qmljs/parser: update to latest qt5 parser

fix error semicolon insertion of loops, strict mode
Change-Id: I311733ffb34269d1cee7e576d05af78893b2bcbb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Fawzi Mohamed
2013-01-22 11:15:23 +01:00
committed by Erik Verbruggen
parent 111872591e
commit f0e4df5826
14 changed files with 1141 additions and 1016 deletions

View File

@@ -44,7 +44,7 @@
static inline int classify2(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 'a') {
if (s[1].unicode() == 's') {
return qmlMode ? Lexer::T_AS : Lexer::T_RESERVED_WORD;
return qmlMode ? Lexer::T_AS : Lexer::T_IDENTIFIER;
}
}
else if (s[0].unicode() == 'd') {
@@ -62,13 +62,13 @@ static inline int classify2(const QChar *s, bool qmlMode) {
}
else if (qmlMode && s[0].unicode() == 'o') {
if (s[1].unicode() == 'n') {
return Lexer::T_ON;
return qmlMode ? Lexer::T_ON : Lexer::T_IDENTIFIER;
}
}
return Lexer::T_IDENTIFIER;
}
static inline int classify3(const QChar *s, bool /*qmlMode*/) {
static inline int classify3(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 'f') {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 'r') {
@@ -79,7 +79,7 @@ static inline int classify3(const QChar *s, bool /*qmlMode*/) {
else if (s[0].unicode() == 'i') {
if (s[1].unicode() == 'n') {
if (s[2].unicode() == 't') {
return Lexer::T_INT;
return qmlMode ? Lexer::T_INT : Lexer::T_IDENTIFIER;
}
}
}
@@ -107,12 +107,12 @@ static inline int classify3(const QChar *s, bool /*qmlMode*/) {
return Lexer::T_IDENTIFIER;
}
static inline int classify4(const QChar *s, bool /*qmlMode*/) {
static inline int classify4(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 'b') {
if (s[1].unicode() == 'y') {
if (s[2].unicode() == 't') {
if (s[3].unicode() == 'e') {
return Lexer::T_BYTE;
return qmlMode ? Lexer::T_BYTE : Lexer::T_IDENTIFIER;
}
}
}
@@ -128,7 +128,7 @@ static inline int classify4(const QChar *s, bool /*qmlMode*/) {
else if (s[1].unicode() == 'h') {
if (s[2].unicode() == 'a') {
if (s[3].unicode() == 'r') {
return Lexer::T_CHAR;
return qmlMode ? Lexer::T_CHAR : Lexer::T_IDENTIFIER;
}
}
}
@@ -153,7 +153,7 @@ static inline int classify4(const QChar *s, bool /*qmlMode*/) {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 't') {
if (s[3].unicode() == 'o') {
return Lexer::T_GOTO;
return qmlMode ? Lexer::T_GOTO : Lexer::T_IDENTIFIER;
}
}
}
@@ -162,7 +162,7 @@ static inline int classify4(const QChar *s, bool /*qmlMode*/) {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 'g') {
return Lexer::T_LONG;
return qmlMode ? Lexer::T_LONG : Lexer::T_IDENTIFIER;
}
}
}
@@ -213,7 +213,7 @@ static inline int classify4(const QChar *s, bool /*qmlMode*/) {
return Lexer::T_IDENTIFIER;
}
static inline int classify5(const QChar *s, bool /*qmlMode*/) {
static inline int classify5(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 'b') {
if (s[1].unicode() == 'r') {
if (s[2].unicode() == 'e') {
@@ -248,7 +248,7 @@ static inline int classify5(const QChar *s, bool /*qmlMode*/) {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 's') {
if (s[4].unicode() == 't') {
return Lexer::T_CONST;
return qmlMode ? Lexer::T_CONST : Lexer::T_RESERVED_WORD;
}
}
}
@@ -268,7 +268,7 @@ static inline int classify5(const QChar *s, bool /*qmlMode*/) {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 'a') {
if (s[4].unicode() == 'l') {
return Lexer::T_FINAL;
return qmlMode ? Lexer::T_FINAL : Lexer::T_IDENTIFIER;
}
}
}
@@ -277,7 +277,7 @@ static inline int classify5(const QChar *s, bool /*qmlMode*/) {
if (s[2].unicode() == 'o') {
if (s[3].unicode() == 'a') {
if (s[4].unicode() == 't') {
return Lexer::T_FLOAT;
return qmlMode ? Lexer::T_FLOAT : Lexer::T_IDENTIFIER;
}
}
}
@@ -288,7 +288,7 @@ static inline int classify5(const QChar *s, bool /*qmlMode*/) {
if (s[2].unicode() == 'o') {
if (s[3].unicode() == 'r') {
if (s[4].unicode() == 't') {
return Lexer::T_SHORT;
return qmlMode ? Lexer::T_SHORT : Lexer::T_IDENTIFIER;
}
}
}
@@ -297,7 +297,7 @@ static inline int classify5(const QChar *s, bool /*qmlMode*/) {
if (s[2].unicode() == 'p') {
if (s[3].unicode() == 'e') {
if (s[4].unicode() == 'r') {
return Lexer::T_SUPER;
return qmlMode ? Lexer::T_SUPER : Lexer::T_IDENTIFIER;
}
}
}
@@ -346,7 +346,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'b') {
if (s[4].unicode() == 'l') {
if (s[5].unicode() == 'e') {
return Lexer::T_DOUBLE;
return qmlMode ? Lexer::T_DOUBLE : Lexer::T_IDENTIFIER;
}
}
}
@@ -385,7 +385,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'i') {
if (s[4].unicode() == 'v') {
if (s[5].unicode() == 'e') {
return Lexer::T_NATIVE;
return qmlMode ? Lexer::T_NATIVE : Lexer::T_IDENTIFIER;
}
}
}
@@ -398,7 +398,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'l') {
if (s[4].unicode() == 'i') {
if (s[5].unicode() == 'c') {
return qmlMode ? Lexer::T_PUBLIC : Lexer::T_RESERVED_WORD;
return qmlMode ? Lexer::T_PUBLIC : Lexer::T_IDENTIFIER;
}
}
}
@@ -435,7 +435,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 't') {
if (s[4].unicode() == 'i') {
if (s[5].unicode() == 'c') {
return Lexer::T_STATIC;
return qmlMode ? Lexer::T_STATIC : Lexer::T_IDENTIFIER;
}
}
}
@@ -459,7 +459,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'o') {
if (s[4].unicode() == 'w') {
if (s[5].unicode() == 's') {
return Lexer::T_THROWS;
return qmlMode ? Lexer::T_THROWS : Lexer::T_IDENTIFIER;
}
}
}
@@ -480,7 +480,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
return Lexer::T_IDENTIFIER;
}
static inline int classify7(const QChar *s, bool /*qmlMode*/) {
static inline int classify7(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 'b') {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 'o') {
@@ -488,7 +488,7 @@ static inline int classify7(const QChar *s, bool /*qmlMode*/) {
if (s[4].unicode() == 'e') {
if (s[5].unicode() == 'a') {
if (s[6].unicode() == 'n') {
return Lexer::T_BOOLEAN;
return qmlMode ? Lexer::T_BOOLEAN : Lexer::T_IDENTIFIER;
}
}
}
@@ -548,7 +548,7 @@ static inline int classify7(const QChar *s, bool /*qmlMode*/) {
if (s[4].unicode() == 'a') {
if (s[5].unicode() == 'g') {
if (s[6].unicode() == 'e') {
return Lexer::T_PACKAGE;
return qmlMode ? Lexer::T_PACKAGE : Lexer::T_IDENTIFIER;
}
}
}
@@ -561,7 +561,7 @@ static inline int classify7(const QChar *s, bool /*qmlMode*/) {
if (s[4].unicode() == 'a') {
if (s[5].unicode() == 't') {
if (s[6].unicode() == 'e') {
return Lexer::T_PRIVATE;
return qmlMode ? Lexer::T_PRIVATE : Lexer::T_IDENTIFIER;
}
}
}
@@ -581,7 +581,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
if (s[5].unicode() == 'a') {
if (s[6].unicode() == 'c') {
if (s[7].unicode() == 't') {
return Lexer::T_ABSTRACT;
return qmlMode ? Lexer::T_ABSTRACT : Lexer::T_IDENTIFIER;
}
}
}
@@ -649,7 +649,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
if (s[5].unicode() == 'r') {
if (s[6].unicode() == 't') {
if (s[7].unicode() == 'y') {
return Lexer::T_PROPERTY;
return qmlMode ? Lexer::T_PROPERTY : Lexer::T_IDENTIFIER;
}
}
}
@@ -683,7 +683,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
if (s[5].unicode() == 'i') {
if (s[6].unicode() == 'l') {
if (s[7].unicode() == 'e') {
return Lexer::T_VOLATILE;
return qmlMode ? Lexer::T_VOLATILE : Lexer::T_IDENTIFIER;
}
}
}
@@ -695,7 +695,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
return Lexer::T_IDENTIFIER;
}
static inline int classify9(const QChar *s, bool /*qmlMode*/) {
static inline int classify9(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 'i') {
if (s[1].unicode() == 'n') {
if (s[2].unicode() == 't') {
@@ -705,7 +705,7 @@ static inline int classify9(const QChar *s, bool /*qmlMode*/) {
if (s[6].unicode() == 'a') {
if (s[7].unicode() == 'c') {
if (s[8].unicode() == 'e') {
return Lexer::T_INTERFACE;
return qmlMode ? Lexer::T_INTERFACE : Lexer::T_IDENTIFIER;
}
}
}
@@ -724,7 +724,7 @@ static inline int classify9(const QChar *s, bool /*qmlMode*/) {
if (s[6].unicode() == 't') {
if (s[7].unicode() == 'e') {
if (s[8].unicode() == 'd') {
return Lexer::T_PROTECTED;
return qmlMode ? Lexer::T_PROTECTED : Lexer::T_IDENTIFIER;
}
}
}
@@ -743,7 +743,7 @@ static inline int classify9(const QChar *s, bool /*qmlMode*/) {
if (s[6].unicode() == 'e') {
if (s[7].unicode() == 'n') {
if (s[8].unicode() == 't') {
return Lexer::T_TRANSIENT;
return qmlMode ? Lexer::T_TRANSIENT : Lexer::T_IDENTIFIER;
}
}
}
@@ -756,7 +756,7 @@ static inline int classify9(const QChar *s, bool /*qmlMode*/) {
return Lexer::T_IDENTIFIER;
}
static inline int classify10(const QChar *s, bool /*qmlMode*/) {
static inline int classify10(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 'i') {
if (s[1].unicode() == 'm') {
if (s[2].unicode() == 'p') {
@@ -767,7 +767,7 @@ static inline int classify10(const QChar *s, bool /*qmlMode*/) {
if (s[7].unicode() == 'n') {
if (s[8].unicode() == 't') {
if (s[9].unicode() == 's') {
return Lexer::T_IMPLEMENTS;
return qmlMode ? Lexer::T_IMPLEMENTS : Lexer::T_IDENTIFIER;
}
}
}
@@ -800,7 +800,7 @@ static inline int classify10(const QChar *s, bool /*qmlMode*/) {
return Lexer::T_IDENTIFIER;
}
static inline int classify12(const QChar *s, bool /*qmlMode*/) {
static inline int classify12(const QChar *s, bool qmlMode) {
if (s[0].unicode() == 's') {
if (s[1].unicode() == 'y') {
if (s[2].unicode() == 'n') {
@@ -813,7 +813,7 @@ static inline int classify12(const QChar *s, bool /*qmlMode*/) {
if (s[9].unicode() == 'z') {
if (s[10].unicode() == 'e') {
if (s[11].unicode() == 'd') {
return Lexer::T_SYNCHRONIZED;
return qmlMode ? Lexer::T_SYNCHRONIZED : Lexer::T_IDENTIFIER;
}
}
}