QMLJS: Fix punctuation of messages

- Add full stop to the end of messages.
- Use double quotes for emphasis (instead of single quotes).

Change-Id: I5b0bd2cecda115735b67ceaab202c36ca5d81b43
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Leena Miettinen
2016-06-22 13:26:17 +02:00
parent 38c7ce6518
commit aa566604be
2 changed files with 35 additions and 35 deletions

View File

@@ -581,7 +581,7 @@ again:
if (end - begin != chars.size() - 1) {
_errorCode = IllegalExponentIndicator;
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number");
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number.");
return T_ERROR;
}
@@ -674,7 +674,7 @@ again:
if (qmlMode())
break;
_errorCode = IllegalCharacter;
_errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal");
_errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal.");
return T_ERROR;
} else if (_char == QLatin1Char('\\')) {
break;
@@ -720,7 +720,7 @@ again:
u = decodeUnicodeEscapeCharacter(&ok);
if (! ok) {
_errorCode = IllegalUnicodeEscapeSequence;
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence");
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence.");
return T_ERROR;
}
} break;
@@ -731,7 +731,7 @@ again:
u = decodeHexEscapeCharacter(&ok);
if (!ok) {
_errorCode = IllegalHexadecimalEscapeSequence;
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal hexadecimal escape sequence");
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal hexadecimal escape sequence.");
return T_ERROR;
}
} break;
@@ -764,7 +764,7 @@ again:
case '8':
case '9':
_errorCode = IllegalEscapeSequence;
_errorMessage = QCoreApplication::translate("QmlParser", "Octal escape sequences are not allowed");
_errorMessage = QCoreApplication::translate("QmlParser", "Octal escape sequences are not allowed.");
return T_ERROR;
case '\r':
@@ -788,7 +788,7 @@ again:
}
_errorCode = UnclosedStringLiteral;
_errorMessage = QCoreApplication::translate("QmlParser", "Unclosed string at end of line");
_errorMessage = QCoreApplication::translate("QmlParser", "Unclosed string at end of line.");
return T_ERROR;
}
case '0':
@@ -812,7 +812,7 @@ again:
c = decodeUnicodeEscapeCharacter(&ok);
if (! ok) {
_errorCode = IllegalUnicodeEscapeSequence;
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence");
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence.");
return T_ERROR;
}
}
@@ -837,7 +837,7 @@ again:
c = decodeUnicodeEscapeCharacter(&ok);
if (! ok) {
_errorCode = IllegalUnicodeEscapeSequence;
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence");
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence.");
return T_ERROR;
}
if (isIdentifierPart(c))
@@ -900,7 +900,7 @@ int Lexer::scanNumber(QChar ch)
}
} else if (_char.isDigit() && !qmlMode()) {
_errorCode = IllegalCharacter;
_errorMessage = QCoreApplication::translate("QmlParser", "Decimal numbers can't start with '0'");
_errorMessage = QCoreApplication::translate("QmlParser", "Decimal numbers cannot start with \"0\".");
return T_ERROR;
}
@@ -921,7 +921,7 @@ int Lexer::scanNumber(QChar ch)
if (chars.size() < 3) {
_errorCode = IllegalHexNumber;
_errorMessage = QCoreApplication::translate("QmlParser", "At least one hexadecimal digit is required after '0%1'").arg(ch);
_errorMessage = QCoreApplication::translate("QmlParser", "At least one hexadecimal digit is required after \"0%1\".").arg(ch);
return T_ERROR;
}
@@ -997,7 +997,7 @@ int Lexer::scanNumber(QChar ch)
if (end - begin != chars.size() - 1) {
_errorCode = IllegalExponentIndicator;
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number");
_errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number.");
return T_ERROR;
}
@@ -1023,7 +1023,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (isIdentLetter(_char)) {
int flag = regExpFlagFromChar(_char);
if (flag == 0 || _patternFlags & flag) {
_errorMessage = QCoreApplication::translate("QmlParser", "Invalid regular expression flag '%0'")
_errorMessage = QCoreApplication::translate("QmlParser", "Invalid regular expression flag \"%0\".")
.arg(QChar(_char));
return false;
}
@@ -1040,7 +1040,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
scanChar();
if (_codePtr > _endPtr || isLineTerminator()) {
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence");
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence.");
return false;
}
@@ -1062,7 +1062,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
scanChar();
if (_codePtr > _endPtr || isLineTerminator()) {
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence");
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence.");
return false;
}
@@ -1075,7 +1075,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
}
if (_char != QLatin1Char(']')) {
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression class");
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression class.");
return false;
}
@@ -1085,7 +1085,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
default:
if (_codePtr > _endPtr || isLineTerminator()) {
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal");
_errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal.");
return false;
} else {
_tokenText += _char;
@@ -1289,7 +1289,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
if (! (directiveName == QLatin1String("pragma") ||
directiveName == QLatin1String("import"))) {
error->message = QCoreApplication::translate("QmlParser", "Syntax error");
error->message = QCoreApplication::translate("QmlParser", "Syntax error.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // not a valid directive name
@@ -1299,7 +1299,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
if (directiveName == QLatin1String("pragma")) {
// .pragma library
if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("library"))) {
error->message = QCoreApplication::translate("QmlParser", "Syntax error");
error->message = QCoreApplication::translate("QmlParser", "Syntax error.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // expected `library
@@ -1323,7 +1323,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
pathOrUri = tokenText();
if (!pathOrUri.endsWith(QLatin1String("js"))) {
error->message = QCoreApplication::translate("QmlParser","Imported file must be a script");
error->message = QCoreApplication::translate("QmlParser","Imported file must be a script.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1334,7 +1334,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
while (true) {
if (!isUriToken(_tokenKind)) {
error->message = QCoreApplication::translate("QmlParser","Invalid module URI");
error->message = QCoreApplication::translate("QmlParser","Invalid module URI.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1344,7 +1344,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
lex();
if (tokenStartLine() != lineNumber) {
error->message = QCoreApplication::translate("QmlParser","Invalid module URI");
error->message = QCoreApplication::translate("QmlParser","Invalid module URI.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1356,7 +1356,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
lex();
if (tokenStartLine() != lineNumber) {
error->message = QCoreApplication::translate("QmlParser","Invalid module URI");
error->message = QCoreApplication::translate("QmlParser","Invalid module URI.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1364,7 +1364,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
}
if (_tokenKind != T_NUMERIC_LITERAL) {
error->message = QCoreApplication::translate("QmlParser","Module import requires a version");
error->message = QCoreApplication::translate("QmlParser","Module import requires a version.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // expected the module version number
@@ -1378,9 +1378,9 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
//
if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("as") && tokenStartLine() == lineNumber)) {
if (fileImport)
error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier");
error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier.");
else
error->message = QCoreApplication::translate("QmlParser", "Module import requires a qualifier");
error->message = QCoreApplication::translate("QmlParser", "Module import requires a qualifier.");
if (tokenStartLine() != lineNumber) {
error->loc.startLine = lineNumber;
error->loc.startColumn = column;
@@ -1393,9 +1393,9 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
if (lex() != T_IDENTIFIER || tokenStartLine() != lineNumber) {
if (fileImport)
error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier");
error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier.");
else
error->message = QCoreApplication::translate("QmlParser", "Module import requires a qualifier");
error->message = QCoreApplication::translate("QmlParser", "Module import requires a qualifier.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // expected module name
@@ -1403,7 +1403,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
const QString module = tokenText();
if (!module.at(0).isUpper()) {
error->message = QCoreApplication::translate("QmlParser","Invalid import qualifier");
error->message = QCoreApplication::translate("QmlParser","Invalid import qualifier.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1416,7 +1416,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
}
if (tokenStartLine() != lineNumber) {
error->message = QCoreApplication::translate("QmlParser", "Syntax error");
error->message = QCoreApplication::translate("QmlParser", "Syntax error.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // the directives cannot span over multiple lines