diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-12-04 14:31:17 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-12-04 14:31:17 (GMT) |
commit | e524071986aba68956ff4cf18439e3d61ff90ec4 (patch) | |
tree | 5c7e609be153c4f0cbb708e6315d57fc1f9cf16b /src/declarative/qml/parser | |
parent | ee9aee5d85345880d8269c02cfd3c2d86e89c9d3 (diff) | |
download | Qt-e524071986aba68956ff4cf18439e3d61ff90ec4.zip Qt-e524071986aba68956ff4cf18439e3d61ff90ec4.tar.gz Qt-e524071986aba68956ff4cf18439e3d61ff90ec4.tar.bz2 |
small cleanup
make use of QVariant::userType over Qvariant::type
make use of char for 1-string character
QCoreApplication::translate is static
Diffstat (limited to 'src/declarative/qml/parser')
-rw-r--r-- | src/declarative/qml/parser/qmljsgrammar_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/parser/qmljslexer.cpp | 20 | ||||
-rw-r--r-- | src/declarative/qml/parser/qmljsparser.cpp | 14 |
3 files changed, 18 insertions, 18 deletions
diff --git a/src/declarative/qml/parser/qmljsgrammar_p.h b/src/declarative/qml/parser/qmljsgrammar_p.h index d607e8d..3717a1f 100644 --- a/src/declarative/qml/parser/qmljsgrammar_p.h +++ b/src/declarative/qml/parser/qmljsgrammar_p.h @@ -169,7 +169,7 @@ public: }; static const char *const spell []; - static const int lhs []; + static const unsigned char lhs []; static const int rhs []; static const int goto_default []; static const int action_default []; diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp index e9ea604..cf3ed34 100644 --- a/src/declarative/qml/parser/qmljslexer.cpp +++ b/src/declarative/qml/parser/qmljslexer.cpp @@ -49,7 +49,7 @@ #include "qmljsengine_p.h" #include "qmljsgrammar_p.h" -#include <QtGui/qapplication.h> +#include <QtCore/qcoreapplication.h> #include <ctype.h> #include <stdlib.h> @@ -551,7 +551,7 @@ int Lexer::lex() else { setDone(Bad); err = IllegalCharacter; - errmsg = qApp->translate("QmlParser", "Illegal character"); + errmsg = QCoreApplication::translate("QmlParser", "Illegal character"); } } break; @@ -565,7 +565,7 @@ int Lexer::lex() } else if (current == 0 || isLineTerminator()) { setDone(Bad); err = UnclosedStringLiteral; - errmsg = qApp->translate("QmlParser", "Unclosed string at end of line"); + errmsg = QCoreApplication::translate("QmlParser", "Unclosed string at end of line"); } else if (current == '\\') { state = InEscapeSequence; } else { @@ -591,7 +591,7 @@ int Lexer::lex() } else { setDone(Bad); err = IllegalEscapeSequence; - errmsg = qApp->translate("QmlParser", "Illegal escape squence"); + errmsg = QCoreApplication::translate("QmlParser", "Illegal escape squence"); } } else if (current == 'x') state = InHexEscape; @@ -637,7 +637,7 @@ int Lexer::lex() } else { setDone(Bad); err = IllegalUnicodeEscapeSequence; - errmsg = qApp->translate("QmlParser", "Illegal unicode escape sequence"); + errmsg = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence"); } break; case InSingleLineComment: @@ -663,7 +663,7 @@ int Lexer::lex() if (current == 0) { setDone(Bad); err = UnclosedComment; - errmsg = qApp->translate("QmlParser", "Unclosed comment at end of file"); + errmsg = QCoreApplication::translate("QmlParser", "Unclosed comment at end of file"); driver->addComment(startpos, tokenLength(), startlineno, startcolumn); } else if (isLineTerminator()) { shiftWindowsLineBreak(); @@ -750,7 +750,7 @@ int Lexer::lex() } else { setDone(Bad); err = IllegalExponentIndicator; - errmsg = qApp->translate("QmlParser", "Illegal syntax for exponential number"); + errmsg = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number"); } break; case InExponent: @@ -776,7 +776,7 @@ int Lexer::lex() && isIdentLetter(current)) { state = Bad; err = IllegalIdentifier; - errmsg = qApp->translate("QmlParser", "Identifier cannot start with numeric literal"); + errmsg = QCoreApplication::translate("QmlParser", "Identifier cannot start with numeric literal"); } // terminate string @@ -1107,7 +1107,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix) while (1) { if (isLineTerminator() || current == 0) { - errmsg = qApp->translate("QmlParser", "Unterminated regular expression literal"); + errmsg = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal"); return false; } else if (current != '/' || lastWasEscape == true) @@ -1131,7 +1131,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix) while (isIdentLetter(current)) { int flag = Ecma::RegExp::flagFromChar(current); if (flag == 0) { - errmsg = qApp->translate("QmlParser", "Invalid regular expression flag '%0'") + errmsg = QCoreApplication::translate("QmlParser", "Invalid regular expression flag '%0'") .arg(QChar(current)); return false; } diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp index 7a81557..8ca3c30 100644 --- a/src/declarative/qml/parser/qmljsparser.cpp +++ b/src/declarative/qml/parser/qmljsparser.cpp @@ -49,7 +49,7 @@ #include "qmljsnodepool_p.h" #include <QtCore/QtDebug> -#include <QtGui/QApplication> +#include <QtCore/QCoreApplication> #include <QVarLengthArray> #include <string.h> @@ -266,7 +266,7 @@ case 18: { QString text; for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) { text += q->name->asString(); - if (q->next) text += QLatin1String("."); + if (q->next) text += QLatin1Char('.'); } node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId); node->fileNameToken = loc(2); @@ -1722,7 +1722,7 @@ case 337: { yylloc.startColumn += yylloc.length; yylloc.length = 0; - //const QString msg = qApp->translate("QmlParser", "Missing `;'"); + //const QString msg = QCoreApplication::translate("QmlParser", "Missing `;'"); //diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg)); first_token = &token_buffer[0]; @@ -1747,7 +1747,7 @@ case 337: { token_buffer[1].loc = yylloc = location(lexer); if (t_action(errorState, yytoken)) { - const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token])); + const QString msg = QCoreApplication::translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); action = errorState; @@ -1775,7 +1775,7 @@ case 337: { for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { int a = t_action(errorState, *tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = qApp->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(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = *tk; @@ -1798,7 +1798,7 @@ case 337: { int a = t_action(errorState, tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = qApp->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(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = tk; @@ -1811,7 +1811,7 @@ case 337: { } } - const QString msg = qApp->translate("QmlParser", "Syntax error"); + const QString msg = QCoreApplication::translate("QmlParser", "Syntax error"); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); } |