diff options
author | Marco Benelli <marco.benelli@qt.io> | 2018-10-16 15:32:58 +0200 |
---|---|---|
committer | Marco Benelli <marco.benelli@qt.io> | 2018-11-22 11:21:32 +0000 |
commit | 4646acad0db369302d08a1b83e1971be31c1df4f (patch) | |
tree | cc6b02cc0942309f9887e3a8e0f19a34e60123d5 /src | |
parent | fe8a3727735f1e6cf9414999ff5103520b1a56f9 (diff) | |
download | qt-creator-4646acad0db369302d08a1b83e1971be31c1df4f.tar.gz |
qmljs: update parser
Update the qtcreator qmljs parser to the
one of Qt 5.12. It supports EcmaScript 7.
Task-number: QTCREATORBUG-20341
Change-Id: I0d1cff71402ba17e22cde6b46c65614e162280de
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src')
46 files changed, 10453 insertions, 5721 deletions
diff --git a/src/libs/qmljs/jsoncheck.cpp b/src/libs/qmljs/jsoncheck.cpp index 2649f71a01..3940f46099 100644 --- a/src/libs/qmljs/jsoncheck.cpp +++ b/src/libs/qmljs/jsoncheck.cpp @@ -84,7 +84,7 @@ void JsonCheck::postVisit(Node *) analysis()->m_ranking += previous.m_ranking; } -bool JsonCheck::visit(ObjectLiteral *ast) +bool JsonCheck::visit(ObjectPattern *ast) { if (!proceedCheck(JsonValue::Object, ast->lbraceToken)) return false; @@ -96,8 +96,8 @@ bool JsonCheck::visit(ObjectLiteral *ast) return false; QSet<QString> propertiesFound; - for (PropertyAssignmentList *it = ast->properties; it; it = it->next) { - PropertyNameAndValue *assignment = AST::cast<AST::PropertyNameAndValue *>(it->assignment); + for (PatternPropertyList *it = ast->properties; it; it = it->next) { + PatternProperty *assignment = AST::cast<AST::PatternProperty *>(it->property); StringLiteralPropertyName *literalName = cast<StringLiteralPropertyName *>(assignment->name); if (literalName) { const QString &propertyName = literalName->id.toString(); @@ -106,7 +106,7 @@ bool JsonCheck::visit(ObjectLiteral *ast) propertiesFound.insert(propertyName); // Sec. 5.2: "... each property definition's value MUST be a schema..." m_schema->enterNestedPropertySchema(propertyName); - processSchema(assignment->value); + processSchema(assignment->initializer); m_schema->leaveNestedSchema(); } else { analysis()->m_messages.append(Message(ErrInvalidPropertyName, @@ -144,7 +144,7 @@ bool JsonCheck::visit(ObjectLiteral *ast) return false; } -bool JsonCheck::visit(ArrayLiteral *ast) +bool JsonCheck::visit(ArrayPattern *ast) { if (!proceedCheck(JsonValue::Array, ast->firstSourceLocation())) return false; @@ -155,21 +155,21 @@ bool JsonCheck::visit(ArrayLiteral *ast) // Sec. 5.5: "When this attribute value is a schema... all the items in the array MUST // be valid according to the schema." m_schema->enterNestedItemSchema(); - for (ElementList *element = ast->elements; element; element = element->next) - processSchema(element->expression); + for (PatternElementList *element = ast->elements; element; element = element->next) + processSchema(element->element->initializer); m_schema->leaveNestedSchema(); } else if (m_schema->hasItemArraySchema()) { // Sec. 5.5: "When this attribute value is an array of schemas... each position in the // instance array MUST conform to the schema in the corresponding position for this array." int current = 0; const int arraySize = m_schema->itemArraySchemaSize(); - for (ElementList *element = ast->elements; element; element = element->next, ++current) { + for (PatternElementList *element = ast->elements; element; element = element->next, ++current) { if (current < arraySize) { if (m_schema->maybeEnterNestedArraySchema(current)) { - processSchema(element->expression); + processSchema(element->element->initializer); m_schema->leaveNestedSchema(); } else { - Node::accept(element->expression, this); + Node::accept(element->element->initializer, this); } } else { // TODO: Handle additionalItems. diff --git a/src/libs/qmljs/jsoncheck.h b/src/libs/qmljs/jsoncheck.h index 53246045ff..e8efc8db19 100644 --- a/src/libs/qmljs/jsoncheck.h +++ b/src/libs/qmljs/jsoncheck.h @@ -51,8 +51,8 @@ private: bool preVisit(AST::Node *) override; void postVisit(AST::Node *) override; - bool visit(AST::ObjectLiteral *ast) override; - bool visit(AST::ArrayLiteral *ast) override; + bool visit(AST::ObjectPattern *ast) override; + bool visit(AST::ArrayPattern *ast) override; bool visit(AST::NullExpression *ast) override; bool visit(AST::TrueLiteral *ast) override; bool visit(AST::FalseLiteral *ast) override; diff --git a/src/libs/qmljs/parser/parser.pri b/src/libs/qmljs/parser/parser.pri index e17a0955fb..7418ea56be 100644 --- a/src/libs/qmljs/parser/parser.pri +++ b/src/libs/qmljs/parser/parser.pri @@ -10,7 +10,7 @@ HEADERS += \ $$PWD/qmljsglobal_p.h \ $$PWD/qmldirparser_p.h \ $$PWD/qmlerror.h \ - $$PWD/qmljskeywords_p.h \ + $$PWD/qmljskeywords_p.h SOURCES += \ $$PWD/qmljsast.cpp \ @@ -20,7 +20,13 @@ SOURCES += \ $$PWD/qmljslexer.cpp \ $$PWD/qmljsparser.cpp \ $$PWD/qmldirparser.cpp \ - $$PWD/qmlerror.cpp \ + $$PWD/qmlerror.cpp -DISTFILES += \ - $$PWD/qmljs.g +#CONFIG += qlalr +QLALRSOURCES = $$PWD/qmljs.g +#QMAKE_QLALRFLAGS = --no-debug --qt + +DISTFILES += $$QLALRSOURCES + +# make sure we install the headers generated by qlalr +#private_headers.CONFIG += no_check_exist diff --git a/src/libs/qmljs/parser/qmldirparser.cpp b/src/libs/qmljs/parser/qmldirparser.cpp index ece7384c98..d56affdbe1 100644 --- a/src/libs/qmljs/parser/qmldirparser.cpp +++ b/src/libs/qmljs/parser/qmldirparser.cpp @@ -93,6 +93,7 @@ bool QmlDirParser::parse(const QString &source) _components.clear(); _scripts.clear(); _designerSupported = false; + _className.clear(); quint16 lineNumber = 0; bool firstLine = true; @@ -182,7 +183,8 @@ bool QmlDirParser::parse(const QString &source) continue; } - // Ignore these. qmlimportscanner uses them. + _className = sections[1]; + } else if (sections[0] == QLatin1String("internal")) { if (sectionCount != 3) { reportError(lineNumber, 0, @@ -256,7 +258,7 @@ bool QmlDirParser::parse(const QString &source) if (parseVersion(sections[1], &major, &minor)) { const QString &fileName = sections[2]; - if (fileName.endsWith(QLatin1String(".js"))) { + if (fileName.endsWith(QLatin1String(".js")) || fileName.endsWith(QLatin1String(".mjs"))) { // A 'js' extension indicates a namespaced script import const Script entry(sections[0], fileName, major, minor); _scripts.append(entry); @@ -363,6 +365,11 @@ bool QmlDirParser::designerSupported() const return _designerSupported; } +QString QmlDirParser::className() const +{ + return _className; +} + QDebug &operator<< (QDebug &debug, const QmlDirParser::Component &component) { const QString output = QStringLiteral("{%1 %2.%3}"). diff --git a/src/libs/qmljs/parser/qmldirparser_p.h b/src/libs/qmljs/parser/qmldirparser_p.h index 1eaedf20d5..a39bfff0d2 100644 --- a/src/libs/qmljs/parser/qmldirparser_p.h +++ b/src/libs/qmljs/parser/qmldirparser_p.h @@ -39,8 +39,8 @@ #include <QtCore/QUrl> #include <QtCore/QHash> #include <QtCore/QDebug> - #include "qmljsengine_p.h" +#include "qmljsglobal_p.h" QT_BEGIN_NAMESPACE @@ -48,8 +48,6 @@ class QmlError; class QmlEngine; class QML_PARSER_EXPORT QmlDirParser { - Q_DISABLE_COPY(QmlDirParser) - public: QmlDirParser(); ~QmlDirParser(); @@ -76,8 +74,7 @@ public: struct Component { - Component() - : majorVersion(0), minorVersion(0), internal(false), singleton(false) {} + Component() {} Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion) : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion), @@ -85,24 +82,23 @@ public: QString typeName; QString fileName; - int majorVersion; - int minorVersion; - bool internal; - bool singleton; + int majorVersion = 0; + int minorVersion = 0; + bool internal = false; + bool singleton = false; }; struct Script { - Script() - : majorVersion(0), minorVersion(0) {} + Script() {} Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion) : nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {} QString nameSpace; QString fileName; - int majorVersion; - int minorVersion; + int majorVersion = 0; + int minorVersion = 0; }; QHash<QString,Component> components() const; @@ -124,6 +120,8 @@ public: QList<TypeInfo> typeInfos() const; #endif + QString className() const; + private: bool maybeAddComponent(const QString &typeName, const QString &fileName, const QString &version, QHash<QString,Component> &hash, int lineNumber = -1, bool multi = true); void reportError(quint16 line, quint16 column, const QString &message); @@ -139,6 +137,7 @@ private: #ifdef QT_CREATOR QList<TypeInfo> _typeInfos; #endif + QString _className; }; typedef QHash<QString,QmlDirParser::Component> QmlDirComponents; diff --git a/src/libs/qmljs/parser/qmlerror.cpp b/src/libs/qmljs/parser/qmlerror.cpp index 0ef8c80dfb..1703847bbd 100644 --- a/src/libs/qmljs/parser/qmlerror.cpp +++ b/src/libs/qmljs/parser/qmlerror.cpp @@ -91,7 +91,7 @@ QmlErrorPrivate::QmlErrorPrivate() Creates an empty error object. */ QmlError::QmlError() -: d(0) +: d(nullptr) { } @@ -99,7 +99,7 @@ QmlError::QmlError() Creates a copy of \a other. */ QmlError::QmlError(const QmlError &other) -: d(0) +: d(nullptr) { *this = other; } @@ -111,7 +111,7 @@ QmlError &QmlError::operator=(const QmlError &other) { if (!other.d) { delete d; - d = 0; + d = nullptr; } else { if (!d) d = new QmlErrorPrivate; @@ -130,7 +130,7 @@ QmlError &QmlError::operator=(const QmlError &other) */ QmlError::~QmlError() { - delete d; d = 0; + delete d; d = nullptr; } /*! @@ -138,7 +138,7 @@ QmlError::~QmlError() */ bool QmlError::isValid() const { - return d != 0; + return d != nullptr; } /*! @@ -231,7 +231,7 @@ QObject *QmlError::object() const { if (d) return d->object; - return 0; + return nullptr; } /*! @@ -260,7 +260,7 @@ QtMsgType QmlError::messageType() const \since 5.9 Sets the \a messageType for this message. The message type determines which - QDebug handlers are responsible for recieving the message. + QDebug handlers are responsible for receiving the message. */ void QmlError::setMessageType(QtMsgType messageType) { diff --git a/src/libs/qmljs/parser/qmljs.g b/src/libs/qmljs/parser/qmljs.g index 9209de3e69..c9dc94de92 100644 --- a/src/libs/qmljs/parser/qmljs.g +++ b/src/libs/qmljs/parser/qmljs.g @@ -40,8 +40,7 @@ %parser QmlJSGrammar %decl qmljsparser_p.h %impl qmljsparser.cpp -%expect 5 -%expect-rr 2 +%expect 1 %token T_AND "&" T_AND_AND "&&" T_AND_EQ "&=" %token T_BREAK "break" T_CASE "case" T_CATCH "catch" @@ -64,7 +63,8 @@ %token T_RBRACE "}" T_RBRACKET "]" T_REMAINDER "%" %token T_REMAINDER_EQ "%=" T_RETURN "return" T_RPAREN ")" %token T_SEMICOLON ";" T_AUTOMATIC_SEMICOLON T_STAR "*" -%token T_STAR_EQ "*=" T_STRING_LITERAL "string literal" +%token T_STAR_STAR "**" T_STAR_STAR_EQ "**=" T_STAR_EQ "*=" +%token T_STRING_LITERAL "string literal" %token T_PROPERTY "property" T_SIGNAL "signal" T_READONLY "readonly" %token T_SWITCH "switch" T_THIS "this" T_THROW "throw" %token T_TILDE "~" T_TRY "try" T_TYPEOF "typeof" @@ -77,14 +77,29 @@ %token T_MULTILINE_STRING_LITERAL "multiline string literal" %token T_COMMENT "comment" %token T_COMPATIBILITY_SEMICOLON +%token T_ARROW "=>" %token T_ENUM "enum" +%token T_ELLIPSIS "..." +%token T_YIELD "yield" +%token T_SUPER "super" +%token T_CLASS "class" +%token T_EXTENDS "extends" +%token T_STATIC "static" +%token T_EXPORT "export" +%token T_FROM "from" + +--- template strings +%token T_NO_SUBSTITUTION_TEMPLATE"(no subst template)" +%token T_TEMPLATE_HEAD "(template head)" +%token T_TEMPLATE_MIDDLE "(template middle)" +%token T_TEMPLATE_TAIL "(template tail)" --- context keywords. %token T_PUBLIC "public" %token T_IMPORT "import" %token T_PRAGMA "pragma" %token T_AS "as" -%token T_ON "on" +%token T_OF "of" %token T_GET "get" %token T_SET "set" @@ -95,11 +110,16 @@ %token T_FEED_UI_OBJECT_MEMBER %token T_FEED_JS_STATEMENT %token T_FEED_JS_EXPRESSION -%token T_FEED_JS_SOURCE_ELEMENT -%token T_FEED_JS_PROGRAM +%token T_FEED_JS_SCRIPT +%token T_FEED_JS_MODULE -%nonassoc SHIFT_THERE -%nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY T_ON T_SET T_GET +--- Lookahead handling +%token T_FORCE_DECLARATION "(force decl)" +%token T_FORCE_BLOCK "(force block)" +%token T_FOR_LOOKAHEAD_OK "(for lookahead ok)" + +--%left T_PLUS T_MINUS +%nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY T_ON T_SET T_GET T_OF T_STATIC T_FROM T_AS %nonassoc REDUCE_HERE %start TopLevel @@ -241,30 +261,42 @@ public: union Value { int ival; double dval; + AST::VariableScope scope; + AST::ForEachType forEachType; AST::ArgumentList *ArgumentList; AST::CaseBlock *CaseBlock; AST::CaseClause *CaseClause; AST::CaseClauses *CaseClauses; AST::Catch *Catch; AST::DefaultClause *DefaultClause; - AST::ElementList *ElementList; AST::Elision *Elision; AST::ExpressionNode *Expression; + AST::TemplateLiteral *Template; AST::Finally *Finally; AST::FormalParameterList *FormalParameterList; - AST::FunctionBody *FunctionBody; AST::FunctionDeclaration *FunctionDeclaration; AST::Node *Node; AST::PropertyName *PropertyName; - AST::PropertyAssignment *PropertyAssignment; - AST::PropertyAssignmentList *PropertyAssignmentList; - AST::SourceElement *SourceElement; - AST::SourceElements *SourceElements; AST::Statement *Statement; AST::StatementList *StatementList; AST::Block *Block; - AST::VariableDeclaration *VariableDeclaration; AST::VariableDeclarationList *VariableDeclarationList; + AST::Pattern *Pattern; + AST::PatternElement *PatternElement; + AST::PatternElementList *PatternElementList; + AST::PatternProperty *PatternProperty; + AST::PatternPropertyList *PatternPropertyList; + AST::ClassElementList *ClassElementList; + AST::ImportClause *ImportClause; + AST::FromClause *FromClause; + AST::NameSpaceImport *NameSpaceImport; + AST::ImportsList *ImportsList; + AST::NamedImports *NamedImports; + AST::ImportSpecifier *ImportSpecifier; + AST::ExportSpecifier *ExportSpecifier; + AST::ExportsList *ExportsList; + AST::ExportClause *ExportClause; + AST::ExportDeclaration *ExportDeclaration; AST::UiProgram *UiProgram; AST::UiHeaderItemList *UiHeaderItemList; @@ -281,7 +313,6 @@ public: AST::UiObjectMemberList *UiObjectMemberList; AST::UiArrayMemberList *UiArrayMemberList; AST::UiQualifiedId *UiQualifiedId; - AST::UiQualifiedPragmaId *UiQualifiedPragmaId; AST::UiEnumMemberList *UiEnumMemberList; }; @@ -290,12 +321,13 @@ public: ~Parser(); // parse a UI program - bool parse() { return parse(T_FEED_UI_PROGRAM); } + bool parse() { ++functionNestingLevel; bool r = parse(T_FEED_UI_PROGRAM); --functionNestingLevel; return r; } bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } - bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } - bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } - bool parseProgram() { return parse(T_FEED_JS_PROGRAM); } + bool parseUiObjectMember() { ++functionNestingLevel; bool r = parse(T_FEED_UI_OBJECT_MEMBER); --functionNestingLevel; return r; } + bool parseProgram() { return parse(T_FEED_JS_SCRIPT); } + bool parseScript() { return parse(T_FEED_JS_SCRIPT); } + bool parseModule() { return parse(T_FEED_JS_MODULE); } AST::UiProgram *ast() const { return AST::cast<AST::UiProgram *>(program); } @@ -333,7 +365,7 @@ public: inline DiagnosticMessage diagnosticMessage() const { for (const DiagnosticMessage &d : diagnostic_messages) { - if (d.kind != DiagnosticMessage::Warning) + if (d.kind != Severity::Warning) return d; } @@ -364,22 +396,31 @@ protected: { return location_stack [tos + index - 1]; } AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); - AST::UiQualifiedPragmaId *reparseAsQualifiedPragmaId(AST::ExpressionNode *expr); + + void pushToken(int token); + int lookaheadToken(Lexer *lexer); + + void syntaxError(const AST::SourceLocation &location, const char *message) { + diagnostic_messages.append(DiagnosticMessage(Severity::Error, location, QLatin1String(message))); + } + void syntaxError(const AST::SourceLocation &location, const QString &message) { + diagnostic_messages.append(DiagnosticMessage(Severity::Error, location, message)); + } protected: Engine *driver; MemoryPool *pool; - int tos; - int stack_size; - Value *sym_stack; - int *state_stack; - AST::SourceLocation *location_stack; - QStringRef *string_stack; + int tos = 0; + int stack_size = 0; + Value *sym_stack = nullptr; + int *state_stack = nullptr; + AST::SourceLocation *location_stack = nullptr; + QVector<QStringRef> string_stack; - AST::Node *program; + AST::Node *program = nullptr; - // error recovery - enum { TOKEN_BUFFER_SIZE = 3 }; + // error recovery and lookahead handling + enum { TOKEN_BUFFER_SIZE = 5 }; struct SavedToken { int token; @@ -388,14 +429,25 @@ protected: QStringRef spell; }; - double yylval; + int yytoken = -1; + double yylval = 0.; QStringRef yytokenspell; AST::SourceLocation yylloc; AST::SourceLocation yyprevlloc; SavedToken token_buffer[TOKEN_BUFFER_SIZE]; - SavedToken *first_token; - SavedToken *last_token; + SavedToken *first_token = nullptr; + SavedToken *last_token = nullptr; + + int functionNestingLevel = 0; + + enum CoverExpressionType { + CE_Invalid, + CE_ParenthesizedExpression, + CE_FormalParameterList + }; + AST::SourceLocation coverExpressionErrorLocation; + CoverExpressionType coverExpressionType = CE_Invalid; QList<DiagnosticMessage> diagnostic_messages; }; @@ -424,6 +476,8 @@ protected: // qlalr --no-debug --no-lines --qt qmljs.g // +#define UNIMPLEMENTED syntaxError(loc(1), "Unimplemented"); return false + using namespace QmlJS; QT_QML_BEGIN_NAMESPACE @@ -438,22 +492,12 @@ void Parser::reallocateStack() sym_stack = reinterpret_cast<Value*> (realloc(sym_stack, stack_size * sizeof(Value))); state_stack = reinterpret_cast<int*> (realloc(state_stack, stack_size * sizeof(int))); location_stack = reinterpret_cast<AST::SourceLocation*> (realloc(location_stack, stack_size * sizeof(AST::SourceLocation))); - string_stack = reinterpret_cast<QStringRef*> (realloc(string_stack, stack_size * sizeof(QStringRef))); + string_stack.resize(stack_size); } Parser::Parser(Engine *engine): driver(engine), - pool(engine->pool()), - tos(0), - stack_size(0), - sym_stack(0), - state_stack(0), - location_stack(0), - string_stack(0), - program(0), - yylval(0), - first_token(0), - last_token(0) + pool(engine->pool()) { } @@ -463,7 +507,6 @@ Parser::~Parser() free(sym_stack); free(state_stack); free(location_stack); - free(string_stack); } } @@ -505,29 +548,39 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) return 0; } -AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode *expr) +void Parser::pushToken(int token) { - if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(expr)) { - AST::UiQualifiedPragmaId *q = new (pool) AST::UiQualifiedPragmaId(idExpr->name); - q->identifierToken = idExpr->identifierToken; + last_token->token = yytoken; + last_token->dval = yylval; + last_token->spell = yytokenspell; + last_token->loc = yylloc; + ++last_token; + yytoken = token; +} - return q->finish(); +int Parser::lookaheadToken(Lexer *lexer) +{ + if (yytoken < 0) { + yytoken = lexer->lex(); + yylval = lexer->tokenValue(); + yytokenspell = lexer->tokenSpell(); + yylloc = location(lexer); } - - return 0; + return yytoken; } +//#define PARSER_DEBUG bool Parser::parse(int startToken) { Lexer *lexer = driver->lexer(); bool hadErrors = false; - int yytoken = -1; + yytoken = -1; int action = 0; token_buffer[0].token = startToken; first_token = &token_buffer[0]; - if (startToken == T_FEED_JS_PROGRAM && !lexer->qmlMode()) { + if (startToken == T_FEED_JS_SCRIPT && !lexer->qmlMode()) { Directives ignoreDirectives; Directives *directives = driver->directives(); if (!directives) @@ -570,10 +623,19 @@ bool Parser::parse(int startToken) yytokenspell = first_token->spell; yylloc = first_token->loc; ++first_token; + if (first_token == last_token) + first_token = last_token = &token_buffer[0]; } } +#ifdef PARSER_DEBUG + qDebug() << " in state" << action; +#endif + action = t_action(action, yytoken); +#ifdef PARSER_DEBUG + qDebug() << " current token" << yytoken << (yytoken >= 0 ? spell[yytoken] : "(null)") << "new state" << action; +#endif if (action > 0) { if (action != ACCEPT_STATE) { yytoken = -1; @@ -588,6 +650,10 @@ bool Parser::parse(int startToken) const int r = -action - 1; tos -= rhs[r]; +#ifdef PARSER_DEBUG + qDebug() << " reducing through rule " << -action; +#endif + switch (r) { ./ @@ -595,2582 +661,3693 @@ bool Parser::parse(int startToken) -- Declarative UI -------------------------------------------------------------------------------------------------------- -TopLevel: T_FEED_UI_PROGRAM UiProgram ; +TopLevel: T_FEED_UI_PROGRAM UiProgram; /. -case $rule_number: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; ./ -TopLevel: T_FEED_JS_STATEMENT Statement ; +TopLevel: T_FEED_JS_STATEMENT Statement; /. -case $rule_number: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; ./ -TopLevel: T_FEED_JS_EXPRESSION Expression ; +TopLevel: T_FEED_JS_EXPRESSION Expression; /. -case $rule_number: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; ./ -TopLevel: T_FEED_JS_SOURCE_ELEMENT SourceElement ; +TopLevel: T_FEED_UI_OBJECT_MEMBER UiObjectMember; /. -case $rule_number: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; ./ -TopLevel: T_FEED_UI_OBJECT_MEMBER UiObjectMember ; +TopLevel: T_FEED_JS_SCRIPT Script; /. -case $rule_number: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; ./ -TopLevel: T_FEED_JS_PROGRAM Program ; +TopLevel: T_FEED_JS_MODULE Module; /. -case $rule_number: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; ./ + UiProgram: UiHeaderItemListOpt UiRootMember; /. -case $rule_number: { - sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList, - sym(2).UiObjectMemberList->finish()); -} break; + case $rule_number: { + sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList, sym(2).UiObjectMemberList->finish()); + } break; ./ -UiHeaderItemListOpt: Empty ; -UiHeaderItemListOpt: UiHeaderItemList ; +UiHeaderItemListOpt: Empty; +UiHeaderItemListOpt: UiHeaderItemList; /. -case $rule_number: { - sym(1).Node = sym(1).UiHeaderItemList->finish(); -} break; + case $rule_number: { + sym(1).Node = sym(1).UiHeaderItemList->finish(); + } break; ./ -UiHeaderItemList: UiPragma ; +UiHeaderItemList: UiPragma; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma); -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma); + } break; ./ -UiHeaderItemList: UiImport ; +UiHeaderItemList: UiImport; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport); -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport); + } break; ./ -UiHeaderItemList: UiHeaderItemList UiPragma ; +UiHeaderItemList: UiHeaderItemList UiPragma; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma); -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma); + } break; ./ -UiHeaderItemList: UiHeaderItemList UiImport ; +UiHeaderItemList: UiHeaderItemList UiImport; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport); -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport); + } break; ./ -PragmaId: MemberExpression ; - -ImportId: MemberExpression ; +PragmaId: JsIdentifier; -UiPragma: UiPragmaHead T_AUTOMATIC_SEMICOLON ; -UiPragma: UiPragmaHead T_SEMICOLON ; +UiPragma: T_PRAGMA PragmaId T_AUTOMATIC_SEMICOLON; +UiPragma: T_PRAGMA PragmaId T_SEMICOLON; /. -case $rule_number: { - sym(1).UiPragma->semicolonToken = loc(2); -} break; + case $rule_number: { + AST::UiPragma *pragma = new (pool) AST::UiPragma(stringRef(2)); + pragma->pragmaToken = loc(1); + pragma->semicolonToken = loc(3); + sym(1).Node = pragma; + } break; ./ -UiImport: UiImportHead T_AUTOMATIC_SEMICOLON ; -UiImport: UiImportHead T_SEMICOLON ; +ImportId: MemberExpression; + +UiImport: UiImportHead T_AUTOMATIC_SEMICOLON; +UiImport: UiImportHead T_SEMICOLON; /. -case $rule_number: { - sym(1).UiImport->semicolonToken = loc(2); -} break; + case $rule_number: { + sym(1).UiImport->semicolonToken = loc(2); + } break; ./ -UiImport: UiImportHead T_NUMERIC_LITERAL T_AUTOMATIC_SEMICOLON ; -UiImport: UiImportHead T_NUMERIC_LITERAL T_SEMICOLON ; +UiImport: UiImportHead T_NUMERIC_LITERAL T_AUTOMATIC_SEMICOLON; +UiImport: UiImportHead T_NUMERIC_LITERAL T_SEMICOLON; /. -case $rule_number: { - sym(1).UiImport->versionToken = loc(2); - sym(1).UiImport->semicolonToken = loc(3); -} break; + case $rule_number: { + sym(1).UiImport->versionToken = loc(2); + sym(1).UiImport->semicolonToken = loc(3); + } break; ./ -UiImport: UiImportHead T_NUMERIC_LITERAL T_AS JsIdentifier T_AUTOMATIC_SEMICOLON ; -UiImport: UiImportHead T_NUMERIC_LITERAL T_AS JsIdentifier T_SEMICOLON ; +UiImport: UiImportHead T_NUMERIC_LITERAL T_AS QmlIdentifier T_AUTOMATIC_SEMICOLON; +UiImport: UiImportHead T_NUMERIC_LITERAL T_AS QmlIdentifier T_SEMICOLON; /. -case $rule_number: { - sym(1).UiImport->versionToken = loc(2); - sym(1).UiImport->asToken = loc(3); - sym(1).UiImport->importIdToken = loc(4); - sym(1).UiImport->importId = stringRef(4); - sym(1).UiImport->semicolonToken = loc(5); -} break; + case $rule_number: { + sym(1).UiImport->versionToken = loc(2); + sym(1).UiImport->asToken = loc(3); + sym(1).UiImport->importIdToken = loc(4); + sym(1).UiImport->importId = stringRef(4); + sym(1).UiImport->semicolonToken = loc(5); + } break; ./ -UiImport: UiImportHead T_AS JsIdentifier T_AUTOMATIC_SEMICOLON ; -UiImport: UiImportHead T_AS JsIdentifier T_SEMICOLON ; +UiImport: UiImportHead T_AS QmlIdentifier T_AUTOMATIC_SEMICOLON; +UiImport: UiImportHead T_AS QmlIdentifier T_SEMICOLON; /. -case $rule_number: { - sym(1).UiImport->asToken = loc(2); - sym(1).UiImport->importIdToken = loc(3); - sym(1).UiImport->importId = stringRef(3); - sym(1).UiImport->semicolonToken = loc(4); -} break; + case $rule_number: { + sym(1).UiImport->asToken = loc(2); + sym(1).UiImport->importIdToken = loc(3); + sym(1).UiImport->importId = stringRef(3); + sym(1).UiImport->semicolonToken = loc(4); + } break; ./ -UiPragmaHead: T_PRAGMA PragmaId ; +UiImportHead: T_IMPORT ImportId; /. -case $rule_number: { - AST::UiPragma *node = 0; + case $rule_number: { + AST::UiImport *node = 0; - if (AST::UiQualifiedPragmaId *qualifiedId = reparseAsQualifiedPragmaId(sym(2).Expression)) { - node = new (pool) AST::UiPragma(qualifiedId); - } + if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) { + node = new (pool) AST::UiImport(importIdLiteral->value); + node->fileNameToken = loc(2); + } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) { + node = new (pool) AST::UiImport(qualifiedId); + node->fileNameToken = loc(2); + } - sym(1).Node = node; + sym(1).Node = node; - if (node) { - node->pragmaToken = loc(1); - } else { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), - QLatin1String("Expected a qualified name id"))); + if (node) { + node->importToken = loc(1); + } else { + diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1), + QLatin1String("Expected a qualified name id or a string literal"))); - return false; // ### remove me - } -} break; + return false; // ### remove me + } + } break; ./ +Empty: ; +/. + case $rule_number: { + sym(1).Node = nullptr; + } break; +./ -UiImportHead: T_IMPORT ImportId ; +UiRootMember: UiObjectDefinition; /. -case $rule_number: { - AST::UiImport *node = 0; - - if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) { - node = new (pool) AST::UiImport(importIdLiteral->value); - node->fileNameToken = loc(2); - } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) { - node = new (pool) AST::UiImport(qualifiedId); - node->fileNameToken = loc(2); - } + case $rule_number: { + sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); + } break; +./ - sym(1).Node = node; +UiObjectMemberList: UiObjectMember; +/. + case $rule_number: { + sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); + } break; +./ - if (node) { - node->importToken = loc(1); - } else { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), - QLatin1String("Expected a qualified name id or a string literal"))); +UiObjectMemberList: UiObjectMemberList UiObjectMember; +/. + case $rule_number: { + AST::UiObjectMemberList *node = new (pool) AST:: UiObjectMemberList(sym(1).UiObjectMemberList, sym(2).UiObjectMember); + sym(1).Node = node; + } break; +./ - return false; // ### remove me - } -} break; +UiArrayMemberList: UiObjectDefinition; +/. + case $rule_number: { + sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember); + } break; ./ -Empty: ; +UiArrayMemberList: UiArrayMemberList T_COMMA UiObjectDefinition; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + AST::UiArrayMemberList *node = new (pool) AST::UiArrayMemberList(sym(1).UiArrayMemberList, sym(3).UiObjectMember); + node->commaToken = loc(2); + sym(1).Node = node; + } break; ./ -UiRootMember: UiObjectDefinition ; +UiObjectInitializer: T_LBRACE T_RBRACE; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); -} break; + case $rule_number: { + AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0); + node->lbraceToken = loc(1); + node->rbraceToken = loc(2); + sym(1).Node = node; + } break; ./ -UiObjectMemberList: UiObjectMember ; +UiObjectInitializer: T_LBRACE UiObjectMemberList T_RBRACE; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); -} break; + case $rule_number: { + AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish()); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + sym(1).Node = node; + } break; ./ -UiObjectMemberList: UiObjectMemberList UiObjectMember ; +UiObjectDefinition: UiQualifiedId UiObjectInitializer; /. -case $rule_number: { - AST::UiObjectMemberList *node = new (pool) AST:: UiObjectMemberList( - sym(1).UiObjectMemberList, sym(2).UiObjectMember); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiObjectDefinition *node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId, sym(2).UiObjectInitializer); + sym(1).Node = node; + } break; ./ -UiArrayMemberList: UiObjectDefinition ; +UiObjectMember: UiObjectDefinition; + +UiObjectMember: UiQualifiedId T_COLON ExpressionStatementLookahead T_LBRACKET UiArrayMemberList T_RBRACKET; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember); -} break; + case $rule_number: { + AST::UiArrayBinding *node = new (pool) AST::UiArrayBinding(sym(1).UiQualifiedId, sym(5).UiArrayMemberList->finish()); + node->colonToken = loc(2); + node->lbracketToken = loc(4); + node->rbracketToken = loc(6); + sym(1).Node = node; + } break; ./ -UiArrayMemberList: UiArrayMemberList T_COMMA UiObjectDefinition ; +UiObjectMember: UiQualifiedId T_COLON ExpressionStatementLookahead UiQualifiedId UiObjectInitializer; /. -case $rule_number: { - AST::UiArrayMemberList *node = new (pool) AST::UiArrayMemberList( - sym(1).UiArrayMemberList, sym(3).UiObjectMember); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( + sym(1).UiQualifiedId, sym(4).UiQualifiedId, sym(5).UiObjectInitializer); + node->colonToken = loc(2); + sym(1).Node = node; + } break; ./ -UiObjectInitializer: T_LBRACE T_RBRACE ; +UiObjectMember: UiQualifiedId T_ON UiQualifiedId UiObjectInitializer; /. -case $rule_number: { - AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0); - node->lbraceToken = loc(1); - node->rbraceToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( + sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); + node->colonToken = loc(2); + node->hasOnToken = true; + sym(1).Node = node; + } break; ./ -UiObjectInitializer: T_LBRACE UiObjectMemberList T_RBRACE ; + +UiObjectLiteral: T_LBRACE ExpressionStatementLookahead UiPropertyDefinitionList T_RBRACE; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiObjectLiteral: T_LBRACE ExpressionStatementLookahead UiPropertyDefinitionList T_COMMA T_RBRACE; /. -case $rule_number: { - AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish()); - node->lbraceToken = loc(1); - node->rbraceToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ObjectPattern *l = new (pool) AST::ObjectPattern(sym(3).PatternPropertyList->finish()); + l->lbraceToken = loc(1); + l->rbraceToken = loc(4); + AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(l); + sym(1).Node = node; + } break; ./ -UiObjectDefinition: UiQualifiedId UiObjectInitializer ; + +UiScriptStatement: ExpressionStatementLookahead T_FORCE_DECLARATION ExpressionStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiScriptStatement: ExpressionStatementLookahead T_FORCE_BLOCK Block; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiScriptStatement: ExpressionStatementLookahead T_FORCE_BLOCK UiObjectLiteral; /. -case $rule_number: { - AST::UiObjectDefinition *node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId, - sym(2).UiObjectInitializer); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(3).Node; + } break; ./ -UiObjectMember: UiObjectDefinition ; -UiObjectMember: UiQualifiedId T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ; +UiScriptStatement: ExpressionStatementLookahead EmptyStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiScriptStatement: ExpressionStatementLookahead ExpressionStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiScriptStatement: ExpressionStatementLookahead IfStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiScriptStatement: ExpressionStatementLookahead WithStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiScriptStatement: ExpressionStatementLookahead SwitchStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiScriptStatement: ExpressionStatementLookahead TryStatement; /. -case $rule_number: { - AST::UiArrayBinding *node = new (pool) AST::UiArrayBinding( - sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish()); - node->colonToken = loc(2); - node->lbracketToken = loc(3); - node->rbracketToken = loc(5); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + } break; ./ -UiObjectMember: UiQualifiedId T_COLON UiQualifiedId UiObjectInitializer ; +UiObjectMember: UiQualifiedId T_COLON UiScriptStatement; /. -case $rule_number: { - AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( - sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer); +case $rule_number: +{ + AST::UiScriptBinding *node = new (pool) AST::UiScriptBinding(sym(1).UiQualifiedId, sym(3).Statement); node->colonToken = loc(2); sym(1).Node = node; -} break; + } break; ./ -UiObjectMember: UiQualifiedId T_ON UiQualifiedId UiObjectInitializer ; +UiPropertyType: T_VAR; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiPropertyType: T_RESERVED_WORD; +/. case $rule_number: Q_FALLTHROUGH(); ./ +UiPropertyType: T_IDENTIFIER; /. -case $rule_number: { - AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( - sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); - node->colonToken = loc(2); - node->hasOnToken = true; - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1)); + node->identifierToken = loc(1); + sym(1).Node = node; + } break; ./ -UiScriptStatement: Block ; -UiScriptStatement: EmptyStatement ; -UiScriptStatement: ExpressionStatement ; -UiScriptStatement: IfStatement ; -UiScriptStatement: WithStatement ; -UiScriptStatement: SwitchStatement ; -UiScriptStatement: TryStatement ; +UiPropertyType: UiPropertyType T_DOT T_IDENTIFIER; +/. + case $rule_number: { + AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(sym(1).UiQualifiedId, stringRef(3)); + node->identifierToken = loc(3); + sym(1).Node = node; + } break; +./ -UiObjectMember: UiQualifiedId T_COLON UiScriptStatement ; +UiParameterListOpt: ; /. -case $rule_number: -{ - AST::UiScriptBinding *node = new (pool) AST::UiScriptBinding( - sym(1).UiQualifiedId, sym(3).Statement); - node->colonToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -UiPropertyType: T_VAR ; +UiParameterListOpt: UiParameterList; /. -case $rule_number: { - AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(1).UiParameterList->finish(); + } break; ./ -UiPropertyType: T_RESERVED_WORD ; +UiParameterList: UiPropertyType QmlIdentifier; /. -case $rule_number: { - AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiQualifiedId->finish(), stringRef(2)); + node->propertyTypeToken = loc(1); + node->identifierToken = loc(2); + sym(1).Node = node; + } break; +./ + +UiParameterList: UiParameterList T_COMMA UiPropertyType QmlIdentifier; +/. + case $rule_number: { + AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, sym(3).UiQualifiedId->finish(), stringRef(4)); + node->propertyTypeToken = loc(3); + node->commaToken = loc(2); + node->identifierToken = loc(4); + sym(1).Node = node; + } break; +./ + +UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_AUTOMATIC_SEMICOLON; +UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_SEMICOLON; +/. + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2)); + node->type = AST::UiPublicMember::Signal; + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(2); + node->parameters = sym(4).UiParameterList; + node->semicolonToken = loc(6); + sym(1).Node = node; + } break; +./ + +UiObjectMember: T_SIGNAL T_IDENTIFIER T_AUTOMATIC_SEMICOLON; +UiObjectMember: T_SIGNAL T_IDENTIFIER T_SEMICOLON; +/. + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2)); + node->type = AST::UiPublicMember::Signal; + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(2); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; +./ + +UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_AUTOMATIC_SEMICOLON; +UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_SEMICOLON; +/. + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6)); + node->typeModifier = stringRef(2); + node->propertyToken = loc(1); + node->typeModifierToken = loc(2); + node->typeToken = loc(4); + node->identifierToken = loc(6); + node->semicolonToken = loc(7); + sym(1).Node = node; + } break; +./ + +UiObjectMember: T_PROPERTY UiPropertyType QmlIdentifier T_AUTOMATIC_SEMICOLON; +UiObjectMember: T_PROPERTY UiPropertyType QmlIdentifier T_SEMICOLON; +/. + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3)); + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->semicolonToken = loc(4); + sym(1).Node = node; + } break; +./ + +UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType QmlIdentifier T_AUTOMATIC_SEMICOLON; +UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType QmlIdentifier T_SEMICOLON; +/. + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4)); + node->isDefaultMember = true; + node->defaultToken = loc(1); + node->propertyToken = loc(2); + node->typeToken = loc(3); + node->identifierToken = loc(4); + node->semicolonToken = loc(5); + sym(1).Node = node; + } break; +./ + +UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_AUTOMATIC_SEMICOLON; +UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_SEMICOLON; +/. + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(5).UiQualifiedId->finish(), stringRef(7)); + node->isDefaultMember = true; + node->defaultToken = loc(1); + node->typeModifier = stringRef(3); + node->propertyToken = loc(2); + node->typeModifierToken = loc(2); + node->typeToken = loc(4); + node->identifierToken = loc(7); + node->semicolonToken = loc(8); + sym(1).Node = node; + } break; +./ + +UiObjectMember: T_PROPERTY UiPropertyType QmlIdentifier T_COLON UiScriptStatement; +/. + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3), sym(5).Statement); + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->colonToken = loc(4); + sym(1).Node = node; + } break; +./ + +UiObjectMember: T_READONLY T_PROPERTY UiPropertyType QmlIdentifier T_COLON UiScriptStatement; +/. + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), sym(6).Statement); + node->isReadonlyMember = true; + node->readonlyToken = loc(1); + node->propertyToken = loc(2); + node->typeToken = loc(3); + node->identifierToken = loc(4); + node->colonToken = loc(5); + sym(1).Node = node; + } break; ./ -UiPropertyType: T_IDENTIFIER ; +UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType QmlIdentifier T_COLON UiScriptStatement; /. -case $rule_number: { - AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), sym(6).Statement); + node->isDefaultMember = true; + node->defaultToken = loc(1); + node->propertyToken = loc(2); + node->typeToken = loc(3); + node->identifierToken = loc(4); + node->colonToken = loc(5); + sym(1).Node = node; + } break; ./ -UiPropertyType: UiPropertyType T_DOT T_IDENTIFIER ; +UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET; /. -case $rule_number: { - AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(sym(1).UiQualifiedId, stringRef(3)); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6)); + node->typeModifier = stringRef(2); + node->propertyToken = loc(1); + node->typeModifierToken = loc(2); + node->typeToken = loc(4); + node->identifierToken = loc(6); + node->semicolonToken = loc(7); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(6)); + propertyName->identifierToken = loc(6); + propertyName->next = 0; + + AST::UiArrayBinding *binding = new (pool) AST::UiArrayBinding(propertyName, sym(9).UiArrayMemberList->finish()); + binding->colonToken = loc(7); + binding->lbracketToken = loc(8); + binding->rbracketToken = loc(10); + + node->binding = binding; + + sym(1).Node = node; + } break; ./ -UiParameterListOpt: ; +UiObjectMember: T_PROPERTY UiPropertyType QmlIdentifier T_COLON ExpressionStatementLookahead UiQualifiedId UiObjectInitializer; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3)); + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->semicolonToken = loc(4); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(3)); + propertyName->identifierToken = loc(3); + propertyName->next = 0; + + AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( + propertyName, sym(6).UiQualifiedId, sym(7).UiObjectInitializer); + binding->colonToken = loc(4); + + node->binding = binding; + + sym(1).Node = node; + } break; ./ -UiParameterListOpt: UiParameterList ; +UiObjectMember: T_READONLY T_PROPERTY UiPropertyType QmlIdentifier T_COLON ExpressionStatementLookahead UiQualifiedId UiObjectInitializer; /. -case $rule_number: { - sym(1).Node = sym(1).UiParameterList->finish (); -} break; + case $rule_number: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4)); + node->isReadonlyMember = true; + node->readonlyToken = loc(1); + node->propertyToken = loc(2); + node->typeToken = loc(3); + node->identifierToken = loc(4); + node->semicolonToken = loc(5); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(4)); + propertyName->identifierToken = loc(4); + propertyName->next = 0; + + AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( + propertyName, sym(7).UiQualifiedId, sym(8).UiObjectInitializer); + binding->colonToken = loc(5); + + node->binding = binding; + + sym(1).Node = node; + } break; ./ -UiParameterList: UiPropertyType JsIdentifier ; +UiObjectMember: FunctionDeclaration; /. -case $rule_number: { - AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiQualifiedId->finish(), stringRef(2)); - node->propertyTypeToken = loc(1); - node->identifierToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); + } break; ./ -UiParameterList: UiParameterList T_COMMA UiPropertyType JsIdentifier ; +UiObjectMember: VariableStatement; /. -case $rule_number: { - AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, sym(3).UiQualifiedId->finish(), stringRef(4)); - node->propertyTypeToken = loc(3); - node->commaToken = loc(2); - node->identifierToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); + } break; ./ -UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_SEMICOLON ; +UiQualifiedId: MemberExpression; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2)); - node->type = AST::UiPublicMember::Signal; - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(2); - node->parameters = sym(4).UiParameterList; - node->semicolonToken = loc(6); - sym(1).Node = node; -} break; + case $rule_number: { + if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) { + diagnostic_messages.append(DiagnosticMessage(Severity::Warning, mem->lbracketToken, + QLatin1String("Ignored annotation"))); + + sym(1).Expression = mem->base; + } + + if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) { + sym(1).UiQualifiedId = qualifiedId; + } else { + sym(1).UiQualifiedId = 0; + + diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1), + QLatin1String("Expected a qualified name id"))); + + return false; // ### recover + } + } break; ./ -UiObjectMember: T_SIGNAL T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_SIGNAL T_IDENTIFIER T_SEMICOLON ; +UiObjectMember: T_ENUM T_IDENTIFIER T_LBRACE EnumMemberList T_RBRACE; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2)); - node->type = AST::UiPublicMember::Signal; - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(2); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiEnumDeclaration *enumDeclaration = new (pool) AST::UiEnumDeclaration(stringRef(2), sym(4).UiEnumMemberList->finish()); + enumDeclaration->enumToken = loc(1); + enumDeclaration->rbraceToken = loc(5); + sym(1).Node = enumDeclaration; + break; + } ./ -UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ; +EnumMemberList: T_IDENTIFIER; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6)); - node->typeModifier = stringRef(2); - node->propertyToken = loc(1); - node->typeModifierToken = loc(2); - node->typeToken = loc(4); - node->identifierToken = loc(6); - node->semicolonToken = loc(7); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1)); + node->memberToken = loc(1); + sym(1).Node = node; + break; + } ./ -UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ; +EnumMemberList: T_IDENTIFIER T_EQ T_NUMERIC_LITERAL; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3)); - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(3); - node->semicolonToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1), sym(3).dval); + node->memberToken = loc(1); + node->valueToken = loc(3); + sym(1).Node = node; + break; + } ./ -UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ; +EnumMemberList: EnumMemberList T_COMMA T_IDENTIFIER; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4)); - node->isDefaultMember = true; - node->defaultToken = loc(1); - node->propertyToken = loc(2); - node->typeToken = loc(3); - node->identifierToken = loc(4); - node->semicolonToken = loc(5); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3)); + node->memberToken = loc(3); + sym(1).Node = node; + break; + } ./ -UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ; +EnumMemberList: EnumMemberList T_COMMA T_IDENTIFIER T_EQ T_NUMERIC_LITERAL; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(5).UiQualifiedId->finish(), stringRef(7)); - node->isDefaultMember = true; - node->defaultToken = loc(1); - node->typeModifier = stringRef(3); - node->propertyToken = loc(2); - node->typeModifierToken = loc(2); - node->typeToken = loc(4); - node->identifierToken = loc(7); - node->semicolonToken = loc(8); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3), sym(5).dval); + node->memberToken = loc(3); + node->valueToken = loc(5); + sym(1).Node = node; + break; + } ./ -UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ; +QmlIdentifier: T_IDENTIFIER; +QmlIdentifier: T_PROPERTY; +QmlIdentifier: T_SIGNAL; +QmlIdentifier: T_READONLY; +QmlIdentifier: T_ON; +QmlIdentifier: T_GET; +QmlIdentifier: T_SET; +QmlIdentifier: T_FROM; +QmlIdentifier: T_OF; + +JsIdentifier: T_IDENTIFIER; +JsIdentifier: T_PROPERTY; +JsIdentifier: T_SIGNAL; +JsIdentifier: T_READONLY; +JsIdentifier: T_ON; +JsIdentifier: T_GET; +JsIdentifier: T_SET; +JsIdentifier: T_FROM; +JsIdentifier: T_STATIC; +JsIdentifier: T_OF; +JsIdentifier: T_AS; + +IdentifierReference: JsIdentifier; +BindingIdentifier: IdentifierReference; + +-------------------------------------------------------------------------------------------------------- +-- Expressions +-------------------------------------------------------------------------------------------------------- + +PrimaryExpression: T_THIS; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3), - sym(5).Statement); - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(3); - node->colonToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ThisExpression *node = new (pool) AST::ThisExpression(); + node->thisToken = loc(1); + sym(1).Node = node; + } break; ./ -UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ; +PrimaryExpression: IdentifierReference; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), - sym(6).Statement); - node->isReadonlyMember = true; - node->readonlyToken = loc(1); - node->propertyToken = loc(2); - node->typeToken = loc(3); - node->identifierToken = loc(4); - node->colonToken = loc(5); - sym(1).Node = node; -} break; + case $rule_number: { + AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1)); + node->identifierToken = loc(1); + sym(1).Node = node; + } break; ./ -UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ; +PrimaryExpression: Literal; +PrimaryExpression: ArrayLiteral; +PrimaryExpression: ObjectLiteral; +PrimaryExpression: FunctionExpression; +PrimaryExpression: ClassExpression; +PrimaryExpression: GeneratorExpression; +PrimaryExpression: RegularExpressionLiteral; +PrimaryExpression: TemplateLiteral; + +PrimaryExpression: CoverParenthesizedExpressionAndArrowParameterList; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), - sym(6).Statement); - node->isDefaultMember = true; - node->defaultToken = loc(1); - node->propertyToken = loc(2); - node->typeToken = loc(3); - node->identifierToken = loc(4); - node->colonToken = loc(5); - sym(1).Node = node; -} break; + case $rule_number: { + if (coverExpressionType != CE_ParenthesizedExpression) { + syntaxError(coverExpressionErrorLocation, "Expected token ')'."); + return false; + } + } break; ./ -UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ; +-- Parsing of the CoverParenthesizedExpressionAndArrowParameterList is restricted to the one rule below when this is parsed as a primary expression +CoverParenthesizedExpressionAndArrowParameterList: T_LPAREN Expression_In T_RPAREN; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6)); - node->typeModifier = stringRef(2); - node->propertyToken = loc(1); - node->typeModifierToken = loc(2); - node->typeToken = loc(4); - node->identifierToken = loc(6); - node->semicolonToken = loc(7); // insert a fake ';' before ':' - - AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(6)); - propertyName->identifierToken = loc(6); - propertyName->next = 0; - - AST::UiArrayBinding *binding = new (pool) AST::UiArrayBinding( - propertyName, sym(9).UiArrayMemberList->finish()); - binding->colonToken = loc(7); - binding->lbracketToken = loc(8); - binding->rbracketToken = loc(10); - - node->binding = binding; + case $rule_number: { + AST::NestedExpression *node = new (pool) AST::NestedExpression(sym(2).Expression); + node->lparenToken = loc(1); + node->rparenToken = loc(3); + sym(1).Node = node; + coverExpressionType = CE_ParenthesizedExpression; + } break; +./ - sym(1).Node = node; -} break; +CoverParenthesizedExpressionAndArrowParameterList: T_LPAREN T_RPAREN; +/. + case $rule_number: { + sym(1).Node = nullptr; + coverExpressionErrorLocation = loc(2); + coverExpressionType = CE_FormalParameterList; + } break; ./ -UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ; +CoverParenthesizedExpressionAndArrowParameterList: T_LPAREN BindingRestElement T_RPAREN; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3)); - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(3); - node->semicolonToken = loc(4); // insert a fake ';' before ':' + case $rule_number: { + AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(nullptr, sym(2).PatternElement))->finish(pool); + sym(1).Node = node; + coverExpressionErrorLocation = loc(2); + coverExpressionType = CE_FormalParameterList; + } break; +./ - AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(3)); - propertyName->identifierToken = loc(3); - propertyName->next = 0; +CoverParenthesizedExpressionAndArrowParameterList: T_LPAREN Expression_In T_COMMA BindingRestElementOpt T_RPAREN; +/. + case $rule_number: { + AST::FormalParameterList *list = sym(2).Expression->reparseAsFormalParameterList(pool); + if (!list) { + syntaxError(loc(1), "Invalid Arrow parameter list."); + return false; + } + if (sym(4).Node) { + list = new (pool) AST::FormalParameterList(list, sym(4).PatternElement); + } + coverExpressionErrorLocation = loc(4); + coverExpressionType = CE_FormalParameterList; + sym(1).Node = list->finish(pool); + } break; +./ - AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( - propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer); - binding->colonToken = loc(4); +Literal: T_NULL; +/. + case $rule_number: { + AST::NullExpression *node = new (pool) AST::NullExpression(); + node->nullToken = loc(1); + sym(1).Node = node; + } break; +./ - node->binding = binding; +Literal: T_TRUE; +/. + case $rule_number: { + AST::TrueLiteral *node = new (pool) AST::TrueLiteral(); + node->trueToken = loc(1); + sym(1).Node = node; + } break; +./ - sym(1).Node = node; -} break; +Literal: T_FALSE; +/. + case $rule_number: { + AST::FalseLiteral *node = new (pool) AST::FalseLiteral(); + node->falseToken = loc(1); + sym(1).Node = node; + } break; ./ -UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ; +Literal: T_NUMERIC_LITERAL; /. -case $rule_number: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4)); - node->isReadonlyMember = true; - node->readonlyToken = loc(1); - node->propertyToken = loc(2); - node->typeToken = loc(3); - node->identifierToken = loc(4); - node->semicolonToken = loc(5); // insert a fake ';' before ':' + case $rule_number: { + AST::NumericLiteral *node = new (pool) AST::NumericLiteral(sym(1).dval); + node->literalToken = loc(1); + sym(1).Node = node; + } break; +./ - AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(4)); - propertyName->identifierToken = loc(4); - propertyName->next = 0; +Literal: T_MULTILINE_STRING_LITERAL; +/. case $rule_number: Q_FALLTHROUGH(); ./ - AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( - propertyName, sym(6).UiQualifiedId, sym(7).UiObjectInitializer); - binding->colonToken = loc(5); +Literal: T_STRING_LITERAL; +/. + case $rule_number: { + AST::StringLiteral *node = new (pool) AST::StringLiteral(stringRef(1)); + node->literalToken = loc(1); + sym(1).Node = node; + } break; +./ + +RegularExpressionLiteral: T_DIVIDE_; +/: +#define J_SCRIPT_REGEXPLITERAL_RULE1 $rule_number +:/ +/. +{ + Lexer::RegExpBodyPrefix prefix; + case $rule_number: + prefix = Lexer::NoPrefix; + goto scan_regexp; +./ - node->binding = binding; +RegularExpressionLiteral: T_DIVIDE_EQ; +/: +#define J_SCRIPT_REGEXPLITERAL_RULE2 $rule_number +:/ +/. + case $rule_number: + prefix = Lexer::EqualPrefix; + goto scan_regexp; - sym(1).Node = node; -} break; + scan_regexp: { + bool rx = lexer->scanRegExp(prefix); + if (!rx) { + diagnostic_messages.append(DiagnosticMessage(Severity::Error, location(lexer), lexer->errorMessage())); + return false; + } + + loc(1).length = lexer->tokenLength(); + yylloc = loc(1); // adjust the location of the current token + + AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral(driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); + node->literalToken = loc(1); + sym(1).Node = node; + } break; +} ./ -UiObjectMember: FunctionDeclaration ; + +ArrayLiteral: T_LBRACKET ElisionOpt T_RBRACKET; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); -} break; + case $rule_number: { + AST::PatternElementList *list = nullptr; + if (sym(2).Elision) + list = (new (pool) AST::PatternElementList(sym(2).Elision, nullptr))->finish(); + AST::ArrayPattern *node = new (pool) AST::ArrayPattern(list); + node->lbracketToken = loc(1); + node->rbracketToken = loc(3); + sym(1).Node = node; + } break; ./ -UiObjectMember: VariableStatement ; +ArrayLiteral: T_LBRACKET ElementList T_RBRACKET; /. -case $rule_number: { - sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); -} break; + case $rule_number: { + AST::ArrayPattern *node = new (pool) AST::ArrayPattern(sym(2).PatternElementList->finish()); + node->lbracketToken = loc(1); + node->rbracketToken = loc(3); + sym(1).Node = node; + } break; ./ -UiObjectMember: T_ENUM T_IDENTIFIER T_LBRACE EnumMemberList T_RBRACE; +ArrayLiteral: T_LBRACKET ElementList T_COMMA ElisionOpt T_RBRACKET; /. -case $rule_number: { - AST::UiEnumDeclaration *enumDeclaration = new (pool) AST::UiEnumDeclaration(stringRef(2), sym(4).UiEnumMemberList->finish()); - enumDeclaration->enumToken = loc(1); - enumDeclaration->rbraceToken = loc(5); - sym(1).Node = enumDeclaration; - break; -} + case $rule_number: { + auto *list = sym(2).PatternElementList; + if (sym(4).Elision) { + AST::PatternElementList *l = new (pool) AST::PatternElementList(sym(4).Elision, nullptr); + list = list->append(l); + } + AST::ArrayPattern *node = new (pool) AST::ArrayPattern(list->finish()); + node->lbracketToken = loc(1); + node->commaToken = loc(3); + node->rbracketToken = loc(5); + sym(1).Node = node; + Q_ASSERT(node->isValidArrayLiteral()); + } break; ./ -EnumMemberList: T_IDENTIFIER; +ElementList: AssignmentExpression_In; /. -case $rule_number: { - AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1)); - node->memberToken = loc(1); - sym(1).Node = node; - break; -} + case $rule_number: { + AST::PatternElement *e = new (pool) AST::PatternElement(sym(1).Expression); + sym(1).Node = new (pool) AST::PatternElementList(nullptr, e); + } break; ./ -EnumMemberList: T_IDENTIFIER T_EQ T_NUMERIC_LITERAL; +ElementList: Elision AssignmentExpression_In; /. -case $rule_number: { - AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1), sym(3).dval); - node->memberToken = loc(1); - node->valueToken = loc(3); - sym(1).Node = node; - break; -} + case $rule_number: { + AST::PatternElement *e = new (pool) AST::PatternElement(sym(2).Expression); + sym(1).Node = new (pool) AST::PatternElementList(sym(1).Elision->finish(), e); + } break; ./ -EnumMemberList: EnumMemberList T_COMMA T_IDENTIFIER; +ElementList: ElisionOpt SpreadElement; /. -case $rule_number: { - AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3)); - node->memberToken = loc(3); - sym(1).Node = node; - break; -} + case $rule_number: { + AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(1).Elision, sym(2).PatternElement); + sym(1).Node = node; + } break; ./ -EnumMemberList: EnumMemberList T_COMMA T_IDENTIFIER T_EQ T_NUMERIC_LITERAL; +ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression_In; /. -case $rule_number: { - AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3), sym(5).dval); - node->memberToken = loc(3); - node->valueToken = loc(5); - sym(1).Node = node; - break; -} + case $rule_number: { + AST::PatternElement *e = new (pool) AST::PatternElement(sym(4).Expression); + AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(3).Elision, e); + sym(1).Node = sym(1).PatternElementList->append(node); + } break; ./ -JsIdentifier: T_IDENTIFIER; +ElementList: ElementList T_COMMA ElisionOpt SpreadElement; +/. + case $rule_number: { + AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(3).Elision, sym(4).PatternElement); + sym(1).Node = sym(1).PatternElementList->append(node); + } break; +./ -JsIdentifier: T_PROPERTY ; -JsIdentifier: T_SIGNAL ; -JsIdentifier: T_READONLY ; -JsIdentifier: T_ON ; -JsIdentifier: T_GET ; -JsIdentifier: T_SET ; +Elision: T_COMMA; +/. + case $rule_number: { + AST::Elision *node = new (pool) AST::Elision(); + node->commaToken = loc(1); + sym(1).Node = node; + } break; +./ --------------------------------------------------------------------------------------------------------- --- Expressions --------------------------------------------------------------------------------------------------------- +Elision: Elision T_COMMA; +/. + case $rule_number: { + AST::Elision *node = new (pool) AST::Elision(sym(1).Elision); + node->commaToken = loc(2); + sym(1).Node = node; + } break; +./ -PrimaryExpression: T_THIS ; +ElisionOpt: ; /. -case $rule_number: { - AST::ThisExpression *node = new (pool) AST::ThisExpression(); - node->thisToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -PrimaryExpression: JsIdentifier ; +ElisionOpt: Elision; /. -case $rule_number: { - AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(1).Elision->finish(); + } break; ./ -PrimaryExpression: T_NULL ; +SpreadElement: T_ELLIPSIS AssignmentExpression; /. -case $rule_number: { - AST::NullExpression *node = new (pool) AST::NullExpression(); - node->nullToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PatternElement *node = new (pool) AST::PatternElement(sym(2).Expression, AST::PatternElement::SpreadElement); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_TRUE ; +ObjectLiteral: T_LBRACE T_RBRACE; /. -case $rule_number: { - AST::TrueLiteral *node = new (pool) AST::TrueLiteral(); - node->trueToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ObjectPattern *node = new (pool) AST::ObjectPattern(); + node->lbraceToken = loc(1); + node->rbraceToken = loc(2); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_FALSE ; +ObjectLiteral: T_LBRACE PropertyDefinitionList T_RBRACE; /. -case $rule_number: { - AST::FalseLiteral *node = new (pool) AST::FalseLiteral(); - node->falseToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ObjectPattern *node = new (pool) AST::ObjectPattern(sym(2).PatternPropertyList->finish()); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_NUMERIC_LITERAL ; +ObjectLiteral: T_LBRACE PropertyDefinitionList T_COMMA T_RBRACE; /. -case $rule_number: { - AST::NumericLiteral *node = new (pool) AST::NumericLiteral(sym(1).dval); - node->literalToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ObjectPattern *node = new (pool) AST::ObjectPattern(sym(2).PatternPropertyList->finish()); + node->lbraceToken = loc(1); + node->rbraceToken = loc(4); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_MULTILINE_STRING_LITERAL ; -/.case $rule_number:./ -PrimaryExpression: T_STRING_LITERAL ; +UiPropertyDefinitionList: UiPropertyDefinition; +/. case $rule_number: Q_FALLTHROUGH(); ./ +PropertyDefinitionList: PropertyDefinition; /. -case $rule_number: { - AST::StringLiteral *node = new (pool) AST::StringLiteral(stringRef(1)); - node->literalToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::PatternPropertyList(sym(1).PatternProperty); + } break; ./ -PrimaryExpression: T_DIVIDE_ ; -/: -#define J_SCRIPT_REGEXPLITERAL_RULE1 $rule_number -:/ +UiPropertyDefinitionList: UiPropertyDefinitionList T_COMMA UiPropertyDefinition; +/. case $rule_number: Q_FALLTHROUGH(); ./ +PropertyDefinitionList: PropertyDefinitionList T_COMMA PropertyDefinition; /. -case $rule_number: { - bool rx = lexer->scanRegExp(Lexer::NoPrefix); - if (!rx) { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); - return false; // ### remove me - } - - loc(1).length = lexer->tokenLength(); - yylloc = loc(1); // adjust the location of the current token - - AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral( - driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); - node->literalToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PatternPropertyList *node = new (pool) AST::PatternPropertyList(sym(1).PatternPropertyList, sym(3).PatternProperty); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_DIVIDE_EQ ; -/: -#define J_SCRIPT_REGEXPLITERAL_RULE2 $rule_number -:/ +PropertyDefinition: IdentifierReference; /. -case $rule_number: { - bool rx = lexer->scanRegExp(Lexer::EqualPrefix); - if (!rx) { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); - return false; - } + case $rule_number: { + AST::IdentifierPropertyName *name = new (pool) AST::IdentifierPropertyName(stringRef(1)); + name->propertyNameToken = loc(1); + AST::IdentifierExpression *expr = new (pool) AST::IdentifierExpression(stringRef(1)); + expr->identifierToken = loc(1); + AST::PatternProperty *node = new (pool) AST::PatternProperty(name, expr); + node->colonToken = loc(2); + sym(1).Node = node; + } break; +./ - loc(1).length = lexer->tokenLength(); - yylloc = loc(1); // adjust the location of the current token +-- Using this production should result in a syntax error when used in an ObjectLiteral +PropertyDefinition: CoverInitializedName; - AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral( - driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); - node->literalToken = loc(1); - sym(1).Node = node; -} break; +CoverInitializedName: IdentifierReference Initializer_In; +/. + case $rule_number: { + AST::IdentifierPropertyName *name = new (pool) AST::IdentifierPropertyName(stringRef(1)); + name->propertyNameToken = loc(1); + AST::IdentifierExpression *left = new (pool) AST::IdentifierExpression(stringRef(1)); + left->identifierToken = loc(1); + // if initializer is an anonymous function expression, we need to assign identifierref as it's name + if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression)) + f->name = stringRef(1); + if (auto *c = asAnonymousClassDefinition(sym(2).Expression)) + c->name = stringRef(1); + AST::BinaryExpression *assignment = new (pool) AST::BinaryExpression(left, QSOperator::Assign, sym(2).Expression); + AST::PatternProperty *node = new (pool) AST::PatternProperty(name, assignment); + node->colonToken = loc(1); + sym(1).Node = node; + + } break; ./ -PrimaryExpression: T_LBRACKET T_RBRACKET ; +UiPropertyDefinition: UiPropertyName T_COLON AssignmentExpression_In; +/. case $rule_number: Q_FALLTHROUGH(); ./ +PropertyDefinition: PropertyName T_COLON AssignmentExpression_In; /. -case $rule_number: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral((AST::Elision *) 0); - node->lbracketToken = loc(1); - node->rbracketToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, sym(3).Expression); + if (auto *f = asAnonymousFunctionDefinition(sym(3).Expression)) { + if (!AST::cast<AST::ComputedPropertyName *>(sym(1).PropertyName)) + f->name = driver->newStringRef(sym(1).PropertyName->asString()); + } + if (auto *c = asAnonymousClassDefinition(sym(3).Expression)) { + if (!AST::cast<AST::ComputedPropertyName *>(sym(1).PropertyName)) + c->name = driver->newStringRef(sym(1).PropertyName->asString()); + } + node->colonToken = loc(2); + sym(1).Node = node; + } break; +./ + +PropertyDefinition: MethodDefinition; + +PropertyName: LiteralPropertyName; +PropertyName: ComputedPropertyName; + +LiteralPropertyName: IdentifierName; +/. + case $rule_number: { + AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); + node->propertyNameToken = loc(1); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_LBRACKET Elision T_RBRACKET ; +UiPropertyName: T_STRING_LITERAL; +/. case $rule_number: Q_FALLTHROUGH(); ./ +LiteralPropertyName: T_STRING_LITERAL; /. -case $rule_number: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).Elision->finish()); - node->lbracketToken = loc(1); - node->rbracketToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::StringLiteralPropertyName *node = new (pool) AST::StringLiteralPropertyName(stringRef(1)); + node->propertyNameToken = loc(1); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_LBRACKET ElementList T_RBRACKET ; +UiPropertyName: T_NUMERIC_LITERAL; +/. case $rule_number: Q_FALLTHROUGH(); ./ +LiteralPropertyName: T_NUMERIC_LITERAL; /. -case $rule_number: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish ()); - node->lbracketToken = loc(1); - node->rbracketToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::NumericLiteralPropertyName *node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval); + node->propertyNameToken = loc(1); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_LBRACKET ElementList T_COMMA T_RBRACKET ; +IdentifierName: IdentifierReference; +IdentifierName: ReservedIdentifier; + +ReservedIdentifier: T_BREAK; +ReservedIdentifier: T_CASE; +ReservedIdentifier: T_CATCH; +ReservedIdentifier: T_CONTINUE; +ReservedIdentifier: T_DEFAULT; +ReservedIdentifier: T_DELETE; +ReservedIdentifier: T_DO; +ReservedIdentifier: T_ELSE; +ReservedIdentifier: T_ENUM; +ReservedIdentifier: T_FALSE; +ReservedIdentifier: T_FINALLY; +ReservedIdentifier: T_FOR; +ReservedIdentifier: T_FUNCTION; +ReservedIdentifier: T_IF; +ReservedIdentifier: T_IN; +ReservedIdentifier: T_INSTANCEOF; +ReservedIdentifier: T_NEW; +ReservedIdentifier: T_NULL; +ReservedIdentifier: T_RETURN; +ReservedIdentifier: T_SWITCH; +ReservedIdentifier: T_THIS; +ReservedIdentifier: T_THROW; +ReservedIdentifier: T_TRUE; +ReservedIdentifier: T_TRY; +ReservedIdentifier: T_TYPEOF; +ReservedIdentifier: T_VAR; +ReservedIdentifier: T_VOID; +ReservedIdentifier: T_WHILE; +ReservedIdentifier: T_CONST; +ReservedIdentifier: T_LET; +ReservedIdentifier: T_DEBUGGER; +ReservedIdentifier: T_RESERVED_WORD; +ReservedIdentifier: T_SUPER; +ReservedIdentifier: T_WITH; +ReservedIdentifier: T_CLASS; +ReservedIdentifier: T_EXTENDS; +ReservedIdentifier: T_EXPORT; +ReservedIdentifier: T_IMPORT; + +ComputedPropertyName: T_LBRACKET AssignmentExpression_In T_RBRACKET; /. -case $rule_number: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), - (AST::Elision *) 0); - node->lbracketToken = loc(1); - node->commaToken = loc(3); - node->rbracketToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ComputedPropertyName *node = new (pool) AST::ComputedPropertyName(sym(2).Expression); + node->propertyNameToken = loc(1); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_LBRACKET ElementList T_COMMA Elision T_RBRACKET ; +Initializer: T_EQ AssignmentExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Initializer_In: T_EQ AssignmentExpression_In; /. case $rule_number: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), - sym(4).Elision->finish()); - node->lbracketToken = loc(1); - node->commaToken = loc(3); - node->rbracketToken = loc(5); - sym(1).Node = node; + sym(1) = sym(2); } break; ./ --- PrimaryExpression: T_LBRACE T_RBRACE ; --- /. --- case $rule_number: { --- sym(1).Node = new (pool) AST::ObjectLiteral(); --- } break; --- ./ -PrimaryExpression: T_LBRACE PropertyAssignmentListOpt T_RBRACE ; +InitializerOpt: ; +/. case $rule_number: Q_FALLTHROUGH(); ./ +InitializerOpt_In: ; /. -case $rule_number: { - AST::ObjectLiteral *node = 0; - if (sym(2).Node) - node = new (pool) AST::ObjectLiteral( - sym(2).PropertyAssignmentList->finish ()); - else - node = new (pool) AST::ObjectLiteral(); - node->lbraceToken = loc(1); - node->rbraceToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -PrimaryExpression: T_LBRACE PropertyAssignmentList T_COMMA T_RBRACE ; +InitializerOpt: Initializer; +InitializerOpt_In: Initializer_In; + +TemplateLiteral: T_NO_SUBSTITUTION_TEMPLATE; +/. case $rule_number: Q_FALLTHROUGH(); ./ + +TemplateSpans: T_TEMPLATE_TAIL; /. -case $rule_number: { - AST::ObjectLiteral *node = new (pool) AST::ObjectLiteral( - sym(2).PropertyAssignmentList->finish ()); - node->lbraceToken = loc(1); - node->rbraceToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::TemplateLiteral *node = new (pool) AST::TemplateLiteral(stringRef(1), nullptr); + node->literalToken = loc(1); + sym(1).Node = node; + } break; ./ -PrimaryExpression: T_LPAREN Expression T_RPAREN ; +TemplateSpans: T_TEMPLATE_MIDDLE Expression TemplateSpans; +/. case $rule_number: Q_FALLTHROUGH(); ./ + +TemplateLiteral: T_TEMPLATE_HEAD Expression TemplateSpans; /. -case $rule_number: { - AST::NestedExpression *node = new (pool) AST::NestedExpression(sym(2).Expression); - node->lparenToken = loc(1); - node->rparenToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::TemplateLiteral *node = new (pool) AST::TemplateLiteral(stringRef(1), sym(2).Expression); + node->next = sym(3).Template; + node->literalToken = loc(1); + sym(1).Node = node; + } break; ./ -UiQualifiedId: MemberExpression ; +MemberExpression: PrimaryExpression; + +Super: T_SUPER; /. -case $rule_number: { - if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) { - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken, - QLatin1String("Ignored annotation"))); + case $rule_number: { + AST::SuperLiteral *node = new (pool) AST::SuperLiteral(); + node->superToken = loc(1); + sym(1).Node = node; + } break; +./ - sym(1).Expression = mem->base; - } - if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) { - sym(1).UiQualifiedId = qualifiedId; - } else { - sym(1).UiQualifiedId = 0; +MemberExpression: Super T_LBRACKET Expression_In T_RBRACKET; +/. case $rule_number: Q_FALLTHROUGH(); ./ +MemberExpression: MemberExpression T_LBRACKET Expression_In T_RBRACKET; +/. + case $rule_number: { + AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); + node->lbracketToken = loc(2); + node->rbracketToken = loc(4); + sym(1).Node = node; + } break; +./ - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), - QLatin1String("Expected a qualified name id"))); - return false; // ### recover - } -} break; +-- the identifier has to be "target", catched at codegen time +NewTarget: T_NEW T_DOT T_IDENTIFIER; +/. case $rule_number: + { + AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1)); + node->identifierToken= loc(1); + sym(1).Node = node; + } Q_FALLTHROUGH(); +./ +MemberExpression: Super T_DOT IdentifierName; +/. case $rule_number: Q_FALLTHROUGH(); ./ +MemberExpression: MemberExpression T_DOT IdentifierName; +/. + case $rule_number: { + AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); + node->dotToken = loc(2); + node->identifierToken = loc(3); + sym(1).Node = node; + } break; ./ -ElementList: AssignmentExpression ; +MemberExpression: MetaProperty; + +MemberExpression: T_NEW MemberExpression T_LPAREN Arguments T_RPAREN; /. -case $rule_number: { - sym(1).Node = new (pool) AST::ElementList((AST::Elision *) 0, sym(1).Expression); -} break; + case $rule_number: { + AST::NewMemberExpression *node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList); + node->newToken = loc(1); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + sym(1).Node = node; + } break; ./ -ElementList: Elision AssignmentExpression ; +MetaProperty: NewTarget; + + +NewExpression: MemberExpression; + +NewExpression: T_NEW NewExpression; /. -case $rule_number: { - sym(1).Node = new (pool) AST::ElementList(sym(1).Elision->finish(), sym(2).Expression); -} break; + case $rule_number: { + AST::NewExpression *node = new (pool) AST::NewExpression(sym(2).Expression); + node->newToken = loc(1); + sym(1).Node = node; + } break; ./ -ElementList: ElementList T_COMMA AssignmentExpression ; + +CallExpression: CallExpression TemplateLiteral; +/. case $rule_number: Q_FALLTHROUGH(); ./ +MemberExpression: MemberExpression TemplateLiteral; /. -case $rule_number: { - AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, - (AST::Elision *) 0, sym(3).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::TaggedTemplate *node = new (pool) AST::TaggedTemplate(sym(1).Expression, sym(2).Template); + sym(1).Node = node; + } break; ./ -ElementList: ElementList T_COMMA Elision AssignmentExpression ; +CallExpression: MemberExpression T_LPAREN Arguments T_RPAREN; /. -case $rule_number: { - AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, sym(3).Elision->finish(), - sym(4).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; ./ -Elision: T_COMMA ; +CallExpression: Super T_LPAREN Arguments T_RPAREN; +/. case $rule_number: Q_FALLTHROUGH(); ./ +CallExpression: CallExpression T_LPAREN Arguments T_RPAREN; /. -case $rule_number: { - AST::Elision *node = new (pool) AST::Elision(); - node->commaToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; ./ -Elision: Elision T_COMMA ; +CallExpression: CallExpression T_LBRACKET Expression_In T_RBRACKET; /. -case $rule_number: { - AST::Elision *node = new (pool) AST::Elision(sym(1).Elision); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); + node->lbracketToken = loc(2); + node->rbracketToken = loc(4); + sym(1).Node = node; + } break; ./ -PropertyAssignment: PropertyName T_COLON AssignmentExpression ; +CallExpression: CallExpression T_DOT IdentifierName; /. -case $rule_number: { - AST::PropertyNameAndValue *node = new (pool) AST::PropertyNameAndValue( - sym(1).PropertyName, sym(3).Expression); - node->colonToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); + node->dotToken = loc(2); + node->identifierToken = loc(3); + sym(1).Node = node; + } break; ./ -PropertyAssignment: T_GET PropertyName T_LPAREN T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; +Arguments: ; /. -case $rule_number: { - AST::PropertyGetterSetter *node = new (pool) AST::PropertyGetterSetter( - sym(2).PropertyName, sym(6).FunctionBody); - node->getSetToken = loc(1); - node->lparenToken = loc(3); - node->rparenToken = loc(4); - node->lbraceToken = loc(5); - node->rbraceToken = loc(7); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -PropertyAssignment: T_SET PropertyName T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; +Arguments: ArgumentList; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Arguments: ArgumentList T_COMMA; /. -case $rule_number: { - AST::PropertyGetterSetter *node = new (pool) AST::PropertyGetterSetter( - sym(2).PropertyName, sym(4).FormalParameterList, sym(7).FunctionBody); - node->getSetToken = loc(1); - node->lparenToken = loc(3); - node->rparenToken = loc(5); - node->lbraceToken = loc(6); - node->rbraceToken = loc(8); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(1).ArgumentList->finish(); + } break; ./ -PropertyAssignmentList: PropertyAssignment ; +ArgumentList: AssignmentExpression_In; /. -case $rule_number: { - sym(1).Node = new (pool) AST::PropertyAssignmentList(sym(1).PropertyAssignment); -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression); + } break; ./ -PropertyAssignmentList: PropertyAssignmentList T_COMMA PropertyAssignment ; +ArgumentList: T_ELLIPSIS AssignmentExpression_In; /. -case $rule_number: { - AST::PropertyAssignmentList *node = new (pool) AST::PropertyAssignmentList( - sym(1).PropertyAssignmentList, sym(3).PropertyAssignment); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(2).Expression); + node->isSpreadElement = true; + sym(1).Node = node; + } break; ./ -PropertyName: JsIdentifier %prec SHIFT_THERE ; +ArgumentList: ArgumentList T_COMMA AssignmentExpression_In; /. -case $rule_number: { - AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); - node->propertyNameToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression); + node->commaToken = loc(2); + sym(1).Node = node; + } break; ./ -PropertyName: T_STRING_LITERAL ; +ArgumentList: ArgumentList T_COMMA T_ELLIPSIS AssignmentExpression_In; /. -case $rule_number: { - AST::StringLiteralPropertyName *node = new (pool) AST::StringLiteralPropertyName(stringRef(1)); - node->propertyNameToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(4).Expression); + node->commaToken = loc(2); + node->isSpreadElement = true; + sym(1).Node = node; + } break; ./ -PropertyName: T_NUMERIC_LITERAL ; +LeftHandSideExpression: NewExpression; +LeftHandSideExpression: CallExpression; + +UpdateExpression: LeftHandSideExpression; + +UpdateExpression: LeftHandSideExpression T_PLUS_PLUS; /. -case $rule_number: { - AST::NumericLiteralPropertyName *node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval); - node->propertyNameToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PostIncrementExpression *node = new (pool) AST::PostIncrementExpression(sym(1).Expression); + node->incrementToken = loc(2); + sym(1).Node = node; + } break; ./ -PropertyName: ReservedIdentifier ; +UpdateExpression: LeftHandSideExpression T_MINUS_MINUS; /. -case $rule_number: { - AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); - node->propertyNameToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PostDecrementExpression *node = new (pool) AST::PostDecrementExpression(sym(1).Expression); + node->decrementToken = loc(2); + sym(1).Node = node; + } break; ./ -ReservedIdentifier: T_BREAK ; -ReservedIdentifier: T_CASE ; -ReservedIdentifier: T_CATCH ; -ReservedIdentifier: T_CONTINUE ; -ReservedIdentifier: T_DEFAULT ; -ReservedIdentifier: T_DELETE ; -ReservedIdentifier: T_DO ; -ReservedIdentifier: T_ELSE ; -ReservedIdentifier: T_ENUM ; -ReservedIdentifier: T_FALSE ; -ReservedIdentifier: T_FINALLY ; -ReservedIdentifier: T_FOR ; -ReservedIdentifier: T_FUNCTION ; -ReservedIdentifier: T_IF ; -ReservedIdentifier: T_IN ; -ReservedIdentifier: T_INSTANCEOF ; -ReservedIdentifier: T_NEW ; -ReservedIdentifier: T_NULL ; -ReservedIdentifier: T_RETURN ; -ReservedIdentifier: T_SWITCH ; -ReservedIdentifier: T_THIS ; -ReservedIdentifier: T_THROW ; -ReservedIdentifier: T_TRUE ; -ReservedIdentifier: T_TRY ; -ReservedIdentifier: T_TYPEOF ; -ReservedIdentifier: T_VAR ; -ReservedIdentifier: T_VOID ; -ReservedIdentifier: T_WHILE ; -ReservedIdentifier: T_CONST ; -ReservedIdentifier: T_LET ; -ReservedIdentifier: T_DEBUGGER ; -ReservedIdentifier: T_RESERVED_WORD ; -ReservedIdentifier: T_WITH ; - -PropertyIdentifier: JsIdentifier ; -PropertyIdentifier: ReservedIdentifier ; - -MemberExpression: PrimaryExpression ; -MemberExpression: FunctionExpression ; - -MemberExpression: MemberExpression T_LBRACKET Expression T_RBRACKET ; +UpdateExpression: T_PLUS_PLUS UnaryExpression; /. -case $rule_number: { - AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); - node->lbracketToken = loc(2); - node->rbracketToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PreIncrementExpression *node = new (pool) AST::PreIncrementExpression(sym(2).Expression); + node->incrementToken = loc(1); + sym(1).Node = node; + } break; ./ -MemberExpression: MemberExpression T_DOT PropertyIdentifier ; +UpdateExpression: T_MINUS_MINUS UnaryExpression; /. -case $rule_number: { - AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); - node->dotToken = loc(2); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PreDecrementExpression *node = new (pool) AST::PreDecrementExpression(sym(2).Expression); + node->decrementToken = loc(1); + sym(1).Node = node; + } break; ./ -MemberExpression: T_NEW MemberExpression T_LPAREN ArgumentListOpt T_RPAREN ; +UnaryExpression: UpdateExpression; + +UnaryExpression: T_DELETE UnaryExpression; /. -case $rule_number: { - AST::NewMemberExpression *node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList); - node->newToken = loc(1); - node->lparenToken = loc(3); - node->rparenToken = loc(5); - sym(1).Node = node; -} break; + case $rule_number: { + AST::DeleteExpression *node = new (pool) AST::DeleteExpression(sym(2).Expression); + node->deleteToken = loc(1); + sym(1).Node = node; + } break; ./ -NewExpression: MemberExpression ; +UnaryExpression: T_VOID UnaryExpression; +/. + case $rule_number: { + AST::VoidExpression *node = new (pool) AST::VoidExpression(sym(2).Expression); + node->voidToken = loc(1); + sym(1).Node = node; + } break; +./ -NewExpression: T_NEW NewExpression ; +UnaryExpression: T_TYPEOF UnaryExpression; /. -case $rule_number: { - AST::NewExpression *node = new (pool) AST::NewExpression(sym(2).Expression); - node->newToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::TypeOfExpression *node = new (pool) AST::TypeOfExpression(sym(2).Expression); + node->typeofToken = loc(1); + sym(1).Node = node; + } break; ./ -CallExpression: MemberExpression T_LPAREN ArgumentListOpt T_RPAREN ; +UnaryExpression: T_PLUS UnaryExpression; /. -case $rule_number: { - AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UnaryPlusExpression *node = new (pool) AST::UnaryPlusExpression(sym(2).Expression); + node->plusToken = loc(1); + sym(1).Node = node; + } break; ./ -CallExpression: CallExpression T_LPAREN ArgumentListOpt T_RPAREN ; +UnaryExpression: T_MINUS UnaryExpression; /. -case $rule_number: { - AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::UnaryMinusExpression *node = new (pool) AST::UnaryMinusExpression(sym(2).Expression); + node->minusToken = loc(1); + sym(1).Node = node; + } break; ./ -CallExpression: CallExpression T_LBRACKET Expression T_RBRACKET ; +UnaryExpression: T_TILDE UnaryExpression; /. -case $rule_number: { - AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); - node->lbracketToken = loc(2); - node->rbracketToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::TildeExpression *node = new (pool) AST::TildeExpression(sym(2).Expression); + node->tildeToken = loc(1); + sym(1).Node = node; + } break; ./ -CallExpression: CallExpression T_DOT PropertyIdentifier ; +UnaryExpression: T_NOT UnaryExpression; /. -case $rule_number: { - AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); - node->dotToken = loc(2); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::NotExpression *node = new (pool) AST::NotExpression(sym(2).Expression); + node->notToken = loc(1); + sym(1).Node = node; + } break; ./ -ArgumentListOpt: ; +ExponentiationExpression: UnaryExpression; + +ExponentiationExpression: UpdateExpression T_STAR_STAR ExponentiationExpression; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Exp, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -ArgumentListOpt: ArgumentList ; +MultiplicativeExpression: ExponentiationExpression; + +MultiplicativeExpression: MultiplicativeExpression MultiplicativeOperator ExponentiationExpression; /. -case $rule_number: { - sym(1).Node = sym(1).ArgumentList->finish(); -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -ArgumentList: AssignmentExpression ; +MultiplicativeOperator: T_STAR; /. -case $rule_number: { - sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression); -} break; + case $rule_number: { + sym(1).ival = QSOperator::Mul; + } break; ./ -ArgumentList: ArgumentList T_COMMA AssignmentExpression ; +MultiplicativeOperator: T_DIVIDE_; /. -case $rule_number: { - AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::Div; + } break; +./ + +MultiplicativeOperator: T_REMAINDER; +/. + case $rule_number: { + sym(1).ival = QSOperator::Mod; + } break; ./ -LeftHandSideExpression: NewExpression ; -LeftHandSideExpression: CallExpression ; -PostfixExpression: LeftHandSideExpression ; +AdditiveExpression: MultiplicativeExpression; -PostfixExpression: LeftHandSideExpression T_PLUS_PLUS ; +AdditiveExpression: AdditiveExpression T_PLUS MultiplicativeExpression; /. -case $rule_number: { - AST::PostIncrementExpression *node = new (pool) AST::PostIncrementExpression(sym(1).Expression); - node->incrementToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Add, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -PostfixExpression: LeftHandSideExpression T_MINUS_MINUS ; +AdditiveExpression: AdditiveExpression T_MINUS MultiplicativeExpression; /. -case $rule_number: { - AST::PostDecrementExpression *node = new (pool) AST::PostDecrementExpression(sym(1).Expression); - node->decrementToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Sub, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -UnaryExpression: PostfixExpression ; +ShiftExpression: AdditiveExpression; -UnaryExpression: T_DELETE UnaryExpression ; +ShiftExpression: ShiftExpression T_LT_LT AdditiveExpression; /. -case $rule_number: { - AST::DeleteExpression *node = new (pool) AST::DeleteExpression(sym(2).Expression); - node->deleteToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::LShift, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -UnaryExpression: T_VOID UnaryExpression ; +ShiftExpression: ShiftExpression T_GT_GT AdditiveExpression; /. -case $rule_number: { - AST::VoidExpression *node = new (pool) AST::VoidExpression(sym(2).Expression); - node->voidToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::RShift, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -UnaryExpression: T_TYPEOF UnaryExpression ; +ShiftExpression: ShiftExpression T_GT_GT_GT AdditiveExpression; /. -case $rule_number: { - AST::TypeOfExpression *node = new (pool) AST::TypeOfExpression(sym(2).Expression); - node->typeofToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::URShift, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -UnaryExpression: T_PLUS_PLUS UnaryExpression ; +RelationalExpression_In: ShiftExpression; +RelationalExpression: ShiftExpression; + +RelationalExpression_In: RelationalExpression_In RelationalOperator ShiftExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +RelationalExpression: RelationalExpression RelationalOperator ShiftExpression; /. -case $rule_number: { - AST::PreIncrementExpression *node = new (pool) AST::PreIncrementExpression(sym(2).Expression); - node->incrementToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -UnaryExpression: T_MINUS_MINUS UnaryExpression ; +RelationalOperator: T_LT; /. -case $rule_number: { - AST::PreDecrementExpression *node = new (pool) AST::PreDecrementExpression(sym(2).Expression); - node->decrementToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::Lt; + } break; +./ +RelationalOperator: T_GT; +/. + case $rule_number: { + sym(1).ival = QSOperator::Gt; + } break; +./ +RelationalOperator: T_LE; +/. + case $rule_number: { + sym(1).ival = QSOperator::Le; + } break; +./ +RelationalOperator: T_GE; +/. + case $rule_number: { + sym(1).ival = QSOperator::Ge; + } break; +./ +RelationalOperator: T_INSTANCEOF; +/. + case $rule_number: { + sym(1).ival = QSOperator::InstanceOf; + } break; ./ -UnaryExpression: T_PLUS UnaryExpression ; +RelationalExpression_In: RelationalExpression_In T_IN ShiftExpression; /. -case $rule_number: { - AST::UnaryPlusExpression *node = new (pool) AST::UnaryPlusExpression(sym(2).Expression); - node->plusToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::In, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -UnaryExpression: T_MINUS UnaryExpression ; +EqualityExpression_In: RelationalExpression_In; +EqualityExpression: RelationalExpression; + +EqualityExpression_In: EqualityExpression_In EqualityOperator RelationalExpression_In; +/. case $rule_number: Q_FALLTHROUGH(); ./ +EqualityExpression: EqualityExpression EqualityOperator RelationalExpression; /. -case $rule_number: { - AST::UnaryMinusExpression *node = new (pool) AST::UnaryMinusExpression(sym(2).Expression); - node->minusToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -UnaryExpression: T_TILDE UnaryExpression ; +EqualityOperator: T_EQ_EQ; /. -case $rule_number: { - AST::TildeExpression *node = new (pool) AST::TildeExpression(sym(2).Expression); - node->tildeToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::Equal; + } break; +./ +EqualityOperator: T_NOT_EQ; +/. + case $rule_number: { + sym(1).ival = QSOperator::NotEqual; + } break; +./ +EqualityOperator: T_EQ_EQ_EQ; +/. + case $rule_number: { + sym(1).ival = QSOperator::StrictEqual; + } break; +./ +EqualityOperator: T_NOT_EQ_EQ; +/. + case $rule_number: { + sym(1).ival = QSOperator::StrictNotEqual; + } break; ./ -UnaryExpression: T_NOT UnaryExpression ; + +BitwiseANDExpression: EqualityExpression; +BitwiseANDExpression_In: EqualityExpression_In; + +BitwiseANDExpression: BitwiseANDExpression T_AND EqualityExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +BitwiseANDExpression_In: BitwiseANDExpression_In T_AND EqualityExpression_In; /. -case $rule_number: { - AST::NotExpression *node = new (pool) AST::NotExpression(sym(2).Expression); - node->notToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -MultiplicativeExpression: UnaryExpression ; -MultiplicativeExpression: MultiplicativeExpression T_STAR UnaryExpression ; +BitwiseXORExpression: BitwiseANDExpression; +BitwiseXORExpression_In: BitwiseANDExpression_In; + +BitwiseXORExpression: BitwiseXORExpression T_XOR BitwiseANDExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +BitwiseXORExpression_In: BitwiseXORExpression_In T_XOR BitwiseANDExpression_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Mul, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -MultiplicativeExpression: MultiplicativeExpression T_DIVIDE_ UnaryExpression ; +BitwiseORExpression: BitwiseXORExpression; +BitwiseORExpression_In: BitwiseXORExpression_In; + +BitwiseORExpression: BitwiseORExpression T_OR BitwiseXORExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +BitwiseORExpression_In: BitwiseORExpression_In T_OR BitwiseXORExpression_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Div, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -MultiplicativeExpression: MultiplicativeExpression T_REMAINDER UnaryExpression ; +LogicalANDExpression: BitwiseORExpression; +LogicalANDExpression_In: BitwiseORExpression_In; + +LogicalANDExpression: LogicalANDExpression T_AND_AND BitwiseORExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +LogicalANDExpression_In: LogicalANDExpression_In T_AND_AND BitwiseORExpression_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Mod, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -AdditiveExpression: MultiplicativeExpression ; +LogicalORExpression: LogicalANDExpression; +LogicalORExpression_In: LogicalANDExpression_In; -AdditiveExpression: AdditiveExpression T_PLUS MultiplicativeExpression ; +LogicalORExpression: LogicalORExpression T_OR_OR LogicalANDExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +LogicalORExpression_In: LogicalORExpression_In T_OR_OR LogicalANDExpression_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Add, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -AdditiveExpression: AdditiveExpression T_MINUS MultiplicativeExpression ; + +ConditionalExpression: LogicalORExpression; +ConditionalExpression_In: LogicalORExpression_In; + +ConditionalExpression: LogicalORExpression T_QUESTION AssignmentExpression_In T_COLON AssignmentExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ConditionalExpression_In: LogicalORExpression_In T_QUESTION AssignmentExpression_In T_COLON AssignmentExpression_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Sub, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression); + node->questionToken = loc(2); + node->colonToken = loc(4); + sym(1).Node = node; + } break; ./ -ShiftExpression: AdditiveExpression ; +AssignmentExpression: ConditionalExpression; +AssignmentExpression_In: ConditionalExpression_In; + +AssignmentExpression: YieldExpression; +AssignmentExpression_In: YieldExpression_In; -ShiftExpression: ShiftExpression T_LT_LT AdditiveExpression ; +AssignmentExpression: ArrowFunction; +AssignmentExpression_In: ArrowFunction_In; + +AssignmentExpression: LeftHandSideExpression T_EQ AssignmentExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +AssignmentExpression_In: LeftHandSideExpression T_EQ AssignmentExpression_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::LShift, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + // need to convert the LHS to an AssignmentPattern if it was an Array/ObjectLiteral + if (AST::Pattern *p = sym(1).Expression->patternCast()) { + AST::SourceLocation errorLoc; + QString errorMsg; + if (!p->convertLiteralToAssignmentPattern(pool, &errorLoc, &errorMsg)) { + syntaxError(errorLoc, errorMsg); + return false; + } + } + // if lhs is an identifier expression and rhs is an anonymous function expression, we need to assign the name of lhs to the function + if (auto *f = asAnonymousFunctionDefinition(sym(3).Expression)) { + if (auto *id = AST::cast<AST::IdentifierExpression *>(sym(1).Expression)) + f->name = id->name; + } + if (auto *c = asAnonymousClassDefinition(sym(3).Expression)) { + if (auto *id = AST::cast<AST::IdentifierExpression *>(sym(1).Expression)) + c->name = id->name; + } + + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Assign, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -ShiftExpression: ShiftExpression T_GT_GT AdditiveExpression ; +AssignmentExpression: LeftHandSideExpression AssignmentOperator AssignmentExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +AssignmentExpression_In: LeftHandSideExpression AssignmentOperator AssignmentExpression_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::RShift, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; ./ -ShiftExpression: ShiftExpression T_GT_GT_GT AdditiveExpression ; +AssignmentOperator: T_STAR_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::URShift, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceMul; + } break; ./ -RelationalExpression: ShiftExpression ; +AssignmentOperator: T_STAR_STAR_EQ; +/. + case $rule_number: { + sym(1).ival = QSOperator::InplaceExp; + } break; +./ -RelationalExpression: RelationalExpression T_LT ShiftExpression ; +AssignmentOperator: T_DIVIDE_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Lt, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceDiv; + } break; ./ -RelationalExpression: RelationalExpression T_GT ShiftExpression ; +AssignmentOperator: T_REMAINDER_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Gt, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceMod; + } break; ./ -RelationalExpression: RelationalExpression T_LE ShiftExpression ; +AssignmentOperator: T_PLUS_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Le, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceAdd; + } break; ./ -RelationalExpression: RelationalExpression T_GE ShiftExpression ; +AssignmentOperator: T_MINUS_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Ge, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceSub; + } break; ./ -RelationalExpression: RelationalExpression T_INSTANCEOF ShiftExpression ; +AssignmentOperator: T_LT_LT_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::InstanceOf, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceLeftShift; + } break; ./ -RelationalExpression: RelationalExpression T_IN ShiftExpression ; +AssignmentOperator: T_GT_GT_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::In, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceRightShift; + } break; ./ -RelationalExpressionNotIn: ShiftExpression ; +AssignmentOperator: T_GT_GT_GT_EQ; +/. + case $rule_number: { + sym(1).ival = QSOperator::InplaceURightShift; + } break; +./ -RelationalExpressionNotIn: RelationalExpressionNotIn T_LT ShiftExpression ; +AssignmentOperator: T_AND_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Lt, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceAnd; + } break; ./ -RelationalExpressionNotIn: RelationalExpressionNotIn T_GT ShiftExpression ; +AssignmentOperator: T_XOR_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Gt, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceXor; + } break; ./ -RelationalExpressionNotIn: RelationalExpressionNotIn T_LE ShiftExpression ; +AssignmentOperator: T_OR_EQ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Le, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).ival = QSOperator::InplaceOr; + } break; ./ -RelationalExpressionNotIn: RelationalExpressionNotIn T_GE ShiftExpression ; +Expression: AssignmentExpression; +Expression_In: AssignmentExpression_In; + +Expression: Expression T_COMMA AssignmentExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Expression_In: Expression_In T_COMMA AssignmentExpression_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Ge, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); + node->commaToken = loc(2); + sym(1).Node = node; + } break; ./ -RelationalExpressionNotIn: RelationalExpressionNotIn T_INSTANCEOF ShiftExpression ; +ExpressionOpt: ; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ExpressionOpt_In: ; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::InstanceOf, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -EqualityExpression: RelationalExpression ; +ExpressionOpt: Expression; +ExpressionOpt_In: Expression_In; -EqualityExpression: EqualityExpression T_EQ_EQ RelationalExpression ; +-- Statements + +Statement: ExpressionStatementLookahead T_FORCE_BLOCK BlockStatement; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Equal, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(3).Node; + } break; ./ -EqualityExpression: EqualityExpression T_NOT_EQ RelationalExpression ; +Statement: ExpressionStatementLookahead VariableStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead EmptyStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead ExpressionStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead IfStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead BreakableStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead ContinueStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead BreakStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead ReturnStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead WithStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead LabelledStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead ThrowStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead TryStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +Statement: ExpressionStatementLookahead DebuggerStatement; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::NotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + } break; ./ -EqualityExpression: EqualityExpression T_EQ_EQ_EQ RelationalExpression ; +Declaration: HoistableDeclaration; +Declaration: ClassDeclaration; +Declaration: LexicalDeclaration_In; + +HoistableDeclaration: FunctionDeclaration; +HoistableDeclaration: GeneratorDeclaration; + +HoistableDeclaration_Default: FunctionDeclaration_Default; +HoistableDeclaration_Default: GeneratorDeclaration_Default; + +BreakableStatement: IterationStatement; +BreakableStatement: SwitchStatement; + +BlockStatement: Block; + +Block: T_LBRACE StatementListOpt T_RBRACE; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::StrictEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::Block *node = new (pool) AST::Block(sym(2).StatementList); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + sym(1).Node = node; + } break; ./ -EqualityExpression: EqualityExpression T_NOT_EQ_EQ RelationalExpression ; +StatementList: StatementListItem; + +StatementList: StatementList StatementListItem; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).StatementList = sym(1).StatementList->append(sym(2).StatementList); + } break; ./ -EqualityExpressionNotIn: RelationalExpressionNotIn ; +StatementListItem: Statement; +/. + case $rule_number: { + sym(1).StatementList = new (pool) AST::StatementList(sym(1).Statement); + } break; +./ -EqualityExpressionNotIn: EqualityExpressionNotIn T_EQ_EQ RelationalExpressionNotIn ; +StatementListItem: ExpressionStatementLookahead T_FORCE_DECLARATION Declaration T_AUTOMATIC_SEMICOLON; +StatementListItem: ExpressionStatementLookahead T_FORCE_DECLARATION Declaration T_SEMICOLON; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Equal, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::StatementList(sym(3).FunctionDeclaration); + } break; ./ -EqualityExpressionNotIn: EqualityExpressionNotIn T_NOT_EQ RelationalExpressionNotIn; +StatementListOpt: ExpressionStatementLookahead; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::NotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -EqualityExpressionNotIn: EqualityExpressionNotIn T_EQ_EQ_EQ RelationalExpressionNotIn ; +StatementListOpt: StatementList; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::StrictEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(1).StatementList->finish(); + } break; ./ -EqualityExpressionNotIn: EqualityExpressionNotIn T_NOT_EQ_EQ RelationalExpressionNotIn ; +LetOrConst: T_LET; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).scope = AST::VariableScope::Let; + } break; +./ +LetOrConst: T_CONST; +/. + case $rule_number: { + sym(1).scope = AST::VariableScope::Const; + } break; ./ -BitwiseANDExpression: EqualityExpression ; +Var: T_VAR; +/. + case $rule_number: { + sym(1).scope = AST::VariableScope::Var; + } break; +./ -BitwiseANDExpression: BitwiseANDExpression T_AND EqualityExpression ; +LexicalDeclaration: LetOrConst BindingList; +/. case $rule_number: Q_FALLTHROUGH(); ./ +LexicalDeclaration_In: LetOrConst BindingList_In; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VarDeclaration: Var VariableDeclarationList; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VarDeclaration_In: Var VariableDeclarationList_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::VariableStatement *node = new (pool) AST::VariableStatement(sym(2).VariableDeclarationList->finish(sym(1).scope)); + node->declarationKindToken = loc(1); + sym(1).Node = node; + } break; ./ -BitwiseANDExpressionNotIn: EqualityExpressionNotIn ; +VariableStatement: VarDeclaration_In T_AUTOMATIC_SEMICOLON; +VariableStatement: VarDeclaration_In T_SEMICOLON; -BitwiseANDExpressionNotIn: BitwiseANDExpressionNotIn T_AND EqualityExpressionNotIn ; +BindingList: LexicalBinding_In; +/. case $rule_number: Q_FALLTHROUGH(); ./ +BindingList_In: LexicalBinding_In; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VariableDeclarationList: VariableDeclaration; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VariableDeclarationList_In: VariableDeclaration_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).PatternElement); + } break; ./ -BitwiseXORExpression: BitwiseANDExpression ; - -BitwiseXORExpression: BitwiseXORExpression T_XOR BitwiseANDExpression ; +BindingList: BindingList T_COMMA LexicalBinding; +/. case $rule_number: Q_FALLTHROUGH(); ./ +BindingList_In: BindingList_In T_COMMA LexicalBinding_In; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VariableDeclarationList: VariableDeclarationList T_COMMA VariableDeclaration; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VariableDeclarationList_In: VariableDeclarationList_In T_COMMA VariableDeclaration_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::VariableDeclarationList *node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).PatternElement); + node->commaToken = loc(2); + sym(1).Node = node; + } break; ./ -BitwiseXORExpressionNotIn: BitwiseANDExpressionNotIn ; +LexicalBinding: BindingIdentifier InitializerOpt; +/. case $rule_number: Q_FALLTHROUGH(); ./ +LexicalBinding_In: BindingIdentifier InitializerOpt_In; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VariableDeclaration: BindingIdentifier InitializerOpt; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VariableDeclaration_In: BindingIdentifier InitializerOpt_In; +/. + case $rule_number: { + auto *node = new (pool) AST::PatternElement(stringRef(1), sym(2).Expression); + node->identifierToken = loc(1); + sym(1).Node = node; + // if initializer is an anonymous function expression, we need to assign identifierref as it's name + if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression)) + f->name = stringRef(1); + if (auto *c = asAnonymousClassDefinition(sym(2).Expression)) + c->name = stringRef(1); + } break; +./ -BitwiseXORExpressionNotIn: BitwiseXORExpressionNotIn T_XOR BitwiseANDExpressionNotIn ; +LexicalBinding: BindingPattern Initializer; +/. case $rule_number: Q_FALLTHROUGH(); ./ +LexicalBinding_In: BindingPattern Initializer_In; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VariableDeclaration: BindingPattern Initializer; +/. case $rule_number: Q_FALLTHROUGH(); ./ +VariableDeclaration_In: BindingPattern Initializer_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + auto *node = new (pool) AST::PatternElement(sym(1).Pattern, sym(2).Expression); + node->identifierToken = loc(1); + sym(1).Node = node; + } break; ./ -BitwiseORExpression: BitwiseXORExpression ; +BindingPattern: T_LBRACE ObjectBindingPattern T_RBRACE; +/. + case $rule_number: { + auto *node = new (pool) AST::ObjectPattern(sym(2).PatternPropertyList); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + node->parseMode = AST::Pattern::Binding; + sym(1).Node = node; + } break; +./ -BitwiseORExpression: BitwiseORExpression T_OR BitwiseXORExpression ; +BindingPattern: T_LBRACKET ArrayBindingPattern T_RBRACKET; +/. + case $rule_number: { + auto *node = new (pool) AST::ArrayPattern(sym(2).PatternElementList); + node->lbracketToken = loc(1); + node->rbracketToken = loc(3); + node->parseMode = AST::Pattern::Binding; + sym(1).Node = node; + } break; +./ + +ObjectBindingPattern: ; +/. + case $rule_number: { + sym(1).Node = nullptr; + } break; +./ + +ObjectBindingPattern: BindingPropertyList; +/. case $rule_number: ./ +ObjectBindingPattern: BindingPropertyList T_COMMA; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(1).PatternPropertyList->finish(); + } break; +./ + +ArrayBindingPattern: ElisionOpt BindingRestElementOpt; +/. + case $rule_number: { + if (sym(1).Elision || sym(2).Node) { + auto *l = new (pool) AST::PatternElementList(sym(1).Elision, sym(2).PatternElement); + sym(1).Node = l->finish(); + } else { + sym(1).Node = nullptr; + } + } break; ./ -BitwiseORExpressionNotIn: BitwiseXORExpressionNotIn ; +ArrayBindingPattern: BindingElementList; +/. + case $rule_number: { + sym(1).Node = sym(1).PatternElementList->finish(); + } break; +./ -BitwiseORExpressionNotIn: BitwiseORExpressionNotIn T_OR BitwiseXORExpressionNotIn ; +ArrayBindingPattern: BindingElementList T_COMMA ElisionOpt BindingRestElementOpt; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + if (sym(3).Elision || sym(4).Node) { + auto *l = new (pool) AST::PatternElementList(sym(3).Elision, sym(4).PatternElement); + l = sym(1).PatternElementList->append(l); + sym(1).Node = l; + } + sym(1).Node = sym(1).PatternElementList->finish(); + } break; ./ -LogicalANDExpression: BitwiseORExpression ; +BindingPropertyList: BindingProperty; +/. + case $rule_number: { + sym(1).Node = new (pool) AST::PatternPropertyList(sym(1).PatternProperty); + } break; +./ -LogicalANDExpression: LogicalANDExpression T_AND_AND BitwiseORExpression ; +BindingPropertyList: BindingPropertyList T_COMMA BindingProperty; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::And, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::PatternPropertyList(sym(1).PatternPropertyList, sym(3).PatternProperty); + } break; ./ -LogicalANDExpressionNotIn: BitwiseORExpressionNotIn ; +BindingElementList: BindingElisionElement; -LogicalANDExpressionNotIn: LogicalANDExpressionNotIn T_AND_AND BitwiseORExpressionNotIn ; +BindingElementList: BindingElementList T_COMMA BindingElisionElement; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::And, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).PatternElementList = sym(1).PatternElementList->append(sym(3).PatternElementList); + } break; ./ -LogicalORExpression: LogicalANDExpression ; - -LogicalORExpression: LogicalORExpression T_OR_OR LogicalANDExpression ; +BindingElisionElement: ElisionOpt BindingElement; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Or, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::PatternElementList(sym(1).Elision, sym(2).PatternElement); + } break; ./ -LogicalORExpressionNotIn: LogicalANDExpressionNotIn ; -LogicalORExpressionNotIn: LogicalORExpressionNotIn T_OR_OR LogicalANDExpressionNotIn ; +BindingProperty: BindingIdentifier InitializerOpt_In; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Or, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::StringLiteralPropertyName *name = new (pool) AST::StringLiteralPropertyName(stringRef(1)); + name->propertyNameToken = loc(1); + // if initializer is an anonymous function expression, we need to assign identifierref as it's name + if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression)) + f->name = stringRef(1); + if (auto *c = asAnonymousClassDefinition(sym(2).Expression)) + c->name = stringRef(1); + sym(1).Node = new (pool) AST::PatternProperty(name, stringRef(1), sym(2).Expression); + } break; ./ -ConditionalExpression: LogicalORExpression ; +BindingProperty: PropertyName T_COLON BindingIdentifier InitializerOpt_In; +/. + case $rule_number: { + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, stringRef(3), sym(4).Expression); + sym(1).Node = node; + } break; +./ -ConditionalExpression: LogicalORExpression T_QUESTION AssignmentExpression T_COLON AssignmentExpression ; +BindingProperty: PropertyName T_COLON BindingPattern InitializerOpt_In; /. -case $rule_number: { - AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, - sym(3).Expression, sym(5).Expression); - node->questionToken = loc(2); - node->colonToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, sym(3).Pattern, sym(4).Expression); + sym(1).Node = node; + } break; ./ -ConditionalExpressionNotIn: LogicalORExpressionNotIn ; +BindingElement: BindingIdentifier InitializerOpt_In; +/. + case $rule_number: { + AST::PatternElement *node = new (pool) AST::PatternElement(stringRef(1), sym(2).Expression); + node->identifierToken = loc(1); + // if initializer is an anonymous function expression, we need to assign identifierref as it's name + if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression)) + f->name = stringRef(1); + if (auto *c = asAnonymousClassDefinition(sym(2).Expression)) + c->name = stringRef(1); + sym(1).Node = node; + } break; +./ -ConditionalExpressionNotIn: LogicalORExpressionNotIn T_QUESTION AssignmentExpressionNotIn T_COLON AssignmentExpressionNotIn ; +BindingElement: BindingPattern InitializerOpt_In; /. -case $rule_number: { - AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, - sym(3).Expression, sym(5).Expression); - node->questionToken = loc(2); - node->colonToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PatternElement *node = new (pool) AST::PatternElement(sym(1).Pattern, sym(2).Expression); + sym(1).Node = node; + } break; ./ -AssignmentExpression: ConditionalExpression ; +BindingRestElement: T_ELLIPSIS BindingIdentifier; +/. + case $rule_number: { + AST::PatternElement *node = new (pool) AST::PatternElement(stringRef(2), nullptr, AST::PatternElement::RestElement); + node->identifierToken = loc(2); + sym(1).Node = node; + } break; +./ -AssignmentExpression: LeftHandSideExpression AssignmentOperator AssignmentExpression ; +BindingRestElement: T_ELLIPSIS BindingPattern; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - sym(2).ival, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::PatternElement *node = new (pool) AST::PatternElement(sym(2).Pattern, nullptr, AST::PatternElement::RestElement); + sym(1).Node = node; + } break; +./ + +BindingRestElementOpt: ; +/. + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -AssignmentExpressionNotIn: ConditionalExpressionNotIn ; +BindingRestElementOpt: BindingRestElement; -AssignmentExpressionNotIn: LeftHandSideExpression AssignmentOperator AssignmentExpressionNotIn ; + +EmptyStatement: T_SEMICOLON; /. -case $rule_number: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - sym(2).ival, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::EmptyStatement *node = new (pool) AST::EmptyStatement(); + node->semicolonToken = loc(1); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_EQ ; +-- Spec says it should have a "[lookahead ∉ { {, function, class, let [ }]" before the Expression statement. +-- This is implemented with the rule below that is run before any statement and inserts a T_EXPRESSION_STATEMENT_OK +-- token if it's ok to parse as an expression statement. +ExpressionStatementLookahead: ; +/: +#define J_SCRIPT_EXPRESSIONSTATEMENTLOOKAHEAD_RULE $rule_number +:/ /. -case $rule_number: { - sym(1).ival = QSOperator::Assign; -} break; + case $rule_number: { + int token = lookaheadToken(lexer); + if (token == T_LBRACE) + pushToken(T_FORCE_BLOCK); + else if (token == T_FUNCTION || token == T_CLASS || token == T_LET || token == T_CONST) + pushToken(T_FORCE_DECLARATION); + } break; ./ -AssignmentOperator: T_STAR_EQ ; +ExpressionStatement: Expression_In T_AUTOMATIC_SEMICOLON; +ExpressionStatement: Expression_In T_SEMICOLON; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceMul; -} break; + case $rule_number: { + AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(sym(1).Expression); + node->semicolonToken = loc(2); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_DIVIDE_EQ ; +IfStatement: T_IF T_LPAREN Expression_In T_RPAREN Statement T_ELSE Statement; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceDiv; -} break; + case $rule_number: { + AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement, sym(7).Statement); + node->ifToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + node->elseToken = loc(6); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_REMAINDER_EQ ; +IfStatement: T_IF T_LPAREN Expression_In T_RPAREN Statement; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceMod; -} break; + case $rule_number: { + AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement); + node->ifToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_PLUS_EQ ; + +IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression_In T_RPAREN T_AUTOMATIC_SEMICOLON; +IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression_In T_RPAREN T_COMPATIBILITY_SEMICOLON; -- for JSC/V8 compatibility +IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression_In T_RPAREN T_SEMICOLON; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceAdd; -} break; + case $rule_number: { + AST::DoWhileStatement *node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression); + node->doToken = loc(1); + node->whileToken = loc(3); + node->lparenToken = loc(4); + node->rparenToken = loc(6); + node->semicolonToken = loc(7); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_MINUS_EQ ; +IterationStatement: T_WHILE T_LPAREN Expression_In T_RPAREN Statement; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceSub; -} break; + case $rule_number: { + AST::WhileStatement *node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement); + node->whileToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_LT_LT_EQ ; +IterationStatement: T_FOR T_LPAREN ExpressionOpt T_SEMICOLON ExpressionOpt_In T_SEMICOLON ExpressionOpt_In T_RPAREN Statement; -- [lookahead != { let [ }] /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceLeftShift; -} break; + case $rule_number: { + AST::ForStatement *node = new (pool) AST::ForStatement(sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); + node->forToken = loc(1); + node->lparenToken = loc(2); + node->firstSemicolonToken = loc(4); + node->secondSemicolonToken = loc(6); + node->rparenToken = loc(8); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_GT_GT_EQ ; +IterationStatement: T_FOR T_LPAREN VarDeclaration T_SEMICOLON ExpressionOpt_In T_SEMICOLON ExpressionOpt_In T_RPAREN Statement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +IterationStatement: T_FOR T_LPAREN LexicalDeclaration T_SEMICOLON ExpressionOpt_In T_SEMICOLON ExpressionOpt_In T_RPAREN Statement; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceRightShift; -} break; + case $rule_number: { + // ### get rid of the static_cast! + AST::ForStatement *node = new (pool) AST::ForStatement( + static_cast<AST::VariableStatement *>(sym(3).Node)->declarations, sym(5).Expression, + sym(7).Expression, sym(9).Statement); + node->forToken = loc(1); + node->lparenToken = loc(2); + node->firstSemicolonToken = loc(4); + node->secondSemicolonToken = loc(6); + node->rparenToken = loc(8); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_GT_GT_GT_EQ ; +InOrOf: T_IN; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceURightShift; -} break; + case $rule_number: { + sym(1).forEachType = AST::ForEachType::In; + } break; ./ -AssignmentOperator: T_AND_EQ ; +InOrOf: T_OF; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceAnd; -} break; + case $rule_number: { + sym(1).forEachType = AST::ForEachType::Of; + } break; ./ -AssignmentOperator: T_XOR_EQ ; +IterationStatement: T_FOR T_LPAREN LeftHandSideExpression InOrOf Expression_In T_RPAREN Statement; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceXor; -} break; + case $rule_number: { + // need to convert the LHS to an AssignmentPattern if it was an Array/ObjectLiteral + if (AST::Pattern *p = sym(3).Expression->patternCast()) { + AST::SourceLocation errorLoc; + QString errorMsg; + if (!p->convertLiteralToAssignmentPattern(pool, &errorLoc, &errorMsg)) { + syntaxError(errorLoc, errorMsg); + return false; + } + } + AST::ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).Expression, sym(5).Expression, sym(7).Statement); + node->forToken = loc(1); + node->lparenToken = loc(2); + node->inOfToken = loc(4); + node->rparenToken = loc(6); + node->type = sym(4).forEachType; + sym(1).Node = node; + } break; +./ + +IterationStatement: T_FOR T_LPAREN ForDeclaration InOrOf Expression_In T_RPAREN Statement; +/. + case $rule_number: { + AST::ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).PatternElement, sym(5).Expression, sym(7).Statement); + node->forToken = loc(1); + node->lparenToken = loc(2); + node->inOfToken = loc(4); + node->rparenToken = loc(6); + node->type = sym(4).forEachType; + sym(1).Node = node; + } break; +./ + +ForDeclaration: LetOrConst BindingIdentifier; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ForDeclaration: Var BindingIdentifier; +/. + case $rule_number: { + auto *node = new (pool) AST::PatternElement(stringRef(2), nullptr); + node->identifierToken = loc(2); + node->scope = sym(1).scope; + node->isForDeclaration = true; + sym(1).Node = node; + } break; +./ + +ForDeclaration: LetOrConst BindingPattern; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ForDeclaration: Var BindingPattern; +/. + case $rule_number: { + auto *node = new (pool) AST::PatternElement(sym(2).Pattern, nullptr); + node->scope = sym(1).scope; + node->isForDeclaration = true; + sym(1).Node = node; + } break; +./ + +ContinueStatement: T_CONTINUE T_AUTOMATIC_SEMICOLON; +ContinueStatement: T_CONTINUE T_SEMICOLON; +/. + case $rule_number: { + AST::ContinueStatement *node = new (pool) AST::ContinueStatement(); + node->continueToken = loc(1); + node->semicolonToken = loc(2); + sym(1).Node = node; + } break; +./ + +ContinueStatement: T_CONTINUE IdentifierReference T_AUTOMATIC_SEMICOLON; +ContinueStatement: T_CONTINUE IdentifierReference T_SEMICOLON; +/. + case $rule_number: { + AST::ContinueStatement *node = new (pool) AST::ContinueStatement(stringRef(2)); + node->continueToken = loc(1); + node->identifierToken = loc(2); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; +./ + +BreakStatement: T_BREAK T_AUTOMATIC_SEMICOLON; +BreakStatement: T_BREAK T_SEMICOLON; +/. + case $rule_number: { + AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef()); + node->breakToken = loc(1); + node->semicolonToken = loc(2); + sym(1).Node = node; + } break; +./ + +BreakStatement: T_BREAK IdentifierReference T_AUTOMATIC_SEMICOLON; +BreakStatement: T_BREAK IdentifierReference T_SEMICOLON; +/. + case $rule_number: { + AST::BreakStatement *node = new (pool) AST::BreakStatement(stringRef(2)); + node->breakToken = loc(1); + node->identifierToken = loc(2); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; +./ + +ReturnStatement: T_RETURN ExpressionOpt_In T_AUTOMATIC_SEMICOLON; +ReturnStatement: T_RETURN ExpressionOpt_In T_SEMICOLON; +/. + case $rule_number: { + if (!functionNestingLevel) { + syntaxError(loc(1), "Return statement not allowed outside of Function declaration."); + return false; + } + AST::ReturnStatement *node = new (pool) AST::ReturnStatement(sym(2).Expression); + node->returnToken = loc(1); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; ./ -AssignmentOperator: T_OR_EQ ; +WithStatement: T_WITH T_LPAREN Expression_In T_RPAREN Statement; /. -case $rule_number: { - sym(1).ival = QSOperator::InplaceOr; -} break; + case $rule_number: { + AST::WithStatement *node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement); + node->withToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; ./ -Expression: AssignmentExpression ; +SwitchStatement: T_SWITCH T_LPAREN Expression_In T_RPAREN CaseBlock; +/. + case $rule_number: { + AST::SwitchStatement *node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock); + node->switchToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; +./ -Expression: Expression T_COMMA AssignmentExpression ; +CaseBlock: T_LBRACE CaseClausesOpt T_RBRACE; /. -case $rule_number: { - AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + sym(1).Node = node; + } break; ./ -ExpressionOpt: ; +CaseBlock: T_LBRACE CaseClausesOpt DefaultClause CaseClausesOpt T_RBRACE; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); + node->lbraceToken = loc(1); + node->rbraceToken = loc(5); + sym(1).Node = node; + } break; ./ -ExpressionOpt: Expression ; +CaseClauses: CaseClause; +/. + case $rule_number: { + sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause); + } break; +./ -ExpressionNotIn: AssignmentExpressionNotIn ; +CaseClauses: CaseClauses CaseClause; +/. + case $rule_number: { + sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause); + } break; +./ -ExpressionNotIn: ExpressionNotIn T_COMMA AssignmentExpressionNotIn ; +CaseClausesOpt: ; /. -case $rule_number: { - AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -ExpressionNotInOpt: ; +CaseClausesOpt: CaseClauses; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + sym(1).Node = sym(1).CaseClauses->finish(); + } break; ./ -ExpressionNotInOpt: ExpressionNotIn ; +CaseClause: T_CASE Expression_In T_COLON StatementListOpt; +/. + case $rule_number: { + AST::CaseClause *node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList); + node->caseToken = loc(1); + node->colonToken = loc(3); + sym(1).Node = node; + } break; +./ -Statement: Block ; -Statement: VariableStatement ; -Statement: EmptyStatement ; -Statement: ExpressionStatement ; -Statement: IfStatement ; -Statement: IterationStatement ; -Statement: ContinueStatement ; -Statement: BreakStatement ; -Statement: ReturnStatement ; -Statement: WithStatement ; -Statement: LabelledStatement ; -Statement: SwitchStatement ; -Statement: ThrowStatement ; -Statement: TryStatement ; -Statement: DebuggerStatement ; +DefaultClause: T_DEFAULT T_COLON StatementListOpt; +/. + case $rule_number: { + AST::DefaultClause *node = new (pool) AST::DefaultClause(sym(3).StatementList); + node->defaultToken = loc(1); + node->colonToken = loc(2); + sym(1).Node = node; + } break; +./ + +LabelledStatement: IdentifierReference T_COLON LabelledItem; +/. + case $rule_number: { + AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); + node->identifierToken = loc(1); + node->colonToken = loc(2); + sym(1).Node = node; + } break; +./ +LabelledItem: Statement; -Block: T_LBRACE StatementListOpt T_RBRACE ; +LabelledItem: ExpressionStatementLookahead T_FORCE_DECLARATION FunctionDeclaration; /. -case $rule_number: { - AST::Block *node = new (pool) AST::Block(sym(2).StatementList); - node->lbraceToken = loc(1); - node->rbraceToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + syntaxError(loc(3), "FunctionDeclarations are not allowed after a label."); + return false; + } break; ./ -StatementList: Statement ; +ThrowStatement: T_THROW Expression_In T_AUTOMATIC_SEMICOLON; +ThrowStatement: T_THROW Expression_In T_SEMICOLON; /. -case $rule_number: { - sym(1).Node = new (pool) AST::StatementList(sym(1).Statement); -} break; + case $rule_number: { + AST::ThrowStatement *node = new (pool) AST::ThrowStatement(sym(2).Expression); + node->throwToken = loc(1); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; ./ -StatementList: StatementList Statement ; +TryStatement: T_TRY Block Catch; /. -case $rule_number: { - sym(1).Node = new (pool) AST::StatementList(sym(1).StatementList, sym(2).Statement); -} break; + case $rule_number: { + AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch); + node->tryToken = loc(1); + sym(1).Node = node; + } break; ./ -StatementListOpt: ; +TryStatement: T_TRY Block Finally; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally); + node->tryToken = loc(1); + sym(1).Node = node; + } break; ./ -StatementListOpt: StatementList ; +TryStatement: T_TRY Block Catch Finally; /. -case $rule_number: { - sym(1).Node = sym(1).StatementList->finish (); -} break; + case $rule_number: { + AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally); + node->tryToken = loc(1); + sym(1).Node = node; + } break; ./ -VariableStatement: VariableDeclarationKind VariableDeclarationList T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -VariableStatement: VariableDeclarationKind VariableDeclarationList T_SEMICOLON ; +Catch: T_CATCH T_LPAREN CatchParameter T_RPAREN Block; /. -case $rule_number: { - AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope; - if (sym(1).ival == T_LET) - s = AST::VariableDeclaration::BlockScope; - else if (sym(1).ival == T_CONST) - s = AST::VariableDeclaration::ReadOnlyBlockScope; - - AST::VariableStatement *node = new (pool) AST::VariableStatement(sym(2).VariableDeclarationList->finish(s)); - node->declarationKindToken = loc(1); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::Catch *node = new (pool) AST::Catch(sym(3).PatternElement, sym(5).Block); + node->catchToken = loc(1); + node->lparenToken = loc(2); + node->identifierToken = loc(3); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; ./ -VariableDeclarationKind: T_LET ; +Finally: T_FINALLY Block; /. -case $rule_number: { - sym(1).ival = T_LET; -} break; + case $rule_number: { + AST::Finally *node = new (pool) AST::Finally(sym(2).Block); + node->finallyToken = loc(1); + sym(1).Node = node; + } break; ./ -VariableDeclarationKind: T_CONST ; +CatchParameter: BindingIdentifier; /. -case $rule_number: { - sym(1).ival = T_CONST; -} break; + case $rule_number: { + AST::PatternElement *node = new (pool) AST::PatternElement(stringRef(1)); + node->identifierToken = loc(1); + node->scope = AST::VariableScope::Let; + sym(1).Node = node; + } break; ./ -VariableDeclarationKind: T_VAR ; +CatchParameter: BindingPattern; /. -case $rule_number: { - sym(1).ival = T_VAR; -} break; + case $rule_number: { + AST::PatternElement *node = new (pool) AST::PatternElement(sym(1).Pattern); + node->scope = AST::VariableScope::Let; + sym(1).Node = node; + } break; ./ -VariableDeclarationList: VariableDeclaration ; +DebuggerStatement: T_DEBUGGER T_AUTOMATIC_SEMICOLON; -- automatic semicolon +DebuggerStatement: T_DEBUGGER T_SEMICOLON; /. -case $rule_number: { - sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); -} break; + case $rule_number: { + AST::DebuggerStatement *node = new (pool) AST::DebuggerStatement(); + node->debuggerToken = loc(1); + node->semicolonToken = loc(2); + sym(1).Node = node; + } break; ./ -VariableDeclarationList: VariableDeclarationList T_COMMA VariableDeclaration ; +-- tell the parser to prefer function declarations to function expressions. +-- That is, the `Function' symbol is used to mark the start of a function +-- declaration. +-- This is still required for parsing QML, where MemberExpression and FunctionDeclaration would +-- otherwise conflict. +Function: T_FUNCTION %prec REDUCE_HERE; + +FunctionDeclaration: Function BindingIdentifier T_LPAREN FormalParameters T_RPAREN FunctionLBrace FunctionBody FunctionRBrace; /. -case $rule_number: { - AST::VariableDeclarationList *node = new (pool) AST::VariableDeclarationList( - sym(1).VariableDeclarationList, sym(3).VariableDeclaration); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).StatementList); + node->functionToken = loc(1); + node->identifierToken = loc(2); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + node->lbraceToken = loc(6); + node->rbraceToken = loc(8); + sym(1).Node = node; + } break; ./ -VariableDeclarationListNotIn: VariableDeclarationNotIn ; + +FunctionDeclaration_Default: FunctionDeclaration; +FunctionDeclaration_Default: Function T_LPAREN FormalParameters T_RPAREN FunctionLBrace FunctionBody FunctionRBrace; /. -case $rule_number: { - sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); -} break; + case $rule_number: { + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(QStringRef(), sym(3).FormalParameterList, sym(6).StatementList); + node->functionToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + node->lbraceToken = loc(5); + node->rbraceToken = loc(7); + sym(1).Node = node; + } break; ./ -VariableDeclarationListNotIn: VariableDeclarationListNotIn T_COMMA VariableDeclarationNotIn ; +FunctionExpression: T_FUNCTION BindingIdentifier T_LPAREN FormalParameters T_RPAREN FunctionLBrace FunctionBody FunctionRBrace; /. -case $rule_number: { - sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).VariableDeclaration); -} break; + case $rule_number: { + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).StatementList); + node->functionToken = loc(1); + if (! stringRef(2).isNull()) + node->identifierToken = loc(2); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + node->lbraceToken = loc(6); + node->rbraceToken = loc(8); + sym(1).Node = node; + } break; ./ -VariableDeclaration: JsIdentifier InitialiserOpt ; +FunctionExpression: T_FUNCTION T_LPAREN FormalParameters T_RPAREN FunctionLBrace FunctionBody FunctionRBrace; /. -case $rule_number: { - AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope; - AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression, s); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(3).FormalParameterList, sym(6).StatementList); + node->functionToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + node->lbraceToken = loc(5); + node->rbraceToken = loc(7); + sym(1).Node = node; + } break; ./ -VariableDeclarationNotIn: JsIdentifier InitialiserNotInOpt ; +StrictFormalParameters: FormalParameters; + +FormalParameters: ; /. -case $rule_number: { - AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope; - AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression, s); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -Initialiser: T_EQ AssignmentExpression ; +FormalParameters: BindingRestElement; /. -case $rule_number: { - // ### TODO: AST for initializer - sym(1) = sym(2); -} break; + case $rule_number: { + AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(nullptr, sym(1).PatternElement))->finish(pool); + sym(1).Node = node; + } break; ./ -InitialiserOpt: ; +FormalParameters: FormalParameterList; +/. case $rule_number: ./ +FormalParameters: FormalParameterList T_COMMA; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + sym(1).Node = sym(1).FormalParameterList->finish(pool); + } break; ./ -InitialiserOpt: Initialiser ; +FormalParameters: FormalParameterList T_COMMA BindingRestElement; +/. + case $rule_number: { + AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(sym(1).FormalParameterList, sym(3).PatternElement))->finish(pool); + sym(1).Node = node; + } break; +./ -InitialiserNotIn: T_EQ AssignmentExpressionNotIn ; +FormalParameterList: BindingElement; /. -case $rule_number: { - // ### TODO: AST for initializer - sym(1) = sym(2); -} break; + case $rule_number: { + AST::FormalParameterList *node = new (pool) AST::FormalParameterList(nullptr, sym(1).PatternElement); + sym(1).Node = node; + } break; ./ -InitialiserNotInOpt: ; + +FormalParameterList: FormalParameterList T_COMMA BindingElement; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + AST::FormalParameterList *node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, sym(3).PatternElement); + sym(1).Node = node; + } break; ./ -InitialiserNotInOpt: InitialiserNotIn ; +FormalParameter: BindingElement; -EmptyStatement: T_SEMICOLON ; +FunctionLBrace: T_LBRACE; /. -case $rule_number: { - AST::EmptyStatement *node = new (pool) AST::EmptyStatement(); - node->semicolonToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + ++functionNestingLevel; + } break; ./ -ExpressionStatement: Expression T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ExpressionStatement: Expression T_SEMICOLON ; +FunctionRBrace: T_RBRACE; /. -case $rule_number: { - AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(sym(1).Expression); - node->semicolonToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + --functionNestingLevel; + } break; ./ -IfStatement: T_IF T_LPAREN Expression T_RPAREN Statement T_ELSE Statement ; + +FunctionBody: StatementListOpt; + +ArrowFunction: ArrowParameters T_ARROW ConciseBodyLookahead AssignmentExpression; -- [lookahead ≠{] +/. case $rule_number: Q_FALLTHROUGH(); ./ +ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead AssignmentExpression_In; -- [lookahead ≠{] /. -case $rule_number: { - AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement, sym(7).Statement); - node->ifToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - node->elseToken = loc(6); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ReturnStatement *ret = new (pool) AST::ReturnStatement(sym(4).Expression); + ret->returnToken = sym(4).Node->firstSourceLocation(); + ret->semicolonToken = sym(4).Node->lastSourceLocation(); + AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish(); + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringRef(), sym(1).FormalParameterList, statements); + f->isArrowFunction = true; + f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); + f->lbraceToken = sym(4).Node->firstSourceLocation(); + f->rbraceToken = sym(4).Node->lastSourceLocation(); + sym(1).Node = f; + } break; ./ -IfStatement: T_IF T_LPAREN Expression T_RPAREN Statement ; +ArrowFunction: ArrowParameters T_ARROW ConciseBodyLookahead T_FORCE_BLOCK FunctionLBrace FunctionBody FunctionRBrace; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead T_FORCE_BLOCK FunctionLBrace FunctionBody FunctionRBrace; /. -case $rule_number: { - AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement); - node->ifToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringRef(), sym(1).FormalParameterList, sym(6).StatementList); + f->isArrowFunction = true; + f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); + f->lbraceToken = loc(6); + f->rbraceToken = loc(7); + sym(1).Node = f; + } break; ./ +ArrowParameters: BindingIdentifier; +/. + case $rule_number: { + AST::PatternElement *e = new (pool) AST::PatternElement(stringRef(1), nullptr, AST::PatternElement::Binding); + e->identifierToken = loc(1); + sym(1).FormalParameterList = (new (pool) AST::FormalParameterList(nullptr, e))->finish(pool); + } break; +./ -IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_COMPATIBILITY_SEMICOLON ; -- for JSC/V8 compatibility -IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_SEMICOLON ; +-- CoverParenthesizedExpressionAndArrowParameterList for ArrowParameters i being refined to: +-- ArrowFormalParameters: T_LPAREN StrictFormalParameters T_RPAREN +ArrowParameters: CoverParenthesizedExpressionAndArrowParameterList; /. -case $rule_number: { - AST::DoWhileStatement *node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression); - node->doToken = loc(1); - node->whileToken = loc(3); - node->lparenToken = loc(4); - node->rparenToken = loc(6); - node->semicolonToken = loc(7); - sym(1).Node = node; -} break; + case $rule_number: { + if (coverExpressionType != CE_FormalParameterList) { + AST::NestedExpression *ne = static_cast<AST::NestedExpression *>(sym(1).Node); + AST::FormalParameterList *list = ne->expression->reparseAsFormalParameterList(pool); + if (!list) { + syntaxError(loc(1), "Invalid Arrow parameter list."); + return false; + } + sym(1).Node = list->finish(pool); + } + } break; ./ -IterationStatement: T_WHILE T_LPAREN Expression T_RPAREN Statement ; +ConciseBodyLookahead: ; +/: +#define J_SCRIPT_CONCISEBODYLOOKAHEAD_RULE $rule_number +:/ /. -case $rule_number: { - AST::WhileStatement *node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement); - node->whileToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + if (lookaheadToken(lexer) == T_LBRACE) + pushToken(T_FORCE_BLOCK); + } break; ./ -IterationStatement: T_FOR T_LPAREN ExpressionNotInOpt T_SEMICOLON ExpressionOpt T_SEMICOLON ExpressionOpt T_RPAREN Statement ; +MethodDefinition: PropertyName T_LPAREN StrictFormalParameters T_RPAREN FunctionLBrace FunctionBody FunctionRBrace; /. -case $rule_number: { - AST::ForStatement *node = new (pool) AST::ForStatement(sym(3).Expression, - sym(5).Expression, sym(7).Expression, sym(9).Statement); - node->forToken = loc(1); - node->lparenToken = loc(2); - node->firstSemicolonToken = loc(4); - node->secondSemicolonToken = loc(6); - node->rparenToken = loc(8); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(stringRef(1), sym(3).FormalParameterList, sym(6).StatementList); + f->functionToken = sym(1).PropertyName->firstSourceLocation(); + f->lparenToken = loc(2); + f->rparenToken = loc(4); + f->lbraceToken = loc(5); + f->rbraceToken = loc(7); + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, f); + node->colonToken = loc(2); + sym(1).Node = node; + } break; ./ -IterationStatement: T_FOR T_LPAREN T_VAR VariableDeclarationListNotIn T_SEMICOLON ExpressionOpt T_SEMICOLON ExpressionOpt T_RPAREN Statement ; +MethodDefinition: T_STAR PropertyName GeneratorLParen StrictFormalParameters T_RPAREN FunctionLBrace GeneratorBody GeneratorRBrace; /. -case $rule_number: { - AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope; - AST::LocalForStatement *node = new (pool) AST::LocalForStatement( - sym(4).VariableDeclarationList->finish(s), sym(6).Expression, - sym(8).Expression, sym(10).Statement); - node->forToken = loc(1); - node->lparenToken = loc(2); - node->varToken = loc(3); - node->firstSemicolonToken = loc(5); - node->secondSemicolonToken = loc(7); - node->rparenToken = loc(9); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).StatementList); + f->functionToken = sym(2).PropertyName->firstSourceLocation(); + f->lparenToken = loc(3); + f->rparenToken = loc(5); + f->lbraceToken = loc(6); + f->rbraceToken = loc(8); + f->isGenerator = true; + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(2).PropertyName, f); + node->colonToken = loc(2); + sym(1).Node = node; + } break; +./ + + +MethodDefinition: T_GET PropertyName T_LPAREN T_RPAREN FunctionLBrace FunctionBody FunctionRBrace; +/. + case $rule_number: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(stringRef(2), nullptr, sym(6).StatementList); + f->functionToken = sym(2).PropertyName->firstSourceLocation(); + f->lparenToken = loc(3); + f->rparenToken = loc(4); + f->lbraceToken = loc(5); + f->rbraceToken = loc(7); + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(2).PropertyName, f, AST::PatternProperty::Getter); + node->colonToken = loc(2); + sym(1).Node = node; + } break; ./ -IterationStatement: T_FOR T_LPAREN LeftHandSideExpression T_IN Expression T_RPAREN Statement ; +MethodDefinition: T_SET PropertyName T_LPAREN PropertySetParameterList T_RPAREN FunctionLBrace FunctionBody FunctionRBrace; /. -case $rule_number: { - AST:: ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).Expression, - sym(5).Expression, sym(7).Statement); - node->forToken = loc(1); - node->lparenToken = loc(2); - node->inToken = loc(4); - node->rparenToken = loc(6); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).StatementList); + f->functionToken = sym(2).PropertyName->firstSourceLocation(); + f->lparenToken = loc(3); + f->rparenToken = loc(5); + f->lbraceToken = loc(6); + f->rbraceToken = loc(8); + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(2).PropertyName, f, AST::PatternProperty::Setter); + node->colonToken = loc(2); + sym(1).Node = node; + } break; ./ -IterationStatement: T_FOR T_LPAREN T_VAR VariableDeclarationNotIn T_IN Expression T_RPAREN Statement ; + +PropertySetParameterList: FormalParameter; /. -case $rule_number: { - AST::LocalForEachStatement *node = new (pool) AST::LocalForEachStatement( - sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); - node->forToken = loc(1); - node->lparenToken = loc(2); - node->varToken = loc(3); - node->inToken = loc(5); - node->rparenToken = loc(7); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(nullptr, sym(1).PatternElement))->finish(pool); + sym(1).Node = node; + } break; ./ -ContinueStatement: T_CONTINUE T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ContinueStatement: T_CONTINUE T_SEMICOLON ; +GeneratorLParen: T_LPAREN; /. -case $rule_number: { - AST::ContinueStatement *node = new (pool) AST::ContinueStatement(); - node->continueToken = loc(1); - node->semicolonToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + lexer->enterGeneratorBody(); + } break; ./ -ContinueStatement: T_CONTINUE JsIdentifier T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ContinueStatement: T_CONTINUE JsIdentifier T_SEMICOLON ; +GeneratorRBrace: T_RBRACE; /. -case $rule_number: { - AST::ContinueStatement *node = new (pool) AST::ContinueStatement(stringRef(2)); - node->continueToken = loc(1); - node->identifierToken = loc(2); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + --functionNestingLevel; + lexer->leaveGeneratorBody(); + } break; ./ -BreakStatement: T_BREAK T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -BreakStatement: T_BREAK T_SEMICOLON ; +GeneratorDeclaration: Function T_STAR BindingIdentifier GeneratorLParen FormalParameters T_RPAREN FunctionLBrace GeneratorBody GeneratorRBrace; /. -case $rule_number: { - AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef()); - node->breakToken = loc(1); - node->semicolonToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(3), sym(5).FormalParameterList, sym(8).StatementList); + node->functionToken = loc(1); + node->identifierToken = loc(3); + node->lparenToken = loc(4); + node->rparenToken = loc(6); + node->lbraceToken = loc(7); + node->rbraceToken = loc(9); + node->isGenerator = true; + sym(1).Node = node; + } break; ./ -BreakStatement: T_BREAK JsIdentifier T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -BreakStatement: T_BREAK JsIdentifier T_SEMICOLON ; +GeneratorDeclaration_Default: GeneratorDeclaration; +GeneratorDeclaration_Default: Function T_STAR GeneratorLParen FormalParameters T_RPAREN FunctionLBrace GeneratorBody GeneratorRBrace; +/. + case $rule_number: { + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(QStringRef(), sym(4).FormalParameterList, sym(7).StatementList); + node->functionToken = loc(1); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + node->lbraceToken = loc(6); + node->rbraceToken = loc(8); + node->isGenerator = true; + sym(1).Node = node; + } break; +./ + +GeneratorExpression: T_FUNCTION T_STAR BindingIdentifier GeneratorLParen FormalParameters T_RPAREN FunctionLBrace GeneratorBody GeneratorRBrace; /. -case $rule_number: { - AST::BreakStatement *node = new (pool) AST::BreakStatement(stringRef(2)); - node->breakToken = loc(1); - node->identifierToken = loc(2); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(3), sym(5).FormalParameterList, sym(8).StatementList); + node->functionToken = loc(1); + if (!stringRef(3).isNull()) + node->identifierToken = loc(3); + node->lparenToken = loc(4); + node->rparenToken = loc(6); + node->lbraceToken = loc(7); + node->rbraceToken = loc(9); + node->isGenerator = true; + sym(1).Node = node; + } break; ./ -ReturnStatement: T_RETURN ExpressionOpt T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ReturnStatement: T_RETURN ExpressionOpt T_SEMICOLON ; +GeneratorExpression: T_FUNCTION T_STAR GeneratorLParen FormalParameters T_RPAREN FunctionLBrace GeneratorBody GeneratorRBrace; /. -case $rule_number: { - AST::ReturnStatement *node = new (pool) AST::ReturnStatement(sym(2).Expression); - node->returnToken = loc(1); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(4).FormalParameterList, sym(7).StatementList); + node->functionToken = loc(1); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + node->lbraceToken = loc(6); + node->rbraceToken = loc(8); + node->isGenerator = true; + sym(1).Node = node; + } break; ./ -WithStatement: T_WITH T_LPAREN Expression T_RPAREN Statement ; +GeneratorBody: FunctionBody; + +YieldExpression: T_YIELD; +/. case $rule_number: Q_FALLTHROUGH(); ./ +YieldExpression_In: T_YIELD; /. -case $rule_number: { - AST::WithStatement *node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement); - node->withToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::YieldExpression *node = new (pool) AST::YieldExpression(); + node->yieldToken = loc(1); + sym(1).Node = node; + } break; ./ -SwitchStatement: T_SWITCH T_LPAREN Expression T_RPAREN CaseBlock ; +YieldExpression: T_YIELD T_STAR AssignmentExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +YieldExpression_In: T_YIELD T_STAR AssignmentExpression_In; /. -case $rule_number: { - AST::SwitchStatement *node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock); - node->switchToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + AST::YieldExpression *node = new (pool) AST::YieldExpression(sym(3).Expression); + node->yieldToken = loc(1); + node->isYieldStar = true; + sym(1).Node = node; + } break; ./ -CaseBlock: T_LBRACE CaseClausesOpt T_RBRACE ; +YieldExpression: T_YIELD AssignmentExpression; +/. case $rule_number: Q_FALLTHROUGH(); ./ +YieldExpression_In: T_YIELD AssignmentExpression_In; /. -case $rule_number: { - AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses); - node->lbraceToken = loc(1); - node->rbraceToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + AST::YieldExpression *node = new (pool) AST::YieldExpression(sym(2).Expression); + node->yieldToken = loc(1); + sym(1).Node = node; + } break; ./ -CaseBlock: T_LBRACE CaseClausesOpt DefaultClause CaseClausesOpt T_RBRACE ; + +ClassDeclaration: T_CLASS BindingIdentifier ClassHeritageOpt ClassLBrace ClassBodyOpt ClassRBrace; /. -case $rule_number: { - AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); - node->lbraceToken = loc(1); - node->rbraceToken = loc(5); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ClassDeclaration *node = new (pool) AST::ClassDeclaration(stringRef(2), sym(3).Expression, sym(5).ClassElementList); + node->classToken = loc(1); + node->identifierToken = loc(2); + node->lbraceToken = loc(4); + node->rbraceToken = loc(6); + sym(1).Node = node; + } break; ./ -CaseClauses: CaseClause ; +ClassExpression: T_CLASS BindingIdentifier ClassHeritageOpt ClassLBrace ClassBodyOpt ClassRBrace; /. -case $rule_number: { - sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause); -} break; + case $rule_number: { + AST::ClassExpression *node = new (pool) AST::ClassExpression(stringRef(2), sym(3).Expression, sym(5).ClassElementList); + node->classToken = loc(1); + node->identifierToken = loc(2); + node->lbraceToken = loc(4); + node->rbraceToken = loc(6); + sym(1).Node = node; + } break; ./ -CaseClauses: CaseClauses CaseClause ; +ClassDeclaration_Default: T_CLASS ClassHeritageOpt ClassLBrace ClassBodyOpt ClassRBrace; /. -case $rule_number: { - sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause); -} break; + case $rule_number: { + AST::ClassDeclaration *node = new (pool) AST::ClassDeclaration(QStringRef(), sym(2).Expression, sym(4).ClassElementList); + node->classToken = loc(1); + node->lbraceToken = loc(3); + node->rbraceToken = loc(5); + sym(1).Node = node; + } break; ./ -CaseClausesOpt: ; +ClassExpression: T_CLASS ClassHeritageOpt ClassLBrace ClassBodyOpt ClassRBrace; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + AST::ClassExpression *node = new (pool) AST::ClassExpression(QStringRef(), sym(2).Expression, sym(4).ClassElementList); + node->classToken = loc(1); + node->lbraceToken = loc(3); + node->rbraceToken = loc(5); + sym(1).Node = node; + } break; ./ -CaseClausesOpt: CaseClauses ; +ClassDeclaration_Default: ClassDeclaration; + +ClassLBrace: T_LBRACE; /. -case $rule_number: { - sym(1).Node = sym(1).CaseClauses->finish (); -} break; + case $rule_number: { + lexer->setStaticIsKeyword(true); + } break; ./ -CaseClause: T_CASE Expression T_COLON StatementListOpt ; +ClassRBrace: T_RBRACE; +/. case $rule_number: ./ +ClassStaticQualifier: T_STATIC; /. -case $rule_number: { - AST::CaseClause *node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList); - node->caseToken = loc(1); - node->colonToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + lexer->setStaticIsKeyword(false); + } break; ./ -DefaultClause: T_DEFAULT T_COLON StatementListOpt ; +ClassHeritageOpt: ; /. -case $rule_number: { - AST::DefaultClause *node = new (pool) AST::DefaultClause(sym(3).StatementList); - node->defaultToken = loc(1); - node->colonToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -LabelledStatement: JsIdentifier T_COLON Statement ; +ClassHeritageOpt: T_EXTENDS LeftHandSideExpression; /. -case $rule_number: { - AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); - node->identifierToken = loc(1); - node->colonToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = sym(2).Node; + } break; ./ -ThrowStatement: T_THROW Expression T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -ThrowStatement: T_THROW Expression T_SEMICOLON ; +ClassBodyOpt: ; /. -case $rule_number: { - AST::ThrowStatement *node = new (pool) AST::ThrowStatement(sym(2).Expression); - node->throwToken = loc(1); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -TryStatement: T_TRY Block Catch ; +ClassBodyOpt: ClassElementList; /. -case $rule_number: { - AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch); - node->tryToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + if (sym(1).Node) + sym(1).Node = sym(1).ClassElementList->finish(); + } break; ./ -TryStatement: T_TRY Block Finally ; +ClassElementList: ClassElement; + +ClassElementList: ClassElementList ClassElement; /. -case $rule_number: { - AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally); - node->tryToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + if (sym(2).Node) + sym(1).ClassElementList = sym(1).ClassElementList->append(sym(2).ClassElementList); + } break; ./ -TryStatement: T_TRY Block Catch Finally ; +ClassElement: MethodDefinition; /. -case $rule_number: { - AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally); - node->tryToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + AST::ClassElementList *node = new (pool) AST::ClassElementList(sym(1).PatternProperty, false); + sym(1).Node = node; + } break; ./ -Catch: T_CATCH T_LPAREN JsIdentifier T_RPAREN Block ; +ClassElement: ClassStaticQualifier MethodDefinition; /. -case $rule_number: { - AST::Catch *node = new (pool) AST::Catch(stringRef(3), sym(5).Block); - node->catchToken = loc(1); - node->lparenToken = loc(2); - node->identifierToken = loc(3); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case $rule_number: { + lexer->setStaticIsKeyword(true); + AST::ClassElementList *node = new (pool) AST::ClassElementList(sym(2).PatternProperty, true); + sym(1).Node = node; + } break; ./ -Finally: T_FINALLY Block ; +ClassElement: T_SEMICOLON; /. -case $rule_number: { - AST::Finally *node = new (pool) AST::Finally(sym(2).Block); - node->finallyToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ -DebuggerStatement: T_DEBUGGER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon -DebuggerStatement: T_DEBUGGER T_SEMICOLON ; +-- Scripts and Modules + +Script: ; /. -case $rule_number: { - AST::DebuggerStatement *node = new (pool) AST::DebuggerStatement(); - node->debuggerToken = loc(1); - node->semicolonToken = loc(2); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = nullptr; + } break; ./ --- tell the parser to prefer function declarations to function expressions. --- That is, the `Function' symbol is used to mark the start of a function --- declaration. -Function: T_FUNCTION %prec REDUCE_HERE ; +Script: ScriptBody; -FunctionDeclaration: Function JsIdentifier T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; +ScriptBody: StatementList; /. -case $rule_number: { - AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); - node->functionToken = loc(1); - node->identifierToken = loc(2); - node->lparenToken = loc(3); - node->rparenToken = loc(5); - node->lbraceToken = loc(6); - node->rbraceToken = loc(8); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).Node = new (pool) AST::Program(sym(1).StatementList->finish()); + } break; ./ -FunctionExpression: T_FUNCTION JsIdentifier T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; +Module: ModuleBodyOpt; +/. case $rule_number: { + sym(1).Node = new (pool) AST::ESModule(sym(1).StatementList); + } break; +./ + +ModuleBody: ModuleItemList; /. -case $rule_number: { - AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); - node->functionToken = loc(1); - if (! stringRef(2).isNull()) - node->identifierToken = loc(2); - node->lparenToken = loc(3); - node->rparenToken = loc(5); - node->lbraceToken = loc(6); - node->rbraceToken = loc(8); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).StatementList = sym(1).StatementList->finish(); + } break; ./ -FunctionExpression: T_FUNCTION T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; +ModuleBodyOpt: ; /. -case $rule_number: { - AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(3).FormalParameterList, sym(6).FunctionBody); - node->functionToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - node->lbraceToken = loc(5); - node->rbraceToken = loc(7); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).StatementList = nullptr; + } break; ./ +ModuleBodyOpt: ModuleBody; + +ModuleItemList: ModuleItem; -FormalParameterList: JsIdentifier ; +ModuleItemList: ModuleItemList ModuleItem; /. -case $rule_number: { - AST::FormalParameterList *node = new (pool) AST::FormalParameterList(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).StatementList = sym(1).StatementList->append(sym(2).StatementList); + } break; ./ -FormalParameterList: FormalParameterList T_COMMA JsIdentifier ; +ModuleItem: ImportDeclaration T_AUTOMATIC_SEMICOLON; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ModuleItem: ImportDeclaration T_SEMICOLON; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ModuleItem: ExportDeclaration T_AUTOMATIC_SEMICOLON; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ModuleItem: ExportDeclaration T_SEMICOLON; /. -case $rule_number: { - AST::FormalParameterList *node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, stringRef(3)); - node->commaToken = loc(2); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; + case $rule_number: { + sym(1).StatementList = new (pool) AST::StatementList(sym(1).Node); + } break; ./ -FormalParameterListOpt: ; +ModuleItem: StatementListItem; + +ImportDeclaration: T_IMPORT ImportClause FromClause; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + auto decl = new (pool) AST::ImportDeclaration(sym(2).ImportClause, sym(3).FromClause); + decl->importToken = loc(1); + sym(1).Node = decl; + } break; +./ +ImportDeclaration: T_IMPORT ModuleSpecifier; +/. + case $rule_number: { + auto decl = new (pool) AST::ImportDeclaration(stringRef(2)); + decl->importToken = loc(1); + decl->moduleSpecifierToken = loc(2); + sym(1).Node = decl; + } break; ./ -FormalParameterListOpt: FormalParameterList ; +ImportClause: ImportedDefaultBinding; /. -case $rule_number: { - sym(1).Node = sym(1).FormalParameterList->finish (); -} break; + case $rule_number: { + auto clause = new (pool) AST::ImportClause(stringRef(1)); + clause->importedDefaultBindingToken = loc(1); + sym(1).ImportClause = clause; + } break; +./ +ImportClause: NameSpaceImport; +/. + case $rule_number: { + sym(1).ImportClause = new (pool) AST::ImportClause(sym(1).NameSpaceImport); + } break; +./ +ImportClause: NamedImports; +/. + case $rule_number: { + sym(1).ImportClause = new (pool) AST::ImportClause(sym(1).NamedImports); + } break; +./ +ImportClause: ImportedDefaultBinding T_COMMA NameSpaceImport; +/. + case $rule_number: { + auto importClause = new (pool) AST::ImportClause(stringRef(1), sym(3).NameSpaceImport); + importClause->importedDefaultBindingToken = loc(1); + sym(1).ImportClause = importClause; + } break; +./ +ImportClause: ImportedDefaultBinding T_COMMA NamedImports; +/. + case $rule_number: { + auto importClause = new (pool) AST::ImportClause(stringRef(1), sym(3).NamedImports); + importClause->importedDefaultBindingToken = loc(1); + sym(1).ImportClause = importClause; + } break; ./ -FunctionBodyOpt: ; +ImportedDefaultBinding: ImportedBinding; + +NameSpaceImport: T_STAR T_AS ImportedBinding; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + auto import = new (pool) AST::NameSpaceImport(stringRef(3)); + import->starToken = loc(1); + import->importedBindingToken = loc(3); + sym(1).NameSpaceImport = import; + } break; ./ -FunctionBodyOpt: FunctionBody ; +NamedImports: T_LBRACE T_RBRACE; +/. + case $rule_number: { + auto namedImports = new (pool) AST::NamedImports(); + namedImports->leftBraceToken = loc(1); + namedImports->rightBraceToken = loc(2); + sym(1).NamedImports = namedImports; + } break; +./ +NamedImports: T_LBRACE ImportsList T_RBRACE; +/. + case $rule_number: { + auto namedImports = new (pool) AST::NamedImports(sym(2).ImportsList->finish()); + namedImports->leftBraceToken = loc(1); + namedImports->rightBraceToken = loc(3); + sym(1).NamedImports = namedImports; + } break; +./ +NamedImports: T_LBRACE ImportsList T_COMMA T_RBRACE; +/. + case $rule_number: { + auto namedImports = new (pool) AST::NamedImports(sym(2).ImportsList->finish()); + namedImports->leftBraceToken = loc(1); + namedImports->rightBraceToken = loc(4); + sym(1).NamedImports = namedImports; + } break; +./ -FunctionBody: SourceElements ; +FromClause: T_FROM ModuleSpecifier; /. -case $rule_number: { - sym(1).Node = new (pool) AST::FunctionBody(sym(1).SourceElements->finish ()); -} break; + case $rule_number: { + auto clause = new (pool) AST::FromClause(stringRef(2)); + clause->fromToken = loc(1); + clause->moduleSpecifierToken = loc(2); + sym(1).FromClause = clause; + } break; ./ -Program: Empty ; +ImportsList: ImportSpecifier; +/. + case $rule_number: { + auto importsList = new (pool) AST::ImportsList(sym(1).ImportSpecifier); + importsList->importSpecifierToken = loc(1); + sym(1).ImportsList = importsList; + } break; +./ +ImportsList: ImportsList T_COMMA ImportSpecifier; +/. + case $rule_number: { + auto importsList = new (pool) AST::ImportsList(sym(1).ImportsList, sym(3).ImportSpecifier); + importsList->importSpecifierToken = loc(3); + sym(1).ImportsList = importsList; + } break; +./ -Program: SourceElements ; +ImportSpecifier: ImportedBinding; /. -case $rule_number: { - sym(1).Node = new (pool) AST::Program(sym(1).SourceElements->finish ()); -} break; + case $rule_number: { + auto importSpecifier = new (pool) AST::ImportSpecifier(stringRef(1)); + importSpecifier->importedBindingToken = loc(1); + sym(1).ImportSpecifier = importSpecifier; + } break; ./ +ImportSpecifier: IdentifierName T_AS ImportedBinding; +/. + case $rule_number: { + auto importSpecifier = new (pool) AST::ImportSpecifier(stringRef(1), stringRef(3)); + importSpecifier->identifierToken = loc(1); + importSpecifier->importedBindingToken = loc(3); + sym(1).ImportSpecifier = importSpecifier; + } break; +./ + +ModuleSpecifier: T_STRING_LITERAL; -SourceElements: SourceElement ; +ImportedBinding: BindingIdentifier; + +ExportDeclarationLookahead: ; +/: +#define J_SCRIPT_EXPORTDECLARATIONLOOKAHEAD_RULE $rule_number +:/ /. -case $rule_number: { - sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElement); -} break; + case $rule_number: { + int token = lookaheadToken(lexer); + if (token == T_FUNCTION || token == T_CLASS) + pushToken(T_FORCE_DECLARATION); + } break; ./ -SourceElements: SourceElements SourceElement ; +ExportDeclaration: T_EXPORT T_STAR FromClause; /. -case $rule_number: { - sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElements, sym(2).SourceElement); -} break; + case $rule_number: { + auto exportDeclaration = new (pool) AST::ExportDeclaration(sym(3).FromClause); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; +./ +ExportDeclaration: T_EXPORT ExportClause FromClause; +/. + case $rule_number: { + auto exportDeclaration = new (pool) AST::ExportDeclaration(sym(2).ExportClause, sym(3).FromClause); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; +./ +ExportDeclaration: T_EXPORT ExportClause; +/. + case $rule_number: { + auto exportDeclaration = new (pool) AST::ExportDeclaration(sym(2).ExportClause); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; +./ +ExportDeclaration: T_EXPORT VariableStatement; +/. case $rule_number: Q_FALLTHROUGH(); ./ +ExportDeclaration: T_EXPORT Declaration; +/. + case $rule_number: { + auto exportDeclaration = new (pool) AST::ExportDeclaration(/*exportDefault=*/false, sym(2).Node); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; +./ +ExportDeclaration: T_EXPORT T_DEFAULT ExportDeclarationLookahead T_FORCE_DECLARATION HoistableDeclaration_Default; +/. + case $rule_number: { + if (auto *f = AST::cast<AST::FunctionDeclaration*>(sym(5).Node)) { + if (f->name.isEmpty()) { + f->name = stringRef(2); + f->identifierToken = loc(2); + } + } + } Q_FALLTHROUGH(); ./ +ExportDeclaration: T_EXPORT T_DEFAULT ExportDeclarationLookahead T_FORCE_DECLARATION ClassDeclaration_Default; +/. + case $rule_number: { + // Emulate 15.2.3.11 + if (auto *cls = AST::cast<AST::ClassDeclaration*>(sym(5).Node)) { + if (cls->name.isEmpty()) { + cls->name = stringRef(2); + cls->identifierToken = loc(2); + } + } -SourceElement: Statement ; + auto exportDeclaration = new (pool) AST::ExportDeclaration(/*exportDefault=*/true, sym(5).Node); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; +./ +ExportDeclaration: T_EXPORT T_DEFAULT ExportDeclarationLookahead AssignmentExpression_In; -- [lookahead ∉ { function, class }] /. -case $rule_number: { - sym(1).Node = new (pool) AST::StatementSourceElement(sym(1).Statement); -} break; + case $rule_number: { + // if lhs is an identifier expression and rhs is an anonymous function expression, we need to assign the name of lhs to the function + if (auto *f = asAnonymousFunctionDefinition(sym(4).Node)) { + f->name = stringRef(2); + } + if (auto *c = asAnonymousClassDefinition(sym(4).Expression)) { + c->name = stringRef(2); + } + + auto exportDeclaration = new (pool) AST::ExportDeclaration(/*exportDefault=*/true, sym(4).Node); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; ./ -SourceElement: FunctionDeclaration ; +ExportClause: T_LBRACE T_RBRACE; /. -case $rule_number: { - sym(1).Node = new (pool) AST::FunctionSourceElement(sym(1).FunctionDeclaration); -} break; + case $rule_number: { + auto exportClause = new (pool) AST::ExportClause(); + exportClause->leftBraceToken = loc(1); + exportClause->rightBraceToken = loc(2); + sym(1).ExportClause = exportClause; + } break; +./ +ExportClause: T_LBRACE ExportsList T_RBRACE; +/. + case $rule_number: { + auto exportClause = new (pool) AST::ExportClause(sym(2).ExportsList->finish()); + exportClause->leftBraceToken = loc(1); + exportClause->rightBraceToken = loc(3); + sym(1).ExportClause = exportClause; + } break; +./ +ExportClause: T_LBRACE ExportsList T_COMMA T_RBRACE; +/. + case $rule_number: { + auto exportClause = new (pool) AST::ExportClause(sym(2).ExportsList->finish()); + exportClause->leftBraceToken = loc(1); + exportClause->rightBraceToken = loc(4); + sym(1).ExportClause = exportClause; + } break; ./ -PropertyAssignmentListOpt: ; +ExportsList: ExportSpecifier; /. -case $rule_number: { - sym(1).Node = 0; -} break; + case $rule_number: { + sym(1).ExportsList = new (pool) AST::ExportsList(sym(1).ExportSpecifier); + } break; +./ +ExportsList: ExportsList T_COMMA ExportSpecifier; +/. + case $rule_number: { + sym(1).ExportsList = new (pool) AST::ExportsList(sym(1).ExportsList, sym(3).ExportSpecifier); + } break; ./ -PropertyAssignmentListOpt: PropertyAssignmentList ; +ExportSpecifier: IdentifierName; +/. + case $rule_number: { + auto exportSpecifier = new (pool) AST::ExportSpecifier(stringRef(1)); + exportSpecifier->identifierToken = loc(1); + sym(1).ExportSpecifier = exportSpecifier; + } break; +./ +ExportSpecifier: IdentifierName T_AS IdentifierName; +/. + case $rule_number: { + auto exportSpecifier = new (pool) AST::ExportSpecifier(stringRef(1), stringRef(3)); + exportSpecifier->identifierToken = loc(1); + exportSpecifier->exportedIdentifierToken = loc(3); + sym(1).ExportSpecifier = exportSpecifier; + } break; +./ + +-- Old top level code /. + // ------------ end of switch statement } // switch action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT); } // if } while (action != 0); +#ifdef PARSER_DEBUG + qDebug() << "Done or error."; +#endif + if (first_token == last_token) { const int errorState = state_stack[tos]; // automatic insertion of `;' if (yytoken != -1 && ((t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken)) || t_action(errorState, T_COMPATIBILITY_SEMICOLON))) { +#ifdef PARSER_DEBUG + qDebug() << "Inserting automatic semicolon."; +#endif SavedToken &tk = token_buffer[0]; tk.token = yytoken; tk.dval = yylval; @@ -3183,7 +4360,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; yylloc.length = 0; //const QString msg = QCoreApplication::translate("QmlParser", "Missing `;'"); - //diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg)); + //diagnostic_messages.append(DiagnosticMessage(Severity::Warning, yylloc, msg)); first_token = &token_buffer[0]; last_token = &token_buffer[1]; @@ -3215,7 +4392,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; msg = QCoreApplication::translate("QmlParser", "Syntax error"); else msg = QCoreApplication::translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); + diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg)); action = errorState; goto _Lcheck_token; @@ -3243,7 +4420,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; 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])); - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); + diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg)); yytoken = *tk; yylval = 0; @@ -3260,14 +4437,13 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || - tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION || - tk == T_FEED_JS_SOURCE_ELEMENT) + tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION) continue; 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])); - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); + diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg)); yytoken = tk; yylval = 0; @@ -3280,7 +4456,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; } const QString msg = QCoreApplication::translate("QmlParser", "Syntax error"); - diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); + diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg)); } return false; diff --git a/src/libs/qmljs/parser/qmljsast.cpp b/src/libs/qmljs/parser/qmljsast.cpp index f23c412c83..5ec1df21a9 100644 --- a/src/libs/qmljs/parser/qmljsast.cpp +++ b/src/libs/qmljs/parser/qmljsast.cpp @@ -31,6 +31,27 @@ QT_QML_BEGIN_NAMESPACE namespace QmlJS { namespace AST { +FunctionExpression *asAnonymousFunctionDefinition(Node *n) +{ + if (!n) + return nullptr; + FunctionExpression *f = n->asFunctionDefinition(); + if (!f || !f->name.isNull()) + return nullptr; + return f; +} + +ClassExpression *asAnonymousClassDefinition(Node *n) +{ + if (!n) + return nullptr; + ClassExpression *c = n->asClassDefinition(); + if (!c || !c->name.isNull()) + return nullptr; + return c; +} + + void Node::accept(Visitor *visitor) { if (visitor->preVisit(this)) { @@ -47,22 +68,42 @@ void Node::accept(Node *node, Visitor *visitor) ExpressionNode *Node::expressionCast() { - return 0; + return nullptr; } BinaryExpression *Node::binaryExpressionCast() { - return 0; + return nullptr; } Statement *Node::statementCast() { - return 0; + return nullptr; } UiObjectMember *Node::uiObjectMemberCast() { - return 0; + return nullptr; +} + +LeftHandSideExpression *Node::leftHandSideExpressionCast() +{ + return nullptr; +} + +Pattern *Node::patternCast() +{ + return nullptr; +} + +FunctionExpression *Node::asFunctionDefinition() +{ + return nullptr; +} + +ClassExpression *Node::asClassDefinition() +{ + return nullptr; } ExpressionNode *ExpressionNode::expressionCast() @@ -70,6 +111,42 @@ ExpressionNode *ExpressionNode::expressionCast() return this; } +FormalParameterList *ExpressionNode::reparseAsFormalParameterList(MemoryPool *pool) +{ + AST::ExpressionNode *expr = this; + AST::FormalParameterList *f = nullptr; + if (AST::Expression *commaExpr = AST::cast<AST::Expression *>(expr)) { + f = commaExpr->left->reparseAsFormalParameterList(pool); + if (!f) + return nullptr; + + expr = commaExpr->right; + } + + AST::ExpressionNode *rhs = nullptr; + if (AST::BinaryExpression *assign = AST::cast<AST::BinaryExpression *>(expr)) { + if (assign->op != QSOperator::Assign) + return nullptr; + expr = assign->left; + rhs = assign->right; + } + AST::PatternElement *binding = nullptr; + if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(expr)) { + binding = new (pool) AST::PatternElement(idExpr->name, rhs); + binding->identifierToken = idExpr->identifierToken; + } else if (AST::Pattern *p = expr->patternCast()) { + SourceLocation loc; + QString s; + if (!p->convertLiteralToAssignmentPattern(pool, &loc, &s)) + return nullptr; + binding = new (pool) AST::PatternElement(p, rhs); + binding->identifierToken = p->firstSourceLocation(); + } + if (!binding) + return nullptr; + return new (pool) AST::FormalParameterList(f, binding); +} + BinaryExpression *BinaryExpression::binaryExpressionCast() { return this; @@ -93,6 +170,16 @@ void NestedExpression::accept0(Visitor *visitor) visitor->endVisit(this); } +FunctionExpression *NestedExpression::asFunctionDefinition() +{ + return expression->asFunctionDefinition(); +} + +ClassExpression *NestedExpression::asClassDefinition() +{ + return expression->asClassDefinition(); +} + void ThisExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { @@ -133,7 +220,7 @@ void FalseLiteral::accept0(Visitor *visitor) visitor->endVisit(this); } -void StringLiteral::accept0(Visitor *visitor) +void SuperLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { } @@ -141,7 +228,8 @@ void StringLiteral::accept0(Visitor *visitor) visitor->endVisit(this); } -void NumericLiteral::accept0(Visitor *visitor) + +void StringLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { } @@ -149,81 +237,229 @@ void NumericLiteral::accept0(Visitor *visitor) visitor->endVisit(this); } -void RegExpLiteral::accept0(Visitor *visitor) +void TemplateLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { + if (next) + accept(next, visitor); } visitor->endVisit(this); } -void ArrayLiteral::accept0(Visitor *visitor) +void NumericLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(elements, visitor); - accept(elision, visitor); } visitor->endVisit(this); } -void ObjectLiteral::accept0(Visitor *visitor) +void RegExpLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(properties, visitor); } visitor->endVisit(this); } -void ElementList::accept0(Visitor *visitor) +void ArrayPattern::accept0(Visitor *visitor) { - if (visitor->visit(this)) { - for (ElementList *it = this; it; it = it->next) { - accept(it->elision, visitor); - accept(it->expression, visitor); - } - } + if (visitor->visit(this)) + accept(elements, visitor); visitor->endVisit(this); } -void Elision::accept0(Visitor *visitor) +bool ArrayPattern::isValidArrayLiteral(SourceLocation *errorLocation) const { + for (PatternElementList *it = elements; it != nullptr; it = it->next) { + PatternElement *e = it->element; + if (e && e->bindingTarget != nullptr) { + if (errorLocation) + *errorLocation = e->firstSourceLocation(); + return false; + } + } + return true; +} + +void ObjectPattern::accept0(Visitor *visitor) { if (visitor->visit(this)) { - // ### + accept(properties, visitor); } visitor->endVisit(this); } -void PropertyNameAndValue::accept0(Visitor *visitor) -{ - if (visitor->visit(this)) { - accept(name, visitor); - accept(value, visitor); +/* + This is the grammar for AssignmentPattern that we need to convert the literal to: + + AssignmentPattern: + ObjectAssignmentPattern + ArrayAssignmentPattern + ArrayAssignmentPattern: + [ ElisionOpt AssignmentRestElementOpt ] + [ AssignmentElementList ] + [ AssignmentElementList , ElisionOpt AssignmentRestElementOpt ] + AssignmentElementList: + AssignmentElisionElement + AssignmentElementList , AssignmentElisionElement + AssignmentElisionElement: + ElisionOpt AssignmentElement + AssignmentRestElement: + ... DestructuringAssignmentTarget + + ObjectAssignmentPattern: + {} + { AssignmentPropertyList } + { AssignmentPropertyList, } + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + AssignmentProperty: + IdentifierReference InitializerOpt_In + PropertyName: + AssignmentElement + + AssignmentElement: + DestructuringAssignmentTarget InitializerOpt_In + DestructuringAssignmentTarget: + LeftHandSideExpression + + It was originally parsed with the following grammar: + +ArrayLiteral: + [ ElisionOpt ] + [ ElementList ] + [ ElementList , ElisionOpt ] +ElementList: + ElisionOpt AssignmentExpression_In + ElisionOpt SpreadElement + ElementList , ElisionOpt AssignmentExpression_In + ElementList , Elisionopt SpreadElement +SpreadElement: + ... AssignmentExpression_In +ObjectLiteral: + {} + { PropertyDefinitionList } + { PropertyDefinitionList , } +PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition +PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression_In + MethodDefinition +PropertyName: + LiteralPropertyName + ComputedPropertyName + +*/ +bool ArrayPattern::convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage) +{ + if (parseMode == Binding) + return true; + for (auto *it = elements; it; it = it->next) { + if (!it->element) + continue; + if (it->element->type == PatternElement::SpreadElement && it->next) { + *errorLocation = it->element->firstSourceLocation(); + *errorMessage = QString::fromLatin1("'...' can only appear as last element in a destructuring list."); + return false; + } + if (!it->element->convertLiteralToAssignmentPattern(pool, errorLocation, errorMessage)) + return false; } + parseMode = Binding; + return true; +} - visitor->endVisit(this); +bool ObjectPattern::convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage) +{ + if (parseMode == Binding) + return true; + for (auto *it = properties; it; it = it->next) { + if (!it->property->convertLiteralToAssignmentPattern(pool, errorLocation, errorMessage)) + return false; + } + parseMode = Binding; + return true; } -void PropertyGetterSetter::accept0(Visitor *visitor) +bool PatternElement::convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage) { - if (visitor->visit(this)) { - accept(name, visitor); - accept(formals, visitor); - accept(functionBody, visitor); + Q_ASSERT(type == Literal || type == SpreadElement); + Q_ASSERT(bindingIdentifier.isNull()); + Q_ASSERT(bindingTarget == nullptr); + Q_ASSERT(bindingTarget == nullptr); + Q_ASSERT(initializer); + ExpressionNode *init = initializer; + + initializer = nullptr; + LeftHandSideExpression *lhs = init->leftHandSideExpressionCast(); + if (type == SpreadElement) { + if (!lhs) { + *errorLocation = init->firstSourceLocation(); + *errorMessage = QString::fromLatin1("Invalid lhs expression after '...' in destructuring expression."); + return false; + } + } else { + type = PatternElement::Binding; + + if (BinaryExpression *b = init->binaryExpressionCast()) { + if (b->op != QSOperator::Assign) { + *errorLocation = b->operatorToken; + *errorMessage = QString::fromLatin1("Invalid assignment operation in destructuring expression"); + return false; + } + lhs = b->left->leftHandSideExpressionCast(); + initializer = b->right; + Q_ASSERT(lhs); + } else { + lhs = init->leftHandSideExpressionCast(); + } + if (!lhs) { + *errorLocation = init->firstSourceLocation(); + *errorMessage = QString::fromLatin1("Destructuring target is not a left hand side expression."); + return false; + } } - visitor->endVisit(this); + if (auto *i = cast<IdentifierExpression *>(lhs)) { + bindingIdentifier = i->name; + identifierToken = i->identifierToken; + return true; + } + + bindingTarget = lhs; + if (auto *p = lhs->patternCast()) { + if (!p->convertLiteralToAssignmentPattern(pool, errorLocation, errorMessage)) + return false; + } + return true; } -void PropertyAssignmentList::accept0(Visitor *visitor) +bool PatternProperty::convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage) +{ + Q_ASSERT(type != SpreadElement); + if (type == Binding) + return true; + if (type == Getter || type == Setter) { + *errorLocation = firstSourceLocation(); + *errorMessage = QString::fromLatin1("Invalid getter/setter in destructuring expression."); + return false; + } + Q_ASSERT(type == Literal); + return PatternElement::convertLiteralToAssignmentPattern(pool, errorLocation, errorMessage); +} + + +void Elision::accept0(Visitor *visitor) { if (visitor->visit(this)) { - for (PropertyAssignmentList *it = this; it; it = it->next) { - accept(it->assignment, visitor); - } + // ### } visitor->endVisit(this); @@ -253,6 +489,28 @@ void NumericLiteralPropertyName::accept0(Visitor *visitor) visitor->endVisit(this); } +namespace { +struct LocaleWithoutZeroPadding : public QLocale +{ + LocaleWithoutZeroPadding() + : QLocale(QLocale::C) + { + setNumberOptions(QLocale::OmitLeadingZeroInExponent | QLocale::OmitGroupSeparator); + } +}; +} + +QString NumericLiteralPropertyName::asString()const +{ + // Can't use QString::number here anymore as it does zero padding by default now. + + // In C++11 this initialization is thread-safe (6.7 [stmt.dcl] p4) + static LocaleWithoutZeroPadding locale; + // Because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562 we can't use thread_local + // for the locale variable and therefore rely on toString(double) to be thread-safe. + return locale.toString(id, 'g', 16); +} + void ArrayMemberExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { @@ -482,15 +740,6 @@ void VariableDeclarationList::accept0(Visitor *visitor) visitor->endVisit(this); } -void VariableDeclaration::accept0(Visitor *visitor) -{ - if (visitor->visit(this)) { - accept(expression, visitor); - } - - visitor->endVisit(this); -} - void EmptyStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { @@ -543,17 +792,6 @@ void ForStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(initialiser, visitor); - accept(condition, visitor); - accept(expression, visitor); - accept(statement, visitor); - } - - visitor->endVisit(this); -} - -void LocalForStatement::accept0(Visitor *visitor) -{ - if (visitor->visit(this)) { accept(declarations, visitor); accept(condition, visitor); accept(expression, visitor); @@ -566,7 +804,7 @@ void LocalForStatement::accept0(Visitor *visitor) void ForEachStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(initialiser, visitor); + accept(lhs, visitor); accept(expression, visitor); accept(statement, visitor); } @@ -574,18 +812,15 @@ void ForEachStatement::accept0(Visitor *visitor) visitor->endVisit(this); } -void LocalForEachStatement::accept0(Visitor *visitor) +void ContinueStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(declaration, visitor); - accept(expression, visitor); - accept(statement, visitor); } visitor->endVisit(this); } -void ContinueStatement::accept0(Visitor *visitor) +void BreakStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { } @@ -593,15 +828,16 @@ void ContinueStatement::accept0(Visitor *visitor) visitor->endVisit(this); } -void BreakStatement::accept0(Visitor *visitor) +void ReturnStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { + accept(expression, visitor); } visitor->endVisit(this); } -void ReturnStatement::accept0(Visitor *visitor) +void YieldExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); @@ -610,6 +846,7 @@ void ReturnStatement::accept0(Visitor *visitor) visitor->endVisit(this); } + void WithStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { @@ -703,6 +940,7 @@ void TryStatement::accept0(Visitor *visitor) void Catch::accept0(Visitor *visitor) { if (visitor->visit(this)) { + accept(patternElement, visitor); accept(statement, visitor); } @@ -738,57 +976,182 @@ void FunctionExpression::accept0(Visitor *visitor) visitor->endVisit(this); } +FunctionExpression *FunctionExpression::asFunctionDefinition() +{ + return this; +} + +QStringList FormalParameterList::formals() const +{ + QStringList formals; + int i = 0; + for (const FormalParameterList *it = this; it; it = it->next) { + if (it->element) { + QString name = it->element->bindingIdentifier.toString(); + int duplicateIndex = formals.indexOf(name); + if (duplicateIndex >= 0) { + // change the name of the earlier argument to enforce the lookup semantics from the spec + formals[duplicateIndex] += QLatin1String("#") + QString::number(i); + } + formals += name; + } + ++i; + } + return formals; +} + +QStringList FormalParameterList::boundNames() const +{ + QStringList names; + for (const FormalParameterList *it = this; it; it = it->next) { + if (it->element) + it->element->boundNames(&names); + } + return names; +} + void FormalParameterList::accept0(Visitor *visitor) { if (visitor->visit(this)) { - // ### + accept(element, visitor); + if (next) + accept(next, visitor); } visitor->endVisit(this); } -void FunctionBody::accept0(Visitor *visitor) +FormalParameterList *FormalParameterList::finish(QmlJS::MemoryPool *pool) +{ + FormalParameterList *front = next; + next = nullptr; + + int i = 0; + for (const FormalParameterList *it = this; it; it = it->next) { + if (it->element && it->element->bindingIdentifier.isEmpty()) + it->element->bindingIdentifier = pool->newString(QLatin1String("arg#") + QString::number(i)); + ++i; + } + return front; +} + +void Program::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(elements, visitor); + accept(statements, visitor); } visitor->endVisit(this); } -void Program::accept0(Visitor *visitor) +void ImportSpecifier::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(elements, visitor); + + } + visitor->endVisit(this); +} + +void ImportsList::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + for (ImportsList *it = this; it; it = it->next) { + accept(it->importSpecifier, visitor); + } + } + + visitor->endVisit(this); +} + +void NamedImports::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(importsList, visitor); + } + + visitor->endVisit(this); +} + +void FromClause::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + } + + visitor->endVisit(this); +} + +void NameSpaceImport::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + } + + visitor->endVisit(this); +} + +void ImportClause::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(nameSpaceImport, visitor); + accept(namedImports, visitor); + } + + visitor->endVisit(this); +} + +void ImportDeclaration::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(importClause, visitor); + accept(fromClause, visitor); + } + + visitor->endVisit(this); +} + +void ExportSpecifier::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + } visitor->endVisit(this); } -void SourceElements::accept0(Visitor *visitor) +void ExportsList::accept0(Visitor *visitor) { if (visitor->visit(this)) { - for (SourceElements *it = this; it; it = it->next) { - accept(it->element, visitor); + for (ExportsList *it = this; it; it = it->next) { + accept(it->exportSpecifier, visitor); } } visitor->endVisit(this); } -void FunctionSourceElement::accept0(Visitor *visitor) +void ExportClause::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(declaration, visitor); + accept(exportsList, visitor); } visitor->endVisit(this); } -void StatementSourceElement::accept0(Visitor *visitor) +void ExportDeclaration::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(statement, visitor); + accept(fromClause, visitor); + accept(exportClause, visitor); + accept(variableStatementOrDeclaration, visitor); + } + + visitor->endVisit(this); +} + +void ESModule::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(body, visitor); } visitor->endVisit(this); @@ -916,18 +1279,9 @@ void UiImport::accept0(Visitor *visitor) visitor->endVisit(this); } -void UiQualifiedPragmaId::accept0(Visitor *visitor) -{ - if (visitor->visit(this)) { - } - - visitor->endVisit(this); -} - void UiPragma::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(pragmaType, visitor); } visitor->endVisit(this); @@ -970,6 +1324,153 @@ void UiEnumMemberList::accept0(Visitor *visitor) visitor->endVisit(this); } +void TaggedTemplate::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(base, visitor); + accept(templateLiteral, visitor); + } + + visitor->endVisit(this); +} + +void PatternElement::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(bindingTarget, visitor); + accept(initializer, visitor); + } + + visitor->endVisit(this); +} + +void PatternElement::boundNames(QStringList *names) +{ + if (bindingTarget) { + if (PatternElementList *e = elementList()) + e->boundNames(names); + else if (PatternPropertyList *p = propertyList()) + p->boundNames(names); + } else { + names->append(bindingIdentifier.toString()); + } +} + +void PatternElementList::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(elision, visitor); + accept(element, visitor); + if (next) + accept(next, visitor); + } + + visitor->endVisit(this); +} + +void PatternElementList::boundNames(QStringList *names) +{ + for (PatternElementList *it = this; it; it = it->next) { + if (it->element) + it->element->boundNames(names); + } +} + +void PatternProperty::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(name, visitor); + accept(bindingTarget, visitor); + accept(initializer, visitor); + } + + visitor->endVisit(this); +} + +void PatternProperty::boundNames(QStringList *names) +{ + PatternElement::boundNames(names); +} + +void PatternPropertyList::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(property, visitor); + if (next) + accept(next, visitor); + } + + visitor->endVisit(this); +} + +void PatternPropertyList::boundNames(QStringList *names) +{ + for (PatternPropertyList *it = this; it; it = it->next) + it->property->boundNames(names); +} + +void ComputedPropertyName::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(expression, visitor); + } + + visitor->endVisit(this); +} + +void ClassExpression::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(heritage, visitor); + accept(elements, visitor); + } + + visitor->endVisit(this); +} + +ClassExpression *ClassExpression::asClassDefinition() +{ + return this; +} + +void ClassDeclaration::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(heritage, visitor); + accept(elements, visitor); + } + + visitor->endVisit(this); +} + +void ClassElementList::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(property, visitor); + if (next) + accept(next, visitor); + } + + visitor->endVisit(this); +} + +ClassElementList *ClassElementList::finish() +{ + ClassElementList *front = next; + next = nullptr; + return front; +} + +Pattern *Pattern::patternCast() +{ + return this; +} + +LeftHandSideExpression *LeftHandSideExpression::leftHandSideExpressionCast() +{ + return this; +} + } } // namespace QmlJS::AST QT_QML_END_NAMESPACE diff --git a/src/libs/qmljs/parser/qmljsast_p.h b/src/libs/qmljs/parser/qmljsast_p.h index ee65923603..048c27d470 100644 --- a/src/libs/qmljs/parser/qmljsast_p.h +++ b/src/libs/qmljs/parser/qmljsast_p.h @@ -62,6 +62,8 @@ enum Op { Div, InplaceDiv, Equal, + Exp, + InplaceExp, Ge, Gt, In, @@ -85,7 +87,8 @@ enum Op { Sub, URShift, InplaceURightShift, - InplaceXor + InplaceXor, + Invalid }; } // namespace QSOperator @@ -94,6 +97,13 @@ namespace QmlJS { namespace AST { +enum class VariableScope { + NoScope, + Var, + Let, + Const +}; + template <typename T1, typename T2> T1 cast(T2 *ast) { @@ -103,6 +113,9 @@ T1 cast(T2 *ast) return 0; } +FunctionExpression *asAnonymousFunctionDefinition(AST::Node *n); +ClassExpression *asAnonymousClassDefinition(AST::Node *n); + class QML_PARSER_EXPORT Node: public Managed { public: @@ -110,7 +123,7 @@ public: Kind_Undefined, Kind_ArgumentList, - Kind_ArrayLiteral, + Kind_ArrayPattern, Kind_ArrayMemberExpression, Kind_BinaryExpression, Kind_Block, @@ -132,6 +145,7 @@ public: Kind_Expression, Kind_ExpressionStatement, Kind_FalseLiteral, + Kind_SuperLiteral, Kind_FieldMemberExpression, Kind_Finally, Kind_ForEachStatement, @@ -140,38 +154,50 @@ public: Kind_FunctionBody, Kind_FunctionDeclaration, Kind_FunctionExpression, - Kind_FunctionSourceElement, + Kind_ClassExpression, + Kind_ClassDeclaration, Kind_IdentifierExpression, Kind_IdentifierPropertyName, + Kind_ComputedPropertyName, Kind_IfStatement, Kind_LabelledStatement, - Kind_LocalForEachStatement, - Kind_LocalForStatement, + Kind_NameSpaceImport, + Kind_ImportSpecifier, + Kind_ImportsList, + Kind_NamedImports, + Kind_ImportClause, + Kind_FromClause, + Kind_ImportDeclaration, + Kind_Module, + Kind_ExportSpecifier, + Kind_ExportsList, + Kind_ExportClause, + Kind_ExportDeclaration, Kind_NewExpression, Kind_NewMemberExpression, Kind_NotExpression, Kind_NullExpression, + Kind_YieldExpression, Kind_NumericLiteral, Kind_NumericLiteralPropertyName, - Kind_ObjectLiteral, + Kind_ObjectPattern, Kind_PostDecrementExpression, Kind_PostIncrementExpression, Kind_PreDecrementExpression, Kind_PreIncrementExpression, Kind_Program, - Kind_PropertyAssignmentList, + Kind_PropertyDefinitionList, Kind_PropertyGetterSetter, Kind_PropertyName, Kind_PropertyNameAndValue, Kind_RegExpLiteral, Kind_ReturnStatement, - Kind_SourceElement, - Kind_SourceElements, Kind_StatementList, - Kind_StatementSourceElement, Kind_StringLiteral, Kind_StringLiteralPropertyName, Kind_SwitchStatement, + Kind_TemplateLiteral, + Kind_TaggedTemplate, Kind_ThisExpression, Kind_ThrowStatement, Kind_TildeExpression, @@ -187,6 +213,12 @@ public: Kind_WhileStatement, Kind_WithStatement, Kind_NestedExpression, + Kind_ClassElementList, + Kind_PatternElement, + Kind_PatternElementList, + Kind_PatternProperty, + Kind_PatternPropertyList, + Kind_UiArrayBinding, Kind_UiImport, @@ -200,7 +232,6 @@ public: Kind_UiParameterList, Kind_UiPublicMember, Kind_UiQualifiedId, - Kind_UiQualifiedPragmaId, Kind_UiScriptBinding, Kind_UiSourceElement, Kind_UiHeaderItemList, @@ -208,8 +239,7 @@ public: Kind_UiEnumMemberList }; - inline Node() - : kind(Kind_Undefined) {} + inline Node() {} // NOTE: node destructors are never called, // instead we block free the memory @@ -220,19 +250,24 @@ public: virtual BinaryExpression *binaryExpressionCast(); virtual Statement *statementCast(); virtual UiObjectMember *uiObjectMemberCast(); + virtual LeftHandSideExpression *leftHandSideExpressionCast(); + virtual Pattern *patternCast(); + // implements the IsFunctionDefinition rules in the spec + virtual FunctionExpression *asFunctionDefinition(); + virtual ClassExpression *asClassDefinition(); void accept(Visitor *visitor); static void accept(Node *node, Visitor *visitor); inline static void acceptChild(Node *node, Visitor *visitor) - { accept(node, visitor); } // ### remove + { return accept(node, visitor); } // ### remove virtual void accept0(Visitor *visitor) = 0; virtual SourceLocation firstSourceLocation() const = 0; virtual SourceLocation lastSourceLocation() const = 0; // attributes - int kind; + int kind = Kind_Undefined; }; class QML_PARSER_EXPORT ExpressionNode: public Node @@ -241,6 +276,14 @@ public: ExpressionNode() {} ExpressionNode *expressionCast() override; + + AST::FormalParameterList *reparseAsFormalParameterList(MemoryPool *pool); + +}; + +class QML_PARSER_EXPORT LeftHandSideExpression : public ExpressionNode +{ + LeftHandSideExpression *leftHandSideExpressionCast() override; }; class QML_PARSER_EXPORT Statement: public Node @@ -251,7 +294,7 @@ public: Statement *statementCast() override; }; -class QML_PARSER_EXPORT NestedExpression: public ExpressionNode +class QML_PARSER_EXPORT NestedExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(NestedExpression) @@ -268,13 +311,17 @@ public: SourceLocation lastSourceLocation() const override { return rparenToken; } + FunctionExpression *asFunctionDefinition() override; + ClassExpression *asClassDefinition() override; + + // attributes ExpressionNode *expression; SourceLocation lparenToken; SourceLocation rparenToken; }; -class QML_PARSER_EXPORT ThisExpression: public ExpressionNode +class QML_PARSER_EXPORT ThisExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(ThisExpression) @@ -293,7 +340,7 @@ public: SourceLocation thisToken; }; -class QML_PARSER_EXPORT IdentifierExpression: public ExpressionNode +class QML_PARSER_EXPORT IdentifierExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(IdentifierExpression) @@ -314,7 +361,7 @@ public: SourceLocation identifierToken; }; -class QML_PARSER_EXPORT NullExpression: public ExpressionNode +class QML_PARSER_EXPORT NullExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(NullExpression) @@ -333,7 +380,7 @@ public: SourceLocation nullToken; }; -class QML_PARSER_EXPORT TrueLiteral: public ExpressionNode +class QML_PARSER_EXPORT TrueLiteral: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(TrueLiteral) @@ -352,7 +399,7 @@ public: SourceLocation trueToken; }; -class QML_PARSER_EXPORT FalseLiteral: public ExpressionNode +class QML_PARSER_EXPORT FalseLiteral: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(FalseLiteral) @@ -371,7 +418,27 @@ public: SourceLocation falseToken; }; -class QML_PARSER_EXPORT NumericLiteral: public ExpressionNode +class QML_PARSER_EXPORT SuperLiteral : public LeftHandSideExpression +{ +public: + QMLJS_DECLARE_AST_NODE(SuperLiteral) + + SuperLiteral() { kind = K; } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return superToken; } + + SourceLocation lastSourceLocation() const override + { return superToken; } + +// attributes + SourceLocation superToken; +}; + + +class QML_PARSER_EXPORT NumericLiteral: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(NumericLiteral) @@ -392,7 +459,7 @@ public: SourceLocation literalToken; }; -class QML_PARSER_EXPORT StringLiteral: public ExpressionNode +class QML_PARSER_EXPORT StringLiteral: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(StringLiteral) @@ -413,7 +480,30 @@ public: SourceLocation literalToken; }; -class QML_PARSER_EXPORT RegExpLiteral: public ExpressionNode +class QML_PARSER_EXPORT TemplateLiteral : public LeftHandSideExpression +{ +public: + QMLJS_DECLARE_AST_NODE(TemplateLiteral) + + TemplateLiteral(const QStringRef &str, ExpressionNode *e) + : value(str), expression(e), next(nullptr) + { kind = K; } + + SourceLocation firstSourceLocation() const override + { return literalToken; } + + SourceLocation lastSourceLocation() const override + { return next ? next->lastSourceLocation() : (expression ? expression->lastSourceLocation() : literalToken); } + + void accept0(Visitor *visitor) override; + + QStringRef value; + ExpressionNode *expression; + TemplateLiteral *next; + SourceLocation literalToken; +}; + +class QML_PARSER_EXPORT RegExpLiteral: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(RegExpLiteral) @@ -435,22 +525,26 @@ public: SourceLocation literalToken; }; -class QML_PARSER_EXPORT ArrayLiteral: public ExpressionNode +class QML_PARSER_EXPORT Pattern : public LeftHandSideExpression { public: - QMLJS_DECLARE_AST_NODE(ArrayLiteral) - - ArrayLiteral(Elision *e): - elements (0), elision (e) - { kind = K; } + enum ParseMode { + Literal, + Binding + }; + Pattern *patternCast() override; + virtual bool convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage) = 0; + ParseMode parseMode = Literal; +}; - ArrayLiteral(ElementList *elts): - elements (elts), elision (0) - { kind = K; } +class QML_PARSER_EXPORT ArrayPattern : public Pattern +{ +public: + QMLJS_DECLARE_AST_NODE(ArrayPattern) - ArrayLiteral(ElementList *elts, Elision *e): - elements (elts), elision (e) - { kind = K; } + ArrayPattern(PatternElementList *elts) + : elements(elts) + { kind = K; } void accept0(Visitor *visitor) override; @@ -460,24 +554,28 @@ public: SourceLocation lastSourceLocation() const override { return rbracketToken; } + bool isValidArrayLiteral(SourceLocation *errorLocation = nullptr) const; + + bool convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage) override; + // attributes - ElementList *elements; - Elision *elision; + PatternElementList *elements = nullptr; SourceLocation lbracketToken; SourceLocation commaToken; SourceLocation rbracketToken; }; -class QML_PARSER_EXPORT ObjectLiteral: public ExpressionNode +class QML_PARSER_EXPORT ObjectPattern : public Pattern { public: - QMLJS_DECLARE_AST_NODE(ObjectLiteral) + QMLJS_DECLARE_AST_NODE(ObjectPattern) - ObjectLiteral(): - properties (0) { kind = K; } + ObjectPattern() + { kind = K; } - ObjectLiteral(PropertyAssignmentList *plist): - properties (plist) { kind = K; } + ObjectPattern(PatternPropertyList *plist) + : properties(plist) + { kind = K; } void accept0(Visitor *visitor) override; @@ -487,8 +585,10 @@ public: SourceLocation lastSourceLocation() const override { return rbraceToken; } + bool convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage) override; + // attributes - PropertyAssignmentList *properties; + PatternPropertyList *properties = nullptr; SourceLocation lbraceToken; SourceLocation rbraceToken; }; @@ -519,7 +619,7 @@ public: inline Elision *finish () { Elision *front = next; - next = 0; + next = nullptr; return front; } @@ -528,53 +628,6 @@ public: SourceLocation commaToken; }; -class QML_PARSER_EXPORT ElementList: public Node -{ -public: - QMLJS_DECLARE_AST_NODE(ElementList) - - ElementList(Elision *e, ExpressionNode *expr): - elision (e), expression (expr), next (this) - { kind = K; } - - ElementList(ElementList *previous, Elision *e, ExpressionNode *expr): - elision (e), expression (expr) - { - kind = K; - next = previous->next; - previous->next = this; - } - - inline ElementList *finish () - { - ElementList *front = next; - next = 0; - return front; - } - - void accept0(Visitor *visitor) override; - - SourceLocation firstSourceLocation() const override - { - if (elision) - return elision->firstSourceLocation(); - return expression->firstSourceLocation(); - } - - SourceLocation lastSourceLocation() const override - { - if (next) - return next->lastSourceLocation(); - return expression->lastSourceLocation(); - } - -// attributes - Elision *elision; - ExpressionNode *expression; - ElementList *next; - SourceLocation commaToken; -}; - class QML_PARSER_EXPORT PropertyName: public Node { public: @@ -594,113 +647,182 @@ public: SourceLocation propertyNameToken; }; -class QML_PARSER_EXPORT PropertyAssignment: public Node +class QML_PARSER_EXPORT PatternElement : public Node { public: - PropertyAssignment(PropertyName *n) - : name(n) - {} + QMLJS_DECLARE_AST_NODE(PatternElement) + + enum Type { + // object literal types + Literal, + Getter, + Setter, + + // used by both bindings and literals + SpreadElement, + RestElement = SpreadElement, + + // binding types + Binding, + }; + + PatternElement(ExpressionNode *i = nullptr, Type t = Literal) + : initializer(i), type(t) + { kind = K; } + + PatternElement(const QStringRef &n, ExpressionNode *i = nullptr, Type t = Binding) + : bindingIdentifier(n), initializer(i), type(t) + { + Q_ASSERT(t >= RestElement); + kind = K; + } + + PatternElement(Pattern *pattern, ExpressionNode *i = nullptr, Type t = Binding) + : bindingTarget(pattern), initializer(i), type(t) + { + Q_ASSERT(t >= RestElement); + kind = K; + } + + void accept0(Visitor *visitor) override; + virtual bool convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage); + + SourceLocation firstSourceLocation() const override + { return identifierToken.isValid() ? identifierToken : (bindingTarget ? bindingTarget->firstSourceLocation() : initializer->firstSourceLocation()); } + + SourceLocation lastSourceLocation() const override + { return initializer ? initializer->lastSourceLocation() : (bindingTarget ? bindingTarget->lastSourceLocation() : identifierToken); } + + ExpressionNode *destructuringTarget() const { return bindingTarget; } + Pattern *destructuringPattern() const { return bindingTarget ? bindingTarget->patternCast() : nullptr; } + PatternElementList *elementList() const { ArrayPattern *a = cast<ArrayPattern *>(bindingTarget); return a ? a->elements : nullptr; } + PatternPropertyList *propertyList() const { ObjectPattern *o = cast<ObjectPattern *>(bindingTarget); return o ? o->properties : nullptr; } + + bool isVariableDeclaration() const { return scope != VariableScope::NoScope; } + bool isLexicallyScoped() const { return scope == VariableScope::Let || scope == VariableScope::Const; } + + virtual void boundNames(QStringList *names); + // attributes - PropertyName *name; + SourceLocation identifierToken; + QStringRef bindingIdentifier; + ExpressionNode *bindingTarget = nullptr; + ExpressionNode *initializer = nullptr; + Type type = Literal; + // when used in a VariableDeclarationList + VariableScope scope = VariableScope::NoScope; + bool isForDeclaration = false; }; -class QML_PARSER_EXPORT PropertyAssignmentList: public Node +class QML_PARSER_EXPORT PatternElementList : public Node { public: - QMLJS_DECLARE_AST_NODE(PropertyAssignmentList) + QMLJS_DECLARE_AST_NODE(PatternElementList) - PropertyAssignmentList(PropertyAssignment *assignment) - : assignment(assignment) - , next(this) + PatternElementList(Elision *elision, PatternElement *element) + : elision(elision), element(element), next(this) { kind = K; } - PropertyAssignmentList(PropertyAssignmentList *previous, PropertyAssignment *assignment) - : assignment(assignment) - { - kind = K; - next = previous->next; - previous->next = this; + PatternElementList *append(PatternElementList *n) { + n->next = next; + next = n; + return n; } - inline PropertyAssignmentList *finish () + inline PatternElementList *finish () { - PropertyAssignmentList *front = next; + PatternElementList *front = next; next = 0; return front; } void accept0(Visitor *visitor) override; + void boundNames(QStringList *names); + SourceLocation firstSourceLocation() const override - { return assignment->firstSourceLocation(); } + { return elision ? elision->firstSourceLocation() : element->firstSourceLocation(); } SourceLocation lastSourceLocation() const override - { return next ? next->lastSourceLocation() : assignment->lastSourceLocation(); } + { return next ? next->lastSourceLocation() : (element ? element->lastSourceLocation() : elision->lastSourceLocation()); } -// attributes - PropertyAssignment *assignment; - PropertyAssignmentList *next; - SourceLocation commaToken; + Elision *elision = nullptr; + PatternElement *element = nullptr; + PatternElementList *next; }; -class QML_PARSER_EXPORT PropertyNameAndValue: public PropertyAssignment +class QML_PARSER_EXPORT PatternProperty : public PatternElement { public: - QMLJS_DECLARE_AST_NODE(PropertyNameAndValue) + QMLJS_DECLARE_AST_NODE(PatternProperty) + + PatternProperty(PropertyName *name, ExpressionNode *i = nullptr, Type t = Literal) + : PatternElement(i, t), name(name) + { kind = K; } - PropertyNameAndValue(PropertyName *n, ExpressionNode *v) - : PropertyAssignment(n), value(v) + PatternProperty(PropertyName *name, const QStringRef &n, ExpressionNode *i = nullptr) + : PatternElement(n, i), name(name) + { kind = K; } + + PatternProperty(PropertyName *name, Pattern *pattern, ExpressionNode *i = nullptr) + : PatternElement(pattern, i), name(name) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return name->firstSourceLocation(); } - SourceLocation lastSourceLocation() const override - { return value->lastSourceLocation(); } + { + SourceLocation loc = PatternElement::lastSourceLocation(); + return loc.isValid() ? loc : name->lastSourceLocation(); + } + + void boundNames(QStringList *names) override; + bool convertLiteralToAssignmentPattern(MemoryPool *pool, SourceLocation *errorLocation, QString *errorMessage) override; // attributes + PropertyName *name; SourceLocation colonToken; - ExpressionNode *value; - SourceLocation commaToken; }; -class QML_PARSER_EXPORT PropertyGetterSetter: public PropertyAssignment + +class QML_PARSER_EXPORT PatternPropertyList : public Node { public: - QMLJS_DECLARE_AST_NODE(PropertyGetterSetter) + QMLJS_DECLARE_AST_NODE(PatternPropertyList) - enum Type { - Getter, - Setter - }; - - PropertyGetterSetter(PropertyName *n, FunctionBody *b) - : PropertyAssignment(n), type(Getter), formals(0), functionBody (b) + PatternPropertyList(PatternProperty *property) + : property(property), next(this) { kind = K; } - PropertyGetterSetter(PropertyName *n, FormalParameterList *f, FunctionBody *b) - : PropertyAssignment(n), type(Setter), formals(f), functionBody (b) - { kind = K; } + PatternPropertyList(PatternPropertyList *previous, PatternProperty *property) + : property(property), next(this) + { + kind = K; + next = previous->next; + previous->next = this; + } void accept0(Visitor *visitor) override; + void boundNames(QStringList *names); + + inline PatternPropertyList *finish () + { + PatternPropertyList *front = next; + next = 0; + return front; + } + SourceLocation firstSourceLocation() const override - { return getSetToken; } + { return property->firstSourceLocation(); } SourceLocation lastSourceLocation() const override - { return rbraceToken; } + { return next ? next->lastSourceLocation() : property->lastSourceLocation(); } -// attributes - Type type; - SourceLocation getSetToken; - SourceLocation lparenToken; - FormalParameterList *formals; - SourceLocation rparenToken; - SourceLocation lbraceToken; - FunctionBody *functionBody; - SourceLocation rbraceToken; + PatternProperty *property; + PatternPropertyList *next; }; class QML_PARSER_EXPORT IdentifierPropertyName: public PropertyName @@ -745,13 +867,37 @@ public: void accept0(Visitor *visitor) override; - QString asString() const override { return QString::number(id, 'g', 16); } + QString asString() const override; // attributes double id; }; -class QML_PARSER_EXPORT ArrayMemberExpression: public ExpressionNode +class QML_PARSER_EXPORT ComputedPropertyName : public PropertyName +{ +public: + QMLJS_DECLARE_AST_NODE(ComputedPropertyName) + + ComputedPropertyName(ExpressionNode *expression) + : expression(expression) + { kind = K; } + + void accept0(Visitor *visitor) override; + + QString asString() const override { return QString(); } + + SourceLocation firstSourceLocation() const override + { return expression->firstSourceLocation(); } + + SourceLocation lastSourceLocation() const override + { return expression->lastSourceLocation(); } + +// attributes + ExpressionNode *expression; +}; + + +class QML_PARSER_EXPORT ArrayMemberExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(ArrayMemberExpression) @@ -775,7 +921,7 @@ public: SourceLocation rbracketToken; }; -class QML_PARSER_EXPORT FieldMemberExpression: public ExpressionNode +class QML_PARSER_EXPORT FieldMemberExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(FieldMemberExpression) @@ -799,7 +945,29 @@ public: SourceLocation identifierToken; }; -class QML_PARSER_EXPORT NewMemberExpression: public ExpressionNode +class QML_PARSER_EXPORT TaggedTemplate : public LeftHandSideExpression +{ +public: + QMLJS_DECLARE_AST_NODE(TaggedTemplate) + + TaggedTemplate(ExpressionNode *b, TemplateLiteral *t) + : base (b), templateLiteral(t) + { kind = K; } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return base->firstSourceLocation(); } + + SourceLocation lastSourceLocation() const override + { return templateLiteral->lastSourceLocation(); } + + // attributes + ExpressionNode *base; + TemplateLiteral *templateLiteral; +}; + +class QML_PARSER_EXPORT NewMemberExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(NewMemberExpression) @@ -824,7 +992,7 @@ public: SourceLocation rparenToken; }; -class QML_PARSER_EXPORT NewExpression: public ExpressionNode +class QML_PARSER_EXPORT NewExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(NewExpression) @@ -845,7 +1013,7 @@ public: SourceLocation newToken; }; -class QML_PARSER_EXPORT CallExpression: public ExpressionNode +class QML_PARSER_EXPORT CallExpression: public LeftHandSideExpression { public: QMLJS_DECLARE_AST_NODE(CallExpression) @@ -901,7 +1069,7 @@ public: inline ArgumentList *finish () { ArgumentList *front = next; - next = 0; + next = nullptr; return front; } @@ -909,6 +1077,7 @@ public: ExpressionNode *expression; ArgumentList *next; SourceLocation commaToken; + bool isSpreadElement = false; }; class QML_PARSER_EXPORT PostIncrementExpression: public ExpressionNode @@ -1242,16 +1411,15 @@ class QML_PARSER_EXPORT StatementList: public Node public: QMLJS_DECLARE_AST_NODE(StatementList) - StatementList(Statement *stmt): - statement (stmt), next (this) - { kind = K; } + // ### This should be a Statement, but FunctionDeclaration currently doesn't inherit it. + StatementList(Node *stmt) + : statement(stmt), next (this) + { kind = K; } - StatementList(StatementList *previous, Statement *stmt): - statement (stmt) - { - kind = K; - next = previous->next; - previous->next = this; + StatementList *append(StatementList *n) { + n->next = next; + next = n; + return n; } void accept0(Visitor *visitor) override; @@ -1265,81 +1433,26 @@ public: inline StatementList *finish () { StatementList *front = next; - next = 0; + next = nullptr; return front; } // attributes - Statement *statement; + Node *statement = nullptr; StatementList *next; }; -class QML_PARSER_EXPORT VariableStatement: public Statement -{ -public: - QMLJS_DECLARE_AST_NODE(VariableStatement) - - VariableStatement(VariableDeclarationList *vlist): - declarations (vlist) - { kind = K; } - - void accept0(Visitor *visitor) override; - - SourceLocation firstSourceLocation() const override - { return declarationKindToken; } - - SourceLocation lastSourceLocation() const override - { return semicolonToken; } - -// attributes - VariableDeclarationList *declarations; - SourceLocation declarationKindToken; - SourceLocation semicolonToken; -}; - -class QML_PARSER_EXPORT VariableDeclaration: public Node -{ -public: - QMLJS_DECLARE_AST_NODE(VariableDeclaration) - - enum VariableScope { - FunctionScope, - BlockScope, // let - ReadOnlyBlockScope // const - }; - - VariableDeclaration(const QStringRef &n, ExpressionNode *e, VariableScope s): - name (n), expression (e), scope(s) - { kind = K; } - - bool isLexicallyScoped() const { return scope != FunctionScope; } - - void accept0(Visitor *visitor) override; - - SourceLocation firstSourceLocation() const override - { return identifierToken; } - - SourceLocation lastSourceLocation() const override - { return expression ? expression->lastSourceLocation() : identifierToken; } - -// attributes - QStringRef name; - ExpressionNode *expression; - SourceLocation identifierToken; - VariableScope scope; -}; - class QML_PARSER_EXPORT VariableDeclarationList: public Node { public: QMLJS_DECLARE_AST_NODE(VariableDeclarationList) - VariableDeclarationList(VariableDeclaration *decl): - declaration (decl), next (this) - { kind = K; } + VariableDeclarationList(PatternElement *decl) + : declaration(decl), next(this) + { kind = K; } - VariableDeclarationList(VariableDeclarationList *previous, VariableDeclaration *decl): - declaration (decl) + VariableDeclarationList(VariableDeclarationList *previous, PatternElement *decl) + : declaration(decl) { kind = K; next = previous->next; @@ -1358,23 +1471,45 @@ public: return declaration->lastSourceLocation(); } - inline VariableDeclarationList *finish(VariableDeclaration::VariableScope s) + inline VariableDeclarationList *finish(VariableScope s) { VariableDeclarationList *front = next; - next = 0; + next = nullptr; VariableDeclarationList *vdl; - for (vdl = front; vdl != 0; vdl = vdl->next) { + for (vdl = front; vdl != nullptr; vdl = vdl->next) { vdl->declaration->scope = s; } return front; } // attributes - VariableDeclaration *declaration; + PatternElement *declaration; VariableDeclarationList *next; SourceLocation commaToken; }; +class QML_PARSER_EXPORT VariableStatement: public Statement +{ +public: + QMLJS_DECLARE_AST_NODE(VariableStatement) + + VariableStatement(VariableDeclarationList *vlist): + declarations (vlist) + { kind = K; } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return declarationKindToken; } + + SourceLocation lastSourceLocation() const override + { return declarations->lastSourceLocation(); } + +// attributes + VariableDeclarationList *declarations; + SourceLocation declarationKindToken; +}; + class QML_PARSER_EXPORT EmptyStatement: public Statement { public: @@ -1408,7 +1543,7 @@ public: { return expression->firstSourceLocation(); } SourceLocation lastSourceLocation() const override - { return semicolonToken; } + { return semicolonToken.isValid() ? semicolonToken : expression->lastSourceLocation(); } // attributes ExpressionNode *expression; @@ -1420,7 +1555,7 @@ class QML_PARSER_EXPORT IfStatement: public Statement public: QMLJS_DECLARE_AST_NODE(IfStatement) - IfStatement(ExpressionNode *e, Statement *t, Statement *f = 0): + IfStatement(ExpressionNode *e, Statement *t, Statement *f = nullptr): expression (e), ok (t), ko (f) { kind = K; } @@ -1508,35 +1643,11 @@ public: initialiser (i), condition (c), expression (e), statement (stmt) { kind = K; } - void accept0(Visitor *visitor) override; - - SourceLocation firstSourceLocation() const override - { return forToken; } - - SourceLocation lastSourceLocation() const override - { return statement->lastSourceLocation(); } - -// attributes - ExpressionNode *initialiser; - ExpressionNode *condition; - ExpressionNode *expression; - Statement *statement; - SourceLocation forToken; - SourceLocation lparenToken; - SourceLocation firstSemicolonToken; - SourceLocation secondSemicolonToken; - SourceLocation rparenToken; -}; - -class QML_PARSER_EXPORT LocalForStatement: public Statement -{ -public: - QMLJS_DECLARE_AST_NODE(LocalForStatement) - - LocalForStatement(VariableDeclarationList *vlist, ExpressionNode *c, ExpressionNode *e, Statement *stmt): + ForStatement(VariableDeclarationList *vlist, ExpressionNode *c, ExpressionNode *e, Statement *stmt): declarations (vlist), condition (c), expression (e), statement (stmt) { kind = K; } + void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override @@ -1546,26 +1657,34 @@ public: { return statement->lastSourceLocation(); } // attributes - VariableDeclarationList *declarations; + ExpressionNode *initialiser = nullptr; + VariableDeclarationList *declarations = nullptr; ExpressionNode *condition; ExpressionNode *expression; Statement *statement; SourceLocation forToken; SourceLocation lparenToken; - SourceLocation varToken; SourceLocation firstSemicolonToken; SourceLocation secondSemicolonToken; SourceLocation rparenToken; }; +enum class ForEachType { + In, + Of +}; + class QML_PARSER_EXPORT ForEachStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(ForEachStatement) - ForEachStatement(ExpressionNode *i, ExpressionNode *e, Statement *stmt): - initialiser (i), expression (e), statement (stmt) - { kind = K; } + ForEachStatement(ExpressionNode *i, ExpressionNode *e, Statement *stmt) + : lhs(i), expression(e), statement(stmt) + { kind = K; } + ForEachStatement(PatternElement *v, ExpressionNode *e, Statement *stmt) + : lhs(v), expression(e), statement(stmt) + { kind = K; } void accept0(Visitor *visitor) override; @@ -1575,42 +1694,19 @@ public: SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } -// attributes - ExpressionNode *initialiser; - ExpressionNode *expression; - Statement *statement; - SourceLocation forToken; - SourceLocation lparenToken; - SourceLocation inToken; - SourceLocation rparenToken; -}; - -class QML_PARSER_EXPORT LocalForEachStatement: public Statement -{ -public: - QMLJS_DECLARE_AST_NODE(LocalForEachStatement) - - LocalForEachStatement(VariableDeclaration *v, ExpressionNode *e, Statement *stmt): - declaration (v), expression (e), statement (stmt) - { kind = K; } - - void accept0(Visitor *visitor) override; - - SourceLocation firstSourceLocation() const override - { return forToken; } - - SourceLocation lastSourceLocation() const override - { return statement->lastSourceLocation(); } + PatternElement *declaration() const { + return AST::cast<PatternElement *>(lhs); + } // attributes - VariableDeclaration *declaration; + Node *lhs; ExpressionNode *expression; Statement *statement; SourceLocation forToken; SourceLocation lparenToken; - SourceLocation varToken; - SourceLocation inToken; + SourceLocation inOfToken; SourceLocation rparenToken; + ForEachType type; }; class QML_PARSER_EXPORT ContinueStatement: public Statement @@ -1681,6 +1777,28 @@ public: SourceLocation semicolonToken; }; +class QML_PARSER_EXPORT YieldExpression: public ExpressionNode +{ +public: + QMLJS_DECLARE_AST_NODE(YieldExpression) + + YieldExpression(ExpressionNode *e = nullptr): + expression (e) { kind = K; } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return yieldToken; } + + SourceLocation lastSourceLocation() const override + { return expression ? expression->lastSourceLocation() : yieldToken; } + +// attributes + ExpressionNode *expression; + bool isYieldStar = false; + SourceLocation yieldToken; +}; + class QML_PARSER_EXPORT WithStatement: public Statement { public: @@ -1711,7 +1829,7 @@ class QML_PARSER_EXPORT CaseBlock: public Node public: QMLJS_DECLARE_AST_NODE(CaseBlock) - CaseBlock(CaseClauses *c, DefaultClause *d = 0, CaseClauses *r = 0): + CaseBlock(CaseClauses *c, DefaultClause *d = nullptr, CaseClauses *r = nullptr): clauses (c), defaultClause (d), moreClauses (r) { kind = K; } @@ -1808,7 +1926,7 @@ public: inline CaseClauses *finish () { CaseClauses *front = next; - next = 0; + next = nullptr; return front; } @@ -1891,9 +2009,9 @@ class QML_PARSER_EXPORT Catch: public Node public: QMLJS_DECLARE_AST_NODE(Catch) - Catch(const QStringRef &n, Block *stmt): - name (n), statement (stmt) - { kind = K; } + Catch(PatternElement *p, Block *stmt) + : patternElement(p), statement(stmt) + { kind = K; } void accept0(Visitor *visitor) override; @@ -1904,7 +2022,7 @@ public: { return statement->lastSourceLocation(); } // attributes - QStringRef name; + PatternElement *patternElement; Block *statement; SourceLocation catchToken; SourceLocation lparenToken; @@ -1944,11 +2062,11 @@ public: { kind = K; } TryStatement(Statement *stmt, Finally *f): - statement (stmt), catchExpression (0), finallyExpression (f) + statement (stmt), catchExpression (nullptr), finallyExpression (f) { kind = K; } TryStatement(Statement *stmt, Catch *c): - statement (stmt), catchExpression (c), finallyExpression (0) + statement (stmt), catchExpression (c), finallyExpression (nullptr) { kind = K; } void accept0(Visitor *visitor) override; @@ -1978,7 +2096,7 @@ class QML_PARSER_EXPORT FunctionExpression: public ExpressionNode public: QMLJS_DECLARE_AST_NODE(FunctionExpression) - FunctionExpression(const QStringRef &n, FormalParameterList *f, FunctionBody *b): + FunctionExpression(const QStringRef &n, FormalParameterList *f, StatementList *b): name (n), formals (f), body (b) { kind = K; } @@ -1990,10 +2108,14 @@ public: SourceLocation lastSourceLocation() const override { return rbraceToken; } + FunctionExpression *asFunctionDefinition() override; + // attributes QStringRef name; + bool isArrowFunction = false; + bool isGenerator = false; FormalParameterList *formals; - FunctionBody *body; + StatementList *body; SourceLocation functionToken; SourceLocation identifierToken; SourceLocation lparenToken; @@ -2007,7 +2129,7 @@ class QML_PARSER_EXPORT FunctionDeclaration: public FunctionExpression public: QMLJS_DECLARE_AST_NODE(FunctionDeclaration) - FunctionDeclaration(const QStringRef &n, FormalParameterList *f, FunctionBody *b): + FunctionDeclaration(const QStringRef &n, FormalParameterList *f, StatementList *b): FunctionExpression(n, f, b) { kind = K; } @@ -2019,168 +2141,593 @@ class QML_PARSER_EXPORT FormalParameterList: public Node public: QMLJS_DECLARE_AST_NODE(FormalParameterList) - FormalParameterList(const QStringRef &n): - name (n), next (this) + FormalParameterList(FormalParameterList *previous, PatternElement *e) + : element(e) + { + kind = K; + if (previous) { + next = previous->next; + previous->next = this; + } else { + next = this; + } + } + + FormalParameterList *append(FormalParameterList *n) { + n->next = next; + next = n; + return n; + } + + bool isSimpleParameterList() + { + AST::FormalParameterList *formals = this; + while (formals) { + PatternElement *e = formals->element; + if (e && e->type == PatternElement::RestElement) + return false; + if (e && (e->initializer || e->bindingTarget)) + return false; + formals = formals->next; + } + return true; + } + + int length() + { + // the length property of Function objects + int l = 0; + AST::FormalParameterList *formals = this; + while (formals) { + PatternElement *e = formals->element; + if (!e || e->initializer) + break; + if (e->type == PatternElement::RestElement) + break; + ++l; + formals = formals->next; + } + return l; + } + + bool containsName(const QString &name) const { + for (const FormalParameterList *it = this; it; it = it->next) { + PatternElement *b = it->element; + // ### handle binding patterns + if (b && b->bindingIdentifier == name) + return true; + } + return false; + } + + QStringList formals() const; + + QStringList boundNames() const; + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return element->firstSourceLocation(); } + + SourceLocation lastSourceLocation() const override + { return next ? next->lastSourceLocation() : element->lastSourceLocation(); } + + FormalParameterList *finish(MemoryPool *pool); + +// attributes + PatternElement *element = nullptr; + FormalParameterList *next; +}; + +class QML_PARSER_EXPORT ClassExpression : public ExpressionNode +{ +public: + QMLJS_DECLARE_AST_NODE(ClassExpression) + + ClassExpression(const QStringRef &n, ExpressionNode *heritage, ClassElementList *elements) + : name(n), heritage(heritage), elements(elements) { kind = K; } - FormalParameterList(FormalParameterList *previous, const QStringRef &n): - name (n) + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return classToken; } + + SourceLocation lastSourceLocation() const override + { return rbraceToken; } + + ClassExpression *asClassDefinition() override; + +// attributes + QStringRef name; + ExpressionNode *heritage; + ClassElementList *elements; + SourceLocation classToken; + SourceLocation identifierToken; + SourceLocation lbraceToken; + SourceLocation rbraceToken; +}; + +class QML_PARSER_EXPORT ClassDeclaration: public ClassExpression +{ +public: + QMLJS_DECLARE_AST_NODE(ClassDeclaration) + + ClassDeclaration(const QStringRef &n, ExpressionNode *heritage, ClassElementList *elements) + : ClassExpression(n, heritage, elements) + { kind = K; } + + void accept0(Visitor *visitor) override; +}; + + +class QML_PARSER_EXPORT ClassElementList : public Node +{ +public: + QMLJS_DECLARE_AST_NODE(ClassElementList) + + ClassElementList(PatternProperty *property, bool isStatic) + : isStatic(isStatic), property(property) { kind = K; - next = previous->next; - previous->next = this; + next = this; + } + + ClassElementList *append(ClassElementList *n) { + n->next = next; + next = n; + return n; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override - { return identifierToken; } + { return property->firstSourceLocation(); } SourceLocation lastSourceLocation() const override - { return next ? next->lastSourceLocation() : identifierToken; } + { + if (next) + return next->lastSourceLocation(); + return property->lastSourceLocation(); + } - inline FormalParameterList *finish () + ClassElementList *finish(); + + bool isStatic; + ClassElementList *next; + PatternProperty *property; +}; + +class QML_PARSER_EXPORT Program: public Node +{ +public: + QMLJS_DECLARE_AST_NODE(Program) + + Program(StatementList *statements) + : statements(statements) + { kind = K; } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return statements ? statements->firstSourceLocation() : SourceLocation(); } + + SourceLocation lastSourceLocation() const override + { return statements ? statements->lastSourceLocation() : SourceLocation(); } + +// attributes + StatementList *statements; +}; + +class QML_PARSER_EXPORT ImportSpecifier: public Node +{ +public: + QMLJS_DECLARE_AST_NODE(ImportSpecifier) + + ImportSpecifier(const QStringRef &importedBinding) + : importedBinding(importedBinding) { - FormalParameterList *front = next; - next = 0; - return front; + kind = K; } + ImportSpecifier(const QStringRef &identifier, const QStringRef &importedBinding) + : identifier(identifier), importedBinding(importedBinding) + { + kind = K; + } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return identifier.isNull() ? importedBindingToken : identifierToken; } + SourceLocation lastSourceLocation() const override + { return importedBindingToken; } + // attributes - QStringRef name; - FormalParameterList *next; - SourceLocation commaToken; SourceLocation identifierToken; + SourceLocation importedBindingToken; + QStringRef identifier; + QStringRef importedBinding; }; -class QML_PARSER_EXPORT SourceElement: public Node +class QML_PARSER_EXPORT ImportsList: public Node { public: - QMLJS_DECLARE_AST_NODE(SourceElement) + QMLJS_DECLARE_AST_NODE(ImportsList) - inline SourceElement() - { kind = K; } + ImportsList(ImportSpecifier *importSpecifier) + : importSpecifier(importSpecifier) + { + kind = K; + next = this; + } + + ImportsList(ImportsList *previous, ImportSpecifier *importSpecifier) + : importSpecifier(importSpecifier) + { + kind = K; + if (previous) { + next = previous->next; + previous->next = this; + } else { + next = this; + } + } + + ImportsList *finish() + { + ImportsList *head = next; + next = nullptr; + return head; + } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return importSpecifierToken; } + + SourceLocation lastSourceLocation() const override + { return next ? next->lastSourceLocation() : importSpecifierToken; } + +// attributes + SourceLocation importSpecifierToken; + ImportSpecifier *importSpecifier; + ImportsList *next = this; }; -class QML_PARSER_EXPORT SourceElements: public Node +class QML_PARSER_EXPORT NamedImports: public Node { public: - QMLJS_DECLARE_AST_NODE(SourceElements) + QMLJS_DECLARE_AST_NODE(NamedImports) - SourceElements(SourceElement *elt): - element (elt), next (this) - { kind = K; } + NamedImports() + { + kind = K; + } - SourceElements(SourceElements *previous, SourceElement *elt): - element (elt) + NamedImports(ImportsList *importsList) + : importsList(importsList) { kind = K; - next = previous->next; - previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override - { return element->firstSourceLocation(); } - + { return leftBraceToken; } SourceLocation lastSourceLocation() const override - { return next ? next->lastSourceLocation() : element->lastSourceLocation(); } + { return rightBraceToken; } - inline SourceElements *finish () +// attributes + SourceLocation leftBraceToken; + SourceLocation rightBraceToken; + ImportsList *importsList = nullptr; +}; + +class QML_PARSER_EXPORT NameSpaceImport: public Node +{ +public: + QMLJS_DECLARE_AST_NODE(NameSpaceImport) + + NameSpaceImport(const QStringRef &importedBinding) + : importedBinding(importedBinding) { - SourceElements *front = next; - next = 0; - return front; + kind = K; } + void accept0(Visitor *visitor) override; + + virtual SourceLocation firstSourceLocation() const override + { return starToken; } + virtual SourceLocation lastSourceLocation() const override + { return importedBindingToken; } + // attributes - SourceElement *element; - SourceElements *next; + SourceLocation starToken; + SourceLocation importedBindingToken; + QStringRef importedBinding; }; -class QML_PARSER_EXPORT FunctionBody: public Node +class QML_PARSER_EXPORT ImportClause: public Node { public: - QMLJS_DECLARE_AST_NODE(FunctionBody) + QMLJS_DECLARE_AST_NODE(ImportClause) - FunctionBody(SourceElements *elts): - elements (elts) - { kind = K; } + ImportClause(const QStringRef &importedDefaultBinding) + : importedDefaultBinding(importedDefaultBinding) + { + kind = K; + } + + ImportClause(NameSpaceImport *nameSpaceImport) + : nameSpaceImport(nameSpaceImport) + { + kind = K; + } + + ImportClause(NamedImports *namedImports) + : namedImports(namedImports) + { + kind = K; + } + + ImportClause(const QStringRef &importedDefaultBinding, NameSpaceImport *nameSpaceImport) + : importedDefaultBinding(importedDefaultBinding) + , nameSpaceImport(nameSpaceImport) + { + kind = K; + } + + ImportClause(const QStringRef &importedDefaultBinding, NamedImports *namedImports) + : importedDefaultBinding(importedDefaultBinding) + , namedImports(namedImports) + { + kind = K; + } + + void accept0(Visitor *visitor) override; + + virtual SourceLocation firstSourceLocation() const override + { return importedDefaultBinding.isNull() ? (nameSpaceImport ? nameSpaceImport->firstSourceLocation() : namedImports->firstSourceLocation()) : importedDefaultBindingToken; } + virtual SourceLocation lastSourceLocation() const override + { return importedDefaultBinding.isNull() ? (nameSpaceImport ? nameSpaceImport->lastSourceLocation() : namedImports->lastSourceLocation()) : importedDefaultBindingToken; } + +// attributes + SourceLocation importedDefaultBindingToken; + QStringRef importedDefaultBinding; + NameSpaceImport *nameSpaceImport = nullptr; + NamedImports *namedImports = nullptr; +}; + +class QML_PARSER_EXPORT FromClause: public Node +{ +public: + QMLJS_DECLARE_AST_NODE(FromClause) + + FromClause(const QStringRef &moduleSpecifier) + : moduleSpecifier(moduleSpecifier) + { + kind = K; + } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override - { return elements ? elements->firstSourceLocation() : SourceLocation(); } + { return fromToken; } SourceLocation lastSourceLocation() const override - { return elements ? elements->lastSourceLocation() : SourceLocation(); } + { return moduleSpecifierToken; } // attributes - SourceElements *elements; + SourceLocation fromToken; + SourceLocation moduleSpecifierToken; + QStringRef moduleSpecifier; }; -class QML_PARSER_EXPORT Program: public Node +class QML_PARSER_EXPORT ImportDeclaration: public Statement { public: - QMLJS_DECLARE_AST_NODE(Program) + QMLJS_DECLARE_AST_NODE(ImportDeclaration) - Program(SourceElements *elts): - elements (elts) - { kind = K; } + ImportDeclaration(ImportClause *importClause, FromClause *fromClause) + : importClause(importClause), fromClause(fromClause) + { + kind = K; + } + + ImportDeclaration(const QStringRef &moduleSpecifier) + : moduleSpecifier(moduleSpecifier) + { + kind = K; + } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override - { return elements ? elements->firstSourceLocation() : SourceLocation(); } + { return importToken; } SourceLocation lastSourceLocation() const override - { return elements ? elements->lastSourceLocation() : SourceLocation(); } + { return moduleSpecifier.isNull() ? fromClause->lastSourceLocation() : moduleSpecifierToken; } // attributes - SourceElements *elements; + SourceLocation importToken; + SourceLocation moduleSpecifierToken; + QStringRef moduleSpecifier; + ImportClause *importClause = nullptr; + FromClause *fromClause = nullptr; }; -class QML_PARSER_EXPORT FunctionSourceElement: public SourceElement +class QML_PARSER_EXPORT ExportSpecifier: public Node { public: - QMLJS_DECLARE_AST_NODE(FunctionSourceElement) + QMLJS_DECLARE_AST_NODE(ExportSpecifier) - FunctionSourceElement(FunctionDeclaration *f): - declaration (f) - { kind = K; } + ExportSpecifier(const QStringRef &identifier) + : identifier(identifier), exportedIdentifier(identifier) + { + kind = K; + } + + ExportSpecifier(const QStringRef &identifier, const QStringRef &exportedIdentifier) + : identifier(identifier), exportedIdentifier(exportedIdentifier) + { + kind = K; + } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override - { return declaration->firstSourceLocation(); } + { return identifierToken; } + SourceLocation lastSourceLocation() const override + { return exportedIdentifierToken.isValid() ? exportedIdentifierToken : identifierToken; } + +// attributes + SourceLocation identifierToken; + SourceLocation exportedIdentifierToken; + QStringRef identifier; + QStringRef exportedIdentifier; +}; + +class QML_PARSER_EXPORT ExportsList: public Node +{ +public: + QMLJS_DECLARE_AST_NODE(ExportsList) + + ExportsList(ExportSpecifier *exportSpecifier) + : exportSpecifier(exportSpecifier) + { + kind = K; + next = this; + } + + ExportsList(ExportsList *previous, ExportSpecifier *exportSpecifier) + : exportSpecifier(exportSpecifier) + { + kind = K; + if (previous) { + next = previous->next; + previous->next = this; + } else { + next = this; + } + } + + ExportsList *finish() + { + ExportsList *head = next; + next = nullptr; + return head; + } + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return exportSpecifier->firstSourceLocation(); } SourceLocation lastSourceLocation() const override - { return declaration->lastSourceLocation(); } + { return next ? next->lastSourceLocation() : exportSpecifier->lastSourceLocation(); } // attributes - FunctionDeclaration *declaration; + ExportSpecifier *exportSpecifier; + ExportsList *next; }; -class QML_PARSER_EXPORT StatementSourceElement: public SourceElement +class QML_PARSER_EXPORT ExportClause: public Node { public: - QMLJS_DECLARE_AST_NODE(StatementSourceElement) + QMLJS_DECLARE_AST_NODE(ExportClause) - StatementSourceElement(Statement *stmt): - statement (stmt) - { kind = K; } + ExportClause() + { + kind = K; + } + + ExportClause(ExportsList *exportsList) + : exportsList(exportsList) + { + kind = K; + } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override - { return statement->firstSourceLocation(); } + { return leftBraceToken; } + SourceLocation lastSourceLocation() const override + { return rightBraceToken; } +// attributes + SourceLocation leftBraceToken; + SourceLocation rightBraceToken; + ExportsList *exportsList = nullptr; +}; + +class QML_PARSER_EXPORT ExportDeclaration: public Statement +{ +public: + QMLJS_DECLARE_AST_NODE(ExportDeclaration) + + ExportDeclaration(FromClause *fromClause) + : fromClause(fromClause) + { + exportAll = true; + kind = K; + } + + ExportDeclaration(ExportClause *exportClause, FromClause *fromClause) + : exportClause(exportClause), fromClause(fromClause) + { + kind = K; + } + + ExportDeclaration(ExportClause *exportClause) + : exportClause(exportClause) + { + kind = K; + } + + ExportDeclaration(bool exportDefault, Node *variableStatementOrDeclaration) + : variableStatementOrDeclaration(variableStatementOrDeclaration) + , exportDefault(exportDefault) + { + kind = K; + } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return exportToken; } SourceLocation lastSourceLocation() const override - { return statement->lastSourceLocation(); } + { return fromClause ? fromClause->lastSourceLocation() : (exportClause ? exportClause->lastSourceLocation() : variableStatementOrDeclaration->lastSourceLocation()); } // attributes - Statement *statement; + SourceLocation exportToken; + bool exportAll = false; + ExportClause *exportClause = nullptr; + FromClause *fromClause = nullptr; + Node *variableStatementOrDeclaration = nullptr; + bool exportDefault = false; +}; + +class QML_PARSER_EXPORT ESModule: public Node +{ +public: + QMLJS_DECLARE_AST_NODE(Module) + + ESModule(StatementList *body) + : body(body) + { + kind = K; + } + + void accept0(Visitor *visitor) override; + + SourceLocation firstSourceLocation() const override + { return body ? body->firstSourceLocation() : SourceLocation(); } + + SourceLocation lastSourceLocation() const override + { return body ? body->lastSourceLocation() : SourceLocation(); } + +// attributes + StatementList *body; }; class QML_PARSER_EXPORT DebuggerStatement: public Statement @@ -2224,7 +2771,7 @@ public: UiQualifiedId *finish() { UiQualifiedId *head = next; - next = 0; + next = nullptr; return head; } @@ -2248,7 +2795,7 @@ public: QMLJS_DECLARE_AST_NODE(UiImport) UiImport(const QStringRef &fileName) - : fileName(fileName), importUri(0) + : fileName(fileName), importUri(nullptr) { kind = K; } UiImport(UiQualifiedId *uri) @@ -2312,7 +2859,7 @@ public: UiObjectMemberList *finish() { UiObjectMemberList *head = next; - next = 0; + next = nullptr; return head; } @@ -2321,51 +2868,13 @@ public: UiObjectMember *member; }; -class QML_PARSER_EXPORT UiQualifiedPragmaId: public Node -{ -public: - QMLJS_DECLARE_AST_NODE(UiQualifiedPragmaId) - - UiQualifiedPragmaId(const QStringRef &name) - : next(this), name(name) - { kind = K; } - - UiQualifiedPragmaId(UiQualifiedPragmaId *previous, const QStringRef &name) - : name(name) - { - kind = K; - next = previous->next; - previous->next = this; - } - - UiQualifiedPragmaId *finish() - { - UiQualifiedPragmaId *head = next; - next = 0; - return head; - } - - void accept0(Visitor *visitor) override; - - SourceLocation firstSourceLocation() const override - { return identifierToken; } - - SourceLocation lastSourceLocation() const override - { return next ? next->lastSourceLocation() : identifierToken; } - -// attributes - UiQualifiedPragmaId *next; - QStringRef name; - SourceLocation identifierToken; -}; - class QML_PARSER_EXPORT UiPragma: public Node { public: QMLJS_DECLARE_AST_NODE(UiPragma) - UiPragma(UiQualifiedPragmaId *type) - : pragmaType(type) + UiPragma(QStringRef name) + : name(name) { kind = K; } void accept0(Visitor *visitor) override; @@ -2377,7 +2886,7 @@ public: { return semicolonToken; } // attributes - UiQualifiedPragmaId *pragmaType; + QStringRef name; SourceLocation pragmaToken; SourceLocation semicolonToken; }; @@ -2414,7 +2923,7 @@ public: UiHeaderItemList *finish() { UiHeaderItemList *head = next; - next = 0; + next = nullptr; return head; } @@ -2493,7 +3002,7 @@ public: UiArrayMemberList *finish() { UiArrayMemberList *head = next; - next = 0; + next = nullptr; return head; } @@ -2554,7 +3063,7 @@ public: inline UiParameterList *finish () { UiParameterList *front = next; - next = 0; + next = nullptr; return front; } @@ -2574,13 +3083,13 @@ public: UiPublicMember(UiQualifiedId *memberType, const QStringRef &name) - : type(Property), memberType(memberType), name(name), statement(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) + : type(Property), memberType(memberType), name(name), statement(nullptr), binding(nullptr), isDefaultMember(false), isReadonlyMember(false), parameters(nullptr) { kind = K; } UiPublicMember(UiQualifiedId *memberType, const QStringRef &name, Statement *statement) - : type(Property), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) + : type(Property), memberType(memberType), name(name), statement(statement), binding(nullptr), isDefaultMember(false), isReadonlyMember(false), parameters(nullptr) { kind = K; } void accept0(Visitor *visitor) override; @@ -2605,16 +3114,6 @@ public: return semicolonToken; } - QStringRef memberTypeName() const - { - return memberType ? memberType->name : QStringRef(); - } - - bool isValid() const - { - return memberType && !memberType->name.isNull() && !memberType->name.isEmpty(); - } - // attributes enum { Signal, Property } type; QStringRef typeModifier; @@ -2819,7 +3318,7 @@ public: UiEnumMemberList *finish() { UiEnumMemberList *head = next; - next = 0; + next = nullptr; return head; } diff --git a/src/libs/qmljs/parser/qmljsastfwd_p.h b/src/libs/qmljs/parser/qmljsastfwd_p.h index c27b6162ff..cfe97485c3 100644 --- a/src/libs/qmljs/parser/qmljsastfwd_p.h +++ b/src/libs/qmljs/parser/qmljsastfwd_p.h @@ -74,22 +74,27 @@ class IdentifierExpression; class NullExpression; class TrueLiteral; class FalseLiteral; +class SuperLiteral; class NumericLiteral; class StringLiteral; +class TemplateLiteral; class RegExpLiteral; -class ArrayLiteral; -class ObjectLiteral; -class ElementList; +class Pattern; +class ArrayPattern; +class ObjectPattern; +class PatternElement; +class PatternElementList; +class PatternProperty; +class PatternPropertyList; class Elision; -class PropertyAssignmentList; -class PropertyGetterSetter; -class PropertyNameAndValue; class PropertyName; class IdentifierPropertyName; class StringLiteralPropertyName; class NumericLiteralPropertyName; +class ComputedPropertyName; class ArrayMemberExpression; class FieldMemberExpression; +class TaggedTemplate; class NewMemberExpression; class NewExpression; class CallExpression; @@ -108,20 +113,19 @@ class NotExpression; class BinaryExpression; class ConditionalExpression; class Expression; // ### rename +class YieldExpression; class Block; +class LeftHandSideExpression; class StatementList; class VariableStatement; class VariableDeclarationList; -class VariableDeclaration; class EmptyStatement; class ExpressionStatement; class IfStatement; class DoWhileStatement; class WhileStatement; class ForStatement; -class LocalForStatement; class ForEachStatement; -class LocalForEachStatement; class ContinueStatement; class BreakStatement; class ReturnStatement; @@ -139,14 +143,26 @@ class Finally; class FunctionDeclaration; class FunctionExpression; class FormalParameterList; -class FunctionBody; +class ExportSpecifier; +class ExportsList; +class ExportClause; +class ExportDeclaration; class Program; -class SourceElements; -class SourceElement; -class FunctionSourceElement; -class StatementSourceElement; +class ImportSpecifier; +class ImportsList; +class NamedImports; +class NameSpaceImport; +class NamedImport; +class ImportClause; +class FromClause; +class ImportDeclaration; +class ModuleItem; +class ESModule; class DebuggerStatement; class NestedExpression; +class ClassExpression; +class ClassDeclaration; +class ClassElementList; // ui elements class UiProgram; @@ -164,7 +180,6 @@ class UiObjectMember; class UiObjectMemberList; class UiArrayMemberList; class UiQualifiedId; -class UiQualifiedPragmaId; class UiHeaderItemList; class UiEnumDeclaration; class UiEnumMemberList; diff --git a/src/libs/qmljs/parser/qmljsastvisitor_p.h b/src/libs/qmljs/parser/qmljsastvisitor_p.h index 5fd19b876a..940e2e7751 100644 --- a/src/libs/qmljs/parser/qmljsastvisitor_p.h +++ b/src/libs/qmljs/parser/qmljsastvisitor_p.h @@ -68,7 +68,6 @@ public: virtual bool visit(UiObjectMemberList *) { return true; } virtual bool visit(UiArrayMemberList *) { return true; } virtual bool visit(UiQualifiedId *) { return true; } - virtual bool visit(UiQualifiedPragmaId *) { return true; } virtual bool visit(UiEnumDeclaration *) { return true; } virtual bool visit(UiEnumMemberList *) { return true; } @@ -87,7 +86,6 @@ public: virtual void endVisit(UiObjectMemberList *) {} virtual void endVisit(UiArrayMemberList *) {} virtual void endVisit(UiQualifiedId *) {} - virtual void endVisit(UiQualifiedPragmaId *) {} virtual void endVisit(UiEnumDeclaration *) {} virtual void endVisit(UiEnumMemberList *) { } @@ -107,35 +105,41 @@ public: virtual bool visit(FalseLiteral *) { return true; } virtual void endVisit(FalseLiteral *) {} + virtual bool visit(SuperLiteral *) { return true; } + virtual void endVisit(SuperLiteral *) {} + virtual bool visit(StringLiteral *) { return true; } virtual void endVisit(StringLiteral *) {} + virtual bool visit(TemplateLiteral *) { return true; } + virtual void endVisit(TemplateLiteral *) {} + virtual bool visit(NumericLiteral *) { return true; } virtual void endVisit(NumericLiteral *) {} virtual bool visit(RegExpLiteral *) { return true; } virtual void endVisit(RegExpLiteral *) {} - virtual bool visit(ArrayLiteral *) { return true; } - virtual void endVisit(ArrayLiteral *) {} + virtual bool visit(ArrayPattern *) { return true; } + virtual void endVisit(ArrayPattern *) {} - virtual bool visit(ObjectLiteral *) { return true; } - virtual void endVisit(ObjectLiteral *) {} + virtual bool visit(ObjectPattern *) { return true; } + virtual void endVisit(ObjectPattern *) {} - virtual bool visit(ElementList *) { return true; } - virtual void endVisit(ElementList *) {} + virtual bool visit(PatternElementList *) { return true; } + virtual void endVisit(PatternElementList *) {} - virtual bool visit(Elision *) { return true; } - virtual void endVisit(Elision *) {} + virtual bool visit(PatternPropertyList *) { return true; } + virtual void endVisit(PatternPropertyList *) {} - virtual bool visit(PropertyAssignmentList *) { return true; } - virtual void endVisit(PropertyAssignmentList *) {} + virtual bool visit(PatternElement *) { return true; } + virtual void endVisit(PatternElement *) {} - virtual bool visit(PropertyNameAndValue *) { return true; } - virtual void endVisit(PropertyNameAndValue *) {} + virtual bool visit(PatternProperty *) { return true; } + virtual void endVisit(PatternProperty *) {} - virtual bool visit(PropertyGetterSetter *) { return true; } - virtual void endVisit(PropertyGetterSetter *) {} + virtual bool visit(Elision *) { return true; } + virtual void endVisit(Elision *) {} virtual bool visit(NestedExpression *) { return true; } virtual void endVisit(NestedExpression *) {} @@ -149,12 +153,18 @@ public: virtual bool visit(NumericLiteralPropertyName *) { return true; } virtual void endVisit(NumericLiteralPropertyName *) {} + virtual bool visit(ComputedPropertyName *) { return true; } + virtual void endVisit(ComputedPropertyName *) {} + virtual bool visit(ArrayMemberExpression *) { return true; } virtual void endVisit(ArrayMemberExpression *) {} virtual bool visit(FieldMemberExpression *) { return true; } virtual void endVisit(FieldMemberExpression *) {} + virtual bool visit(TaggedTemplate *) { return true; } + virtual void endVisit(TaggedTemplate *) {} + virtual bool visit(NewMemberExpression *) { return true; } virtual void endVisit(NewMemberExpression *) {} @@ -221,9 +231,6 @@ public: virtual bool visit(VariableDeclarationList *) { return true; } virtual void endVisit(VariableDeclarationList *) {} - virtual bool visit(VariableDeclaration *) { return true; } - virtual void endVisit(VariableDeclaration *) {} - virtual bool visit(EmptyStatement *) { return true; } virtual void endVisit(EmptyStatement *) {} @@ -242,15 +249,9 @@ public: virtual bool visit(ForStatement *) { return true; } virtual void endVisit(ForStatement *) {} - virtual bool visit(LocalForStatement *) { return true; } - virtual void endVisit(LocalForStatement *) {} - virtual bool visit(ForEachStatement *) { return true; } virtual void endVisit(ForEachStatement *) {} - virtual bool visit(LocalForEachStatement *) { return true; } - virtual void endVisit(LocalForEachStatement *) {} - virtual bool visit(ContinueStatement *) { return true; } virtual void endVisit(ContinueStatement *) {} @@ -260,6 +261,9 @@ public: virtual bool visit(ReturnStatement *) { return true; } virtual void endVisit(ReturnStatement *) {} + virtual bool visit(YieldExpression *) { return true; } + virtual void endVisit(YieldExpression *) {} + virtual bool visit(WithStatement *) { return true; } virtual void endVisit(WithStatement *) {} @@ -302,20 +306,56 @@ public: virtual bool visit(FormalParameterList *) { return true; } virtual void endVisit(FormalParameterList *) {} - virtual bool visit(FunctionBody *) { return true; } - virtual void endVisit(FunctionBody *) {} + virtual bool visit(ClassExpression *) { return true; } + virtual void endVisit(ClassExpression *) {} + + virtual bool visit(ClassDeclaration *) { return true; } + virtual void endVisit(ClassDeclaration *) {} + + virtual bool visit(ClassElementList *) { return true; } + virtual void endVisit(ClassElementList *) {} virtual bool visit(Program *) { return true; } virtual void endVisit(Program *) {} - virtual bool visit(SourceElements *) { return true; } - virtual void endVisit(SourceElements *) {} + virtual bool visit(NameSpaceImport *) { return true; } + virtual void endVisit(NameSpaceImport *) {} + + virtual bool visit(ImportSpecifier *) { return true; } + virtual void endVisit(ImportSpecifier *) {} + + virtual bool visit(ImportsList *) { return true; } + virtual void endVisit(ImportsList *) {} + + virtual bool visit(NamedImports *) { return true; } + virtual void endVisit(NamedImports *) {} + + virtual bool visit(FromClause *) { return true; } + virtual void endVisit(FromClause *) {} + + virtual bool visit(ImportClause *) { return true; } + virtual void endVisit(ImportClause *) {} + + virtual bool visit(ImportDeclaration *) { return true; } + virtual void endVisit(ImportDeclaration *) {} + + virtual bool visit(ExportSpecifier *) { return true; } + virtual void endVisit(ExportSpecifier *) {} + + virtual bool visit(ExportsList *) { return true; } + virtual void endVisit(ExportsList *) {} + + virtual bool visit(ExportClause *) { return true; } + virtual void endVisit(ExportClause *) {} + + virtual bool visit(ExportDeclaration *) { return true; } + virtual void endVisit(ExportDeclaration *) {} - virtual bool visit(FunctionSourceElement *) { return true; } - virtual void endVisit(FunctionSourceElement *) {} + virtual bool visit(ModuleItem *) { return true; } + virtual void endVisit(ModuleItem *) {} - virtual bool visit(StatementSourceElement *) { return true; } - virtual void endVisit(StatementSourceElement *) {} + virtual bool visit(ESModule *) { return true; } + virtual void endVisit(ESModule *) {} virtual bool visit(DebuggerStatement *) { return true; } virtual void endVisit(DebuggerStatement *) {} diff --git a/src/libs/qmljs/parser/qmljsengine_p.cpp b/src/libs/qmljs/parser/qmljsengine_p.cpp index fbcc1b1771..f38d801a02 100644 --- a/src/libs/qmljs/parser/qmljsengine_p.cpp +++ b/src/libs/qmljs/parser/qmljsengine_p.cpp @@ -98,15 +98,8 @@ double integerFromString(const char *buf, int size, int radix) return result; } -double integerFromString(const QString &str, int radix) -{ - QByteArray ba = QStringRef(&str).trimmed().toLatin1(); - return integerFromString(ba.constData(), ba.size(), radix); -} - - Engine::Engine() - : _lexer(0), _directives(0) + : _lexer(nullptr), _directives(nullptr) { } Engine::~Engine() diff --git a/src/libs/qmljs/parser/qmljsengine_p.h b/src/libs/qmljs/parser/qmljsengine_p.h index 8e20d3567b..093f68bac5 100644 --- a/src/libs/qmljs/parser/qmljsengine_p.h +++ b/src/libs/qmljs/parser/qmljsengine_p.h @@ -49,14 +49,40 @@ QT_QML_BEGIN_NAMESPACE namespace QmlJS { class Lexer; -class Directives; class MemoryPool; +class QML_PARSER_EXPORT Directives { +public: + virtual ~Directives() {} + + virtual void pragmaLibrary() + { + } + + virtual void importFile(const QString &jsfile, const QString &module, int line, int column) + { + Q_UNUSED(jsfile); + Q_UNUSED(module); + Q_UNUSED(line); + Q_UNUSED(column); + } + + virtual void importModule(const QString &uri, const QString &version, const QString &module, int line, int column) + { + Q_UNUSED(uri); + Q_UNUSED(version); + Q_UNUSED(module); + Q_UNUSED(line); + Q_UNUSED(column); + } +}; + + class QML_PARSER_EXPORT DiagnosticMessage { public: - DiagnosticMessage() - : kind(Severity::Error) {} + + DiagnosticMessage() {} DiagnosticMessage(Severity::Enum kind, const AST::SourceLocation &loc, const QString &message) : kind(kind), loc(loc), message(message) {} @@ -67,7 +93,7 @@ public: bool isError() const { return kind == Severity::Error; } - Severity::Enum kind; + Severity::Enum kind = Severity::Error; AST::SourceLocation loc; QString message; }; diff --git a/src/libs/qmljs/parser/qmljsgrammar.cpp b/src/libs/qmljs/parser/qmljsgrammar.cpp index a13e98069d..3c5387f6b7 100644 --- a/src/libs/qmljs/parser/qmljsgrammar.cpp +++ b/src/libs/qmljs/parser/qmljsgrammar.cpp @@ -3,8 +3,9 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of Qt Creator. +** This file is part of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -21,6 +22,8 @@ ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** +** $QT_END_LICENSE$ +** ****************************************************************************/ // This file was generated by qlalr - DO NOT EDIT! @@ -35,713 +38,1315 @@ const char *const QmlJSGrammar::spell [] = { "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=", "-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=", "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return", - ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch", - "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", - "^=", "null", "true", "false", "const", "let", "debugger", "reserved word", "multiline string literal", "comment", - 0, "enum", "public", "import", "pragma", "as", "on", "get", "set", 0, - 0, 0, 0, 0, 0, 0, 0, 0 + ")", ";", 0, "*", "**", "**=", "*=", "string literal", "property", "signal", + "readonly", "switch", "this", "throw", "~", "try", "typeof", "var", "void", "while", + "with", "^", "^=", "null", "true", "false", "const", "let", "debugger", "reserved word", + "multiline string literal", "comment", 0, "=>", "enum", "...", "yield", "super", "class", "extends", + "static", "export", "from", "(no subst template)", "(template head)", "(template middle)", "(template tail)", "public", "import", "pragma", + "as", "of", "get", "set", 0, 0, 0, 0, 0, 0, + 0, "(force decl)", "(force block)", "(for lookahead ok)", 0, 0, +#ifndef QLALR_NO_QMLJSGRAMMAR_DEBUG_INFO +"TopLevel", "UiProgram", "Statement", "Expression", + "UiObjectMember", "Script", "Module", "UiHeaderItemListOpt", "UiRootMember", "Empty", "UiHeaderItemList", "UiPragma", "UiImport", "PragmaId", + "JsIdentifier", "ImportId", "MemberExpression", "UiImportHead", "QmlIdentifier", "UiObjectDefinition", "UiObjectMemberList", "UiArrayMemberList", "UiObjectInitializer", "UiQualifiedId", + "ExpressionStatementLookahead", "UiObjectLiteral", "UiPropertyDefinitionList", "UiScriptStatement", "ExpressionStatement", "Block", "EmptyStatement", "IfStatement", "WithStatement", "SwitchStatement", + "TryStatement", "UiPropertyType", "UiParameterListOpt", "UiParameterList", "FunctionDeclaration", "VariableStatement", "EnumMemberList", "IdentifierReference", "BindingIdentifier", "PrimaryExpression", + "Literal", "ArrayLiteral", "ObjectLiteral", "FunctionExpression", "ClassExpression", "GeneratorExpression", "RegularExpressionLiteral", "TemplateLiteral", "CoverParenthesizedExpressionAndArrowParameterList", "Expression_In", + "BindingRestElement", "BindingRestElementOpt", "ElisionOpt", "ElementList", "AssignmentExpression_In", "Elision", "SpreadElement", "AssignmentExpression", "PropertyDefinitionList", "UiPropertyDefinition", + "PropertyDefinition", "CoverInitializedName", "Initializer_In", "UiPropertyName", "PropertyName", "MethodDefinition", "LiteralPropertyName", "ComputedPropertyName", "IdentifierName", "ReservedIdentifier", + "Initializer", "InitializerOpt", "InitializerOpt_In", "TemplateSpans", "Super", "NewTarget", "MetaProperty", "Arguments", "NewExpression", "CallExpression", + "ArgumentList", "LeftHandSideExpression", "UpdateExpression", "UnaryExpression", "ExponentiationExpression", "MultiplicativeExpression", "MultiplicativeOperator", "AdditiveExpression", "ShiftExpression", "RelationalExpression_In", + "RelationalExpression", "RelationalOperator", "EqualityExpression_In", "EqualityExpression", "EqualityOperator", "BitwiseANDExpression", "BitwiseANDExpression_In", "BitwiseXORExpression", "BitwiseXORExpression_In", "BitwiseORExpression", + "BitwiseORExpression_In", "LogicalANDExpression", "LogicalANDExpression_In", "LogicalORExpression", "LogicalORExpression_In", "ConditionalExpression", "ConditionalExpression_In", "YieldExpression", "YieldExpression_In", "ArrowFunction", + "ArrowFunction_In", "AssignmentOperator", "ExpressionOpt", "ExpressionOpt_In", "BlockStatement", "BreakableStatement", "ContinueStatement", "BreakStatement", "ReturnStatement", "LabelledStatement", + "ThrowStatement", "DebuggerStatement", "Declaration", "HoistableDeclaration", "ClassDeclaration", "LexicalDeclaration_In", "GeneratorDeclaration", "HoistableDeclaration_Default", "FunctionDeclaration_Default", "GeneratorDeclaration_Default", + "IterationStatement", "StatementListOpt", "StatementList", "StatementListItem", "LetOrConst", "Var", "LexicalDeclaration", "BindingList", "BindingList_In", "VarDeclaration", + "VariableDeclarationList", "VarDeclaration_In", "VariableDeclarationList_In", "LexicalBinding_In", "VariableDeclaration", "VariableDeclaration_In", "LexicalBinding", "BindingPattern", "ObjectBindingPattern", "ArrayBindingPattern", + "BindingPropertyList", "BindingElementList", "BindingProperty", "BindingElisionElement", "BindingElement", "InOrOf", "ForDeclaration", "CaseBlock", "CaseClausesOpt", "DefaultClause", + "CaseClauses", "CaseClause", "LabelledItem", "Catch", "Finally", "CatchParameter", "Function", "FormalParameters", "FunctionLBrace", "FunctionBody", + "FunctionRBrace", "StrictFormalParameters", "FormalParameterList", "FormalParameter", "ArrowParameters", "ConciseBodyLookahead", "GeneratorLParen", "GeneratorBody", "GeneratorRBrace", "PropertySetParameterList", + "ClassHeritageOpt", "ClassLBrace", "ClassBodyOpt", "ClassRBrace", "ClassDeclaration_Default", "ClassStaticQualifier", "ClassElementList", "ClassElement", "ScriptBody", "ModuleBodyOpt", + "ModuleBody", "ModuleItemList", "ModuleItem", "ImportDeclaration", "ExportDeclaration", "ImportClause", "FromClause", "ModuleSpecifier", "ImportedDefaultBinding", "NameSpaceImport", + "NamedImports", "ImportedBinding", "ImportsList", "ImportSpecifier", "ExportDeclarationLookahead", "ExportClause", "ExportsList", "ExportSpecifier", "$accept" +#endif // QLALR_NO_QMLJSGRAMMAR_DEBUG_INFO + }; const short QmlJSGrammar::lhs [] = { - 108, 108, 108, 108, 108, 108, 109, 115, 115, 118, - 118, 118, 118, 121, 123, 119, 119, 120, 120, 120, - 120, 120, 120, 120, 120, 124, 125, 117, 116, 128, - 128, 129, 129, 130, 130, 127, 113, 113, 113, 113, - 132, 132, 132, 132, 132, 132, 132, 113, 140, 140, - 140, 140, 141, 141, 142, 142, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 145, 145, 145, - 145, 126, 126, 126, 126, 126, 126, 126, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 131, 148, 148, 148, - 148, 147, 147, 152, 152, 152, 150, 150, 153, 153, - 153, 153, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 156, 156, 156, 157, 157, 122, 122, 122, - 122, 122, 160, 160, 161, 161, 161, 161, 159, 159, - 162, 162, 163, 163, 164, 164, 164, 165, 165, 165, - 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, - 166, 167, 167, 167, 168, 168, 168, 168, 169, 169, - 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, - 170, 171, 171, 171, 171, 171, 172, 172, 172, 172, - 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, - 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, - 182, 183, 183, 184, 184, 151, 151, 185, 185, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 111, 111, 187, 187, 188, 188, 189, 189, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 133, 198, 198, 197, 197, 144, - 144, 199, 199, 199, 200, 200, 202, 202, 201, 203, - 206, 204, 204, 207, 205, 205, 134, 135, 135, 136, - 136, 190, 190, 190, 190, 190, 190, 190, 190, 191, - 191, 191, 191, 192, 192, 192, 192, 193, 193, 137, - 138, 208, 208, 211, 211, 209, 209, 212, 210, 194, - 195, 195, 139, 139, 139, 213, 214, 196, 196, 215, - 143, 158, 158, 216, 216, 155, 155, 154, 154, 217, - 114, 114, 218, 218, 112, 112, 149, 149, 219 + 126, 126, 126, 126, 126, 126, 127, 133, 133, 136, + 136, 136, 136, 139, 137, 137, 141, 138, 138, 138, + 138, 138, 138, 138, 138, 143, 135, 134, 146, 146, + 147, 147, 148, 148, 145, 130, 130, 130, 130, 151, + 151, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 130, 161, 161, 161, 161, 162, 162, 163, 163, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 149, + 130, 166, 166, 166, 166, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 167, 168, 169, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 178, 178, + 178, 178, 170, 170, 170, 170, 170, 170, 176, 176, + 171, 171, 171, 183, 183, 183, 183, 183, 185, 185, + 182, 182, 186, 172, 172, 172, 152, 188, 152, 188, + 190, 190, 191, 189, 190, 190, 194, 194, 196, 193, + 196, 193, 196, 198, 198, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 197, 200, 192, 201, 202, 201, 202, + 177, 203, 203, 177, 142, 204, 142, 142, 205, 142, + 142, 142, 142, 206, 208, 208, 209, 142, 209, 209, + 209, 209, 209, 207, 207, 207, 210, 210, 210, 210, + 211, 211, 212, 212, 212, 212, 212, 213, 213, 213, + 213, 213, 213, 213, 213, 214, 214, 215, 215, 216, + 216, 216, 217, 217, 217, 218, 218, 218, 218, 219, + 220, 219, 220, 221, 221, 221, 221, 221, 219, 222, + 223, 222, 223, 224, 224, 224, 224, 225, 226, 225, + 226, 227, 228, 227, 228, 229, 230, 229, 230, 231, + 232, 231, 232, 233, 234, 233, 234, 235, 236, 235, + 236, 187, 184, 187, 184, 187, 184, 187, 184, 187, + 184, 241, 241, 241, 241, 241, 241, 241, 241, 241, + 241, 241, 241, 129, 179, 129, 179, 242, 243, 242, + 243, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 252, 252, 252, 253, 253, + 257, 257, 245, 245, 244, 155, 262, 262, 263, 263, + 263, 261, 261, 264, 264, 265, 266, 255, 269, 271, + 165, 165, 267, 268, 270, 272, 267, 268, 270, 272, + 276, 273, 274, 275, 276, 273, 274, 275, 277, 277, + 278, 278, 278, 279, 279, 279, 280, 280, 281, 281, + 283, 282, 282, 282, 284, 284, 180, 180, 181, 181, + 156, 150, 154, 154, 157, 157, 260, 260, 260, 260, + 260, 260, 260, 285, 285, 260, 260, 286, 286, 286, + 286, 246, 246, 246, 246, 247, 247, 247, 247, 248, + 248, 158, 159, 287, 287, 290, 290, 288, 288, 291, + 289, 249, 292, 292, 250, 250, 160, 160, 160, 293, + 294, 295, 295, 251, 251, 296, 164, 258, 258, 173, + 173, 301, 297, 297, 297, 297, 297, 302, 302, 303, + 298, 300, 299, 239, 240, 239, 240, 304, 304, 305, + 195, 195, 195, 195, 309, 306, 308, 256, 259, 259, + 175, 175, 307, 237, 238, 237, 238, 237, 238, 254, + 174, 314, 174, 314, 311, 313, 315, 310, 310, 312, + 312, 316, 316, 317, 317, 317, 131, 131, 318, 132, + 320, 319, 319, 321, 321, 322, 322, 322, 322, 322, + 323, 323, 325, 325, 325, 325, 325, 328, 329, 330, + 330, 330, 326, 332, 332, 333, 333, 327, 331, 334, + 324, 324, 324, 324, 324, 324, 324, 324, 335, 335, + 335, 336, 336, 337, 337, 338 }; const short QmlJSGrammar::rhs [] = { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, - 1, 2, 2, 1, 1, 2, 2, 2, 2, 3, - 3, 5, 5, 4, 4, 2, 2, 0, 1, 1, - 2, 1, 3, 2, 3, 2, 1, 5, 4, 4, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, - 1, 3, 0, 1, 2, 4, 6, 6, 3, 3, - 7, 7, 4, 4, 5, 5, 8, 8, 5, 6, - 6, 10, 6, 7, 1, 1, 5, 1, 3, 3, - 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 3, 4, 5, 3, 4, 3, 1, 1, 2, 3, - 4, 1, 2, 3, 7, 8, 1, 3, 1, 1, + 1, 2, 2, 1, 3, 3, 1, 2, 2, 3, + 3, 5, 5, 4, 4, 2, 0, 1, 1, 2, + 1, 3, 2, 3, 2, 1, 6, 5, 4, 4, + 5, 3, 3, 3, 2, 2, 2, 2, 2, 2, + 3, 1, 1, 1, 3, 0, 1, 2, 4, 6, + 6, 3, 3, 7, 7, 4, 4, 5, 5, 8, + 8, 5, 6, 6, 10, 7, 8, 1, 1, 1, + 5, 1, 3, 3, 5, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, + 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 3, 5, 1, 2, 2, 4, 4, 1, 2, + 0, 1, 2, 2, 3, 4, 1, 1, 3, 3, + 1, 1, 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, - 3, 5, 1, 2, 4, 4, 4, 3, 0, 1, - 1, 3, 1, 1, 1, 2, 2, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, - 3, 1, 3, 3, 1, 3, 3, 3, 1, 3, - 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, - 3, 1, 3, 3, 3, 3, 1, 3, 3, 3, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 5, 1, 5, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 2, 0, 1, 3, - 3, 1, 1, 1, 1, 3, 1, 3, 2, 2, - 2, 0, 1, 2, 0, 1, 1, 2, 2, 7, - 5, 7, 7, 7, 5, 9, 10, 7, 8, 2, - 2, 3, 3, 2, 2, 3, 3, 3, 3, 5, - 5, 3, 5, 1, 2, 0, 1, 4, 3, 3, - 3, 3, 3, 3, 4, 5, 2, 2, 2, 1, - 8, 8, 7, 1, 3, 0, 1, 0, 1, 1, - 1, 1, 1, 2, 1, 1, 0, 1, 2 + 1, 1, 1, 3, 2, 2, 0, 0, 1, 1, + 1, 1, 3, 3, 1, 1, 4, 4, 3, 3, + 3, 1, 5, 1, 1, 2, 2, 2, 4, 4, + 4, 4, 3, 0, 1, 2, 1, 2, 3, 4, + 1, 1, 1, 2, 2, 2, 2, 1, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 1, 3, 1, + 1, 1, 1, 3, 3, 1, 3, 3, 3, 1, + 1, 3, 3, 1, 1, 1, 1, 1, 3, 1, + 1, 3, 3, 1, 1, 1, 1, 1, 1, 3, + 3, 1, 1, 3, 3, 1, 1, 3, 3, 1, + 1, 3, 3, 1, 1, 3, 3, 1, 1, 5, + 5, 1, 1, 1, 1, 1, 1, 3, 3, 3, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 3, 0, 0, 1, + 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 2, 1, 4, + 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 2, 1, 1, 1, 1, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, + 0, 1, 2, 2, 1, 4, 1, 3, 1, 3, + 2, 2, 4, 4, 2, 2, 2, 2, 0, 1, + 1, 0, 2, 2, 7, 5, 7, 7, 7, 5, + 9, 9, 9, 1, 1, 7, 7, 2, 2, 2, + 2, 2, 2, 3, 3, 2, 2, 3, 3, 3, + 3, 5, 5, 3, 5, 1, 2, 0, 1, 4, + 3, 3, 1, 3, 3, 3, 3, 3, 4, 5, + 2, 1, 1, 2, 2, 1, 8, 1, 7, 8, + 7, 1, 0, 1, 1, 2, 3, 1, 3, 1, + 1, 1, 1, 4, 4, 7, 7, 1, 1, 0, + 7, 8, 7, 8, 1, 1, 1, 9, 1, 8, + 9, 8, 1, 1, 1, 3, 3, 2, 2, 6, + 6, 5, 5, 1, 1, 1, 1, 0, 2, 0, + 1, 1, 2, 1, 2, 1, 0, 1, 1, 1, + 1, 0, 1, 1, 2, 2, 2, 2, 2, 1, + 3, 2, 1, 1, 1, 3, 3, 1, 3, 2, + 3, 4, 2, 1, 3, 1, 3, 1, 1, 0, + 3, 3, 2, 2, 2, 5, 5, 4, 2, 3, + 4, 1, 3, 1, 3, 2 +}; + + +#ifndef QLALR_NO_QMLJSGRAMMAR_DEBUG_INFO +const int QmlJSGrammar::rule_info [] = { + 126, 115, 127, 126, 117, 128, 126, 118, 129, 126, 116, 130, 126, 119, 131, 126, 120, 132, 127, 133, 134, 133, 135, 133, 136, 136, 137, + 136, 138, 136, 136, 137, 136, 136, 138, 139, 140, 137, 109, 139, 62, 137, 109, 139, 61, 141, 142, 138, 143, 62, 138, 143, 61, 138, 143, 47, 62, + 138, 143, 47, 61, 138, 143, 47, 110, 144, 62, 138, 143, 47, 110, 144, 61, 138, 143, 110, 144, 62, 138, 143, 110, 144, 61, 143, 108, 141, 135, 134, 145, 146, 130, 146, 146, 130, + 147, 145, 147, 147, 8, 145, 148, 33, 55, 148, 33, 146, 55, 145, 149, 148, 130, 145, 130, 149, 7, 150, 34, 147, 56, 130, 149, 7, 150, 149, 148, 130, 149, 124, 149, 148, 151, 33, 150, 152, 55, + 151, 33, 150, 152, 8, 55, 153, 150, 121, 154, 153, 150, 122, 155, 153, 150, 122, 151, 153, 150, 156, 153, 150, 154, 153, 150, 157, 153, 150, 158, 153, 150, 159, 153, 150, 160, + 130, 149, 7, 153, 161, 77, 161, 89, 161, 29, 161, 161, 15, 29, 162, 162, 163, 163, 161, 144, 163, 163, 8, 161, 144, 130, 69, 29, 36, 162, 60, 62, + 130, 69, 29, 36, 162, 60, 61, 130, 69, 29, 62, 130, 69, 29, 61, 130, 68, 29, 37, 161, 24, 144, 62, 130, 68, 29, 37, 161, 24, 144, 61, 130, 68, 161, 144, 62, 130, 68, 161, 144, 61, 130, 10, 68, 161, 144, 62, 130, 10, 68, 161, 144, 61, 130, 10, 68, 29, 37, 161, 24, 144, 62, + 130, 10, 68, 29, 37, 161, 24, 144, 61, 130, 68, 161, 144, 7, 153, 130, 70, 68, 161, 144, 7, 153, 130, 10, 68, 161, 144, 7, 153, 130, 68, 29, 37, 161, 24, 144, 7, 34, 147, 56, 130, 68, 161, 144, 7, 150, 149, 148, 130, 70, 68, 161, 144, 7, 150, 149, 148, 130, 164, 130, 165, 149, 142, + 130, 94, 29, 33, 166, 55, 166, 29, 166, 29, 17, 47, 166, 166, 8, 29, 166, 166, 8, 29, 17, 47, 144, 29, 144, 68, 144, 69, 144, 70, 144, 124, + 144, 112, 144, 113, 144, 102, 144, 111, 140, 29, 140, 68, 140, 69, 140, 70, 140, 124, 140, 112, + 140, 113, 140, 102, 140, 100, 140, 111, 140, 110, 167, 140, 168, 167, 169, 72, 169, 167, 169, 170, + 169, 171, 169, 172, 169, 173, 169, 174, 169, 175, 169, 176, 169, 177, 169, 178, 178, 36, 179, 60, 178, 36, 60, + 178, 36, 180, 60, 178, 36, 179, 8, 181, 60, 170, 83, 170, 84, 170, 85, 170, 47, 170, 90, 170, 67, 176, 12, 176, 13, + 171, 34, 182, 56, 171, 34, 183, 56, 171, 34, 183, 8, 182, 56, 183, 184, 183, 185, 184, 183, 182, 186, 183, 183, 8, 182, 184, 183, 183, 8, 182, 186, 185, 8, 185, 185, 8, + 182, 182, 185, 186, 95, 187, 172, 33, 55, 172, 33, 188, 55, 172, 33, 188, 8, 55, 152, 189, 188, 190, 152, 152, 8, 189, 188, 188, 8, 190, + 190, 167, 190, 191, 191, 167, 192, 189, 193, 7, 184, 190, 194, 7, 184, 190, 195, 194, 196, 194, 197, 196, 198, 193, 67, + 196, 67, 193, 47, 196, 47, 198, 167, 198, 199, 199, 4, 199, 5, 199, 6, 199, 9, 199, 10, + 199, 11, 199, 14, 199, 16, 199, 94, 199, 85, 199, 20, 199, 21, 199, 22, 199, 30, 199, 31, + 199, 32, 199, 43, 199, 83, 199, 59, 199, 71, 199, 72, 199, 73, 199, 84, 199, 75, 199, 76, + 199, 77, 199, 78, 199, 79, 199, 86, 199, 87, 199, 88, 199, 89, 199, 97, 199, 80, 199, 98, + 199, 99, 199, 101, 199, 108, 197, 34, 184, 56, 200, 17, 187, 192, 17, 184, 201, 202, 201, 200, 202, 192, + 177, 103, 203, 106, 203, 105, 129, 203, 177, 104, 129, 203, 142, 169, 204, 97, 142, 204, 34, 179, 56, 142, 142, 34, 179, 56, 205, 43, 15, 29, 142, 204, 15, 198, + 142, 142, 15, 198, 142, 206, 142, 43, 142, 36, 207, 60, 206, 205, 208, 142, 208, 43, 208, 209, 209, 177, 142, 142, 177, 209, 142, 36, 207, 60, 209, 204, 36, 207, 60, + 209, 209, 36, 207, 60, 209, 209, 34, 179, 56, 209, 209, 15, 198, 207, 207, 210, 207, 210, 8, 210, 184, 210, 95, 184, 210, 210, 8, 184, 210, 210, 8, 95, 184, + 211, 208, 211, 209, 212, 211, 212, 211, 53, 212, 211, 42, 212, 53, 213, 212, 42, 213, 213, 212, 213, 11, 213, 213, 78, 213, + 213, 76, 213, 213, 51, 213, 213, 40, 213, 213, 74, 213, 213, 44, 213, 214, 213, 214, 212, 64, 214, 215, 214, 215, 215, 216, 214, 216, 63, + 216, 12, 216, 57, 217, 215, 217, 217, 51, 215, 217, 217, 40, 215, 218, 217, 218, 218, 38, 217, 218, 218, 25, 217, 218, 218, 27, 217, 219, 218, + 220, 218, 219, 219, 221, 218, 220, 220, 221, 218, 221, 37, 221, 24, 221, 35, 221, 23, 221, 32, 219, 219, 31, 218, 222, 219, + 223, 220, 222, 222, 224, 219, 223, 223, 224, 220, 224, 18, 224, 45, 224, 19, 224, 46, 225, 223, 226, 222, 225, 225, 1, 223, + 226, 226, 1, 222, 227, 225, 228, 226, 227, 227, 81, 225, 228, 228, 81, 226, 229, 227, 230, 228, 229, 229, 48, 227, 230, 230, 48, 228, 231, 229, + 232, 230, 231, 231, 2, 229, 232, 232, 2, 230, 233, 231, 234, 232, 233, 233, 50, 231, 234, 234, 50, 232, 235, 233, 236, 234, 235, 233, 54, 184, 7, 187, + 236, 234, 54, 184, 7, 184, 187, 235, 184, 236, 187, 237, 184, 238, 187, 239, 184, 240, 187, 211, 17, 187, 184, 211, 17, 184, 187, 211, 241, 187, + 184, 211, 241, 184, 241, 66, 241, 65, 241, 13, 241, 58, 241, 52, 241, 41, 241, 39, 241, 26, 241, 28, + 241, 3, 241, 82, 241, 49, 129, 187, 179, 184, 129, 129, 8, 187, 179, 179, 8, 184, 242, 243, 242, 129, + 243, 179, 128, 150, 122, 244, 128, 150, 165, 128, 150, 156, 128, 150, 154, 128, 150, 157, 128, 150, 245, 128, 150, 246, 128, 150, 247, 128, 150, 248, + 128, 150, 158, 128, 150, 249, 128, 150, 250, 128, 150, 160, 128, 150, 251, 252, 253, 252, 254, 252, 255, 253, 164, 253, 256, + 257, 258, 257, 259, 245, 260, 245, 159, 244, 155, 155, 33, 261, 55, 262, 263, 262, 262, 263, 263, 128, 263, 150, 121, 252, 62, + 263, 150, 121, 252, 61, 261, 150, 261, 262, 264, 87, 264, 86, 265, 77, 266, 264, 267, 255, 264, 268, 269, 265, 270, 271, 265, 272, + 165, 271, 62, 165, 271, 61, 267, 273, 268, 273, 270, 274, 272, 275, 267, 267, 8, 276, 268, 268, 8, 273, 270, 270, 8, 274, 272, 272, 8, 275, + 276, 168, 201, 273, 168, 202, 274, 168, 201, 275, 168, 202, 276, 277, 200, 273, 277, 192, 274, 277, 200, 275, 277, 192, 277, 33, 278, 55, 277, 34, 279, 56, + 278, 278, 280, 278, 280, 8, 279, 182, 181, 279, 281, 279, 281, 8, 182, 181, 280, 282, 280, 280, 8, 282, 281, 283, 281, 281, 8, 283, + 283, 182, 284, 282, 168, 202, 282, 194, 7, 168, 202, 282, 194, 7, 277, 202, 284, 168, 202, 284, 277, 202, 180, 95, 168, 180, 95, 277, 181, 181, 180, + 156, 61, 150, 154, 179, 62, 154, 179, 61, 157, 30, 36, 179, 60, 128, 16, 128, 157, 30, 36, 179, 60, 128, 260, 14, 128, 79, 36, 179, 60, 62, 260, 14, 128, 79, 36, 179, 60, 92, 260, 14, 128, 79, 36, 179, 60, 61, 260, 79, 36, 179, 60, 128, + 260, 21, 36, 242, 61, 243, 61, 243, 60, 128, 260, 21, 36, 269, 61, 243, 61, 243, 60, 128, 260, 21, 36, 266, 61, 243, 61, 243, 60, 128, 285, 31, 285, 111, 260, 21, 36, 211, 285, 179, 60, 128, 260, 21, 36, 286, 285, 179, 60, 128, 286, 264, 168, 286, 265, 168, 286, 264, 277, + 286, 265, 277, 246, 9, 62, 246, 9, 61, 246, 9, 167, 62, 246, 9, 167, 61, 247, 4, 62, 247, 4, 61, 247, 4, 167, 62, 247, 4, 167, 61, 248, 59, 243, 62, + 248, 59, 243, 61, 158, 80, 36, 179, 60, 128, 159, 71, 36, 179, 60, 287, 287, 33, 288, 55, 287, 33, 288, 289, 288, 55, 290, 291, 290, 290, 291, 288, 288, 290, 291, 5, 179, 7, 261, + 289, 10, 7, 261, 249, 167, 7, 292, 292, 128, 292, 150, 121, 164, 250, 73, 179, 62, 250, 73, 179, 61, 160, 75, 155, 293, 160, 75, 155, 294, 160, 75, 155, 293, 294, 293, 6, 36, 295, 60, 155, + 294, 20, 155, 295, 168, 295, 277, 251, 88, 62, 251, 88, 61, 296, 22, 164, 296, 168, 36, 297, 60, 298, 299, 300, 258, 164, 258, 296, 36, 297, 60, 298, 299, 300, 173, 22, 168, 36, 297, 60, 298, 299, 300, + 173, 22, 36, 297, 60, 298, 299, 300, 301, 297, 297, 297, 180, 297, 302, 297, 302, 8, 297, 302, 8, 180, 302, 284, 302, 302, 8, 284, 303, 284, + 298, 33, 300, 55, 299, 261, 239, 304, 93, 305, 187, 240, 304, 93, 305, 184, 239, 304, 93, 305, 122, 298, 299, 300, 240, 304, 93, 305, 122, 298, 299, 300, 304, 168, 304, 178, 305, + 195, 194, 36, 301, 60, 298, 299, 300, 195, 63, 194, 306, 301, 60, 298, 307, 308, 195, 112, 194, 36, 60, 298, 299, 300, 195, 113, 194, 36, 309, 60, 298, 299, 300, 309, 303, 306, 36, 308, 55, 256, 296, 63, 168, 306, 297, 60, 298, 307, 308, 259, 256, 259, 296, 63, 306, 297, 60, 298, 307, 308, + 175, 22, 63, 168, 306, 297, 60, 298, 307, 308, 175, 22, 63, 306, 297, 60, 298, 307, 308, 307, 299, 237, 96, 238, 96, 237, 96, 63, 187, 238, 96, 63, 184, 237, 96, 187, 238, 96, 184, 254, 98, 168, 310, 311, 312, 313, + 174, 98, 168, 310, 311, 312, 313, 314, 98, 310, 311, 312, 313, 174, 98, 310, 311, 312, 313, 314, 254, 311, 33, 313, 55, 315, 100, 310, 310, 99, 211, 312, + 312, 316, 316, 317, 316, 316, 317, 317, 195, 317, 315, 195, 317, 61, 131, 131, 318, 318, 262, 132, 319, + 320, 321, 319, 319, 320, 321, 322, 321, 321, 322, 322, 323, 62, 322, 323, 61, 322, 324, 62, 322, 324, 61, 322, 263, + 323, 108, 325, 326, 323, 108, 327, 325, 328, 325, 329, 325, 330, 325, 328, 8, 329, 325, 328, 8, 330, 328, 331, 329, 63, 110, 331, 330, 33, 55, + 330, 33, 332, 55, 330, 33, 332, 8, 55, 326, 102, 327, 332, 333, 332, 332, 8, 333, 333, 331, 333, 198, 110, 331, 327, 67, 331, 168, 334, + 324, 101, 63, 326, 324, 101, 335, 326, 324, 101, 335, 324, 101, 165, 324, 101, 252, 324, 101, 10, 334, 121, 257, 324, 101, 10, 334, 121, 314, 324, 101, 10, 334, 184, 335, 33, 55, 335, 33, 336, 55, + 335, 33, 336, 8, 55, 336, 337, 336, 336, 8, 337, 337, 198, 337, 198, 110, 198, 338, 126, 0 }; +const int QmlJSGrammar::rule_index [] = { + 0, 3, 6, 9, 12, 15, 18, 21, 23, 25, + 27, 29, 32, 35, 37, 41, 45, 47, 50, 53, + 57, 61, 67, 73, 78, 83, 86, 87, 89, 91, + 94, 96, 100, 103, 107, 110, 112, 119, 125, 130, + 135, 141, 145, 149, 153, 156, 159, 162, 165, 168, + 171, 175, 177, 179, 181, 185, 186, 188, 191, 196, + 203, 210, 214, 218, 226, 234, 239, 244, 250, 256, + 265, 274, 280, 287, 294, 305, 313, 322, 324, 326, + 328, 334, 336, 340, 344, 350, 352, 354, 356, 358, + 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, + 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, + 400, 402, 404, 406, 408, 410, 412, 414, 416, 420, + 423, 427, 433, 435, 437, 439, 441, 443, 445, 447, + 449, 453, 457, 463, 465, 468, 471, 476, 481, 483, + 486, 487, 489, 492, 495, 499, 504, 506, 508, 512, + 516, 518, 520, 523, 527, 531, 533, 535, 537, 539, + 541, 543, 545, 547, 549, 551, 553, 555, 557, 559, + 561, 563, 565, 567, 569, 571, 573, 575, 577, 579, + 581, 583, 585, 587, 589, 591, 593, 595, 597, 599, + 601, 603, 605, 607, 609, 611, 613, 615, 617, 619, + 621, 623, 625, 627, 631, 634, 637, 638, 639, 641, + 643, 645, 647, 651, 655, 657, 659, 664, 669, 673, + 677, 681, 683, 689, 691, 693, 696, 699, 702, 707, + 712, 717, 722, 726, 727, 729, 732, 734, 737, 741, + 746, 748, 750, 752, 755, 758, 761, 764, 766, 769, + 772, 775, 778, 781, 784, 787, 789, 793, 795, 799, + 801, 803, 805, 807, 811, 815, 817, 821, 825, 829, + 831, 833, 837, 841, 843, 845, 847, 849, 851, 855, + 857, 859, 863, 867, 869, 871, 873, 875, 877, 879, + 883, 887, 889, 891, 895, 899, 901, 903, 907, 911, + 913, 915, 919, 923, 925, 927, 931, 935, 937, 939, + 945, 951, 953, 955, 957, 959, 961, 963, 967, 971, + 975, 979, 981, 983, 985, 987, 989, 991, 993, 995, + 997, 999, 1001, 1003, 1005, 1007, 1011, 1015, 1016, 1017, + 1019, 1021, 1025, 1028, 1031, 1034, 1037, 1040, 1043, 1046, + 1049, 1052, 1055, 1058, 1061, 1064, 1066, 1068, 1070, 1072, + 1074, 1076, 1078, 1080, 1082, 1084, 1088, 1090, 1093, 1095, + 1100, 1105, 1107, 1109, 1111, 1113, 1115, 1118, 1121, 1124, + 1127, 1130, 1133, 1135, 1137, 1139, 1141, 1145, 1149, 1153, + 1157, 1160, 1163, 1166, 1169, 1172, 1175, 1178, 1181, 1185, + 1189, 1190, 1192, 1195, 1198, 1200, 1205, 1207, 1211, 1213, + 1217, 1220, 1223, 1228, 1233, 1236, 1239, 1242, 1245, 1246, + 1248, 1250, 1251, 1254, 1257, 1265, 1271, 1279, 1287, 1295, + 1301, 1311, 1321, 1331, 1333, 1335, 1343, 1351, 1354, 1357, + 1360, 1363, 1366, 1369, 1373, 1377, 1380, 1383, 1387, 1391, + 1395, 1399, 1405, 1411, 1415, 1421, 1423, 1426, 1427, 1429, + 1434, 1438, 1442, 1444, 1448, 1452, 1456, 1460, 1464, 1469, + 1475, 1478, 1480, 1482, 1485, 1488, 1490, 1499, 1501, 1509, + 1518, 1526, 1528, 1529, 1531, 1533, 1536, 1540, 1542, 1546, + 1548, 1550, 1552, 1554, 1559, 1564, 1572, 1580, 1582, 1584, + 1585, 1593, 1602, 1610, 1619, 1621, 1623, 1625, 1635, 1637, + 1646, 1656, 1665, 1667, 1669, 1671, 1675, 1679, 1682, 1685, + 1692, 1699, 1705, 1711, 1713, 1715, 1717, 1719, 1720, 1723, + 1724, 1726, 1728, 1731, 1733, 1736, 1738, 1739, 1741, 1743, + 1745, 1747, 1748, 1750, 1752, 1755, 1758, 1761, 1764, 1767, + 1769, 1773, 1776, 1778, 1780, 1782, 1786, 1790, 1792, 1796, + 1799, 1803, 1808, 1811, 1813, 1817, 1819, 1823, 1825, 1827, + 1828, 1832, 1836, 1839, 1842, 1845, 1851, 1857, 1862, 1865, + 1869, 1874, 1876, 1880, 1882, 1886 +}; +#endif // QLALR_NO_QMLJSGRAMMAR_DEBUG_INFO + const short QmlJSGrammar::action_default [] = { - 0, 0, 28, 0, 0, 0, 28, 0, 195, 262, - 226, 234, 230, 174, 246, 222, 3, 159, 90, 175, - 238, 242, 163, 192, 173, 178, 158, 212, 199, 0, - 97, 98, 93, 0, 87, 82, 367, 0, 0, 0, - 0, 95, 0, 0, 91, 94, 86, 0, 0, 83, - 85, 88, 84, 96, 89, 0, 92, 0, 0, 188, - 0, 0, 175, 194, 177, 176, 0, 0, 0, 190, - 191, 189, 193, 0, 223, 0, 0, 0, 0, 213, - 0, 0, 0, 0, 0, 0, 203, 0, 0, 0, - 197, 198, 196, 201, 205, 204, 202, 200, 215, 214, - 216, 0, 231, 0, 227, 0, 0, 169, 156, 168, - 157, 123, 124, 125, 151, 126, 153, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 152, - 139, 140, 154, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 155, 0, 0, 167, 263, 170, 0, - 171, 0, 172, 166, 0, 259, 252, 250, 257, 258, - 256, 255, 261, 254, 253, 251, 260, 247, 0, 235, - 0, 0, 239, 0, 0, 243, 0, 0, 169, 161, - 0, 160, 0, 165, 179, 0, 356, 356, 357, 0, - 354, 0, 355, 0, 358, 270, 277, 276, 284, 272, - 0, 273, 0, 359, 0, 366, 274, 275, 90, 280, - 278, 363, 360, 365, 281, 0, 293, 0, 0, 0, - 0, 350, 0, 367, 292, 264, 307, 0, 0, 0, - 294, 0, 0, 282, 283, 0, 271, 279, 308, 309, - 0, 356, 0, 0, 358, 0, 351, 352, 0, 340, - 364, 0, 324, 325, 326, 327, 0, 320, 321, 322, - 323, 348, 349, 0, 0, 0, 0, 0, 312, 313, - 314, 268, 266, 228, 236, 232, 248, 224, 269, 0, - 175, 240, 244, 217, 206, 0, 0, 225, 0, 0, - 0, 0, 218, 0, 0, 0, 0, 0, 210, 208, - 211, 209, 207, 220, 219, 221, 0, 233, 0, 229, - 0, 267, 175, 0, 249, 264, 265, 0, 264, 0, - 0, 316, 0, 0, 0, 318, 0, 237, 0, 0, - 241, 0, 0, 245, 305, 0, 297, 306, 300, 0, - 304, 0, 264, 298, 0, 264, 0, 0, 317, 0, - 0, 0, 319, 0, 0, 0, 311, 0, 310, 90, - 117, 368, 0, 0, 122, 286, 289, 0, 123, 293, - 126, 153, 128, 129, 93, 134, 135, 87, 136, 292, - 139, 91, 94, 264, 88, 96, 142, 89, 144, 92, - 146, 147, 294, 149, 150, 155, 0, 119, 118, 121, - 105, 120, 104, 0, 114, 287, 285, 0, 0, 0, - 358, 0, 115, 163, 164, 169, 0, 162, 0, 328, - 329, 0, 356, 0, 0, 358, 0, 116, 0, 0, - 0, 331, 336, 334, 337, 0, 0, 335, 336, 0, - 332, 0, 333, 288, 339, 0, 288, 338, 0, 341, - 342, 0, 288, 343, 344, 0, 0, 345, 0, 0, - 0, 346, 347, 181, 180, 0, 0, 0, 315, 0, - 0, 0, 330, 302, 295, 0, 303, 299, 0, 301, - 290, 0, 291, 296, 0, 0, 358, 0, 353, 108, - 0, 0, 112, 99, 0, 101, 110, 0, 102, 111, - 113, 103, 109, 100, 0, 106, 185, 183, 187, 184, - 182, 186, 361, 6, 362, 4, 2, 75, 107, 0, - 0, 0, 83, 85, 84, 37, 5, 0, 76, 0, - 51, 50, 49, 0, 0, 51, 0, 0, 0, 52, - 0, 67, 68, 0, 65, 0, 66, 41, 42, 43, - 44, 46, 47, 71, 45, 0, 0, 0, 78, 0, - 77, 80, 0, 81, 0, 79, 0, 51, 0, 0, - 0, 0, 0, 61, 0, 62, 0, 0, 32, 0, - 0, 72, 33, 0, 36, 34, 30, 0, 35, 31, - 0, 63, 0, 64, 163, 0, 69, 73, 0, 0, - 0, 0, 163, 288, 0, 70, 90, 123, 293, 126, - 153, 128, 129, 93, 134, 135, 136, 292, 139, 91, - 94, 264, 96, 142, 89, 144, 92, 146, 147, 294, - 149, 150, 155, 74, 0, 59, 53, 60, 54, 0, - 0, 0, 0, 56, 0, 57, 58, 55, 0, 0, - 0, 0, 48, 0, 38, 39, 0, 40, 8, 0, - 0, 9, 0, 11, 0, 10, 0, 1, 27, 15, - 14, 26, 13, 12, 29, 7, 0, 18, 0, 19, - 0, 24, 25, 0, 20, 21, 0, 22, 23, 16, - 17, 369 + 0, 0, 422, 422, 422, 0, 27, 0, 266, 111, + 316, 0, 334, 498, 292, 300, 296, 242, 114, 312, + 118, 288, 258, 3, 113, 115, 109, 106, 243, 110, + 304, 308, 225, 222, 263, 241, 224, 112, 215, 116, + 281, 271, 0, 105, 528, 0, 129, 130, 125, 102, + 0, 100, 95, 0, 141, 0, 0, 0, 127, 0, + 0, 211, 123, 126, 104, 99, 0, 0, 96, 98, + 101, 97, 103, 128, 216, 0, 108, 0, 124, 0, + 0, 514, 117, 256, 248, 314, 0, 0, 118, 109, + 243, 265, 245, 244, 0, 261, 262, 260, 259, 264, + 500, 0, 494, 0, 422, 491, 372, 0, 369, 422, + 367, 493, 317, 0, 335, 293, 301, 297, 349, 347, + 313, 348, 355, 344, 289, 345, 0, 109, 346, 363, + 352, 243, 305, 309, 280, 350, 270, 364, 0, 0, + 0, 422, 0, 0, 0, 0, 339, 421, 0, 0, + 0, 376, 0, 0, 515, 353, 354, 0, 0, 343, + 351, 315, 500, 0, 495, 0, 422, 0, 497, 492, + 0, 291, 0, 284, 286, 285, 287, 282, 0, 277, + 275, 0, 278, 276, 274, 272, 0, 0, 0, 268, + 269, 267, 279, 0, 299, 0, 295, 423, 0, 424, + 337, 422, 0, 462, 463, 0, 0, 464, 476, 0, + 107, 483, 488, 208, 208, 484, 485, 0, 0, 401, + 141, 415, 210, 0, 206, 416, 486, 489, 487, 0, + 422, 0, 477, 417, 418, 208, 407, 402, 158, 159, + 107, 157, 0, 0, 165, 166, 167, 168, 200, 194, + 169, 196, 170, 171, 172, 173, 174, 202, 201, 175, + 176, 177, 178, 179, 203, 180, 181, 0, 195, 182, + 183, 163, 197, 184, 161, 198, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 199, 412, 403, 408, 399, + 0, 208, 208, 413, 414, 0, 204, 0, 405, 409, + 142, 419, 139, 400, 141, 410, 419, 411, 420, 406, + 140, 404, 0, 331, 324, 0, 329, 330, 328, 327, + 333, 326, 325, 322, 323, 332, 321, 319, 0, 303, + 0, 0, 307, 0, 0, 311, 0, 446, 447, 448, + 449, 0, 442, 443, 444, 445, 474, 475, 0, 0, + 0, 0, 0, 0, 427, 428, 429, 338, 340, 0, + 0, 243, 0, 0, 375, 374, 0, 0, 0, 336, + 339, 0, 341, 339, 0, 422, 431, 0, 434, 435, + 0, 422, 437, 0, 0, 0, 320, 0, 422, 436, + 318, 438, 377, 440, 383, 392, 0, 207, 0, 387, + 209, 391, 0, 205, 395, 396, 339, 0, 339, 0, + 422, 433, 439, 441, 385, 379, 393, 397, 0, 207, + 0, 389, 339, 0, 339, 0, 422, 432, 365, 342, + 422, 0, 366, 357, 0, 0, 359, 360, 356, 0, + 358, 0, 370, 371, 0, 0, 483, 506, 0, 0, + 422, 513, 0, 508, 507, 208, 378, 0, 384, 0, + 388, 528, 0, 0, 530, 525, 0, 532, 531, 0, + 164, 534, 0, 100, 536, 101, 0, 527, 520, 526, + 533, 535, 483, 482, 0, 0, 422, 0, 501, 0, + 0, 0, 422, 0, 503, 0, 0, 490, 505, 0, + 0, 422, 0, 504, 0, 483, 0, 0, 422, 0, + 502, 529, 0, 0, 422, 426, 422, 425, 0, 450, + 451, 0, 0, 0, 453, 458, 456, 459, 0, 0, + 457, 458, 0, 454, 0, 455, 422, 461, 0, 422, + 460, 0, 465, 466, 0, 467, 468, 0, 0, 469, + 0, 472, 473, 0, 0, 470, 471, 0, 0, 422, + 430, 0, 0, 422, 452, 519, 0, 517, 208, 0, + 380, 386, 394, 398, 0, 390, 381, 382, 496, 0, + 368, 0, 290, 0, 283, 0, 273, 0, 298, 0, + 294, 0, 0, 234, 227, 233, 0, 232, 235, 0, + 237, 0, 236, 239, 0, 240, 231, 238, 0, 302, + 0, 0, 306, 0, 0, 310, 0, 0, 234, 228, + 221, 0, 218, 0, 229, 0, 0, 234, 220, 0, + 217, 0, 230, 528, 0, 0, 530, 0, 521, 530, + 0, 523, 249, 248, 0, 483, 0, 483, 0, 0, + 422, 0, 480, 0, 0, 422, 0, 481, 0, 483, + 483, 0, 0, 422, 0, 511, 0, 0, 422, 0, + 512, 152, 151, 156, 148, 0, 0, 144, 153, 0, + 145, 150, 146, 0, 155, 134, 0, 142, 0, 141, + 132, 0, 137, 138, 0, 133, 143, 135, 136, 131, + 0, 0, 120, 121, 419, 119, 0, 122, 253, 247, + 225, 226, 0, 0, 234, 0, 223, 219, 255, 252, + 246, 0, 0, 212, 214, 0, 213, 254, 251, 250, + 518, 0, 516, 0, 257, 0, 0, 6, 543, 540, + 544, 422, 550, 0, 0, 548, 549, 546, 547, 545, + 575, 573, 570, 0, 0, 574, 572, 0, 563, 568, + 0, 578, 0, 524, 577, 0, 478, 361, 509, 362, + 576, 528, 483, 0, 0, 0, 422, 0, 479, 483, + 0, 0, 422, 0, 510, 0, 530, 0, 522, 582, + 0, 584, 579, 0, 580, 583, 581, 0, 585, 571, + 569, 0, 558, 553, 552, 554, 555, 0, 0, 551, + 0, 556, 557, 0, 564, 566, 0, 560, 0, 567, + 0, 561, 565, 562, 0, 559, 5, 538, 422, 2, + 78, 80, 0, 0, 476, 0, 96, 98, 97, 36, + 4, 0, 79, 0, 54, 53, 52, 0, 0, 54, + 0, 0, 0, 55, 0, 93, 91, 86, 94, 90, + 87, 89, 92, 88, 70, 71, 0, 68, 422, 69, + 0, 74, 45, 46, 47, 49, 0, 0, 50, 48, + 43, 422, 44, 372, 126, 128, 147, 0, 0, 0, + 40, 162, 41, 160, 149, 0, 154, 42, 0, 0, + 0, 82, 0, 81, 84, 0, 85, 0, 83, 0, + 54, 0, 0, 0, 0, 0, 64, 0, 65, 0, + 0, 31, 0, 0, 75, 32, 0, 35, 33, 29, + 0, 34, 30, 0, 66, 422, 67, 0, 72, 225, + 0, 76, 0, 0, 0, 422, 0, 73, 225, 0, + 77, 0, 62, 56, 63, 57, 0, 0, 0, 0, + 59, 0, 60, 61, 58, 422, 0, 0, 51, 141, + 0, 0, 37, 38, 0, 39, 8, 0, 0, 9, + 0, 11, 0, 10, 1, 26, 17, 14, 0, 15, + 16, 13, 12, 28, 7, 0, 18, 0, 19, 0, + 24, 25, 0, 20, 21, 0, 22, 23, 586 }; const short QmlJSGrammar::goto_default [] = { - 7, 667, 213, 200, 211, 526, 513, 662, 675, 512, - 661, 665, 663, 671, 22, 668, 666, 664, 18, 525, - 587, 577, 584, 579, 553, 195, 199, 201, 206, 237, - 214, 234, 568, 639, 638, 205, 236, 557, 26, 491, - 490, 362, 361, 9, 360, 363, 204, 484, 364, 109, - 17, 149, 24, 13, 148, 19, 25, 59, 23, 8, - 28, 27, 283, 15, 277, 10, 273, 12, 275, 11, - 274, 20, 281, 21, 282, 14, 276, 272, 313, 418, - 278, 279, 207, 197, 196, 210, 209, 233, 198, 367, - 366, 235, 475, 474, 335, 336, 477, 338, 476, 337, - 431, 435, 438, 434, 433, 453, 454, 202, 188, 203, - 212, 0 + 7, 984, 108, 23, 840, 826, 737, 980, 994, 976, + 979, 983, 981, 988, 27, 985, 32, 982, 866, 839, + 930, 920, 927, 922, 106, 882, 887, 871, 125, 428, + 123, 128, 160, 137, 156, 911, 956, 955, 830, 159, + 900, 26, 13, 38, 29, 9, 37, 24, 18, 25, + 39, 82, 20, 126, 215, 311, 688, 686, 114, 300, + 698, 12, 675, 886, 674, 671, 222, 888, 472, 471, + 241, 238, 239, 244, 400, 416, 395, 724, 42, 36, + 33, 599, 35, 17, 598, 131, 84, 83, 22, 34, + 94, 8, 136, 134, 40, 178, 124, 21, 172, 14, + 115, 16, 117, 15, 116, 30, 132, 31, 133, 19, + 120, 85, 161, 10, 112, 383, 359, 518, 429, 119, + 121, 118, 135, 130, 155, 122, 434, 438, 433, 440, + 437, 770, 767, 769, 129, 111, 109, 110, 439, 157, + 363, 392, 456, 367, 415, 158, 570, 394, 414, 571, + 399, 214, 242, 297, 237, 298, 236, 299, 212, 377, + 360, 524, 528, 531, 527, 526, 203, 545, 546, 553, + 206, 483, 104, 451, 578, 484, 216, 498, 113, 101, + 446, 452, 453, 499, 634, 464, 466, 478, 764, 469, + 468, 467, 827, 739, 738, 741, 740, 736, 735, 801, + 756, 804, 803, 805, 806, 815, 816, 814, 760, 751, + 790, 789, 0 }; const short QmlJSGrammar::action_index [] = { - 350, 1528, 3041, 3041, 2937, 1235, 115, 105, 239, -108, - 102, 93, 95, 205, -108, 422, 110, -108, -108, 727, - 92, 118, 265, 256, -108, -108, -108, 507, 247, 1528, - -108, -108, -108, 665, -108, -108, 2729, 1826, 1528, 1528, - 1528, -108, 1041, 1528, -108, -108, -108, 1528, 1528, -108, - -108, -108, -108, -108, -108, 1528, -108, 1528, 1528, -108, - 1528, 1528, 174, 221, -108, -108, 1528, 1528, 1528, -108, - -108, -108, 177, 1528, 422, 1528, 1528, 1528, 1528, 411, - 1528, 1528, 1528, 1528, 1528, 1528, 211, 1528, 1528, 1528, - 142, 148, 154, 217, 223, 226, 227, 231, 507, 385, - 395, 1528, 57, 1528, 83, 2521, 1528, 1528, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, -108, 179, 1528, -108, -108, 77, 36, - -108, 1528, -108, -108, 1528, -108, -108, -108, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, 1528, 56, - 1528, 1528, 80, 74, 1528, -108, 2521, 1528, 1528, -108, - 125, -108, 55, -108, -108, 53, 410, 418, 72, 52, - -108, 392, -108, 46, 3041, -108, -108, -108, -108, -108, - 273, -108, 396, -108, 44, -108, -108, -108, 76, -108, - -108, -108, 3041, -108, -108, 744, -108, 589, 98, 2937, - 91, 90, 88, 3249, -108, 1528, -108, 86, 1528, 81, - -108, 75, 73, -108, -108, 586, -108, -108, -108, -108, - 71, 491, 69, 65, 3041, 64, -108, -108, 2937, -108, - -108, 139, -108, -108, -108, -108, 134, -108, -108, -108, - -108, -108, -108, 63, 66, 1528, 147, 264, -108, -108, - -108, 1726, -108, 87, 68, 70, -108, 334, 82, 78, - 796, 89, 121, 349, 318, 469, 1528, 330, 1528, 1528, - 1528, 1528, 359, 1528, 1528, 1528, 1528, 1528, 284, 289, - 303, 306, 313, 365, 369, 375, 1528, 58, 1528, 85, - 1528, -108, 849, 1528, -108, 1528, 79, 59, 1528, 61, - 2937, -108, 1528, 146, 2937, -108, 1528, 62, 1528, 1528, - 106, 99, 1528, -108, 96, 176, 171, -108, -108, 1528, - -108, 407, 1528, -108, 97, 1528, -52, 2937, -108, 1528, - 120, 2937, -108, 1528, 123, 2937, 101, 2937, -108, 116, - -108, 84, 45, 0, -108, -108, 2937, -39, 641, -3, - 652, 156, 1528, 2937, -7, -11, 567, 2625, -21, 5, - 945, 2, 94, 1629, 2625, -1, -26, 6, 1528, 10, - -15, 1528, 14, 1528, -25, -12, 2833, -108, -108, -108, - -108, -108, -108, 1528, -108, -108, -108, -14, -58, -13, - 3041, -36, -108, 287, -108, 1528, -46, -108, 153, -108, - -108, -31, 586, -57, -32, 3041, 11, -108, 1528, 168, - 29, -108, 47, -108, 48, 169, 1528, -108, 49, 50, - -108, 9, -108, 2937, -108, 136, 2937, -108, 275, -108, - -108, 126, 2937, 35, -108, 33, 37, -108, 466, -4, - 38, -108, -108, -108, -108, 1528, 130, 2937, -108, 1528, - 117, 2937, -108, 34, -108, 296, -108, -108, 1528, -108, - -108, 404, -108, -108, 12, 40, 3041, 13, -108, -108, - 155, 1926, -108, -108, 2026, -108, -108, 2126, -108, -108, - -108, -108, -108, -108, 144, -108, -108, -108, -108, -108, - -108, -108, -108, -108, 3041, -108, -108, -108, 132, -27, - 15, 1137, 218, -23, 17, -108, -108, 196, -108, 242, - 8, -108, -108, 579, 237, -108, 127, 18, 415, -108, - 103, -108, -108, 236, -108, 2223, -108, -108, -108, -108, - -108, -108, -108, -108, -108, 27, 21, 137, 31, 20, - -108, 23, -5, -108, -9, -108, 332, -10, 571, 201, - 195, 586, 225, -108, 7, -108, 1137, 165, -108, 4, - 1137, -108, -108, 1333, -108, -108, -108, 1431, -108, -108, - 184, -108, 2223, -108, 331, 3, -108, -108, 202, 531, - 26, 2417, 327, 3145, 1, -108, 25, 629, 24, 649, - 124, 1528, 2937, 22, -6, 514, -8, 19, 1041, 16, - 94, 1629, 28, 42, 67, 1528, 60, 43, 1528, 54, - 1528, 41, 39, -108, 234, -108, 228, -108, 51, -2, - 564, 233, 575, -108, 100, -108, -108, -108, 2320, 1137, - 1826, 32, -108, 122, -108, -108, 30, -108, -108, 1137, - 1137, 104, 903, -108, 308, -108, 108, -108, -108, 133, - 119, -108, -108, -108, -108, -108, 451, -108, 164, -108, - 161, -108, -108, 458, -108, -108, 151, -108, -108, -108, - -108, -108, + 360, 2257, 317, 158, -126, 1795, 188, 277, 218, -126, + -126, 75, -126, -126, 142, 96, 83, 422, -126, -126, + 76, 393, -126, 172, -126, -126, 85, -126, 1036, -126, + 68, 213, 409, -126, 302, -126, -126, -126, -126, -126, + 427, 288, 291, -126, 685, 2142, -126, -126, -126, -126, + 901, -126, -126, 5445, 2953, 3643, 2142, 2142, -126, 1679, + 2142, -126, -126, -126, -126, -126, 2142, 2142, -126, -126, + -126, -126, -126, -126, -126, 2257, -126, 2142, -126, 2142, + 2142, 3413, -126, -126, 28, -126, 2142, 2142, -126, -126, + 168, 310, -126, -126, 2142, -126, -126, -126, -126, 337, + -126, 3298, -126, 105, -126, -126, 5567, 86, -126, 336, + -126, -126, -126, 78, -126, 147, 106, 100, -126, -126, + -126, -126, -126, -126, 504, -126, 323, 187, -126, -126, + -126, 1223, 153, 145, 483, -126, 309, -126, 885, 881, + 130, -126, 121, 128, 346, 120, 2372, -126, 114, 2372, + 119, -126, 111, 110, 3068, -126, -126, 906, 150, -126, + -126, -126, -126, 3183, -126, 112, -126, 94, -126, -126, + 2142, 377, 2142, -126, -126, -126, -126, 464, 2142, -126, + -126, 2142, -126, -126, -126, 352, 2142, 2142, 2142, 183, + 186, 198, 263, 2142, 109, 2142, 174, -126, 2372, -126, + -126, -126, 5689, -126, -126, 161, 712, -126, -126, 138, + -126, 1100, -126, 159, 149, -126, 155, 107, 1003, 4835, + 177, -126, -126, 2372, -126, -126, 1100, -126, -126, 156, + -126, 52, -126, -126, -126, 84, -126, 116, -126, -126, + 189, -126, 49, 88, -126, -126, -126, -126, -126, -126, + -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, + -126, -126, -126, -126, -126, -126, -126, 2372, -126, -126, + -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, + -126, -126, -126, -126, -126, -126, -126, 4835, -126, -126, + 906, 77, 74, -126, -126, 27, -126, 29, 63, -126, + 65, 1100, -126, -126, 71, -126, 1100, -126, -126, -126, + -126, -126, 2372, -126, -126, 2372, -126, -126, -126, -126, + -126, -126, -126, -126, -126, -126, -126, -126, 2142, 41, + 2142, 2372, 79, 81, 2372, -126, 171, -126, -126, -126, + -126, 169, -126, -126, -126, -126, -126, -126, 5201, 72, + 104, 2372, 205, 241, -126, -126, -126, 3873, 125, 70, + 176, 1122, 1003, 64, -126, -126, 906, 58, 2257, -126, + 2372, 44, 90, 2372, 53, -126, -126, 2372, -126, -126, + 195, -126, -126, 2257, 2372, 2257, -126, 185, -126, -126, + -126, 327, 102, 95, -126, -126, 906, 97, 92, -126, + -126, -126, 2257, -126, -126, -126, 2372, 60, 2372, 62, + -126, -126, 322, 101, -126, 115, -126, -126, 1003, 99, + 98, -126, 2372, 59, 2372, 57, -126, -126, -126, -126, + -126, 56, -126, -126, 211, 708, -126, -126, -126, 906, + -126, 564, -126, -126, 712, 91, 1100, -126, 69, 93, + -126, -126, 73, -126, -126, 113, 124, 117, -126, 759, + -126, 61, 103, 1451, 5079, -126, 82, -126, 5079, 4957, + -126, -126, 50, 4835, -126, 4835, 4835, 46, -126, -126, + -126, -126, 1100, -126, 20, 39, -126, 38, -126, 40, + 24, 45, -126, 42, -126, 54, 906, -126, -126, 43, + 66, -126, 47, -126, -28, 1100, 48, 67, -126, 51, + -126, -126, 2372, 231, -126, 80, -126, -126, 181, -126, + -126, 2372, 214, 144, -126, 157, -126, 160, 209, 2372, + -126, 167, 166, -126, 127, -126, -126, -126, 396, -126, + -126, 308, -126, -126, 246, 164, -126, 162, 146, -126, + 906, -126, -126, 126, 154, -126, -126, 2372, 208, -126, + -126, 2372, 210, -126, -126, -126, 2372, -126, 118, 122, + 134, -126, -126, -126, 782, -126, -126, -126, -126, 5567, + -126, 2142, 368, 2142, 437, 2142, 315, 2142, 89, 2142, + 152, 4225, 2372, 2487, -126, -126, 239, -126, 7, -39, + -126, 2372, 2835, -126, 2372, -126, -126, -126, 2142, -26, + 2142, 2372, 21, 6, 2257, -126, 4225, 2372, 2487, -126, + -126, 236, -126, -30, -126, 4225, 2372, 2487, -126, 228, + -126, -60, -126, -87, 33, 33, 5079, 13, -126, 5079, + 5, -126, -126, -126, 25, 1100, 650, 1100, -3, 31, + -126, 22, -126, -25, 3, -126, -17, -126, 4, 1100, + 1100, -18, 1, -126, -8, -126, -4, 18, -126, -16, + -126, -126, 312, -126, -126, 243, 253, -126, -126, 5323, + -126, -126, -126, 2372, -126, -126, 249, 2605, 215, 17, + -126, 3758, -126, -126, 2257, -126, -126, -126, -126, -126, + 2, 240, -126, -126, 2720, -126, -12, -126, -126, -126, + 406, -126, 212, 12, 2487, -14, -126, -126, -126, -126, + -126, 348, 2257, -126, -126, 330, -126, -126, -126, -126, + -126, 2257, -126, 2142, -126, 232, 217, -126, -126, -126, + -126, 220, -126, 494, 998, -126, -126, -126, -126, -126, + -126, -75, -126, 4347, -96, -126, -126, -9, -126, -126, + 3528, -126, 178, -126, -126, 805, -126, -126, -126, -126, + -126, 632, 1100, 809, 15, 26, -126, -1, -126, 1100, + -27, -7, -126, -36, -126, 32, 5079, -41, -126, -126, + 206, -86, -126, 4469, -126, -126, -126, 4225, -126, -126, + -126, -52, -126, 151, -126, -126, -126, 4713, -57, -126, + 196, -126, -126, -101, -126, -126, 207, -126, 580, -126, + 4591, -126, -126, -126, 712, -126, -126, -126, 55, -126, + -126, 386, 19, 8, 165, 1565, 283, -24, 16, -126, + -126, 304, -126, 275, 37, -126, -126, 615, 342, -126, + 193, 23, 499, -126, 163, -126, -126, -126, -126, -126, + -126, -126, -126, -126, -126, -126, 347, -126, -126, -126, + 4103, -126, -126, -126, -126, -126, -29, 2372, -126, -126, + -126, -126, -126, 5811, 11, 10, -126, 201, 9, 296, + -126, -126, -126, -126, -126, 2372, -126, -126, -5, 0, + 180, 14, -19, -126, -15, -42, -126, -40, -126, 431, + -34, 615, 303, 182, 495, 313, -126, -2, -126, 1337, + 194, -126, 36, 1337, -126, -126, 1911, -126, -126, -126, + 2027, -126, -126, 300, -126, -126, -126, 4103, -126, 458, + -13, -126, 289, 615, -6, -126, 4103, -126, 448, -22, + -126, 247, -126, 321, -126, 35, -11, 615, 316, 615, + -126, 143, -126, -126, -126, -126, 1210, 3988, -126, 2953, + 34, 267, -126, -126, 30, -126, -126, 1337, 545, 173, + 1337, -126, 387, -126, -126, -126, 382, -126, 179, -126, + -126, -126, -126, -126, -126, 474, -126, 320, -126, 192, + -126, -126, 471, -126, -126, 224, -126, -126, -126, - -112, 18, 86, 97, 69, 316, 7, -112, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -64, - -112, -112, -112, -112, -112, -112, -112, -112, -112, 66, - -112, -112, -112, -17, -112, -112, -10, -36, 3, 90, - 95, -112, 149, 74, -112, -112, -112, 67, 13, -112, - -112, -112, -112, -112, -112, 178, -112, 181, 185, -112, - 189, 190, -112, -112, -112, -112, 198, 208, 212, -112, - -112, -112, -112, 209, -112, 201, 164, 111, 113, -112, - 116, 130, 131, 132, 134, 142, -112, 118, 124, 144, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, 154, -112, 155, -112, 268, 28, -8, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, 42, -112, -112, -112, -112, - -112, 47, -112, -112, 50, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, 159, -112, - 158, 56, -112, -112, 57, -112, 362, 60, 157, -112, - -112, -112, -112, -112, -112, -112, 20, 151, -112, -112, - -112, 25, -112, -112, 30, -112, -112, -112, -112, -112, - -112, -112, 31, -112, -112, -112, -112, -112, -112, -112, - -112, -112, 233, -112, -112, 34, -112, 35, -112, 225, - -112, 36, -112, 216, -112, 55, -112, -112, 53, 39, - -112, -112, -112, -112, -112, 19, -112, -112, -112, -112, - -112, 94, -112, -112, 92, -112, -112, -112, 117, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, 33, -112, -112, -112, -112, - -112, 88, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, 51, 220, -112, 227, 235, - 236, 244, -112, 21, 17, 102, 91, 89, -112, -112, - -112, -112, -112, -112, -112, -112, 211, -112, 247, -112, - 257, -112, -112, 264, -112, 75, -112, -112, 103, -112, - 112, -112, 29, -112, 73, -112, 263, -112, 255, 254, - -112, -112, 245, -112, -112, -112, -112, -112, -112, 248, - -112, 65, 105, -112, -112, 99, -112, 162, -112, 37, - -112, 115, -112, 44, -112, 135, -112, 137, -112, -112, - -112, -112, -112, -112, -112, -112, 138, -112, 24, -112, - 26, -112, 104, 140, -112, -112, 32, 64, -112, -112, - 174, -112, -112, 48, 87, -112, -112, -112, 54, -112, - 40, 71, -112, 150, -112, -112, 197, -112, -112, -112, - -112, -112, -112, 12, -112, -112, -112, -112, -112, -112, - 206, -112, -112, -112, -112, 207, -112, -112, -112, -112, - -112, -112, 231, -112, -112, 239, -112, -112, 43, -112, - -112, -112, -112, -112, -59, -112, 38, -112, -62, -112, - -112, -112, -112, 258, -112, -112, 259, -112, -112, -112, - -112, -112, 163, -72, -112, -112, 41, -112, 62, -112, - 61, -112, -112, -112, -112, 59, -112, 193, -112, 58, - -112, 204, -112, -112, -112, -112, -112, -112, 52, -112, - -112, 175, -112, -112, -112, -112, 186, -112, -112, -112, - -112, 49, -112, -112, 173, -112, -112, 45, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, 213, -112, -112, -112, -112, -112, - -112, 46, -112, -112, -112, -112, -112, -112, -112, 27, - -112, -112, -112, -18, -9, -112, -112, -112, 15, -112, - -112, -112, -112, -112, -112, 331, -112, -112, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, 11, -6, - -112, 10, -112, -112, -112, -112, 156, -112, -112, -112, - 240, -112, -112, 330, -112, -112, -112, 332, -112, -112, - -112, -112, 376, -112, -112, 8, -112, -112, -7, 76, - -112, 358, -112, 228, 5, -112, -112, 6, -112, 4, - -112, 79, 221, -112, -112, 2, -112, -112, 174, -112, - -112, 16, -112, -112, -112, 14, -112, -16, 70, -112, - 63, -112, -112, -112, -112, -112, -30, -112, -112, -112, - -15, -28, -13, -112, -112, -112, -112, -112, 460, 93, - 307, -12, -112, -112, -112, -112, -11, -112, -112, -2, - -1, 85, 84, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, -112, -3, -112, -112, -112, - -112, -112, -112, 0, -112, -112, -112, -112, -112, -112, - -112, -112 + -213, 160, 123, 148, 168, 658, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, 81, -213, -213, + -213, 44, -213, -213, -213, -213, -213, -213, -213, -213, + -213, -213, 104, -213, -213, -213, -213, -213, -213, -213, + 48, -213, -213, -213, 124, 659, -213, -213, -213, -213, + 116, -213, -213, 212, 120, 197, 500, 505, -213, 506, + 493, -213, -213, -213, -213, -213, 521, 529, -213, -213, + -213, -213, -213, -213, -213, 267, -213, 560, -213, 638, + 619, 218, -213, -213, -213, -213, 306, 309, -213, -213, + -213, -213, -213, -213, 487, -213, -213, -213, -213, -213, + -213, 307, -213, -213, -46, -213, 82, -213, -213, 184, + -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, + -213, 11, -213, -213, -213, -213, -213, -213, 60, 99, + -213, 198, -213, -213, 171, -213, 66, -213, -213, 86, + 28, -213, -213, -213, 1, -213, -213, 225, -213, -213, + -213, -213, -117, 7, -213, -108, -106, -104, -213, -213, + 422, -213, 432, -213, -213, -213, -213, -213, 329, -213, + -213, 434, -213, -213, -213, -213, 451, 458, 430, -213, + -213, -213, -213, 459, -213, 468, -213, -213, -13, -213, + -213, 204, 9, -213, -213, 57, 196, -213, -213, -213, + -213, 217, -213, 32, 34, -213, -213, -213, 213, 215, + 26, -213, -213, 23, -213, -213, 393, -213, -213, -99, + -95, -98, -213, -213, -213, 10, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, 29, -213, -213, + -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, 342, -213, -213, + 223, 16, 17, -213, -213, -213, -213, -213, -213, -213, + -213, 312, -213, -213, 117, -213, 555, -213, -213, -213, + -213, -213, 31, -213, -213, 30, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, -213, 376, -213, + 391, 27, -213, -213, 25, -213, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, -213, 39, -213, + -213, 21, -213, -213, -213, -213, -213, 610, -213, -213, + -213, -80, 295, -213, -213, -213, 291, -213, 359, -213, + 115, -213, -213, 114, -213, 162, -213, 24, -213, -213, + -213, 161, -213, 377, 22, 387, -213, -213, 159, -213, + -213, -213, -213, 36, -213, -213, 272, 40, 38, -213, + -213, -213, 398, -213, -213, -213, 107, -213, 106, -213, + 315, -213, -213, 37, -213, -213, -213, -213, 408, -213, + 35, -213, 103, -213, 101, -213, 151, -213, -213, -213, + -35, -213, -213, -213, -213, 109, -213, -213, -213, 330, + -213, 169, -213, -213, 188, -213, 258, -213, -213, -75, + -213, -213, -213, -213, -213, -213, -213, 33, -213, 471, + -213, -88, -213, 250, 53, -213, -213, -213, 172, 199, + -213, -213, -213, 194, -213, 201, 203, -213, -213, -213, + -213, -213, 205, -213, -213, -81, -83, -90, -213, -213, + -213, -109, -118, -120, -213, -213, 254, -213, -213, -213, + -119, -121, -127, -213, -178, 252, -213, -124, -135, -141, + -213, -213, -2, -213, 178, -213, 179, -213, -213, -213, + -213, -4, -213, -213, -213, -213, -213, -123, -213, -9, + -213, -122, -213, -213, -213, -213, -96, -213, -213, -97, + -213, -213, -213, -213, -213, -125, -213, -213, 42, -213, + 246, -213, -213, -213, 69, -213, -213, 19, -213, 195, + -213, 15, -213, 202, -213, -213, 8, -213, -20, 3, + -213, -213, -213, -213, 304, -213, -213, -213, -213, 20, + -213, 542, -38, 578, -37, 308, -213, 519, -213, 588, + -213, 164, 80, 76, -213, -213, -213, -213, -213, -213, + -213, 77, 78, -213, 79, -213, -213, -213, 590, -213, + 591, 83, -213, -213, 290, -213, 153, 93, 131, -213, + -213, -213, -213, -213, -213, 149, 50, 126, -213, -213, + -213, -213, -213, -78, -72, -71, 154, -67, -213, 200, + -65, -213, -213, -213, -213, 270, 277, 281, -213, -48, + -44, -43, -213, -213, -56, -66, -69, -213, -36, 248, + 236, -213, -68, -64, -52, -213, -213, -47, -53, -61, + -213, -213, 52, -213, -213, -213, -213, -213, -213, 437, + -213, -213, -213, 90, -213, -213, -213, 91, -213, 89, + -213, 111, -213, -213, 404, -213, -213, -213, -213, -213, + -213, -213, -213, -213, 251, -213, -213, -213, -213, -213, + 104, -213, -213, -213, 118, -213, -213, -213, -213, -213, + -213, -213, 317, -213, -213, 61, -213, -213, -213, -213, + -213, 316, -213, 337, -213, -213, -213, -213, -213, -213, + -213, 219, -213, 365, 283, -213, -213, -213, -213, -213, + -213, -213, -213, 121, -183, -213, -213, -185, -213, -213, + -39, -213, 288, -213, -213, 192, -213, -213, -213, -213, + -213, 256, 289, 287, -213, -143, -142, -144, -213, 266, + -213, -145, -180, -177, -213, -175, 141, -179, -213, -213, + -213, -213, -213, 220, -213, -213, -213, 155, -213, -213, + -213, -174, -213, -213, -213, -213, -213, 244, -213, -213, + 12, -213, -213, -213, -213, -213, -213, -213, 234, -213, + 301, -213, -213, -213, 231, -213, -213, -213, 167, -213, + -213, 104, -213, -213, 146, 486, -213, -213, -213, -213, + -213, -213, -213, -22, -213, -213, -213, -213, -7, -213, + -213, -213, 4, -213, -213, -213, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, -213, 13, -213, + 844, -213, -213, -213, -213, -213, 5, -10, -213, -213, + -213, 128, -213, -16, -213, -213, -213, -213, -213, -30, + -213, -213, -213, -213, -213, -58, -213, -213, -213, -213, + -213, -213, -213, -213, -213, -213, -213, -213, -213, 104, + -213, -3, -12, -213, 2, -213, -213, -213, -213, 583, + -213, -213, -213, 584, -213, -213, 715, -213, -213, -213, + 712, -213, -213, -213, -213, 190, -213, 766, -213, 104, + -11, -213, -29, -6, -213, 150, 746, -213, 104, -15, + -213, -213, -213, -32, -213, -213, -213, 18, 0, 14, + -213, -213, -213, -213, -213, 174, 625, 727, -213, 633, + -1, -213, -213, -213, -8, -213, -213, 328, -5, 237, + 637, -213, -213, -213, -213, -213, 104, -213, -213, -213, + -213, -213, -213, -213, -213, 6, -213, -213, -213, -213, + -213, -213, -14, -213, -213, -213, -213, -213, -213 }; const short QmlJSGrammar::action_info [] = { - -132, 425, 409, 424, -151, 422, -120, 403, 347, -140, - 428, 465, -152, -143, 417, 353, 406, -145, 452, 412, - 410, -148, 408, -140, 469, 271, -152, 569, 353, -132, - 271, -151, 248, 601, 583, -120, 583, 583, 565, 529, - 562, 576, 563, 598, 555, 534, 634, 539, 564, 561, - 558, 478, 436, 436, 436, 456, 460, 443, 644, 641, - 556, -148, 432, 583, 442, 583, 427, -145, 488, 458, - 452, 452, 485, 486, -143, 469, 452, 465, 428, 194, - 191, 174, 168, 248, 73, 151, 286, 145, 286, 187, - 310, 326, 396, 0, 168, 0, 153, 0, 244, 247, - 402, -121, 265, 73, 101, 691, 332, 241, 326, 469, - 306, 465, 193, 339, 452, 183, 306, 357, 145, 246, - 318, 320, 428, 248, 353, 145, 186, 271, 145, 243, - 580, 145, 455, 145, 176, 0, 103, 308, 145, 315, - 264, 101, 537, 446, 145, 559, 456, 176, 176, 308, - 0, 538, 145, 177, 145, 145, 0, 0, 345, 262, - 261, 646, 645, 494, 542, 541, 177, 177, 170, 690, - 689, 328, 171, 580, 103, 329, 145, 471, 654, 439, - 351, 181, 60, 355, 341, 262, 261, 145, 60, 66, - 467, 592, 560, 61, 60, 260, 259, 659, 660, 61, - 255, 254, 349, 648, 505, 61, 324, 267, 659, 660, - 537, 495, 688, 687, 420, 419, 64, 262, 261, 571, - 105, 581, 682, 681, 440, 685, 684, 65, 430, 583, - 535, 535, 574, 66, 67, 146, 87, 342, 88, 106, - 68, 107, 87, 545, 88, 593, 591, 567, 87, 89, - 88, 87, 87, 88, 88, 89, 87, 535, 88, 683, - 0, 89, 535, 0, 89, 89, 535, 0, 66, 89, - 636, 530, 87, 0, 88, 0, 532, 532, 67, 60, - 176, 145, 0, 145, 68, 89, 575, 573, 531, 531, - 61, 0, 649, 532, 0, 637, 635, 546, 544, 177, - 0, 178, 176, 532, 481, 531, 0, 0, 532, 87, - 0, 88, 532, 67, 87, 531, 88, 532, 0, 68, - 531, 177, 89, 415, 531, 270, 268, 89, 87, 531, - 88, 87, 0, 88, 239, 238, 450, 449, 87, 0, - 88, 89, 176, 87, 89, 88, 176, 176, 288, 289, - 0, 89, 288, 289, 269, 678, 89, 482, 480, 0, - -107, 177, 0, 178, -107, 177, 177, 178, 415, 679, - 677, 0, 293, 294, 0, 290, 291, 0, 0, 290, - 291, 295, 293, 294, 296, 0, 297, 0, 293, 294, - 0, 295, 293, 294, 296, 0, 297, 295, 293, 294, - 296, 295, 297, 676, 296, 0, 297, 295, 80, 81, - 296, 0, 297, 0, 0, 0, 82, 83, 80, 81, - 84, 35, 85, 0, 0, 35, 82, 83, 0, 0, - 84, 0, 85, 35, 80, 81, 35, 0, 0, 35, - 75, 76, 82, 83, 35, 0, 84, 35, 85, 0, - 6, 5, 4, 1, 3, 2, 0, 0, 49, 52, - 50, 0, 49, 52, 50, 0, 0, 77, 78, 0, - 49, 52, 50, 49, 52, 50, 49, 52, 50, 0, - 35, 49, 52, 50, 49, 52, 50, 35, 46, 34, - 51, 0, 46, 34, 51, 35, 0, 0, 35, 0, - 46, 34, 51, 46, 34, 51, 46, 34, 51, 0, - 0, 46, 34, 51, 46, 34, 51, 49, 52, 50, - 35, 0, 0, 0, 49, 52, 50, 0, 0, 0, - 80, 81, 49, 52, 50, 49, 52, 50, 82, 83, - 0, 0, 84, 35, 85, 0, 537, 46, 34, 51, - 186, 0, 0, 0, 46, 34, 51, 49, 52, 50, - 35, 0, 46, 34, 51, 46, 34, 51, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 537, - 49, 52, 50, 0, 0, 0, 537, 46, 34, 51, - 537, 0, 0, 35, 537, 0, 35, 49, 52, 50, - 35, 0, 0, 186, 35, 0, 0, 0, 35, 0, - 46, 34, 51, 0, 0, 35, 0, 0, 35, 0, - 0, 0, 0, 0, 0, 0, 0, 46, 34, 51, - 49, 52, 50, 49, 52, 50, 0, 49, 52, 50, - 0, 49, 52, 50, 0, 49, 52, 50, 0, 0, - 258, 257, 49, 52, 50, 49, 52, 50, 35, 0, - 46, 34, 51, 46, 34, 51, 0, 46, 34, 51, - 35, 46, 34, 51, 0, 46, 34, 51, 35, 0, - 0, 35, 46, 34, 51, 46, 34, 51, 0, 0, - 253, 252, 0, 0, 35, 49, 52, 50, 0, 0, - 0, 186, 253, 252, 0, 0, 0, 49, 52, 50, - 258, 257, 0, 258, 257, 49, 52, 50, 49, 52, - 50, 0, 0, 0, 0, 46, 34, 51, 0, 0, - 155, 49, 52, 50, 0, 0, 0, 46, 34, 51, - 156, 0, 0, 0, 157, 46, 34, 51, 46, 34, - 51, 0, 0, 158, 0, 159, 0, 0, 0, 0, - 0, 46, 34, 51, 0, 0, 160, 0, 161, 64, - 0, 0, 0, 35, 0, 0, 162, 0, 0, 163, - 65, 0, 0, 0, 0, 164, 0, 0, 0, 0, - 0, 165, 0, 0, 0, 0, 0, 0, 0, 155, - 0, 0, 0, 0, 0, 253, 252, 166, 0, 156, - 49, 52, 50, 157, 0, 0, 0, 0, 0, 0, - 0, 0, 158, 0, 159, 0, 0, 322, 0, 0, - 0, 0, 0, 0, 0, 160, 0, 161, 64, 0, - 46, 34, 51, 0, 0, 162, 0, 0, 163, 65, - 0, 0, 155, 0, 164, 0, 0, 0, 0, 0, - 165, 0, 156, 0, 0, 0, 157, 0, 0, 0, - 0, 0, 0, 0, 0, 158, 166, 159, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 160, 0, - 161, 64, 0, 0, 0, 0, 0, 0, 162, 0, - 0, 163, 65, 0, 0, 0, 0, 164, 0, 0, - 0, 0, 0, 165, 0, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 166, - 0, 0, 35, 0, 0, 0, 36, 37, 0, 38, - 0, 0, 0, 0, 0, 0, 521, 0, 0, 0, - 45, 0, 0, 0, 0, 0, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 33, 53, 49, - 52, 50, 0, 54, 35, 0, 0, 0, 36, 37, - 0, 38, 0, 0, 44, 56, 32, 0, 42, 0, - 0, 41, 45, 0, 0, 0, 0, 0, 0, 46, - 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, - 53, 49, 52, 50, 0, 54, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 44, 56, 32, 0, - 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, - 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, - 35, 0, 0, 0, 36, 37, 0, 38, 0, 0, - 0, 0, 0, 0, 42, 0, 0, 0, 45, 0, + 632, 945, 905, 912, 881, 906, 757, 908, 447, 818, + 904, 926, 463, 614, 479, 602, 895, -160, -162, 454, + 926, 606, 587, 608, 797, 302, 105, 757, 899, 901, + 624, 907, 919, 781, 105, 654, 105, 898, 169, 454, + 447, 717, 662, 958, 942, 951, 716, 454, 707, 961, + 757, 105, 853, 824, 169, -539, 667, 649, 759, 105, + 479, 647, 703, 926, 105, 465, 465, 926, 479, 926, + 608, 304, 105, 310, 848, 775, 490, 169, 105, 302, + 485, 328, -103, 296, 491, 303, 482, 843, 334, 193, + 496, 223, 733, 169, 223, 290, 516, 169, 198, 105, + 105, 223, 169, 500, 289, 373, 454, 169, 507, 402, + 396, 432, 223, 375, 402, 402, 402, 426, 402, 422, + 424, 408, 410, 418, 287, 406, 105, 447, 454, 449, + 223, 370, 459, 368, 223, 223, 465, 479, 105, 223, + 351, 169, 574, 581, 587, 105, 561, 557, 170, 169, + 521, 350, 430, 581, 193, 328, 512, 357, -537, 810, + 463, 430, 529, 226, 589, 529, 223, 229, 100, -499, + 589, 162, 529, 536, 211, 170, 223, 525, -107, 430, + 368, 195, 535, 208, 548, 302, 554, 430, 902, 105, + 195, 347, 346, 198, 201, 330, -164, 851, 550, 331, + 208, 645, 923, 198, 963, 962, 914, 378, 851, 889, + 92, 577, 576, 198, 793, 820, 198, 852, 198, 532, + -541, 93, 198, 86, 865, 864, 86, 625, 646, 807, + 345, 344, 340, 339, 87, 903, 198, 87, 86, 198, + 990, 989, 520, 519, 198, 388, 626, 198, 704, 87, + 924, 679, 547, 1001, 1000, 381, 890, 689, 86, 808, + 683, 794, 821, 610, 533, 353, 548, 611, 559, 87, + 563, 699, 443, 442, 523, 923, 771, 1008, 748, 747, + -107, 977, 978, 953, 630, 1007, 1006, 379, 186, 482, + 187, 514, 622, 746, 745, 597, 977, 978, 680, -164, + 705, 188, 356, 354, 844, 690, 625, 935, 954, 952, + 694, 965, 910, 186, 95, 187, 198, -542, 849, -164, + 917, 743, 95, 972, 0, 626, 188, 627, 744, 223, + -207, 198, 849, 355, 186, -208, 187, 926, 368, 402, + 186, -373, 187, 891, 223, 849, -373, 188, -164, 95, + 849, 892, 846, 188, 868, 0, 368, 0, 0, 96, + 846, 936, 934, 893, 845, 97, 846, 96, 208, 543, + 542, 849, 845, 97, 918, 916, 0, 186, 845, 187, + 846, 1004, 1003, -207, 199, 197, 173, 174, -208, 0, + 188, -373, 845, 846, 96, 173, 174, 616, 846, 0, + 97, 616, 0, 539, 198, 845, 0, 0, 869, 867, + 845, 173, 174, 175, 176, 0, 617, 0, 743, 846, + 617, 616, 175, 176, 616, 744, 0, 0, 966, 0, + 1002, 845, 364, 365, 997, 722, 723, 591, 175, 176, + 617, 0, 714, 617, 441, 618, 616, 0, 998, 996, + 179, 180, 0, 722, 723, 0, 592, 0, 593, 182, + 179, 180, 183, 616, 184, 617, 0, 714, 0, 182, + 0, 0, 183, 616, 184, 6, 5, 4, 1, 3, + 2, -80, 617, 0, 618, 61, 75, 179, 180, 61, + 75, -80, 617, 0, 618, 181, 182, 995, 0, 183, + 857, 184, 0, 857, 752, 0, 179, 180, 0, 61, + 75, 0, 61, 75, 181, 182, 208, 0, 183, 0, + 184, 0, 173, 174, 857, 61, 75, 753, 857, 0, + 0, 0, 0, 0, 61, 75, 0, 0, 0, 860, + 863, 861, 860, 863, 861, 0, 0, 0, 0, 175, + 176, 61, 75, 0, 0, 0, 0, 754, 0, 0, + 0, 61, 75, 860, 863, 861, 0, 860, 863, 861, + 0, 151, 0, 855, 52, 0, 855, 0, 0, 0, + 364, 365, 858, 856, 862, 858, 856, 862, 0, 0, + 0, 0, 441, 52, 0, 859, 0, 855, 859, 0, + 0, 855, 0, 0, 0, 0, 858, 856, 862, 52, + 858, 856, 862, 68, 71, 69, 0, 0, 0, 859, + 0, 0, 0, 859, 0, 0, 0, 0, 0, 0, + 851, 0, 68, 71, 69, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 857, 72, 0, 49, 68, 71, + 69, 0, 0, 0, 0, 43, 64, 51, 70, 0, + 0, 52, 0, 0, 72, 0, 49, 0, 0, 65, + 0, 0, 0, 0, 43, 64, 51, 70, 0, 52, + 72, 0, 49, 860, 863, 861, 447, 0, 65, 0, + 43, 64, 51, 70, 0, 0, 0, 0, 0, 0, + 68, 71, 69, 0, 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 52, 0, 0, 855, 68, 71, + 69, 0, 0, 0, 0, 0, 858, 856, 862, 0, + 0, 463, 72, 0, 49, 0, 0, 52, 0, 859, + 0, 52, 43, 64, 51, 70, 0, 0, 0, 0, + 72, 0, 49, 68, 71, 69, 65, 0, 0, 0, + 43, 64, 51, 70, 0, 0, 0, 0, 0, 0, + 0, 444, 0, 0, 65, 0, 68, 71, 69, 0, + 68, 71, 69, 0, 463, 72, 0, 49, 52, 0, + 0, 0, 219, 220, 0, 43, 64, 51, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 72, 65, + 49, 52, 72, 0, 49, 219, 220, 0, 43, 64, + 51, 70, 43, 64, 51, 70, 0, 68, 71, 69, + 0, 0, 65, 0, 52, 0, 65, 0, 52, 0, + 0, 772, 0, 0, 0, 447, 0, 0, 0, 0, + 68, 71, 69, 0, 0, 0, 0, 0, 0, 72, + 0, 49, 0, 0, 0, 0, 0, 0, 773, 43, + 64, 51, 70, 68, 71, 69, 0, 68, 71, 69, + 0, 0, 72, 65, 49, 0, 0, 0, 0, 0, + 0, 0, 43, 64, 51, 70, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 72, 65, 49, 0, 72, + 52, 49, 0, 0, 52, 43, 64, 51, 70, 43, + 64, 51, 70, 0, 0, 0, 0, 0, 0, 65, + 52, 0, 0, 65, 0, 52, 0, 645, 0, 219, + 220, 0, 343, 342, 0, 0, 338, 337, 0, 68, + 71, 69, 0, 68, 71, 69, 0, 0, 0, 0, + 0, 0, 0, 0, 646, 0, 0, 0, 0, 68, + 71, 69, 0, 0, 68, 71, 69, 0, 0, 0, + 0, 72, 0, 49, 0, 72, 0, 49, 0, 0, + 0, 43, 64, 51, 70, 43, 64, 51, 70, 0, + 0, 72, 0, 49, 0, 65, 72, 0, 49, 65, + 0, 43, 64, 51, 70, 0, 43, 64, 51, 70, + 0, 0, 0, 0, 0, 65, 0, 52, 0, 0, + 65, 807, 52, 0, 0, 0, 219, 220, 0, 313, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 314, + 0, 0, 0, 385, 0, 0, 0, 0, 0, 0, + 0, 808, 316, 0, 317, 759, 68, 71, 69, 0, + 0, 68, 71, 69, 0, 318, 0, 319, 92, 0, + 0, 0, 0, 0, 0, 320, 0, 0, 321, 93, + 0, 0, 0, 0, 322, 0, 0, 0, 72, 0, + 49, 324, 323, 72, 0, 49, 0, 0, 43, 64, + 51, 70, 0, 43, 64, 51, 70, 0, 325, 0, + 0, 0, 65, 0, 0, 313, 0, 65, 0, 52, + 0, 0, 0, 219, 220, 314, 0, 0, 0, 385, + 0, 0, 0, 0, 0, 0, 0, 0, 316, 0, + 317, 0, 0, 378, 0, 0, 0, 0, 0, 0, + 0, 318, 0, 319, 92, 0, 0, 0, 68, 71, + 69, 320, 0, 0, 321, 93, 0, 0, 0, 0, + 322, 0, 0, 0, 0, 0, 0, 324, 323, 0, + 0, 0, 0, 0, 0, 218, 0, 0, 0, 0, + 72, 0, 49, 0, 325, 0, 0, 0, 0, 0, + 43, 64, 51, 70, 0, 0, 0, 0, 0, 0, + 0, 0, 46, 47, 65, 0, 313, 0, 0, 0, + 0, 0, 50, 379, 0, 0, 314, 0, 0, 52, + 315, 0, 0, 53, 54, 0, 55, 0, 0, 316, + 0, 317, 0, 835, 0, 0, 0, 63, 0, 0, + 0, 0, 318, 0, 319, 92, 0, 0, 0, 0, + 0, 0, 320, 0, 0, 321, 93, 73, 68, 71, + 69, 322, 76, 0, 0, 0, 0, 0, 324, 323, + 0, 0, 0, 62, 78, 48, 0, 0, 0, 0, + 58, 0, 0, 0, 0, 325, 0, 74, 44, 0, + 72, 0, 49, 61, 75, 0, 0, 0, 0, 0, + 43, 64, 51, 70, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, + 47, 0, 0, 0, 0, 0, 0, 0, 0, 50, + 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, + 53, 54, 0, 55, 0, 0, 0, 0, 0, 0, + 835, 0, 0, 0, 63, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 73, 68, 71, 69, 0, 76, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 62, 78, 48, 0, 0, 0, 0, 58, 0, 0, + 0, 0, 0, 0, 74, 44, 0, 72, 0, 49, + 61, 75, 0, 0, 0, 0, 0, 43, 64, 51, + 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 65, 0, 46, 47, 0, 0, 0, 0, 0, + 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, + 52, 0, 0, 0, 53, 54, 0, 55, 0, 0, + 0, 0, 0, 0, 59, 0, 0, 0, 63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 73, 68, + 71, 69, 0, 76, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 62, 78, 48, 0, 0, 0, + 0, 58, 0, 0, 0, 0, 0, 0, 74, 44, + 0, 72, 0, 49, 61, 75, 0, 0, 0, 0, + 0, 43, 64, 51, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 65, 0, 46, 47, 0, + 713, 0, 0, 0, 0, 0, 0, 50, 0, 0, + 0, 0, 0, 0, 52, 0, 0, 0, 53, 54, + 0, 55, 0, 0, 0, 0, 0, 0, 835, 0, + 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 53, 49, 52, 50, - 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 44, 56, 32, 0, 0, 0, 0, 41, - 0, 0, 0, 0, 0, 0, 0, 46, 34, 51, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, - 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, - 36, 37, 0, 38, 0, 0, 0, 0, 0, 0, - 521, 0, 0, 0, 45, 0, 0, 0, 0, 0, + 0, 0, 73, 68, 71, 69, 0, 76, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 62, 78, + 48, 0, 0, 0, 0, 58, 0, 0, 0, 0, + 0, 0, 74, 44, 0, 72, 0, 49, 61, 75, + 0, 0, 0, 0, 0, 43, 64, 51, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 0, 46, 47, 0, 713, 0, 0, 0, 0, 0, + 0, 50, 0, 0, 0, 0, 0, 0, 52, 0, + 0, 0, 53, 54, 0, 55, 0, 0, 0, 0, + 0, 0, 59, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 53, 49, 52, 50, 0, 54, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 44, 56, - 32, 0, 0, 0, 0, 41, 0, 0, 0, 0, - 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 519, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 221, 0, 0, - 0, 0, 0, 0, 35, 0, 0, 0, 36, 37, - 0, 38, 0, 0, 0, 0, 0, 0, 521, 0, - 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 73, 68, 71, 69, + 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 62, 78, 48, 0, 0, 0, 0, 58, + 0, 0, 0, 0, 0, 0, 74, 44, 0, 72, + 0, 49, 61, 75, 0, 0, 0, 0, 0, 43, + 64, 51, 70, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 0, 832, 0, 46, 47, 0, + 0, 0, 0, 0, 0, 0, 0, 834, 0, 0, + 0, 0, 0, 0, 52, 0, 0, 0, 53, 54, + 0, 55, 0, 0, 0, 0, 0, 0, 835, 0, + 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 53, 522, 524, 523, 0, 54, 0, 0, 0, 0, - 230, 0, 0, 0, 0, 0, 44, 56, 32, 216, - 224, 0, 0, 41, 0, 0, 520, 0, 0, 0, - 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 519, 0, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 221, 0, 0, 0, 0, - 0, 0, 35, 0, 0, 0, 36, 37, 0, 38, - 0, 0, 0, 0, 0, 0, 521, 0, 0, 0, - 45, 0, 0, 0, 0, 0, 0, 0, 585, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 53, 522, - 524, 523, 0, 54, 0, 0, 0, 0, 230, 0, - 0, 0, 0, 0, 44, 56, 32, 216, 224, 0, - 0, 41, 0, 0, 520, 0, 0, 0, 0, 46, - 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 519, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 221, 0, 0, 0, 0, 0, 0, - 35, 0, 0, 0, 36, 37, 0, 38, 0, 0, - 0, 0, 0, 0, 521, 0, 0, 0, 45, 0, - 0, 0, 0, 0, 0, 0, 588, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 53, 522, 524, 523, - 0, 54, 0, 0, 0, 0, 230, 0, 0, 0, - 0, 0, 44, 56, 32, 216, 224, 0, 0, 41, - 0, 0, 520, 0, 0, 0, 0, 46, 34, 51, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, - 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, - 33, 0, 0, 0, 0, 0, 0, 35, 0, 0, - 0, 36, 37, 0, 38, 0, 0, 0, 39, 0, - 40, 42, 43, 0, 0, 45, 0, 0, 0, 47, - 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 53, 49, 52, 50, 0, 54, 0, - 55, 0, 57, 0, 58, 0, 0, 0, 0, 44, - 56, 32, 0, 0, 0, 0, 41, 0, 0, 0, - 0, 0, 0, 0, 46, 34, 51, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -141, 0, 0, 0, - 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 33, 0, 0, 0, 0, 0, 0, 35, 0, - 0, 0, 36, 37, 0, 38, 0, 0, 0, 39, - 0, 40, 42, 43, 0, 0, 45, 0, 0, 0, - 47, 0, 48, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 53, 49, 52, 50, 0, 54, - 0, 55, 0, 57, 0, 58, 0, 0, 0, 0, - 44, 56, 32, 0, 0, 0, 0, 41, 0, 0, - 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, - 43, 0, 0, 45, 0, 0, 0, 47, 0, 48, + 0, 0, 73, 836, 838, 837, 0, 76, 0, 0, + 0, 0, 151, 0, 0, 0, 0, 0, 62, 78, + 48, 0, 0, 0, 0, 58, 0, 0, 0, 833, + 0, 0, 74, 44, 0, 72, 0, 49, 61, 75, + 0, 0, 0, 0, 0, 43, 64, 51, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 0, 832, 0, 46, 47, 0, 0, 0, 0, 0, + 0, 0, 0, 834, 0, 0, 0, 0, 0, 0, + 52, 0, 0, 0, 53, 54, 0, 55, 0, 0, + 0, 0, 0, 0, 835, 0, 0, 0, 63, 0, + 0, 0, 0, 0, 0, 0, 928, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 73, 836, + 838, 837, 0, 76, 0, 0, 0, 0, 151, 0, + 0, 0, 0, 0, 62, 78, 48, 0, 0, 0, + 0, 58, 0, 0, 0, 833, 0, 0, 74, 44, + 0, 72, 0, 49, 61, 75, 0, 0, 0, 0, + 0, 43, 64, 51, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 65, 0, 832, 0, 46, + 47, 0, 0, 0, 0, 0, 0, 0, 0, 834, + 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, + 53, 54, 0, 55, 0, 0, 0, 0, 0, 0, + 835, 0, 0, 0, 63, 0, 0, 0, 0, 0, + 0, 0, 931, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 73, 836, 838, 837, 0, 76, + 0, 0, 0, 0, 151, 0, 0, 0, 0, 0, + 62, 78, 48, 0, 0, 0, 0, 58, 0, 0, + 0, 833, 0, 0, 74, 44, 0, 72, 0, 49, + 61, 75, 0, 0, 0, 0, 0, 43, 64, 51, + 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 65, 0, 45, 46, 47, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, + 0, 52, 0, 0, 0, 53, 54, 0, 55, 0, + 0, 0, 56, 0, 57, 59, 60, 0, 0, 63, + 0, 0, 0, 66, 0, 67, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, + 68, 71, 69, 0, 76, 0, 77, 0, 79, 0, + 80, 0, 0, 0, 0, 62, 78, 48, 0, 0, + 0, 0, 58, 0, 0, 0, 0, 0, 0, 74, + 44, 0, 72, 0, 49, 61, 75, 0, 0, 0, + 0, 0, 43, 64, 51, 70, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 65, 0, 45, 46, + 47, 0, 0, 0, 0, 0, 0, 0, 0, 50, + 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, + 53, 54, 0, 55, 0, 0, 0, 56, 0, 57, + 59, 60, 0, 0, 63, 0, 0, 0, 66, 0, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 73, 68, 71, 69, 0, 76, + 0, 77, 0, 79, 0, 80, 0, 0, 0, 0, + 62, 78, 48, 0, 0, 0, 0, 58, 0, 0, + 0, 0, 0, 81, 74, 44, 0, 72, 0, 49, + 61, 75, 0, 0, 0, 0, 0, 43, 64, 51, + 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 65, 0, 45, 46, 47, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, + 0, 52, 0, 0, 0, 53, 54, 0, 55, 0, + 0, 0, 56, 0, 57, 59, 60, 0, 0, 63, + 0, 0, 0, 66, 0, 67, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, + 68, 71, 69, 0, 76, 0, 77, 0, 79, 0, + 80, 0, 0, 0, 0, 62, 78, 48, 0, 0, + 0, 0, 58, 0, 0, 0, 0, 0, 154, 74, + 44, 0, 72, 0, 49, 61, 75, 0, 0, 0, + 0, 0, 43, 64, 51, 70, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 65, 0, 45, 46, + 47, 0, 0, 0, 0, 0, 0, 0, 0, 50, + 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, + 53, 54, 0, 55, 0, 0, 0, 56, 0, 57, + 59, 60, 0, 0, 63, 0, 0, 0, 66, 0, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 73, 68, 71, 69, 0, 76, + 0, 77, 0, 79, 0, 80, 0, 0, 0, 0, + 62, 78, 48, 0, 0, 0, 0, 58, 0, 0, + 0, 0, 601, 154, 74, 44, 0, 72, 0, 49, + 61, 75, 0, 0, 0, 0, 0, 43, 64, 51, + 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 65, 0, 310, 0, 0, 45, 46, 47, 0, + 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, + 0, 0, 0, 0, 52, 0, 0, 0, 53, 54, + 0, 55, 0, 0, 0, 56, 0, 57, 59, 60, + 0, 0, 63, 0, 0, 0, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, - 57, 285, 58, 0, 0, 0, 0, 44, 56, 32, - 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, - 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 492, 0, 0, 29, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, - 43, 0, 0, 45, 0, 0, 0, 47, 0, 48, - 0, 0, 493, 0, 0, 0, 0, 0, 0, 0, - 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, - 57, 0, 58, 0, 0, 0, 0, 44, 56, 32, - 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, - 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 500, 0, 0, 29, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, - 43, 0, 0, 45, 0, 0, 0, 47, 0, 48, - 0, 0, 503, 0, 0, 0, 0, 0, 0, 0, - 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, - 57, 0, 58, 0, 0, 0, 0, 44, 56, 32, - 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, - 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 492, 0, 0, 29, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, - 43, 0, 0, 45, 0, 0, 0, 47, 0, 48, - 0, 0, 498, 0, 0, 0, 0, 0, 0, 0, - 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, - 57, 0, 58, 0, 0, 0, 0, 44, 56, 32, - 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, - 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 500, 0, 0, 29, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, - 43, 0, 0, 45, 0, 0, 0, 47, 0, 48, - 0, 0, 501, 0, 0, 0, 0, 0, 0, 0, - 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, - 57, 0, 58, 0, 0, 0, 0, 44, 56, 32, - 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, - 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, - 0, 0, 35, 222, 0, 0, 223, 37, 0, 38, - 0, 0, 0, 39, 0, 40, 42, 43, 0, 0, - 45, 0, 0, 0, 47, 0, 48, 0, 0, 0, - 0, 0, 0, 0, 226, 0, 0, 0, 53, 49, - 52, 50, 227, 54, 0, 55, 229, 57, 0, 58, - 0, 232, 0, 0, 44, 56, 32, 0, 0, 0, - 0, 41, 0, 0, 0, 0, 0, 0, 0, 46, - 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 35, - 222, 0, 0, 603, 650, 0, 38, 0, 0, 0, - 39, 0, 40, 42, 43, 0, 0, 45, 0, 0, - 0, 47, 0, 48, 0, 0, 0, 0, 0, 0, - 0, 226, 0, 0, 0, 53, 49, 52, 50, 227, - 54, 0, 55, 229, 57, 0, 58, 0, 232, 0, - 0, 44, 56, 32, 0, 0, 0, 0, 41, 0, - 0, 0, 0, 0, 0, 0, 46, 34, 51, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, - 0, 0, 0, 0, 0, 0, 35, 222, 0, 0, - 603, 37, 0, 38, 0, 0, 0, 39, 0, 40, - 42, 43, 0, 0, 45, 0, 0, 0, 47, 0, - 48, 0, 0, 0, 0, 0, 0, 0, 226, 0, - 0, 0, 53, 49, 52, 50, 227, 54, 0, 55, - 229, 57, 0, 58, 0, 232, 0, 0, 44, 56, - 32, 0, 0, 0, 0, 41, 0, 0, 0, 0, - 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 111, 112, 113, 0, 0, - 115, 117, 118, 0, 0, 119, 0, 120, 0, 0, - 0, 123, 124, 125, 0, 0, 0, 0, 0, 0, - 35, 126, 127, 128, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 130, 0, 0, 0, 0, 0, + 0, 0, 73, 68, 71, 69, 0, 76, 0, 77, + 0, 79, 0, 80, 0, 0, 0, 0, 62, 78, + 48, 0, 0, 0, 0, 58, 0, 0, 0, 0, + 0, 154, 74, 44, 0, 72, 0, 49, 61, 75, + 0, 0, 0, 0, 0, 43, 64, 51, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 0, 45, 46, 47, 0, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 0, 0, 0, 0, 52, + 0, 0, 0, 53, 54, 0, 55, 0, 0, 0, + 56, 0, 57, 59, 60, 0, 0, 63, 0, 0, + 0, 66, 0, 67, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 73, 68, 71, + 69, 0, 76, 0, 77, 0, 79, 0, 80, 0, + 0, 0, 0, 62, 78, 48, 0, 0, 0, 0, + 58, 0, 0, 0, 0, 218, 154, 74, 44, 0, + 72, 0, 49, 61, 75, 0, 0, 0, 0, 0, + 43, 64, 51, 70, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 65, 0, 45, 46, 47, 0, + 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, + 0, 0, 0, 0, 52, 0, 0, 0, 53, 54, + 0, 55, 0, 0, 0, 56, 0, 57, 59, 60, + 0, 0, 63, 0, 0, 0, 66, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 133, 0, 0, 0, 0, 0, 0, 49, 52, 50, - 134, 135, 136, 0, 138, 139, 140, 141, 142, 143, - 0, 0, 131, 137, 122, 114, 129, 116, 132, 0, - 0, 0, 121, 0, 0, 0, 0, 46, 34, 51, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, - 112, 113, 0, 0, 115, 117, 118, 0, 0, 119, - 0, 120, 0, 0, 0, 123, 124, 125, 0, 0, - 0, 0, 0, 0, 35, 126, 127, 128, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 130, 0, - 0, 0, 399, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, - 401, 49, 52, 50, 134, 135, 136, 0, 138, 139, - 140, 141, 142, 143, 0, 0, 131, 137, 122, 114, - 129, 116, 132, 0, 0, 0, 121, 0, 0, 0, - 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 111, 112, 113, 0, 0, 115, 117, - 118, 0, 0, 119, 0, 120, 0, 0, 0, 123, - 124, 125, 0, 0, 0, 0, 0, 0, 35, 126, - 127, 128, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 130, 0, 0, 0, 399, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, - 0, 0, 0, 0, 401, 49, 52, 50, 134, 135, - 136, 0, 138, 139, 140, 141, 142, 143, 0, 0, - 131, 137, 122, 114, 129, 116, 132, 0, 0, 0, - 121, 0, 0, 0, 0, 46, 377, 384, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 111, 112, 113, - 0, 0, 115, 117, 118, 0, 0, 119, 0, 120, - 0, 0, 0, 123, 124, 125, 0, 0, 0, 0, - 0, 0, 35, 126, 127, 128, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 130, 0, 0, 0, - 399, 0, 0, 0, 0, 0, 0, 0, 400, 0, - 0, 0, 133, 0, 0, 0, 0, 0, 401, 49, - 52, 50, 134, 135, 136, 0, 138, 139, 140, 141, - 142, 143, 0, 0, 131, 137, 122, 114, 129, 116, - 132, 0, 0, 0, 121, 0, 0, 0, 0, 46, - 377, 384, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 215, 0, 0, 0, 0, 217, 0, 29, 30, - 31, 219, 0, 0, 0, 0, 0, 0, 220, 33, - 0, 0, 0, 0, 0, 0, 35, 222, 0, 0, - 223, 37, 0, 38, 0, 0, 0, 39, 0, 40, - 42, 43, 0, 0, 45, 0, 0, 0, 47, 0, - 48, 0, 0, 0, 0, 0, 225, 0, 226, 0, - 0, 0, 53, 49, 52, 50, 227, 54, 228, 55, - 229, 57, 230, 58, 231, 232, 0, 0, 44, 56, - 32, 216, 224, 218, 0, 41, 0, 0, 0, 0, - 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 215, 0, 0, 0, 0, - 217, 0, 29, 30, 31, 219, 0, 0, 0, 0, - 0, 0, 220, 221, 0, 0, 0, 0, 0, 0, - 35, 222, 0, 0, 223, 37, 0, 38, 0, 0, - 0, 39, 0, 40, 42, 43, 0, 0, 45, 0, - 0, 0, 47, 0, 48, 0, 0, 0, 0, 0, - 225, 0, 226, 0, 0, 0, 53, 49, 52, 50, - 227, 54, 228, 55, 229, 57, 230, 58, 231, 232, - 0, 0, 44, 56, 32, 216, 224, 218, 0, 41, - 0, 0, 0, 0, 0, 0, 0, 46, 34, 51, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 607, - 112, 113, 0, 0, 609, 117, 611, 30, 31, 612, - 0, 120, 0, 0, 0, 123, 614, 615, 0, 0, - 0, 0, 0, 0, 35, 616, 127, 128, 223, 37, - 0, 38, 0, 0, 0, 39, 0, 40, 618, 43, - 0, 0, 620, 0, 0, 0, 47, 0, 48, 0, - 0, 0, 0, 0, 621, 0, 226, 0, 0, 0, - 622, 49, 52, 50, 623, 624, 625, 55, 627, 628, - 629, 630, 631, 632, 0, 0, 619, 626, 613, 608, - 617, 610, 132, 41, 0, 0, 121, 0, 0, 0, - 0, 46, 377, 384, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 368, 112, 113, 0, 0, 370, 117, - 372, 30, 31, 373, 0, 120, 0, 0, 0, 123, - 375, 376, 0, 0, 0, 0, 0, 0, 35, 378, - 127, 128, 223, 37, 0, 38, 0, 0, 0, 39, - 0, 40, 380, 43, 0, 0, 382, 0, 0, 0, - 47, 0, 48, 0, -288, 0, 0, 0, 383, 0, - 226, 0, 0, 0, 385, 49, 52, 50, 386, 387, - 388, 55, 390, 391, 392, 393, 394, 395, 0, 0, - 381, 389, 374, 369, 379, 371, 132, 41, 0, 0, - 121, 0, 0, 0, 0, 46, 377, 384, 0, 0, - 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 68, 71, 69, 0, 76, 0, 77, + 0, 79, 0, 80, 0, 0, 0, 0, 62, 78, + 48, 0, 0, 0, 0, 58, 0, 0, 0, 0, + 604, 154, 74, 44, 0, 72, 0, 49, 61, 75, + 0, 0, 0, 0, 0, 43, 64, 51, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 0, 302, 0, 0, 45, 46, 47, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, + 0, 0, 52, 0, 0, 0, 53, 54, 0, 55, + 0, 0, 0, 56, 0, 57, 59, 60, 0, 0, + 63, 0, 0, 0, 66, 0, 67, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 73, 68, 71, 69, 0, 76, 0, 77, 0, 79, + 0, 80, 0, 0, 0, 0, 62, 78, 48, 0, + 0, 0, 0, 58, 0, 0, 0, 0, 0, 154, + 74, 44, 0, 72, 0, 49, 61, 75, 0, 0, + 0, 0, 0, 43, 64, 51, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 0, 45, + 46, 47, 0, 0, 0, 0, 0, 0, 0, 0, + 50, 0, 0, 0, 0, 0, 0, 52, 0, 0, + 0, 53, 54, 0, 55, 0, 0, 0, 56, 0, + 57, 59, 60, 0, 0, 63, 0, 0, 0, 66, + 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 566, 0, 0, 0, 73, 68, 71, 69, 0, + 76, 0, 77, 0, 79, 0, 80, 0, 0, 0, + 0, 62, 78, 48, 0, 0, 0, 0, 58, 0, + 0, 0, 0, 0, 154, 74, 44, 0, 72, 0, + 49, 61, 75, 0, 0, 0, 0, 0, 43, 64, + 51, 70, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 65, 0, 45, 46, 47, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, + 0, 0, 52, 0, 0, 0, 53, 54, 0, 55, + 0, 0, 0, 56, 0, 57, 59, 60, 0, 0, + 63, 0, 0, 0, 66, 0, 67, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 73, 68, 71, 69, 0, 76, 0, 77, 0, 79, + 0, 80, 0, 0, 0, 0, 62, 78, 48, 0, + 0, 0, 0, 58, 0, 0, 0, 0, 0, 154, + 74, 44, 0, 72, 0, 49, 61, 75, 0, 0, + 0, 0, 0, 43, 64, 51, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 165, 0, 65, 0, 45, + 46, 47, 0, 0, 0, 0, 0, 0, 0, 0, + 50, 0, 0, 0, 0, 0, 0, 52, 0, 0, + 0, 53, 54, 0, 55, 0, 0, 0, 56, 0, + 57, 59, 60, 0, 0, 63, 0, 0, 0, 66, + 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 73, 68, 71, 69, 0, + 76, 0, 77, 0, 79, 0, 80, 0, 0, 0, + 0, 62, 78, 48, 0, 0, 0, 0, 58, 0, + 0, 0, 0, 0, 81, 74, 44, 0, 72, 0, + 49, 61, 75, 0, 0, 0, 0, 0, 43, 64, + 51, 70, 0, 0, 0, 0, 0, 0, 0, 0, + 103, 0, 65, 0, 45, 46, 47, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, + 0, 0, 52, 0, 0, 0, 53, 54, 0, 55, + 0, 0, 0, 56, 0, 57, 59, 60, 0, 0, + 63, 0, 0, 0, 66, 0, 67, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 731, 0, 0, 0, + 73, 68, 71, 69, 0, 76, 0, 77, 0, 79, + 0, 80, 0, 0, 0, 0, 62, 78, 48, 0, + 0, 0, 0, 58, 0, 0, 0, 0, 0, 81, + 74, 44, 0, 72, 0, 49, 61, 75, 0, 0, + 0, 0, 0, 43, 64, 51, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 0, 45, + 46, 47, 0, 0, 0, 0, 0, 0, 0, 0, + 50, 0, 0, 0, 0, 0, 0, 52, 0, 0, + 0, 53, 54, 0, 55, 0, 0, 0, 56, 0, + 57, 59, 60, 0, 0, 63, 0, 0, 0, 66, + 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 73, 68, 71, 69, 0, + 76, 0, 77, 0, 79, 0, 80, 0, 0, 0, + 0, 62, 78, 48, 0, 0, 0, 0, 58, 0, + 0, 0, 0, 0, 154, 74, 44, 0, 72, 0, + 49, 61, 75, 0, 0, 0, 0, 0, 43, 64, + 51, 70, 0, 0, 0, 0, 0, 0, 0, 762, + 0, 0, 65, 0, 45, 46, 47, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, + 0, 0, 52, 0, 0, 0, 53, 54, 0, 55, + 0, 0, 0, 56, 0, 57, 59, 60, 0, 0, + 63, 0, 0, 0, 66, 0, 67, 0, 0, 0, + 0, 0, 0, 702, 0, 0, 0, 0, 0, 0, + 73, 68, 71, 69, 0, 76, 0, 77, 0, 79, + 0, 80, 0, 0, 0, 0, 62, 78, 48, 0, + 0, 0, 0, 58, 0, 0, 0, 0, 218, 154, + 74, 44, 0, 72, 0, 49, 61, 75, 0, 0, + 0, 0, 0, 43, 64, 51, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 0, 45, + 46, 47, 0, 0, 0, 0, 0, 0, 0, 0, + 50, 0, 0, 0, 0, 0, 0, 52, 0, 0, + 0, 53, 54, 0, 55, 0, 0, 0, 56, 0, + 57, 59, 60, 0, 0, 63, 0, 0, 0, 66, + 0, 67, 0, 0, 695, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 73, 68, 71, 69, 0, + 76, 0, 77, 0, 79, 0, 80, 0, 0, 0, + 0, 62, 78, 48, 0, 0, 0, 0, 58, 0, + 0, 0, 0, 694, 154, 74, 44, 0, 72, 0, + 49, 61, 75, 0, 0, 0, 0, 0, 43, 64, + 51, 70, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 65, 0, 45, 46, 47, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, + 0, 0, 52, 0, 0, 0, 53, 54, 0, 55, + 0, 0, 0, 56, 0, 57, 59, 60, 0, 0, + 63, 0, 0, 0, 66, 0, 67, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 73, 68, 71, 69, 0, 76, 0, 77, 0, 79, + 151, 80, 0, 0, 0, 0, 62, 78, 48, 364, + 365, 0, 0, 58, 0, 0, 0, 0, 0, 81, + 74, 44, 0, 72, 0, 49, 61, 75, 0, 0, + 0, 0, 0, 43, 64, 51, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 0, 45, + 46, 47, 0, 0, 0, 0, 0, 0, 0, 0, + 50, 0, 0, 0, 0, 0, 0, 52, 145, 0, + 0, 53, 969, 0, 55, 0, 0, 0, 56, 0, + 57, 59, 60, 0, 0, 63, 0, 0, 0, 66, + 0, 67, 0, 0, 0, 0, 0, 0, 0, 147, + 0, 0, 0, 0, 0, 73, 68, 71, 69, 148, + 76, 0, 77, 150, 79, 0, 80, 0, 153, 0, + 0, 62, 78, 48, 0, 0, 0, 0, 58, 0, + 0, 0, 0, 0, 154, 74, 44, 0, 72, 0, + 49, 61, 75, 0, 0, 0, 0, 0, 43, 64, + 51, 70, 0, 0, 0, 0, 0, 0, 0, 877, + 876, 0, 65, 0, 45, 46, 47, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, + 0, 0, 52, 145, 0, 0, 53, 54, 0, 55, + 0, 0, 0, 56, 0, 57, 59, 60, 0, 0, + 63, 0, 0, 0, 66, 0, 67, 0, 0, 0, + 0, 0, 0, 0, 147, 0, 0, 0, 0, 0, + 73, 68, 71, 69, 148, 76, 0, 77, 150, 79, + 0, 80, 0, 153, 0, 0, 62, 78, 48, 0, + 0, 0, 0, 58, 0, 0, 0, 0, 0, 154, + 74, 44, 0, 72, 0, 49, 61, 75, 0, 0, + 0, 0, 0, 43, 64, 51, 70, 0, 0, 0, + 0, 0, 0, 0, 877, 876, 0, 65, 0, 245, + 246, 247, 0, 0, 250, 252, 253, 0, 0, 254, + 0, 255, 0, 0, 0, 260, 261, 262, 0, 0, + 0, 0, 0, 0, 52, 263, 265, 266, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 269, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 273, 0, 0, 0, 0, 0, + 0, 0, 0, 68, 71, 69, 276, 277, 278, 0, + 280, 281, 282, 283, 284, 285, 0, 0, 270, 279, + 259, 249, 268, 251, 272, 0, 0, 0, 0, 256, + 0, 0, 275, 248, 258, 72, 257, 49, 0, 0, + 0, 0, 0, 264, 0, 43, 64, 51, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 0, 245, 246, 247, 0, 0, 250, 252, 253, 0, + 0, 254, 0, 255, 0, 0, 0, 260, 261, 262, + 0, 0, 0, 0, 0, 0, 52, 263, 265, 266, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 269, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 792, 0, 0, 0, 273, 0, 0, 0, + 0, 0, 0, 0, 0, 68, 71, 69, 276, 277, + 278, 0, 280, 281, 282, 283, 284, 285, 0, 0, + 270, 279, 259, 249, 268, 251, 272, 0, 0, 0, + 0, 256, 0, 0, 275, 248, 258, 72, 257, 49, + 0, 0, 0, 0, 0, 264, 0, 43, 64, 51, + 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 65, 0, 245, 246, 247, 0, 0, 250, 252, + 253, 0, 0, 254, 0, 255, 0, 0, 0, 260, + 261, 262, 0, 0, 0, 0, 0, 0, 52, 263, + 265, 266, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 269, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 796, 0, 0, 0, 273, 0, + 0, 0, 0, 0, 0, 0, 0, 68, 71, 69, + 276, 277, 278, 0, 280, 281, 282, 283, 284, 285, + 0, 0, 270, 279, 259, 249, 268, 251, 272, 0, + 0, 0, 0, 256, 0, 0, 275, 248, 258, 72, + 257, 49, 0, 0, 0, 0, 0, 264, 0, 43, + 64, 51, 70, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 0, 245, 246, 247, 0, 0, + 250, 252, 253, 0, 0, 254, 0, 255, 0, 0, + 0, 260, 261, 262, 0, 0, 0, 0, 0, 0, + 52, 263, 265, 266, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 269, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 823, 0, 0, 0, + 273, 0, 0, 0, 0, 0, 0, 0, 0, 68, + 71, 69, 276, 277, 278, 0, 280, 281, 282, 283, + 284, 285, 0, 0, 270, 279, 259, 249, 268, 251, + 272, 0, 0, 0, 0, 256, 0, 0, 275, 248, + 258, 72, 257, 49, 0, 0, 0, 0, 0, 264, + 0, 43, 64, 51, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 65, 0, 245, 246, 247, + 0, 0, 250, 252, 253, 0, 0, 254, 0, 255, + 0, 0, 0, 260, 261, 262, 0, 0, 0, 0, + 0, 0, 52, 263, 265, 266, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 269, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 817, 0, + 0, 0, 273, 0, 0, 0, 0, 0, 0, 0, + 0, 68, 71, 69, 276, 277, 278, 0, 280, 281, + 282, 283, 284, 285, 0, 0, 270, 279, 259, 249, + 268, 251, 272, 0, 0, 0, 0, 256, 0, 0, + 275, 248, 258, 72, 257, 49, 0, 0, 0, 0, + 0, 264, 0, 43, 64, 51, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 0, 245, + 246, 247, 0, 0, 250, 252, 253, 0, 0, 254, + 0, 255, 0, 0, 0, 260, 261, 262, 0, 0, + 0, 0, 0, 0, 52, 263, 265, 266, 0, 267, + 0, 0, 0, 0, 0, 0, 0, 0, 269, 0, + 0, 0, 271, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 273, 0, 0, 0, 0, 0, + 0, 0, 274, 68, 71, 69, 276, 277, 278, 0, + 280, 281, 282, 283, 284, 285, 0, 0, 270, 279, + 259, 249, 268, 251, 272, 0, 0, 0, 0, 256, + 0, 0, 275, 248, 258, 72, 257, 49, 0, 0, + 0, 0, 0, 264, 0, 43, 64, 51, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 0, 245, 246, 247, 0, 0, 250, 252, 253, 0, + 0, 254, 0, 255, 0, 0, 0, 260, 261, 262, + 0, 0, 0, 0, 0, 0, 52, 263, 265, 266, + 0, 267, 0, 0, 0, 0, 0, 0, 0, 0, + 269, 0, 0, 0, 271, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 273, 0, 0, 0, + 476, 0, 0, 0, 274, 68, 71, 69, 276, 277, + 278, 0, 280, 281, 282, 283, 284, 285, 0, 0, + 270, 279, 259, 249, 268, 251, 272, 0, 0, 0, + 0, 256, 0, 0, 275, 248, 258, 72, 257, 49, + 0, 0, 0, 0, 0, 264, 0, 43, 64, 473, + 475, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 65, 0, 245, 246, 247, 0, 0, 250, 252, + 253, 0, 0, 254, 0, 255, 0, 0, 0, 260, + 261, 262, 0, 0, 0, 0, 0, 0, 52, 263, + 265, 266, 0, 267, 0, 0, 0, 0, 0, 0, + 0, 0, 269, 0, 0, 0, 271, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 273, 0, + 474, 0, 476, 0, 0, 0, 274, 68, 71, 69, + 276, 277, 278, 0, 280, 281, 282, 283, 284, 285, + 0, 0, 270, 279, 259, 249, 268, 251, 272, 0, + 0, 0, 0, 256, 0, 0, 275, 248, 258, 477, + 257, 49, 0, 0, 0, 0, 0, 264, 0, 43, + 64, 473, 475, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 0, 138, 0, 0, 0, 0, + 139, 0, 45, 46, 47, 141, 0, 0, 0, 0, + 0, 0, 142, 50, 0, 0, 0, 0, 0, 0, + 52, 145, 0, 0, 53, 54, 0, 55, 0, 0, + 0, 56, 0, 57, 59, 60, 0, 0, 63, 0, + 0, 0, 66, 0, 67, 0, 0, 0, 0, 0, + 146, 0, 147, 0, 0, 0, 0, 0, 73, 68, + 71, 69, 148, 76, 149, 77, 150, 79, 151, 80, + 152, 153, 0, 0, 62, 78, 48, 0, 0, 140, + 0, 58, 0, 0, 0, 0, 0, 154, 74, 44, + 0, 72, 0, 49, 61, 75, 0, 0, 0, 0, + 0, 43, 64, 51, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 143, 0, 65, 0, 245, 246, 247, + 0, 0, 250, 252, 253, 0, 0, 254, 0, 255, + 0, 0, 0, 260, 261, 262, 0, 0, 0, 0, + 0, 0, 52, 263, 265, 266, 0, 267, 0, 0, + 0, 0, 0, 0, 0, 0, 269, 0, 0, 0, + 271, 0, 0, 0, 0, 0, 0, 0, 682, 0, + 0, 0, 273, 0, 0, 0, 476, 0, 0, 0, + 274, 68, 71, 69, 276, 277, 278, 0, 280, 281, + 282, 283, 284, 285, 0, 0, 270, 279, 259, 249, + 268, 251, 272, 0, 0, 0, 0, 256, 0, 0, + 275, 248, 258, 72, 257, 49, 0, 0, 0, 0, + 0, 264, 0, 43, 64, 473, 475, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 0, 245, + 246, 247, 0, 0, 250, 252, 253, 0, 0, 254, + 0, 255, 0, 0, 0, 260, 261, 262, 0, 0, + 0, 0, 0, 0, 52, 263, 265, 266, 0, 267, + 0, 0, 0, 0, 0, 0, 0, 0, 269, 0, + 0, 0, 271, 0, 0, 0, 0, 0, 0, 0, + 677, 0, 0, 0, 273, 0, 0, 0, 476, 0, + 0, 0, 274, 68, 71, 69, 276, 277, 278, 0, + 280, 281, 282, 283, 284, 285, 0, 0, 270, 279, + 259, 249, 268, 251, 272, 0, 0, 0, 0, 256, + 0, 0, 275, 248, 258, 72, 257, 49, 0, 0, + 0, 0, 0, 264, 0, 43, 64, 473, 475, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 0, 138, 0, 0, 0, 0, 139, 0, 45, 46, + 47, 141, 0, 0, 0, 0, 0, 0, 142, 50, + 0, 0, 0, 0, 0, 0, 52, 145, 0, 0, + 53, 54, 0, 55, 0, 0, 0, 56, 0, 57, + 59, 60, 0, 0, 63, 0, 0, 0, 66, 0, + 67, 0, 0, 0, 0, 0, 146, 0, 147, 0, + 0, 0, 0, 0, 73, 68, 71, 69, 148, 76, + 149, 77, 150, 79, 151, 80, 152, 153, 0, 0, + 62, 78, 48, 0, 0, 140, 0, 58, 0, 0, + 0, 0, 0, 154, 74, 44, 0, 72, 0, 49, + 61, 75, 0, 0, 0, 0, 0, 43, 64, 51, + 70, 0, 0, 0, 0, 0, 0, 0, 144, 143, + 0, 65, 0, 138, 0, 0, 0, 0, 139, 0, + 45, 46, 47, 141, 0, 0, 0, 0, 0, 0, + 142, 50, 0, 0, 0, 0, 0, 0, 52, 145, + 0, 0, 53, 54, 0, 55, 0, 0, 0, 56, + 0, 57, 59, 60, 0, 0, 63, 0, 0, 0, + 66, 0, 67, 0, 0, 0, 0, 0, 146, 0, + 147, 0, 0, 0, 0, 0, 73, 68, 71, 69, + 148, 76, 149, 77, 150, 79, 151, 80, 152, 153, + 0, 0, 62, 78, 48, 0, 0, 140, 0, 58, + 0, 0, 0, 0, 0, 154, 74, 44, 0, 72, + 0, 49, 61, 75, 0, 0, 0, 0, 0, 43, + 64, 51, 70, 0, 0, 0, 0, 0, 0, 0, + 205, 143, 0, 65, 0, 138, 0, 0, 0, 0, + 139, 0, 45, 46, 47, 141, 0, 0, 0, 0, + 0, 0, 142, 50, 0, 0, 0, 0, 0, 0, + 52, 145, 0, 0, 53, 54, 0, 55, 0, 0, + 0, 56, 0, 57, 59, 60, 0, 0, 884, 0, + 0, 0, 66, 0, 67, 0, 0, 0, 0, 0, + 146, 0, 147, 0, 0, 0, 0, 0, 885, 68, + 71, 69, 148, 76, 149, 77, 150, 79, 151, 80, + 152, 153, 0, 0, 62, 78, 48, 0, 0, 140, + 0, 58, 0, 0, 0, 0, 0, 154, 74, 44, + 0, 72, 0, 49, 61, 75, 0, 0, 0, 0, + 0, 43, 64, 51, 70, 0, 0, 0, 0, 0, + 0, 0, 144, 143, 0, 65, 0, - 543, 185, 640, 647, 642, 643, 504, 489, 397, 451, - 655, 657, 669, 670, 154, 680, 658, 448, 686, 316, - 185, 16, 256, 536, 251, 599, 570, 633, 572, 590, - 597, 144, 323, 540, 457, 150, 266, 473, 190, 441, - 350, 445, 251, 192, 256, 437, 429, 354, 208, 240, - 185, 316, 251, 256, 185, 404, 448, 448, 316, 533, - 566, 470, 466, 180, 451, 451, 462, 0, 62, 334, - 510, 516, 62, 0, 0, 325, 62, 299, 316, 0, - 459, 298, 397, 334, 0, 147, 461, 208, 499, 0, - 152, 208, 502, 167, 600, 479, 673, 672, 518, 173, - 175, 515, 316, 674, 208, 397, 316, 518, 316, 407, - 208, 0, 190, 0, 321, 208, 656, 352, 62, 249, - 464, 62, 62, 184, 509, 62, 62, 463, 463, 62, - 208, 508, 421, 208, 62, 208, 184, 356, 245, 358, - 405, 242, 263, 280, 62, 62, 62, 506, 284, 302, - 62, 301, 507, 208, 317, 208, 208, 62, 208, 62, - 343, 184, 300, 413, 348, 365, 62, 0, 62, 190, - 518, 62, 99, 62, 100, 578, 86, 90, 346, 62, - 208, 208, 319, 91, 344, 62, 62, 62, 413, 62, - 93, 94, 95, 473, 96, 468, 514, 62, 189, 62, - 150, 414, 97, 92, 208, 62, 472, 464, 182, 62, - 62, 208, 497, 62, 62, 397, 496, 250, 365, 62, - 104, 102, 208, 263, 208, 98, 414, 263, 169, 172, - 365, 208, 487, 62, 359, 511, 62, 250, 463, 208, - 62, 398, 464, 208, 62, 62, 606, 63, 72, 190, - 150, 208, 411, 62, 518, 69, 62, 208, 416, 582, - 365, 365, 79, 62, 62, 70, 62, 62, 483, 71, - 0, 284, 74, 0, 0, 62, 208, 208, 423, 307, - 284, 0, 62, 0, 287, 426, 108, 284, 0, 292, - 62, 62, 0, 0, 0, 284, 284, 303, 304, 62, - 312, 0, 62, 312, 284, 284, 305, 284, 284, 312, - 62, 0, 312, 309, 284, 284, 110, 284, 62, 312, - 0, 594, 333, 284, 284, 340, 578, 330, 653, 0, - 518, 331, 0, 327, 311, 586, 0, 589, 0, 527, - 0, 314, 0, 0, 518, 0, 518, 444, 447, 0, - 489, 517, 528, 527, 0, 527, 547, 548, 549, 550, - 554, 551, 552, 0, 0, 517, 528, 517, 528, 0, - 0, 0, 602, 0, 0, 0, 0, 0, 0, 0, - 108, 604, 605, 547, 548, 549, 550, 554, 551, 552, - 594, 0, 0, 0, 0, 0, 0, 0, 0, 595, - 596, 547, 548, 549, 550, 554, 551, 552, 0, 0, - 110, 179, 0, 0, 0, 0, 0, 0, 0, 0, + 896, 783, 505, 957, 1005, 784, 943, 950, 788, 987, + 786, 941, 944, 847, 975, 933, 758, 799, 897, 761, + 915, 973, 854, 913, 999, 127, 809, 782, 850, 776, + 778, 777, 960, 894, 880, 959, 964, 870, 540, 537, + 534, 510, 530, 549, 538, 200, 509, 503, 508, 522, + 127, 513, 502, 501, 494, 493, 572, 544, 585, 565, + 583, 127, 163, 492, 166, 164, 567, 167, 562, 573, + 168, 556, 558, 230, 352, 387, 232, 380, 231, 384, + 127, 224, 301, 335, 488, 333, 286, 295, 327, 326, + 487, 486, 293, 294, 470, 207, 462, 450, 555, 405, + 431, 336, 405, 629, 663, 657, 635, 656, 221, 417, + 225, 417, 404, 639, 636, 401, 655, 664, 678, 372, + 638, 670, 641, 127, 650, 668, 312, 107, 669, 651, + 665, 652, 594, 596, 600, 607, 603, 605, 726, 541, + 341, 613, 583, 585, 660, 691, 621, 579, 684, 697, + 210, 209, 883, 427, 372, 619, 372, 210, 644, 372, + 372, 389, 470, 382, 376, 210, 633, 372, 372, 692, + 829, 693, 579, 306, 946, 348, 600, 947, 685, 687, + 515, 517, 470, 348, 600, 348, 348, 210, 644, 600, + 470, 579, 348, 791, 470, 470, 470, 560, 967, 715, + 349, 968, 348, 348, 564, 470, 204, 631, 579, 436, + 210, 461, 623, 470, 937, 811, 812, 938, 425, 348, + 423, 628, 348, 409, 407, 620, 348, 798, 202, 210, + 445, 374, 371, 210, 209, 470, 595, 210, 209, 0, + 470, 470, 470, 579, 470, 28, 210, 213, 992, 991, + 701, 700, 41, 672, 210, 233, 240, 235, 210, 213, + 742, 470, 489, 431, 210, 291, 210, 568, 481, 495, + 721, 504, 210, 800, 305, 210, 800, 210, 213, 730, + 676, 673, 0, 243, 828, 240, 800, 210, 551, 210, + 213, 89, 791, 210, 213, 210, 213, 210, 461, 210, + 213, 0, 88, 28, 580, 308, 706, 210, 213, 200, + 41, 210, 213, 210, 397, 0, 813, 411, 210, 658, + 725, 580, 210, 213, 210, 800, 766, 787, 210, 445, + 210, 213, 210, 412, 0, 511, 210, 391, 11, 348, + 637, 435, 240, 800, 986, 210, 568, 89, 0, 89, + 89, 615, 28, 210, 213, 0, 742, 0, 88, 41, + 88, 88, 0, 480, 234, 0, 308, 0, 102, 89, + 89, 210, 455, 813, 292, 28, 569, 732, 89, 0, + 88, 88, 41, 240, 235, 0, 640, 0, 217, 88, + 0, 90, 28, 90, 90, 91, 11, 552, 99, 41, + 586, 28, 28, 436, 755, 0, 712, 661, 41, 41, + 243, 0, 497, 0, 90, 749, 763, 89, 768, 666, + 369, 185, 90, 398, 0, 734, 0, 506, 88, 448, + 0, 795, 89, 0, 210, 213, 825, 780, 386, 819, + 785, 653, 413, 88, 28, 11, 393, 228, 390, 210, + 419, 41, 648, 575, 0, 569, 0, 659, 765, 403, + 774, 90, 28, 89, 0, 696, 0, 779, 11, 41, + 307, 89, 28, 89, 88, 89, 90, 458, 672, 41, + 329, 457, 88, 28, 88, 11, 88, 0, 802, 28, + 41, 750, 89, 0, 11, 11, 41, 332, 288, 89, + 89, 681, 909, 88, 0, 676, 673, 90, 822, 89, + 88, 88, 210, 455, 0, 90, 0, 90, 171, 90, + 88, 191, 710, 0, 0, 177, 192, 89, 89, 0, + 0, 0, 0, 0, 89, 435, 90, 11, 88, 88, + 0, 89, 189, 90, 90, 88, 89, 89, 0, 190, + 0, 227, 88, 90, 0, 11, 421, 88, 88, 420, + 89, 194, 89, 0, 712, 11, 0, 0, 196, 0, + 89, 88, 90, 88, 0, 98, 11, 0, 90, 643, + 718, 88, 11, 89, 712, 90, 643, 708, 711, 0, + 90, 643, 709, 0, 88, 0, 210, 213, 0, 831, + 831, 89, 921, 925, 90, 0, 90, 643, 719, 308, + 309, 41, 88, 358, 90, 643, 720, 0, 460, 89, + 588, 0, 457, 0, 89, 89, 0, 90, 0, 89, + 88, 89, 89, 0, 41, 88, 88, 0, 0, 582, + 88, 831, 88, 88, 0, 90, 643, 727, 974, 939, + 0, 0, 921, 831, 971, 0, 993, 0, 0, 0, + 89, 712, 712, 90, 0, 0, 89, 0, 0, 0, + 41, 88, 584, 90, 831, 90, 90, 88, 89, 89, + 41, 841, 41, 41, 0, 0, 0, 590, 0, 88, + 88, 685, 687, 609, 0, 361, 612, 842, 0, 89, + 89, 0, 41, 712, 90, 643, 729, 0, 0, 0, + 88, 88, 0, 307, 0, 712, 932, 0, 0, 929, + 0, 0, 0, 90, 643, 728, 0, 0, 831, 0, + 0, 831, 0, 0, 0, 841, 712, 0, 841, 0, + 0, 0, 0, 948, 90, 643, 642, 0, 362, 366, + 970, 842, 0, 89, 842, 873, 89, 872, 874, 879, + 875, 878, 948, 0, 88, 0, 0, 88, 0, 949, + 0, 0, 0, 0, 873, 0, 872, 874, 879, 875, + 878, 0, 939, 0, 0, 0, 0, 0, 11, 940, + 712, 0, 0, 712, 873, 0, 872, 874, 879, 875, + 878, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 873, 0, 872, 874, 879, 875, 878, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 602, 0, 0, 0, 0, 0, - 0, 0, 0, 651, 652, 547, 548, 549, 550, 554, - 551, 552, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -749,397 +1354,708 @@ const short QmlJSGrammar::action_info [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }; const short QmlJSGrammar::action_check [] = { - 7, 33, 60, 60, 7, 36, 7, 7, 60, 7, - 36, 36, 7, 7, 60, 36, 55, 7, 33, 55, - 33, 7, 36, 7, 36, 36, 7, 37, 36, 7, - 36, 7, 7, 7, 33, 7, 33, 33, 47, 66, - 17, 34, 47, 66, 29, 37, 29, 29, 17, 29, - 29, 17, 5, 5, 5, 20, 60, 7, 60, 8, - 33, 7, 33, 33, 55, 33, 55, 7, 55, 36, - 33, 33, 60, 33, 7, 36, 33, 36, 36, 33, - 8, 7, 2, 7, 1, 8, 1, 8, 1, 36, - 8, 2, 8, -1, 2, -1, 60, -1, 33, 55, - 55, 7, 36, 1, 48, 0, 7, 36, 2, 36, - 48, 36, 60, 17, 33, 60, 48, 16, 8, 55, - 61, 60, 36, 7, 36, 8, 36, 36, 8, 60, - 8, 8, 6, 8, 15, -1, 79, 79, 8, 61, - 77, 48, 15, 7, 8, 8, 20, 15, 15, 79, - -1, 24, 8, 34, 8, 8, -1, -1, 61, 61, - 62, 61, 62, 8, 61, 62, 34, 34, 50, 61, - 62, 50, 54, 8, 79, 54, 8, 60, 56, 10, - 60, 56, 40, 60, 8, 61, 62, 8, 40, 12, - 60, 7, 55, 51, 40, 61, 62, 93, 94, 51, - 61, 62, 31, 7, 60, 51, 60, 60, 93, 94, - 15, 56, 61, 62, 61, 62, 42, 61, 62, 24, - 15, 56, 61, 62, 55, 61, 62, 53, 60, 33, - 29, 29, 7, 12, 57, 56, 25, 61, 27, 34, - 63, 36, 25, 7, 27, 61, 62, 29, 25, 38, - 27, 25, 25, 27, 27, 38, 25, 29, 27, 95, - -1, 38, 29, -1, 38, 38, 29, -1, 12, 38, - 36, 29, 25, -1, 27, -1, 75, 75, 57, 40, - 15, 8, -1, 8, 63, 38, 61, 62, 87, 87, - 51, -1, 96, 75, -1, 61, 62, 61, 62, 34, - -1, 36, 15, 75, 8, 87, -1, -1, 75, 25, - -1, 27, 75, 57, 25, 87, 27, 75, -1, 63, - 87, 34, 38, 36, 87, 61, 62, 38, 25, 87, - 27, 25, -1, 27, 61, 62, 61, 62, 25, -1, - 27, 38, 15, 25, 38, 27, 15, 15, 18, 19, - -1, 38, 18, 19, 90, 47, 38, 61, 62, -1, - 33, 34, -1, 36, 33, 34, 34, 36, 36, 61, - 62, -1, 23, 24, -1, 45, 46, -1, -1, 45, - 46, 32, 23, 24, 35, -1, 37, -1, 23, 24, - -1, 32, 23, 24, 35, -1, 37, 32, 23, 24, - 35, 32, 37, 95, 35, -1, 37, 32, 23, 24, - 35, -1, 37, -1, -1, -1, 31, 32, 23, 24, - 35, 29, 37, -1, -1, 29, 31, 32, -1, -1, - 35, -1, 37, 29, 23, 24, 29, -1, -1, 29, - 18, 19, 31, 32, 29, -1, 35, 29, 37, -1, - 100, 101, 102, 103, 104, 105, -1, -1, 66, 67, - 68, -1, 66, 67, 68, -1, -1, 45, 46, -1, - 66, 67, 68, 66, 67, 68, 66, 67, 68, -1, - 29, 66, 67, 68, 66, 67, 68, 29, 96, 97, - 98, -1, 96, 97, 98, 29, -1, -1, 29, -1, - 96, 97, 98, 96, 97, 98, 96, 97, 98, -1, - -1, 96, 97, 98, 96, 97, 98, 66, 67, 68, - 29, -1, -1, -1, 66, 67, 68, -1, -1, -1, - 23, 24, 66, 67, 68, 66, 67, 68, 31, 32, - -1, -1, 35, 29, 37, -1, 15, 96, 97, 98, - 36, -1, -1, -1, 96, 97, 98, 66, 67, 68, - 29, -1, 96, 97, 98, 96, 97, 98, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, - 66, 67, 68, -1, -1, -1, 15, 96, 97, 98, - 15, -1, -1, 29, 15, -1, 29, 66, 67, 68, - 29, -1, -1, 36, 29, -1, -1, -1, 29, -1, - 96, 97, 98, -1, -1, 29, -1, -1, 29, -1, - -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, - 66, 67, 68, 66, 67, 68, -1, 66, 67, 68, - -1, 66, 67, 68, -1, 66, 67, 68, -1, -1, - 61, 62, 66, 67, 68, 66, 67, 68, 29, -1, - 96, 97, 98, 96, 97, 98, -1, 96, 97, 98, - 29, 96, 97, 98, -1, 96, 97, 98, 29, -1, - -1, 29, 96, 97, 98, 96, 97, 98, -1, -1, - 61, 62, -1, -1, 29, 66, 67, 68, -1, -1, - -1, 36, 61, 62, -1, -1, -1, 66, 67, 68, - 61, 62, -1, 61, 62, 66, 67, 68, 66, 67, - 68, -1, -1, -1, -1, 96, 97, 98, -1, -1, - 3, 66, 67, 68, -1, -1, -1, 96, 97, 98, - 13, -1, -1, -1, 17, 96, 97, 98, 96, 97, - 98, -1, -1, 26, -1, 28, -1, -1, -1, -1, - -1, 96, 97, 98, -1, -1, 39, -1, 41, 42, - -1, -1, -1, 29, -1, -1, 49, -1, -1, 52, - 53, -1, -1, -1, -1, 58, -1, -1, -1, -1, - -1, 64, -1, -1, -1, -1, -1, -1, -1, 3, - -1, -1, -1, -1, -1, 61, 62, 80, -1, 13, - 66, 67, 68, 17, -1, -1, -1, -1, -1, -1, - -1, -1, 26, -1, 28, -1, -1, 31, -1, -1, - -1, -1, -1, -1, -1, 39, -1, 41, 42, -1, - 96, 97, 98, -1, -1, 49, -1, -1, 52, 53, - -1, -1, 3, -1, 58, -1, -1, -1, -1, -1, - 64, -1, 13, -1, -1, -1, 17, -1, -1, -1, - -1, -1, -1, -1, -1, 26, 80, 28, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, - 41, 42, -1, -1, -1, -1, -1, -1, 49, -1, - -1, 52, 53, -1, -1, -1, -1, 58, -1, -1, - -1, -1, -1, 64, -1, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, 80, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, 65, 66, - 67, 68, -1, 70, 29, -1, -1, -1, 33, 34, - -1, 36, -1, -1, 81, 82, 83, -1, 43, -1, - -1, 88, 47, -1, -1, -1, -1, -1, -1, 96, - 97, 98, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 81, 82, 83, -1, - -1, -1, -1, 88, -1, -1, -1, -1, -1, -1, - -1, 96, 97, 98, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 12, 13, -1, -1, -1, -1, -1, - -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, - -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 81, 82, 83, -1, -1, -1, -1, 88, - -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, + 60, 7, 17, 37, 33, 47, 102, 47, 36, 110, + 29, 33, 99, 7, 55, 8, 7, 7, 7, 55, + 33, 60, 48, 2, 110, 8, 33, 102, 33, 29, + 60, 17, 34, 60, 33, 60, 33, 29, 55, 55, + 36, 29, 60, 8, 68, 29, 60, 55, 60, 60, + 102, 33, 29, 110, 55, 0, 60, 60, 67, 33, + 55, 36, 60, 33, 33, 33, 33, 33, 55, 33, + 2, 8, 33, 8, 37, 60, 36, 55, 33, 8, + 60, 2, 36, 56, 60, 56, 36, 68, 7, 48, + 36, 17, 64, 55, 17, 7, 16, 55, 8, 33, + 33, 17, 55, 60, 55, 61, 55, 55, 60, 17, + 8, 55, 17, 60, 17, 17, 17, 60, 17, 61, + 61, 61, 60, 8, 8, 61, 33, 36, 55, 60, + 17, 61, 8, 8, 17, 17, 33, 55, 33, 17, + 36, 55, 8, 1, 48, 33, 36, 36, 1, 55, + 36, 79, 33, 1, 48, 2, 36, 36, 0, 8, + 99, 33, 5, 8, 81, 5, 17, 60, 93, 93, + 81, 93, 5, 7, 36, 1, 17, 33, 93, 33, + 8, 81, 55, 22, 20, 8, 60, 33, 8, 33, + 81, 61, 62, 8, 7, 50, 7, 15, 36, 54, + 22, 36, 8, 8, 61, 62, 24, 31, 15, 8, + 42, 61, 62, 8, 8, 8, 8, 24, 8, 10, + 0, 53, 8, 40, 61, 62, 40, 15, 63, 33, + 61, 62, 61, 62, 51, 55, 8, 51, 40, 8, + 61, 62, 61, 62, 8, 60, 34, 8, 8, 51, + 56, 8, 6, 61, 62, 60, 55, 8, 40, 63, + 7, 55, 55, 50, 55, 60, 20, 54, 60, 51, + 60, 56, 61, 62, 60, 8, 98, 0, 61, 62, + 93, 108, 109, 36, 56, 61, 62, 111, 25, 36, + 27, 60, 56, 61, 62, 56, 108, 109, 55, 110, + 60, 38, 61, 62, 29, 56, 15, 7, 61, 62, + 95, 7, 29, 25, 12, 27, 8, 0, 29, 7, + 7, 101, 12, 56, -1, 34, 38, 36, 108, 17, + 8, 8, 29, 92, 25, 8, 27, 33, 8, 17, + 25, 5, 27, 47, 17, 29, 10, 38, 36, 12, + 29, 55, 77, 38, 7, -1, 8, -1, -1, 57, + 77, 61, 62, 67, 89, 63, 77, 57, 22, 61, + 62, 29, 89, 63, 61, 62, -1, 25, 89, 27, + 77, 61, 62, 61, 61, 62, 18, 19, 61, -1, + 38, 55, 89, 77, 57, 18, 19, 15, 77, -1, + 63, 15, -1, 7, 8, 89, -1, -1, 61, 62, + 89, 18, 19, 45, 46, -1, 34, -1, 101, 77, + 34, 15, 45, 46, 15, 108, -1, -1, 124, -1, + 110, 89, 86, 87, 47, 105, 106, 15, 45, 46, + 34, -1, 36, 34, 98, 36, 15, -1, 61, 62, + 23, 24, -1, 105, 106, -1, 34, -1, 36, 32, + 23, 24, 35, 15, 37, 34, -1, 36, -1, 32, + -1, -1, 35, 15, 37, 115, 116, 117, 118, 119, + 120, 33, 34, -1, 36, 103, 104, 23, 24, 103, + 104, 33, 34, -1, 36, 31, 32, 110, -1, 35, + 29, 37, -1, 29, 10, -1, 23, 24, -1, 103, + 104, -1, 103, 104, 31, 32, 22, -1, 35, -1, + 37, -1, 18, 19, 29, 103, 104, 33, 29, -1, + -1, -1, -1, -1, 103, 104, -1, -1, -1, 68, + 69, 70, 68, 69, 70, -1, -1, -1, -1, 45, + 46, 103, 104, -1, -1, -1, -1, 63, -1, -1, + -1, 103, 104, 68, 69, 70, -1, 68, 69, 70, + -1, 77, -1, 102, 29, -1, 102, -1, -1, -1, + 86, 87, 111, 112, 113, 111, 112, 113, -1, -1, + -1, -1, 98, 29, -1, 124, -1, 102, 124, -1, + -1, 102, -1, -1, -1, -1, 111, 112, 113, 29, + 111, 112, 113, 68, 69, 70, -1, -1, -1, 124, + -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, + 15, -1, 68, 69, 70, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 29, 100, -1, 102, 68, 69, + 70, -1, -1, -1, -1, 110, 111, 112, 113, -1, + -1, 29, -1, -1, 100, -1, 102, -1, -1, 124, + -1, -1, -1, -1, 110, 111, 112, 113, -1, 29, + 100, -1, 102, 68, 69, 70, 36, -1, 124, -1, + 110, 111, 112, 113, -1, -1, -1, -1, -1, -1, + 68, 69, 70, -1, 124, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 29, -1, -1, 102, 68, 69, + 70, -1, -1, -1, -1, -1, 111, 112, 113, -1, + -1, 99, 100, -1, 102, -1, -1, 29, -1, 124, + -1, 29, 110, 111, 112, 113, -1, -1, -1, -1, + 100, -1, 102, 68, 69, 70, 124, -1, -1, -1, + 110, 111, 112, 113, -1, -1, -1, -1, -1, -1, + -1, 63, -1, -1, 124, -1, 68, 69, 70, -1, + 68, 69, 70, -1, 99, 100, -1, 102, 29, -1, + -1, -1, 33, 34, -1, 110, 111, 112, 113, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 100, 124, + 102, 29, 100, -1, 102, 33, 34, -1, 110, 111, + 112, 113, 110, 111, 112, 113, -1, 68, 69, 70, + -1, -1, 124, -1, 29, -1, 124, -1, 29, -1, + -1, 36, -1, -1, -1, 36, -1, -1, -1, -1, + 68, 69, 70, -1, -1, -1, -1, -1, -1, 100, + -1, 102, -1, -1, -1, -1, -1, -1, 63, 110, + 111, 112, 113, 68, 69, 70, -1, 68, 69, 70, + -1, -1, 100, 124, 102, -1, -1, -1, -1, -1, + -1, -1, 110, 111, 112, 113, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 100, 124, 102, -1, 100, + 29, 102, -1, -1, 29, 110, 111, 112, 113, 110, + 111, 112, 113, -1, -1, -1, -1, -1, -1, 124, + 29, -1, -1, 124, -1, 29, -1, 36, -1, 33, + 34, -1, 61, 62, -1, -1, 61, 62, -1, 68, + 69, 70, -1, 68, 69, 70, -1, -1, -1, -1, + -1, -1, -1, -1, 63, -1, -1, -1, -1, 68, + 69, 70, -1, -1, 68, 69, 70, -1, -1, -1, + -1, 100, -1, 102, -1, 100, -1, 102, -1, -1, + -1, 110, 111, 112, 113, 110, 111, 112, 113, -1, + -1, 100, -1, 102, -1, 124, 100, -1, 102, 124, + -1, 110, 111, 112, 113, -1, 110, 111, 112, 113, + -1, -1, -1, -1, -1, 124, -1, 29, -1, -1, + 124, 33, 29, -1, -1, -1, 33, 34, -1, 3, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, + -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, + -1, 63, 26, -1, 28, 67, 68, 69, 70, -1, + -1, 68, 69, 70, -1, 39, -1, 41, 42, -1, + -1, -1, -1, -1, -1, 49, -1, -1, 52, 53, + -1, -1, -1, -1, 58, -1, -1, -1, 100, -1, + 102, 65, 66, 100, -1, 102, -1, -1, 110, 111, + 112, 113, -1, 110, 111, 112, 113, -1, 82, -1, + -1, -1, 124, -1, -1, 3, -1, 124, -1, 29, + -1, -1, -1, 33, 34, 13, -1, -1, -1, 17, + -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, + 28, -1, -1, 31, -1, -1, -1, -1, -1, -1, + -1, 39, -1, 41, 42, -1, -1, -1, 68, 69, + 70, 49, -1, -1, 52, 53, -1, -1, -1, -1, + 58, -1, -1, -1, -1, -1, -1, 65, 66, -1, + -1, -1, -1, -1, -1, 95, -1, -1, -1, -1, + 100, -1, 102, -1, 82, -1, -1, -1, -1, -1, + 110, 111, 112, 113, -1, -1, -1, -1, -1, -1, + -1, -1, 12, 13, 124, -1, 3, -1, -1, -1, + -1, -1, 22, 111, -1, -1, 13, -1, -1, 29, + 17, -1, -1, 33, 34, -1, 36, -1, -1, 26, + -1, 28, -1, 43, -1, -1, -1, 47, -1, -1, + -1, -1, 39, -1, 41, 42, -1, -1, -1, -1, + -1, -1, 49, -1, -1, 52, 53, 67, 68, 69, + 70, 58, 72, -1, -1, -1, -1, -1, 65, 66, + -1, -1, -1, 83, 84, 85, -1, -1, -1, -1, + 90, -1, -1, -1, -1, 82, -1, 97, 98, -1, + 100, -1, 102, 103, 104, -1, -1, -1, -1, -1, + 110, 111, 112, 113, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, -1, 88, -1, -1, -1, -1, - -1, -1, -1, 96, 97, 98, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 10, -1, 12, 13, -1, + -1, -1, -1, -1, 67, 68, 69, 70, -1, 72, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 83, 84, 85, -1, -1, -1, -1, 90, -1, -1, + -1, -1, -1, -1, 97, 98, -1, 100, -1, 102, + 103, 104, -1, -1, -1, -1, -1, 110, 111, 112, + 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, -1, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, + -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, + 69, 70, -1, 72, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 83, 84, 85, -1, -1, -1, + -1, 90, -1, -1, -1, -1, -1, -1, 97, 98, + -1, 100, -1, 102, 103, 104, -1, -1, -1, -1, + -1, 110, 111, 112, 113, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 124, -1, 12, 13, -1, + 15, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, + -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, + -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 67, 68, 69, 70, -1, 72, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 83, 84, + 85, -1, -1, -1, -1, 90, -1, -1, -1, -1, + -1, -1, 97, 98, -1, 100, -1, 102, 103, 104, + -1, -1, -1, -1, -1, 110, 111, 112, 113, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + -1, 12, 13, -1, 15, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, + -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, + -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, + -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 83, 84, 85, -1, -1, -1, -1, 90, + -1, -1, -1, -1, -1, -1, 97, 98, -1, 100, + -1, 102, 103, 104, -1, -1, -1, -1, -1, 110, + 111, 112, 113, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, - 75, -1, -1, -1, -1, -1, 81, 82, 83, 84, - 85, -1, -1, 88, -1, -1, 91, -1, -1, -1, - -1, 96, 97, 98, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, 68, -1, 70, -1, -1, -1, -1, 75, -1, - -1, -1, -1, -1, 81, 82, 83, 84, 85, -1, - -1, 88, -1, -1, 91, -1, -1, -1, -1, 96, - 97, 98, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 67, 68, 69, 70, -1, 72, -1, -1, + -1, -1, 77, -1, -1, -1, -1, -1, 83, 84, + 85, -1, -1, -1, -1, 90, -1, -1, -1, 94, + -1, -1, 97, 98, -1, 100, -1, 102, 103, 104, + -1, -1, -1, -1, -1, 110, 111, 112, 113, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, - -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, - -1, -1, 81, 82, 83, 84, 85, -1, -1, 88, - -1, -1, 91, -1, -1, -1, -1, 96, 97, 98, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, + -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, + 69, 70, -1, 72, -1, -1, -1, -1, 77, -1, + -1, -1, -1, -1, 83, 84, 85, -1, -1, -1, + -1, 90, -1, -1, -1, 94, -1, -1, 97, 98, + -1, 100, -1, 102, 103, 104, -1, -1, -1, -1, + -1, 110, 111, 112, 113, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 124, -1, 10, -1, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, + 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, + -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 67, 68, 69, 70, -1, 72, + -1, -1, -1, -1, 77, -1, -1, -1, -1, -1, + 83, 84, 85, -1, -1, -1, -1, 90, -1, -1, + -1, 94, -1, -1, 97, 98, -1, 100, -1, 102, + 103, 104, -1, -1, -1, -1, -1, 110, 111, 112, + 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, + 68, 69, 70, -1, 72, -1, 74, -1, 76, -1, + 78, -1, -1, -1, -1, 83, 84, 85, -1, -1, + -1, -1, 90, -1, -1, -1, -1, -1, -1, 97, + 98, -1, 100, -1, 102, 103, 104, -1, -1, -1, + -1, -1, 110, 111, 112, 113, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 124, -1, 11, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 67, 68, 69, 70, -1, 72, + -1, 74, -1, 76, -1, 78, -1, -1, -1, -1, + 83, 84, 85, -1, -1, -1, -1, 90, -1, -1, + -1, -1, -1, 96, 97, 98, -1, 100, -1, 102, + 103, 104, -1, -1, -1, -1, -1, 110, 111, 112, + 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, + 68, 69, 70, -1, 72, -1, 74, -1, 76, -1, + 78, -1, -1, -1, -1, 83, 84, 85, -1, -1, + -1, -1, 90, -1, -1, -1, -1, -1, 96, 97, + 98, -1, 100, -1, 102, 103, 104, -1, -1, -1, + -1, -1, 110, 111, 112, 113, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 124, -1, 11, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 67, 68, 69, 70, -1, 72, + -1, 74, -1, 76, -1, 78, -1, -1, -1, -1, + 83, 84, 85, -1, -1, -1, -1, 90, -1, -1, + -1, -1, 95, 96, 97, 98, -1, 100, -1, 102, + 103, 104, -1, -1, -1, -1, -1, 110, 111, 112, + 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, -1, 8, -1, -1, 11, 12, 13, -1, + -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, + -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, + -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 67, 68, 69, 70, -1, 72, -1, 74, + -1, 76, -1, 78, -1, -1, -1, -1, 83, 84, + 85, -1, -1, -1, -1, 90, -1, -1, -1, -1, + -1, 96, 97, 98, -1, 100, -1, 102, 103, 104, + -1, -1, -1, -1, -1, 110, 111, 112, 113, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, + -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, + 70, -1, 72, -1, 74, -1, 76, -1, 78, -1, + -1, -1, -1, 83, 84, 85, -1, -1, -1, -1, + 90, -1, -1, -1, -1, 95, 96, 97, 98, -1, + 100, -1, 102, 103, 104, -1, -1, -1, -1, -1, + 110, 111, 112, 113, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 124, -1, 11, 12, 13, -1, + -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, + -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, + -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 67, 68, 69, 70, -1, 72, -1, 74, + -1, 76, -1, 78, -1, -1, -1, -1, 83, 84, + 85, -1, -1, -1, -1, 90, -1, -1, -1, -1, + 95, 96, 97, 98, -1, 100, -1, 102, 103, 104, + -1, -1, -1, -1, -1, 110, 111, 112, 113, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 67, 68, 69, 70, -1, 72, -1, 74, -1, 76, + -1, 78, -1, -1, -1, -1, 83, 84, 85, -1, + -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, + 97, 98, -1, 100, -1, 102, 103, 104, -1, -1, + -1, -1, -1, 110, 111, 112, 113, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, - 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, - 82, 83, -1, -1, -1, -1, 88, -1, -1, -1, - -1, -1, -1, -1, 96, 97, 98, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, - 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, - -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, - -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, - 81, 82, 83, -1, -1, -1, -1, 88, -1, -1, - -1, -1, -1, -1, -1, 96, 97, 98, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, 63, -1, -1, -1, 67, 68, 69, 70, -1, + 72, -1, 74, -1, 76, -1, 78, -1, -1, -1, + -1, 83, 84, 85, -1, -1, -1, -1, 90, -1, + -1, -1, -1, -1, 96, 97, 98, -1, 100, -1, + 102, 103, 104, -1, -1, -1, -1, -1, 110, 111, + 112, 113, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 124, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, - 74, 75, 76, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, - -1, -1, 96, 97, 98, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, - 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, - -1, -1, 96, 97, 98, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, - 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, - -1, -1, 96, 97, 98, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, - 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, - -1, -1, 96, 97, 98, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, - 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, -1, 88, -1, -1, -1, -1, -1, - -1, -1, 96, 97, 98, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, + 67, 68, 69, 70, -1, 72, -1, 74, -1, 76, + -1, 78, -1, -1, -1, -1, 83, 84, 85, -1, + -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, + 97, 98, -1, 100, -1, 102, 103, 104, -1, -1, + -1, -1, -1, 110, 111, 112, 113, -1, -1, -1, + -1, -1, -1, -1, -1, 122, -1, 124, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 67, 68, 69, 70, -1, + 72, -1, 74, -1, 76, -1, 78, -1, -1, -1, + -1, 83, 84, 85, -1, -1, -1, -1, 90, -1, + -1, -1, -1, -1, 96, 97, 98, -1, 100, -1, + 102, 103, 104, -1, -1, -1, -1, -1, 110, 111, + 112, 113, -1, -1, -1, -1, -1, -1, -1, -1, + 122, -1, 124, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, + 67, 68, 69, 70, -1, 72, -1, 74, -1, 76, + -1, 78, -1, -1, -1, -1, 83, 84, 85, -1, + -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, + 97, 98, -1, 100, -1, 102, 103, 104, -1, -1, + -1, -1, -1, 110, 111, 112, 113, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 67, 68, 69, 70, -1, + 72, -1, 74, -1, 76, -1, 78, -1, -1, -1, + -1, 83, 84, 85, -1, -1, -1, -1, 90, -1, + -1, -1, -1, -1, 96, 97, 98, -1, 100, -1, + 102, 103, 104, -1, -1, -1, -1, -1, 110, 111, + 112, 113, -1, -1, -1, -1, -1, -1, -1, 121, + -1, -1, 124, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, + -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, + 67, 68, 69, 70, -1, 72, -1, 74, -1, 76, + -1, 78, -1, -1, -1, -1, 83, 84, 85, -1, + -1, -1, -1, 90, -1, -1, -1, -1, 95, 96, + 97, 98, -1, 100, -1, 102, 103, 104, -1, -1, + -1, -1, -1, 110, 111, 112, 113, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 67, 68, 69, 70, -1, + 72, -1, 74, -1, 76, -1, 78, -1, -1, -1, + -1, 83, 84, 85, -1, -1, -1, -1, 90, -1, + -1, -1, -1, 95, 96, 97, 98, -1, 100, -1, + 102, 103, 104, -1, -1, -1, -1, -1, 110, 111, + 112, 113, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 124, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 67, 68, 69, 70, -1, 72, -1, 74, -1, 76, + 77, 78, -1, -1, -1, -1, 83, 84, 85, 86, + 87, -1, -1, 90, -1, -1, -1, -1, -1, 96, + 97, 98, -1, 100, -1, 102, 103, 104, -1, -1, + -1, -1, -1, 110, 111, 112, 113, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, -1, -1, -1, -1, -1, 61, + -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, + 72, -1, 74, 75, 76, -1, 78, -1, 80, -1, + -1, 83, 84, 85, -1, -1, -1, -1, 90, -1, + -1, -1, -1, -1, 96, 97, 98, -1, 100, -1, + 102, 103, 104, -1, -1, -1, -1, -1, 110, 111, + 112, 113, -1, -1, -1, -1, -1, -1, -1, 121, + 122, -1, 124, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, - -1, -1, -1, -1, 61, -1, -1, -1, 65, 66, - 67, 68, 69, 70, -1, 72, 73, 74, -1, 76, - -1, 78, -1, -1, 81, 82, 83, -1, -1, -1, - -1, 88, -1, -1, -1, -1, -1, -1, -1, 96, - 97, 98, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, - -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, - 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, - 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, - -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, - -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, - 70, -1, 72, 73, 74, -1, 76, -1, 78, -1, - -1, 81, 82, 83, -1, -1, -1, -1, 88, -1, - -1, -1, -1, -1, -1, -1, 96, 97, 98, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, 61, -1, - -1, -1, 65, 66, 67, 68, 69, 70, -1, 72, - 73, 74, -1, 76, -1, 78, -1, -1, 81, 82, - 83, -1, -1, -1, -1, 88, -1, -1, -1, -1, - -1, -1, -1, 96, 97, 98, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, + -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, + 67, 68, 69, 70, 71, 72, -1, 74, 75, 76, + -1, 78, -1, 80, -1, -1, 83, 84, 85, -1, + -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, + 97, 98, -1, 100, -1, 102, 103, 104, -1, -1, + -1, -1, -1, 110, 111, 112, 113, -1, -1, -1, + -1, -1, -1, -1, 121, 122, -1, 124, -1, 4, + 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, + -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, + -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, + -1, -1, -1, 68, 69, 70, 71, 72, 73, -1, + 75, 76, 77, 78, 79, 80, -1, -1, 83, 84, + 85, 86, 87, 88, 89, -1, -1, -1, -1, 94, + -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, + -1, -1, -1, 108, -1, 110, 111, 112, 113, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, + -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, + -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 55, -1, -1, -1, 59, -1, -1, -1, + -1, -1, -1, -1, -1, 68, 69, 70, 71, 72, + 73, -1, 75, 76, 77, 78, 79, 80, -1, -1, + 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, + -1, 94, -1, -1, 97, 98, 99, 100, 101, 102, + -1, -1, -1, -1, -1, 108, -1, 110, 111, 112, + 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, -1, 4, 5, 6, -1, -1, 9, 10, + 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, + 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, + 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 55, -1, -1, -1, 59, -1, + -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, + 71, 72, 73, -1, 75, 76, 77, 78, 79, 80, + -1, -1, 83, 84, 85, 86, 87, 88, 89, -1, + -1, -1, -1, 94, -1, -1, 97, 98, 99, 100, + 101, 102, -1, -1, -1, -1, -1, 108, -1, 110, + 111, 112, 113, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 59, -1, -1, -1, -1, -1, -1, 66, 67, 68, - 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, - -1, -1, 81, 82, 83, 84, 85, 86, 87, -1, - -1, -1, 91, -1, -1, -1, -1, 96, 97, 98, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, + -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, + 59, -1, -1, -1, -1, -1, -1, -1, -1, 68, + 69, 70, 71, 72, 73, -1, 75, 76, 77, 78, + 79, 80, -1, -1, 83, 84, 85, 86, 87, 88, + 89, -1, -1, -1, -1, 94, -1, -1, 97, 98, + 99, 100, 101, 102, -1, -1, -1, -1, -1, 108, + -1, 110, 111, 112, 113, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 124, -1, 4, 5, 6, + -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, + -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, + -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, + -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, + -1, 68, 69, 70, 71, 72, 73, -1, 75, 76, + 77, 78, 79, 80, -1, -1, 83, 84, 85, 86, + 87, 88, 89, -1, -1, -1, -1, 94, -1, -1, + 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, + -1, 108, -1, 110, 111, 112, 113, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, - -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, + -1, -1, -1, -1, 29, 30, 31, 32, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, - 65, 66, 67, 68, 69, 70, 71, -1, 73, 74, - 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, - 85, 86, 87, -1, -1, -1, 91, -1, -1, -1, - -1, 96, 97, 98, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, + -1, -1, 67, 68, 69, 70, 71, 72, 73, -1, + 75, 76, 77, 78, 79, 80, -1, -1, 83, 84, + 85, 86, 87, 88, 89, -1, -1, -1, -1, 94, + -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, + -1, -1, -1, 108, -1, 110, 111, 112, 113, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, + -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, + -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, + -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, + 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, + 63, -1, -1, -1, 67, 68, 69, 70, 71, 72, + 73, -1, 75, 76, 77, 78, 79, 80, -1, -1, + 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, + -1, 94, -1, -1, 97, 98, 99, 100, 101, 102, + -1, -1, -1, -1, -1, 108, -1, 110, 111, 112, + 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, - 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, + 31, 32, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, - -1, -1, -1, -1, 65, 66, 67, 68, 69, 70, - 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, - 81, 82, 83, 84, 85, 86, 87, -1, -1, -1, - 91, -1, -1, -1, -1, 96, 97, 98, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, + 61, -1, 63, -1, -1, -1, 67, 68, 69, 70, + 71, 72, 73, -1, 75, 76, 77, 78, 79, 80, + -1, -1, 83, 84, 85, 86, 87, 88, 89, -1, + -1, -1, -1, 94, -1, -1, 97, 98, 99, 100, + 101, 102, -1, -1, -1, -1, -1, 108, -1, 110, + 111, 112, 113, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, -1, 4, -1, -1, -1, -1, + 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, + -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, + 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, + 59, -1, 61, -1, -1, -1, -1, -1, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, -1, -1, 83, 84, 85, -1, -1, 88, + -1, 90, -1, -1, -1, -1, -1, 96, 97, 98, + -1, 100, -1, 102, 103, 104, -1, -1, -1, -1, + -1, 110, 111, 112, 113, -1, -1, -1, -1, -1, + -1, -1, -1, 122, -1, 124, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, - -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, + -1, -1, 29, 30, 31, 32, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, - -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, - 67, 68, 69, 70, 71, -1, 73, 74, 75, 76, - 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, - 87, -1, -1, -1, 91, -1, -1, -1, -1, 96, - 97, 98, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 59, -1, -1, -1, 63, -1, -1, -1, + 67, 68, 69, 70, 71, 72, 73, -1, 75, 76, + 77, 78, 79, 80, -1, -1, 83, 84, 85, 86, + 87, 88, 89, -1, -1, -1, -1, 94, -1, -1, + 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, + -1, 108, -1, 110, 111, 112, 113, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, -1, 4, + 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, + -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, + -1, -1, -1, -1, 29, 30, 31, 32, -1, 34, + -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, + -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, + 55, -1, -1, -1, 59, -1, -1, -1, 63, -1, + -1, -1, 67, 68, 69, 70, 71, 72, 73, -1, + 75, 76, 77, 78, 79, 80, -1, -1, 83, 84, + 85, 86, 87, 88, 89, -1, -1, -1, -1, 94, + -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, + -1, -1, -1, 108, -1, 110, 111, 112, 113, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, - -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, - 83, 84, 85, 86, -1, 88, -1, -1, -1, -1, - -1, -1, -1, 96, 97, 98, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, + -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, -1, -1, + 83, 84, 85, -1, -1, 88, -1, 90, -1, -1, + -1, -1, -1, 96, 97, 98, -1, 100, -1, 102, + 103, 104, -1, -1, -1, -1, -1, 110, 111, 112, + 113, -1, -1, -1, -1, -1, -1, -1, 121, 122, + -1, 124, -1, 4, -1, -1, -1, -1, 9, -1, + 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, + 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, + -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, + -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, + 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, + 61, -1, -1, -1, -1, -1, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + -1, -1, 83, 84, 85, -1, -1, 88, -1, 90, + -1, -1, -1, -1, -1, 96, 97, 98, -1, 100, + -1, 102, 103, 104, -1, -1, -1, -1, -1, 110, + 111, 112, 113, -1, -1, -1, -1, -1, -1, -1, + 121, 122, -1, 124, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, - 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, + 59, -1, 61, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - -1, -1, 81, 82, 83, 84, 85, 86, -1, 88, - -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, - 5, 6, -1, -1, 9, 10, 11, 12, 13, 14, - -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, - -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, - 85, 86, 87, 88, -1, -1, 91, -1, -1, -1, - -1, 96, 97, 98, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, - 11, 12, 13, 14, -1, 16, -1, -1, -1, 20, - 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, - 31, 32, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, 55, -1, -1, -1, 59, -1, - 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, - 81, 82, 83, 84, 85, 86, 87, 88, -1, -1, - 91, -1, -1, -1, -1, 96, 97, 98, -1, -1, - -1, -1, -1, -1, -1, -1, -1, + 79, 80, -1, -1, 83, 84, 85, -1, -1, 88, + -1, 90, -1, -1, -1, -1, -1, 96, 97, 98, + -1, 100, -1, 102, 103, 104, -1, -1, -1, -1, + -1, 110, 111, 112, 113, -1, -1, -1, -1, -1, + -1, -1, 121, 122, -1, 124, -1, - 18, 18, 32, 18, 32, 18, 3, 43, 18, 25, - 22, 22, 14, 14, 78, 18, 9, 3, 18, 3, - 18, 3, 18, 32, 18, 32, 32, 22, 18, 18, - 22, 3, 3, 18, 106, 43, 3, 18, 18, 101, - 3, 3, 18, 18, 18, 104, 3, 3, 18, 18, - 18, 3, 18, 18, 18, 43, 3, 3, 3, 32, - 14, 3, 3, 3, 25, 25, 25, -1, 55, 18, - 57, 2, 55, -1, -1, 2, 55, 60, 3, -1, - 18, 60, 18, 18, -1, 43, 25, 18, 43, -1, - 43, 18, 43, 43, 18, 43, 11, 12, 14, 43, - 43, 4, 3, 19, 18, 18, 3, 14, 3, 45, - 18, -1, 18, -1, 2, 18, 23, 2, 55, 2, - 57, 55, 55, 57, 57, 55, 55, 57, 57, 55, - 18, 57, 45, 18, 55, 18, 57, 2, 46, 2, - 2, 47, 2, 55, 55, 55, 55, 57, 60, 60, - 55, 60, 57, 18, 79, 18, 18, 55, 18, 55, - 95, 57, 60, 14, 2, 2, 55, -1, 55, 18, - 14, 55, 61, 55, 61, 19, 60, 59, 79, 55, - 18, 18, 79, 59, 79, 55, 55, 55, 14, 55, - 60, 60, 60, 18, 60, 2, 110, 55, 47, 55, - 43, 52, 60, 59, 18, 55, 2, 57, 51, 55, - 55, 18, 39, 55, 55, 18, 43, 4, 2, 55, - 65, 67, 18, 2, 18, 61, 52, 2, 69, 71, - 2, 18, 46, 55, 18, 57, 55, 4, 57, 18, - 55, 44, 57, 18, 55, 55, 18, 58, 58, 18, - 43, 18, 46, 55, 14, 57, 55, 18, 51, 19, - 2, 2, 61, 55, 55, 57, 55, 55, 93, 57, - -1, 60, 63, -1, -1, 55, 18, 18, 47, 68, - 60, -1, 55, -1, 64, 46, 18, 60, -1, 62, - 55, 55, -1, -1, -1, 60, 60, 62, 62, 55, - 55, -1, 55, 55, 60, 60, 62, 60, 60, 55, - 55, -1, 55, 66, 60, 60, 48, 60, 55, 55, - -1, 14, 77, 60, 60, 77, 19, 72, 21, -1, - 14, 77, -1, 70, 77, 5, -1, 5, -1, 23, - -1, 77, -1, -1, 14, -1, 14, 89, 89, -1, - 43, 35, 36, 23, -1, 23, 25, 26, 27, 28, - 29, 30, 31, -1, -1, 35, 36, 35, 36, -1, - -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, - 18, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 14, -1, -1, -1, -1, -1, -1, -1, -1, 23, - 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, - 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, + 58, 181, 180, 35, 18, 182, 35, 22, 187, 14, + 185, 22, 18, 35, 22, 18, 201, 200, 28, 58, + 18, 22, 18, 35, 18, 41, 200, 172, 35, 172, + 174, 173, 18, 63, 29, 35, 18, 24, 135, 135, + 162, 182, 165, 168, 53, 58, 181, 174, 172, 53, + 41, 53, 173, 172, 174, 173, 76, 29, 95, 58, + 98, 41, 179, 172, 172, 58, 58, 173, 53, 66, + 174, 29, 53, 172, 53, 53, 174, 53, 173, 159, + 41, 58, 56, 58, 174, 58, 76, 58, 58, 58, + 173, 172, 76, 76, 41, 38, 184, 172, 29, 66, + 135, 41, 66, 53, 172, 174, 184, 173, 76, 74, + 76, 74, 74, 185, 185, 75, 172, 181, 66, 53, + 187, 182, 187, 41, 172, 172, 115, 173, 181, 173, + 182, 174, 51, 53, 58, 58, 58, 58, 77, 53, + 41, 58, 98, 95, 180, 56, 53, 24, 58, 58, + 41, 42, 24, 2, 53, 51, 53, 41, 42, 53, + 53, 2, 41, 2, 2, 41, 42, 53, 53, 58, + 2, 60, 24, 56, 24, 24, 58, 27, 58, 59, + 2, 2, 41, 24, 58, 24, 24, 41, 42, 58, + 41, 24, 24, 72, 41, 41, 41, 2, 24, 81, + 2, 27, 24, 24, 2, 41, 2, 81, 24, 38, + 41, 42, 81, 41, 24, 203, 204, 27, 117, 24, + 117, 72, 24, 117, 117, 72, 24, 72, 24, 41, + 42, 117, 117, 41, 42, 41, 72, 41, 42, -1, + 41, 41, 41, 24, 41, 85, 41, 42, 11, 12, + 53, 54, 92, 41, 41, 42, 41, 42, 41, 42, + 137, 41, 68, 135, 41, 42, 41, 42, 69, 68, + 3, 68, 41, 42, 157, 41, 42, 41, 42, 61, + 68, 69, -1, 68, 136, 41, 42, 41, 42, 41, + 42, 41, 72, 41, 42, 41, 42, 41, 42, 41, + 42, -1, 52, 85, 137, 54, 55, 41, 42, 58, + 92, 41, 42, 41, 42, -1, 72, 2, 41, 42, + 3, 137, 41, 42, 41, 42, 38, 186, 41, 42, + 41, 42, 41, 42, -1, 85, 41, 42, 178, 24, + 186, 170, 41, 42, 16, 41, 42, 41, -1, 41, + 41, 61, 85, 41, 42, -1, 137, -1, 52, 92, + 52, 52, -1, 191, 151, -1, 54, -1, 61, 41, + 41, 41, 42, 72, 151, 85, 151, 61, 41, -1, + 52, 52, 92, 41, 42, -1, 186, -1, 171, 52, + -1, 85, 85, 85, 85, 89, 178, 151, 89, 92, + 92, 85, 85, 38, 39, -1, 78, 171, 92, 92, + 68, -1, 158, -1, 85, 196, 128, 41, 130, 171, + 61, 92, 85, 151, -1, 88, -1, 175, 52, 171, + -1, 211, 41, -1, 41, 42, 205, 171, 61, 205, + 184, 171, 151, 52, 85, 178, 151, 54, 61, 41, + 42, 92, 171, 149, -1, 151, -1, 180, 170, 61, + 171, 85, 85, 41, -1, 61, -1, 180, 178, 92, + 158, 41, 85, 41, 52, 41, 85, 147, 41, 92, + 104, 151, 52, 85, 52, 178, 52, -1, 205, 85, + 92, 126, 41, -1, 178, 178, 92, 106, 156, 41, + 41, 64, 16, 52, -1, 68, 69, 85, 207, 41, + 52, 52, 41, 42, -1, 85, -1, 85, 96, 85, + 52, 91, 16, -1, -1, 93, 92, 41, 41, -1, + -1, -1, -1, -1, 41, 170, 85, 178, 52, 52, + -1, 41, 91, 85, 85, 52, 41, 41, -1, 91, + -1, 158, 52, 85, -1, 178, 148, 52, 52, 151, + 41, 102, 41, -1, 78, 178, -1, -1, 100, -1, + 41, 52, 85, 52, -1, 88, 178, -1, 85, 86, + 87, 52, 178, 41, 78, 85, 86, 87, 82, -1, + 85, 86, 87, -1, 52, -1, 41, 42, -1, 16, + 16, 41, 19, 19, 85, -1, 85, 86, 87, 54, + 55, 92, 52, 3, 85, 86, 87, -1, 147, 41, + 101, -1, 151, -1, 41, 41, -1, 85, -1, 41, + 52, 41, 41, -1, 92, 52, 52, -1, -1, 97, + 52, 16, 52, 52, -1, 85, 86, 87, 23, 16, + -1, -1, 19, 16, 21, -1, 19, -1, -1, -1, + 41, 78, 78, 85, -1, -1, 41, -1, -1, -1, + 92, 52, 94, 85, 16, 85, 85, 52, 41, 41, + 92, 23, 92, 92, -1, -1, -1, 99, -1, 52, + 52, 58, 59, 103, -1, 85, 105, 39, -1, 41, + 41, -1, 92, 78, 85, 86, 87, -1, -1, -1, + 52, 52, -1, 158, -1, 78, 4, -1, -1, 4, + -1, -1, -1, 85, 86, 87, -1, -1, 16, -1, + -1, 16, -1, -1, -1, 23, 78, -1, 23, -1, + -1, -1, -1, 16, 85, 86, 87, -1, 138, 139, + 23, 39, -1, 41, 39, 28, 41, 30, 31, 32, + 33, 34, 16, -1, 52, -1, -1, 52, -1, 23, + -1, -1, -1, -1, 28, -1, 30, 31, 32, 33, + 34, -1, 16, -1, -1, -1, -1, -1, 178, 23, + 78, -1, -1, 78, 28, -1, 30, 31, 32, 33, + 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 28, -1, 30, 31, 32, 33, 34, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, - -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, - 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -1147,7 +2063,7 @@ const short QmlJSGrammar::action_check [] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1 + -1, -1, -1, -1, -1, -1, -1 }; QT_END_NAMESPACE diff --git a/src/libs/qmljs/parser/qmljsgrammar_p.h b/src/libs/qmljs/parser/qmljsgrammar_p.h index 8250a1e111..6d1b971dca 100644 --- a/src/libs/qmljs/parser/qmljsgrammar_p.h +++ b/src/libs/qmljs/parser/qmljsgrammar_p.h @@ -3,8 +3,9 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of Qt Creator. +** This file is part of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -21,6 +22,8 @@ ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** +** $QT_END_LICENSE$ +** ****************************************************************************/ // @@ -39,7 +42,6 @@ #define QMLJSGRAMMAR_P_H #include "qmljsglobal_p.h" -#include <QtCore/qglobal.h> QT_BEGIN_NAMESPACE @@ -48,47 +50,55 @@ class QML_PARSER_EXPORT QmlJSGrammar public: enum VariousConstants { EOF_SYMBOL = 0, - REDUCE_HERE = 107, - SHIFT_THERE = 106, + REDUCE_HERE = 125, T_AND = 1, T_AND_AND = 2, T_AND_EQ = 3, - T_AS = 95, + T_ARROW = 93, + T_AS = 110, T_AUTOMATIC_SEMICOLON = 62, T_BREAK = 4, T_CASE = 5, T_CATCH = 6, + T_CLASS = 98, T_COLON = 7, T_COMMA = 8, - T_COMMENT = 89, - T_COMPATIBILITY_SEMICOLON = 90, - T_CONST = 84, + T_COMMENT = 91, + T_COMPATIBILITY_SEMICOLON = 92, + T_CONST = 86, T_CONTINUE = 9, - T_DEBUGGER = 86, + T_DEBUGGER = 88, T_DEFAULT = 10, T_DELETE = 11, T_DIVIDE_ = 12, T_DIVIDE_EQ = 13, T_DO = 14, T_DOT = 15, + T_ELLIPSIS = 95, T_ELSE = 16, - T_ENUM = 91, + T_ENUM = 94, T_EQ = 17, T_EQ_EQ = 18, T_EQ_EQ_EQ = 19, - T_ERROR = 99, - T_FALSE = 83, - T_FEED_JS_EXPRESSION = 103, - T_FEED_JS_PROGRAM = 105, - T_FEED_JS_SOURCE_ELEMENT = 104, - T_FEED_JS_STATEMENT = 102, - T_FEED_UI_OBJECT_MEMBER = 101, - T_FEED_UI_PROGRAM = 100, + T_ERROR = 114, + T_EXPORT = 101, + T_EXTENDS = 99, + T_FALSE = 85, + T_FEED_JS_EXPRESSION = 118, + T_FEED_JS_MODULE = 120, + T_FEED_JS_SCRIPT = 119, + T_FEED_JS_STATEMENT = 117, + T_FEED_UI_OBJECT_MEMBER = 116, + T_FEED_UI_PROGRAM = 115, T_FINALLY = 20, T_FOR = 21, + T_FORCE_BLOCK = 122, + T_FORCE_DECLARATION = 121, + T_FOR_LOOKAHEAD_OK = 123, + T_FROM = 102, T_FUNCTION = 22, T_GE = 23, - T_GET = 97, + T_GET = 112, T_GT = 24, T_GT_GT = 25, T_GT_GT_EQ = 26, @@ -96,13 +106,13 @@ public: T_GT_GT_GT_EQ = 28, T_IDENTIFIER = 29, T_IF = 30, - T_IMPORT = 93, + T_IMPORT = 108, T_IN = 31, T_INSTANCEOF = 32, T_LBRACE = 33, T_LBRACKET = 34, T_LE = 35, - T_LET = 85, + T_LET = 87, T_LPAREN = 36, T_LT = 37, T_LT_LT = 38, @@ -110,66 +120,82 @@ public: T_MINUS = 40, T_MINUS_EQ = 41, T_MINUS_MINUS = 42, - T_MULTILINE_STRING_LITERAL = 88, + T_MULTILINE_STRING_LITERAL = 90, T_NEW = 43, T_NOT = 44, T_NOT_EQ = 45, T_NOT_EQ_EQ = 46, - T_NULL = 81, + T_NO_SUBSTITUTION_TEMPLATE = 103, + T_NULL = 83, T_NUMERIC_LITERAL = 47, - T_ON = 96, + T_OF = 111, + T_ON = 124, T_OR = 48, T_OR_EQ = 49, T_OR_OR = 50, T_PLUS = 51, T_PLUS_EQ = 52, T_PLUS_PLUS = 53, - T_PRAGMA = 94, - T_PROPERTY = 66, - T_PUBLIC = 92, + T_PRAGMA = 109, + T_PROPERTY = 68, + T_PUBLIC = 107, T_QUESTION = 54, T_RBRACE = 55, T_RBRACKET = 56, - T_READONLY = 68, + T_READONLY = 70, T_REMAINDER = 57, T_REMAINDER_EQ = 58, - T_RESERVED_WORD = 87, + T_RESERVED_WORD = 89, T_RETURN = 59, T_RPAREN = 60, T_SEMICOLON = 61, - T_SET = 98, - T_SIGNAL = 67, + T_SET = 113, + T_SIGNAL = 69, T_STAR = 63, - T_STAR_EQ = 64, - T_STRING_LITERAL = 65, - T_SWITCH = 69, - T_THIS = 70, - T_THROW = 71, - T_TILDE = 72, - T_TRUE = 82, - T_TRY = 73, - T_TYPEOF = 74, - T_VAR = 75, - T_VOID = 76, - T_WHILE = 77, - T_WITH = 78, - T_XOR = 79, - T_XOR_EQ = 80, - - ACCEPT_STATE = 691, - RULE_COUNT = 369, - STATE_COUNT = 692, - TERMINAL_COUNT = 108, - NON_TERMINAL_COUNT = 112, - - GOTO_INDEX_OFFSET = 692, - GOTO_INFO_OFFSET = 3357, - GOTO_CHECK_OFFSET = 3357 + T_STAR_EQ = 66, + T_STAR_STAR = 64, + T_STAR_STAR_EQ = 65, + T_STATIC = 100, + T_STRING_LITERAL = 67, + T_SUPER = 97, + T_SWITCH = 71, + T_TEMPLATE_HEAD = 104, + T_TEMPLATE_MIDDLE = 105, + T_TEMPLATE_TAIL = 106, + T_THIS = 72, + T_THROW = 73, + T_TILDE = 74, + T_TRUE = 84, + T_TRY = 75, + T_TYPEOF = 76, + T_VAR = 77, + T_VOID = 78, + T_WHILE = 79, + T_WITH = 80, + T_XOR = 81, + T_XOR_EQ = 82, + T_YIELD = 96, + + ACCEPT_STATE = 1008, + RULE_COUNT = 586, + STATE_COUNT = 1009, + TERMINAL_COUNT = 126, + NON_TERMINAL_COUNT = 213, + + GOTO_INDEX_OFFSET = 1009, + GOTO_INFO_OFFSET = 5937, + GOTO_CHECK_OFFSET = 5937 }; static const char *const spell[]; static const short lhs[]; static const short rhs[]; + +#ifndef QLALR_NO_QMLJSGRAMMAR_DEBUG_INFO + static const int rule_index[]; + static const int rule_info[]; +#endif // QLALR_NO_QMLJSGRAMMAR_DEBUG_INFO + static const short goto_default[]; static const short action_default[]; static const short action_index[]; diff --git a/src/libs/qmljs/parser/qmljskeywords_p.h b/src/libs/qmljs/parser/qmljskeywords_p.h index 4b56b83815..cc03e7599f 100644 --- a/src/libs/qmljs/parser/qmljskeywords_p.h +++ b/src/libs/qmljs/parser/qmljskeywords_p.h @@ -42,10 +42,10 @@ QT_QML_BEGIN_NAMESPACE namespace QmlJS { -static inline int classify2(const QChar *s, bool qmlMode) { +static inline int classify2(const QChar *s, int parseModeFlags) { if (s[0].unicode() == 'a') { if (s[1].unicode() == 's') { - return qmlMode ? Lexer::T_AS : Lexer::T_IDENTIFIER; + return Lexer::T_AS; } } else if (s[0].unicode() == 'd') { @@ -61,15 +61,18 @@ static inline int classify2(const QChar *s, bool qmlMode) { return Lexer::T_IN; } } - else if (qmlMode && s[0].unicode() == 'o') { + else if (s[0].unicode() == 'o') { if (s[1].unicode() == 'n') { - return qmlMode ? Lexer::T_ON : Lexer::T_IDENTIFIER; + return (parseModeFlags & Lexer::QmlMode) ? Lexer::T_ON : Lexer::T_IDENTIFIER; + } + else if (s[1].unicode() == 'f') { + return Lexer::T_OF; } } return Lexer::T_IDENTIFIER; } -static inline int classify3(const QChar *s, bool qmlMode) { +static inline int classify3(const QChar *s, int parseModeFlags) { if (s[0].unicode() == 'f') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'r') { @@ -87,7 +90,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 qmlMode ? int(Lexer::T_INT) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_INT) : int(Lexer::T_IDENTIFIER); } } } @@ -129,12 +132,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, int parseModeFlags) { if (s[0].unicode() == 'b') { if (s[1].unicode() == 'y') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'e') { - return qmlMode ? int(Lexer::T_BYTE) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_BYTE) : int(Lexer::T_IDENTIFIER); } } } @@ -150,7 +153,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 qmlMode ? int(Lexer::T_CHAR) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_CHAR) : int(Lexer::T_IDENTIFIER); } } } @@ -166,7 +169,16 @@ static inline int classify4(const QChar *s, bool qmlMode) { else if (s[1].unicode() == 'n') { if (s[2].unicode() == 'u') { if (s[3].unicode() == 'm') { - return qmlMode ? int(Lexer::T_ENUM) : int(Lexer::T_RESERVED_WORD); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_ENUM) : int(Lexer::T_RESERVED_WORD); + } + } + } + } + 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); } } } @@ -175,7 +187,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 qmlMode ? int(Lexer::T_GOTO) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_GOTO) : int(Lexer::T_IDENTIFIER); } } } @@ -184,7 +196,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 qmlMode ? int(Lexer::T_LONG) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_LONG) : int(Lexer::T_IDENTIFIER); } } } @@ -235,7 +247,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, int parseModeFlags) { if (s[0].unicode() == 'b') { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'e') { @@ -290,7 +302,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 qmlMode ? int(Lexer::T_FINAL) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_FINAL) : int(Lexer::T_IDENTIFIER); } } } @@ -299,7 +311,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 qmlMode ? int(Lexer::T_FLOAT) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_FLOAT) : int(Lexer::T_IDENTIFIER); } } } @@ -310,7 +322,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 qmlMode ? int(Lexer::T_SHORT) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_SHORT) : int(Lexer::T_IDENTIFIER); } } } @@ -319,7 +331,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 qmlMode ? int(Lexer::T_SUPER) : int(Lexer::T_RESERVED_WORD); + return int(Lexer::T_SUPER); } } } @@ -347,10 +359,21 @@ static inline int classify5(const QChar *s, bool qmlMode) { } } } + else if (s[0].unicode() == 'y') { + if (s[1].unicode() == 'i') { + if (s[2].unicode() == 'e') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'd') { + return (parseModeFlags & Lexer::YieldIsKeyword) ? Lexer::T_YIELD : Lexer::T_IDENTIFIER; + } + } + } + } + } return Lexer::T_IDENTIFIER; } -static inline int classify6(const QChar *s, bool qmlMode) { +static inline int classify6(const QChar *s, int parseModeFlags) { if (s[0].unicode() == 'd') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'l') { @@ -368,7 +391,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 qmlMode ? int(Lexer::T_DOUBLE) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_DOUBLE) : int(Lexer::T_IDENTIFIER); } } } @@ -394,7 +417,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 ? int(Lexer::T_IMPORT) : int(Lexer::T_RESERVED_WORD); + return Lexer::T_IMPORT; } } } @@ -407,7 +430,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 qmlMode ? int(Lexer::T_NATIVE) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_NATIVE) : int(Lexer::T_IDENTIFIER); } } } @@ -420,7 +443,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_IDENTIFIER; + return (parseModeFlags & Lexer::QmlMode) ? Lexer::T_PUBLIC : Lexer::T_IDENTIFIER; } } } @@ -431,7 +454,7 @@ static inline int classify6(const QChar *s, bool qmlMode) { if (s[3].unicode() == 'g') { if (s[4].unicode() == 'm') { if (s[5].unicode() == 'a') { - return qmlMode ? Lexer::T_PRAGMA : Lexer::T_IDENTIFIER; + return (parseModeFlags & Lexer::QmlMode) ? Lexer::T_PRAGMA : Lexer::T_IDENTIFIER; } } } @@ -452,7 +475,7 @@ static inline int classify6(const QChar *s, bool qmlMode) { } } else if (s[0].unicode() == 's') { - if (qmlMode && s[1].unicode() == 'i') { + if ((parseModeFlags & Lexer::QmlMode) && s[1].unicode() == 'i') { if (s[2].unicode() == 'g') { if (s[3].unicode() == 'n') { if (s[4].unicode() == 'a') { @@ -468,7 +491,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 qmlMode ? int(Lexer::T_STATIC) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::StaticIsKeyword) ? int(Lexer::T_STATIC) : int(Lexer::T_IDENTIFIER); } } } @@ -492,7 +515,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 qmlMode ? int(Lexer::T_THROWS) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_THROWS) : int(Lexer::T_IDENTIFIER); } } } @@ -513,7 +536,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, int parseModeFlags) { if (s[0].unicode() == 'b') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'o') { @@ -521,7 +544,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 qmlMode ? int(Lexer::T_BOOLEAN) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_BOOLEAN) : int(Lexer::T_IDENTIFIER); } } } @@ -581,7 +604,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 qmlMode ? int(Lexer::T_PACKAGE) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_PACKAGE) : int(Lexer::T_IDENTIFIER); } } } @@ -594,7 +617,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 qmlMode ? int(Lexer::T_PRIVATE) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_PRIVATE) : int(Lexer::T_IDENTIFIER); } } } @@ -605,7 +628,7 @@ static inline int classify7(const QChar *s, bool qmlMode) { return Lexer::T_IDENTIFIER; } -static inline int classify8(const QChar *s, bool qmlMode) { +static inline int classify8(const QChar *s, int parseModeFlags) { if (s[0].unicode() == 'a') { if (s[1].unicode() == 'b') { if (s[2].unicode() == 's') { @@ -614,7 +637,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 qmlMode ? int(Lexer::T_ABSTRACT) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_ABSTRACT) : int(Lexer::T_IDENTIFIER); } } } @@ -674,7 +697,7 @@ static inline int classify8(const QChar *s, bool qmlMode) { } } } - else if (qmlMode && s[0].unicode() == 'p') { + else if ((parseModeFlags & Lexer::QmlMode) && s[0].unicode() == 'p') { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'p') { @@ -691,7 +714,7 @@ static inline int classify8(const QChar *s, bool qmlMode) { } } } - else if (qmlMode && s[0].unicode() == 'r') { + else if ((parseModeFlags & Lexer::QmlMode) && s[0].unicode() == 'r') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 'd') { @@ -716,7 +739,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 qmlMode ? int(Lexer::T_VOLATILE) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_VOLATILE) : int(Lexer::T_IDENTIFIER); } } } @@ -728,7 +751,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, int parseModeFlags) { if (s[0].unicode() == 'i') { if (s[1].unicode() == 'n') { if (s[2].unicode() == 't') { @@ -738,7 +761,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 qmlMode ? int(Lexer::T_INTERFACE) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_INTERFACE) : int(Lexer::T_IDENTIFIER); } } } @@ -757,7 +780,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 qmlMode ? int(Lexer::T_PROTECTED) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_PROTECTED) : int(Lexer::T_IDENTIFIER); } } } @@ -776,7 +799,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 qmlMode ? int(Lexer::T_TRANSIENT) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_TRANSIENT) : int(Lexer::T_IDENTIFIER); } } } @@ -789,7 +812,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, int parseModeFlags) { if (s[0].unicode() == 'i') { if (s[1].unicode() == 'm') { if (s[2].unicode() == 'p') { @@ -800,7 +823,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 qmlMode ? int(Lexer::T_IMPLEMENTS) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_IMPLEMENTS) : int(Lexer::T_IDENTIFIER); } } } @@ -833,7 +856,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, int parseModeFlags) { if (s[0].unicode() == 's') { if (s[1].unicode() == 'y') { if (s[2].unicode() == 'n') { @@ -846,7 +869,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 qmlMode ? int(Lexer::T_SYNCHRONIZED) : int(Lexer::T_IDENTIFIER); + return (parseModeFlags & Lexer::QmlMode) ? int(Lexer::T_SYNCHRONIZED) : int(Lexer::T_IDENTIFIER); } } } @@ -862,18 +885,18 @@ static inline int classify12(const QChar *s, bool qmlMode) { return Lexer::T_IDENTIFIER; } -int Lexer::classify(const QChar *s, int n, bool qmlMode) { +int Lexer::classify(const QChar *s, int n, int parseModeFlags) { switch (n) { - case 2: return classify2(s, qmlMode); - case 3: return classify3(s, qmlMode); - case 4: return classify4(s, qmlMode); - case 5: return classify5(s, qmlMode); - case 6: return classify6(s, qmlMode); - case 7: return classify7(s, qmlMode); - case 8: return classify8(s, qmlMode); - case 9: return classify9(s, qmlMode); - case 10: return classify10(s, qmlMode); - case 12: return classify12(s, qmlMode); + case 2: return classify2(s, parseModeFlags); + case 3: return classify3(s, parseModeFlags); + case 4: return classify4(s, parseModeFlags); + case 5: return classify5(s, parseModeFlags); + case 6: return classify6(s, parseModeFlags); + case 7: return classify7(s, parseModeFlags); + case 8: return classify8(s, parseModeFlags); + case 9: return classify9(s, parseModeFlags); + case 10: return classify10(s, parseModeFlags); + case 12: return classify12(s, parseModeFlags); default: return Lexer::T_IDENTIFIER; } // switch } diff --git a/src/libs/qmljs/parser/qmljslexer.cpp b/src/libs/qmljs/parser/qmljslexer.cpp index 42fbc8186e..19d367be1b 100644 --- a/src/libs/qmljs/parser/qmljslexer.cpp +++ b/src/libs/qmljs/parser/qmljslexer.cpp @@ -44,6 +44,8 @@ static inline int regExpFlagFromChar(const QChar &ch) case 'g': return Lexer::RegExp_Global; case 'i': return Lexer::RegExp_IgnoreCase; case 'm': return Lexer::RegExp_Multiline; + case 'u': return Lexer::RegExp_Unicode; + case 'y': return Lexer::RegExp_Sticky; } return 0; } @@ -63,22 +65,15 @@ static inline QChar convertHex(QChar c1, QChar c2) return QChar((convertHex(c1.unicode()) << 4) + convertHex(c2.unicode())); } -static inline QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4) -{ - return QChar((convertHex(c3.unicode()) << 4) + convertHex(c4.unicode()), - (convertHex(c1.unicode()) << 4) + convertHex(c2.unicode())); -} - Lexer::Lexer(Engine *engine) : _engine(engine) - , _codePtr(0) - , _endPtr(0) - , _lastLinePtr(0) - , _tokenLinePtr(0) - , _tokenStartPtr(0) + , _codePtr(nullptr) + , _endPtr(nullptr) + , _tokenStartPtr(nullptr) , _char(QLatin1Char('\n')) , _errorCode(NoError) , _currentLineNumber(0) + , _currentColumnNumber(0) , _tokenValue(0) , _parenthesesState(IgnoreParentheses) , _parenthesesCount(0) @@ -87,6 +82,7 @@ Lexer::Lexer(Engine *engine) , _tokenKind(0) , _tokenLength(0) , _tokenLine(0) + , _tokenColumn(0) , _validTokenText(false) , _prohibitAutomaticSemicolon(false) , _restrictedKeyword(false) @@ -123,14 +119,13 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode) _codePtr = code.unicode(); _endPtr = _codePtr + code.length(); - _lastLinePtr = _codePtr; - _tokenLinePtr = _codePtr; _tokenStartPtr = _codePtr; _char = QLatin1Char('\n'); _errorCode = NoError; _currentLineNumber = lineno; + _currentColumnNumber = 0; _tokenValue = 0; // parentheses state @@ -142,6 +137,7 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode) _patternFlags = 0; _tokenLength = 0; _tokenLine = lineno; + _tokenColumn = 0; _validTokenText = false; _prohibitAutomaticSemicolon = false; @@ -158,9 +154,10 @@ void Lexer::scanChar() if (sequenceLength == 2) _char = *_codePtr++; - if (unsigned sequenceLength = isLineTerminatorSequence()) { - _lastLinePtr = _codePtr + sequenceLength - 1; // points to the first character after the newline + ++_currentColumnNumber; + if (isLineTerminator()) { ++_currentLineNumber; + _currentColumnNumber = 0; } } @@ -208,12 +205,32 @@ inline bool isBinop(int tok) return false; } } + +int hexDigit(QChar c) +{ + if (c >= QLatin1Char('0') && c <= QLatin1Char('9')) + return c.unicode() - '0'; + if (c >= QLatin1Char('a') && c <= QLatin1Char('f')) + return c.unicode() - 'a' + 10; + if (c >= QLatin1Char('A') && c <= QLatin1Char('F')) + return c.unicode() - 'A' + 10; + return -1; +} + +int octalDigit(QChar c) +{ + if (c >= QLatin1Char('0') && c <= QLatin1Char('7')) + return c.unicode() - '0'; + return -1; +} + } // anonymous namespace int Lexer::lex() { const int previousTokenKind = _tokenKind; + again: _tokenSpell = QStringRef(); _tokenKind = scanToken(); _tokenLength = _codePtr - _tokenStartPtr - 1; @@ -225,6 +242,9 @@ int Lexer::lex() // update the flags switch (_tokenKind) { case T_LBRACE: + if (_bracesCount > 0) + ++_bracesCount; + Q_FALLTHROUGH(); case T_SEMICOLON: case T_QUESTION: case T_COLON: @@ -252,9 +272,15 @@ int Lexer::lex() case T_CONTINUE: case T_BREAK: case T_RETURN: + case T_YIELD: case T_THROW: _restrictedKeyword = true; break; + case T_RBRACE: + if (_bracesCount > 0) + --_bracesCount; + if (_bracesCount == 0) + goto again; } // switch // update the parentheses state @@ -281,39 +307,57 @@ int Lexer::lex() return _tokenKind; } -bool Lexer::isUnicodeEscapeSequence(const QChar *chars) -{ - if (isHexDigit(chars[0]) && isHexDigit(chars[1]) && isHexDigit(chars[2]) && isHexDigit(chars[3])) - return true; - - return false; -} - -QChar Lexer::decodeUnicodeEscapeCharacter(bool *ok) +uint Lexer::decodeUnicodeEscapeCharacter(bool *ok) { - if (_char == QLatin1Char('u') && isUnicodeEscapeSequence(&_codePtr[0])) { - scanChar(); // skip u + Q_ASSERT(_char == QLatin1Char('u')); + scanChar(); // skip u + if (_codePtr + 4 <= _endPtr && isHexDigit(_char)) { + uint codePoint = 0; + for (int i = 0; i < 4; ++i) { + int digit = hexDigit(_char); + if (digit < 0) + goto error; + codePoint *= 16; + codePoint += digit; + scanChar(); + } - const QChar c1 = _char; - scanChar(); + *ok = true; + return codePoint; + } else if (_codePtr < _endPtr && _char == QLatin1Char('{')) { + scanChar(); // skip '{' + uint codePoint = 0; + if (!isHexDigit(_char)) + // need at least one hex digit + goto error; - const QChar c2 = _char; - scanChar(); + while (_codePtr <= _endPtr) { + int digit = hexDigit(_char); + if (digit < 0) + break; + codePoint *= 16; + codePoint += digit; + if (codePoint > 0x10ffff) + goto error; + scanChar(); + } - const QChar c3 = _char; - scanChar(); + if (_char != QLatin1Char('}')) + goto error; - const QChar c4 = _char; - scanChar(); + scanChar(); // skip '}' - if (ok) - *ok = true; - return convertUnicode(c1, c2, c3, c4); + *ok = true; + return codePoint; } + error: + _errorCode = IllegalUnicodeEscapeSequence; + _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence"); + *ok = false; - return QChar(); + return 0; } QChar Lexer::decodeHexEscapeCharacter(bool *ok) @@ -337,15 +381,15 @@ QChar Lexer::decodeHexEscapeCharacter(bool *ok) return QChar(); } -static inline bool isIdentifierStart(QChar ch) +static inline bool isIdentifierStart(uint ch) { // fast path for ascii - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || - (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || + if ((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || ch == '$' || ch == '_') return true; - switch (ch.category()) { + switch (QChar::category(ch)) { case QChar::Number_Letter: case QChar::Letter_Uppercase: case QChar::Letter_Lowercase: @@ -359,17 +403,17 @@ static inline bool isIdentifierStart(QChar ch) return false; } -static bool isIdentifierPart(QChar ch) +static bool isIdentifierPart(uint ch) { // fast path for ascii - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || - (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || - (ch.unicode() >= '0' && ch.unicode() <= '9') || + if ((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >= '0' && ch <= '9') || ch == '$' || ch == '_' || - ch.unicode() == 0x200c /* ZWNJ */ || ch.unicode() == 0x200d /* ZWJ */) + ch == 0x200c /* ZWNJ */ || ch == 0x200d /* ZWJ */) return true; - switch (ch.category()) { + switch (QChar::category(ch)) { case QChar::Mark_NonSpacing: case QChar::Mark_SpacingCombining: @@ -398,19 +442,23 @@ int Lexer::scanToken() return tk; } + if (_bracesCount == 0) { + // we're inside a Template string + return scanString(TemplateContinuation); + } + + _terminator = false; again: _validTokenText = false; - _tokenLinePtr = _lastLinePtr; while (_char.isSpace()) { - if (unsigned sequenceLength = isLineTerminatorSequence()) { - _tokenLinePtr = _codePtr + sequenceLength - 1; - + if (isLineTerminator()) { if (_restrictedKeyword) { // automatic semicolon insertion _tokenLine = _currentLineNumber; + _tokenColumn = _currentColumnNumber; _tokenStartPtr = _codePtr - 1; return T_SEMICOLON; } else { @@ -424,6 +472,7 @@ again: _tokenStartPtr = _codePtr - 1; _tokenLine = _currentLineNumber; + _tokenColumn = _currentColumnNumber; if (_codePtr > _endPtr) return EOF_SYMBOL; @@ -487,6 +536,9 @@ again: return T_EQ_EQ_EQ; } return T_EQ_EQ; + } else if (_char == QLatin1Char('>')) { + scanChar(); + return T_ARROW; } return T_EQ; @@ -543,50 +595,18 @@ again: return T_DIVIDE_; case '.': - if (_char.isDigit()) { - QVarLengthArray<char,32> chars; - - chars.append(ch.unicode()); // append the `.' - - while (_char.isDigit()) { - chars.append(_char.unicode()); + if (isDecimalDigit(_char.unicode())) + return scanNumber(ch); + if (_char == QLatin1Char('.')) { + scanChar(); + if (_char == QLatin1Char('.')) { scanChar(); - } - - if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) { - if (_codePtr[0].isDigit() || ((_codePtr[0] == QLatin1Char('+') || _codePtr[0] == QLatin1Char('-')) && - _codePtr[1].isDigit())) { - - chars.append(_char.unicode()); - scanChar(); // consume `e' - - if (_char == QLatin1Char('+') || _char == QLatin1Char('-')) { - chars.append(_char.unicode()); - scanChar(); // consume the sign - } - - while (_char.isDigit()) { - chars.append(_char.unicode()); - scanChar(); - } - } - } - - chars.append('\0'); - - const char *begin = chars.constData(); - const char *end = 0; - bool ok = false; - - _tokenValue = qstrtod(begin, &end, &ok); - - if (end - begin != chars.size() - 1) { - _errorCode = IllegalExponentIndicator; - _errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number"); + return T_ELLIPSIS; + } else { + _errorCode = IllegalCharacter; + _errorMessage = QCoreApplication::translate("QmlParser", "Unexpected token '.'"); return T_ERROR; } - - return T_NUMERIC_LITERAL; } return T_DOT; @@ -597,7 +617,7 @@ again: } else if (_char == QLatin1Char('-')) { scanChar(); - if (_terminator && !_delimited && !_prohibitAutomaticSemicolon) { + if (_terminator && !_delimited && !_prohibitAutomaticSemicolon && _tokenKind != T_LPAREN) { _stackToken = T_MINUS_MINUS; return T_SEMICOLON; } @@ -615,7 +635,7 @@ again: } else if (_char == QLatin1Char('+')) { scanChar(); - if (_terminator && !_delimited && !_prohibitAutomaticSemicolon) { + if (_terminator && !_delimited && !_prohibitAutomaticSemicolon && _tokenKind != T_LPAREN) { _stackToken = T_PLUS_PLUS; return T_SEMICOLON; } @@ -628,6 +648,13 @@ again: if (_char == QLatin1Char('=')) { scanChar(); return T_STAR_EQ; + } else if (_char == QLatin1Char('*')) { + scanChar(); + if (_char == QLatin1Char('=')) { + scanChar(); + return T_STAR_STAR_EQ; + } + return T_STAR_STAR; } return T_STAR; @@ -662,141 +689,12 @@ again: } return T_NOT; + case '`': + _outerTemplateBraceCount.push(_bracesCount); + Q_FALLTHROUGH(); case '\'': - case '"': { - const QChar quote = ch; - bool multilineStringLiteral = false; - - const QChar *startCode = _codePtr; - - if (_engine) { - while (_codePtr <= _endPtr) { - if (isLineTerminator()) { - if (qmlMode()) - break; - _errorCode = IllegalCharacter; - _errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal"); - return T_ERROR; - } else if (_char == QLatin1Char('\\')) { - break; - } else if (_char == quote) { - _tokenSpell = _engine->midRef(startCode - _code.unicode() - 1, _codePtr - startCode); - scanChar(); - - return T_STRING_LITERAL; - } - scanChar(); - } - } - - _validTokenText = true; - _tokenText.resize(0); - startCode--; - while (startCode != _codePtr - 1) - _tokenText += *startCode++; - - while (_codePtr <= _endPtr) { - if (unsigned sequenceLength = isLineTerminatorSequence()) { - multilineStringLiteral = true; - _tokenText += _char; - if (sequenceLength == 2) - _tokenText += *_codePtr; - scanChar(); - } else if (_char == quote) { - scanChar(); - - if (_engine) - _tokenSpell = _engine->newStringRef(_tokenText); - - return multilineStringLiteral ? T_MULTILINE_STRING_LITERAL : T_STRING_LITERAL; - } else if (_char == QLatin1Char('\\')) { - scanChar(); - if (_codePtr > _endPtr) { - _errorCode = IllegalEscapeSequence; - _errorMessage = QCoreApplication::translate("QmlParser", "End of file reached at escape sequence"); - return T_ERROR; - } - - QChar u; - - switch (_char.unicode()) { - // unicode escape sequence - case 'u': { - bool ok = false; - u = decodeUnicodeEscapeCharacter(&ok); - if (! ok) { - _errorCode = IllegalUnicodeEscapeSequence; - _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence"); - return T_ERROR; - } - } break; - - // hex escape sequence - case 'x': { - bool ok = false; - u = decodeHexEscapeCharacter(&ok); - if (!ok) { - _errorCode = IllegalHexadecimalEscapeSequence; - _errorMessage = QCoreApplication::translate("QmlParser", "Illegal hexadecimal escape sequence"); - return T_ERROR; - } - } break; - - // single character escape sequence - case '\\': u = QLatin1Char('\\'); scanChar(); break; - case '\'': u = QLatin1Char('\''); scanChar(); break; - case '\"': u = QLatin1Char('\"'); scanChar(); break; - case 'b': u = QLatin1Char('\b'); scanChar(); break; - case 'f': u = QLatin1Char('\f'); scanChar(); break; - case 'n': u = QLatin1Char('\n'); scanChar(); break; - case 'r': u = QLatin1Char('\r'); scanChar(); break; - case 't': u = QLatin1Char('\t'); scanChar(); break; - case 'v': u = QLatin1Char('\v'); scanChar(); break; - - case '0': - if (! _codePtr->isDigit()) { - scanChar(); - u = QLatin1Char('\0'); - break; - } - // fall through - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - _errorCode = IllegalEscapeSequence; - _errorMessage = QCoreApplication::translate("QmlParser", "Octal escape sequences are not allowed"); - return T_ERROR; - - case '\r': - case '\n': - case 0x2028u: - case 0x2029u: - scanChar(); - continue; - - default: - // non escape character - u = _char; - scanChar(); - } - - _tokenText += u; - } else { - _tokenText += _char; - scanChar(); - } - } - - _errorCode = UnclosedStringLiteral; - _errorMessage = QCoreApplication::translate("QmlParser", "Unclosed string at end of line"); - return T_ERROR; - } + case '"': + return scanString(ScanStringMode(ch.unicode())); case '0': case '1': case '2': @@ -810,28 +708,36 @@ again: return scanNumber(ch); default: { - QChar c = ch; + uint c = ch.unicode(); bool identifierWithEscapeChars = false; - if (c == QLatin1Char('\\') && _char == QLatin1Char('u')) { + if (QChar::isHighSurrogate(c) && QChar::isLowSurrogate(_char.unicode())) { + c = QChar::surrogateToUcs4(ushort(c), _char.unicode()); + scanChar(); + } else if (c == '\\' && _char == QLatin1Char('u')) { identifierWithEscapeChars = true; bool ok = false; c = decodeUnicodeEscapeCharacter(&ok); - if (! ok) { - _errorCode = IllegalUnicodeEscapeSequence; - _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence"); + if (!ok) return T_ERROR; - } } if (isIdentifierStart(c)) { if (identifierWithEscapeChars) { _tokenText.resize(0); - _tokenText += c; + if (QChar::requiresSurrogates(c)) { + _tokenText += QChar(QChar::highSurrogate(c)); + _tokenText += QChar(QChar::lowSurrogate(c)); + } else { + _tokenText += QChar(c); + } _validTokenText = true; } - while (true) { - c = _char; - if (_char == QLatin1Char('\\') && _codePtr[0] == QLatin1Char('u')) { - if (! identifierWithEscapeChars) { + while (_codePtr <= _endPtr) { + c = _char.unicode(); + if (QChar::isHighSurrogate(c) && QChar::isLowSurrogate(_codePtr->unicode())) { + scanChar(); + c = QChar::surrogateToUcs4(ushort(c), _char.unicode()); + } else if (_char == QLatin1Char('\\') && _codePtr[0] == QLatin1Char('u')) { + if (!identifierWithEscapeChars) { identifierWithEscapeChars = true; _tokenText.resize(0); _tokenText.insert(0, _tokenStartPtr, _codePtr - _tokenStartPtr - 1); @@ -841,38 +747,52 @@ again: scanChar(); // skip '\\' bool ok = false; c = decodeUnicodeEscapeCharacter(&ok); - if (! ok) { - _errorCode = IllegalUnicodeEscapeSequence; - _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence"); + if (!ok) return T_ERROR; - } - if (isIdentifierPart(c)) - _tokenText += c; - continue; - } else if (isIdentifierPart(c)) { - if (identifierWithEscapeChars) - _tokenText += c; - scanChar(); + if (!isIdentifierPart(c)) + break; + + if (identifierWithEscapeChars) { + if (QChar::requiresSurrogates(c)) { + _tokenText += QChar(QChar::highSurrogate(c)); + _tokenText += QChar(QChar::lowSurrogate(c)); + } else { + _tokenText += QChar(c); + } + } continue; } - _tokenLength = _codePtr - _tokenStartPtr - 1; + if (!isIdentifierPart(c)) + break; - int kind = T_IDENTIFIER; + if (identifierWithEscapeChars) { + if (QChar::requiresSurrogates(c)) { + _tokenText += QChar(QChar::highSurrogate(c)); + _tokenText += QChar(QChar::lowSurrogate(c)); + } else { + _tokenText += QChar(c); + } + } + scanChar(); + } + + _tokenLength = _codePtr - _tokenStartPtr - 1; - if (! identifierWithEscapeChars) - kind = classify(_tokenStartPtr, _tokenLength, _qmlMode); + int kind = T_IDENTIFIER; - if (_engine) { - if (kind == T_IDENTIFIER && identifierWithEscapeChars) - _tokenSpell = _engine->newStringRef(_tokenText); - else - _tokenSpell = _engine->midRef(_tokenStartPtr - _code.unicode(), _tokenLength); - } + if (!identifierWithEscapeChars) + kind = classify(_tokenStartPtr, _tokenLength, parseModeFlags()); - return kind; + if (_engine) { + if (kind == T_IDENTIFIER && identifierWithEscapeChars) + _tokenSpell = _engine->newStringRef(_tokenText); + else + _tokenSpell = _engine->midRef(_tokenStartPtr - _code.unicode(), _tokenLength); } + + return kind; } } @@ -882,93 +802,278 @@ again: return T_ERROR; } -int Lexer::scanNumber(QChar ch) +int Lexer::scanString(ScanStringMode mode) { - if (ch != QLatin1Char('0')) { - QVarLengthArray<char, 64> buf; - buf += ch.toLatin1(); - - QChar n = _char; - const QChar *code = _codePtr; - while (n.isDigit()) { - buf += n.toLatin1(); - n = *code++; - } + QChar quote = (mode == TemplateContinuation) ? QChar(TemplateHead) : QChar(mode); + bool multilineStringLiteral = false; - if (n != QLatin1Char('.') && n != QLatin1Char('e') && n != QLatin1Char('E')) { - if (code != _codePtr) { - _codePtr = code - 1; + const QChar *startCode = _codePtr; + + if (_engine) { + while (_codePtr <= _endPtr) { + if (isLineTerminator() && quote != QLatin1Char('`')) { + if (qmlMode()) + break; + _errorCode = IllegalCharacter; + _errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal"); + return T_ERROR; + } else if (_char == QLatin1Char('\\')) { + break; + } else if (_char == '$' && quote == QLatin1Char('`')) { + break; + } else if (_char == quote) { + _tokenSpell = _engine->midRef(startCode - _code.unicode() - 1, _codePtr - startCode); scanChar(); + + if (quote == QLatin1Char('`')) + _bracesCount = _outerTemplateBraceCount.pop(); + + if (mode == TemplateHead) + return T_NO_SUBSTITUTION_TEMPLATE; + else if (mode == TemplateContinuation) + return T_TEMPLATE_TAIL; + else + return T_STRING_LITERAL; } - buf.append('\0'); - _tokenValue = strtod(buf.constData(), 0); - return T_NUMERIC_LITERAL; + scanChar(); } - } else if (_char.isDigit() && !qmlMode()) { - _errorCode = IllegalCharacter; - _errorMessage = QCoreApplication::translate("QmlParser", "Decimal numbers can't start with '0'"); - return T_ERROR; } - QVarLengthArray<char,32> chars; - chars.append(ch.unicode()); + _validTokenText = true; + _tokenText.resize(0); + startCode--; + while (startCode != _codePtr - 1) + _tokenText += *startCode++; + + while (_codePtr <= _endPtr) { + if (unsigned sequenceLength = isLineTerminatorSequence()) { + multilineStringLiteral = true; + _tokenText += _char; + if (sequenceLength == 2) + _tokenText += *_codePtr; + scanChar(); + } else if (_char == mode) { + scanChar(); - if (ch == QLatin1Char('0') && (_char == QLatin1Char('x') || _char == QLatin1Char('X'))) { - ch = _char; // remember the x or X to use it in the error message below. + if (_engine) + _tokenSpell = _engine->newStringRef(_tokenText); - // parse hex integer literal - chars.append(_char.unicode()); - scanChar(); // consume `x' + if (quote == QLatin1Char('`')) + _bracesCount = _outerTemplateBraceCount.pop(); - while (isHexDigit(_char)) { - chars.append(_char.unicode()); + if (mode == TemplateContinuation) + return T_TEMPLATE_TAIL; + else if (mode == TemplateHead) + return T_NO_SUBSTITUTION_TEMPLATE; + + return multilineStringLiteral ? T_MULTILINE_STRING_LITERAL : T_STRING_LITERAL; + } else if (quote == QLatin1Char('`') && _char == QLatin1Char('$') && *_codePtr == '{') { + scanChar(); + scanChar(); + _bracesCount = 1; + if (_engine) + _tokenSpell = _engine->newStringRef(_tokenText); + + return (mode == TemplateHead ? T_TEMPLATE_HEAD : T_TEMPLATE_MIDDLE); + } else if (_char == QLatin1Char('\\')) { + scanChar(); + if (_codePtr > _endPtr) { + _errorCode = IllegalEscapeSequence; + _errorMessage = QCoreApplication::translate("QmlParser", "End of file reached at escape sequence"); + return T_ERROR; + } + + QChar u; + + switch (_char.unicode()) { + // unicode escape sequence + case 'u': { + bool ok = false; + uint codePoint = decodeUnicodeEscapeCharacter(&ok); + if (!ok) + return T_ERROR; + if (QChar::requiresSurrogates(codePoint)) { + // need to use a surrogate pair + _tokenText += QChar(QChar::highSurrogate(codePoint)); + u = QChar::lowSurrogate(codePoint); + } else { + u = codePoint; + } + } break; + + // hex escape sequence + case 'x': { + bool ok = false; + u = decodeHexEscapeCharacter(&ok); + if (!ok) { + _errorCode = IllegalHexadecimalEscapeSequence; + _errorMessage = QCoreApplication::translate("QmlParser", "Illegal hexadecimal escape sequence"); + return T_ERROR; + } + } break; + + // single character escape sequence + case '\\': u = QLatin1Char('\\'); scanChar(); break; + case '\'': u = QLatin1Char('\''); scanChar(); break; + case '\"': u = QLatin1Char('\"'); scanChar(); break; + case 'b': u = QLatin1Char('\b'); scanChar(); break; + case 'f': u = QLatin1Char('\f'); scanChar(); break; + case 'n': u = QLatin1Char('\n'); scanChar(); break; + case 'r': u = QLatin1Char('\r'); scanChar(); break; + case 't': u = QLatin1Char('\t'); scanChar(); break; + case 'v': u = QLatin1Char('\v'); scanChar(); break; + + case '0': + if (! _codePtr->isDigit()) { + scanChar(); + u = QLatin1Char('\0'); + break; + } + Q_FALLTHROUGH(); + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + _errorCode = IllegalEscapeSequence; + _errorMessage = QCoreApplication::translate("QmlParser", "Octal escape sequences are not allowed"); + return T_ERROR; + + case '\r': + case '\n': + case 0x2028u: + case 0x2029u: + scanChar(); + continue; + + default: + // non escape character + u = _char; + scanChar(); + } + + _tokenText += u; + } else { + _tokenText += _char; scanChar(); } + } - if (chars.size() < 3) { - _errorCode = IllegalHexNumber; - _errorMessage = QCoreApplication::translate("QmlParser", "At least one hexadecimal digit is required after '0%1'").arg(ch); + _errorCode = UnclosedStringLiteral; + _errorMessage = QCoreApplication::translate("QmlParser", "Unclosed string at end of line"); + return T_ERROR; +} + +int Lexer::scanNumber(QChar ch) +{ + if (ch == QLatin1Char('0')) { + if (_char == QLatin1Char('x') || _char == QLatin1Char('X')) { + ch = _char; // remember the x or X to use it in the error message below. + + // parse hex integer literal + scanChar(); // consume 'x' + + if (!isHexDigit(_char)) { + _errorCode = IllegalNumber; + _errorMessage = QCoreApplication::translate("QmlParser", "At least one hexadecimal digit is required after '0%1'").arg(ch); + return T_ERROR; + } + + double d = 0.; + while (1) { + int digit = ::hexDigit(_char); + if (digit < 0) + break; + d *= 16; + d += digit; + scanChar(); + } + + _tokenValue = d; + return T_NUMERIC_LITERAL; + } else if (_char == QLatin1Char('o') || _char == QLatin1Char('O')) { + ch = _char; // remember the o or O to use it in the error message below. + + // parse octal integer literal + scanChar(); // consume 'o' + + if (!isOctalDigit(_char.unicode())) { + _errorCode = IllegalNumber; + _errorMessage = QCoreApplication::translate("QmlParser", "At least one octal digit is required after '0%1'").arg(ch); + return T_ERROR; + } + + double d = 0.; + while (1) { + int digit = ::octalDigit(_char); + if (digit < 0) + break; + d *= 8; + d += digit; + scanChar(); + } + + _tokenValue = d; + return T_NUMERIC_LITERAL; + } else if (_char == QLatin1Char('b') || _char == QLatin1Char('B')) { + ch = _char; // remember the b or B to use it in the error message below. + + // parse binary integer literal + scanChar(); // consume 'b' + + if (_char.unicode() != '0' && _char.unicode() != '1') { + _errorCode = IllegalNumber; + _errorMessage = QCoreApplication::translate("QmlParser", "At least one binary digit is required after '0%1'").arg(ch); + return T_ERROR; + } + + double d = 0.; + while (1) { + int digit = 0; + if (_char.unicode() == '1') + digit = 1; + else if (_char.unicode() != '0') + break; + d *= 2; + d += digit; + scanChar(); + } + + _tokenValue = d; + return T_NUMERIC_LITERAL; + } else if (_char.isDigit() && !qmlMode()) { + _errorCode = IllegalCharacter; + _errorMessage = QCoreApplication::translate("QmlParser", "Decimal numbers can't start with '0'"); return T_ERROR; } - - _tokenValue = integerFromString(chars.constData(), chars.size(), 16); - return T_NUMERIC_LITERAL; } // decimal integer literal - while (_char.isDigit()) { - chars.append(_char.unicode()); - scanChar(); // consume the digit - } - - if (_char == QLatin1Char('.')) { - chars.append(_char.unicode()); - scanChar(); // consume `.' + QVarLengthArray<char,32> chars; + chars.append(ch.unicode()); + if (ch != QLatin1Char('.')) { while (_char.isDigit()) { chars.append(_char.unicode()); - scanChar(); + scanChar(); // consume the digit } - if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) { - if (_codePtr[0].isDigit() || ((_codePtr[0] == QLatin1Char('+') || _codePtr[0] == QLatin1Char('-')) && - _codePtr[1].isDigit())) { - - chars.append(_char.unicode()); - scanChar(); // consume `e' + if (_char == QLatin1Char('.')) { + chars.append(_char.unicode()); + scanChar(); // consume `.' + } + } - if (_char == QLatin1Char('+') || _char == QLatin1Char('-')) { - chars.append(_char.unicode()); - scanChar(); // consume the sign - } + while (_char.isDigit()) { + chars.append(_char.unicode()); + scanChar(); + } - while (_char.isDigit()) { - chars.append(_char.unicode()); - scanChar(); - } - } - } - } else if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) { + if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) { if (_codePtr[0].isDigit() || ((_codePtr[0] == QLatin1Char('+') || _codePtr[0] == QLatin1Char('-')) && _codePtr[1].isDigit())) { @@ -987,16 +1092,10 @@ int Lexer::scanNumber(QChar ch) } } - if (chars.size() == 1) { - // if we ended up with a single digit, then it was a '0' - _tokenValue = 0; - return T_NUMERIC_LITERAL; - } - chars.append('\0'); const char *begin = chars.constData(); - const char *end = 0; + const char *end = nullptr; bool ok = false; _tokenValue = qstrtod(begin, &end, &ok); @@ -1160,16 +1259,6 @@ bool Lexer::isOctalDigit(ushort c) return (c >= '0' && c <= '7'); } -int Lexer::tokenEndLine() const -{ - return _currentLineNumber; -} - -int Lexer::tokenEndColumn() const -{ - return _codePtr - _lastLinePtr; -} - QString Lexer::tokenText() const { if (_validTokenText) @@ -1242,6 +1331,7 @@ static const int uriTokens[] = { QmlJSGrammar::T_FUNCTION, QmlJSGrammar::T_IF, QmlJSGrammar::T_IN, + QmlJSGrammar::T_OF, QmlJSGrammar::T_INSTANCEOF, QmlJSGrammar::T_NEW, QmlJSGrammar::T_NULL, @@ -1288,7 +1378,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error) lex(); // skip T_DOT - if (! (_tokenKind == T_IDENTIFIER || _tokenKind == T_RESERVED_WORD)) + if (! (_tokenKind == T_IDENTIFIER || _tokenKind == T_IMPORT)) return true; // expected a valid QML/JS directive const QString directiveName = tokenText(); @@ -1312,7 +1402,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error) } // we found a .pragma library directive - directives->pragmaLibrary(lineNumber, column); + directives->pragmaLibrary(); } else { Q_ASSERT(directiveName == QLatin1String("import")); @@ -1382,7 +1472,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error) // // recognize the mandatory `as' followed by the module name // - if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("as") && tokenStartLine() == lineNumber)) { + if (! (lex() == T_AS && tokenStartLine() == lineNumber)) { if (fileImport) error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier"); else diff --git a/src/libs/qmljs/parser/qmljslexer_p.h b/src/libs/qmljs/parser/qmljslexer_p.h index 07b925d7a1..39128b4409 100644 --- a/src/libs/qmljs/parser/qmljslexer_p.h +++ b/src/libs/qmljs/parser/qmljslexer_p.h @@ -40,6 +40,7 @@ #include "qmljsgrammar_p.h" #include <QtCore/qstring.h> +#include <QtCore/qstack.h> QT_QML_BEGIN_NAMESPACE @@ -47,35 +48,7 @@ namespace QmlJS { class Engine; class DiagnosticMessage; - -class QML_PARSER_EXPORT Directives { - -public: - virtual ~Directives() {} - - virtual void pragmaLibrary(int line, int column) - { - Q_UNUSED(line); - Q_UNUSED(column); - } - - virtual void importFile(const QString &jsfile, const QString &module, int line, int column) - { - Q_UNUSED(jsfile); - Q_UNUSED(module); - Q_UNUSED(line); - Q_UNUSED(column); - } - - virtual void importModule(const QString &uri, const QString &version, const QString &module, int line, int column) - { - Q_UNUSED(uri); - Q_UNUSED(version); - Q_UNUSED(module); - Q_UNUSED(line); - Q_UNUSED(column); - } -}; +class Directives; class QML_PARSER_EXPORT Lexer: public QmlJSGrammar { @@ -85,10 +58,7 @@ public: T_BOOLEAN = T_RESERVED_WORD, T_BYTE = T_RESERVED_WORD, T_CHAR = T_RESERVED_WORD, - T_CLASS = T_RESERVED_WORD, T_DOUBLE = T_RESERVED_WORD, - T_EXPORT = T_RESERVED_WORD, - T_EXTENDS = T_RESERVED_WORD, T_FINAL = T_RESERVED_WORD, T_FLOAT = T_RESERVED_WORD, T_GOTO = T_RESERVED_WORD, @@ -101,8 +71,6 @@ public: T_PRIVATE = T_RESERVED_WORD, T_PROTECTED = T_RESERVED_WORD, T_SHORT = T_RESERVED_WORD, - T_STATIC = T_RESERVED_WORD, - T_SUPER = T_RESERVED_WORD, T_SYNCHRONIZED = T_RESERVED_WORD, T_THROWS = T_RESERVED_WORD, T_TRANSIENT = T_RESERVED_WORD, @@ -112,7 +80,7 @@ public: enum Error { NoError, IllegalCharacter, - IllegalHexNumber, + IllegalNumber, UnclosedStringLiteral, IllegalEscapeSequence, IllegalUnicodeEscapeSequence, @@ -130,13 +98,34 @@ public: enum RegExpFlag { RegExp_Global = 0x01, RegExp_IgnoreCase = 0x02, - RegExp_Multiline = 0x04 + RegExp_Multiline = 0x04, + RegExp_Unicode = 0x08, + RegExp_Sticky = 0x10 + }; + + enum ParseModeFlags { + QmlMode = 0x1, + YieldIsKeyword = 0x2, + StaticIsKeyword = 0x4 }; public: Lexer(Engine *engine); + int parseModeFlags() const { + int flags = 0; + if (qmlMode()) + flags |= QmlMode|StaticIsKeyword; + if (yieldIsKeyWord()) + flags |= YieldIsKeyword; + if (_staticIsKeyword) + flags |= StaticIsKeyword; + return flags; + } + bool qmlMode() const; + bool yieldIsKeyWord() const { return _generatorLevel != 0; } + void setStaticIsKeyword(bool b) { _staticIsKeyword = b; } QString code() const; void setCode(const QString &code, int lineno, bool qmlMode = true); @@ -154,10 +143,7 @@ public: int tokenLength() const { return _tokenLength; } int tokenStartLine() const { return _tokenLine; } - int tokenStartColumn() const { return _tokenStartPtr - _tokenLinePtr + 1; } - - int tokenEndLine() const; - int tokenEndColumn() const; + int tokenStartColumn() const { return _tokenColumn; } inline QStringRef tokenSpell() const { return _tokenSpell; } double tokenValue() const { return _tokenValue; } @@ -176,13 +162,23 @@ public: BalancedParentheses }; + void enterGeneratorBody() { ++_generatorLevel; } + void leaveGeneratorBody() { --_generatorLevel; } + protected: - int classify(const QChar *s, int n, bool qmlMode); + static int classify(const QChar *s, int n, int parseModeFlags); private: inline void scanChar(); int scanToken(); int scanNumber(QChar ch); + enum ScanStringMode { + SingleQuote = '\'', + DoubleQuote = '"', + TemplateHead = '`', + TemplateContinuation = 0 + }; + int scanString(ScanStringMode mode); bool isLineTerminator() const; unsigned isLineTerminatorSequence() const; @@ -190,10 +186,9 @@ private: static bool isDecimalDigit(ushort c); static bool isHexDigit(QChar c); static bool isOctalDigit(ushort c); - static bool isUnicodeEscapeSequence(const QChar *chars); void syncProhibitAutomaticSemicolon(); - QChar decodeUnicodeEscapeCharacter(bool *ok); + uint decodeUnicodeEscapeCharacter(bool *ok); QChar decodeHexEscapeCharacter(bool *ok); private: @@ -206,26 +201,30 @@ private: const QChar *_codePtr; const QChar *_endPtr; - const QChar *_lastLinePtr; - const QChar *_tokenLinePtr; const QChar *_tokenStartPtr; QChar _char; Error _errorCode; int _currentLineNumber; + int _currentColumnNumber; double _tokenValue; // parentheses state ParenthesesState _parenthesesState; int _parenthesesCount; + // template string stack + QStack<int> _outerTemplateBraceCount; + int _bracesCount = -1; + int _stackToken; int _patternFlags; int _tokenKind; int _tokenLength; int _tokenLine; + int _tokenColumn; bool _validTokenText; bool _prohibitAutomaticSemicolon; @@ -234,6 +233,8 @@ private: bool _followsClosingBrace; bool _delimited; bool _qmlMode; + int _generatorLevel = 0; + bool _staticIsKeyword = false; }; } // end of namespace QmlJS diff --git a/src/libs/qmljs/parser/qmljsmemorypool_p.h b/src/libs/qmljs/parser/qmljsmemorypool_p.h index 2cb234f244..4c5ec5c310 100644 --- a/src/libs/qmljs/parser/qmljsmemorypool_p.h +++ b/src/libs/qmljs/parser/qmljsmemorypool_p.h @@ -56,13 +56,7 @@ class QML_PARSER_EXPORT MemoryPool : public QSharedData void operator =(const MemoryPool &other); public: - MemoryPool() - : _blocks(0), - _allocatedBlocks(0), - _blockCount(-1), - _ptr(0), - _end(0) - { } + MemoryPool() {} ~MemoryPool() { @@ -74,6 +68,7 @@ public: free(_blocks); } + qDeleteAll(strings); } inline void *allocate(size_t size) @@ -90,11 +85,16 @@ public: void reset() { _blockCount = -1; - _ptr = _end = 0; + _ptr = _end = nullptr; } template <typename Tp> Tp *New() { return new (this->allocate(sizeof(Tp))) Tp(); } + QStringRef newString(const QString &string) { + strings.append(new QString(string)); + return QStringRef(strings.last()); + } + private: Q_NEVER_INLINE void *allocate_helper(size_t size) { @@ -110,7 +110,7 @@ private: Q_CHECK_PTR(_blocks); for (int index = _blockCount; index < _allocatedBlocks; ++index) - _blocks[index] = 0; + _blocks[index] = nullptr; } char *&block = _blocks[_blockCount]; @@ -129,11 +129,12 @@ private: } private: - char **_blocks; - int _allocatedBlocks; - int _blockCount; - char *_ptr; - char *_end; + char **_blocks = nullptr; + int _allocatedBlocks = 0; + int _blockCount = -1; + char *_ptr = nullptr; + char *_end = nullptr; + QVector<QString*> strings; enum { @@ -144,12 +145,10 @@ private: class QML_PARSER_EXPORT Managed { - Managed(const Managed &other); - void operator = (const Managed &other); - + Q_DISABLE_COPY(Managed) public: - Managed() {} - ~Managed() {} + Managed() = default; + ~Managed() = default; void *operator new(size_t size, MemoryPool *pool) { return pool->allocate(size); } void operator delete(void *) {} diff --git a/src/libs/qmljs/parser/qmljsparser.cpp b/src/libs/qmljs/parser/qmljsparser.cpp index 5ab7114400..d7f23855b8 100644 --- a/src/libs/qmljs/parser/qmljsparser.cpp +++ b/src/libs/qmljs/parser/qmljsparser.cpp @@ -1,10 +1,13 @@ + +#line 127 "qmljs.g" /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of Qt Creator. +** This file is part of the QtQml module of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -13,13 +16,26 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -34,6 +50,8 @@ #include <string.h> +#line 461 "qmljs.g" + #include "qmljsparser_p.h" @@ -51,6 +69,8 @@ // qlalr --no-debug --no-lines --qt qmljs.g // +#define UNIMPLEMENTED syntaxError(loc(1), "Unimplemented"); return false + using namespace QmlJS; QT_QML_BEGIN_NAMESPACE @@ -65,22 +85,12 @@ void Parser::reallocateStack() sym_stack = reinterpret_cast<Value*> (realloc(sym_stack, stack_size * sizeof(Value))); state_stack = reinterpret_cast<int*> (realloc(state_stack, stack_size * sizeof(int))); location_stack = reinterpret_cast<AST::SourceLocation*> (realloc(location_stack, stack_size * sizeof(AST::SourceLocation))); - string_stack = reinterpret_cast<QStringRef*> (realloc(string_stack, stack_size * sizeof(QStringRef))); + string_stack.resize(stack_size); } Parser::Parser(Engine *engine): driver(engine), - pool(engine->pool()), - tos(0), - stack_size(0), - sym_stack(0), - state_stack(0), - location_stack(0), - string_stack(0), - program(0), - yylval(0), - first_token(0), - last_token(0) + pool(engine->pool()) { } @@ -90,7 +100,6 @@ Parser::~Parser() free(sym_stack); free(state_stack); free(location_stack); - free(string_stack); } } @@ -132,29 +141,39 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) return 0; } -AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode *expr) +void Parser::pushToken(int token) { - if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(expr)) { - AST::UiQualifiedPragmaId *q = new (pool) AST::UiQualifiedPragmaId(idExpr->name); - q->identifierToken = idExpr->identifierToken; + last_token->token = yytoken; + last_token->dval = yylval; + last_token->spell = yytokenspell; + last_token->loc = yylloc; + ++last_token; + yytoken = token; +} - return q->finish(); +int Parser::lookaheadToken(Lexer *lexer) +{ + if (yytoken < 0) { + yytoken = lexer->lex(); + yylval = lexer->tokenValue(); + yytokenspell = lexer->tokenSpell(); + yylloc = location(lexer); } - - return 0; + return yytoken; } +//#define PARSER_DEBUG bool Parser::parse(int startToken) { Lexer *lexer = driver->lexer(); bool hadErrors = false; - int yytoken = -1; + yytoken = -1; int action = 0; token_buffer[0].token = startToken; first_token = &token_buffer[0]; - if (startToken == T_FEED_JS_PROGRAM && !lexer->qmlMode()) { + if (startToken == T_FEED_JS_SCRIPT && !lexer->qmlMode()) { Directives ignoreDirectives; Directives *directives = driver->directives(); if (!directives) @@ -197,10 +216,19 @@ bool Parser::parse(int startToken) yytokenspell = first_token->spell; yylloc = first_token->loc; ++first_token; + if (first_token == last_token) + first_token = last_token = &token_buffer[0]; } } +#ifdef PARSER_DEBUG + qDebug() << " in state" << action; +#endif + action = t_action(action, yytoken); +#ifdef PARSER_DEBUG + qDebug() << " current token" << yytoken << (yytoken >= 0 ? spell[yytoken] : "(null)") << "new state" << action; +#endif if (action > 0) { if (action != ACCEPT_STATE) { yytoken = -1; @@ -215,1667 +243,3097 @@ bool Parser::parse(int startToken) const int r = -action - 1; tos -= rhs[r]; +#ifdef PARSER_DEBUG + qDebug() << " reducing through rule " << -action; +#endif + switch (r) { -case 0: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; +#line 665 "qmljs.g" -case 1: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case 0: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; -case 2: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; +#line 673 "qmljs.g" -case 3: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case 1: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; -case 4: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; +#line 681 "qmljs.g" -case 5: { - sym(1).Node = sym(2).Node; - program = sym(1).Node; -} break; + case 2: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; -case 6: { - sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList, - sym(2).UiObjectMemberList->finish()); -} break; +#line 689 "qmljs.g" -case 8: { - sym(1).Node = sym(1).UiHeaderItemList->finish(); -} break; + case 3: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; -case 9: { - sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma); -} break; +#line 697 "qmljs.g" -case 10: { - sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport); -} break; + case 4: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; -case 11: { - sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma); -} break; +#line 705 "qmljs.g" -case 12: { - sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport); -} break; + case 5: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; + } break; -case 16: { - sym(1).UiPragma->semicolonToken = loc(2); -} break; +#line 714 "qmljs.g" -case 18: { - sym(1).UiImport->semicolonToken = loc(2); -} break; + case 6: { + sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList, sym(2).UiObjectMemberList->finish()); + } break; -case 20: { - sym(1).UiImport->versionToken = loc(2); - sym(1).UiImport->semicolonToken = loc(3); -} break; +#line 722 "qmljs.g" -case 22: { - sym(1).UiImport->versionToken = loc(2); - sym(1).UiImport->asToken = loc(3); - sym(1).UiImport->importIdToken = loc(4); - sym(1).UiImport->importId = stringRef(4); - sym(1).UiImport->semicolonToken = loc(5); -} break; + case 8: { + sym(1).Node = sym(1).UiHeaderItemList->finish(); + } break; -case 24: { - sym(1).UiImport->asToken = loc(2); - sym(1).UiImport->importIdToken = loc(3); - sym(1).UiImport->importId = stringRef(3); - sym(1).UiImport->semicolonToken = loc(4); -} break; +#line 729 "qmljs.g" -case 25: { - AST::UiPragma *node = 0; + case 9: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma); + } break; - if (AST::UiQualifiedPragmaId *qualifiedId = reparseAsQualifiedPragmaId(sym(2).Expression)) { - node = new (pool) AST::UiPragma(qualifiedId); - } +#line 736 "qmljs.g" - sym(1).Node = node; + case 10: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport); + } break; - if (node) { - node->pragmaToken = loc(1); - } else { - diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1), - QLatin1String("Expected a qualified name id"))); +#line 743 "qmljs.g" - return false; // ### remove me - } -} break; + case 11: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma); + } break; -case 26: { - AST::UiImport *node = 0; +#line 750 "qmljs.g" - if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) { - node = new (pool) AST::UiImport(importIdLiteral->value); - node->fileNameToken = loc(2); - } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) { - node = new (pool) AST::UiImport(qualifiedId); - node->fileNameToken = loc(2); - } + case 12: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport); + } break; - sym(1).Node = node; +#line 760 "qmljs.g" - if (node) { - node->importToken = loc(1); - } else { - diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1), - QLatin1String("Expected a qualified name id or a string literal"))); + case 15: { + AST::UiPragma *pragma = new (pool) AST::UiPragma(stringRef(2)); + pragma->pragmaToken = loc(1); + pragma->semicolonToken = loc(3); + sym(1).Node = pragma; + } break; - return false; // ### remove me - } -} break; +#line 773 "qmljs.g" -case 27: { - sym(1).Node = 0; -} break; + case 18: { + sym(1).UiImport->semicolonToken = loc(2); + } break; -case 28: { - sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); -} break; +#line 781 "qmljs.g" -case 29: { - sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); -} break; + case 20: { + sym(1).UiImport->versionToken = loc(2); + sym(1).UiImport->semicolonToken = loc(3); + } break; -case 30: { - AST::UiObjectMemberList *node = new (pool) AST:: UiObjectMemberList( - sym(1).UiObjectMemberList, sym(2).UiObjectMember); - sym(1).Node = node; -} break; +#line 790 "qmljs.g" -case 31: { - sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember); -} break; + case 22: { + sym(1).UiImport->versionToken = loc(2); + sym(1).UiImport->asToken = loc(3); + sym(1).UiImport->importIdToken = loc(4); + sym(1).UiImport->importId = stringRef(4); + sym(1).UiImport->semicolonToken = loc(5); + } break; -case 32: { - AST::UiArrayMemberList *node = new (pool) AST::UiArrayMemberList( - sym(1).UiArrayMemberList, sym(3).UiObjectMember); - node->commaToken = loc(2); - sym(1).Node = node; -} break; +#line 802 "qmljs.g" -case 33: { - AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0); - node->lbraceToken = loc(1); - node->rbraceToken = loc(2); - sym(1).Node = node; -} break; + case 24: { + sym(1).UiImport->asToken = loc(2); + sym(1).UiImport->importIdToken = loc(3); + sym(1).UiImport->importId = stringRef(3); + sym(1).UiImport->semicolonToken = loc(4); + } break; -case 34: { - AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish()); - node->lbraceToken = loc(1); - node->rbraceToken = loc(3); - sym(1).Node = node; -} break; +#line 812 "qmljs.g" -case 35: { - AST::UiObjectDefinition *node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId, - sym(2).UiObjectInitializer); - sym(1).Node = node; -} break; + case 25: { + AST::UiImport *node = 0; -case 37: { - AST::UiArrayBinding *node = new (pool) AST::UiArrayBinding( - sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish()); - node->colonToken = loc(2); - node->lbracketToken = loc(3); - node->rbracketToken = loc(5); - sym(1).Node = node; -} break; + if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) { + node = new (pool) AST::UiImport(importIdLiteral->value); + node->fileNameToken = loc(2); + } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) { + node = new (pool) AST::UiImport(qualifiedId); + node->fileNameToken = loc(2); + } -case 38: { - AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( - sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer); - node->colonToken = loc(2); - sym(1).Node = node; -} break; + sym(1).Node = node; -case 39: { - AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( - sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); - node->colonToken = loc(2); - node->hasOnToken = true; - sym(1).Node = node; -} break; + if (node) { + node->importToken = loc(1); + } else { + diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1), + QLatin1String("Expected a qualified name id or a string literal"))); + + return false; // ### remove me + } + } break; -case 47: +#line 838 "qmljs.g" + + case 26: { + sym(1).Node = nullptr; + } break; + +#line 845 "qmljs.g" + + case 27: { + sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); + } break; + +#line 852 "qmljs.g" + + case 28: { + sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); + } break; + +#line 859 "qmljs.g" + + case 29: { + AST::UiObjectMemberList *node = new (pool) AST:: UiObjectMemberList(sym(1).UiObjectMemberList, sym(2).UiObjectMember); + sym(1).Node = node; + } break; + +#line 867 "qmljs.g" + + case 30: { + sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember); + } break; + +#line 874 "qmljs.g" + + case 31: { + AST::UiArrayMemberList *node = new (pool) AST::UiArrayMemberList(sym(1).UiArrayMemberList, sym(3).UiObjectMember); + node->commaToken = loc(2); + sym(1).Node = node; + } break; + +#line 883 "qmljs.g" + + case 32: { + AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0); + node->lbraceToken = loc(1); + node->rbraceToken = loc(2); + sym(1).Node = node; + } break; + +#line 893 "qmljs.g" + + case 33: { + AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish()); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + sym(1).Node = node; + } break; + +#line 903 "qmljs.g" + + case 34: { + AST::UiObjectDefinition *node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId, sym(2).UiObjectInitializer); + sym(1).Node = node; + } break; + +#line 913 "qmljs.g" + + case 36: { + AST::UiArrayBinding *node = new (pool) AST::UiArrayBinding(sym(1).UiQualifiedId, sym(5).UiArrayMemberList->finish()); + node->colonToken = loc(2); + node->lbracketToken = loc(4); + node->rbracketToken = loc(6); + sym(1).Node = node; + } break; + +#line 924 "qmljs.g" + + case 37: { + AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( + sym(1).UiQualifiedId, sym(4).UiQualifiedId, sym(5).UiObjectInitializer); + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 934 "qmljs.g" + + case 38: { + AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( + sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); + node->colonToken = loc(2); + node->hasOnToken = true; + sym(1).Node = node; + } break; + +#line 946 "qmljs.g" + case 39: Q_FALLTHROUGH(); +#line 948 "qmljs.g" + + case 40: { + AST::ObjectPattern *l = new (pool) AST::ObjectPattern(sym(3).PatternPropertyList->finish()); + l->lbraceToken = loc(1); + l->rbraceToken = loc(4); + AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(l); + sym(1).Node = node; + } break; + +#line 960 "qmljs.g" + case 41: Q_FALLTHROUGH(); +#line 962 "qmljs.g" + case 42: Q_FALLTHROUGH(); +#line 964 "qmljs.g" + + case 43: { + sym(1).Node = sym(3).Node; + } break; + +#line 972 "qmljs.g" + case 44: Q_FALLTHROUGH(); +#line 974 "qmljs.g" + case 45: Q_FALLTHROUGH(); +#line 976 "qmljs.g" + case 46: Q_FALLTHROUGH(); +#line 978 "qmljs.g" + case 47: Q_FALLTHROUGH(); +#line 980 "qmljs.g" + case 48: Q_FALLTHROUGH(); +#line 982 "qmljs.g" + + case 49: { + sym(1).Node = sym(2).Node; + } break; + +#line 989 "qmljs.g" + +case 50: { - AST::UiScriptBinding *node = new (pool) AST::UiScriptBinding( - sym(1).UiQualifiedId, sym(3).Statement); + AST::UiScriptBinding *node = new (pool) AST::UiScriptBinding(sym(1).UiQualifiedId, sym(3).Statement); node->colonToken = loc(2); sym(1).Node = node; -} break; + } break; + +#line 999 "qmljs.g" + case 51: Q_FALLTHROUGH(); +#line 1001 "qmljs.g" + case 52: Q_FALLTHROUGH(); +#line 1003 "qmljs.g" + + case 53: { + AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1)); + node->identifierToken = loc(1); + sym(1).Node = node; + } break; + +#line 1012 "qmljs.g" + + case 54: { + AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(sym(1).UiQualifiedId, stringRef(3)); + node->identifierToken = loc(3); + sym(1).Node = node; + } break; + +#line 1021 "qmljs.g" + + case 55: { + sym(1).Node = nullptr; + } break; + +#line 1028 "qmljs.g" + + case 56: { + sym(1).Node = sym(1).UiParameterList->finish(); + } break; + +#line 1035 "qmljs.g" + + case 57: { + AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiQualifiedId->finish(), stringRef(2)); + node->propertyTypeToken = loc(1); + node->identifierToken = loc(2); + sym(1).Node = node; + } break; + +#line 1045 "qmljs.g" + + case 58: { + AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, sym(3).UiQualifiedId->finish(), stringRef(4)); + node->propertyTypeToken = loc(3); + node->commaToken = loc(2); + node->identifierToken = loc(4); + sym(1).Node = node; + } break; + +#line 1057 "qmljs.g" + + case 60: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2)); + node->type = AST::UiPublicMember::Signal; + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(2); + node->parameters = sym(4).UiParameterList; + node->semicolonToken = loc(6); + sym(1).Node = node; + } break; + +#line 1072 "qmljs.g" + + case 62: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2)); + node->type = AST::UiPublicMember::Signal; + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(2); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; + +#line 1086 "qmljs.g" + + case 64: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6)); + node->typeModifier = stringRef(2); + node->propertyToken = loc(1); + node->typeModifierToken = loc(2); + node->typeToken = loc(4); + node->identifierToken = loc(6); + node->semicolonToken = loc(7); + sym(1).Node = node; + } break; + +#line 1101 "qmljs.g" + + case 66: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3)); + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->semicolonToken = loc(4); + sym(1).Node = node; + } break; + +#line 1114 "qmljs.g" + + case 68: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4)); + node->isDefaultMember = true; + node->defaultToken = loc(1); + node->propertyToken = loc(2); + node->typeToken = loc(3); + node->identifierToken = loc(4); + node->semicolonToken = loc(5); + sym(1).Node = node; + } break; + +#line 1129 "qmljs.g" + + case 70: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(5).UiQualifiedId->finish(), stringRef(7)); + node->isDefaultMember = true; + node->defaultToken = loc(1); + node->typeModifier = stringRef(3); + node->propertyToken = loc(2); + node->typeModifierToken = loc(2); + node->typeToken = loc(4); + node->identifierToken = loc(7); + node->semicolonToken = loc(8); + sym(1).Node = node; + } break; + +#line 1145 "qmljs.g" + + case 71: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3), sym(5).Statement); + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->colonToken = loc(4); + sym(1).Node = node; + } break; + +#line 1157 "qmljs.g" + + case 72: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), sym(6).Statement); + node->isReadonlyMember = true; + node->readonlyToken = loc(1); + node->propertyToken = loc(2); + node->typeToken = loc(3); + node->identifierToken = loc(4); + node->colonToken = loc(5); + sym(1).Node = node; + } break; + +#line 1171 "qmljs.g" + + case 73: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), sym(6).Statement); + node->isDefaultMember = true; + node->defaultToken = loc(1); + node->propertyToken = loc(2); + node->typeToken = loc(3); + node->identifierToken = loc(4); + node->colonToken = loc(5); + sym(1).Node = node; + } break; + +#line 1185 "qmljs.g" + + case 74: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6)); + node->typeModifier = stringRef(2); + node->propertyToken = loc(1); + node->typeModifierToken = loc(2); + node->typeToken = loc(4); + node->identifierToken = loc(6); + node->semicolonToken = loc(7); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(6)); + propertyName->identifierToken = loc(6); + propertyName->next = 0; + + AST::UiArrayBinding *binding = new (pool) AST::UiArrayBinding(propertyName, sym(9).UiArrayMemberList->finish()); + binding->colonToken = loc(7); + binding->lbracketToken = loc(8); + binding->rbracketToken = loc(10); + + node->binding = binding; + + sym(1).Node = node; + } break; + +#line 1211 "qmljs.g" + + case 75: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3)); + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->semicolonToken = loc(4); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(3)); + propertyName->identifierToken = loc(3); + propertyName->next = 0; + + AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( + propertyName, sym(6).UiQualifiedId, sym(7).UiObjectInitializer); + binding->colonToken = loc(4); + + node->binding = binding; + + sym(1).Node = node; + } break; + +#line 1234 "qmljs.g" + + case 76: { + AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4)); + node->isReadonlyMember = true; + node->readonlyToken = loc(1); + node->propertyToken = loc(2); + node->typeToken = loc(3); + node->identifierToken = loc(4); + node->semicolonToken = loc(5); // insert a fake ';' before ':' + + AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(4)); + propertyName->identifierToken = loc(4); + propertyName->next = 0; + + AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( + propertyName, sym(7).UiQualifiedId, sym(8).UiObjectInitializer); + binding->colonToken = loc(5); + + node->binding = binding; + + sym(1).Node = node; + } break; + +#line 1259 "qmljs.g" + + case 77: { + sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); + } break; + +#line 1266 "qmljs.g" + + case 78: { + sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); + } break; -case 48: { - AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; +#line 1273 "qmljs.g" -case 49: { - AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case 79: { + if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) { + diagnostic_messages.append(DiagnosticMessage(Severity::Warning, mem->lbracketToken, + QLatin1String("Ignored annotation"))); + + sym(1).Expression = mem->base; + } -case 50: { - AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) { + sym(1).UiQualifiedId = qualifiedId; + } else { + sym(1).UiQualifiedId = 0; -case 51: { - AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(sym(1).UiQualifiedId, stringRef(3)); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; + diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1), + QLatin1String("Expected a qualified name id"))); -case 52: { - sym(1).Node = 0; -} break; + return false; // ### recover + } + } break; -case 53: { - sym(1).Node = sym(1).UiParameterList->finish (); -} break; +#line 1296 "qmljs.g" -case 54: { - AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiQualifiedId->finish(), stringRef(2)); - node->propertyTypeToken = loc(1); - node->identifierToken = loc(2); - sym(1).Node = node; -} break; + case 80: { + AST::UiEnumDeclaration *enumDeclaration = new (pool) AST::UiEnumDeclaration(stringRef(2), sym(4).UiEnumMemberList->finish()); + enumDeclaration->enumToken = loc(1); + enumDeclaration->rbraceToken = loc(5); + sym(1).Node = enumDeclaration; + break; + } -case 55: { - AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, sym(3).UiQualifiedId->finish(), stringRef(4)); - node->propertyTypeToken = loc(3); - node->commaToken = loc(2); - node->identifierToken = loc(4); - sym(1).Node = node; -} break; +#line 1307 "qmljs.g" -case 57: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2)); - node->type = AST::UiPublicMember::Signal; - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(2); - node->parameters = sym(4).UiParameterList; - node->semicolonToken = loc(6); - sym(1).Node = node; -} break; - -case 59: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2)); - node->type = AST::UiPublicMember::Signal; - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(2); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; - -case 61: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6)); - node->typeModifier = stringRef(2); - node->propertyToken = loc(1); - node->typeModifierToken = loc(2); - node->typeToken = loc(4); - node->identifierToken = loc(6); - node->semicolonToken = loc(7); - sym(1).Node = node; -} break; - -case 63: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3)); - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(3); - node->semicolonToken = loc(4); - sym(1).Node = node; -} break; - -case 65: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4)); - node->isDefaultMember = true; - node->defaultToken = loc(1); - node->propertyToken = loc(2); - node->typeToken = loc(3); - node->identifierToken = loc(4); - node->semicolonToken = loc(5); - sym(1).Node = node; -} break; - -case 67: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(5).UiQualifiedId->finish(), stringRef(7)); - node->isDefaultMember = true; - node->defaultToken = loc(1); - node->typeModifier = stringRef(3); - node->propertyToken = loc(2); - node->typeModifierToken = loc(2); - node->typeToken = loc(4); - node->identifierToken = loc(7); - node->semicolonToken = loc(8); - sym(1).Node = node; -} break; - -case 68: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3), - sym(5).Statement); - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(3); - node->colonToken = loc(4); - sym(1).Node = node; -} break; - -case 69: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), - sym(6).Statement); - node->isReadonlyMember = true; - node->readonlyToken = loc(1); - node->propertyToken = loc(2); - node->typeToken = loc(3); - node->identifierToken = loc(4); - node->colonToken = loc(5); - sym(1).Node = node; -} break; - -case 70: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), - sym(6).Statement); - node->isDefaultMember = true; - node->defaultToken = loc(1); - node->propertyToken = loc(2); - node->typeToken = loc(3); - node->identifierToken = loc(4); - node->colonToken = loc(5); - sym(1).Node = node; -} break; + case 81: { + AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1)); + node->memberToken = loc(1); + sym(1).Node = node; + break; + } -case 71: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6)); - node->typeModifier = stringRef(2); - node->propertyToken = loc(1); - node->typeModifierToken = loc(2); - node->typeToken = loc(4); - node->identifierToken = loc(6); - node->semicolonToken = loc(7); // insert a fake ';' before ':' +#line 1317 "qmljs.g" - AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(6)); - propertyName->identifierToken = loc(6); - propertyName->next = 0; + case 82: { + AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1), sym(3).dval); + node->memberToken = loc(1); + node->valueToken = loc(3); + sym(1).Node = node; + break; + } - AST::UiArrayBinding *binding = new (pool) AST::UiArrayBinding( - propertyName, sym(9).UiArrayMemberList->finish()); - binding->colonToken = loc(7); - binding->lbracketToken = loc(8); - binding->rbracketToken = loc(10); +#line 1328 "qmljs.g" - node->binding = binding; + case 83: { + AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3)); + node->memberToken = loc(3); + sym(1).Node = node; + break; + } - sym(1).Node = node; -} break; +#line 1338 "qmljs.g" -case 72: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3)); - node->propertyToken = loc(1); - node->typeToken = loc(2); - node->identifierToken = loc(3); - node->semicolonToken = loc(4); // insert a fake ';' before ':' + case 84: { + AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3), sym(5).dval); + node->memberToken = loc(3); + node->valueToken = loc(5); + sym(1).Node = node; + break; + } - AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(3)); - propertyName->identifierToken = loc(3); - propertyName->next = 0; +#line 1378 "qmljs.g" - AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( - propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer); - binding->colonToken = loc(4); + case 107: { + AST::ThisExpression *node = new (pool) AST::ThisExpression(); + node->thisToken = loc(1); + sym(1).Node = node; + } break; - node->binding = binding; +#line 1387 "qmljs.g" - sym(1).Node = node; -} break; + case 108: { + AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1)); + node->identifierToken = loc(1); + sym(1).Node = node; + } break; -case 73: { - AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4)); - node->isReadonlyMember = true; - node->readonlyToken = loc(1); - node->propertyToken = loc(2); - node->typeToken = loc(3); - node->identifierToken = loc(4); - node->semicolonToken = loc(5); // insert a fake ';' before ':' +#line 1405 "qmljs.g" - AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(4)); - propertyName->identifierToken = loc(4); - propertyName->next = 0; + case 117: { + if (coverExpressionType != CE_ParenthesizedExpression) { + syntaxError(coverExpressionErrorLocation, "Expected token ')'."); + return false; + } + } break; - AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( - propertyName, sym(6).UiQualifiedId, sym(7).UiObjectInitializer); - binding->colonToken = loc(5); +#line 1416 "qmljs.g" - node->binding = binding; + case 118: { + AST::NestedExpression *node = new (pool) AST::NestedExpression(sym(2).Expression); + node->lparenToken = loc(1); + node->rparenToken = loc(3); + sym(1).Node = node; + coverExpressionType = CE_ParenthesizedExpression; + } break; - sym(1).Node = node; -} break; - -case 74: { - sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); -} break; - -case 75: { - sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); -} break; - -case 76: { - AST::UiEnumDeclaration *enumDeclaration = new (pool) AST::UiEnumDeclaration(stringRef(2), sym(4).UiEnumMemberList->finish()); - enumDeclaration->enumToken = loc(1); - enumDeclaration->rbraceToken = loc(5); - sym(1).Node = enumDeclaration; - break; -} +#line 1427 "qmljs.g" -case 77: { - AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1)); - node->memberToken = loc(1); - sym(1).Node = node; - break; -} + case 119: { + sym(1).Node = nullptr; + coverExpressionErrorLocation = loc(2); + coverExpressionType = CE_FormalParameterList; + } break; -case 78: { - AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1), sym(3).dval); - node->memberToken = loc(1); - node->valueToken = loc(3); - sym(1).Node = node; - break; -} +#line 1436 "qmljs.g" -case 79: { - AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3)); - node->memberToken = loc(3); - sym(1).Node = node; - break; -} + case 120: { + AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(nullptr, sym(2).PatternElement))->finish(pool); + sym(1).Node = node; + coverExpressionErrorLocation = loc(2); + coverExpressionType = CE_FormalParameterList; + } break; -case 80: { - AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3), sym(5).dval); - node->memberToken = loc(3); - node->valueToken = loc(5); - sym(1).Node = node; - break; +#line 1446 "qmljs.g" + + case 121: { + AST::FormalParameterList *list = sym(2).Expression->reparseAsFormalParameterList(pool); + if (!list) { + syntaxError(loc(1), "Invalid Arrow parameter list."); + return false; + } + if (sym(4).Node) { + list = new (pool) AST::FormalParameterList(list, sym(4).PatternElement); + } + coverExpressionErrorLocation = loc(4); + coverExpressionType = CE_FormalParameterList; + sym(1).Node = list->finish(pool); + } break; + +#line 1463 "qmljs.g" + + case 122: { + AST::NullExpression *node = new (pool) AST::NullExpression(); + node->nullToken = loc(1); + sym(1).Node = node; + } break; + +#line 1472 "qmljs.g" + + case 123: { + AST::TrueLiteral *node = new (pool) AST::TrueLiteral(); + node->trueToken = loc(1); + sym(1).Node = node; + } break; + +#line 1481 "qmljs.g" + + case 124: { + AST::FalseLiteral *node = new (pool) AST::FalseLiteral(); + node->falseToken = loc(1); + sym(1).Node = node; + } break; + +#line 1490 "qmljs.g" + + case 125: { + AST::NumericLiteral *node = new (pool) AST::NumericLiteral(sym(1).dval); + node->literalToken = loc(1); + sym(1).Node = node; + } break; + +#line 1499 "qmljs.g" + case 126: Q_FALLTHROUGH(); +#line 1502 "qmljs.g" + + case 127: { + AST::StringLiteral *node = new (pool) AST::StringLiteral(stringRef(1)); + node->literalToken = loc(1); + sym(1).Node = node; + } break; + +#line 1514 "qmljs.g" + +{ + Lexer::RegExpBodyPrefix prefix; + case 128: + prefix = Lexer::NoPrefix; + goto scan_regexp; + +#line 1526 "qmljs.g" + + case 129: + prefix = Lexer::EqualPrefix; + goto scan_regexp; + + scan_regexp: { + bool rx = lexer->scanRegExp(prefix); + if (!rx) { + diagnostic_messages.append(DiagnosticMessage(Severity::Error, location(lexer), lexer->errorMessage())); + return false; + } + + loc(1).length = lexer->tokenLength(); + yylloc = loc(1); // adjust the location of the current token + + AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral(driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); + node->literalToken = loc(1); + sym(1).Node = node; + } break; } -case 88: { - AST::ThisExpression *node = new (pool) AST::ThisExpression(); - node->thisToken = loc(1); - sym(1).Node = node; -} break; +#line 1550 "qmljs.g" + + case 130: { + AST::PatternElementList *list = nullptr; + if (sym(2).Elision) + list = (new (pool) AST::PatternElementList(sym(2).Elision, nullptr))->finish(); + AST::ArrayPattern *node = new (pool) AST::ArrayPattern(list); + node->lbracketToken = loc(1); + node->rbracketToken = loc(3); + sym(1).Node = node; + } break; + +#line 1563 "qmljs.g" + + case 131: { + AST::ArrayPattern *node = new (pool) AST::ArrayPattern(sym(2).PatternElementList->finish()); + node->lbracketToken = loc(1); + node->rbracketToken = loc(3); + sym(1).Node = node; + } break; + +#line 1573 "qmljs.g" + + case 132: { + auto *list = sym(2).PatternElementList; + if (sym(4).Elision) { + AST::PatternElementList *l = new (pool) AST::PatternElementList(sym(4).Elision, nullptr); + list = list->append(l); + } + AST::ArrayPattern *node = new (pool) AST::ArrayPattern(list->finish()); + node->lbracketToken = loc(1); + node->commaToken = loc(3); + node->rbracketToken = loc(5); + sym(1).Node = node; + Q_ASSERT(node->isValidArrayLiteral()); + } break; -case 89: { - AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; +#line 1590 "qmljs.g" -case 90: { - AST::NullExpression *node = new (pool) AST::NullExpression(); - node->nullToken = loc(1); - sym(1).Node = node; -} break; + case 133: { + AST::PatternElement *e = new (pool) AST::PatternElement(sym(1).Expression); + sym(1).Node = new (pool) AST::PatternElementList(nullptr, e); + } break; -case 91: { - AST::TrueLiteral *node = new (pool) AST::TrueLiteral(); - node->trueToken = loc(1); - sym(1).Node = node; -} break; +#line 1598 "qmljs.g" -case 92: { - AST::FalseLiteral *node = new (pool) AST::FalseLiteral(); - node->falseToken = loc(1); - sym(1).Node = node; -} break; + case 134: { + AST::PatternElement *e = new (pool) AST::PatternElement(sym(2).Expression); + sym(1).Node = new (pool) AST::PatternElementList(sym(1).Elision->finish(), e); + } break; -case 93: { - AST::NumericLiteral *node = new (pool) AST::NumericLiteral(sym(1).dval); - node->literalToken = loc(1); - sym(1).Node = node; -} break; -case 94: -case 95: { - AST::StringLiteral *node = new (pool) AST::StringLiteral(stringRef(1)); - node->literalToken = loc(1); - sym(1).Node = node; -} break; +#line 1606 "qmljs.g" -case 96: { - bool rx = lexer->scanRegExp(Lexer::NoPrefix); - if (!rx) { - diagnostic_messages.append(DiagnosticMessage(Severity::Error, location(lexer), lexer->errorMessage())); - return false; // ### remove me - } + case 135: { + AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(1).Elision, sym(2).PatternElement); + sym(1).Node = node; + } break; - loc(1).length = lexer->tokenLength(); - yylloc = loc(1); // adjust the location of the current token +#line 1614 "qmljs.g" - AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral( - driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); - node->literalToken = loc(1); - sym(1).Node = node; -} break; + case 136: { + AST::PatternElement *e = new (pool) AST::PatternElement(sym(4).Expression); + AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(3).Elision, e); + sym(1).Node = sym(1).PatternElementList->append(node); + } break; -case 97: { - bool rx = lexer->scanRegExp(Lexer::EqualPrefix); - if (!rx) { - diagnostic_messages.append(DiagnosticMessage(Severity::Error, location(lexer), lexer->errorMessage())); - return false; - } +#line 1623 "qmljs.g" - loc(1).length = lexer->tokenLength(); - yylloc = loc(1); // adjust the location of the current token + case 137: { + AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(3).Elision, sym(4).PatternElement); + sym(1).Node = sym(1).PatternElementList->append(node); + } break; + +#line 1631 "qmljs.g" + + case 138: { + AST::Elision *node = new (pool) AST::Elision(); + node->commaToken = loc(1); + sym(1).Node = node; + } break; + +#line 1640 "qmljs.g" + + case 139: { + AST::Elision *node = new (pool) AST::Elision(sym(1).Elision); + node->commaToken = loc(2); + sym(1).Node = node; + } break; + +#line 1649 "qmljs.g" + + case 140: { + sym(1).Node = nullptr; + } break; + +#line 1656 "qmljs.g" + + case 141: { + sym(1).Node = sym(1).Elision->finish(); + } break; + +#line 1663 "qmljs.g" + + case 142: { + AST::PatternElement *node = new (pool) AST::PatternElement(sym(2).Expression, AST::PatternElement::SpreadElement); + sym(1).Node = node; + } break; + +#line 1671 "qmljs.g" + + case 143: { + AST::ObjectPattern *node = new (pool) AST::ObjectPattern(); + node->lbraceToken = loc(1); + node->rbraceToken = loc(2); + sym(1).Node = node; + } break; + +#line 1681 "qmljs.g" + + case 144: { + AST::ObjectPattern *node = new (pool) AST::ObjectPattern(sym(2).PatternPropertyList->finish()); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + sym(1).Node = node; + } break; + +#line 1691 "qmljs.g" + + case 145: { + AST::ObjectPattern *node = new (pool) AST::ObjectPattern(sym(2).PatternPropertyList->finish()); + node->lbraceToken = loc(1); + node->rbraceToken = loc(4); + sym(1).Node = node; + } break; + +#line 1702 "qmljs.g" + case 146: Q_FALLTHROUGH(); +#line 1704 "qmljs.g" + + case 147: { + sym(1).Node = new (pool) AST::PatternPropertyList(sym(1).PatternProperty); + } break; + +#line 1711 "qmljs.g" + case 148: Q_FALLTHROUGH(); +#line 1713 "qmljs.g" + + case 149: { + AST::PatternPropertyList *node = new (pool) AST::PatternPropertyList(sym(1).PatternPropertyList, sym(3).PatternProperty); + sym(1).Node = node; + } break; + +#line 1721 "qmljs.g" + + case 150: { + AST::IdentifierPropertyName *name = new (pool) AST::IdentifierPropertyName(stringRef(1)); + name->propertyNameToken = loc(1); + AST::IdentifierExpression *expr = new (pool) AST::IdentifierExpression(stringRef(1)); + expr->identifierToken = loc(1); + AST::PatternProperty *node = new (pool) AST::PatternProperty(name, expr); + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 1737 "qmljs.g" + + case 152: { + AST::IdentifierPropertyName *name = new (pool) AST::IdentifierPropertyName(stringRef(1)); + name->propertyNameToken = loc(1); + AST::IdentifierExpression *left = new (pool) AST::IdentifierExpression(stringRef(1)); + left->identifierToken = loc(1); + // if initializer is an anonymous function expression, we need to assign identifierref as it's name + if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression)) + f->name = stringRef(1); + if (auto *c = asAnonymousClassDefinition(sym(2).Expression)) + c->name = stringRef(1); + AST::BinaryExpression *assignment = new (pool) AST::BinaryExpression(left, QSOperator::Assign, sym(2).Expression); + AST::PatternProperty *node = new (pool) AST::PatternProperty(name, assignment); + node->colonToken = loc(1); + sym(1).Node = node; + + } break; + +#line 1757 "qmljs.g" + case 153: Q_FALLTHROUGH(); +#line 1759 "qmljs.g" + + case 154: { + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, sym(3).Expression); + if (auto *f = asAnonymousFunctionDefinition(sym(3).Expression)) { + if (!AST::cast<AST::ComputedPropertyName *>(sym(1).PropertyName)) + f->name = driver->newStringRef(sym(1).PropertyName->asString()); + } + if (auto *c = asAnonymousClassDefinition(sym(3).Expression)) { + if (!AST::cast<AST::ComputedPropertyName *>(sym(1).PropertyName)) + c->name = driver->newStringRef(sym(1).PropertyName->asString()); + } + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 1781 "qmljs.g" + + case 158: { + AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); + node->propertyNameToken = loc(1); + sym(1).Node = node; + } break; + +#line 1790 "qmljs.g" + case 159: Q_FALLTHROUGH(); +#line 1792 "qmljs.g" + + case 160: { + AST::StringLiteralPropertyName *node = new (pool) AST::StringLiteralPropertyName(stringRef(1)); + node->propertyNameToken = loc(1); + sym(1).Node = node; + } break; + +#line 1801 "qmljs.g" + case 161: Q_FALLTHROUGH(); +#line 1803 "qmljs.g" + + case 162: { + AST::NumericLiteralPropertyName *node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval); + node->propertyNameToken = loc(1); + sym(1).Node = node; + } break; + +#line 1854 "qmljs.g" + + case 203: { + AST::ComputedPropertyName *node = new (pool) AST::ComputedPropertyName(sym(2).Expression); + node->propertyNameToken = loc(1); + sym(1).Node = node; + } break; + +#line 1863 "qmljs.g" + case 204: Q_FALLTHROUGH(); +#line 1865 "qmljs.g" + +case 205: { + sym(1) = sym(2); +} break; + +#line 1873 "qmljs.g" + case 206: Q_FALLTHROUGH(); +#line 1875 "qmljs.g" + + case 207: { + sym(1).Node = nullptr; + } break; + +#line 1885 "qmljs.g" + case 210: Q_FALLTHROUGH(); +#line 1888 "qmljs.g" + + case 211: { + AST::TemplateLiteral *node = new (pool) AST::TemplateLiteral(stringRef(1), nullptr); + node->literalToken = loc(1); + sym(1).Node = node; + } break; + +#line 1897 "qmljs.g" + case 212: Q_FALLTHROUGH(); +#line 1900 "qmljs.g" + + case 213: { + AST::TemplateLiteral *node = new (pool) AST::TemplateLiteral(stringRef(1), sym(2).Expression); + node->next = sym(3).Template; + node->literalToken = loc(1); + sym(1).Node = node; + } break; + +#line 1913 "qmljs.g" + + case 215: { + AST::SuperLiteral *node = new (pool) AST::SuperLiteral(); + node->superToken = loc(1); + sym(1).Node = node; + } break; + +#line 1923 "qmljs.g" + case 216: Q_FALLTHROUGH(); +#line 1925 "qmljs.g" + + case 217: { + AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); + node->lbracketToken = loc(2); + node->rbracketToken = loc(4); + sym(1).Node = node; + } break; + +#line 1937 "qmljs.g" + case 218: + { + AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1)); + node->identifierToken= loc(1); + sym(1).Node = node; + } Q_FALLTHROUGH(); + +#line 1945 "qmljs.g" + case 219: Q_FALLTHROUGH(); +#line 1947 "qmljs.g" + + case 220: { + AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); + node->dotToken = loc(2); + node->identifierToken = loc(3); + sym(1).Node = node; + } break; + +#line 1959 "qmljs.g" + + case 222: { + AST::NewMemberExpression *node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList); + node->newToken = loc(1); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + sym(1).Node = node; + } break; + +#line 1975 "qmljs.g" + + case 225: { + AST::NewExpression *node = new (pool) AST::NewExpression(sym(2).Expression); + node->newToken = loc(1); + sym(1).Node = node; + } break; + +#line 1985 "qmljs.g" + case 226: Q_FALLTHROUGH(); +#line 1987 "qmljs.g" + + case 227: { + AST::TaggedTemplate *node = new (pool) AST::TaggedTemplate(sym(1).Expression, sym(2).Template); + sym(1).Node = node; + } break; + +#line 1995 "qmljs.g" + + case 228: { + AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; + +#line 2005 "qmljs.g" + case 229: Q_FALLTHROUGH(); +#line 2007 "qmljs.g" + + case 230: { + AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; + +#line 2017 "qmljs.g" + + case 231: { + AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); + node->lbracketToken = loc(2); + node->rbracketToken = loc(4); + sym(1).Node = node; + } break; + +#line 2027 "qmljs.g" + + case 232: { + AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); + node->dotToken = loc(2); + node->identifierToken = loc(3); + sym(1).Node = node; + } break; + +#line 2037 "qmljs.g" + + case 233: { + sym(1).Node = nullptr; + } break; + +#line 2044 "qmljs.g" + case 234: Q_FALLTHROUGH(); +#line 2046 "qmljs.g" + + case 235: { + sym(1).Node = sym(1).ArgumentList->finish(); + } break; + +#line 2053 "qmljs.g" + + case 236: { + sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression); + } break; + +#line 2060 "qmljs.g" + + case 237: { + AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(2).Expression); + node->isSpreadElement = true; + sym(1).Node = node; + } break; + +#line 2069 "qmljs.g" + + case 238: { + AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression); + node->commaToken = loc(2); + sym(1).Node = node; + } break; + +#line 2078 "qmljs.g" + + case 239: { + AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(4).Expression); + node->commaToken = loc(2); + node->isSpreadElement = true; + sym(1).Node = node; + } break; - AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral( - driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); - node->literalToken = loc(1); - sym(1).Node = node; -} break; +#line 2093 "qmljs.g" + + case 243: { + AST::PostIncrementExpression *node = new (pool) AST::PostIncrementExpression(sym(1).Expression); + node->incrementToken = loc(2); + sym(1).Node = node; + } break; -case 98: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral((AST::Elision *) 0); - node->lbracketToken = loc(1); - node->rbracketToken = loc(2); - sym(1).Node = node; -} break; +#line 2102 "qmljs.g" -case 99: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).Elision->finish()); - node->lbracketToken = loc(1); - node->rbracketToken = loc(3); - sym(1).Node = node; -} break; + case 244: { + AST::PostDecrementExpression *node = new (pool) AST::PostDecrementExpression(sym(1).Expression); + node->decrementToken = loc(2); + sym(1).Node = node; + } break; -case 100: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish ()); - node->lbracketToken = loc(1); - node->rbracketToken = loc(3); - sym(1).Node = node; -} break; +#line 2111 "qmljs.g" -case 101: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), - (AST::Elision *) 0); - node->lbracketToken = loc(1); - node->commaToken = loc(3); - node->rbracketToken = loc(4); - sym(1).Node = node; -} break; + case 245: { + AST::PreIncrementExpression *node = new (pool) AST::PreIncrementExpression(sym(2).Expression); + node->incrementToken = loc(1); + sym(1).Node = node; + } break; -case 102: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), - sym(4).Elision->finish()); - node->lbracketToken = loc(1); - node->commaToken = loc(3); - node->rbracketToken = loc(5); - sym(1).Node = node; -} break; +#line 2120 "qmljs.g" -case 103: { - AST::ObjectLiteral *node = 0; - if (sym(2).Node) - node = new (pool) AST::ObjectLiteral( - sym(2).PropertyAssignmentList->finish ()); - else - node = new (pool) AST::ObjectLiteral(); - node->lbraceToken = loc(1); - node->rbraceToken = loc(3); - sym(1).Node = node; -} break; + case 246: { + AST::PreDecrementExpression *node = new (pool) AST::PreDecrementExpression(sym(2).Expression); + node->decrementToken = loc(1); + sym(1).Node = node; + } break; -case 104: { - AST::ObjectLiteral *node = new (pool) AST::ObjectLiteral( - sym(2).PropertyAssignmentList->finish ()); - node->lbraceToken = loc(1); - node->rbraceToken = loc(4); - sym(1).Node = node; -} break; +#line 2131 "qmljs.g" -case 105: { - AST::NestedExpression *node = new (pool) AST::NestedExpression(sym(2).Expression); - node->lparenToken = loc(1); - node->rparenToken = loc(3); - sym(1).Node = node; -} break; + case 248: { + AST::DeleteExpression *node = new (pool) AST::DeleteExpression(sym(2).Expression); + node->deleteToken = loc(1); + sym(1).Node = node; + } break; -case 106: { - if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) { - diagnostic_messages.append(DiagnosticMessage(Severity::Warning, mem->lbracketToken, - QLatin1String("Ignored annotation"))); +#line 2140 "qmljs.g" - sym(1).Expression = mem->base; - } + case 249: { + AST::VoidExpression *node = new (pool) AST::VoidExpression(sym(2).Expression); + node->voidToken = loc(1); + sym(1).Node = node; + } break; - if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) { - sym(1).UiQualifiedId = qualifiedId; - } else { - sym(1).UiQualifiedId = 0; +#line 2149 "qmljs.g" - diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1), - QLatin1String("Expected a qualified name id"))); + case 250: { + AST::TypeOfExpression *node = new (pool) AST::TypeOfExpression(sym(2).Expression); + node->typeofToken = loc(1); + sym(1).Node = node; + } break; - return false; // ### recover - } -} break; +#line 2158 "qmljs.g" -case 107: { - sym(1).Node = new (pool) AST::ElementList((AST::Elision *) 0, sym(1).Expression); -} break; + case 251: { + AST::UnaryPlusExpression *node = new (pool) AST::UnaryPlusExpression(sym(2).Expression); + node->plusToken = loc(1); + sym(1).Node = node; + } break; -case 108: { - sym(1).Node = new (pool) AST::ElementList(sym(1).Elision->finish(), sym(2).Expression); -} break; +#line 2167 "qmljs.g" -case 109: { - AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, - (AST::Elision *) 0, sym(3).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case 252: { + AST::UnaryMinusExpression *node = new (pool) AST::UnaryMinusExpression(sym(2).Expression); + node->minusToken = loc(1); + sym(1).Node = node; + } break; -case 110: { - AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, sym(3).Elision->finish(), - sym(4).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; +#line 2176 "qmljs.g" -case 111: { - AST::Elision *node = new (pool) AST::Elision(); - node->commaToken = loc(1); - sym(1).Node = node; -} break; + case 253: { + AST::TildeExpression *node = new (pool) AST::TildeExpression(sym(2).Expression); + node->tildeToken = loc(1); + sym(1).Node = node; + } break; -case 112: { - AST::Elision *node = new (pool) AST::Elision(sym(1).Elision); - node->commaToken = loc(2); - sym(1).Node = node; -} break; +#line 2185 "qmljs.g" -case 113: { - AST::PropertyNameAndValue *node = new (pool) AST::PropertyNameAndValue( - sym(1).PropertyName, sym(3).Expression); - node->colonToken = loc(2); - sym(1).Node = node; -} break; + case 254: { + AST::NotExpression *node = new (pool) AST::NotExpression(sym(2).Expression); + node->notToken = loc(1); + sym(1).Node = node; + } break; -case 114: { - AST::PropertyGetterSetter *node = new (pool) AST::PropertyGetterSetter( - sym(2).PropertyName, sym(6).FunctionBody); - node->getSetToken = loc(1); - node->lparenToken = loc(3); - node->rparenToken = loc(4); - node->lbraceToken = loc(5); - node->rbraceToken = loc(7); - sym(1).Node = node; -} break; +#line 2196 "qmljs.g" -case 115: { - AST::PropertyGetterSetter *node = new (pool) AST::PropertyGetterSetter( - sym(2).PropertyName, sym(4).FormalParameterList, sym(7).FunctionBody); - node->getSetToken = loc(1); - node->lparenToken = loc(3); - node->rparenToken = loc(5); - node->lbraceToken = loc(6); - node->rbraceToken = loc(8); - sym(1).Node = node; -} break; + case 256: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Exp, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 116: { - sym(1).Node = new (pool) AST::PropertyAssignmentList(sym(1).PropertyAssignment); -} break; +#line 2207 "qmljs.g" -case 117: { - AST::PropertyAssignmentList *node = new (pool) AST::PropertyAssignmentList( - sym(1).PropertyAssignmentList, sym(3).PropertyAssignment); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case 258: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 118: { - AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); - node->propertyNameToken = loc(1); - sym(1).Node = node; -} break; +#line 2216 "qmljs.g" -case 119: { - AST::StringLiteralPropertyName *node = new (pool) AST::StringLiteralPropertyName(stringRef(1)); - node->propertyNameToken = loc(1); - sym(1).Node = node; -} break; + case 259: { + sym(1).ival = QSOperator::Mul; + } break; -case 120: { - AST::NumericLiteralPropertyName *node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval); - node->propertyNameToken = loc(1); - sym(1).Node = node; -} break; +#line 2223 "qmljs.g" -case 121: { - AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); - node->propertyNameToken = loc(1); - sym(1).Node = node; -} break; + case 260: { + sym(1).ival = QSOperator::Div; + } break; -case 159: { - AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); - node->lbracketToken = loc(2); - node->rbracketToken = loc(4); - sym(1).Node = node; -} break; +#line 2230 "qmljs.g" -case 160: { - AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); - node->dotToken = loc(2); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; + case 261: { + sym(1).ival = QSOperator::Mod; + } break; -case 161: { - AST::NewMemberExpression *node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList); - node->newToken = loc(1); - node->lparenToken = loc(3); - node->rparenToken = loc(5); - sym(1).Node = node; -} break; +#line 2239 "qmljs.g" -case 163: { - AST::NewExpression *node = new (pool) AST::NewExpression(sym(2).Expression); - node->newToken = loc(1); - sym(1).Node = node; -} break; + case 263: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Add, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 164: { - AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; +#line 2248 "qmljs.g" -case 165: { - AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case 264: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Sub, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 166: { - AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); - node->lbracketToken = loc(2); - node->rbracketToken = loc(4); - sym(1).Node = node; -} break; +#line 2259 "qmljs.g" -case 167: { - AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); - node->dotToken = loc(2); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; + case 266: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::LShift, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 168: { - sym(1).Node = 0; -} break; +#line 2268 "qmljs.g" -case 169: { - sym(1).Node = sym(1).ArgumentList->finish(); -} break; + case 267: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::RShift, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 170: { - sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression); -} break; +#line 2277 "qmljs.g" -case 171: { - AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case 268: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::URShift, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 175: { - AST::PostIncrementExpression *node = new (pool) AST::PostIncrementExpression(sym(1).Expression); - node->incrementToken = loc(2); - sym(1).Node = node; -} break; +#line 2289 "qmljs.g" + case 271: Q_FALLTHROUGH(); +#line 2291 "qmljs.g" -case 176: { - AST::PostDecrementExpression *node = new (pool) AST::PostDecrementExpression(sym(1).Expression); - node->decrementToken = loc(2); - sym(1).Node = node; -} break; + case 272: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 178: { - AST::DeleteExpression *node = new (pool) AST::DeleteExpression(sym(2).Expression); - node->deleteToken = loc(1); - sym(1).Node = node; -} break; +#line 2300 "qmljs.g" -case 179: { - AST::VoidExpression *node = new (pool) AST::VoidExpression(sym(2).Expression); - node->voidToken = loc(1); - sym(1).Node = node; -} break; + case 273: { + sym(1).ival = QSOperator::Lt; + } break; -case 180: { - AST::TypeOfExpression *node = new (pool) AST::TypeOfExpression(sym(2).Expression); - node->typeofToken = loc(1); - sym(1).Node = node; -} break; +#line 2306 "qmljs.g" -case 181: { - AST::PreIncrementExpression *node = new (pool) AST::PreIncrementExpression(sym(2).Expression); - node->incrementToken = loc(1); - sym(1).Node = node; -} break; + case 274: { + sym(1).ival = QSOperator::Gt; + } break; -case 182: { - AST::PreDecrementExpression *node = new (pool) AST::PreDecrementExpression(sym(2).Expression); - node->decrementToken = loc(1); - sym(1).Node = node; -} break; +#line 2312 "qmljs.g" -case 183: { - AST::UnaryPlusExpression *node = new (pool) AST::UnaryPlusExpression(sym(2).Expression); - node->plusToken = loc(1); - sym(1).Node = node; -} break; + case 275: { + sym(1).ival = QSOperator::Le; + } break; -case 184: { - AST::UnaryMinusExpression *node = new (pool) AST::UnaryMinusExpression(sym(2).Expression); - node->minusToken = loc(1); - sym(1).Node = node; -} break; +#line 2318 "qmljs.g" -case 185: { - AST::TildeExpression *node = new (pool) AST::TildeExpression(sym(2).Expression); - node->tildeToken = loc(1); - sym(1).Node = node; -} break; + case 276: { + sym(1).ival = QSOperator::Ge; + } break; -case 186: { - AST::NotExpression *node = new (pool) AST::NotExpression(sym(2).Expression); - node->notToken = loc(1); - sym(1).Node = node; -} break; +#line 2324 "qmljs.g" -case 188: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Mul, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 277: { + sym(1).ival = QSOperator::InstanceOf; + } break; -case 189: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Div, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2331 "qmljs.g" -case 190: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Mod, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 278: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::In, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 192: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Add, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2343 "qmljs.g" + case 281: Q_FALLTHROUGH(); +#line 2345 "qmljs.g" -case 193: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Sub, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 282: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; + +#line 2354 "qmljs.g" + + case 283: { + sym(1).ival = QSOperator::Equal; + } break; + +#line 2360 "qmljs.g" + + case 284: { + sym(1).ival = QSOperator::NotEqual; + } break; + +#line 2366 "qmljs.g" + + case 285: { + sym(1).ival = QSOperator::StrictEqual; + } break; + +#line 2372 "qmljs.g" + + case 286: { + sym(1).ival = QSOperator::StrictNotEqual; + } break; + +#line 2383 "qmljs.g" + case 289: Q_FALLTHROUGH(); +#line 2385 "qmljs.g" + + case 290: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; + +#line 2398 "qmljs.g" + case 293: Q_FALLTHROUGH(); +#line 2400 "qmljs.g" + + case 294: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; + +#line 2412 "qmljs.g" + case 297: Q_FALLTHROUGH(); +#line 2414 "qmljs.g" + + case 298: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; + +#line 2426 "qmljs.g" + case 301: Q_FALLTHROUGH(); +#line 2428 "qmljs.g" + + case 302: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; + +#line 2440 "qmljs.g" + case 305: Q_FALLTHROUGH(); +#line 2442 "qmljs.g" + + case 306: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; + +#line 2455 "qmljs.g" + case 309: Q_FALLTHROUGH(); +#line 2457 "qmljs.g" + + case 310: { + AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression); + node->questionToken = loc(2); + node->colonToken = loc(4); + sym(1).Node = node; + } break; + +#line 2476 "qmljs.g" + case 317: Q_FALLTHROUGH(); +#line 2478 "qmljs.g" + + case 318: { + // need to convert the LHS to an AssignmentPattern if it was an Array/ObjectLiteral + if (AST::Pattern *p = sym(1).Expression->patternCast()) { + AST::SourceLocation errorLoc; + QString errorMsg; + if (!p->convertLiteralToAssignmentPattern(pool, &errorLoc, &errorMsg)) { + syntaxError(errorLoc, errorMsg); + return false; + } + } + // if lhs is an identifier expression and rhs is an anonymous function expression, we need to assign the name of lhs to the function + if (auto *f = asAnonymousFunctionDefinition(sym(3).Expression)) { + if (auto *id = AST::cast<AST::IdentifierExpression *>(sym(1).Expression)) + f->name = id->name; + } + if (auto *c = asAnonymousClassDefinition(sym(3).Expression)) { + if (auto *id = AST::cast<AST::IdentifierExpression *>(sym(1).Expression)) + c->name = id->name; + } -case 195: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::LShift, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Assign, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 196: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::RShift, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2506 "qmljs.g" + case 319: Q_FALLTHROUGH(); +#line 2508 "qmljs.g" -case 197: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::URShift, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 320: { + AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; + } break; -case 199: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Lt, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2517 "qmljs.g" -case 200: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Gt, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 321: { + sym(1).ival = QSOperator::InplaceMul; + } break; -case 201: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Le, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2524 "qmljs.g" -case 202: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Ge, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 322: { + sym(1).ival = QSOperator::InplaceExp; + } break; -case 203: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::InstanceOf, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2531 "qmljs.g" -case 204: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::In, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 323: { + sym(1).ival = QSOperator::InplaceDiv; + } break; -case 206: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Lt, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2538 "qmljs.g" -case 207: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Gt, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 324: { + sym(1).ival = QSOperator::InplaceMod; + } break; -case 208: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Le, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2545 "qmljs.g" -case 209: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Ge, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 325: { + sym(1).ival = QSOperator::InplaceAdd; + } break; -case 210: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::InstanceOf, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2552 "qmljs.g" -case 212: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Equal, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 326: { + sym(1).ival = QSOperator::InplaceSub; + } break; -case 213: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::NotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2559 "qmljs.g" -case 214: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::StrictEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 327: { + sym(1).ival = QSOperator::InplaceLeftShift; + } break; -case 215: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2566 "qmljs.g" -case 217: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Equal, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 328: { + sym(1).ival = QSOperator::InplaceRightShift; + } break; -case 218: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::NotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2573 "qmljs.g" -case 219: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::StrictEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 329: { + sym(1).ival = QSOperator::InplaceURightShift; + } break; -case 220: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2580 "qmljs.g" -case 222: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 330: { + sym(1).ival = QSOperator::InplaceAnd; + } break; -case 224: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2587 "qmljs.g" -case 226: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 331: { + sym(1).ival = QSOperator::InplaceXor; + } break; -case 228: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2594 "qmljs.g" -case 230: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 332: { + sym(1).ival = QSOperator::InplaceOr; + } break; -case 232: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2604 "qmljs.g" + case 335: Q_FALLTHROUGH(); +#line 2606 "qmljs.g" -case 234: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::And, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 336: { + AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); + node->commaToken = loc(2); + sym(1).Node = node; + } break; -case 236: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::And, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2615 "qmljs.g" + case 337: Q_FALLTHROUGH(); +#line 2617 "qmljs.g" -case 238: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Or, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 338: { + sym(1).Node = nullptr; + } break; -case 240: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - QSOperator::Or, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2629 "qmljs.g" -case 242: { - AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, - sym(3).Expression, sym(5).Expression); - node->questionToken = loc(2); - node->colonToken = loc(4); - sym(1).Node = node; -} break; + case 341: { + sym(1).Node = sym(3).Node; + } break; -case 244: { - AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, - sym(3).Expression, sym(5).Expression); - node->questionToken = loc(2); - node->colonToken = loc(4); - sym(1).Node = node; -} break; +#line 2636 "qmljs.g" + case 342: Q_FALLTHROUGH(); +#line 2638 "qmljs.g" + case 343: Q_FALLTHROUGH(); +#line 2640 "qmljs.g" + case 344: Q_FALLTHROUGH(); +#line 2642 "qmljs.g" + case 345: Q_FALLTHROUGH(); +#line 2644 "qmljs.g" + case 346: Q_FALLTHROUGH(); +#line 2646 "qmljs.g" + case 347: Q_FALLTHROUGH(); +#line 2648 "qmljs.g" + case 348: Q_FALLTHROUGH(); +#line 2650 "qmljs.g" + case 349: Q_FALLTHROUGH(); +#line 2652 "qmljs.g" + case 350: Q_FALLTHROUGH(); +#line 2654 "qmljs.g" + case 351: Q_FALLTHROUGH(); +#line 2656 "qmljs.g" + case 352: Q_FALLTHROUGH(); +#line 2658 "qmljs.g" + case 353: Q_FALLTHROUGH(); +#line 2660 "qmljs.g" + + case 354: { + sym(1).Node = sym(2).Node; + } break; + +#line 2682 "qmljs.g" + + case 365: { + AST::Block *node = new (pool) AST::Block(sym(2).StatementList); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + sym(1).Node = node; + } break; + +#line 2694 "qmljs.g" + + case 367: { + sym(1).StatementList = sym(1).StatementList->append(sym(2).StatementList); + } break; + +#line 2701 "qmljs.g" + + case 368: { + sym(1).StatementList = new (pool) AST::StatementList(sym(1).Statement); + } break; + +#line 2709 "qmljs.g" + + case 370: { + sym(1).Node = new (pool) AST::StatementList(sym(3).FunctionDeclaration); + } break; + +#line 2716 "qmljs.g" + + case 371: { + sym(1).Node = nullptr; + } break; + +#line 2723 "qmljs.g" + + case 372: { + sym(1).Node = sym(1).StatementList->finish(); + } break; + +#line 2730 "qmljs.g" + + case 373: { + sym(1).scope = AST::VariableScope::Let; + } break; + +#line 2736 "qmljs.g" + + case 374: { + sym(1).scope = AST::VariableScope::Const; + } break; + +#line 2743 "qmljs.g" + + case 375: { + sym(1).scope = AST::VariableScope::Var; + } break; + +#line 2750 "qmljs.g" + case 376: Q_FALLTHROUGH(); +#line 2752 "qmljs.g" + case 377: Q_FALLTHROUGH(); +#line 2754 "qmljs.g" + case 378: Q_FALLTHROUGH(); +#line 2756 "qmljs.g" + + case 379: { + AST::VariableStatement *node = new (pool) AST::VariableStatement(sym(2).VariableDeclarationList->finish(sym(1).scope)); + node->declarationKindToken = loc(1); + sym(1).Node = node; + } break; + +#line 2768 "qmljs.g" + case 382: Q_FALLTHROUGH(); +#line 2770 "qmljs.g" + case 383: Q_FALLTHROUGH(); +#line 2772 "qmljs.g" + case 384: Q_FALLTHROUGH(); +#line 2774 "qmljs.g" + + case 385: { + sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).PatternElement); + } break; + +#line 2781 "qmljs.g" + case 386: Q_FALLTHROUGH(); +#line 2783 "qmljs.g" + case 387: Q_FALLTHROUGH(); +#line 2785 "qmljs.g" + case 388: Q_FALLTHROUGH(); +#line 2787 "qmljs.g" + + case 389: { + AST::VariableDeclarationList *node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).PatternElement); + node->commaToken = loc(2); + sym(1).Node = node; + } break; + +#line 2796 "qmljs.g" + case 390: Q_FALLTHROUGH(); +#line 2798 "qmljs.g" + case 391: Q_FALLTHROUGH(); +#line 2800 "qmljs.g" + case 392: Q_FALLTHROUGH(); +#line 2802 "qmljs.g" + + case 393: { + auto *node = new (pool) AST::PatternElement(stringRef(1), sym(2).Expression); + node->identifierToken = loc(1); + sym(1).Node = node; + // if initializer is an anonymous function expression, we need to assign identifierref as it's name + if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression)) + f->name = stringRef(1); + if (auto *c = asAnonymousClassDefinition(sym(2).Expression)) + c->name = stringRef(1); + } break; + +#line 2816 "qmljs.g" + case 394: Q_FALLTHROUGH(); +#line 2818 "qmljs.g" + case 395: Q_FALLTHROUGH(); +#line 2820 "qmljs.g" + case 396: Q_FALLTHROUGH(); +#line 2822 "qmljs.g" + + case 397: { + auto *node = new (pool) AST::PatternElement(sym(1).Pattern, sym(2).Expression); + node->identifierToken = loc(1); + sym(1).Node = node; + } break; + +#line 2831 "qmljs.g" + + case 398: { + auto *node = new (pool) AST::ObjectPattern(sym(2).PatternPropertyList); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + node->parseMode = AST::Pattern::Binding; + sym(1).Node = node; + } break; + +#line 2842 "qmljs.g" + + case 399: { + auto *node = new (pool) AST::ArrayPattern(sym(2).PatternElementList); + node->lbracketToken = loc(1); + node->rbracketToken = loc(3); + node->parseMode = AST::Pattern::Binding; + sym(1).Node = node; + } break; + +#line 2853 "qmljs.g" + + case 400: { + sym(1).Node = nullptr; + } break; + +#line 2860 "qmljs.g" + case 401: +#line 2862 "qmljs.g" + + case 402: { + sym(1).Node = sym(1).PatternPropertyList->finish(); + } break; + +#line 2869 "qmljs.g" + + case 403: { + if (sym(1).Elision || sym(2).Node) { + auto *l = new (pool) AST::PatternElementList(sym(1).Elision, sym(2).PatternElement); + sym(1).Node = l->finish(); + } else { + sym(1).Node = nullptr; + } + } break; -case 246: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - sym(2).ival, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; +#line 2881 "qmljs.g" -case 248: { - AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, - sym(2).ival, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; + case 404: { + sym(1).Node = sym(1).PatternElementList->finish(); + } break; -case 249: { - sym(1).ival = QSOperator::Assign; -} break; +#line 2888 "qmljs.g" -case 250: { - sym(1).ival = QSOperator::InplaceMul; -} break; + case 405: { + if (sym(3).Elision || sym(4).Node) { + auto *l = new (pool) AST::PatternElementList(sym(3).Elision, sym(4).PatternElement); + l = sym(1).PatternElementList->append(l); + sym(1).Node = l; + } + sym(1).Node = sym(1).PatternElementList->finish(); + } break; -case 251: { - sym(1).ival = QSOperator::InplaceDiv; -} break; +#line 2900 "qmljs.g" -case 252: { - sym(1).ival = QSOperator::InplaceMod; -} break; + case 406: { + sym(1).Node = new (pool) AST::PatternPropertyList(sym(1).PatternProperty); + } break; -case 253: { - sym(1).ival = QSOperator::InplaceAdd; -} break; +#line 2907 "qmljs.g" -case 254: { - sym(1).ival = QSOperator::InplaceSub; -} break; + case 407: { + sym(1).Node = new (pool) AST::PatternPropertyList(sym(1).PatternPropertyList, sym(3).PatternProperty); + } break; -case 255: { - sym(1).ival = QSOperator::InplaceLeftShift; -} break; +#line 2916 "qmljs.g" -case 256: { - sym(1).ival = QSOperator::InplaceRightShift; -} break; + case 409: { + sym(1).PatternElementList = sym(1).PatternElementList->append(sym(3).PatternElementList); + } break; -case 257: { - sym(1).ival = QSOperator::InplaceURightShift; -} break; +#line 2923 "qmljs.g" -case 258: { - sym(1).ival = QSOperator::InplaceAnd; -} break; + case 410: { + sym(1).Node = new (pool) AST::PatternElementList(sym(1).Elision, sym(2).PatternElement); + } break; -case 259: { - sym(1).ival = QSOperator::InplaceXor; -} break; +#line 2931 "qmljs.g" -case 260: { - sym(1).ival = QSOperator::InplaceOr; -} break; + case 411: { + AST::StringLiteralPropertyName *name = new (pool) AST::StringLiteralPropertyName(stringRef(1)); + name->propertyNameToken = loc(1); + // if initializer is an anonymous function expression, we need to assign identifierref as it's name + if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression)) + f->name = stringRef(1); + if (auto *c = asAnonymousClassDefinition(sym(2).Expression)) + c->name = stringRef(1); + sym(1).Node = new (pool) AST::PatternProperty(name, stringRef(1), sym(2).Expression); + } break; + +#line 2945 "qmljs.g" -case 262: { - AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + case 412: { + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, stringRef(3), sym(4).Expression); + sym(1).Node = node; + } break; -case 263: { - sym(1).Node = 0; -} break; +#line 2953 "qmljs.g" + + case 413: { + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, sym(3).Pattern, sym(4).Expression); + sym(1).Node = node; + } break; + +#line 2961 "qmljs.g" + + case 414: { + AST::PatternElement *node = new (pool) AST::PatternElement(stringRef(1), sym(2).Expression); + node->identifierToken = loc(1); + // if initializer is an anonymous function expression, we need to assign identifierref as it's name + if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression)) + f->name = stringRef(1); + if (auto *c = asAnonymousClassDefinition(sym(2).Expression)) + c->name = stringRef(1); + sym(1).Node = node; + } break; + +#line 2975 "qmljs.g" + + case 415: { + AST::PatternElement *node = new (pool) AST::PatternElement(sym(1).Pattern, sym(2).Expression); + sym(1).Node = node; + } break; + +#line 2983 "qmljs.g" + + case 416: { + AST::PatternElement *node = new (pool) AST::PatternElement(stringRef(2), nullptr, AST::PatternElement::RestElement); + node->identifierToken = loc(2); + sym(1).Node = node; + } break; + +#line 2992 "qmljs.g" + + case 417: { + AST::PatternElement *node = new (pool) AST::PatternElement(sym(2).Pattern, nullptr, AST::PatternElement::RestElement); + sym(1).Node = node; + } break; + +#line 3000 "qmljs.g" + + case 418: { + sym(1).Node = nullptr; + } break; + +#line 3010 "qmljs.g" + + case 420: { + AST::EmptyStatement *node = new (pool) AST::EmptyStatement(); + node->semicolonToken = loc(1); + sym(1).Node = node; + } break; + +#line 3025 "qmljs.g" + + case 421: { + int token = lookaheadToken(lexer); + if (token == T_LBRACE) + pushToken(T_FORCE_BLOCK); + else if (token == T_FUNCTION || token == T_CLASS || token == T_LET || token == T_CONST) + pushToken(T_FORCE_DECLARATION); + } break; + +#line 3037 "qmljs.g" + + case 423: { + AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(sym(1).Expression); + node->semicolonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3046 "qmljs.g" + + case 424: { + AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement, sym(7).Statement); + node->ifToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + node->elseToken = loc(6); + sym(1).Node = node; + } break; + +#line 3058 "qmljs.g" + + case 425: { + AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement); + node->ifToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; + +#line 3072 "qmljs.g" + + case 428: { + AST::DoWhileStatement *node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression); + node->doToken = loc(1); + node->whileToken = loc(3); + node->lparenToken = loc(4); + node->rparenToken = loc(6); + node->semicolonToken = loc(7); + sym(1).Node = node; + } break; + +#line 3085 "qmljs.g" + + case 429: { + AST::WhileStatement *node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement); + node->whileToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; + +#line 3096 "qmljs.g" + + case 430: { + AST::ForStatement *node = new (pool) AST::ForStatement(sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); + node->forToken = loc(1); + node->lparenToken = loc(2); + node->firstSemicolonToken = loc(4); + node->secondSemicolonToken = loc(6); + node->rparenToken = loc(8); + sym(1).Node = node; + } break; + +#line 3109 "qmljs.g" + case 431: Q_FALLTHROUGH(); +#line 3111 "qmljs.g" + + case 432: { + // ### get rid of the static_cast! + AST::ForStatement *node = new (pool) AST::ForStatement( + static_cast<AST::VariableStatement *>(sym(3).Node)->declarations, sym(5).Expression, + sym(7).Expression, sym(9).Statement); + node->forToken = loc(1); + node->lparenToken = loc(2); + node->firstSemicolonToken = loc(4); + node->secondSemicolonToken = loc(6); + node->rparenToken = loc(8); + sym(1).Node = node; + } break; + +#line 3127 "qmljs.g" + + case 433: { + sym(1).forEachType = AST::ForEachType::In; + } break; + +#line 3134 "qmljs.g" + + case 434: { + sym(1).forEachType = AST::ForEachType::Of; + } break; + +#line 3141 "qmljs.g" + + case 435: { + // need to convert the LHS to an AssignmentPattern if it was an Array/ObjectLiteral + if (AST::Pattern *p = sym(3).Expression->patternCast()) { + AST::SourceLocation errorLoc; + QString errorMsg; + if (!p->convertLiteralToAssignmentPattern(pool, &errorLoc, &errorMsg)) { + syntaxError(errorLoc, errorMsg); + return false; + } + } + AST::ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).Expression, sym(5).Expression, sym(7).Statement); + node->forToken = loc(1); + node->lparenToken = loc(2); + node->inOfToken = loc(4); + node->rparenToken = loc(6); + node->type = sym(4).forEachType; + sym(1).Node = node; + } break; + +#line 3163 "qmljs.g" + + case 436: { + AST::ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).PatternElement, sym(5).Expression, sym(7).Statement); + node->forToken = loc(1); + node->lparenToken = loc(2); + node->inOfToken = loc(4); + node->rparenToken = loc(6); + node->type = sym(4).forEachType; + sym(1).Node = node; + } break; + +#line 3176 "qmljs.g" + case 437: Q_FALLTHROUGH(); +#line 3178 "qmljs.g" + + case 438: { + auto *node = new (pool) AST::PatternElement(stringRef(2), nullptr); + node->identifierToken = loc(2); + node->scope = sym(1).scope; + node->isForDeclaration = true; + sym(1).Node = node; + } break; + +#line 3189 "qmljs.g" + case 439: Q_FALLTHROUGH(); +#line 3191 "qmljs.g" + + case 440: { + auto *node = new (pool) AST::PatternElement(sym(2).Pattern, nullptr); + node->scope = sym(1).scope; + node->isForDeclaration = true; + sym(1).Node = node; + } break; + +#line 3202 "qmljs.g" + + case 442: { + AST::ContinueStatement *node = new (pool) AST::ContinueStatement(); + node->continueToken = loc(1); + node->semicolonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3213 "qmljs.g" + + case 444: { + AST::ContinueStatement *node = new (pool) AST::ContinueStatement(stringRef(2)); + node->continueToken = loc(1); + node->identifierToken = loc(2); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; + +#line 3225 "qmljs.g" + + case 446: { + AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef()); + node->breakToken = loc(1); + node->semicolonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3236 "qmljs.g" + + case 448: { + AST::BreakStatement *node = new (pool) AST::BreakStatement(stringRef(2)); + node->breakToken = loc(1); + node->identifierToken = loc(2); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; + +#line 3248 "qmljs.g" + + case 450: { + if (!functionNestingLevel) { + syntaxError(loc(1), "Return statement not allowed outside of Function declaration."); + return false; + } + AST::ReturnStatement *node = new (pool) AST::ReturnStatement(sym(2).Expression); + node->returnToken = loc(1); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; -case 266: { - AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; +#line 3262 "qmljs.g" + + case 451: { + AST::WithStatement *node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement); + node->withToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; + +#line 3273 "qmljs.g" + + case 452: { + AST::SwitchStatement *node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock); + node->switchToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; + +#line 3284 "qmljs.g" + + case 453: { + AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses); + node->lbraceToken = loc(1); + node->rbraceToken = loc(3); + sym(1).Node = node; + } break; -case 267: { - sym(1).Node = 0; -} break; +#line 3294 "qmljs.g" -case 284: { - AST::Block *node = new (pool) AST::Block(sym(2).StatementList); - node->lbraceToken = loc(1); - node->rbraceToken = loc(3); - sym(1).Node = node; -} break; + case 454: { + AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); + node->lbraceToken = loc(1); + node->rbraceToken = loc(5); + sym(1).Node = node; + } break; + +#line 3304 "qmljs.g" + + case 455: { + sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause); + } break; + +#line 3311 "qmljs.g" + + case 456: { + sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause); + } break; + +#line 3318 "qmljs.g" + + case 457: { + sym(1).Node = nullptr; + } break; + +#line 3325 "qmljs.g" + + case 458: { + sym(1).Node = sym(1).CaseClauses->finish(); + } break; + +#line 3332 "qmljs.g" + + case 459: { + AST::CaseClause *node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList); + node->caseToken = loc(1); + node->colonToken = loc(3); + sym(1).Node = node; + } break; + +#line 3342 "qmljs.g" + + case 460: { + AST::DefaultClause *node = new (pool) AST::DefaultClause(sym(3).StatementList); + node->defaultToken = loc(1); + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3352 "qmljs.g" + + case 461: { + AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); + node->identifierToken = loc(1); + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3364 "qmljs.g" + + case 463: { + syntaxError(loc(3), "FunctionDeclarations are not allowed after a label."); + return false; + } break; + +#line 3373 "qmljs.g" + + case 465: { + AST::ThrowStatement *node = new (pool) AST::ThrowStatement(sym(2).Expression); + node->throwToken = loc(1); + node->semicolonToken = loc(3); + sym(1).Node = node; + } break; + +#line 3383 "qmljs.g" + + case 466: { + AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch); + node->tryToken = loc(1); + sym(1).Node = node; + } break; + +#line 3392 "qmljs.g" + + case 467: { + AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally); + node->tryToken = loc(1); + sym(1).Node = node; + } break; + +#line 3401 "qmljs.g" + + case 468: { + AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally); + node->tryToken = loc(1); + sym(1).Node = node; + } break; + +#line 3410 "qmljs.g" + + case 469: { + AST::Catch *node = new (pool) AST::Catch(sym(3).PatternElement, sym(5).Block); + node->catchToken = loc(1); + node->lparenToken = loc(2); + node->identifierToken = loc(3); + node->rparenToken = loc(4); + sym(1).Node = node; + } break; + +#line 3422 "qmljs.g" + + case 470: { + AST::Finally *node = new (pool) AST::Finally(sym(2).Block); + node->finallyToken = loc(1); + sym(1).Node = node; + } break; + +#line 3431 "qmljs.g" + + case 471: { + AST::PatternElement *node = new (pool) AST::PatternElement(stringRef(1)); + node->identifierToken = loc(1); + node->scope = AST::VariableScope::Let; + sym(1).Node = node; + } break; + +#line 3441 "qmljs.g" + + case 472: { + AST::PatternElement *node = new (pool) AST::PatternElement(sym(1).Pattern); + node->scope = AST::VariableScope::Let; + sym(1).Node = node; + } break; + +#line 3451 "qmljs.g" + + case 474: { + AST::DebuggerStatement *node = new (pool) AST::DebuggerStatement(); + node->debuggerToken = loc(1); + node->semicolonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3468 "qmljs.g" + + case 476: { + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).StatementList); + node->functionToken = loc(1); + node->identifierToken = loc(2); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + node->lbraceToken = loc(6); + node->rbraceToken = loc(8); + sym(1).Node = node; + } break; + +#line 3484 "qmljs.g" + + case 478: { + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(QStringRef(), sym(3).FormalParameterList, sym(6).StatementList); + node->functionToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + node->lbraceToken = loc(5); + node->rbraceToken = loc(7); + sym(1).Node = node; + } break; + +#line 3497 "qmljs.g" + + case 479: { + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).StatementList); + node->functionToken = loc(1); + if (! stringRef(2).isNull()) + node->identifierToken = loc(2); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + node->lbraceToken = loc(6); + node->rbraceToken = loc(8); + sym(1).Node = node; + } break; + +#line 3512 "qmljs.g" + + case 480: { + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(3).FormalParameterList, sym(6).StatementList); + node->functionToken = loc(1); + node->lparenToken = loc(2); + node->rparenToken = loc(4); + node->lbraceToken = loc(5); + node->rbraceToken = loc(7); + sym(1).Node = node; + } break; + +#line 3527 "qmljs.g" + + case 482: { + sym(1).Node = nullptr; + } break; + +#line 3534 "qmljs.g" + + case 483: { + AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(nullptr, sym(1).PatternElement))->finish(pool); + sym(1).Node = node; + } break; + +#line 3542 "qmljs.g" + case 484: +#line 3544 "qmljs.g" + + case 485: { + sym(1).Node = sym(1).FormalParameterList->finish(pool); + } break; + +#line 3551 "qmljs.g" + + case 486: { + AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(sym(1).FormalParameterList, sym(3).PatternElement))->finish(pool); + sym(1).Node = node; + } break; + +#line 3559 "qmljs.g" + + case 487: { + AST::FormalParameterList *node = new (pool) AST::FormalParameterList(nullptr, sym(1).PatternElement); + sym(1).Node = node; + } break; + +#line 3568 "qmljs.g" + + case 488: { + AST::FormalParameterList *node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, sym(3).PatternElement); + sym(1).Node = node; + } break; + +#line 3578 "qmljs.g" + + case 490: { + ++functionNestingLevel; + } break; + +#line 3585 "qmljs.g" + + case 491: { + --functionNestingLevel; + } break; + +#line 3595 "qmljs.g" + case 493: Q_FALLTHROUGH(); +#line 3597 "qmljs.g" + + case 494: { + AST::ReturnStatement *ret = new (pool) AST::ReturnStatement(sym(4).Expression); + ret->returnToken = sym(4).Node->firstSourceLocation(); + ret->semicolonToken = sym(4).Node->lastSourceLocation(); + AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish(); + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringRef(), sym(1).FormalParameterList, statements); + f->isArrowFunction = true; + f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); + f->lbraceToken = sym(4).Node->firstSourceLocation(); + f->rbraceToken = sym(4).Node->lastSourceLocation(); + sym(1).Node = f; + } break; + +#line 3613 "qmljs.g" + case 495: Q_FALLTHROUGH(); +#line 3615 "qmljs.g" + + case 496: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringRef(), sym(1).FormalParameterList, sym(6).StatementList); + f->isArrowFunction = true; + f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); + f->lbraceToken = loc(6); + f->rbraceToken = loc(7); + sym(1).Node = f; + } break; + +#line 3627 "qmljs.g" + + case 497: { + AST::PatternElement *e = new (pool) AST::PatternElement(stringRef(1), nullptr, AST::PatternElement::Binding); + e->identifierToken = loc(1); + sym(1).FormalParameterList = (new (pool) AST::FormalParameterList(nullptr, e))->finish(pool); + } break; + +#line 3638 "qmljs.g" + + case 498: { + if (coverExpressionType != CE_FormalParameterList) { + AST::NestedExpression *ne = static_cast<AST::NestedExpression *>(sym(1).Node); + AST::FormalParameterList *list = ne->expression->reparseAsFormalParameterList(pool); + if (!list) { + syntaxError(loc(1), "Invalid Arrow parameter list."); + return false; + } + sym(1).Node = list->finish(pool); + } + } break; + +#line 3656 "qmljs.g" + + case 499: { + if (lookaheadToken(lexer) == T_LBRACE) + pushToken(T_FORCE_BLOCK); + } break; + +#line 3664 "qmljs.g" + + case 500: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(stringRef(1), sym(3).FormalParameterList, sym(6).StatementList); + f->functionToken = sym(1).PropertyName->firstSourceLocation(); + f->lparenToken = loc(2); + f->rparenToken = loc(4); + f->lbraceToken = loc(5); + f->rbraceToken = loc(7); + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, f); + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3679 "qmljs.g" + + case 501: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).StatementList); + f->functionToken = sym(2).PropertyName->firstSourceLocation(); + f->lparenToken = loc(3); + f->rparenToken = loc(5); + f->lbraceToken = loc(6); + f->rbraceToken = loc(8); + f->isGenerator = true; + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(2).PropertyName, f); + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3696 "qmljs.g" + + case 502: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(stringRef(2), nullptr, sym(6).StatementList); + f->functionToken = sym(2).PropertyName->firstSourceLocation(); + f->lparenToken = loc(3); + f->rparenToken = loc(4); + f->lbraceToken = loc(5); + f->rbraceToken = loc(7); + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(2).PropertyName, f, AST::PatternProperty::Getter); + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3711 "qmljs.g" + + case 503: { + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).StatementList); + f->functionToken = sym(2).PropertyName->firstSourceLocation(); + f->lparenToken = loc(3); + f->rparenToken = loc(5); + f->lbraceToken = loc(6); + f->rbraceToken = loc(8); + AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(2).PropertyName, f, AST::PatternProperty::Setter); + node->colonToken = loc(2); + sym(1).Node = node; + } break; + +#line 3727 "qmljs.g" + + case 504: { + AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(nullptr, sym(1).PatternElement))->finish(pool); + sym(1).Node = node; + } break; + +#line 3735 "qmljs.g" + + case 505: { + lexer->enterGeneratorBody(); + } break; + +#line 3742 "qmljs.g" + + case 506: { + --functionNestingLevel; + lexer->leaveGeneratorBody(); + } break; + +#line 3750 "qmljs.g" + + case 507: { + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(3), sym(5).FormalParameterList, sym(8).StatementList); + node->functionToken = loc(1); + node->identifierToken = loc(3); + node->lparenToken = loc(4); + node->rparenToken = loc(6); + node->lbraceToken = loc(7); + node->rbraceToken = loc(9); + node->isGenerator = true; + sym(1).Node = node; + } break; + +#line 3766 "qmljs.g" + + case 509: { + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(QStringRef(), sym(4).FormalParameterList, sym(7).StatementList); + node->functionToken = loc(1); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + node->lbraceToken = loc(6); + node->rbraceToken = loc(8); + node->isGenerator = true; + sym(1).Node = node; + } break; + +#line 3780 "qmljs.g" + + case 510: { + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(3), sym(5).FormalParameterList, sym(8).StatementList); + node->functionToken = loc(1); + if (!stringRef(3).isNull()) + node->identifierToken = loc(3); + node->lparenToken = loc(4); + node->rparenToken = loc(6); + node->lbraceToken = loc(7); + node->rbraceToken = loc(9); + node->isGenerator = true; + sym(1).Node = node; + } break; + +#line 3796 "qmljs.g" + + case 511: { + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(4).FormalParameterList, sym(7).StatementList); + node->functionToken = loc(1); + node->lparenToken = loc(3); + node->rparenToken = loc(5); + node->lbraceToken = loc(6); + node->rbraceToken = loc(8); + node->isGenerator = true; + sym(1).Node = node; + } break; + +#line 3812 "qmljs.g" + case 513: Q_FALLTHROUGH(); +#line 3814 "qmljs.g" + + case 514: { + AST::YieldExpression *node = new (pool) AST::YieldExpression(); + node->yieldToken = loc(1); + sym(1).Node = node; + } break; + +#line 3823 "qmljs.g" + case 515: Q_FALLTHROUGH(); +#line 3825 "qmljs.g" + + case 516: { + AST::YieldExpression *node = new (pool) AST::YieldExpression(sym(3).Expression); + node->yieldToken = loc(1); + node->isYieldStar = true; + sym(1).Node = node; + } break; + +#line 3835 "qmljs.g" + case 517: Q_FALLTHROUGH(); +#line 3837 "qmljs.g" + + case 518: { + AST::YieldExpression *node = new (pool) AST::YieldExpression(sym(2).Expression); + node->yieldToken = loc(1); + sym(1).Node = node; + } break; + +#line 3847 "qmljs.g" + + case 519: { + AST::ClassDeclaration *node = new (pool) AST::ClassDeclaration(stringRef(2), sym(3).Expression, sym(5).ClassElementList); + node->classToken = loc(1); + node->identifierToken = loc(2); + node->lbraceToken = loc(4); + node->rbraceToken = loc(6); + sym(1).Node = node; + } break; + +#line 3859 "qmljs.g" + + case 520: { + AST::ClassExpression *node = new (pool) AST::ClassExpression(stringRef(2), sym(3).Expression, sym(5).ClassElementList); + node->classToken = loc(1); + node->identifierToken = loc(2); + node->lbraceToken = loc(4); + node->rbraceToken = loc(6); + sym(1).Node = node; + } break; + +#line 3871 "qmljs.g" + + case 521: { + AST::ClassDeclaration *node = new (pool) AST::ClassDeclaration(QStringRef(), sym(2).Expression, sym(4).ClassElementList); + node->classToken = loc(1); + node->lbraceToken = loc(3); + node->rbraceToken = loc(5); + sym(1).Node = node; + } break; + +#line 3882 "qmljs.g" + + case 522: { + AST::ClassExpression *node = new (pool) AST::ClassExpression(QStringRef(), sym(2).Expression, sym(4).ClassElementList); + node->classToken = loc(1); + node->lbraceToken = loc(3); + node->rbraceToken = loc(5); + sym(1).Node = node; + } break; + +#line 3895 "qmljs.g" + + case 524: { + lexer->setStaticIsKeyword(true); + } break; + +#line 3902 "qmljs.g" + case 525: +#line 3904 "qmljs.g" + + case 526: { + lexer->setStaticIsKeyword(false); + } break; -case 285: { - sym(1).Node = new (pool) AST::StatementList(sym(1).Statement); -} break; +#line 3911 "qmljs.g" -case 286: { - sym(1).Node = new (pool) AST::StatementList(sym(1).StatementList, sym(2).Statement); -} break; + case 527: { + sym(1).Node = nullptr; + } break; + +#line 3918 "qmljs.g" -case 287: { - sym(1).Node = 0; -} break; + case 528: { + sym(1).Node = sym(2).Node; + } break; -case 288: { - sym(1).Node = sym(1).StatementList->finish (); -} break; +#line 3925 "qmljs.g" -case 290: { - AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope; - if (sym(1).ival == T_LET) - s = AST::VariableDeclaration::BlockScope; - else if (sym(1).ival == T_CONST) - s = AST::VariableDeclaration::ReadOnlyBlockScope; - - AST::VariableStatement *node = new (pool) AST::VariableStatement(sym(2).VariableDeclarationList->finish(s)); - node->declarationKindToken = loc(1); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case 529: { + sym(1).Node = nullptr; + } break; -case 291: { - sym(1).ival = T_LET; -} break; +#line 3932 "qmljs.g" -case 292: { - sym(1).ival = T_CONST; -} break; + case 530: { + if (sym(1).Node) + sym(1).Node = sym(1).ClassElementList->finish(); + } break; -case 293: { - sym(1).ival = T_VAR; -} break; +#line 3942 "qmljs.g" -case 294: { - sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); -} break; + case 532: { + if (sym(2).Node) + sym(1).ClassElementList = sym(1).ClassElementList->append(sym(2).ClassElementList); + } break; -case 295: { - AST::VariableDeclarationList *node = new (pool) AST::VariableDeclarationList( - sym(1).VariableDeclarationList, sym(3).VariableDeclaration); - node->commaToken = loc(2); - sym(1).Node = node; -} break; +#line 3950 "qmljs.g" -case 296: { - sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); -} break; + case 533: { + AST::ClassElementList *node = new (pool) AST::ClassElementList(sym(1).PatternProperty, false); + sym(1).Node = node; + } break; -case 297: { - sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).VariableDeclaration); -} break; +#line 3958 "qmljs.g" -case 298: { - AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope; - AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression, s); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case 534: { + lexer->setStaticIsKeyword(true); + AST::ClassElementList *node = new (pool) AST::ClassElementList(sym(2).PatternProperty, true); + sym(1).Node = node; + } break; -case 299: { - AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope; - AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression, s); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; +#line 3967 "qmljs.g" -case 300: { - // ### TODO: AST for initializer - sym(1) = sym(2); -} break; + case 535: { + sym(1).Node = nullptr; + } break; -case 301: { - sym(1).Node = 0; -} break; +#line 3976 "qmljs.g" -case 303: { - // ### TODO: AST for initializer - sym(1) = sym(2); -} break; + case 536: { + sym(1).Node = nullptr; + } break; -case 304: { - sym(1).Node = 0; -} break; +#line 3985 "qmljs.g" -case 306: { - AST::EmptyStatement *node = new (pool) AST::EmptyStatement(); - node->semicolonToken = loc(1); - sym(1).Node = node; -} break; + case 538: { + sym(1).Node = new (pool) AST::Program(sym(1).StatementList->finish()); + } break; -case 308: { - AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(sym(1).Expression); - node->semicolonToken = loc(2); - sym(1).Node = node; -} break; +#line 3992 "qmljs.g" + case 539: { + sym(1).Node = new (pool) AST::ESModule(sym(1).StatementList); + } break; -case 309: { - AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement, sym(7).Statement); - node->ifToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - node->elseToken = loc(6); - sym(1).Node = node; -} break; +#line 3998 "qmljs.g" -case 310: { - AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement); - node->ifToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case 540: { + sym(1).StatementList = sym(1).StatementList->finish(); + } break; -case 313: { - AST::DoWhileStatement *node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression); - node->doToken = loc(1); - node->whileToken = loc(3); - node->lparenToken = loc(4); - node->rparenToken = loc(6); - node->semicolonToken = loc(7); - sym(1).Node = node; -} break; +#line 4005 "qmljs.g" -case 314: { - AST::WhileStatement *node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement); - node->whileToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case 541: { + sym(1).StatementList = nullptr; + } break; -case 315: { - AST::ForStatement *node = new (pool) AST::ForStatement(sym(3).Expression, - sym(5).Expression, sym(7).Expression, sym(9).Statement); - node->forToken = loc(1); - node->lparenToken = loc(2); - node->firstSemicolonToken = loc(4); - node->secondSemicolonToken = loc(6); - node->rparenToken = loc(8); - sym(1).Node = node; -} break; +#line 4015 "qmljs.g" -case 316: { - AST::VariableDeclaration::VariableScope s = AST::VariableDeclaration::FunctionScope; - AST::LocalForStatement *node = new (pool) AST::LocalForStatement( - sym(4).VariableDeclarationList->finish(s), sym(6).Expression, - sym(8).Expression, sym(10).Statement); - node->forToken = loc(1); - node->lparenToken = loc(2); - node->varToken = loc(3); - node->firstSemicolonToken = loc(5); - node->secondSemicolonToken = loc(7); - node->rparenToken = loc(9); - sym(1).Node = node; -} break; + case 544: { + sym(1).StatementList = sym(1).StatementList->append(sym(2).StatementList); + } break; -case 317: { - AST:: ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).Expression, - sym(5).Expression, sym(7).Statement); - node->forToken = loc(1); - node->lparenToken = loc(2); - node->inToken = loc(4); - node->rparenToken = loc(6); - sym(1).Node = node; -} break; +#line 4022 "qmljs.g" + case 545: Q_FALLTHROUGH(); +#line 4024 "qmljs.g" + case 546: Q_FALLTHROUGH(); +#line 4026 "qmljs.g" + case 547: Q_FALLTHROUGH(); +#line 4028 "qmljs.g" -case 318: { - AST::LocalForEachStatement *node = new (pool) AST::LocalForEachStatement( - sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); - node->forToken = loc(1); - node->lparenToken = loc(2); - node->varToken = loc(3); - node->inToken = loc(5); - node->rparenToken = loc(7); - sym(1).Node = node; -} break; + case 548: { + sym(1).StatementList = new (pool) AST::StatementList(sym(1).Node); + } break; -case 320: { - AST::ContinueStatement *node = new (pool) AST::ContinueStatement(); - node->continueToken = loc(1); - node->semicolonToken = loc(2); - sym(1).Node = node; -} break; +#line 4037 "qmljs.g" -case 322: { - AST::ContinueStatement *node = new (pool) AST::ContinueStatement(stringRef(2)); - node->continueToken = loc(1); - node->identifierToken = loc(2); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case 550: { + auto decl = new (pool) AST::ImportDeclaration(sym(2).ImportClause, sym(3).FromClause); + decl->importToken = loc(1); + sym(1).Node = decl; + } break; -case 324: { - AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef()); - node->breakToken = loc(1); - node->semicolonToken = loc(2); - sym(1).Node = node; -} break; +#line 4045 "qmljs.g" -case 326: { - AST::BreakStatement *node = new (pool) AST::BreakStatement(stringRef(2)); - node->breakToken = loc(1); - node->identifierToken = loc(2); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case 551: { + auto decl = new (pool) AST::ImportDeclaration(stringRef(2)); + decl->importToken = loc(1); + decl->moduleSpecifierToken = loc(2); + sym(1).Node = decl; + } break; -case 328: { - AST::ReturnStatement *node = new (pool) AST::ReturnStatement(sym(2).Expression); - node->returnToken = loc(1); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; +#line 4055 "qmljs.g" -case 329: { - AST::WithStatement *node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement); - node->withToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; + case 552: { + auto clause = new (pool) AST::ImportClause(stringRef(1)); + clause->importedDefaultBindingToken = loc(1); + sym(1).ImportClause = clause; + } break; -case 330: { - AST::SwitchStatement *node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock); - node->switchToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; +#line 4063 "qmljs.g" -case 331: { - AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses); - node->lbraceToken = loc(1); - node->rbraceToken = loc(3); - sym(1).Node = node; -} break; + case 553: { + sym(1).ImportClause = new (pool) AST::ImportClause(sym(1).NameSpaceImport); + } break; -case 332: { - AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); - node->lbraceToken = loc(1); - node->rbraceToken = loc(5); - sym(1).Node = node; -} break; +#line 4069 "qmljs.g" -case 333: { - sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause); -} break; + case 554: { + sym(1).ImportClause = new (pool) AST::ImportClause(sym(1).NamedImports); + } break; -case 334: { - sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause); -} break; +#line 4075 "qmljs.g" -case 335: { - sym(1).Node = 0; -} break; + case 555: { + auto importClause = new (pool) AST::ImportClause(stringRef(1), sym(3).NameSpaceImport); + importClause->importedDefaultBindingToken = loc(1); + sym(1).ImportClause = importClause; + } break; -case 336: { - sym(1).Node = sym(1).CaseClauses->finish (); -} break; +#line 4083 "qmljs.g" -case 337: { - AST::CaseClause *node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList); - node->caseToken = loc(1); - node->colonToken = loc(3); - sym(1).Node = node; -} break; + case 556: { + auto importClause = new (pool) AST::ImportClause(stringRef(1), sym(3).NamedImports); + importClause->importedDefaultBindingToken = loc(1); + sym(1).ImportClause = importClause; + } break; -case 338: { - AST::DefaultClause *node = new (pool) AST::DefaultClause(sym(3).StatementList); - node->defaultToken = loc(1); - node->colonToken = loc(2); - sym(1).Node = node; -} break; +#line 4094 "qmljs.g" -case 339: { - AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); - node->identifierToken = loc(1); - node->colonToken = loc(2); - sym(1).Node = node; -} break; + case 558: { + auto import = new (pool) AST::NameSpaceImport(stringRef(3)); + import->starToken = loc(1); + import->importedBindingToken = loc(3); + sym(1).NameSpaceImport = import; + } break; + +#line 4104 "qmljs.g" -case 341: { - AST::ThrowStatement *node = new (pool) AST::ThrowStatement(sym(2).Expression); - node->throwToken = loc(1); - node->semicolonToken = loc(3); - sym(1).Node = node; -} break; + case 559: { + auto namedImports = new (pool) AST::NamedImports(); + namedImports->leftBraceToken = loc(1); + namedImports->rightBraceToken = loc(2); + sym(1).NamedImports = namedImports; + } break; + +#line 4113 "qmljs.g" + + case 560: { + auto namedImports = new (pool) AST::NamedImports(sym(2).ImportsList->finish()); + namedImports->leftBraceToken = loc(1); + namedImports->rightBraceToken = loc(3); + sym(1).NamedImports = namedImports; + } break; + +#line 4122 "qmljs.g" + + case 561: { + auto namedImports = new (pool) AST::NamedImports(sym(2).ImportsList->finish()); + namedImports->leftBraceToken = loc(1); + namedImports->rightBraceToken = loc(4); + sym(1).NamedImports = namedImports; + } break; + +#line 4132 "qmljs.g" + + case 562: { + auto clause = new (pool) AST::FromClause(stringRef(2)); + clause->fromToken = loc(1); + clause->moduleSpecifierToken = loc(2); + sym(1).FromClause = clause; + } break; + +#line 4142 "qmljs.g" + + case 563: { + auto importsList = new (pool) AST::ImportsList(sym(1).ImportSpecifier); + importsList->importSpecifierToken = loc(1); + sym(1).ImportsList = importsList; + } break; + +#line 4150 "qmljs.g" + + case 564: { + auto importsList = new (pool) AST::ImportsList(sym(1).ImportsList, sym(3).ImportSpecifier); + importsList->importSpecifierToken = loc(3); + sym(1).ImportsList = importsList; + } break; + +#line 4159 "qmljs.g" + + case 565: { + auto importSpecifier = new (pool) AST::ImportSpecifier(stringRef(1)); + importSpecifier->importedBindingToken = loc(1); + sym(1).ImportSpecifier = importSpecifier; + } break; + +#line 4167 "qmljs.g" + + case 566: { + auto importSpecifier = new (pool) AST::ImportSpecifier(stringRef(1), stringRef(3)); + importSpecifier->identifierToken = loc(1); + importSpecifier->importedBindingToken = loc(3); + sym(1).ImportSpecifier = importSpecifier; + } break; + +#line 4184 "qmljs.g" + + case 569: { + int token = lookaheadToken(lexer); + if (token == T_FUNCTION || token == T_CLASS) + pushToken(T_FORCE_DECLARATION); + } break; + +#line 4193 "qmljs.g" + + case 570: { + auto exportDeclaration = new (pool) AST::ExportDeclaration(sym(3).FromClause); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; + +#line 4201 "qmljs.g" + + case 571: { + auto exportDeclaration = new (pool) AST::ExportDeclaration(sym(2).ExportClause, sym(3).FromClause); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; + +#line 4209 "qmljs.g" + + case 572: { + auto exportDeclaration = new (pool) AST::ExportDeclaration(sym(2).ExportClause); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; + +#line 4217 "qmljs.g" + case 573: Q_FALLTHROUGH(); +#line 4219 "qmljs.g" + + case 574: { + auto exportDeclaration = new (pool) AST::ExportDeclaration(/*exportDefault=*/false, sym(2).Node); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; + +#line 4227 "qmljs.g" + + case 575: { + if (auto *f = AST::cast<AST::FunctionDeclaration*>(sym(5).Node)) { + if (f->name.isEmpty()) { + f->name = stringRef(2); + f->identifierToken = loc(2); + } + } + } Q_FALLTHROUGH(); -case 342: { - AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch); - node->tryToken = loc(1); - sym(1).Node = node; -} break; +#line 4238 "qmljs.g" -case 343: { - AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally); - node->tryToken = loc(1); - sym(1).Node = node; -} break; + case 576: { + // Emulate 15.2.3.11 + if (auto *cls = AST::cast<AST::ClassDeclaration*>(sym(5).Node)) { + if (cls->name.isEmpty()) { + cls->name = stringRef(2); + cls->identifierToken = loc(2); + } + } -case 344: { - AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally); - node->tryToken = loc(1); - sym(1).Node = node; -} break; + auto exportDeclaration = new (pool) AST::ExportDeclaration(/*exportDefault=*/true, sym(5).Node); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; -case 345: { - AST::Catch *node = new (pool) AST::Catch(stringRef(3), sym(5).Block); - node->catchToken = loc(1); - node->lparenToken = loc(2); - node->identifierToken = loc(3); - node->rparenToken = loc(4); - sym(1).Node = node; -} break; +#line 4254 "qmljs.g" -case 346: { - AST::Finally *node = new (pool) AST::Finally(sym(2).Block); - node->finallyToken = loc(1); - sym(1).Node = node; -} break; + case 577: { + // if lhs is an identifier expression and rhs is an anonymous function expression, we need to assign the name of lhs to the function + if (auto *f = asAnonymousFunctionDefinition(sym(4).Node)) { + f->name = stringRef(2); + } + if (auto *c = asAnonymousClassDefinition(sym(4).Expression)) { + c->name = stringRef(2); + } -case 348: { - AST::DebuggerStatement *node = new (pool) AST::DebuggerStatement(); - node->debuggerToken = loc(1); - node->semicolonToken = loc(2); - sym(1).Node = node; -} break; + auto exportDeclaration = new (pool) AST::ExportDeclaration(/*exportDefault=*/true, sym(4).Node); + exportDeclaration->exportToken = loc(1); + sym(1).ExportDeclaration = exportDeclaration; + } break; -case 350: { - AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); - node->functionToken = loc(1); - node->identifierToken = loc(2); - node->lparenToken = loc(3); - node->rparenToken = loc(5); - node->lbraceToken = loc(6); - node->rbraceToken = loc(8); - sym(1).Node = node; -} break; +#line 4271 "qmljs.g" -case 351: { - AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); - node->functionToken = loc(1); - if (! stringRef(2).isNull()) - node->identifierToken = loc(2); - node->lparenToken = loc(3); - node->rparenToken = loc(5); - node->lbraceToken = loc(6); - node->rbraceToken = loc(8); - sym(1).Node = node; -} break; + case 578: { + auto exportClause = new (pool) AST::ExportClause(); + exportClause->leftBraceToken = loc(1); + exportClause->rightBraceToken = loc(2); + sym(1).ExportClause = exportClause; + } break; -case 352: { - AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(3).FormalParameterList, sym(6).FunctionBody); - node->functionToken = loc(1); - node->lparenToken = loc(2); - node->rparenToken = loc(4); - node->lbraceToken = loc(5); - node->rbraceToken = loc(7); - sym(1).Node = node; -} break; +#line 4280 "qmljs.g" -case 353: { - AST::FormalParameterList *node = new (pool) AST::FormalParameterList(stringRef(1)); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; + case 579: { + auto exportClause = new (pool) AST::ExportClause(sym(2).ExportsList->finish()); + exportClause->leftBraceToken = loc(1); + exportClause->rightBraceToken = loc(3); + sym(1).ExportClause = exportClause; + } break; -case 354: { - AST::FormalParameterList *node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, stringRef(3)); - node->commaToken = loc(2); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; +#line 4289 "qmljs.g" -case 355: { - sym(1).Node = 0; -} break; + case 580: { + auto exportClause = new (pool) AST::ExportClause(sym(2).ExportsList->finish()); + exportClause->leftBraceToken = loc(1); + exportClause->rightBraceToken = loc(4); + sym(1).ExportClause = exportClause; + } break; -case 356: { - sym(1).Node = sym(1).FormalParameterList->finish (); -} break; +#line 4299 "qmljs.g" -case 357: { - sym(1).Node = 0; -} break; + case 581: { + sym(1).ExportsList = new (pool) AST::ExportsList(sym(1).ExportSpecifier); + } break; -case 359: { - sym(1).Node = new (pool) AST::FunctionBody(sym(1).SourceElements->finish ()); -} break; +#line 4305 "qmljs.g" -case 361: { - sym(1).Node = new (pool) AST::Program(sym(1).SourceElements->finish ()); -} break; + case 582: { + sym(1).ExportsList = new (pool) AST::ExportsList(sym(1).ExportsList, sym(3).ExportSpecifier); + } break; -case 362: { - sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElement); -} break; +#line 4312 "qmljs.g" -case 363: { - sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElements, sym(2).SourceElement); -} break; + case 583: { + auto exportSpecifier = new (pool) AST::ExportSpecifier(stringRef(1)); + exportSpecifier->identifierToken = loc(1); + sym(1).ExportSpecifier = exportSpecifier; + } break; -case 364: { - sym(1).Node = new (pool) AST::StatementSourceElement(sym(1).Statement); -} break; +#line 4320 "qmljs.g" -case 365: { - sym(1).Node = new (pool) AST::FunctionSourceElement(sym(1).FunctionDeclaration); -} break; + case 584: { + auto exportSpecifier = new (pool) AST::ExportSpecifier(stringRef(1), stringRef(3)); + exportSpecifier->identifierToken = loc(1); + exportSpecifier->exportedIdentifierToken = loc(3); + sym(1).ExportSpecifier = exportSpecifier; + } break; -case 366: { - sym(1).Node = 0; -} break; +#line 4331 "qmljs.g" + // ------------ end of switch statement } // switch action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT); } // if } while (action != 0); +#ifdef PARSER_DEBUG + qDebug() << "Done or error."; +#endif + if (first_token == last_token) { const int errorState = state_stack[tos]; // automatic insertion of `;' if (yytoken != -1 && ((t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken)) || t_action(errorState, T_COMPATIBILITY_SEMICOLON))) { +#ifdef PARSER_DEBUG + qDebug() << "Inserting automatic semicolon."; +#endif SavedToken &tk = token_buffer[0]; tk.token = yytoken; tk.dval = yylval; @@ -1965,8 +3423,7 @@ case 366: { for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || - tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION || - tk == T_FEED_JS_SOURCE_ELEMENT) + tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION) continue; int a = t_action(errorState, tk); diff --git a/src/libs/qmljs/parser/qmljsparser_p.h b/src/libs/qmljs/parser/qmljsparser_p.h index fdbc4c27ff..48478e32c5 100644 --- a/src/libs/qmljs/parser/qmljsparser_p.h +++ b/src/libs/qmljs/parser/qmljsparser_p.h @@ -1,10 +1,13 @@ + +#line 178 "qmljs.g" /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of Qt Creator. +** This file is part of the QtQml module of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -13,13 +16,26 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -70,30 +86,42 @@ public: union Value { int ival; double dval; + AST::VariableScope scope; + AST::ForEachType forEachType; AST::ArgumentList *ArgumentList; AST::CaseBlock *CaseBlock; AST::CaseClause *CaseClause; AST::CaseClauses *CaseClauses; AST::Catch *Catch; AST::DefaultClause *DefaultClause; - AST::ElementList *ElementList; AST::Elision *Elision; AST::ExpressionNode *Expression; + AST::TemplateLiteral *Template; AST::Finally *Finally; AST::FormalParameterList *FormalParameterList; - AST::FunctionBody *FunctionBody; AST::FunctionDeclaration *FunctionDeclaration; AST::Node *Node; AST::PropertyName *PropertyName; - AST::PropertyAssignment *PropertyAssignment; - AST::PropertyAssignmentList *PropertyAssignmentList; - AST::SourceElement *SourceElement; - AST::SourceElements *SourceElements; AST::Statement *Statement; AST::StatementList *StatementList; AST::Block *Block; - AST::VariableDeclaration *VariableDeclaration; AST::VariableDeclarationList *VariableDeclarationList; + AST::Pattern *Pattern; + AST::PatternElement *PatternElement; + AST::PatternElementList *PatternElementList; + AST::PatternProperty *PatternProperty; + AST::PatternPropertyList *PatternPropertyList; + AST::ClassElementList *ClassElementList; + AST::ImportClause *ImportClause; + AST::FromClause *FromClause; + AST::NameSpaceImport *NameSpaceImport; + AST::ImportsList *ImportsList; + AST::NamedImports *NamedImports; + AST::ImportSpecifier *ImportSpecifier; + AST::ExportSpecifier *ExportSpecifier; + AST::ExportsList *ExportsList; + AST::ExportClause *ExportClause; + AST::ExportDeclaration *ExportDeclaration; AST::UiProgram *UiProgram; AST::UiHeaderItemList *UiHeaderItemList; @@ -110,7 +138,6 @@ public: AST::UiObjectMemberList *UiObjectMemberList; AST::UiArrayMemberList *UiArrayMemberList; AST::UiQualifiedId *UiQualifiedId; - AST::UiQualifiedPragmaId *UiQualifiedPragmaId; AST::UiEnumMemberList *UiEnumMemberList; }; @@ -119,12 +146,13 @@ public: ~Parser(); // parse a UI program - bool parse() { return parse(T_FEED_UI_PROGRAM); } + bool parse() { ++functionNestingLevel; bool r = parse(T_FEED_UI_PROGRAM); --functionNestingLevel; return r; } bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } - bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } - bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } - bool parseProgram() { return parse(T_FEED_JS_PROGRAM); } + bool parseUiObjectMember() { ++functionNestingLevel; bool r = parse(T_FEED_UI_OBJECT_MEMBER); --functionNestingLevel; return r; } + bool parseProgram() { return parse(T_FEED_JS_SCRIPT); } + bool parseScript() { return parse(T_FEED_JS_SCRIPT); } + bool parseModule() { return parse(T_FEED_JS_MODULE); } AST::UiProgram *ast() const { return AST::cast<AST::UiProgram *>(program); } @@ -193,22 +221,31 @@ protected: { return location_stack [tos + index - 1]; } AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); - AST::UiQualifiedPragmaId *reparseAsQualifiedPragmaId(AST::ExpressionNode *expr); + + void pushToken(int token); + int lookaheadToken(Lexer *lexer); + + void syntaxError(const AST::SourceLocation &location, const char *message) { + diagnostic_messages.append(DiagnosticMessage(Severity::Error, location, QLatin1String(message))); + } + void syntaxError(const AST::SourceLocation &location, const QString &message) { + diagnostic_messages.append(DiagnosticMessage(Severity::Error, location, message)); + } protected: Engine *driver; MemoryPool *pool; - int tos; - int stack_size; - Value *sym_stack; - int *state_stack; - AST::SourceLocation *location_stack; - QStringRef *string_stack; + int tos = 0; + int stack_size = 0; + Value *sym_stack = nullptr; + int *state_stack = nullptr; + AST::SourceLocation *location_stack = nullptr; + QVector<QStringRef> string_stack; - AST::Node *program; + AST::Node *program = nullptr; - // error recovery - enum { TOKEN_BUFFER_SIZE = 3 }; + // error recovery and lookahead handling + enum { TOKEN_BUFFER_SIZE = 5 }; struct SavedToken { int token; @@ -217,14 +254,25 @@ protected: QStringRef spell; }; - double yylval; + int yytoken = -1; + double yylval = 0.; QStringRef yytokenspell; AST::SourceLocation yylloc; AST::SourceLocation yyprevlloc; SavedToken token_buffer[TOKEN_BUFFER_SIZE]; - SavedToken *first_token; - SavedToken *last_token; + SavedToken *first_token = nullptr; + SavedToken *last_token = nullptr; + + int functionNestingLevel = 0; + + enum CoverExpressionType { + CE_Invalid, + CE_ParenthesizedExpression, + CE_FormalParameterList + }; + AST::SourceLocation coverExpressionErrorLocation; + CoverExpressionType coverExpressionType = CE_Invalid; QList<DiagnosticMessage> diagnostic_messages; }; @@ -233,9 +281,27 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 96 +#line 1511 "qmljs.g" + +#define J_SCRIPT_REGEXPLITERAL_RULE1 128 + +#line 1523 "qmljs.g" + +#define J_SCRIPT_REGEXPLITERAL_RULE2 129 + +#line 3022 "qmljs.g" + +#define J_SCRIPT_EXPRESSIONSTATEMENTLOOKAHEAD_RULE 421 + +#line 3653 "qmljs.g" + +#define J_SCRIPT_CONCISEBODYLOOKAHEAD_RULE 499 + +#line 4181 "qmljs.g" + +#define J_SCRIPT_EXPORTDECLARATIONLOOKAHEAD_RULE 569 -#define J_SCRIPT_REGEXPLITERAL_RULE2 97 +#line 4469 "qmljs.g" QT_QML_END_NAMESPACE diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 92516dee2e..6b904da040 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -306,14 +306,14 @@ bool Bind::visit(UiArrayBinding *) return true; } -bool Bind::visit(VariableDeclaration *ast) +bool Bind::visit(PatternElement *ast) { - if (ast->name.isEmpty()) + if (ast->bindingIdentifier.isEmpty() || !ast->isVariableDeclaration()) return false; ASTVariableReference *ref = new ASTVariableReference(ast, _doc, &_valueOwner); if (_currentObjectValue) - _currentObjectValue->setMember(ast->name.toString(), ref); + _currentObjectValue->setMember(ast->bindingIdentifier, ref); return true; } @@ -337,8 +337,8 @@ bool Bind::visit(FunctionExpression *ast) // 1. Function formal arguments for (FormalParameterList *it = ast->formals; it; it = it->next) { - if (!it->name.isEmpty()) - functionScope->setMember(it->name.toString(), _valueOwner.unknownValue()); + if (!it->element->bindingIdentifier.isEmpty()) + functionScope->setMember(it->element->bindingIdentifier, _valueOwner.unknownValue()); } // 2. Functions defined inside the function body diff --git a/src/libs/qmljs/qmljsbind.h b/src/libs/qmljs/qmljsbind.h index e584abef7b..575c52db8d 100644 --- a/src/libs/qmljs/qmljsbind.h +++ b/src/libs/qmljs/qmljsbind.h @@ -79,7 +79,7 @@ protected: // QML/JS bool visit(AST::FunctionDeclaration *ast) override; bool visit(AST::FunctionExpression *ast) override; - bool visit(AST::VariableDeclaration *ast) override; + bool visit(AST::PatternElement *ast) override; ObjectValue *switchObjectValue(ObjectValue *newObjectValue); ObjectValue *bindObject(AST::UiQualifiedId *qualifiedTypeNameId, AST::UiObjectInitializer *initializer); diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index e4ff7047eb..2b081a92b6 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -197,10 +197,6 @@ protected: return true; if (Statement *stmt = ast->statementCast()) onUnreachable(stmt); - if (FunctionSourceElement *fun = cast<FunctionSourceElement *>(ast)) - onUnreachable(fun->declaration); - if (StatementSourceElement *stmt = cast<StatementSourceElement *>(ast)) - onUnreachable(stmt->statement); return false; } @@ -306,8 +302,6 @@ protected: bool visit(WhileStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); } bool visit(ForStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); } bool visit(ForEachStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); } - bool visit(LocalForStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); } - bool visit(LocalForEachStatement *ast) override { return preconditionLoopStatement(ast, ast->statement); } bool visit(DoWhileStatement *ast) override { @@ -367,8 +361,8 @@ public: { clear(); for (FormalParameterList *plist = function->formals; plist; plist = plist->next) { - if (!plist->name.isEmpty()) - _formalParameterNames += plist->name.toString(); + if (!plist->element->bindingIdentifier.isEmpty()) + _formalParameterNames += plist->element->bindingIdentifier.toString(); } Node::accept(function->body, this); @@ -418,11 +412,11 @@ protected: return true; } - bool visit(VariableDeclaration *ast) + bool visit(PatternElement *ast) { - if (ast->name.isEmpty()) + if (ast->bindingIdentifier.isEmpty() || !ast->isVariableDeclaration()) return true; - const QString &name = ast->name.toString(); + const QString &name = ast->bindingIdentifier.toString(); if (_formalParameterNames.contains(name)) addMessage(WarnAlreadyFormalParameter, ast->identifierToken, name); @@ -484,7 +478,7 @@ private: QList<Message> _messages; QStringList _formalParameterNames; - QHash<QString, VariableDeclaration *> _declaredVariables; + QHash<QString, PatternElement *> _declaredVariables; QHash<QString, FunctionDeclaration *> _declaredFunctions; QHash<QString, QList<SourceLocation> > _possiblyUndeclaredUses; bool _seenNonDeclarationStatement; @@ -1039,8 +1033,8 @@ bool Check::visit(UiArrayBinding *ast) bool Check::visit(UiPublicMember *ast) { if (ast->type == UiPublicMember::Property) { - if (ast->isValid()) { - const QStringRef typeName = ast->memberTypeName(); + if (ast->defaultToken.isValid() || ast->readonlyToken.isValid()) { + const QStringRef typeName = ast->memberType->name; if (!typeName.isEmpty() && typeName.at(0).isLower()) { const QString typeNameS = typeName.toString(); if (!isValidBuiltinPropertyType(typeNameS)) @@ -1277,8 +1271,6 @@ bool Check::visit(Block *ast) && !cast<Finally *>(p) && !cast<ForStatement *>(p) && !cast<ForEachStatement *>(p) - && !cast<LocalForStatement *>(p) - && !cast<LocalForEachStatement *>(p) && !cast<DoWhileStatement *>(p) && !cast<WhileStatement *>(p) && !cast<IfStatement *>(p) @@ -1311,8 +1303,7 @@ bool Check::visit(Expression *ast) { if (ast->left && ast->right) { Node *p = parent(); - if (!cast<ForStatement *>(p) - && !cast<LocalForStatement *>(p)) { + if (!cast<ForStatement *>(p)) { addMessage(WarnComma, ast->commaToken); } } @@ -1372,13 +1363,6 @@ bool Check::visit(ForStatement *ast) return true; } -bool Check::visit(LocalForStatement *ast) -{ - if (ast->condition) - checkAssignInCondition(ast->condition); - return true; -} - bool Check::visit(WhileStatement *ast) { if (ast->expression) diff --git a/src/libs/qmljs/qmljscheck.h b/src/libs/qmljs/qmljscheck.h index 810bdb8d26..f42de04a55 100644 --- a/src/libs/qmljs/qmljscheck.h +++ b/src/libs/qmljs/qmljscheck.h @@ -84,7 +84,6 @@ protected: bool visit(AST::ExpressionStatement *ast) override; bool visit(AST::IfStatement *ast) override; bool visit(AST::ForStatement *ast) override; - bool visit(AST::LocalForStatement *ast) override; bool visit(AST::WhileStatement *ast) override; bool visit(AST::DoWhileStatement *ast) override; bool visit(AST::CaseBlock *ast) override; diff --git a/src/libs/qmljs/qmljsdescribevalue.cpp b/src/libs/qmljs/qmljsdescribevalue.cpp index 268266ffcc..0a9ff68abe 100644 --- a/src/libs/qmljs/qmljsdescribevalue.cpp +++ b/src/libs/qmljs/qmljsdescribevalue.cpp @@ -366,11 +366,11 @@ void DescribeValueVisitor::visit(const Reference *value) } } else if (const ASTVariableReference *v = value->asAstVariableReference()) { basicDump("ASTVariableReference", v, printDetail); - const AST::VariableDeclaration *var = v->ast(); - if (printDetail && var) { + const AST::PatternElement *var = v->ast(); + if (printDetail && var && var->isVariableDeclaration()) { dumpNewline(); dump("variable:"); - dump(var->name.toString()); + dump(var->bindingIdentifier.toString()); } } else if (const QmlPrototypeReference *v = value->asQmlPrototypeReference()) { basicDump("QmlPrototypeReference", v, printDetail); diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index 0474fca121..a4551b1c1c 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -248,7 +248,7 @@ public: {} - void pragmaLibrary(int line, int column) override + void pragmaLibrary(int line, int column) { isLibrary = true; addLocation(line, column); @@ -305,12 +305,14 @@ bool Document::parse_helper(int startToken) case QmlJSGrammar::T_FEED_UI_PROGRAM: _parsedCorrectly = parser.parse(); break; - case QmlJSGrammar::T_FEED_JS_PROGRAM: + case QmlJSGrammar::T_FEED_JS_SCRIPT: + case QmlJSGrammar::T_FEED_JS_MODULE: _parsedCorrectly = parser.parseProgram(); for (const auto &d: directives.locations()) { _jsdirectives << d; } break; + case QmlJSGrammar::T_FEED_JS_EXPRESSION: _parsedCorrectly = parser.parseExpression(); break; @@ -341,7 +343,7 @@ bool Document::parseQml() bool Document::parseJavaScript() { - return parse_helper(QmlJSGrammar::T_FEED_JS_PROGRAM); + return parse_helper(QmlJSGrammar::T_FEED_JS_SCRIPT); } bool Document::parseExpression() diff --git a/src/libs/qmljs/qmljsevaluate.cpp b/src/libs/qmljs/qmljsevaluate.cpp index 26ba2e56b5..754113d199 100644 --- a/src/libs/qmljs/qmljsevaluate.cpp +++ b/src/libs/qmljs/qmljsevaluate.cpp @@ -126,11 +126,6 @@ bool Evaluate::visit(AST::UiHeaderItemList *) return false; } -bool Evaluate::visit(AST::UiQualifiedPragmaId *) -{ - return false; -} - bool Evaluate::visit(AST::UiPragma *) { return false; @@ -264,20 +259,20 @@ bool Evaluate::visit(AST::RegExpLiteral *) return false; } -bool Evaluate::visit(AST::ArrayLiteral *) +bool Evaluate::visit(AST::ArrayPattern *) { _result = _valueOwner->arrayCtor()->returnValue(); return false; } -bool Evaluate::visit(AST::ObjectLiteral *) +bool Evaluate::visit(AST::ObjectPattern *) { // ### properties _result = _valueOwner->newObject(); return false; } -bool Evaluate::visit(AST::ElementList *) +bool Evaluate::visit(AST::PatternElementList *) { return false; } @@ -287,17 +282,12 @@ bool Evaluate::visit(AST::Elision *) return false; } -bool Evaluate::visit(AST::PropertyAssignmentList *) +bool Evaluate::visit(AST::PatternPropertyList *) { return false; } -bool Evaluate::visit(AST::PropertyGetterSetter *) -{ - return false; -} - -bool Evaluate::visit(AST::PropertyNameAndValue *) +bool Evaluate::visit(AST::PatternProperty *) { return false; } @@ -529,11 +519,6 @@ bool Evaluate::visit(AST::Block *) return false; } -bool Evaluate::visit(AST::StatementList *) -{ - return false; -} - bool Evaluate::visit(AST::VariableStatement *) { return false; @@ -544,7 +529,7 @@ bool Evaluate::visit(AST::VariableDeclarationList *) return false; } -bool Evaluate::visit(AST::VariableDeclaration *) +bool Evaluate::visit(AST::PatternElement *) { return false; } @@ -579,21 +564,11 @@ bool Evaluate::visit(AST::ForStatement *) return false; } -bool Evaluate::visit(AST::LocalForStatement *) -{ - return false; -} - bool Evaluate::visit(AST::ForEachStatement *) { return false; } -bool Evaluate::visit(AST::LocalForEachStatement *) -{ - return false; -} - bool Evaluate::visit(AST::ContinueStatement *) { return false; @@ -679,27 +654,12 @@ bool Evaluate::visit(AST::FormalParameterList *) return false; } -bool Evaluate::visit(AST::FunctionBody *) -{ - return false; -} - bool Evaluate::visit(AST::Program *) { return false; } -bool Evaluate::visit(AST::SourceElements *) -{ - return false; -} - -bool Evaluate::visit(AST::FunctionSourceElement *) -{ - return false; -} - -bool Evaluate::visit(AST::StatementSourceElement *) +bool Evaluate::visit(AST::StatementList *) { return false; } diff --git a/src/libs/qmljs/qmljsevaluate.h b/src/libs/qmljs/qmljsevaluate.h index 0246bc453a..7e3a218415 100644 --- a/src/libs/qmljs/qmljsevaluate.h +++ b/src/libs/qmljs/qmljsevaluate.h @@ -61,7 +61,6 @@ protected: // Ui bool visit(AST::UiProgram *ast) override; bool visit(AST::UiHeaderItemList *ast) override; - bool visit(AST::UiQualifiedPragmaId *ast) override; bool visit(AST::UiPragma *ast) override; bool visit(AST::UiImport *ast) override; bool visit(AST::UiPublicMember *ast) override; @@ -84,13 +83,12 @@ protected: bool visit(AST::StringLiteral *ast) override; bool visit(AST::NumericLiteral *ast) override; bool visit(AST::RegExpLiteral *ast) override; - bool visit(AST::ArrayLiteral *ast) override; - bool visit(AST::ObjectLiteral *ast) override; - bool visit(AST::ElementList *ast) override; + bool visit(AST::ArrayPattern *ast) override; + bool visit(AST::ObjectPattern *ast) override; bool visit(AST::Elision *ast) override; - bool visit(AST::PropertyAssignmentList *ast) override; - bool visit(AST::PropertyGetterSetter *ast) override; - bool visit(AST::PropertyNameAndValue *ast) override; + bool visit(AST::PatternElementList *ast) override; + bool visit(AST::PatternPropertyList *ast) override; + bool visit(AST::PatternProperty *ast) override; bool visit(AST::NestedExpression *ast) override; bool visit(AST::IdentifierPropertyName *ast) override; bool visit(AST::StringLiteralPropertyName *ast) override; @@ -116,19 +114,16 @@ protected: bool visit(AST::ConditionalExpression *ast) override; bool visit(AST::Expression *ast) override; bool visit(AST::Block *ast) override; - bool visit(AST::StatementList *ast) override; bool visit(AST::VariableStatement *ast) override; bool visit(AST::VariableDeclarationList *ast) override; - bool visit(AST::VariableDeclaration *ast) override; + bool visit(AST::PatternElement *ast) override; bool visit(AST::EmptyStatement *ast) override; bool visit(AST::ExpressionStatement *ast) override; bool visit(AST::IfStatement *ast) override; bool visit(AST::DoWhileStatement *ast) override; bool visit(AST::WhileStatement *ast) override; bool visit(AST::ForStatement *ast) override; - bool visit(AST::LocalForStatement *ast) override; bool visit(AST::ForEachStatement *ast) override; - bool visit(AST::LocalForEachStatement *ast) override; bool visit(AST::ContinueStatement *ast) override; bool visit(AST::BreakStatement *ast) override; bool visit(AST::ReturnStatement *ast) override; @@ -146,11 +141,8 @@ protected: bool visit(AST::FunctionDeclaration *ast) override; bool visit(AST::FunctionExpression *ast) override; bool visit(AST::FormalParameterList *ast) override; - bool visit(AST::FunctionBody *ast) override; bool visit(AST::Program *ast) override; - bool visit(AST::SourceElements *ast) override; - bool visit(AST::FunctionSourceElement *ast) override; - bool visit(AST::StatementSourceElement *ast) override; + bool visit(AST::StatementList *ast) override; bool visit(AST::DebuggerStatement *ast) override; private: diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index d8df6ed570..e8ac4c162b 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -1052,6 +1052,11 @@ void ObjectValue::setMember(const QString &name, const Value *value) m_members[name].value = value; } +void ObjectValue::setMember(const QStringRef &name, const Value *value) +{ + m_members[name.toString()].value = value; +} + void ObjectValue::setPropertyInfo(const QString &name, const PropertyInfo &propertyInfo) { m_members[name].propertyInfo = propertyInfo; @@ -1856,7 +1861,7 @@ ASTObjectValue::ASTObjectValue(UiQualifiedId *typeName, for (UiObjectMemberList *it = m_initializer->members; it; it = it->next) { UiObjectMember *member = it->member; if (UiPublicMember *def = cast<UiPublicMember *>(member)) { - if (def->type == UiPublicMember::Property && !def->name.isEmpty() && def->isValid()) { + if (def->type == UiPublicMember::Property && !def->name.isEmpty()) { ASTPropertyReference *ref = new ASTPropertyReference(def, m_doc, valueOwner); m_properties.append(ref); if (def->defaultToken.isValid()) @@ -1931,7 +1936,7 @@ const Document *ASTObjectValue::document() const return m_doc; } -ASTVariableReference::ASTVariableReference(VariableDeclaration *ast, const Document *doc, ValueOwner *valueOwner) +ASTVariableReference::ASTVariableReference(PatternElement *ast, const Document *doc, ValueOwner *valueOwner) : Reference(valueOwner) , m_ast(ast) , m_doc(doc) @@ -1947,7 +1952,7 @@ const ASTVariableReference *ASTVariableReference::asAstVariableReference() const return this; } -const VariableDeclaration *ASTVariableReference::ast() const +const PatternElement *ASTVariableReference::ast() const { return m_ast; } @@ -1955,16 +1960,16 @@ const VariableDeclaration *ASTVariableReference::ast() const const Value *ASTVariableReference::value(ReferenceContext *referenceContext) const { // may be assigned to later - if (!m_ast->expression) + if (!m_ast->expressionCast()) return valueOwner()->unknownValue(); Document::Ptr doc = m_doc->ptr(); ScopeChain scopeChain(doc, referenceContext->context()); ScopeBuilder builder(&scopeChain); - builder.push(ScopeAstPath(doc)(m_ast->expression->firstSourceLocation().begin())); + builder.push(ScopeAstPath(doc)(m_ast->expressionCast()->firstSourceLocation().begin())); Evaluate evaluator(&scopeChain, referenceContext); - return evaluator(m_ast->expression); + return evaluator(m_ast->expressionCast()); } bool ASTVariableReference::getSourceLocation(QString *fileName, int *line, int *column) const @@ -1981,12 +1986,12 @@ class UsesArgumentsArray : protected Visitor bool m_usesArgumentsArray; public: - bool operator()(FunctionBody *ast) + bool operator()(StatementList *ast) { - if (!ast || !ast->elements) + if (!ast) return false; m_usesArgumentsArray = false; - Node::accept(ast->elements, this); + Node::accept(ast, this); return m_usesArgumentsArray; } @@ -2001,7 +2006,8 @@ protected: } // don't go into nested functions - bool visit(FunctionBody *) { return false; } + bool visit(Program *) { return false; } + bool visit(StatementList *) { return false; } }; } // anonymous namespace @@ -2013,7 +2019,7 @@ ASTFunctionValue::ASTFunctionValue(FunctionExpression *ast, const Document *doc, setPrototype(valueOwner->functionPrototype()); for (FormalParameterList *it = ast->formals; it; it = it->next) - m_argumentNames.append(it->name.toString()); + m_argumentNames.append(it->element->bindingIdentifier.toString()); m_isVariadic = UsesArgumentsArray()(ast->body); } @@ -2121,10 +2127,9 @@ bool ASTPropertyReference::getSourceLocation(QString *fileName, int *line, int * const Value *ASTPropertyReference::value(ReferenceContext *referenceContext) const { if (m_ast->statement - && (!m_ast->isValid() - || m_ast->memberTypeName() == QLatin1String("variant") - || m_ast->memberTypeName() == QLatin1String("var") - || m_ast->memberTypeName() == QLatin1String("alias"))) { + && (m_ast->memberType->name == QLatin1String("variant") + || m_ast->memberType->name == QLatin1String("var") + || m_ast->memberType->name == QLatin1String("alias"))) { // Adjust the context for the current location - expensive! // ### Improve efficiency by caching the 'use chain' constructed in ScopeBuilder. @@ -2140,7 +2145,7 @@ const Value *ASTPropertyReference::value(ReferenceContext *referenceContext) con return evaluator(m_ast->statement); } - const QString memberType = m_ast->memberTypeName().toString(); + const QString memberType = m_ast->memberType->name.toString(); const Value *builtin = valueOwner()->defaultValueForBuiltinType(memberType); if (!builtin->asUndefinedValue()) diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index fd38b68aba..9da1aa8635 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -508,6 +508,7 @@ public: virtual void processMembers(MemberProcessor *processor) const; virtual void setMember(const QString &name, const Value *value); + virtual void setMember(const QStringRef &name, const Value *value); virtual void setPropertyInfo(const QString &name, const PropertyInfo &propertyInfo); virtual void removeMember(const QString &name); @@ -884,14 +885,14 @@ private: class QMLJS_EXPORT ASTVariableReference: public Reference { - AST::VariableDeclaration *m_ast; + AST::PatternElement *m_ast; const Document *m_doc; public: - ASTVariableReference(AST::VariableDeclaration *ast, const Document *doc, ValueOwner *valueOwner); + ASTVariableReference(AST::PatternElement *ast, const Document *doc, ValueOwner *valueOwner); ~ASTVariableReference(); const ASTVariableReference *asAstVariableReference() const override; - const AST::VariableDeclaration *ast() const; + const AST::PatternElement *ast() const; private: const Value *value(ReferenceContext *referenceContext) const override; bool getSourceLocation(QString *fileName, int *line, int *column) const override; diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index 7744bfa971..ae26ba1d90 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -531,7 +531,6 @@ protected: bool visit(UiPragma *ast) override { out("pragma ", ast->pragmaToken); - accept(ast->pragmaType); return false; } @@ -666,20 +665,16 @@ protected: bool visit(NumericLiteral *ast) override { out(ast->literalToken); return true; } bool visit(RegExpLiteral *ast) override { out(ast->literalToken); return true; } - bool visit(ArrayLiteral *ast) override + bool visit(ArrayPattern *ast) override { out(ast->lbracketToken); if (ast->elements) accept(ast->elements); - if (ast->elements && ast->elision) - out(", ", ast->commaToken); - if (ast->elision) - accept(ast->elision); out(ast->rbracketToken); return false; } - bool visit(ObjectLiteral *ast) override + bool visit(ObjectPattern *ast) override { out(ast->lbraceToken); lnAcceptIndented(ast->properties); @@ -688,55 +683,57 @@ protected: return false; } - bool visit(ElementList *ast) override + bool visit(PatternElementList *ast) override { - for (ElementList *it = ast; it; it = it->next) { + for (PatternElementList *it = ast; it; it = it->next) { if (it->elision) accept(it->elision); - if (it->elision && it->expression) + if (it->elision && it->element) out(", "); - if (it->expression) - accept(it->expression); + if (it->element) + accept(it->element); if (it->next) - out(", ", ast->commaToken); + out(", "); } return false; } - bool visit(PropertyAssignmentList *ast) override + bool visit(PatternPropertyList *ast) override { - for (PropertyAssignmentList *it = ast; it; it = it->next) { - PropertyNameAndValue *assignment = AST::cast<PropertyNameAndValue *>(it->assignment); + for (PatternPropertyList *it = ast; it; it = it->next) { + PatternProperty *assignment = AST::cast<PatternProperty *>(it->property); if (assignment) { out("\""); accept(assignment->name); out("\""); out(": ", assignment->colonToken); - accept(assignment->value); + accept(assignment->initializer); if (it->next) { - out(",", ast->commaToken); // always invalid? + out(","); // always invalid? newLine(); } continue; } - PropertyGetterSetter *getterSetter = AST::cast<PropertyGetterSetter *>(it->assignment); - if (getterSetter) { - switch (getterSetter->type) { - case PropertyGetterSetter::Getter: + PatternPropertyList *getterSetter = AST::cast<PatternPropertyList *>(it->next); + if (getterSetter->property) { + switch (getterSetter->property->type) { + case PatternElement::Getter: out("get"); break; - case PropertyGetterSetter::Setter: + case PatternElement::Setter: out("set"); break; + default: + break; } - accept(getterSetter->name); - out("(", getterSetter->lparenToken); - accept(getterSetter->formals); - out("(", getterSetter->rparenToken); - out(" {", getterSetter->lbraceToken); - accept(getterSetter->functionBody); - out(" }", getterSetter->rbraceToken); + accept(getterSetter->property->name); + out("("); + //accept(getterSetter->formals); // TODO + out(")"); + out(" {"); + //accept(getterSetter->functionBody); // TODO + out(" }"); } } return false; @@ -922,12 +919,15 @@ protected: return false; } - bool visit(VariableDeclaration *ast) override + bool visit(PatternElement *ast) override { + if (!ast->isVariableDeclaration()) + return false; + out(ast->identifierToken); - if (ast->expression) { + if (ast->initializer) { out(" = "); - accept(ast->expression); + accept(ast->initializer); } return false; } @@ -996,45 +996,13 @@ protected: return false; } - bool visit(LocalForStatement *ast) override - { - out(ast->forToken); - out(" "); - out(ast->lparenToken); - out(ast->varToken); - out(" "); - accept(ast->declarations); - out("; ", ast->firstSemicolonToken); - accept(ast->condition); - out("; ", ast->secondSemicolonToken); - accept(ast->expression); - out(")", ast->rparenToken); - acceptBlockOrIndented(ast->statement); - return false; - } - bool visit(ForEachStatement *ast) override { out(ast->forToken); out(" "); out(ast->lparenToken); - accept(ast->initialiser); - out(" in ", ast->inToken); - accept(ast->expression); - out(ast->rparenToken); - acceptBlockOrIndented(ast->statement); - return false; - } - - bool visit(LocalForEachStatement *ast) override - { - out(ast->forToken); - out(" "); - out(ast->lparenToken); - out(ast->varToken); - out(" "); - accept(ast->declaration); - out(" in ", ast->inToken); + accept(ast->lhs); + out(" in "); accept(ast->expression); out(ast->rparenToken); acceptBlockOrIndented(ast->statement); @@ -1245,12 +1213,6 @@ protected: return false; } - bool visit(UiQualifiedPragmaId *ast) override - { - out(ast->identifierToken); - return false; - } - bool visit(Elision *ast) override { for (Elision *it = ast; it; it = it->next) { @@ -1288,16 +1250,6 @@ protected: return false; } - bool visit(SourceElements *ast) override - { - for (SourceElements *it = ast; it; it = it->next) { - accept(it->element); - if (it->next) - newLine(); - } - return false; - } - bool visit(VariableDeclarationList *ast) override { for (VariableDeclarationList *it = ast; it; it = it->next) { @@ -1321,9 +1273,7 @@ protected: bool visit(FormalParameterList *ast) override { for (FormalParameterList *it = ast; it; it = it->next) { - if (it->commaToken.isValid()) - out(", ", it->commaToken); - out(it->identifierToken); + out(it->element->bindingIdentifier.toString()); // TODO } return false; } diff --git a/src/libs/qmljs/qmljssimplereader.cpp b/src/libs/qmljs/qmljssimplereader.cpp index bc67bf8f62..247e92d58a 100644 --- a/src/libs/qmljs/qmljssimplereader.cpp +++ b/src/libs/qmljs/qmljssimplereader.cpp @@ -250,12 +250,12 @@ QVariant SimpleAbstractStreamReader::parsePropertyExpression(AST::ExpressionNode { Q_ASSERT(expressionNode); - AST::ArrayLiteral *arrayLiteral = AST::cast<AST::ArrayLiteral *>(expressionNode); + AST::ArrayPattern *arrayLiteral = AST::cast<AST::ArrayPattern *>(expressionNode); if (arrayLiteral) { QList<QVariant> variantList; - for (AST::ElementList *it = arrayLiteral->elements; it; it = it->next) - variantList << parsePropertyExpression(it->expression); + for (AST::PatternElementList *it = arrayLiteral->elements; it; it = it->next) + variantList << parsePropertyExpression(it->element->initializer); return variantList; } diff --git a/src/libs/qmljs/qmljstypedescriptionreader.cpp b/src/libs/qmljs/qmljstypedescriptionreader.cpp index 8c90b416d7..1cf16eaa07 100644 --- a/src/libs/qmljs/qmljstypedescriptionreader.cpp +++ b/src/libs/qmljs/qmljstypedescriptionreader.cpp @@ -189,13 +189,14 @@ void TypeDescriptionReader::readDependencies(UiScriptBinding *ast) addError(ast->statement->firstSourceLocation(), tr("Expected dependency definitions")); return; } - ArrayLiteral *exp = AST::cast<ArrayLiteral *>(stmt->expression); + ArrayPattern *exp = AST::cast<ArrayPattern *>(stmt->expression); if (!exp) { addError(stmt->expression->firstSourceLocation(), tr("Expected dependency definitions")); return; } - for (ElementList *l = exp->elements; l; l = l->next) { - StringLiteral *str = AST::cast<StringLiteral *>(l->expression); + for (PatternElementList *l = exp->elements; l; l = l->next) { + //StringLiteral *str = AST::cast<StringLiteral *>(l->element->initializer); + StringLiteral *str = AST::cast<StringLiteral *>(l->element->initializer); *_dependencies << str->value.toString(); } } @@ -231,7 +232,7 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast) } else if (name == QLatin1String("exports")) { readExports(script, fmo); } else if (name == QLatin1String("exportMetaObjectRevisions")) { - readMetaObjectRevisions(script, fmo); + //readMetaObjectRevisions(script, fmo); } else if (name == QLatin1String("attachedType")) { fmo->setAttachedTypeName(readStringBinding(script)); } else if (name == QLatin1String("isSingleton")) { @@ -562,14 +563,14 @@ void TypeDescriptionReader::readExports(UiScriptBinding *ast, FakeMetaObject::Pt return; } - ArrayLiteral *arrayLit = AST::cast<ArrayLiteral *>(expStmt->expression); + ArrayPattern *arrayLit = AST::cast<ArrayPattern *>(expStmt->expression); if (!arrayLit) { addError(expStmt->firstSourceLocation(), tr("Expected array of strings after colon.")); return; } - for (ElementList *it = arrayLit->elements; it; it = it->next) { - StringLiteral *stringLit = AST::cast<StringLiteral *>(it->expression); + for (PatternElementList *it = arrayLit->elements; it; it = it->next) { + StringLiteral *stringLit = AST::cast<StringLiteral *>(it->element->initializer); if (!stringLit) { addError(arrayLit->firstSourceLocation(), tr("Expected array literal with only string literal members.")); return; @@ -608,7 +609,7 @@ void TypeDescriptionReader::readMetaObjectRevisions(UiScriptBinding *ast, FakeMe return; } - ArrayLiteral *arrayLit = AST::cast<ArrayLiteral *>(expStmt->expression); + ArrayPattern *arrayLit = AST::cast<ArrayPattern *>(expStmt->expression); if (!arrayLit) { addError(expStmt->firstSourceLocation(), tr("Expected array of numbers after colon.")); return; @@ -616,8 +617,8 @@ void TypeDescriptionReader::readMetaObjectRevisions(UiScriptBinding *ast, FakeMe int exportIndex = 0; const int exportCount = fmo->exports().size(); - for (ElementList *it = arrayLit->elements; it; it = it->next, ++exportIndex) { - NumericLiteral *numberLit = cast<NumericLiteral *>(it->expression); + for (PatternElementList *it = arrayLit->elements; it; it = it->next, ++exportIndex) { + NumericLiteral *numberLit = cast<NumericLiteral *>(it->element->initializer); if (!numberLit) { addError(arrayLit->firstSourceLocation(), tr("Expected array literal with only number literal members.")); return; @@ -654,18 +655,18 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt return; } - ObjectLiteral *objectLit = AST::cast<ObjectLiteral *>(expStmt->expression); + ObjectPattern *objectLit = AST::cast<ObjectPattern *>(expStmt->expression); if (!objectLit) { addError(expStmt->firstSourceLocation(), tr("Expected object literal after colon.")); return; } - for (PropertyAssignmentList *it = objectLit->properties; it; it = it->next) { - PropertyNameAndValue *assignement = AST::cast<PropertyNameAndValue *>(it->assignment); + for (PatternPropertyList *it = objectLit->properties; it; it = it->next) { + PatternProperty *assignement = AST::cast<PatternProperty *>(it->property); if (assignement) { StringLiteralPropertyName *propName = AST::cast<StringLiteralPropertyName *>(assignement->name); - NumericLiteral *value = AST::cast<NumericLiteral *>(assignement->value); - UnaryMinusExpression *minus = AST::cast<UnaryMinusExpression *>(assignement->value); + NumericLiteral *value = AST::cast<NumericLiteral *>(assignement->initializer); + UnaryMinusExpression *minus = AST::cast<UnaryMinusExpression *>(assignement->initializer); if (minus) value = AST::cast<NumericLiteral *>(minus->expression); if (!propName || !value) { @@ -679,7 +680,7 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt fme->addKey(propName->id.toString(), v); continue; } - PropertyGetterSetter *getterSetter = AST::cast<PropertyGetterSetter *>(it->assignment); + PatternPropertyList *getterSetter = AST::cast<PatternPropertyList *>(it->next); if (getterSetter) addError(objectLit->firstSourceLocation(), tr("Enum should not contain getter and setters, but only 'string: number' elements.")); } diff --git a/src/plugins/debugger/qml/interactiveinterpreter.cpp b/src/plugins/debugger/qml/interactiveinterpreter.cpp index 3f1bb02230..9f82b09360 100644 --- a/src/plugins/debugger/qml/interactiveinterpreter.cpp +++ b/src/plugins/debugger/qml/interactiveinterpreter.cpp @@ -35,7 +35,8 @@ bool InteractiveInterpreter::canEvaluate() int yytos = -1; setCode(m_code, 1); - m_tokens.append(T_FEED_JS_PROGRAM); + m_tokens.append(T_FEED_JS_SCRIPT); + m_tokens.append(T_FEED_JS_MODULE); do { if (++yytos == m_stateStack.size()) diff --git a/src/plugins/debugger/qml/qmlengineutils.cpp b/src/plugins/debugger/qml/qmlengineutils.cpp index 0ef1bf07e5..042df6b6a6 100644 --- a/src/plugins/debugger/qml/qmlengineutils.cpp +++ b/src/plugins/debugger/qml/qmlengineutils.cpp @@ -160,15 +160,12 @@ public: bool visit(VariableStatement *ast) override { test(ast); return true; } bool visit(VariableDeclarationList *ast) override { test(ast); return true; } - bool visit(VariableDeclaration *ast) override { test(ast); return true; } bool visit(ExpressionStatement *ast) override { test(ast); return true; } bool visit(IfStatement *ast) override { test(ast); return true; } bool visit(DoWhileStatement *ast) override { test(ast); return true; } bool visit(WhileStatement *ast) override { test(ast); return true; } bool visit(ForStatement *ast) override { test(ast); return true; } - bool visit(LocalForStatement *ast) override { test(ast); return true; } bool visit(ForEachStatement *ast) override { test(ast); return true; } - bool visit(LocalForEachStatement *ast) override { test(ast); return true; } bool visit(ContinueStatement *ast) override { test(ast); return true; } bool visit(BreakStatement *ast) override { test(ast); return true; } bool visit(ReturnStatement *ast) override { test(ast); return true; } diff --git a/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp b/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp index a3a33f0140..8a935970c0 100644 --- a/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp +++ b/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp @@ -84,7 +84,7 @@ protected: bool visit(AST::UiPublicMember *node) override { - if (node->memberTypeName() == m_typeName){ + if (node->memberType->name == m_typeName){ const ObjectValue * objectValue = m_context->lookupType(m_document.data(), QStringList(m_typeName)); if (objectValue == m_typeValue) m_implemenations.append(node->typeToken); @@ -187,9 +187,10 @@ protected: return false; } - bool visit(AST::VariableDeclaration *node) override + bool visit(AST::PatternElement *node) override { - AST::Node::accept(node->expression, this); + if (node->isVariableDeclaration()) + AST::Node::accept(node->initializer, this); return false; } diff --git a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp index 70e2f8463e..7c0688ba9a 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp @@ -81,6 +81,7 @@ void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializ QmlJS::AST::UiObjectMemberList *insertAfter = searchMemberToInsertAfter(initializer->members, m_name, m_propertyOrder); QmlJS::AST::SourceLocation endOfPreviousMember; QmlJS::AST::SourceLocation startOfNextMember; + bool previousMemberSemicolon = false; unsigned depth; if (insertAfter == nullptr || insertAfter->member == nullptr) { @@ -96,6 +97,16 @@ void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializ } else { endOfPreviousMember = insertAfter->member->lastSourceLocation(); + // Find out if the previous members ends with semicolon. + if (auto member = QmlJS::AST::cast<QmlJS::AST::UiScriptBinding*>(insertAfter->member)) { + if (auto stmt = QmlJS::AST::cast<QmlJS::AST::ExpressionStatement*>(member->statement)) + previousMemberSemicolon = stmt->semicolonToken.isValid(); + else + previousMemberSemicolon = endOfPreviousMember.isValid(); + } else { + previousMemberSemicolon = endOfPreviousMember.isValid(); + } + if (insertAfter->next && insertAfter->next->member) startOfNextMember = insertAfter->next->member->firstSourceLocation(); else @@ -113,7 +124,7 @@ void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializ needsTrailingSemicolon = m_propertyType == QmlRefactoring::ScriptBinding; } } else { // we're inserting after a member, not after the lbrace - if (endOfPreviousMember.isValid()) { // there already is a semicolon after the previous member + if (previousMemberSemicolon) { if (insertAfter->next && insertAfter->next->member) { // and the after us there is a member, not an rbrace, so: needsTrailingSemicolon = m_propertyType == QmlRefactoring::ScriptBinding; } diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index f92358efc9..1f977a8199 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -85,8 +85,8 @@ static TypeName resolveTypeName(const ASTPropertyReference *ref, const ContextPt { TypeName type = "unknown"; - if (ref->ast()->isValid()) { - type = ref->ast()->memberTypeName().toUtf8(); + if (ref->ast()->defaultToken.isValid()) { + type = ref->ast()->memberType->name.toUtf8(); if (type == "alias") { const Value *value = context->lookupReference(ref); diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 125c6d12bd..3ed93bb4d7 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -1178,9 +1178,6 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, if (property->type == AST::UiPublicMember::Signal) continue; // QML designer doesn't support this yet. - if (property->name.isEmpty() || !property->isValid()) - continue; // better safe than sorry. - const QStringRef astName = property->name; QString astValue; if (property->statement) @@ -1193,7 +1190,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, astValue = astValue.left(astValue.length() - 1); astValue = astValue.trimmed(); - const TypeName &astType = property->memberTypeName().toUtf8(); + const TypeName &astType = property->memberType->name.toUtf8(); AbstractProperty modelProperty = modelNode.property(astName.toUtf8()); if (property->binding) { @@ -1250,12 +1247,12 @@ static QVariant parsePropertyExpression(AST::ExpressionNode *expressionNode) { Q_ASSERT(expressionNode); - auto arrayLiteral = AST::cast<AST::ArrayLiteral *>(expressionNode); + auto arrayLiteral = AST::cast<AST::ArrayPattern *>(expressionNode); if (arrayLiteral) { QList<QVariant> variantList; - for (AST::ElementList *it = arrayLiteral->elements; it; it = it->next) - variantList << parsePropertyExpression(it->expression); + for (AST::PatternElementList *it = arrayLiteral->elements; it; it = it->next) + variantList << parsePropertyExpression(it->element->initializer); return variantList; } diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp index ccae08f6dd..bbd53bcf41 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.cpp +++ b/src/plugins/qmljseditor/qmljseditordocument.cpp @@ -295,8 +295,8 @@ protected: decl.text += QLatin1Char('('); for (FormalParameterList *it = ast->formals; it; it = it->next) { - if (!it->name.isEmpty()) - decl.text += it->name; + if (!it->element->bindingIdentifier.isEmpty()) + decl.text += it->element->bindingIdentifier; if (it->next) decl.text += QLatin1String(", "); @@ -309,14 +309,14 @@ protected: return false; } - bool visit(AST::VariableDeclaration *ast) override + bool visit(AST::PatternElement *ast) override { - if (ast->name.isEmpty()) + if (!ast->isVariableDeclaration() || ast->bindingIdentifier.isEmpty()) return false; Declaration decl; decl.text.fill(QLatin1Char(' '), _depth); - decl.text += ast->name; + decl.text += ast->bindingIdentifier; const SourceLocation first = ast->identifierToken; decl.startLine = first.startLine; @@ -343,8 +343,8 @@ protected: decl.text += QLatin1Char('('); for (FormalParameterList *it = funcExpr->formals; it; it = it->next) { - if (!it->name.isEmpty()) - decl.text += it->name; + if (!it->element->bindingIdentifier.isEmpty()) + decl.text += it->element->bindingIdentifier; if (it->next) decl.text += QLatin1String(", "); diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 6c8d2f4f98..c44158fb14 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -227,9 +227,9 @@ protected: return false; } - bool visit(AST::VariableDeclaration *node) override + bool visit(AST::PatternElement *node) override { - if (node->name == _name) { + if (node->isVariableDeclaration() && node->bindingIdentifier == _name) { if (checkLookup()) _usages.append(node->identifierToken); } @@ -322,7 +322,7 @@ protected: bool visit(AST::UiPublicMember *node) override { - if (node->memberTypeName() == _name){ + if (node->memberType->name == _name){ const ObjectValue * tVal = _context->lookupType(_doc.data(), QStringList(_name)); if (tVal == _typeValue) _usages.append(node->typeToken); @@ -406,9 +406,10 @@ protected: return false; } - bool visit(AST::VariableDeclaration *node) override + bool visit(AST::PatternElement *node) override { - Node::accept(node->expression, this); + if (node->isVariableDeclaration()) + Node::accept(node->initializer, this); return false; } @@ -583,8 +584,8 @@ protected: bool visit(UiPublicMember *node) override { if (containsOffset(node->typeToken)){ - if (node->isValid()) { - _name = node->memberTypeName().toString(); + if (node->defaultToken.isValid()) { + _name = node->memberType->name.toString(); _targetValue = _scopeChain->context()->lookupType(_doc.data(), QStringList(_name)); _scope = 0; _typeKind = TypeKind; @@ -612,10 +613,10 @@ protected: return true; } - bool visit(VariableDeclaration *node) override + bool visit(PatternElement *node) override { - if (containsOffset(node->identifierToken)) { - _name = node->name.toString(); + if (node->isVariableDeclaration() && containsOffset(node->identifierToken)) { + _name = node->bindingIdentifier.toString(); return false; } return true; diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index 4cd696a046..c464b38092 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -323,8 +323,8 @@ protected: bool visit(UiPublicMember *ast) { - if (ast->typeToken.isValid() && ast->isValid()) { - if (m_scopeChain.context()->lookupType(m_scopeChain.document().data(), QStringList(ast->memberTypeName().toString()))) + if (ast->typeToken.isValid()) { // TODO: ast->isValid() ? + if (m_scopeChain.context()->lookupType(m_scopeChain.document().data(), QStringList(ast->memberType->name.toString()))) addUse(ast->typeToken, SemanticHighlighter::QmlTypeType); } if (ast->identifierToken.isValid()) @@ -350,9 +350,10 @@ protected: return visit(static_cast<FunctionExpression *>(ast)); } - bool visit(VariableDeclaration *ast) + bool visit(PatternElement *ast) { - processName(ast->name, ast->identifierToken); + if (ast->isVariableDeclaration()) + processName(ast->bindingIdentifier, ast->identifierToken); return true; } diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp index b10d7902d0..647a733a77 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.cpp +++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp @@ -263,14 +263,14 @@ private: bool visit(AST::BinaryExpression *binExp) { AST::IdentifierExpression *lhsIdent = AST::cast<AST::IdentifierExpression *>(binExp->left); - AST::ObjectLiteral *rhsObjLit = AST::cast<AST::ObjectLiteral *>(binExp->right); + AST::ObjectPattern *rhsObjLit = AST::cast<AST::ObjectPattern *>(binExp->right); if (lhsIdent && rhsObjLit && (lhsIdent->name == QLatin1String("testcase")) && (binExp->op == QSOperator::Assign)) { QModelIndex index = m_model->enterTestCase(rhsObjLit); m_nodeToIndex.insert(rhsObjLit, index); - if (AST::PropertyAssignmentList *properties = rhsObjLit->properties) + if (AST::PatternPropertyList *properties = rhsObjLit->properties) visitProperties(properties); m_model->leaveTestCase(); @@ -290,13 +290,13 @@ private: return true; } - void visitProperties(AST::PropertyAssignmentList *properties) + void visitProperties(AST::PatternPropertyList *properties) { while (properties) { QModelIndex index = m_model->enterTestCaseProperties(properties); m_nodeToIndex.insert(properties, index); - if (AST::PropertyNameAndValue *assignment = AST::cast<AST::PropertyNameAndValue *>(properties->assignment)) - if (AST::ObjectLiteral *objLiteral = AST::cast<AST::ObjectLiteral *>(assignment->value)) + if (AST::PatternProperty *assignment = AST::cast<AST::PatternProperty *>(properties->property)) + if (AST::ObjectPattern *objLiteral = AST::cast<AST::ObjectPattern *>(assignment->initializer)) visitProperties(objLiteral->properties); m_model->leaveTestCaseProperties(); @@ -592,7 +592,7 @@ static QString functionDisplayName(QStringRef name, AST::FormalParameterList *fo if (!name.isEmpty()) display += name.toString() + QLatin1Char('('); for (AST::FormalParameterList *param = formals; param; param = param->next) { - display += param->name.toString(); + display += param->element->bindingIdentifier.toString(); if (param->next) display += QLatin1String(", "); } @@ -650,7 +650,7 @@ void QmlOutlineModel::leaveFieldMemberExpression() leaveNode(); } -QModelIndex QmlOutlineModel::enterTestCase(AST::ObjectLiteral *objectLiteral) +QModelIndex QmlOutlineModel::enterTestCase(AST::ObjectPattern *objectLiteral) { QMap<int, QVariant> objectData; @@ -667,18 +667,18 @@ void QmlOutlineModel::leaveTestCase() leaveNode(); } -QModelIndex QmlOutlineModel::enterTestCaseProperties(AST::PropertyAssignmentList *propertyAssignmentList) +QModelIndex QmlOutlineModel::enterTestCaseProperties(AST::PatternPropertyList *propertyAssignmentList) { QMap<int, QVariant> objectData; - if (AST::PropertyNameAndValue *assignment = AST::cast<AST::PropertyNameAndValue *>( - propertyAssignmentList->assignment)) { + if (AST::PatternProperty *assignment = AST::cast<AST::PatternProperty *>( + propertyAssignmentList->property)) { if (AST::IdentifierPropertyName *propertyName = AST::cast<AST::IdentifierPropertyName *>(assignment->name)) { objectData.insert(Qt::DisplayRole, propertyName->id.toString()); objectData.insert(ItemTypeRole, ElementBindingType); QmlOutlineItem *item; - if (assignment->value->kind == AST::Node::Kind_FunctionExpression) + if (assignment->initializer->kind == AST::Node::Kind_FunctionExpression) item = enterNode(objectData, assignment, 0, Icons::functionDeclarationIcon()); - else if (assignment->value->kind == AST::Node::Kind_ObjectLiteral) + else if (assignment->initializer->kind == AST::Node::Kind_ObjectPattern) item = enterNode(objectData, assignment, 0, Icons::objectDefinitionIcon()); else item = enterNode(objectData, assignment, 0, Icons::scriptBindingIcon()); @@ -686,8 +686,8 @@ QModelIndex QmlOutlineModel::enterTestCaseProperties(AST::PropertyAssignmentList return item->index(); } } - if (AST::PropertyGetterSetter *getterSetter = AST::cast<AST::PropertyGetterSetter *>( - propertyAssignmentList->assignment)) { + if (AST::PatternProperty *getterSetter = AST::cast<AST::PatternProperty *>( + propertyAssignmentList->property)) { if (AST::IdentifierPropertyName *propertyName = AST::cast<AST::IdentifierPropertyName *>(getterSetter->name)) { objectData.insert(Qt::DisplayRole, propertyName->id.toString()); objectData.insert(ItemTypeRole, ElementBindingType); @@ -728,7 +728,7 @@ AST::SourceLocation QmlOutlineModel::sourceLocation(const QModelIndex &index) co location = getLocation(member); else if (AST::ExpressionNode *expression = node->expressionCast()) location = getLocation(expression); - else if (AST::PropertyAssignmentList *propertyAssignmentList = AST::cast<AST::PropertyAssignmentList *>(node)) + else if (AST::PatternPropertyList *propertyAssignmentList = AST::cast<AST::PatternPropertyList *>(node)) location = getLocation(propertyAssignmentList); } return location; @@ -999,26 +999,16 @@ AST::SourceLocation QmlOutlineModel::getLocation(AST::ExpressionNode *exprNode) return location; } -AST::SourceLocation QmlOutlineModel::getLocation(AST::PropertyAssignmentList *propertyNode) { - if (AST::PropertyNameAndValue *assignment = AST::cast<AST::PropertyNameAndValue *>(propertyNode->assignment)) +AST::SourceLocation QmlOutlineModel::getLocation(AST::PatternPropertyList *propertyNode) { + if (AST::PatternProperty *assignment = AST::cast<AST::PatternProperty *>(propertyNode->property)) return getLocation(assignment); - if (AST::PropertyGetterSetter *getterSetter = AST::cast<AST::PropertyGetterSetter *>(propertyNode->assignment)) - return getLocation(getterSetter); - return propertyNode->commaToken; // should never happen + return propertyNode->firstSourceLocation(); // should never happen } -AST::SourceLocation QmlOutlineModel::getLocation(AST::PropertyNameAndValue *propertyNode) { +AST::SourceLocation QmlOutlineModel::getLocation(AST::PatternProperty *propertyNode) { AST::SourceLocation location; location = propertyNode->name->propertyNameToken; - location.length = propertyNode->value->lastSourceLocation().end() - location.offset; - - return location; -} - -AST::SourceLocation QmlOutlineModel::getLocation(AST::PropertyGetterSetter *propertyNode) { - AST::SourceLocation location; - location = propertyNode->name->propertyNameToken; - location.length = propertyNode->rbraceToken.end() - location.offset; + location.length = propertyNode->initializer->lastSourceLocation().end() - location.offset; return location; } diff --git a/src/plugins/qmljseditor/qmloutlinemodel.h b/src/plugins/qmljseditor/qmloutlinemodel.h index 2f1ff2a26e..fddbd2f7c6 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.h +++ b/src/plugins/qmljseditor/qmloutlinemodel.h @@ -120,10 +120,10 @@ private: QmlJS::AST::FunctionExpression *functionExpression); void leaveFieldMemberExpression(); - QModelIndex enterTestCase(QmlJS::AST::ObjectLiteral *objectLiteral); + QModelIndex enterTestCase(QmlJS::AST::ObjectPattern *objectLiteral); void leaveTestCase(); - QModelIndex enterTestCaseProperties(QmlJS::AST::PropertyAssignmentList *propertyAssignmentList); + QModelIndex enterTestCaseProperties(QmlJS::AST::PatternPropertyList *propertyAssignmentList); void leaveTestCaseProperties(); private: @@ -140,9 +140,8 @@ private: static QString asString(QmlJS::AST::UiQualifiedId *id); static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::UiObjectMember *objMember); static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::ExpressionNode *exprNode); - static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::PropertyAssignmentList *propertyNode); - static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::PropertyNameAndValue *propertyNode); - static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::PropertyGetterSetter *propertyNode); + static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::PatternProperty *propertyNode); + static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::PatternPropertyList *propertyNode); QIcon getIcon(QmlJS::AST::UiQualifiedId *objDef); QString getAnnotation(QmlJS::AST::UiObjectInitializer *objInitializer); diff --git a/src/plugins/qmljstools/qmljslocatordata.cpp b/src/plugins/qmljstools/qmljslocatordata.cpp index 36aa5c4010..47c89435a7 100644 --- a/src/plugins/qmljstools/qmljslocatordata.cpp +++ b/src/plugins/qmljstools/qmljslocatordata.cpp @@ -134,8 +134,8 @@ protected: for (FormalParameterList *it = ast->formals; it; it = it->next) { if (it != ast->formals) entry.displayName += QLatin1String(", "); - if (!it->name.isEmpty()) - entry.displayName += it->name.toString(); + if (!it->element->bindingIdentifier.isEmpty()) + entry.displayName += it->element->bindingIdentifier.toString(); } entry.displayName += QLatin1Char(')'); entry.symbolName = entry.displayName; @@ -214,8 +214,8 @@ protected: for (FormalParameterList *it = funcExpr->formals; it; it = it->next) { if (it != funcExpr->formals) entry.displayName += QLatin1String(", "); - if (!it->name.isEmpty()) - entry.displayName += it->name.toString(); + if (!it->element->bindingIdentifier.isEmpty()) + entry.displayName += it->element->bindingIdentifier.toString(); } entry.displayName += QLatin1Char(')'); entry.symbolName = entry.displayName; |