diff options
Diffstat (limited to 'src/tools/qdoc/qmlparser/qqmljskeywords_p.h')
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljskeywords_p.h | 96 |
1 files changed, 60 insertions, 36 deletions
diff --git a/src/tools/qdoc/qmlparser/qqmljskeywords_p.h b/src/tools/qdoc/qmlparser/qqmljskeywords_p.h index 4bb39d077a..7fcf001303 100644 --- a/src/tools/qdoc/qmlparser/qqmljskeywords_p.h +++ b/src/tools/qdoc/qmlparser/qqmljskeywords_p.h @@ -53,10 +53,16 @@ // We mean it. // +#include "qqmljslexer_p.h" + +QT_QML_BEGIN_NAMESPACE + +namespace QQmlJS { + 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') { @@ -74,13 +80,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') { @@ -88,10 +94,17 @@ static inline int classify3(const QChar *s, bool /*qmlMode*/) { } } } + else if (s[0].unicode() == 'g') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 't') { + return Lexer::T_GET; + } + } + } else if (s[0].unicode() == 'i') { if (s[1].unicode() == 'n') { if (s[2].unicode() == 't') { - return Lexer::T_INT; + return qmlMode ? int(Lexer::T_INT) : int(Lexer::T_IDENTIFIER); } } } @@ -102,6 +115,13 @@ static inline int classify3(const QChar *s, bool /*qmlMode*/) { } } } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 't') { + return Lexer::T_SET; + } + } + } else if (s[0].unicode() == 't') { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'y') { @@ -119,12 +139,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 ? int(Lexer::T_BYTE) : int(Lexer::T_IDENTIFIER); } } } @@ -140,7 +160,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 ? int(Lexer::T_CHAR) : int(Lexer::T_IDENTIFIER); } } } @@ -165,7 +185,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 ? int(Lexer::T_GOTO) : int(Lexer::T_IDENTIFIER); } } } @@ -174,7 +194,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 ? int(Lexer::T_LONG) : int(Lexer::T_IDENTIFIER); } } } @@ -225,7 +245,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') { @@ -260,7 +280,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 ? int(Lexer::T_CONST) : int(Lexer::T_RESERVED_WORD); } } } @@ -280,7 +300,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 ? int(Lexer::T_FINAL) : int(Lexer::T_IDENTIFIER); } } } @@ -289,7 +309,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 ? int(Lexer::T_FLOAT) : int(Lexer::T_IDENTIFIER); } } } @@ -300,7 +320,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 ? int(Lexer::T_SHORT) : int(Lexer::T_IDENTIFIER); } } } @@ -309,7 +329,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 ? int(Lexer::T_SUPER) : int(Lexer::T_RESERVED_WORD); } } } @@ -358,7 +378,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 ? int(Lexer::T_DOUBLE) : int(Lexer::T_IDENTIFIER); } } } @@ -384,7 +404,7 @@ static inline int classify6(const QChar *s, bool qmlMode) { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 't') { - return qmlMode ? Lexer::T_IMPORT : Lexer::T_RESERVED_WORD; + return qmlMode ? int(Lexer::T_IMPORT) : int(Lexer::T_RESERVED_WORD); } } } @@ -397,7 +417,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 ? int(Lexer::T_NATIVE) : int(Lexer::T_IDENTIFIER); } } } @@ -410,7 +430,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; } } } @@ -447,7 +467,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 ? int(Lexer::T_STATIC) : int(Lexer::T_IDENTIFIER); } } } @@ -471,7 +491,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 ? int(Lexer::T_THROWS) : int(Lexer::T_IDENTIFIER); } } } @@ -492,7 +512,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') { @@ -500,7 +520,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 ? int(Lexer::T_BOOLEAN) : int(Lexer::T_IDENTIFIER); } } } @@ -560,7 +580,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 ? int(Lexer::T_PACKAGE) : int(Lexer::T_IDENTIFIER); } } } @@ -573,7 +593,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 ? int(Lexer::T_PRIVATE) : int(Lexer::T_IDENTIFIER); } } } @@ -593,7 +613,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 ? int(Lexer::T_ABSTRACT) : int(Lexer::T_IDENTIFIER); } } } @@ -661,7 +681,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; } } } @@ -695,7 +715,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 ? int(Lexer::T_VOLATILE) : int(Lexer::T_IDENTIFIER); } } } @@ -707,7 +727,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') { @@ -717,7 +737,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 ? int(Lexer::T_INTERFACE) : int(Lexer::T_IDENTIFIER); } } } @@ -736,7 +756,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 ? int(Lexer::T_PROTECTED) : int(Lexer::T_IDENTIFIER); } } } @@ -755,7 +775,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 ? int(Lexer::T_TRANSIENT) : int(Lexer::T_IDENTIFIER); } } } @@ -768,7 +788,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') { @@ -779,7 +799,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 ? int(Lexer::T_IMPLEMENTS) : int(Lexer::T_IDENTIFIER); } } } @@ -812,7 +832,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') { @@ -825,7 +845,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 ? int(Lexer::T_SYNCHRONIZED) : int(Lexer::T_IDENTIFIER); } } } @@ -857,4 +877,8 @@ int Lexer::classify(const QChar *s, int n, bool qmlMode) { } // switch } +} // namespace QQmlJS + +QT_QML_END_NAMESPACE + #endif // QQMLJSKEYWORDS_P_H |