diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-03-02 11:02:06 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-04-25 17:50:12 +0000 |
commit | 70251c5ee7e2c96dac19e49b6ce69a55d78994a4 (patch) | |
tree | 330f295e7129151b28db5fbe22636c65963ec55c /src/qml/parser/qqmljskeywords_p.h | |
parent | 19d3b7eb4c5fd806ea519771549df14ac965b79e (diff) |
Bring JS grammar in line with ES7 spec
This basically updates all grammar rules in the
qqmljs.g file to be in line with the ES7 specification.
Some special handling for the lookahead rules appearing
in the spec was needed and is implemented through empty
lookahead rules in the grammar, that might push an
additional token into the token stream.
Renamed some classes in the AST to be in line with
the names used in ES7, and removed some other ones
(SourceElements) that are no longer used.
The ES7 grammar rules contain lots of variations of
the base rules (with In/Return/Yield/Default suffixes).
With the exception of the In and Default rules, these
are implemented through state tracking in the parser
and lexer.
Change-Id: I4017d97cd050ed816c1dad11833e882cba30801a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljskeywords_p.h')
-rw-r--r-- | src/qml/parser/qqmljskeywords_p.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljskeywords_p.h b/src/qml/parser/qqmljskeywords_p.h index f20f341b7b..e2ae66d796 100644 --- a/src/qml/parser/qqmljskeywords_p.h +++ b/src/qml/parser/qqmljskeywords_p.h @@ -186,6 +186,15 @@ static inline int classify4(const QChar *s, int parseModeFlags) { } } } + else if (s[0].unicode() == 'f') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'o') { + if (s[3].unicode() == 'm') { + return int(Lexer::T_FROM); + } + } + } + } else if (s[0].unicode() == 'g') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 't') { @@ -334,7 +343,7 @@ static inline int classify5(const QChar *s, int parseModeFlags) { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'r') { - return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_SUPER) : int(Lexer::T_RESERVED_WORD); + return int(Lexer::T_SUPER); } } } |