From aa566604becbfbe0001369e89ef909fb4c357ddd Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 22 Jun 2016 13:26:17 +0200 Subject: [PATCH] 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 --- src/libs/qmljs/parser/qmljslexer.cpp | 58 +++++++++++++-------------- src/libs/qmljs/parser/qmljsparser.cpp | 12 +++--- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/libs/qmljs/parser/qmljslexer.cpp b/src/libs/qmljs/parser/qmljslexer.cpp index 62e40d94937..8ab06dc7ecf 100644 --- a/src/libs/qmljs/parser/qmljslexer.cpp +++ b/src/libs/qmljs/parser/qmljslexer.cpp @@ -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 diff --git a/src/libs/qmljs/parser/qmljsparser.cpp b/src/libs/qmljs/parser/qmljsparser.cpp index 4d92c51cd4f..bddfe95d27b 100644 --- a/src/libs/qmljs/parser/qmljsparser.cpp +++ b/src/libs/qmljs/parser/qmljsparser.cpp @@ -1799,7 +1799,7 @@ case 355: { yylloc.startColumn += yylloc.length; yylloc.length = 0; - //const QString msg = QCoreApplication::translate("QmlParser", "Missing `;'"); + //const QString msg = QCoreApplication::translate("QmlParser", "Missing \";\"."); //diagnostic_messages.append(DiagnosticMessage(Severity::Warning, yylloc, msg)); first_token = &token_buffer[0]; @@ -1829,9 +1829,9 @@ case 355: { QString msg; int token = token_buffer[0].token; if (token < 0 || token >= TERMINAL_COUNT) - msg = QCoreApplication::translate("QmlParser", "Syntax error"); + msg = QCoreApplication::translate("QmlParser", "Syntax error."); else - msg = QCoreApplication::translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); + msg = QCoreApplication::translate("QmlParser", "Unexpected token \"%1\".").arg(QLatin1String(spell[token])); diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg)); action = errorState; @@ -1859,7 +1859,7 @@ case 355: { for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { int a = t_action(errorState, *tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); + const QString msg = QCoreApplication::translate("QmlParser", "Expected token \"%1\".").arg(QLatin1String(spell[*tk])); diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg)); yytoken = *tk; @@ -1883,7 +1883,7 @@ case 355: { int a = t_action(errorState, tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); + const QString msg = QCoreApplication::translate("QmlParser", "Expected token \"%1\".").arg(QLatin1String(spell[tk])); diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg)); yytoken = tk; @@ -1896,7 +1896,7 @@ case 355: { } } - const QString msg = QCoreApplication::translate("QmlParser", "Syntax error"); + const QString msg = QCoreApplication::translate("QmlParser", "Syntax error."); diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg)); }