UI text: fix qmljs messages

Added punctuation.

Change-Id: I737a66bb505221ff92d295c4e4b30446a099a15b
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Leena Miettinen
2013-02-08 17:12:45 +01:00
committed by Thomas Hartmann
parent 3e1f2521cc
commit 62f13deaf3
2 changed files with 60 additions and 60 deletions

View File

@@ -129,7 +129,7 @@ bool SimpleAbstractStreamReader::readFile(const QString &fileName)
file.close();
return readFromSource(QString::fromLocal8Bit(source));
}
addError(tr("Cannot find file %1").arg(fileName));
addError(tr("Cannot find file %1.").arg(fileName));
return false;
}
@@ -176,13 +176,13 @@ AST::SourceLocation SimpleAbstractStreamReader::currentSourceLocation() const
bool SimpleAbstractStreamReader::readDocument(AST::UiProgram *ast)
{
if (!ast) {
addError(tr("Could not parse document"));
addError(tr("Could not parse document."));
return false;
}
AST::UiObjectDefinition *uiObjectDefinition = AST::cast<AST::UiObjectDefinition *>(ast->members->member);
if (!uiObjectDefinition) {
addError(tr("Expected document to contain a single object definition"));
addError(tr("Expected document to contain a single object definition."));
return false;
}
readChild(uiObjectDefinition);
@@ -246,7 +246,7 @@ QVariant SimpleAbstractStreamReader::parsePropertyScriptBinding(AST::UiScriptBin
AST::ExpressionStatement *expStmt = AST::cast<AST::ExpressionStatement *>(uiScriptBinding->statement);
if (!expStmt) {
addError(tr("Expected expression statement after colon"), uiScriptBinding->statement->firstSourceLocation());
addError(tr("Expected expression statement after colon."), uiScriptBinding->statement->firstSourceLocation());
return QVariant();
}
@@ -282,7 +282,7 @@ QVariant SimpleAbstractStreamReader::parsePropertyExpression(AST::ExpressionNode
if (numericLiteral)
return numericLiteral->value;
addError(tr("Expected expression statement to be a literal"), expressionNode->firstSourceLocation());
addError(tr("Expected expression statement to be a literal."), expressionNode->firstSourceLocation());
return QVariant();
}
@@ -340,7 +340,7 @@ void SimpleReader::propertyDefinition(const QString &name, const QVariant &value
qDebug() << "SimpleReader::propertyDefinition()" << m_currentNode.data()->name() << name << value;
if (m_currentNode.data()->propertyNames().contains(name))
addError(tr("Property is defined twice"), currentSourceLocation());
addError(tr("Property is defined twice."), currentSourceLocation());
m_currentNode.data()->setProperty(name, value);
}

View File

@@ -95,18 +95,18 @@ QString TypeDescriptionReader::warningMessage() const
void TypeDescriptionReader::readDocument(UiProgram *ast)
{
if (!ast) {
addError(SourceLocation(), tr("Could not parse document"));
addError(SourceLocation(), tr("Could not parse document."));
return;
}
if (!ast->imports || ast->imports->next) {
addError(SourceLocation(), tr("Expected a single import"));
addError(SourceLocation(), tr("Expected a single import."));
return;
}
UiImport *import = ast->imports->import;
if (toString(import->importUri) != QLatin1String("QtQuick.tooling")) {
addError(import->importToken, tr("Expected import of QtQuick.tooling"));
addError(import->importToken, tr("Expected import of QtQuick.tooling."));
return;
}
@@ -118,23 +118,23 @@ void TypeDescriptionReader::readDocument(UiProgram *ast)
versionString.mid(dotIdx + 1).toInt());
}
if (version > ComponentVersion(1, 1)) {
addError(import->versionToken, tr("Expected version 1.1 or lower"));
addError(import->versionToken, tr("Expected version 1.1 or lower."));
return;
}
if (!ast->members || !ast->members->member || ast->members->next) {
addError(SourceLocation(), tr("Expected document to contain a single object definition"));
addError(SourceLocation(), tr("Expected document to contain a single object definition."));
return;
}
UiObjectDefinition *module = dynamic_cast<UiObjectDefinition *>(ast->members->member);
if (!module) {
addError(SourceLocation(), tr("Expected document to contain a single object definition"));
addError(SourceLocation(), tr("Expected document to contain a single object definition."));
return;
}
if (toString(module->qualifiedTypeNameId) != QLatin1String("Module")) {
addError(SourceLocation(), tr("Expected document to contain a Module {} member"));
addError(SourceLocation(), tr("Expected document to contain a Module {} member."));
return;
}
@@ -153,7 +153,7 @@ void TypeDescriptionReader::readModule(UiObjectDefinition *ast)
if (!component || (typeName != QLatin1String("Component") && typeName != QLatin1String("ModuleApi"))) {
addWarning(member->firstSourceLocation(),
tr("Expected only 'Component' and 'ModuleApi' object definitions"));
tr("Expected only Component and ModuleApi object definitions."));
continue;
}
@@ -197,7 +197,7 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
else if (name == QLatin1String("Enum"))
readEnum(component, fmo);
else
addWarning(component->firstSourceLocation(), tr("Expected only Property, Method, Signal and Enum object definitions"));
addWarning(component->firstSourceLocation(), tr("Expected only Property, Method, Signal and Enum object definitions."));
} else if (script) {
QString name = toString(script->qualifiedId);
if (name == QLatin1String("name")) {
@@ -215,15 +215,15 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
} else {
addWarning(script->firstSourceLocation(),
tr("Expected only name, prototype, defaultProperty, attachedType, exports "
"and exportMetaObjectRevisions script bindings"));
"and exportMetaObjectRevisions script bindings."));
}
} else {
addWarning(member->firstSourceLocation(), tr("Expected only script bindings and object definitions"));
addWarning(member->firstSourceLocation(), tr("Expected only script bindings and object definitions."));
}
}
if (fmo->className().isEmpty()) {
addError(ast->firstSourceLocation(), tr("Component definition is missing a name binding"));
addError(ast->firstSourceLocation(), tr("Component definition is missing a name binding."));
return;
}
@@ -250,15 +250,15 @@ void TypeDescriptionReader::readModuleApi(UiObjectDefinition *ast)
apiInfo.cppName = readStringBinding(script);
} else {
addWarning(script->firstSourceLocation(),
tr("Expected only uri, version and name script bindings"));
tr("Expected only uri, version and name script bindings."));
}
} else {
addWarning(member->firstSourceLocation(), tr("Expected only script bindings"));
addWarning(member->firstSourceLocation(), tr("Expected only script bindings."));
}
}
if (!apiInfo.version.isValid()) {
addError(ast->firstSourceLocation(), tr("ModuleApi definition has no or invalid 'version' binding"));
addError(ast->firstSourceLocation(), tr("ModuleApi definition has no or invalid version binding."));
return;
}
@@ -284,7 +284,7 @@ void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isM
if (name == QLatin1String("Parameter"))
readParameter(component, &fmm);
else
addWarning(component->firstSourceLocation(), tr("Expected only Parameter object definitions"));
addWarning(component->firstSourceLocation(), tr("Expected only Parameter object definitions."));
} else if (script) {
QString name = toString(script->qualifiedId);
if (name == QLatin1String("name"))
@@ -294,15 +294,15 @@ void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isM
else if (name == QLatin1String("revision"))
fmm.setRevision(readIntBinding(script));
else
addWarning(script->firstSourceLocation(), tr("Expected only name and type script bindings"));
addWarning(script->firstSourceLocation(), tr("Expected only name and type script bindings."));
} else {
addWarning(member->firstSourceLocation(), tr("Expected only script bindings and object definitions"));
addWarning(member->firstSourceLocation(), tr("Expected only script bindings and object definitions."));
}
}
if (fmm.methodName().isEmpty()) {
addError(ast->firstSourceLocation(), tr("Method or Signal is missing a name script binding"));
addError(ast->firstSourceLocation(), tr("Method or signal is missing a name script binding."));
return;
}
@@ -322,7 +322,7 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject
UiObjectMember *member = it->member;
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (!script) {
addWarning(member->firstSourceLocation(), tr("Expected script binding"));
addWarning(member->firstSourceLocation(), tr("Expected script binding."));
continue;
}
@@ -340,11 +340,11 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject
else if (id == QLatin1String("revision"))
revision = readIntBinding(script);
else
addWarning(script->firstSourceLocation(), tr("Expected only type, name, revision, isPointer, isReadonly and isList script bindings"));
addWarning(script->firstSourceLocation(), tr("Expected only type, name, revision, isPointer, isReadonly and isList script bindings."));
}
if (name.isEmpty() || type.isEmpty()) {
addError(ast->firstSourceLocation(), tr("Property object is missing a name or type script binding"));
addError(ast->firstSourceLocation(), tr("Property object is missing a name or type script binding."));
return;
}
@@ -359,7 +359,7 @@ void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, FakeMetaObject::Pt
UiObjectMember *member = it->member;
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (!script) {
addWarning(member->firstSourceLocation(), tr("Expected script binding"));
addWarning(member->firstSourceLocation(), tr("Expected script binding."));
continue;
}
@@ -369,7 +369,7 @@ void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, FakeMetaObject::Pt
else if (name == QLatin1String("values"))
readEnumValues(script, &fme);
else
addWarning(script->firstSourceLocation(), tr("Expected only name and values script bindings"));
addWarning(script->firstSourceLocation(), tr("Expected only name and values script bindings".));
}
fmo->addEnum(fme);
@@ -384,7 +384,7 @@ void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, FakeMetaMetho
UiObjectMember *member = it->member;
UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member);
if (!script) {
addWarning(member->firstSourceLocation(), tr("Expected script binding"));
addWarning(member->firstSourceLocation(), tr("Expected script binding."));
continue;
}
@@ -400,7 +400,7 @@ void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, FakeMetaMetho
} else if (id == QLatin1String("isList")) {
// ### unhandled
} else {
addWarning(script->firstSourceLocation(), tr("Expected only name and type script bindings"));
addWarning(script->firstSourceLocation(), tr("Expected only name and type script bindings."));
}
}
@@ -410,19 +410,19 @@ void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, FakeMetaMetho
QString TypeDescriptionReader::readStringBinding(UiScriptBinding *ast)
{
if (!ast || !ast->statement) {
addError(ast->colonToken, tr("Expected string after colon"));
addError(ast->colonToken, tr("Expected string after colon."));
return QString();
}
ExpressionStatement *expStmt = dynamic_cast<ExpressionStatement *>(ast->statement);
if (!expStmt) {
addError(ast->statement->firstSourceLocation(), tr("Expected string after colon"));
addError(ast->statement->firstSourceLocation(), tr("Expected string after colon."));
return QString();
}
StringLiteral *stringLit = dynamic_cast<StringLiteral *>(expStmt->expression);
if (!stringLit) {
addError(expStmt->firstSourceLocation(), tr("Expected string after colon"));
addError(expStmt->firstSourceLocation(), tr("Expected string after colon."));
return QString();
}
@@ -432,20 +432,20 @@ QString TypeDescriptionReader::readStringBinding(UiScriptBinding *ast)
bool TypeDescriptionReader::readBoolBinding(AST::UiScriptBinding *ast)
{
if (!ast || !ast->statement) {
addError(ast->colonToken, tr("Expected boolean after colon"));
addError(ast->colonToken, tr("Expected boolean after colon."));
return false;
}
ExpressionStatement *expStmt = dynamic_cast<ExpressionStatement *>(ast->statement);
if (!expStmt) {
addError(ast->statement->firstSourceLocation(), tr("Expected boolean after colon"));
addError(ast->statement->firstSourceLocation(), tr("Expected boolean after colon."));
return false;
}
TrueLiteral *trueLit = dynamic_cast<TrueLiteral *>(expStmt->expression);
FalseLiteral *falseLit = dynamic_cast<FalseLiteral *>(expStmt->expression);
if (!trueLit && !falseLit) {
addError(expStmt->firstSourceLocation(), tr("Expected true or false after colon"));
addError(expStmt->firstSourceLocation(), tr("Expected true or false after colon."));
return false;
}
@@ -455,19 +455,19 @@ bool TypeDescriptionReader::readBoolBinding(AST::UiScriptBinding *ast)
double TypeDescriptionReader::readNumericBinding(AST::UiScriptBinding *ast)
{
if (!ast || !ast->statement) {
addError(ast->colonToken, tr("Expected numeric literal after colon"));
addError(ast->colonToken, tr("Expected numeric literal after colon."));
return 0;
}
ExpressionStatement *expStmt = AST::cast<ExpressionStatement *>(ast->statement);
if (!expStmt) {
addError(ast->statement->firstSourceLocation(), tr("Expected numeric literal after colon"));
addError(ast->statement->firstSourceLocation(), tr("Expected numeric literal after colon."));
return 0;
}
NumericLiteral *numericLit = AST::cast<NumericLiteral *>(expStmt->expression);
if (!numericLit) {
addError(expStmt->firstSourceLocation(), tr("Expected numeric literal after colon"));
addError(expStmt->firstSourceLocation(), tr("Expected numeric literal after colon."));
return 0;
}
@@ -479,19 +479,19 @@ ComponentVersion TypeDescriptionReader::readNumericVersionBinding(UiScriptBindin
ComponentVersion invalidVersion;
if (!ast || !ast->statement) {
addError(ast->colonToken, tr("Expected numeric literal after colon"));
addError(ast->colonToken, tr("Expected numeric literal after colon."));
return invalidVersion;
}
ExpressionStatement *expStmt = AST::cast<ExpressionStatement *>(ast->statement);
if (!expStmt) {
addError(ast->statement->firstSourceLocation(), tr("Expected numeric literal after colon"));
addError(ast->statement->firstSourceLocation(), tr("Expected numeric literal after colon."));
return invalidVersion;
}
NumericLiteral *numericLit = AST::cast<NumericLiteral *>(expStmt->expression);
if (!numericLit) {
addError(expStmt->firstSourceLocation(), tr("Expected numeric literal after colon"));
addError(expStmt->firstSourceLocation(), tr("Expected numeric literal after colon."));
return invalidVersion;
}
@@ -504,7 +504,7 @@ int TypeDescriptionReader::readIntBinding(AST::UiScriptBinding *ast)
int i = static_cast<int>(v);
if (i != v) {
addError(ast->firstSourceLocation(), tr("Expected integer after colon"));
addError(ast->firstSourceLocation(), tr("Expected integer after colon."));
return 0;
}
@@ -514,26 +514,26 @@ int TypeDescriptionReader::readIntBinding(AST::UiScriptBinding *ast)
void TypeDescriptionReader::readExports(UiScriptBinding *ast, FakeMetaObject::Ptr fmo)
{
if (!ast || !ast->statement) {
addError(ast->colonToken, tr("Expected array of strings after colon"));
addError(ast->colonToken, tr("Expected array of strings after colon."));
return;
}
ExpressionStatement *expStmt = dynamic_cast<ExpressionStatement *>(ast->statement);
if (!expStmt) {
addError(ast->statement->firstSourceLocation(), tr("Expected array of strings after colon"));
addError(ast->statement->firstSourceLocation(), tr("Expected array of strings after colon."));
return;
}
ArrayLiteral *arrayLit = dynamic_cast<ArrayLiteral *>(expStmt->expression);
if (!arrayLit) {
addError(expStmt->firstSourceLocation(), tr("Expected array of strings after colon"));
addError(expStmt->firstSourceLocation(), tr("Expected array of strings after colon."));
return;
}
for (ElementList *it = arrayLit->elements; it; it = it->next) {
StringLiteral *stringLit = dynamic_cast<StringLiteral *>(it->expression);
if (!stringLit) {
addError(arrayLit->firstSourceLocation(), tr("Expected array literal with only string literal members"));
addError(arrayLit->firstSourceLocation(), tr("Expected array literal with only string literal members."));
return;
}
QString exp = stringLit->value.toString();
@@ -542,7 +542,7 @@ void TypeDescriptionReader::readExports(UiScriptBinding *ast, FakeMetaObject::Pt
ComponentVersion version(exp.mid(spaceIdx + 1));
if (spaceIdx == -1 || !version.isValid()) {
addError(stringLit->firstSourceLocation(), tr("Expected string literal to contain 'Package/Name major.minor' or 'Name major.minor'"));
addError(stringLit->firstSourceLocation(), tr("Expected string literal to contain 'Package/Name major.minor' or 'Name major.minor'."));
continue;
}
QString package;
@@ -558,19 +558,19 @@ void TypeDescriptionReader::readExports(UiScriptBinding *ast, FakeMetaObject::Pt
void TypeDescriptionReader::readMetaObjectRevisions(UiScriptBinding *ast, FakeMetaObject::Ptr fmo)
{
if (!ast || !ast->statement) {
addError(ast->colonToken, tr("Expected array of numbers after colon"));
addError(ast->colonToken, tr("Expected array of numbers after colon."));
return;
}
ExpressionStatement *expStmt = dynamic_cast<ExpressionStatement *>(ast->statement);
if (!expStmt) {
addError(ast->statement->firstSourceLocation(), tr("Expected array of numbers after colon"));
addError(ast->statement->firstSourceLocation(), tr("Expected array of numbers after colon."));
return;
}
ArrayLiteral *arrayLit = dynamic_cast<ArrayLiteral *>(expStmt->expression);
if (!arrayLit) {
addError(expStmt->firstSourceLocation(), tr("Expected array of numbers after colon"));
addError(expStmt->firstSourceLocation(), tr("Expected array of numbers after colon."));
return;
}
@@ -579,19 +579,19 @@ void TypeDescriptionReader::readMetaObjectRevisions(UiScriptBinding *ast, FakeMe
for (ElementList *it = arrayLit->elements; it; it = it->next, ++exportIndex) {
NumericLiteral *numberLit = cast<NumericLiteral *>(it->expression);
if (!numberLit) {
addError(arrayLit->firstSourceLocation(), tr("Expected array literal with only number literal members"));
addError(arrayLit->firstSourceLocation(), tr("Expected array literal with only number literal members."));
return;
}
if (exportIndex >= exportCount) {
addError(numberLit->firstSourceLocation(), tr("Meta object revision without matching export"));
addError(numberLit->firstSourceLocation(), tr("Meta object revision without matching export."));
return;
}
const double v = numberLit->value;
const int metaObjectRevision = static_cast<int>(v);
if (metaObjectRevision != v) {
addError(numberLit->firstSourceLocation(), tr("Expected integer"));
addError(numberLit->firstSourceLocation(), tr("Expected integer."));
return;
}
@@ -602,19 +602,19 @@ void TypeDescriptionReader::readMetaObjectRevisions(UiScriptBinding *ast, FakeMe
void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUtils::FakeMetaEnum *fme)
{
if (!ast || !ast->statement) {
addError(ast->colonToken, tr("Expected object literal after colon"));
addError(ast->colonToken, tr("Expected object literal after colon."));
return;
}
ExpressionStatement *expStmt = dynamic_cast<ExpressionStatement *>(ast->statement);
if (!expStmt) {
addError(ast->statement->firstSourceLocation(), tr("Expected object literal after colon"));
addError(ast->statement->firstSourceLocation(), tr("Expected object literal after colon."));
return;
}
ObjectLiteral *objectLit = dynamic_cast<ObjectLiteral *>(expStmt->expression);
if (!objectLit) {
addError(expStmt->firstSourceLocation(), tr("Expected object literal after colon"));
addError(expStmt->firstSourceLocation(), tr("Expected object literal after colon."));
return;
}
@@ -625,7 +625,7 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt
if (minus)
value = dynamic_cast<NumericLiteral *>(minus->expression);
if (!propName || !value) {
addError(objectLit->firstSourceLocation(), tr("Expected object literal to contain only 'string: number' elements"));
addError(objectLit->firstSourceLocation(), tr("Expected object literal to contain only 'string: number' elements."));
continue;
}