OpenCoverage

qqmljs.g #1

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/parser/qqmljs.g
Source codeSwitch to Preprocessed file
LineSourceCount
1-----------------------------------------------------------------------------
2---
3-- Copyright (C) 2016 The Qt Company Ltd.-
4-- Contact: http://www.qt.io/licensing/-
5---
6-- This file is part of the QtQml module of the Qt Toolkit.-
7---
8-- $QT_BEGIN_LICENSE:LGPL$-
9-- Commercial License Usage-
10-- Licensees holding valid commercial Qt licenses may use this file in-
11-- accordance with the commercial license agreement provided with the-
12-- Software or, alternatively, in accordance with the terms contained in-
13-- a written agreement between you and The Qt Company. For licensing terms-
14-- and conditions see https://www.qt.io/terms-conditions. For further-
15-- information use the contact form at https://www.qt.io/contact-us.-
16---
17-- GNU Lesser General Public License Usage-
18-- Alternatively, this file may be used under the terms of the GNU Lesser-
19-- General Public License version 3 as published by the Free Software-
20-- Foundation and appearing in the file LICENSE.LGPL3 included in the-
21-- packaging of this file. Please review the following information to-
22-- ensure the GNU Lesser General Public License version 3 requirements-
23-- will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24---
25-- GNU General Public License Usage-
26-- Alternatively, this file may be used under the terms of the GNU-
27-- General Public License version 2.0 or (at your option) the GNU General-
28-- Public license version 3 or any later version approved by the KDE Free-
29-- Qt Foundation. The licenses are as published by the Free Software-
30-- Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31-- included in the packaging of this file. Please review the following-
32-- information to ensure the GNU General Public License requirements will-
33-- be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34-- https://www.gnu.org/licenses/gpl-3.0.html.-
35---
36-- $QT_END_LICENSE$-
37---
38-----------------------------------------------------------------------------
39-
40%parser QQmlJSGrammar-
41%decl qqmljsparser_p.h-
42%impl qqmljsparser.cpp-
43%expect 1-
44-
45%token T_AND "&" T_AND_AND "&&" T_AND_EQ "&="-
46%token T_BREAK "break" T_CASE "case" T_CATCH "catch"-
47%token T_COLON ":" T_COMMA "," T_CONTINUE "continue"-
48%token T_DEFAULT "default" T_DELETE "delete" T_DIVIDE_ "/"-
49%token T_DIVIDE_EQ "/=" T_DO "do" T_DOT "."-
50%token T_ELSE "else" T_EQ "=" T_EQ_EQ "=="-
51%token T_EQ_EQ_EQ "===" T_FINALLY "finally" T_FOR "for"-
52%token T_FUNCTION "function" T_GE ">=" T_GT ">"-
53%token T_GT_GT ">>" T_GT_GT_EQ ">>=" T_GT_GT_GT ">>>"-
54%token T_GT_GT_GT_EQ ">>>=" T_IDENTIFIER "identifier" T_IF "if"-
55%token T_IN "in" T_INSTANCEOF "instanceof" T_LBRACE "{"-
56%token T_LBRACKET "[" T_LE "<=" T_LPAREN "("-
57%token T_LT "<" T_LT_LT "<<" T_LT_LT_EQ "<<="-
58%token T_MINUS "-" T_MINUS_EQ "-=" T_MINUS_MINUS "--"-
59%token T_NEW "new" T_NOT "!" T_NOT_EQ "!="-
60%token T_NOT_EQ_EQ "!==" T_NUMERIC_LITERAL "numeric literal" T_OR "|"-
61%token T_OR_EQ "|=" T_OR_OR "||" T_PLUS "+"-
62%token T_PLUS_EQ "+=" T_PLUS_PLUS "++" T_QUESTION "?"-
63%token T_RBRACE "}" T_RBRACKET "]" T_REMAINDER "%"-
64%token T_REMAINDER_EQ "%=" T_RETURN "return" T_RPAREN ")"-
65%token T_SEMICOLON ";" T_AUTOMATIC_SEMICOLON T_STAR "*"-
66%token T_STAR_STAR "**" T_STAR_STAR_EQ "**=" T_STAR_EQ "*="-
67%token T_STRING_LITERAL "string literal"-
68%token T_PROPERTY "property" T_SIGNAL "signal" T_READONLY "readonly"-
69%token T_SWITCH "switch" T_THIS "this" T_THROW "throw"-
70%token T_TILDE "~" T_TRY "try" T_TYPEOF "typeof"-
71%token T_VAR "var" T_VOID "void" T_WHILE "while"-
72%token T_WITH "with" T_XOR "^" T_XOR_EQ "^="-
73%token T_NULL "null" T_TRUE "true" T_FALSE "false"-
74%token T_CONST "const" T_LET "let"-
75%token T_DEBUGGER "debugger"-
76%token T_RESERVED_WORD "reserved word"-
77%token T_MULTILINE_STRING_LITERAL "multiline string literal"-
78%token T_COMMENT "comment"-
79%token T_COMPATIBILITY_SEMICOLON-
80%token T_ARROW "=>"-
81%token T_ENUM "enum"-
82%token T_ELLIPSIS "..."-
83%token T_YIELD "yield"-
84%token T_SUPER "super"-
85%token T_CLASS "class"-
86%token T_EXTENDS "extends"-
87%token T_STATIC "static"-
88%token T_EXPORT "export"-
89%token T_FROM "from"-
90-
91--- template strings-
92%token T_NO_SUBSTITUTION_TEMPLATE"(no subst template)"-
93%token T_TEMPLATE_HEAD "(template head)"-
94%token T_TEMPLATE_MIDDLE "(template middle)"-
95%token T_TEMPLATE_TAIL "(template tail)"-
96-
97--- context keywords.-
98%token T_PUBLIC "public"-
99%token T_IMPORT "import"-
100%token T_PRAGMA "pragma"-
101%token T_AS "as"-
102%token T_OF "of"-
103%token T_GET "get"-
104%token T_SET "set"-
105-
106%token T_ERROR-
107-
108--- feed tokens-
109%token T_FEED_UI_PROGRAM-
110%token T_FEED_UI_OBJECT_MEMBER-
111%token T_FEED_JS_STATEMENT-
112%token T_FEED_JS_EXPRESSION-
113%token T_FEED_JS_SCRIPT-
114%token T_FEED_JS_MODULE-
115-
116--- Lookahead handling-
117%token T_FORCE_DECLARATION "(force decl)"-
118%token T_FORCE_BLOCK "(force block)"-
119%token T_FOR_LOOKAHEAD_OK "(for lookahead ok)"-
120-
121--%left T_PLUS T_MINUS-
122%nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY T_ON T_SET T_GET T_OF T_STATIC T_FROM-
123%nonassoc REDUCE_HERE-
124-
125%start TopLevel-
126-
127/./****************************************************************************-
128**-
129** Copyright (C) 2016 The Qt Company Ltd.-
130** Contact: https://www.qt.io/licensing/-
131**-
132** This file is part of the QtQml module of the Qt Toolkit.-
133**-
134** $QT_BEGIN_LICENSE:LGPL$-
135** Commercial License Usage-
136** Licensees holding valid commercial Qt licenses may use this file in-
137** accordance with the commercial license agreement provided with the-
138** Software or, alternatively, in accordance with the terms contained in-
139** a written agreement between you and The Qt Company. For licensing terms-
140** and conditions see https://www.qt.io/terms-conditions. For further-
141** information use the contact form at https://www.qt.io/contact-us.-
142**-
143** GNU Lesser General Public License Usage-
144** Alternatively, this file may be used under the terms of the GNU Lesser-
145** General Public License version 3 as published by the Free Software-
146** Foundation and appearing in the file LICENSE.LGPL3 included in the-
147** packaging of this file. Please review the following information to-
148** ensure the GNU Lesser General Public License version 3 requirements-
149** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
150**-
151** GNU General Public License Usage-
152** Alternatively, this file may be used under the terms of the GNU-
153** General Public License version 2.0 or (at your option) the GNU General-
154** Public license version 3 or any later version approved by the KDE Free-
155** Qt Foundation. The licenses are as published by the Free Software-
156** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
157** included in the packaging of this file. Please review the following-
158** information to ensure the GNU General Public License requirements will-
159** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
160** https://www.gnu.org/licenses/gpl-3.0.html.-
161**-
162** $QT_END_LICENSE$-
163**-
164****************************************************************************/-
165-
166#include <private/qqmljsengine_p.h>-
167#include <private/qqmljslexer_p.h>-
168#include <private/qqmljsast_p.h>-
169#include <private/qqmljsmemorypool_p.h>-
170-
171#include <QtCore/qdebug.h>-
172#include <QtCore/qcoreapplication.h>-
173-
174#include <string.h>-
175-
176./-
177-
178/:/****************************************************************************-
179**-
180** Copyright (C) 2016 The Qt Company Ltd.-
181** Contact: https://www.qt.io/licensing/-
182**-
183** This file is part of the QtQml module of the Qt Toolkit.-
184**-
185** $QT_BEGIN_LICENSE:LGPL$-
186** Commercial License Usage-
187** Licensees holding valid commercial Qt licenses may use this file in-
188** accordance with the commercial license agreement provided with the-
189** Software or, alternatively, in accordance with the terms contained in-
190** a written agreement between you and The Qt Company. For licensing terms-
191** and conditions see https://www.qt.io/terms-conditions. For further-
192** information use the contact form at https://www.qt.io/contact-us.-
193**-
194** GNU Lesser General Public License Usage-
195** Alternatively, this file may be used under the terms of the GNU Lesser-
196** General Public License version 3 as published by the Free Software-
197** Foundation and appearing in the file LICENSE.LGPL3 included in the-
198** packaging of this file. Please review the following information to-
199** ensure the GNU Lesser General Public License version 3 requirements-
200** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
201**-
202** GNU General Public License Usage-
203** Alternatively, this file may be used under the terms of the GNU-
204** General Public License version 2.0 or (at your option) the GNU General-
205** Public license version 3 or any later version approved by the KDE Free-
206** Qt Foundation. The licenses are as published by the Free Software-
207** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
208** included in the packaging of this file. Please review the following-
209** information to ensure the GNU General Public License requirements will-
210** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
211** https://www.gnu.org/licenses/gpl-3.0.html.-
212**-
213** $QT_END_LICENSE$-
214**-
215****************************************************************************/-
216-
217-
218//-
219// W A R N I N G-
220// --------------
221//-
222// This file is not part of the Qt API. It exists purely as an-
223// implementation detail. This header file may change from version to-
224// version without notice, or even be removed.-
225//-
226// We mean it.-
227//-
228-
229//-
230// W A R N I N G-
231// --------------
232//-
233// This file is automatically generated from qqmljs.g.-
234// Changes should be made to that file, not here. Any change to this file will-
235// be lost!-
236//-
237// To regenerate this file, run:-
238// qlalr --no-debug --no-lines --qt qqmljs.g-
239//-
240-
241#ifndef QQMLJSPARSER_P_H-
242#define QQMLJSPARSER_P_H-
243-
244#include <private/qqmljsglobal_p.h>-
245#include <private/qqmljsgrammar_p.h>-
246#include <private/qqmljsast_p.h>-
247#include <private/qqmljsengine_p.h>-
248-
249#include <QtCore/qlist.h>-
250#include <QtCore/qstring.h>-
251-
252QT_QML_BEGIN_NAMESPACE-
253-
254namespace QQmlJS {-
255-
256class Engine;-
257-
258class QML_PARSER_EXPORT Parser: protected $table-
259{-
260public:-
261 union Value {-
262 int ival;-
263 double dval;-
264 AST::VariableScope scope;-
265 AST::ForEachType forEachType;-
266 AST::ArgumentList *ArgumentList;-
267 AST::CaseBlock *CaseBlock;-
268 AST::CaseClause *CaseClause;-
269 AST::CaseClauses *CaseClauses;-
270 AST::Catch *Catch;-
271 AST::DefaultClause *DefaultClause;-
272 AST::Elision *Elision;-
273 AST::ExpressionNode *Expression;-
274 AST::TemplateLiteral *Template;-
275 AST::Finally *Finally;-
276 AST::FormalParameterList *FormalParameterList;-
277 AST::FunctionDeclaration *FunctionDeclaration;-
278 AST::Node *Node;-
279 AST::PropertyName *PropertyName;-
280 AST::Statement *Statement;-
281 AST::StatementList *StatementList;-
282 AST::Block *Block;-
283 AST::VariableDeclarationList *VariableDeclarationList;-
284 AST::Pattern *Pattern;-
285 AST::PatternElement *PatternElement;-
286 AST::PatternElementList *PatternElementList;-
287 AST::PatternProperty *PatternProperty;-
288 AST::PatternPropertyList *PatternPropertyList;-
289 AST::ClassElementList *ClassElementList;-
290-
291 AST::UiProgram *UiProgram;-
292 AST::UiHeaderItemList *UiHeaderItemList;-
293 AST::UiPragma *UiPragma;-
294 AST::UiImport *UiImport;-
295 AST::UiParameterList *UiParameterList;-
296 AST::UiPublicMember *UiPublicMember;-
297 AST::UiObjectDefinition *UiObjectDefinition;-
298 AST::UiObjectInitializer *UiObjectInitializer;-
299 AST::UiObjectBinding *UiObjectBinding;-
300 AST::UiScriptBinding *UiScriptBinding;-
301 AST::UiArrayBinding *UiArrayBinding;-
302 AST::UiObjectMember *UiObjectMember;-
303 AST::UiObjectMemberList *UiObjectMemberList;-
304 AST::UiArrayMemberList *UiArrayMemberList;-
305 AST::UiQualifiedId *UiQualifiedId;-
306 AST::UiQualifiedPragmaId *UiQualifiedPragmaId;-
307 AST::UiEnumMemberList *UiEnumMemberList;-
308 };-
309-
310public:-
311 Parser(Engine *engine);-
312 ~Parser();-
313-
314 // parse a UI program-
315 bool parse() { ++functionNestingLevel; bool r = parse(T_FEED_UI_PROGRAM); --functionNestingLevel; return r; }
never executed: return r;
0
316 bool parseStatement() { return parse(T_FEED_JS_STATEMENT); }
never executed: return parse(T_FEED_JS_STATEMENT);
0
317 bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); }
executed 985 times by 2 tests: return parse(T_FEED_JS_EXPRESSION);
Executed by:
  • tst_ecmascripttests
  • tst_qqmlecmascript
985
318 bool parseUiObjectMember() { ++functionNestingLevel; bool r = parse(T_FEED_UI_OBJECT_MEMBER); --functionNestingLevel; return r; }
never executed: return r;
0
319 bool parseProgram() { return parse(T_FEED_JS_SCRIPT); }
executed 2818020 times by 40 tests: return parse(T_FEED_JS_SCRIPT);
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlincubator
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • ...
2818020
320 bool parseScript() { return parse(T_FEED_JS_SCRIPT); }
never executed: return parse(T_FEED_JS_SCRIPT);
0
321 bool parseModule() { return parse(T_FEED_JS_MODULE); }
never executed: return parse(T_FEED_JS_MODULE);
0
322-
323 AST::UiProgram *ast() const-
324 { return AST::cast<AST::UiProgram *>(program); }
never executed: return AST::cast<AST::UiProgram *>(program);
0
325-
326 AST::Statement *statement() const-
327 {-
328 if (! program)
! programDescription
TRUEnever evaluated
FALSEnever evaluated
0
329 return 0;
never executed: return 0;
0
330-
331 return program->statementCast();
never executed: return program->statementCast();
0
332 }-
333-
334 AST::ExpressionNode *expression() const-
335 {-
336 if (! program)
! programDescription
TRUEnever evaluated
FALSEnever evaluated
0
337 return 0;
never executed: return 0;
0
338-
339 return program->expressionCast();
never executed: return program->expressionCast();
0
340 }-
341-
342 AST::UiObjectMember *uiObjectMember() const-
343 {-
344 if (! program)
! programDescription
TRUEnever evaluated
FALSEnever evaluated
0
345 return 0;
never executed: return 0;
0
346-
347 return program->uiObjectMemberCast();
never executed: return program->uiObjectMemberCast();
0
348 }-
349-
350 AST::Node *rootNode() const-
351 { return program; }
executed 2813969 times by 40 tests: return program;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlincubator
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • ...
2813969
352-
353 QList<DiagnosticMessage> diagnosticMessages() const-
354 { return diagnostic_messages; }
executed 2816740 times by 40 tests: return diagnostic_messages;
Executed by:
  • tst_ecmascripttests
  • tst_examples
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlincubator
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmlmetatype
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qqmltranslation
  • tst_qqmlvaluetypes
  • tst_qqmlxmlhttprequest
  • tst_qquickanimationcontroller
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • ...
2816740
355-
356 inline DiagnosticMessage diagnosticMessage() const-
357 {-
358 for (const DiagnosticMessage &d : diagnostic_messages) {-
359 if (d.kind != DiagnosticMessage::Warning)
d.kind != Diag...ssage::WarningDescription
TRUEnever evaluated
FALSEnever evaluated
0
360 return d;
never executed: return d;
0
361 }
never executed: end of block
0
362-
363 return DiagnosticMessage();
never executed: return DiagnosticMessage();
0
364 }-
365-
366 inline QString errorMessage() const-
367 { return diagnosticMessage().message; }
never executed: return diagnosticMessage().message;
0
368-
369 inline int errorLineNumber() const-
370 { return diagnosticMessage().loc.startLine; }
never executed: return diagnosticMessage().loc.startLine;
0
371-
372 inline int errorColumnNumber() const-
373 { return diagnosticMessage().loc.startColumn; }
never executed: return diagnosticMessage().loc.startColumn;
0
374-
375protected:-
376 bool parse(int startToken);-
377-
378 void reallocateStack();-
379-
380 inline Value &sym(int index)-
381 { return sym_stack [tos + index - 1]; }
executed 297713653 times by 147 tests: return sym_stack [tos + index - 1];
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • ...
297713653
382-
383 inline QStringRef &stringRef(int index)-
384 { return string_stack [tos + index - 1]; }
executed 103079572 times by 147 tests: return string_stack [tos + index - 1];
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • ...
103079572
385-
386 inline AST::SourceLocation &loc(int index)-
387 { return location_stack [tos + index - 1]; }
executed 153093373 times by 147 tests: return location_stack [tos + index - 1];
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • ...
153093373
388-
389 AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr);-
390 AST::UiQualifiedPragmaId *reparseAsQualifiedPragmaId(AST::ExpressionNode *expr);-
391-
392 void pushToken(int token);-
393 int lookaheadToken(Lexer *lexer);-
394-
395 void syntaxError(const AST::SourceLocation &location, const char *message) {-
396 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location, QLatin1String(message)));-
397 }
executed 272 times by 3 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qjsengine
  • tst_qqmlparser
272
398 void syntaxError(const AST::SourceLocation &location, const QString &message) {-
399 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location, message));-
400 }
executed 158 times by 2 tests: end of block
Executed by:
  • tst_ecmascripttests
  • tst_qqmlparser
158
401-
402protected:-
403 Engine *driver;-
404 MemoryPool *pool;-
405 int tos = 0;-
406 int stack_size = 0;-
407 Value *sym_stack = nullptr;-
408 int *state_stack = nullptr;-
409 AST::SourceLocation *location_stack = nullptr;-
410 QVector<QStringRef> string_stack;-
411-
412 AST::Node *program = nullptr;-
413-
414 // error recovery and lookahead handling-
415 enum { TOKEN_BUFFER_SIZE = 5 };-
416-
417 struct SavedToken {-
418 int token;-
419 double dval;-
420 AST::SourceLocation loc;-
421 QStringRef spell;-
422 };-
423-
424 int yytoken = -1;-
425 double yylval = 0.;-
426 QStringRef yytokenspell;-
427 AST::SourceLocation yylloc;-
428 AST::SourceLocation yyprevlloc;-
429-
430 SavedToken token_buffer[TOKEN_BUFFER_SIZE];-
431 SavedToken *first_token = nullptr;-
432 SavedToken *last_token = nullptr;-
433-
434 int functionNestingLevel = 0;-
435-
436 enum CoverExpressionType {-
437 CE_Invalid,-
438 CE_ParenthesizedExpression,-
439 CE_FormalParameterList-
440 };-
441 AST::SourceLocation coverExpressionErrorLocation;-
442 CoverExpressionType coverExpressionType = CE_Invalid;-
443-
444 QList<DiagnosticMessage> diagnostic_messages;-
445};-
446-
447} // end of namespace QQmlJS-
448-
449-
450:/-
451-
452-
453/.-
454-
455#include "qqmljsparser_p.h"-
456-
457#include <QtCore/qvarlengtharray.h>-
458-
459//-
460// W A R N I N G-
461// --------------
462//-
463// This file is automatically generated from qqmljs.g.-
464// Changes should be made to that file, not here. Any change to this file will-
465// be lost!-
466//-
467// To regenerate this file, run:-
468// qlalr --no-debug --no-lines --qt qqmljs.g-
469//-
470-
471#define UNIMPLEMENTED syntaxError(loc(1), "Unimplemented"); return false-
472-
473using namespace QQmlJS;-
474-
475QT_QML_BEGIN_NAMESPACE-
476-
477void Parser::reallocateStack()-
478{-
479 if (! stack_size)-
480 stack_size = 128;-
481 else-
482 stack_size <<= 1;-
483-
484 sym_stack = reinterpret_cast<Value*> (realloc(sym_stack, stack_size * sizeof(Value)));-
485 state_stack = reinterpret_cast<int*> (realloc(state_stack, stack_size * sizeof(int)));-
486 location_stack = reinterpret_cast<AST::SourceLocation*> (realloc(location_stack, stack_size * sizeof(AST::SourceLocation)));-
487 string_stack.resize(stack_size);-
488}-
489-
490Parser::Parser(Engine *engine):-
491 driver(engine),-
492 pool(engine->pool())-
493{-
494}-
495-
496Parser::~Parser()-
497{-
498 if (stack_size) {-
499 free(sym_stack);-
500 free(state_stack);-
501 free(location_stack);-
502 }-
503}-
504-
505static inline AST::SourceLocation location(Lexer *lexer)-
506{-
507 AST::SourceLocation loc;-
508 loc.offset = lexer->tokenOffset();-
509 loc.length = lexer->tokenLength();-
510 loc.startLine = lexer->tokenStartLine();-
511 loc.startColumn = lexer->tokenStartColumn();-
512 return loc;-
513}-
514-
515AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr)-
516{-
517 QVarLengthArray<QStringRef, 4> nameIds;-
518 QVarLengthArray<AST::SourceLocation, 4> locations;-
519-
520 AST::ExpressionNode *it = expr;-
521 while (AST::FieldMemberExpression *m = AST::cast<AST::FieldMemberExpression *>(it)) {-
522 nameIds.append(m->name);-
523 locations.append(m->identifierToken);-
524 it = m->base;-
525 }-
526-
527 if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(it)) {-
528 AST::UiQualifiedId *q = new (pool) AST::UiQualifiedId(idExpr->name);-
529 q->identifierToken = idExpr->identifierToken;-
530-
531 AST::UiQualifiedId *currentId = q;-
532 for (int i = nameIds.size() - 1; i != -1; --i) {-
533 currentId = new (pool) AST::UiQualifiedId(currentId, nameIds[i]);-
534 currentId->identifierToken = locations[i];-
535 }-
536-
537 return currentId->finish();-
538 }-
539-
540 return 0;-
541}-
542-
543AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode *expr)-
544{-
545 if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(expr)) {-
546 AST::UiQualifiedPragmaId *q = new (pool) AST::UiQualifiedPragmaId(idExpr->name);-
547 q->identifierToken = idExpr->identifierToken;-
548-
549 return q->finish();-
550 }-
551-
552 return 0;-
553}-
554-
555void Parser::pushToken(int token)-
556{-
557 last_token->token = yytoken;-
558 last_token->dval = yylval;-
559 last_token->spell = yytokenspell;-
560 last_token->loc = yylloc;-
561 ++last_token;-
562 yytoken = token;-
563}-
564-
565int Parser::lookaheadToken(Lexer *lexer)-
566{-
567 if (yytoken < 0) {-
568 yytoken = lexer->lex();-
569 yylval = lexer->tokenValue();-
570 yytokenspell = lexer->tokenSpell();-
571 yylloc = location(lexer);-
572 }-
573 return yytoken;-
574}-
575-
576//#define PARSER_DEBUG-
577-
578bool Parser::parse(int startToken)-
579{-
580 Lexer *lexer = driver->lexer();-
581 bool hadErrors = false;-
582 yytoken = -1;-
583 int action = 0;-
584-
585 token_buffer[0].token = startToken;-
586 first_token = &token_buffer[0];-
587 if (startToken == T_FEED_JS_SCRIPT && !lexer->qmlMode()) {-
588 Directives ignoreDirectives;-
589 Directives *directives = driver->directives();-
590 if (!directives)-
591 directives = &ignoreDirectives;-
592 DiagnosticMessage error;-
593 if (!lexer->scanDirectives(directives, &error)) {-
594 diagnostic_messages.append(error);-
595 return false;-
596 }-
597 token_buffer[1].token = lexer->tokenKind();-
598 token_buffer[1].dval = lexer->tokenValue();-
599 token_buffer[1].loc = location(lexer);-
600 token_buffer[1].spell = lexer->tokenSpell();-
601 last_token = &token_buffer[2];-
602 } else {-
603 last_token = &token_buffer[1];-
604 }-
605-
606 tos = -1;-
607 program = 0;-
608-
609 do {-
610 if (++tos == stack_size)-
611 reallocateStack();-
612-
613 state_stack[tos] = action;-
614-
615 _Lcheck_token:-
616 if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {-
617 yyprevlloc = yylloc;-
618-
619 if (first_token == last_token) {-
620 yytoken = lexer->lex();-
621 yylval = lexer->tokenValue();-
622 yytokenspell = lexer->tokenSpell();-
623 yylloc = location(lexer);-
624 } else {-
625 yytoken = first_token->token;-
626 yylval = first_token->dval;-
627 yytokenspell = first_token->spell;-
628 yylloc = first_token->loc;-
629 ++first_token;-
630 if (first_token == last_token)-
631 first_token = last_token = &token_buffer[0];-
632 }-
633 }-
634-
635#ifdef PARSER_DEBUG-
636 qDebug() << " in state" << action;-
637#endif-
638-
639 action = t_action(action, yytoken);-
640#ifdef PARSER_DEBUG-
641 qDebug() << " current token" << yytoken << (yytoken >= 0 ? spell[yytoken] : "(null)") << "new state" << action;-
642#endif-
643 if (action > 0) {-
644 if (action != ACCEPT_STATE) {-
645 yytoken = -1;-
646 sym(1).dval = yylval;-
647 stringRef(1) = yytokenspell;-
648 loc(1) = yylloc;-
649 } else {-
650 --tos;-
651 return ! hadErrors;-
652 }-
653 } else if (action < 0) {-
654 const int r = -action - 1;-
655 tos -= rhs[r];-
656-
657#ifdef PARSER_DEBUG-
658 qDebug() << " reducing through rule " << -action;-
659#endif-
660-
661 switch (r) {-
662./-
663-
664---------------------------------------------------------------------------------------------------------
665-- Declarative UI-
666---------------------------------------------------------------------------------------------------------
667-
668TopLevel: T_FEED_UI_PROGRAM UiProgram;-
669/.-
670 case $rule_number: {-
671 sym(1).Node = sym(2).Node;-
672 program = sym(1).Node;-
673 } break;-
674./-
675-
676TopLevel: T_FEED_JS_STATEMENT Statement;-
677/.-
678 case $rule_number: {-
679 sym(1).Node = sym(2).Node;-
680 program = sym(1).Node;-
681 } break;-
682./-
683-
684TopLevel: T_FEED_JS_EXPRESSION Expression;-
685/.-
686 case $rule_number: {-
687 sym(1).Node = sym(2).Node;-
688 program = sym(1).Node;-
689 } break;-
690./-
691-
692TopLevel: T_FEED_UI_OBJECT_MEMBER UiObjectMember;-
693/.-
694 case $rule_number: {-
695 sym(1).Node = sym(2).Node;-
696 program = sym(1).Node;-
697 } break;-
698./-
699-
700TopLevel: T_FEED_JS_SCRIPT Script;-
701/.-
702 case $rule_number: {-
703 sym(1).Node = sym(2).Node;-
704 program = sym(1).Node;-
705 } break;-
706./-
707-
708TopLevel: T_FEED_JS_MODULE Module;-
709/.-
710 case $rule_number: {-
711 sym(1).Node = sym(2).Node;-
712 program = sym(1).Node;-
713 } break;-
714./-
715-
716-
717UiProgram: UiHeaderItemListOpt UiRootMember;-
718/.-
719 case $rule_number: {-
720 sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList, sym(2).UiObjectMemberList->finish());-
721 } break;-
722./-
723-
724UiHeaderItemListOpt: Empty;-
725UiHeaderItemListOpt: UiHeaderItemList;-
726/.-
727 case $rule_number: {-
728 sym(1).Node = sym(1).UiHeaderItemList->finish();-
729 } break;-
730./-
731-
732UiHeaderItemList: UiPragma;-
733/.-
734 case $rule_number: {-
735 sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma);-
736 } break;-
737./-
738-
739UiHeaderItemList: UiImport;-
740/.-
741 case $rule_number: {-
742 sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport);-
743 } break;-
744./-
745-
746UiHeaderItemList: UiHeaderItemList UiPragma;-
747/.-
748 case $rule_number: {-
749 sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma);-
750 } break;-
751./-
752-
753UiHeaderItemList: UiHeaderItemList UiImport;-
754/.-
755 case $rule_number: {-
756 sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport);-
757 } break;-
758./-
759-
760PragmaId: MemberExpression;-
761-
762ImportId: MemberExpression;-
763-
764UiPragma: UiPragmaHead T_AUTOMATIC_SEMICOLON;-
765UiPragma: UiPragmaHead T_SEMICOLON;-
766/.-
767 case $rule_number: {-
768 sym(1).UiPragma->semicolonToken = loc(2);-
769 } break;-
770./-
771-
772UiImport: UiImportHead T_AUTOMATIC_SEMICOLON;-
773UiImport: UiImportHead T_SEMICOLON;-
774/.-
775 case $rule_number: {-
776 sym(1).UiImport->semicolonToken = loc(2);-
777 } break;-
778./-
779-
780UiImport: UiImportHead T_NUMERIC_LITERAL T_AUTOMATIC_SEMICOLON;-
781UiImport: UiImportHead T_NUMERIC_LITERAL T_SEMICOLON;-
782/.-
783 case $rule_number: {-
784 sym(1).UiImport->versionToken = loc(2);-
785 sym(1).UiImport->semicolonToken = loc(3);-
786 } break;-
787./-
788-
789UiImport: UiImportHead T_NUMERIC_LITERAL T_AS QmlIdentifier T_AUTOMATIC_SEMICOLON;-
790UiImport: UiImportHead T_NUMERIC_LITERAL T_AS QmlIdentifier T_SEMICOLON;-
791/.-
792 case $rule_number: {-
793 sym(1).UiImport->versionToken = loc(2);-
794 sym(1).UiImport->asToken = loc(3);-
795 sym(1).UiImport->importIdToken = loc(4);-
796 sym(1).UiImport->importId = stringRef(4);-
797 sym(1).UiImport->semicolonToken = loc(5);-
798 } break;-
799./-
800-
801UiImport: UiImportHead T_AS QmlIdentifier T_AUTOMATIC_SEMICOLON;-
802UiImport: UiImportHead T_AS QmlIdentifier T_SEMICOLON;-
803/.-
804 case $rule_number: {-
805 sym(1).UiImport->asToken = loc(2);-
806 sym(1).UiImport->importIdToken = loc(3);-
807 sym(1).UiImport->importId = stringRef(3);-
808 sym(1).UiImport->semicolonToken = loc(4);-
809 } break;-
810./-
811-
812UiPragmaHead: T_PRAGMA PragmaId;-
813/.-
814 case $rule_number: {-
815 AST::UiPragma *node = 0;-
816-
817 if (AST::UiQualifiedPragmaId *qualifiedId = reparseAsQualifiedPragmaId(sym(2).Expression))-
818 node = new (pool) AST::UiPragma(qualifiedId);-
819-
820 sym(1).Node = node;-
821-
822 if (node) {-
823 node->pragmaToken = loc(1);-
824 } else {-
825 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),-
826 QLatin1String("Expected a qualified name id")));-
827-
828 return false; // ### remove me-
829 }-
830 } break;-
831./-
832-
833-
834UiImportHead: T_IMPORT ImportId;-
835/.-
836 case $rule_number: {-
837 AST::UiImport *node = 0;-
838-
839 if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) {-
840 node = new (pool) AST::UiImport(importIdLiteral->value);-
841 node->fileNameToken = loc(2);-
842 } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {-
843 node = new (pool) AST::UiImport(qualifiedId);-
844 node->fileNameToken = loc(2);-
845 }-
846-
847 sym(1).Node = node;-
848-
849 if (node) {-
850 node->importToken = loc(1);-
851 } else {-
852 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),-
853 QLatin1String("Expected a qualified name id or a string literal")));-
854-
855 return false; // ### remove me-
856 }-
857 } break;-
858./-
859-
860Empty: ;-
861/.-
862 case $rule_number: {-
863 sym(1).Node = nullptr;-
864 } break;-
865./-
866-
867UiRootMember: UiObjectDefinition;-
868/.-
869 case $rule_number: {-
870 sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember);-
871 } break;-
872./-
873-
874UiObjectMemberList: UiObjectMember;-
875/.-
876 case $rule_number: {-
877 sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember);-
878 } break;-
879./-
880-
881UiObjectMemberList: UiObjectMemberList UiObjectMember;-
882/.-
883 case $rule_number: {-
884 AST::UiObjectMemberList *node = new (pool) AST:: UiObjectMemberList(sym(1).UiObjectMemberList, sym(2).UiObjectMember);-
885 sym(1).Node = node;-
886 } break;-
887./-
888-
889UiArrayMemberList: UiObjectDefinition;-
890/.-
891 case $rule_number: {-
892 sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember);-
893 } break;-
894./-
895-
896UiArrayMemberList: UiArrayMemberList T_COMMA UiObjectDefinition;-
897/.-
898 case $rule_number: {-
899 AST::UiArrayMemberList *node = new (pool) AST::UiArrayMemberList(sym(1).UiArrayMemberList, sym(3).UiObjectMember);-
900 node->commaToken = loc(2);-
901 sym(1).Node = node;-
902 } break;-
903./-
904-
905UiObjectInitializer: T_LBRACE T_RBRACE;-
906/.-
907 case $rule_number: {-
908 AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0);-
909 node->lbraceToken = loc(1);-
910 node->rbraceToken = loc(2);-
911 sym(1).Node = node;-
912 } break;-
913./-
914-
915UiObjectInitializer: T_LBRACE UiObjectMemberList T_RBRACE;-
916/.-
917 case $rule_number: {-
918 AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish());-
919 node->lbraceToken = loc(1);-
920 node->rbraceToken = loc(3);-
921 sym(1).Node = node;-
922 } break;-
923./-
924-
925UiObjectDefinition: UiQualifiedId UiObjectInitializer;-
926/.-
927 case $rule_number: {-
928 AST::UiObjectDefinition *node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId, sym(2).UiObjectInitializer);-
929 sym(1).Node = node;-
930 } break;-
931./-
932-
933UiObjectMember: UiObjectDefinition;-
934-
935UiObjectMember: UiQualifiedId T_COLON ExpressionStatementLookahead T_LBRACKET UiArrayMemberList T_RBRACKET;-
936/.-
937 case $rule_number: {-
938 AST::UiArrayBinding *node = new (pool) AST::UiArrayBinding(sym(1).UiQualifiedId, sym(5).UiArrayMemberList->finish());-
939 node->colonToken = loc(2);-
940 node->lbracketToken = loc(4);-
941 node->rbracketToken = loc(6);-
942 sym(1).Node = node;-
943 } break;-
944./-
945-
946UiObjectMember: UiQualifiedId T_COLON ExpressionStatementLookahead UiQualifiedId UiObjectInitializer;-
947/.-
948 case $rule_number: {-
949 AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding(-
950 sym(1).UiQualifiedId, sym(4).UiQualifiedId, sym(5).UiObjectInitializer);-
951 node->colonToken = loc(2);-
952 sym(1).Node = node;-
953 } break;-
954./-
955-
956UiObjectMember: UiQualifiedId T_ON UiQualifiedId UiObjectInitializer;-
957/.-
958 case $rule_number: {-
959 AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding(-
960 sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer);-
961 node->colonToken = loc(2);-
962 node->hasOnToken = true;-
963 sym(1).Node = node;-
964 } break;-
965./-
966-
967-
968UiObjectLiteral: T_LBRACE ExpressionStatementLookahead UiPropertyDefinitionList T_RBRACE;-
969/. case $rule_number: Q_FALLTHROUGH(); ./-
970UiObjectLiteral: T_LBRACE ExpressionStatementLookahead UiPropertyDefinitionList T_COMMA T_RBRACE;-
971/.-
972 case $rule_number: {-
973 AST::ObjectPattern *l = new (pool) AST::ObjectPattern(sym(3).PatternPropertyList->finish());-
974 l->lbraceToken = loc(1);-
975 l->rbraceToken = loc(4);-
976 AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(l);-
977 sym(1).Node = node;-
978 } break;-
979./-
980-
981-
982UiScriptStatement: ExpressionStatementLookahead T_FORCE_DECLARATION ExpressionStatement;-
983/. case $rule_number: Q_FALLTHROUGH(); ./-
984UiScriptStatement: ExpressionStatementLookahead T_FORCE_BLOCK Block;-
985/. case $rule_number: Q_FALLTHROUGH(); ./-
986UiScriptStatement: ExpressionStatementLookahead T_FORCE_BLOCK UiObjectLiteral;-
987/.-
988 case $rule_number: {-
989 sym(1).Node = sym(3).Node;-
990 } break;-
991./-
992-
993-
994UiScriptStatement: ExpressionStatementLookahead EmptyStatement;-
995/. case $rule_number: Q_FALLTHROUGH(); ./-
996UiScriptStatement: ExpressionStatementLookahead ExpressionStatement;-
997/. case $rule_number: Q_FALLTHROUGH(); ./-
998UiScriptStatement: ExpressionStatementLookahead IfStatement;-
999/. case $rule_number: Q_FALLTHROUGH(); ./-
1000UiScriptStatement: ExpressionStatementLookahead WithStatement;-
1001/. case $rule_number: Q_FALLTHROUGH(); ./-
1002UiScriptStatement: ExpressionStatementLookahead SwitchStatement;-
1003/. case $rule_number: Q_FALLTHROUGH(); ./-
1004UiScriptStatement: ExpressionStatementLookahead TryStatement;-
1005/.-
1006 case $rule_number: {-
1007 sym(1).Node = sym(2).Node;-
1008 } break;-
1009./-
1010-
1011UiObjectMember: UiQualifiedId T_COLON UiScriptStatement;-
1012/.-
1013case $rule_number:-
1014{-
1015 AST::UiScriptBinding *node = new (pool) AST::UiScriptBinding(sym(1).UiQualifiedId, sym(3).Statement);-
1016 node->colonToken = loc(2);-
1017 sym(1).Node = node;-
1018 } break;-
1019./-
1020-
1021UiPropertyType: T_VAR;-
1022/.-
1023 case $rule_number: {-
1024 AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1));-
1025 node->identifierToken = loc(1);-
1026 sym(1).Node = node;-
1027 } break;-
1028./-
1029-
1030UiPropertyType: T_RESERVED_WORD;-
1031/.-
1032 case $rule_number: {-
1033 AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1));-
1034 node->identifierToken = loc(1);-
1035 sym(1).Node = node;-
1036 } break;-
1037./-
1038-
1039UiPropertyType: T_IDENTIFIER;-
1040/.-
1041 case $rule_number: {-
1042 AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(stringRef(1));-
1043 node->identifierToken = loc(1);-
1044 sym(1).Node = node;-
1045 } break;-
1046./-
1047-
1048UiPropertyType: UiPropertyType T_DOT T_IDENTIFIER;-
1049/.-
1050 case $rule_number: {-
1051 AST::UiQualifiedId *node = new (pool) AST::UiQualifiedId(sym(1).UiQualifiedId, stringRef(3));-
1052 node->identifierToken = loc(3);-
1053 sym(1).Node = node;-
1054 } break;-
1055./-
1056-
1057UiParameterListOpt: ;-
1058/.-
1059 case $rule_number: {-
1060 sym(1).Node = nullptr;-
1061 } break;-
1062./-
1063-
1064UiParameterListOpt: UiParameterList;-
1065/.-
1066 case $rule_number: {-
1067 sym(1).Node = sym(1).UiParameterList->finish();-
1068 } break;-
1069./-
1070-
1071UiParameterList: UiPropertyType QmlIdentifier;-
1072/.-
1073 case $rule_number: {-
1074 AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiQualifiedId->finish(), stringRef(2));-
1075 node->propertyTypeToken = loc(1);-
1076 node->identifierToken = loc(2);-
1077 sym(1).Node = node;-
1078 } break;-
1079./-
1080-
1081UiParameterList: UiParameterList T_COMMA UiPropertyType QmlIdentifier;-
1082/.-
1083 case $rule_number: {-
1084 AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, sym(3).UiQualifiedId->finish(), stringRef(4));-
1085 node->propertyTypeToken = loc(3);-
1086 node->commaToken = loc(2);-
1087 node->identifierToken = loc(4);-
1088 sym(1).Node = node;-
1089 } break;-
1090./-
1091-
1092UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_AUTOMATIC_SEMICOLON;-
1093UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_SEMICOLON;-
1094/.-
1095 case $rule_number: {-
1096 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2));-
1097 node->type = AST::UiPublicMember::Signal;-
1098 node->propertyToken = loc(1);-
1099 node->typeToken = loc(2);-
1100 node->identifierToken = loc(2);-
1101 node->parameters = sym(4).UiParameterList;-
1102 node->semicolonToken = loc(6);-
1103 sym(1).Node = node;-
1104 } break;-
1105./-
1106-
1107UiObjectMember: T_SIGNAL T_IDENTIFIER T_AUTOMATIC_SEMICOLON;-
1108UiObjectMember: T_SIGNAL T_IDENTIFIER T_SEMICOLON;-
1109/.-
1110 case $rule_number: {-
1111 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(nullptr, stringRef(2));-
1112 node->type = AST::UiPublicMember::Signal;-
1113 node->propertyToken = loc(1);-
1114 node->typeToken = loc(2);-
1115 node->identifierToken = loc(2);-
1116 node->semicolonToken = loc(3);-
1117 sym(1).Node = node;-
1118 } break;-
1119./-
1120-
1121UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_AUTOMATIC_SEMICOLON;-
1122UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_SEMICOLON;-
1123/.-
1124 case $rule_number: {-
1125 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6));-
1126 node->typeModifier = stringRef(2);-
1127 node->propertyToken = loc(1);-
1128 node->typeModifierToken = loc(2);-
1129 node->typeToken = loc(4);-
1130 node->identifierToken = loc(6);-
1131 node->semicolonToken = loc(7);-
1132 sym(1).Node = node;-
1133 } break;-
1134./-
1135-
1136UiObjectMember: T_PROPERTY UiPropertyType QmlIdentifier T_AUTOMATIC_SEMICOLON;-
1137UiObjectMember: T_PROPERTY UiPropertyType QmlIdentifier T_SEMICOLON;-
1138/.-
1139 case $rule_number: {-
1140 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3));-
1141 node->propertyToken = loc(1);-
1142 node->typeToken = loc(2);-
1143 node->identifierToken = loc(3);-
1144 node->semicolonToken = loc(4);-
1145 sym(1).Node = node;-
1146 } break;-
1147./-
1148-
1149UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType QmlIdentifier T_AUTOMATIC_SEMICOLON;-
1150UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType QmlIdentifier T_SEMICOLON;-
1151/.-
1152 case $rule_number: {-
1153 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4));-
1154 node->isDefaultMember = true;-
1155 node->defaultToken = loc(1);-
1156 node->propertyToken = loc(2);-
1157 node->typeToken = loc(3);-
1158 node->identifierToken = loc(4);-
1159 node->semicolonToken = loc(5);-
1160 sym(1).Node = node;-
1161 } break;-
1162./-
1163-
1164UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_AUTOMATIC_SEMICOLON;-
1165UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_SEMICOLON;-
1166/.-
1167 case $rule_number: {-
1168 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(5).UiQualifiedId->finish(), stringRef(7));-
1169 node->isDefaultMember = true;-
1170 node->defaultToken = loc(1);-
1171 node->typeModifier = stringRef(3);-
1172 node->propertyToken = loc(2);-
1173 node->typeModifierToken = loc(2);-
1174 node->typeToken = loc(4);-
1175 node->identifierToken = loc(7);-
1176 node->semicolonToken = loc(8);-
1177 sym(1).Node = node;-
1178 } break;-
1179./-
1180-
1181UiObjectMember: T_PROPERTY UiPropertyType QmlIdentifier T_COLON UiScriptStatement;-
1182/.-
1183 case $rule_number: {-
1184 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3), sym(5).Statement);-
1185 node->propertyToken = loc(1);-
1186 node->typeToken = loc(2);-
1187 node->identifierToken = loc(3);-
1188 node->colonToken = loc(4);-
1189 sym(1).Node = node;-
1190 } break;-
1191./-
1192-
1193UiObjectMember: T_READONLY T_PROPERTY UiPropertyType QmlIdentifier T_COLON UiScriptStatement;-
1194/.-
1195 case $rule_number: {-
1196 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), sym(6).Statement);-
1197 node->isReadonlyMember = true;-
1198 node->readonlyToken = loc(1);-
1199 node->propertyToken = loc(2);-
1200 node->typeToken = loc(3);-
1201 node->identifierToken = loc(4);-
1202 node->colonToken = loc(5);-
1203 sym(1).Node = node;-
1204 } break;-
1205./-
1206-
1207UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType QmlIdentifier T_COLON UiScriptStatement;-
1208/.-
1209 case $rule_number: {-
1210 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4), sym(6).Statement);-
1211 node->isDefaultMember = true;-
1212 node->defaultToken = loc(1);-
1213 node->propertyToken = loc(2);-
1214 node->typeToken = loc(3);-
1215 node->identifierToken = loc(4);-
1216 node->colonToken = loc(5);-
1217 sym(1).Node = node;-
1218 } break;-
1219./-
1220-
1221UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT QmlIdentifier T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET;-
1222/.-
1223 case $rule_number: {-
1224 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(4).UiQualifiedId->finish(), stringRef(6));-
1225 node->typeModifier = stringRef(2);-
1226 node->propertyToken = loc(1);-
1227 node->typeModifierToken = loc(2);-
1228 node->typeToken = loc(4);-
1229 node->identifierToken = loc(6);-
1230 node->semicolonToken = loc(7); // insert a fake ';' before ':'-
1231-
1232 AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(6));-
1233 propertyName->identifierToken = loc(6);-
1234 propertyName->next = 0;-
1235-
1236 AST::UiArrayBinding *binding = new (pool) AST::UiArrayBinding(propertyName, sym(9).UiArrayMemberList->finish());-
1237 binding->colonToken = loc(7);-
1238 binding->lbracketToken = loc(8);-
1239 binding->rbracketToken = loc(10);-
1240-
1241 node->binding = binding;-
1242-
1243 sym(1).Node = node;-
1244 } break;-
1245./-
1246-
1247UiObjectMember: T_PROPERTY UiPropertyType QmlIdentifier T_COLON ExpressionStatementLookahead UiQualifiedId UiObjectInitializer;-
1248/.-
1249 case $rule_number: {-
1250 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(2).UiQualifiedId->finish(), stringRef(3));-
1251 node->propertyToken = loc(1);-
1252 node->typeToken = loc(2);-
1253 node->identifierToken = loc(3);-
1254 node->semicolonToken = loc(4); // insert a fake ';' before ':'-
1255-
1256 AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(3));-
1257 propertyName->identifierToken = loc(3);-
1258 propertyName->next = 0;-
1259-
1260 AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding(-
1261 propertyName, sym(6).UiQualifiedId, sym(7).UiObjectInitializer);-
1262 binding->colonToken = loc(4);-
1263-
1264 node->binding = binding;-
1265-
1266 sym(1).Node = node;-
1267 } break;-
1268./-
1269-
1270UiObjectMember: T_READONLY T_PROPERTY UiPropertyType QmlIdentifier T_COLON ExpressionStatementLookahead UiQualifiedId UiObjectInitializer;-
1271/.-
1272 case $rule_number: {-
1273 AST::UiPublicMember *node = new (pool) AST::UiPublicMember(sym(3).UiQualifiedId->finish(), stringRef(4));-
1274 node->isReadonlyMember = true;-
1275 node->readonlyToken = loc(1);-
1276 node->propertyToken = loc(2);-
1277 node->typeToken = loc(3);-
1278 node->identifierToken = loc(4);-
1279 node->semicolonToken = loc(5); // insert a fake ';' before ':'-
1280-
1281 AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(4));-
1282 propertyName->identifierToken = loc(4);-
1283 propertyName->next = 0;-
1284-
1285 AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding(-
1286 propertyName, sym(7).UiQualifiedId, sym(8).UiObjectInitializer);-
1287 binding->colonToken = loc(5);-
1288-
1289 node->binding = binding;-
1290-
1291 sym(1).Node = node;-
1292 } break;-
1293./-
1294-
1295UiObjectMember: FunctionDeclaration;-
1296/.-
1297 case $rule_number: {-
1298 sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node);-
1299 } break;-
1300./-
1301-
1302UiObjectMember: VariableStatement;-
1303/.-
1304 case $rule_number: {-
1305 sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node);-
1306 } break;-
1307./-
1308-
1309UiQualifiedId: MemberExpression;-
1310/.-
1311 case $rule_number: {-
1312 if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) {-
1313 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken,-
1314 QLatin1String("Ignored annotation")));-
1315-
1316 sym(1).Expression = mem->base;-
1317 }-
1318-
1319 if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) {-
1320 sym(1).UiQualifiedId = qualifiedId;-
1321 } else {-
1322 sym(1).UiQualifiedId = 0;-
1323-
1324 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),-
1325 QLatin1String("Expected a qualified name id")));-
1326-
1327 return false; // ### recover-
1328 }-
1329 } break;-
1330./-
1331-
1332UiObjectMember: T_ENUM T_IDENTIFIER T_LBRACE EnumMemberList T_RBRACE;-
1333/.-
1334 case $rule_number: {-
1335 AST::UiEnumDeclaration *enumDeclaration = new (pool) AST::UiEnumDeclaration(stringRef(2), sym(4).UiEnumMemberList->finish());-
1336 enumDeclaration->enumToken = loc(1);-
1337 enumDeclaration->rbraceToken = loc(5);-
1338 sym(1).Node = enumDeclaration;-
1339 break;-
1340 }-
1341./-
1342-
1343EnumMemberList: T_IDENTIFIER;-
1344/.-
1345 case $rule_number: {-
1346 AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1));-
1347 node->memberToken = loc(1);-
1348 sym(1).Node = node;-
1349 break;-
1350 }-
1351./-
1352-
1353EnumMemberList: T_IDENTIFIER T_EQ T_NUMERIC_LITERAL;-
1354/.-
1355 case $rule_number: {-
1356 AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(stringRef(1), sym(3).dval);-
1357 node->memberToken = loc(1);-
1358 node->valueToken = loc(3);-
1359 sym(1).Node = node;-
1360 break;-
1361 }-
1362./-
1363-
1364EnumMemberList: EnumMemberList T_COMMA T_IDENTIFIER;-
1365/.-
1366 case $rule_number: {-
1367 AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3));-
1368 node->memberToken = loc(3);-
1369 sym(1).Node = node;-
1370 break;-
1371 }-
1372./-
1373-
1374EnumMemberList: EnumMemberList T_COMMA T_IDENTIFIER T_EQ T_NUMERIC_LITERAL;-
1375/.-
1376 case $rule_number: {-
1377 AST::UiEnumMemberList *node = new (pool) AST::UiEnumMemberList(sym(1).UiEnumMemberList, stringRef(3), sym(5).dval);-
1378 node->memberToken = loc(3);-
1379 node->valueToken = loc(5);-
1380 sym(1).Node = node;-
1381 break;-
1382 }-
1383./-
1384-
1385QmlIdentifier: T_IDENTIFIER;-
1386QmlIdentifier: T_PROPERTY;-
1387QmlIdentifier: T_SIGNAL;-
1388QmlIdentifier: T_READONLY;-
1389QmlIdentifier: T_ON;-
1390QmlIdentifier: T_GET;-
1391QmlIdentifier: T_SET;-
1392QmlIdentifier: T_FROM;-
1393QmlIdentifier: T_OF;-
1394-
1395JsIdentifier: T_IDENTIFIER;-
1396JsIdentifier: T_PROPERTY;-
1397JsIdentifier: T_SIGNAL;-
1398JsIdentifier: T_READONLY;-
1399JsIdentifier: T_ON;-
1400JsIdentifier: T_GET;-
1401JsIdentifier: T_SET;-
1402JsIdentifier: T_FROM;-
1403JsIdentifier: T_STATIC;-
1404JsIdentifier: T_OF;-
1405-
1406IdentifierReference: JsIdentifier;-
1407BindingIdentifier: IdentifierReference;-
1408-
1409---------------------------------------------------------------------------------------------------------
1410-- Expressions-
1411---------------------------------------------------------------------------------------------------------
1412-
1413PrimaryExpression: T_THIS;-
1414/.-
1415 case $rule_number: {-
1416 AST::ThisExpression *node = new (pool) AST::ThisExpression();-
1417 node->thisToken = loc(1);-
1418 sym(1).Node = node;-
1419 } break;-
1420./-
1421-
1422PrimaryExpression: IdentifierReference;-
1423/.-
1424 case $rule_number: {-
1425 AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1));-
1426 node->identifierToken = loc(1);-
1427 sym(1).Node = node;-
1428 } break;-
1429./-
1430-
1431PrimaryExpression: Literal;-
1432PrimaryExpression: ArrayLiteral;-
1433PrimaryExpression: ObjectLiteral;-
1434PrimaryExpression: FunctionExpression;-
1435PrimaryExpression: ClassExpression;-
1436PrimaryExpression: GeneratorExpression;-
1437PrimaryExpression: RegularExpressionLiteral;-
1438PrimaryExpression: TemplateLiteral;-
1439-
1440PrimaryExpression: CoverParenthesizedExpressionAndArrowParameterList;-
1441/.-
1442 case $rule_number: {-
1443 if (coverExpressionType != CE_ParenthesizedExpression) {-
1444 syntaxError(coverExpressionErrorLocation, "Expected token ')'.");-
1445 return false;-
1446 }-
1447 } break;-
1448./-
1449-
1450-- Parsing of the CoverParenthesizedExpressionAndArrowParameterList is restricted to the one rule below when this is parsed as a primary expression-
1451CoverParenthesizedExpressionAndArrowParameterList: T_LPAREN Expression_In T_RPAREN;-
1452/.-
1453 case $rule_number: {-
1454 AST::NestedExpression *node = new (pool) AST::NestedExpression(sym(2).Expression);-
1455 node->lparenToken = loc(1);-
1456 node->rparenToken = loc(3);-
1457 sym(1).Node = node;-
1458 coverExpressionType = CE_ParenthesizedExpression;-
1459 } break;-
1460./-
1461-
1462CoverParenthesizedExpressionAndArrowParameterList: T_LPAREN T_RPAREN;-
1463/.-
1464 case $rule_number: {-
1465 sym(1).Node = nullptr;-
1466 coverExpressionErrorLocation = loc(2);-
1467 coverExpressionType = CE_FormalParameterList;-
1468 } break;-
1469./-
1470-
1471CoverParenthesizedExpressionAndArrowParameterList: T_LPAREN BindingRestElement T_RPAREN;-
1472/.-
1473 case $rule_number: {-
1474 AST::FormalParameterList *node = (new (pool) AST::FormalParameterList(nullptr, sym(2).PatternElement))->finish(pool);-
1475 sym(1).Node = node;-
1476 coverExpressionErrorLocation = loc(2);-
1477 coverExpressionType = CE_FormalParameterList;-
1478 } break;-
1479./-
1480-
1481CoverParenthesizedExpressionAndArrowParameterList: T_LPAREN Expression_In T_COMMA BindingRestElementOpt T_RPAREN;-
1482/.-
1483 case $rule_number: {-
1484 AST::FormalParameterList *list = sym(2).Expression->reparseAsFormalParameterList(pool);-
1485 if (!list) {-
1486 syntaxError(loc(1), "Invalid Arrow parameter list.");-
1487 return false;-
1488 }-
1489 if (sym(4).Node) {-
1490 list = new (pool) AST::FormalParameterList(list, sym(4).PatternElement);-
1491 }-
1492 coverExpressionErrorLocation = loc(4);-
1493 coverExpressionType = CE_FormalParameterList;-
1494 sym(1).Node = list->finish(pool);-
1495 } break;-
1496./-
1497-
1498Literal: T_NULL;-
1499/.-
1500 case $rule_number: {-
1501 AST::NullExpression *node = new (pool) AST::NullExpression();-
1502 node->nullToken = loc(1);-
1503 sym(1).Node = node;-
1504 } break;-
1505./-
1506-
1507Literal: T_TRUE;-
1508/.-
1509 case $rule_number: {-
1510 AST::TrueLiteral *node = new (pool) AST::TrueLiteral();-
1511 node->trueToken = loc(1);-
1512 sym(1).Node = node;-
1513 } break;-
1514./-
1515-
1516Literal: T_FALSE;-
1517/.-
1518 case $rule_number: {-
1519 AST::FalseLiteral *node = new (pool) AST::FalseLiteral();-
1520 node->falseToken = loc(1);-
1521 sym(1).Node = node;-
1522 } break;-
1523./-
1524-
1525Literal: T_NUMERIC_LITERAL;-
1526/.-
1527 case $rule_number: {-
1528 AST::NumericLiteral *node = new (pool) AST::NumericLiteral(sym(1).dval);-
1529 node->literalToken = loc(1);-
1530 sym(1).Node = node;-
1531 } break;-
1532./-
1533-
1534Literal: T_MULTILINE_STRING_LITERAL;-
1535/. case $rule_number: Q_FALLTHROUGH(); ./-
1536-
1537Literal: T_STRING_LITERAL;-
1538/.-
1539 case $rule_number: {-
1540 AST::StringLiteral *node = new (pool) AST::StringLiteral(stringRef(1));-
1541 node->literalToken = loc(1);-
1542 sym(1).Node = node;-
1543 } break;-
1544./-
1545-
1546RegularExpressionLiteral: T_DIVIDE_;-
1547/:-
1548#define J_SCRIPT_REGEXPLITERAL_RULE1 $rule_number-
1549:/-
1550/.-
1551{-
1552 Lexer::RegExpBodyPrefix prefix;-
1553 case $rule_number:-
1554 prefix = Lexer::NoPrefix;-
1555 goto scan_regexp;-
1556./-
1557-
1558RegularExpressionLiteral: T_DIVIDE_EQ;-
1559/:-
1560#define J_SCRIPT_REGEXPLITERAL_RULE2 $rule_number-
1561:/-
1562/.-
1563 case $rule_number:-
1564 prefix = Lexer::EqualPrefix;-
1565 goto scan_regexp;-
1566-
1567 scan_regexp: {-
1568 bool rx = lexer->scanRegExp(prefix);-
1569 if (!rx) {-
1570 diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));-
1571 return false;-
1572 }-
1573-
1574 loc(1).length = lexer->tokenLength();-
1575 yylloc = loc(1); // adjust the location of the current token-
1576-
1577 AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral(driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags());-
1578 node->literalToken = loc(1);-
1579 sym(1).Node = node;-
1580 } break;-
1581}-
1582./-
1583-
1584-
1585ArrayLiteral: T_LBRACKET ElisionOpt T_RBRACKET;-
1586/.-
1587 case $rule_number: {-
1588 AST::PatternElementList *list = nullptr;-
1589 if (sym(2).Elision)-
1590 list = (new (pool) AST::PatternElementList(sym(2).Elision, nullptr))->finish();-
1591 AST::ArrayPattern *node = new (pool) AST::ArrayPattern(list);-
1592 node->lbracketToken = loc(1);-
1593 node->rbracketToken = loc(3);-
1594 sym(1).Node = node;-
1595 } break;-
1596./-
1597-
1598ArrayLiteral: T_LBRACKET ElementList T_RBRACKET;-
1599/.-
1600 case $rule_number: {-
1601 AST::ArrayPattern *node = new (pool) AST::ArrayPattern(sym(2).PatternElementList->finish());-
1602 node->lbracketToken = loc(1);-
1603 node->rbracketToken = loc(3);-
1604 sym(1).Node = node;-
1605 } break;-
1606./-
1607-
1608ArrayLiteral: T_LBRACKET ElementList T_COMMA ElisionOpt T_RBRACKET;-
1609/.-
1610 case $rule_number: {-
1611 auto *list = sym(2).PatternElementList;-
1612 if (sym(4).Elision) {-
1613 AST::PatternElementList *l = new (pool) AST::PatternElementList(sym(4).Elision, nullptr);-
1614 list = list->append(l);-
1615 }-
1616 AST::ArrayPattern *node = new (pool) AST::ArrayPattern(list->finish());-
1617 node->lbracketToken = loc(1);-
1618 node->commaToken = loc(3);-
1619 node->rbracketToken = loc(5);-
1620 sym(1).Node = node;-
1621 Q_ASSERT(node->isValidArrayLiteral());-
1622 } break;-
1623./-
1624-
1625ElementList: AssignmentExpression_In;-
1626/.-
1627 case $rule_number: {-
1628 AST::PatternElement *e = new (pool) AST::PatternElement(sym(1).Expression);-
1629 sym(1).Node = new (pool) AST::PatternElementList(nullptr, e);-
1630 } break;-
1631./-
1632-
1633ElementList: Elision AssignmentExpression_In;-
1634/.-
1635 case $rule_number: {-
1636 AST::PatternElement *e = new (pool) AST::PatternElement(sym(2).Expression);-
1637 sym(1).Node = new (pool) AST::PatternElementList(sym(1).Elision->finish(), e);-
1638 } break;-
1639./-
1640-
1641ElementList: ElisionOpt SpreadElement;-
1642/.-
1643 case $rule_number: {-
1644 AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(1).Elision, sym(2).PatternElement);-
1645 sym(1).Node = node;-
1646 } break;-
1647./-
1648-
1649ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression_In;-
1650/.-
1651 case $rule_number: {-
1652 AST::PatternElement *e = new (pool) AST::PatternElement(sym(4).Expression);-
1653 AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(3).Elision, e);-
1654 sym(1).Node = sym(1).PatternElementList->append(node);-
1655 } break;-
1656./-
1657-
1658ElementList: ElementList T_COMMA ElisionOpt SpreadElement;-
1659/.-
1660 case $rule_number: {-
1661 AST::PatternElementList *node = new (pool) AST::PatternElementList(sym(3).Elision, sym(4).PatternElement);-
1662 sym(1).Node = sym(1).PatternElementList->append(node);-
1663 } break;-
1664./-
1665-
1666Elision: T_COMMA;-
1667/.-
1668 case $rule_number: {-
1669 AST::Elision *node = new (pool) AST::Elision();-
1670 node->commaToken = loc(1);-
1671 sym(1).Node = node;-
1672 } break;-
1673./-
1674-
1675Elision: Elision T_COMMA;-
1676/.-
1677 case $rule_number: {-
1678 AST::Elision *node = new (pool) AST::Elision(sym(1).Elision);-
1679 node->commaToken = loc(2);-
1680 sym(1).Node = node;-
1681 } break;-
1682./-
1683-
1684ElisionOpt: ;-
1685/.-
1686 case $rule_number: {-
1687 sym(1).Node = nullptr;-
1688 } break;-
1689./-
1690-
1691ElisionOpt: Elision;-
1692/.-
1693 case $rule_number: {-
1694 sym(1).Node = sym(1).Elision->finish();-
1695 } break;-
1696./-
1697-
1698SpreadElement: T_ELLIPSIS AssignmentExpression;-
1699/.-
1700 case $rule_number: {-
1701 AST::PatternElement *node = new (pool) AST::PatternElement(sym(2).Expression, AST::PatternElement::SpreadElement);-
1702 sym(1).Node = node;-
1703 } break;-
1704./-
1705-
1706ObjectLiteral: T_LBRACE T_RBRACE;-
1707/.-
1708 case $rule_number: {-
1709 AST::ObjectPattern *node = new (pool) AST::ObjectPattern();-
1710 node->lbraceToken = loc(1);-
1711 node->rbraceToken = loc(2);-
1712 sym(1).Node = node;-
1713 } break;-
1714./-
1715-
1716ObjectLiteral: T_LBRACE PropertyDefinitionList T_RBRACE;-
1717/.-
1718 case $rule_number: {-
1719 AST::ObjectPattern *node = new (pool) AST::ObjectPattern(sym(2).PatternPropertyList->finish());-
1720 node->lbraceToken = loc(1);-
1721 node->rbraceToken = loc(3);-
1722 sym(1).Node = node;-
1723 } break;-
1724./-
1725-
1726ObjectLiteral: T_LBRACE PropertyDefinitionList T_COMMA T_RBRACE;-
1727/.-
1728 case $rule_number: {-
1729 AST::ObjectPattern *node = new (pool) AST::ObjectPattern(sym(2).PatternPropertyList->finish());-
1730 node->lbraceToken = loc(1);-
1731 node->rbraceToken = loc(4);-
1732 sym(1).Node = node;-
1733 } break;-
1734./-
1735-
1736-
1737UiPropertyDefinitionList: UiPropertyDefinition;-
1738/. case $rule_number: Q_FALLTHROUGH(); ./-
1739PropertyDefinitionList: PropertyDefinition;-
1740/.-
1741 case $rule_number: {-
1742 sym(1).Node = new (pool) AST::PatternPropertyList(sym(1).PatternProperty);-
1743 } break;-
1744./-
1745-
1746UiPropertyDefinitionList: UiPropertyDefinitionList T_COMMA UiPropertyDefinition;-
1747/. case $rule_number: Q_FALLTHROUGH(); ./-
1748PropertyDefinitionList: PropertyDefinitionList T_COMMA PropertyDefinition;-
1749/.-
1750 case $rule_number: {-
1751 AST::PatternPropertyList *node = new (pool) AST::PatternPropertyList(sym(1).PatternPropertyList, sym(3).PatternProperty);-
1752 sym(1).Node = node;-
1753 } break;-
1754./-
1755-
1756PropertyDefinition: IdentifierReference;-
1757/.-
1758 case $rule_number: {-
1759 AST::IdentifierPropertyName *name = new (pool) AST::IdentifierPropertyName(stringRef(1));-
1760 name->propertyNameToken = loc(1);-
1761 AST::IdentifierExpression *expr = new (pool) AST::IdentifierExpression(stringRef(1));-
1762 expr->identifierToken = loc(1);-
1763 AST::PatternProperty *node = new (pool) AST::PatternProperty(name, expr);-
1764 node->colonToken = loc(2);-
1765 sym(1).Node = node;-
1766 } break;-
1767./-
1768-
1769-- Using this production should result in a syntax error when used in an ObjectLiteral-
1770PropertyDefinition: CoverInitializedName;-
1771-
1772CoverInitializedName: IdentifierReference Initializer_In;-
1773/.-
1774 case $rule_number: {-
1775 AST::IdentifierPropertyName *name = new (pool) AST::IdentifierPropertyName(stringRef(1));-
1776 name->propertyNameToken = loc(1);-
1777 AST::IdentifierExpression *left = new (pool) AST::IdentifierExpression(stringRef(1));-
1778 left->identifierToken = loc(1);-
1779 // if initializer is an anonymous function expression, we need to assign identifierref as it's name-
1780 if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression))-
1781 f->name = stringRef(1);-
1782 if (auto *c = asAnonymousClassDefinition(sym(2).Expression))-
1783 c->name = stringRef(1);-
1784 AST::BinaryExpression *assignment = new (pool) AST::BinaryExpression(left, QSOperator::Assign, sym(2).Expression);-
1785 AST::PatternProperty *node = new (pool) AST::PatternProperty(name, assignment);-
1786 node->colonToken = loc(1);-
1787 sym(1).Node = node;-
1788-
1789 } break;-
1790./-
1791-
1792UiPropertyDefinition: UiPropertyName T_COLON AssignmentExpression_In;-
1793/. case $rule_number: Q_FALLTHROUGH(); ./-
1794PropertyDefinition: PropertyName T_COLON AssignmentExpression_In;-
1795/.-
1796 case $rule_number: {-
1797 AST::PatternProperty *node = new (pool) AST::PatternProperty(sym(1).PropertyName, sym(3).Expression);-
1798 if (auto *f = asAnonymousFunctionDefinition(sym(3).Expression)) {-
1799 if (!AST::cast<AST::ComputedPropertyName *>(sym(1).PropertyName))-
1800 f->name = driver->newStringRef(sym(1).PropertyName->asString());-
1801 }-
1802 if (auto *c = asAnonymousClassDefinition(sym(3).Expression)) {-
1803 if (!AST::cast<AST::ComputedPropertyName *>(sym(1).PropertyName))-
1804 c->name = driver->newStringRef(sym(1).PropertyName->asString());-
1805 }-
1806 node->colonToken = loc(2);-
1807 sym(1).Node = node;-
1808 } break;-
1809./-
1810-
1811PropertyDefinition: MethodDefinition;-
1812-
1813PropertyName: LiteralPropertyName;-
1814PropertyName: ComputedPropertyName;-
1815-
1816LiteralPropertyName: IdentifierName;-
1817/.-
1818 case $rule_number: {-
1819 AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1));-
1820 node->propertyNameToken = loc(1);-
1821 sym(1).Node = node;-
1822 } break;-
1823./-
1824-
1825UiPropertyName: T_STRING_LITERAL;-
1826/. case $rule_number: Q_FALLTHROUGH(); ./-
1827LiteralPropertyName: T_STRING_LITERAL;-
1828/.-
1829 case $rule_number: {-
1830 AST::StringLiteralPropertyName *node = new (pool) AST::StringLiteralPropertyName(stringRef(1));-
1831 node->propertyNameToken = loc(1);-
1832 sym(1).Node = node;-
1833 } break;-
1834./-
1835-
1836UiPropertyName: T_NUMERIC_LITERAL;-
1837/. case $rule_number: Q_FALLTHROUGH(); ./-
1838LiteralPropertyName: T_NUMERIC_LITERAL;-
1839/.-
1840 case $rule_number: {-
1841 AST::NumericLiteralPropertyName *node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval);-
1842 node->propertyNameToken = loc(1);-
1843 sym(1).Node = node;-
1844 } break;-
1845./-
1846-
1847IdentifierName: IdentifierReference;-
1848IdentifierName: ReservedIdentifier;-
1849-
1850ReservedIdentifier: T_BREAK;-
1851ReservedIdentifier: T_CASE;-
1852ReservedIdentifier: T_CATCH;-
1853ReservedIdentifier: T_CONTINUE;-
1854ReservedIdentifier: T_DEFAULT;-
1855ReservedIdentifier: T_DELETE;-
1856ReservedIdentifier: T_DO;-
1857ReservedIdentifier: T_ELSE;-
1858ReservedIdentifier: T_ENUM;-
1859ReservedIdentifier: T_FALSE;-
1860ReservedIdentifier: T_FINALLY;-
1861ReservedIdentifier: T_FOR;-
1862ReservedIdentifier: T_FUNCTION;-
1863ReservedIdentifier: T_IF;-
1864ReservedIdentifier: T_IN;-
1865ReservedIdentifier: T_INSTANCEOF;-
1866ReservedIdentifier: T_NEW;-
1867ReservedIdentifier: T_NULL;-
1868ReservedIdentifier: T_RETURN;-
1869ReservedIdentifier: T_SWITCH;-
1870ReservedIdentifier: T_THIS;-
1871ReservedIdentifier: T_THROW;-
1872ReservedIdentifier: T_TRUE;-
1873ReservedIdentifier: T_TRY;-
1874ReservedIdentifier: T_TYPEOF;-
1875ReservedIdentifier: T_VAR;-
1876ReservedIdentifier: T_VOID;-
1877ReservedIdentifier: T_WHILE;-
1878ReservedIdentifier: T_CONST;-
1879ReservedIdentifier: T_LET;-
1880ReservedIdentifier: T_DEBUGGER;-
1881ReservedIdentifier: T_RESERVED_WORD;-
1882ReservedIdentifier: T_SUPER;-
1883ReservedIdentifier: T_WITH;-
1884ReservedIdentifier: T_CLASS;-
1885ReservedIdentifier: T_EXTENDS;-
1886ReservedIdentifier: T_EXPORT;-
1887-
1888ComputedPropertyName: T_LBRACKET AssignmentExpression_In T_RBRACKET;-
1889/.-
1890 case $rule_number: {-
1891 AST::ComputedPropertyName *node = new (pool) AST::ComputedPropertyName(sym(2).Expression);-
1892 node->propertyNameToken = loc(1);-
1893 sym(1).Node = node;-
1894 } break;-
1895./-
1896-
1897Initializer: T_EQ AssignmentExpression;-
1898/. case $rule_number: Q_FALLTHROUGH(); ./-
1899Initializer_In: T_EQ AssignmentExpression_In;-
1900/.-
1901case $rule_number: {-
1902 sym(1) = sym(2);-
1903} break;-
1904./-
1905-
1906-
1907InitializerOpt: ;-
1908/. case $rule_number: Q_FALLTHROUGH(); ./-
1909InitializerOpt_In: ;-
1910/.-
1911 case $rule_number: {-
1912 sym(1).Node = nullptr;-
1913 } break;-
1914./-
1915-
1916InitializerOpt: Initializer;-
1917InitializerOpt_In: Initializer_In;-
1918-
1919TemplateLiteral: T_NO_SUBSTITUTION_TEMPLATE;-
1920/. case $rule_number: Q_FALLTHROUGH(); ./-
1921-
1922TemplateSpans: T_TEMPLATE_TAIL;-
1923/.-
1924 case $rule_number: {-
1925 AST::TemplateLiteral *node = new (pool) AST::TemplateLiteral(stringRef(1), nullptr);-
1926 node->literalToken = loc(1);-
1927 sym(1).Node = node;-
1928 } break;-
1929./-
1930-
1931TemplateSpans: T_TEMPLATE_MIDDLE Expression TemplateSpans;-
1932/. case $rule_number: Q_FALLTHROUGH(); ./-
1933-
1934TemplateLiteral: T_TEMPLATE_HEAD Expression TemplateSpans;-
1935/.-
1936 case $rule_number: {-
1937 AST::TemplateLiteral *node = new (pool) AST::TemplateLiteral(stringRef(1), sym(2).Expression);-
1938 node->next = sym(3).Template;-
1939 node->literalToken = loc(1);-
1940 sym(1).Node = node;-
1941 } break;-
1942./-
1943-
1944-
1945MemberExpression: PrimaryExpression;-
1946-
1947Super: T_SUPER;-
1948/.-
1949 case $rule_number: {-
1950 AST::SuperLiteral *node = new (pool) AST::SuperLiteral();-
1951 node->superToken = loc(1);-
1952 sym(1).Node = node;-
1953 } break;-
1954./-
1955-
1956-
1957MemberExpression: Super T_LBRACKET Expression_In T_RBRACKET;-
1958/. case $rule_number: Q_FALLTHROUGH(); ./-
1959MemberExpression: MemberExpression T_LBRACKET Expression_In T_RBRACKET;-
1960/.-
1961 case $rule_number: {-
1962 AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression);-
1963 node->lbracketToken = loc(2);-
1964 node->rbracketToken = loc(4);-
1965 sym(1).Node = node;-
1966 } break;-
1967./-
1968-
1969-
1970-- the identifier has to be "target", catched at codegen time-
1971NewTarget: T_NEW T_DOT T_IDENTIFIER;-
1972/. case $rule_number:-
1973 {-
1974 AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1));-
1975 node->identifierToken= loc(1);-
1976 sym(1).Node = node;-
1977 } Q_FALLTHROUGH();-
1978./-
1979MemberExpression: Super T_DOT IdentifierName;-
1980/. case $rule_number: Q_FALLTHROUGH(); ./-
1981MemberExpression: MemberExpression T_DOT IdentifierName;-
1982/.-
1983 case $rule_number: {-
1984 AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3));-
1985 node->dotToken = loc(2);-
1986 node->identifierToken = loc(3);-
1987 sym(1).Node = node;-
1988 } break;-
1989./-
1990-
1991MemberExpression: MetaProperty;-
1992-
1993MemberExpression: T_NEW MemberExpression T_LPAREN Arguments T_RPAREN;-
1994/.-
1995 case $rule_number: {-
1996 AST::NewMemberExpression *node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList);-
1997 node->newToken = loc(1);-
1998 node->lparenToken = loc(3);-
1999 node->rparenToken = loc(5);-
2000 sym(1).Node = node;-
2001 } break;-
2002./-
2003-
2004MetaProperty: NewTarget;-
2005-
2006-
2007NewExpression: MemberExpression;-
2008-
2009NewExpression: T_NEW NewExpression;-
2010/.-
2011 case $rule_number: {-
2012 AST::NewExpression *node = new (pool) AST::NewExpression(sym(2).Expression);-
2013 node->newToken = loc(1);-
2014 sym(1).Node = node;-
2015 } break;-
2016./-
2017-
2018-
2019CallExpression: CallExpression TemplateLiteral;-
2020/. case $rule_number: Q_FALLTHROUGH(); ./-
2021MemberExpression: MemberExpression TemplateLiteral;-
2022/.-
2023 case $rule_number: {-
2024 AST::TaggedTemplate *node = new (pool) AST::TaggedTemplate(sym(1).Expression, sym(2).Template);-
2025 sym(1).Node = node;-
2026 } break;-
2027./-
2028-
2029CallExpression: MemberExpression T_LPAREN Arguments T_RPAREN;-
2030/.-
2031 case $rule_number: {-
2032 AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList);-
2033 node->lparenToken = loc(2);-
2034 node->rparenToken = loc(4);-
2035 sym(1).Node = node;-
2036 } break;-
2037./-
2038-
2039CallExpression: Super T_LPAREN Arguments T_RPAREN;-
2040/. case $rule_number: Q_FALLTHROUGH(); ./-
2041CallExpression: CallExpression T_LPAREN Arguments T_RPAREN;-
2042/.-
2043 case $rule_number: {-
2044 AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList);-
2045 node->lparenToken = loc(2);-
2046 node->rparenToken = loc(4);-
2047 sym(1).Node = node;-
2048 } break;-
2049./-
2050-
2051CallExpression: CallExpression T_LBRACKET Expression_In T_RBRACKET;-
2052/.-
2053 case $rule_number: {-
2054 AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression);-
2055 node->lbracketToken = loc(2);-
2056 node->rbracketToken = loc(4);-
2057 sym(1).Node = node;-
2058 } break;-
2059./-
2060-
2061CallExpression: CallExpression T_DOT IdentifierName;-
2062/.-
2063 case $rule_number: {-
2064 AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3));-
2065 node->dotToken = loc(2);-
2066 node->identifierToken = loc(3);-
2067 sym(1).Node = node;-
2068 } break;-
2069./-
2070-
2071Arguments: ;-
2072/.-
2073 case $rule_number: {-
2074 sym(1).Node = nullptr;-
2075 } break;-
2076./-
2077-
2078Arguments: ArgumentList;-
2079/. case $rule_number: Q_FALLTHROUGH(); ./-
2080Arguments: ArgumentList T_COMMA;-
2081/.-
2082 case $rule_number: {-
2083 sym(1).Node = sym(1).ArgumentList->finish();-
2084 } break;-
2085./-
2086-
2087ArgumentList: AssignmentExpression_In;-
2088/.-
2089 case $rule_number: {-
2090 sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression);-
2091 } break;-
2092./-
2093-
2094ArgumentList: T_ELLIPSIS AssignmentExpression_In;-
2095/.-
2096 case $rule_number: {-
2097 AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(2).Expression);-
2098 node->isSpreadElement = true;-
2099 sym(1).Node = node;-
2100 } break;-
2101./-
2102-
2103ArgumentList: ArgumentList T_COMMA AssignmentExpression_In;-
2104/.-
2105 case $rule_number: {-
2106 AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression);-
2107 node->commaToken = loc(2);-
2108 sym(1).Node = node;-
2109 } break;-
2110./-
2111-
2112ArgumentList: ArgumentList T_COMMA T_ELLIPSIS AssignmentExpression_In;-
2113/.-
2114 case $rule_number: {-
2115 AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(4).Expression);-
2116 node->commaToken = loc(2);-
2117 node->isSpreadElement = true;-
2118 sym(1).Node = node;-
2119 } break;-
2120./-
2121-
2122LeftHandSideExpression: NewExpression;-
2123LeftHandSideExpression: CallExpression;-
2124-
2125UpdateExpression: LeftHandSideExpression;-
2126-
2127UpdateExpression: LeftHandSideExpression T_PLUS_PLUS;-
2128/.-
2129 case $rule_number: {-
2130 AST::PostIncrementExpression *node = new (pool) AST::PostIncrementExpression(sym(1).Expression);-
2131 node->incrementToken = loc(2);-
2132 sym(1).Node = node;-
2133 } break;-
2134./-
2135-
2136UpdateExpression: LeftHandSideExpression T_MINUS_MINUS;-
2137/.-
2138 case $rule_number: {-
2139 AST::PostDecrementExpression *node = new (pool) AST::PostDecrementExpression(sym(1).Expression);-
2140 node->decrementToken = loc(2);-
2141 sym(1).Node = node;-
2142 } break;-
2143./-
2144-
2145UpdateExpression: T_PLUS_PLUS UnaryExpression;-
2146/.-
2147 case $rule_number: {-
2148 AST::PreIncrementExpression *node = new (pool) AST::PreIncrementExpression(sym(2).Expression);-
2149 node->incrementToken = loc(1);-
2150 sym(1).Node = node;-
2151 } break;-
2152./-
2153-
2154UpdateExpression: T_MINUS_MINUS UnaryExpression;-
2155/.-
2156 case $rule_number: {-
2157 AST::PreDecrementExpression *node = new (pool) AST::PreDecrementExpression(sym(2).Expression);-
2158 node->decrementToken = loc(1);-
2159 sym(1).Node = node;-
2160 } break;-
2161./-
2162-
2163UnaryExpression: UpdateExpression;-
2164-
2165UnaryExpression: T_DELETE UnaryExpression;-
2166/.-
2167 case $rule_number: {-
2168 AST::DeleteExpression *node = new (pool) AST::DeleteExpression(sym(2).Expression);-
2169 node->deleteToken = loc(1);-
2170 sym(1).Node = node;-
2171 } break;-
2172./-
2173-
2174UnaryExpression: T_VOID UnaryExpression;-
2175/.-
2176 case $rule_number: {-
2177 AST::VoidExpression *node = new (pool) AST::VoidExpression(sym(2).Expression);-
2178 node->voidToken = loc(1);-
2179 sym(1).Node = node;-
2180 } break;-
2181./-
2182-
2183UnaryExpression: T_TYPEOF UnaryExpression;-
2184/.-
2185 case $rule_number: {-
2186 AST::TypeOfExpression *node = new (pool) AST::TypeOfExpression(sym(2).Expression);-
2187 node->typeofToken = loc(1);-
2188 sym(1).Node = node;-
2189 } break;-
2190./-
2191-
2192UnaryExpression: T_PLUS UnaryExpression;-
2193/.-
2194 case $rule_number: {-
2195 AST::UnaryPlusExpression *node = new (pool) AST::UnaryPlusExpression(sym(2).Expression);-
2196 node->plusToken = loc(1);-
2197 sym(1).Node = node;-
2198 } break;-
2199./-
2200-
2201UnaryExpression: T_MINUS UnaryExpression;-
2202/.-
2203 case $rule_number: {-
2204 AST::UnaryMinusExpression *node = new (pool) AST::UnaryMinusExpression(sym(2).Expression);-
2205 node->minusToken = loc(1);-
2206 sym(1).Node = node;-
2207 } break;-
2208./-
2209-
2210UnaryExpression: T_TILDE UnaryExpression;-
2211/.-
2212 case $rule_number: {-
2213 AST::TildeExpression *node = new (pool) AST::TildeExpression(sym(2).Expression);-
2214 node->tildeToken = loc(1);-
2215 sym(1).Node = node;-
2216 } break;-
2217./-
2218-
2219UnaryExpression: T_NOT UnaryExpression;-
2220/.-
2221 case $rule_number: {-
2222 AST::NotExpression *node = new (pool) AST::NotExpression(sym(2).Expression);-
2223 node->notToken = loc(1);-
2224 sym(1).Node = node;-
2225 } break;-
2226./-
2227-
2228ExponentiationExpression: UnaryExpression;-
2229-
2230ExponentiationExpression: UpdateExpression T_STAR_STAR ExponentiationExpression;-
2231/.-
2232 case $rule_number: {-
2233 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Exp, sym(3).Expression);-
2234 node->operatorToken = loc(2);-
2235 sym(1).Node = node;-
2236 } break;-
2237./-
2238-
2239MultiplicativeExpression: ExponentiationExpression;-
2240-
2241MultiplicativeExpression: MultiplicativeExpression MultiplicativeOperator ExponentiationExpression;-
2242/.-
2243 case $rule_number: {-
2244 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression);-
2245 node->operatorToken = loc(2);-
2246 sym(1).Node = node;-
2247 } break;-
2248./-
2249-
2250MultiplicativeOperator: T_STAR;-
2251/.-
2252 case $rule_number: {-
2253 sym(1).ival = QSOperator::Mul;-
2254 } break;-
2255./-
2256-
2257MultiplicativeOperator: T_DIVIDE_;-
2258/.-
2259 case $rule_number: {-
2260 sym(1).ival = QSOperator::Div;-
2261 } break;-
2262./-
2263-
2264MultiplicativeOperator: T_REMAINDER;-
2265/.-
2266 case $rule_number: {-
2267 sym(1).ival = QSOperator::Mod;-
2268 } break;-
2269./-
2270-
2271AdditiveExpression: MultiplicativeExpression;-
2272-
2273AdditiveExpression: AdditiveExpression T_PLUS MultiplicativeExpression;-
2274/.-
2275 case $rule_number: {-
2276 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Add, sym(3).Expression);-
2277 node->operatorToken = loc(2);-
2278 sym(1).Node = node;-
2279 } break;-
2280./-
2281-
2282AdditiveExpression: AdditiveExpression T_MINUS MultiplicativeExpression;-
2283/.-
2284 case $rule_number: {-
2285 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Sub, sym(3).Expression);-
2286 node->operatorToken = loc(2);-
2287 sym(1).Node = node;-
2288 } break;-
2289./-
2290-
2291ShiftExpression: AdditiveExpression;-
2292-
2293ShiftExpression: ShiftExpression T_LT_LT AdditiveExpression;-
2294/.-
2295 case $rule_number: {-
2296 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::LShift, sym(3).Expression);-
2297 node->operatorToken = loc(2);-
2298 sym(1).Node = node;-
2299 } break;-
2300./-
2301-
2302ShiftExpression: ShiftExpression T_GT_GT AdditiveExpression;-
2303/.-
2304 case $rule_number: {-
2305 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::RShift, sym(3).Expression);-
2306 node->operatorToken = loc(2);-
2307 sym(1).Node = node;-
2308 } break;-
2309./-
2310-
2311ShiftExpression: ShiftExpression T_GT_GT_GT AdditiveExpression;-
2312/.-
2313 case $rule_number: {-
2314 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::URShift, sym(3).Expression);-
2315 node->operatorToken = loc(2);-
2316 sym(1).Node = node;-
2317 } break;-
2318./-
2319-
2320RelationalExpression_In: ShiftExpression;-
2321RelationalExpression: ShiftExpression;-
2322-
2323RelationalExpression_In: RelationalExpression_In RelationalOperator ShiftExpression;-
2324/. case $rule_number: Q_FALLTHROUGH(); ./-
2325RelationalExpression: RelationalExpression RelationalOperator ShiftExpression;-
2326/.-
2327 case $rule_number: {-
2328 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression);-
2329 node->operatorToken = loc(2);-
2330 sym(1).Node = node;-
2331 } break;-
2332./-
2333-
2334RelationalOperator: T_LT;-
2335/.-
2336 case $rule_number: {-
2337 sym(1).ival = QSOperator::Lt;-
2338 } break;-
2339./-
2340RelationalOperator: T_GT;-
2341/.-
2342 case $rule_number: {-
2343 sym(1).ival = QSOperator::Gt;-
2344 } break;-
2345./-
2346RelationalOperator: T_LE;-
2347/.-
2348 case $rule_number: {-
2349 sym(1).ival = QSOperator::Le;-
2350 } break;-
2351./-
2352RelationalOperator: T_GE;-
2353/.-
2354 case $rule_number: {-
2355 sym(1).ival = QSOperator::Ge;-
2356 } break;-
2357./-
2358RelationalOperator: T_INSTANCEOF;-
2359/.-
2360 case $rule_number: {-
2361 sym(1).ival = QSOperator::InstanceOf;-
2362 } break;-
2363./-
2364-
2365RelationalExpression_In: RelationalExpression_In T_IN ShiftExpression;-
2366/.-
2367 case $rule_number: {-
2368 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::In, sym(3).Expression);-
2369 node->operatorToken = loc(2);-
2370 sym(1).Node = node;-
2371 } break;-
2372./-
2373-
2374EqualityExpression_In: RelationalExpression_In;-
2375EqualityExpression: RelationalExpression;-
2376-
2377EqualityExpression_In: EqualityExpression_In EqualityOperator RelationalExpression_In;-
2378/. case $rule_number: Q_FALLTHROUGH(); ./-
2379EqualityExpression: EqualityExpression EqualityOperator RelationalExpression;-
2380/.-
2381 case $rule_number: {-
2382 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression);-
2383 node->operatorToken = loc(2);-
2384 sym(1).Node = node;-
2385 } break;-
2386./-
2387-
2388EqualityOperator: T_EQ_EQ;-
2389/.-
2390 case $rule_number: {-
2391 sym(1).ival = QSOperator::Equal;-
2392 } break;-
2393./-
2394EqualityOperator: T_NOT_EQ;-
2395/.-
2396 case $rule_number: {-
2397 sym(1).ival = QSOperator::NotEqual;-
2398 } break;-
2399./-
2400EqualityOperator: T_EQ_EQ_EQ;-
2401/.-
2402 case $rule_number: {-
2403 sym(1).ival = QSOperator::StrictEqual;-
2404 } break;-
2405./-
2406EqualityOperator: T_NOT_EQ_EQ;-
2407/.-
2408 case $rule_number: {-
2409 sym(1).ival = QSOperator::StrictNotEqual;-
2410 } break;-
2411./-
2412-
2413-
2414BitwiseANDExpression: EqualityExpression;-
2415XitwiseANDExpression_In: EqualityExpression_In;-
2416-
2417BitwiseANDExpression: BitwiseANDExpression T_AND EqualityExpression;-
2418/. case $rule_number: Q_FALLTHROUGH(); ./-
2419XitwiseANDExpression_In: XitwiseANDExpression_In T_AND EqualityExpression_In;-
2420/.-
2421 case $rule_number: {-
2422 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression);-
2423 node->operatorToken = loc(2);-
2424 sym(1).Node = node;-
2425 } break;-
2426./-
2427-
2428-
2429BitwiseXORExpression: BitwiseANDExpression;-
2430BitwiseXORExpression_In: XitwiseANDExpression_In;-
2431-
2432BitwiseXORExpression: BitwiseXORExpression T_XOR BitwiseANDExpression;-
2433/. case $rule_number: Q_FALLTHROUGH(); ./-
2434BitwiseXORExpression_In: BitwiseXORExpression_In T_XOR XitwiseANDExpression_In;-
2435/.-
2436 case $rule_number: {-
2437 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression);-
2438 node->operatorToken = loc(2);-
2439 sym(1).Node = node;-
2440 } break;-
2441./-
2442-
2443BitwiseORExpression: BitwiseXORExpression;-
2444BitwiseORExpression_In: BitwiseXORExpression_In;-
2445-
2446BitwiseORExpression: BitwiseORExpression T_OR BitwiseXORExpression;-
2447/. case $rule_number: Q_FALLTHROUGH(); ./-
2448BitwiseORExpression_In: BitwiseORExpression_In T_OR BitwiseXORExpression_In;-
2449/.-
2450 case $rule_number: {-
2451 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression);-
2452 node->operatorToken = loc(2);-
2453 sym(1).Node = node;-
2454 } break;-
2455./-
2456-
2457LogicalANDExpression: BitwiseORExpression;-
2458LogicalANDExpression_In: BitwiseORExpression_In;-
2459-
2460LogicalANDExpression: LogicalANDExpression T_AND_AND BitwiseORExpression;-
2461/. case $rule_number: Q_FALLTHROUGH(); ./-
2462LogicalANDExpression_In: LogicalANDExpression_In T_AND_AND BitwiseORExpression_In;-
2463/.-
2464 case $rule_number: {-
2465 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression);-
2466 node->operatorToken = loc(2);-
2467 sym(1).Node = node;-
2468 } break;-
2469./-
2470-
2471LogicalORExpression: LogicalANDExpression;-
2472LogicalORExpression_In: LogicalANDExpression_In;-
2473-
2474LogicalORExpression: LogicalORExpression T_OR_OR LogicalANDExpression;-
2475/. case $rule_number: Q_FALLTHROUGH(); ./-
2476LogicalORExpression_In: LogicalORExpression_In T_OR_OR LogicalANDExpression_In;-
2477/.-
2478 case $rule_number: {-
2479 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression);-
2480 node->operatorToken = loc(2);-
2481 sym(1).Node = node;-
2482 } break;-
2483./-
2484-
2485-
2486ConditionalExpression: LogicalORExpression;-
2487ConditionalExpression_In: LogicalORExpression_In;-
2488-
2489ConditionalExpression: LogicalORExpression T_QUESTION AssignmentExpression_In T_COLON AssignmentExpression;-
2490/. case $rule_number: Q_FALLTHROUGH(); ./-
2491ConditionalExpression_In: LogicalORExpression_In T_QUESTION AssignmentExpression_In T_COLON AssignmentExpression_In;-
2492/.-
2493 case $rule_number: {-
2494 AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression);-
2495 node->questionToken = loc(2);-
2496 node->colonToken = loc(4);-
2497 sym(1).Node = node;-
2498 } break;-
2499./-
2500-
2501AssignmentExpression: ConditionalExpression;-
2502AssignmentExpression_In: ConditionalExpression_In;-
2503-
2504AssignmentExpression: YieldExpression;-
2505AssignmentExpression_In: YieldExpression_In;-
2506-
2507AssignmentExpression: ArrowFunction;-
2508AssignmentExpression_In: ArrowFunction_In;-
2509-
2510AssignmentExpression: LeftHandSideExpression T_EQ AssignmentExpression;-
2511/. case $rule_number: Q_FALLTHROUGH(); ./-
2512AssignmentExpression_In: LeftHandSideExpression T_EQ AssignmentExpression_In;-
2513/.-
2514 case $rule_number: {-
2515 // need to convert the LHS to an AssignmentPattern if it was an Array/ObjectLiteral-
2516 if (AST::Pattern *p = sym(1).Expression->patternCast()) {-
2517 AST::SourceLocation errorLoc;-
2518 QString errorMsg;-
2519 if (!p->convertLiteralToAssignmentPattern(pool, &errorLoc, &errorMsg)) {-
2520 syntaxError(errorLoc, errorMsg);-
2521 return false;-
2522 }-
2523 }-
2524 // if lhs is an identifier expression and rhs is an anonymous function expression, we need to assign the name of lhs to the function-
2525 if (auto *f = asAnonymousFunctionDefinition(sym(3).Expression)) {-
2526 if (auto *id = AST::cast<AST::IdentifierExpression *>(sym(1).Expression))-
2527 f->name = id->name;-
2528 }-
2529 if (auto *c = asAnonymousClassDefinition(sym(3).Expression)) {-
2530 if (auto *id = AST::cast<AST::IdentifierExpression *>(sym(1).Expression))-
2531 c->name = id->name;-
2532 }-
2533-
2534 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Assign, sym(3).Expression);-
2535 node->operatorToken = loc(2);-
2536 sym(1).Node = node;-
2537 } break;-
2538./-
2539-
2540AssignmentExpression: LeftHandSideExpression AssignmentOperator AssignmentExpression;-
2541/. case $rule_number: Q_FALLTHROUGH(); ./-
2542AssignmentExpression_In: LeftHandSideExpression AssignmentOperator AssignmentExpression_In;-
2543/.-
2544 case $rule_number: {-
2545 AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression);-
2546 node->operatorToken = loc(2);-
2547 sym(1).Node = node;-
2548 } break;-
2549./-
2550-
2551AssignmentOperator: T_STAR_EQ;-
2552/.-
2553 case $rule_number: {-
2554 sym(1).ival = QSOperator::InplaceMul;-
2555 } break;-
2556./-
2557-
2558AssignmentOperator: T_STAR_STAR_EQ;-
2559/.-
2560 case $rule_number: {-
2561 sym(1).ival = QSOperator::InplaceExp;-
2562 } break;-
2563./-
2564-
2565AssignmentOperator: T_DIVIDE_EQ;-
2566/.-
2567 case $rule_number: {-
2568 sym(1).ival = QSOperator::InplaceDiv;-
2569 } break;-
2570./-
2571-
2572AssignmentOperator: T_REMAINDER_EQ;-
2573/.-
2574 case $rule_number: {-
2575 sym(1).ival = QSOperator::InplaceMod;-
2576 } break;-
2577./-
2578-
2579AssignmentOperator: T_PLUS_EQ;-
2580/.-
2581 case $rule_number: {-
2582 sym(1).ival = QSOperator::InplaceAdd;-
2583 } break;-
2584./-
2585-
2586AssignmentOperator: T_MINUS_EQ;-
2587/.-
2588 case $rule_number: {-
2589 sym(1).ival = QSOperator::InplaceSub;-
2590 } break;-
2591./-
2592-
2593AssignmentOperator: T_LT_LT_EQ;-
2594/.-
2595 case $rule_number: {-
2596 sym(1).ival = QSOperator::InplaceLeftShift;-
2597 } break;-
2598./-
2599-
2600AssignmentOperator: T_GT_GT_EQ;-
2601/.-
2602 case $rule_number: {-
2603 sym(1).ival = QSOperator::InplaceRightShift;-
2604 } break;-
2605./-
2606-
2607AssignmentOperator: T_GT_GT_GT_EQ;-
2608/.-
2609 case $rule_number: {-
2610 sym(1).ival = QSOperator::InplaceURightShift;-
2611 } break;-
2612./-
2613-
2614AssignmentOperator: T_AND_EQ;-
2615/.-
2616 case $rule_number: {-
2617 sym(1).ival = QSOperator::InplaceAnd;-
2618 } break;-
2619./-
2620-
2621AssignmentOperator: T_XOR_EQ;-
2622/.-
2623 case $rule_number: {-
2624 sym(1).ival = QSOperator::InplaceXor;-
2625 } break;-
2626./-
2627-
2628AssignmentOperator: T_OR_EQ;-
2629/.-
2630 case $rule_number: {-
2631 sym(1).ival = QSOperator::InplaceOr;-
2632 } break;-
2633./-
2634-
2635Expression: AssignmentExpression;-
2636Expression_In: AssignmentExpression_In;-
2637-
2638Expression: Expression T_COMMA AssignmentExpression;-
2639/. case $rule_number: Q_FALLTHROUGH(); ./-
2640Expression_In: Expression_In T_COMMA AssignmentExpression_In;-
2641/.-
2642 case $rule_number: {-
2643 AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression);-
2644 node->commaToken = loc(2);-
2645 sym(1).Node = node;-
2646 } break;-
2647./-
2648-
2649ExpressionOpt: ;-
2650/. case $rule_number: Q_FALLTHROUGH(); ./-
2651ExpressionOpt_In: ;-
2652/.-
2653 case $rule_number: {-
2654 sym(1).Node = nullptr;-
2655 } break;-
2656./-
2657-
2658ExpressionOpt: Expression;-
2659ExpressionOpt_In: Expression_In;-
2660-
2661-- Statements-
2662-
2663Statement: ExpressionStatementLookahead T_FORCE_BLOCK BlockStatement;-
2664/.-
2665 case $rule_number: {-
2666 sym(1).Node = sym(3).Node;-
2667 } break;-
2668./-
2669-
2670Statement: ExpressionStatementLookahead VariableStatement;-
2671/. case $rule_number: Q_FALLTHROUGH(); ./-
2672Statement: ExpressionStatementLookahead EmptyStatement;-
2673/. case $rule_number: Q_FALLTHROUGH(); ./-
2674Statement: ExpressionStatementLookahead ExpressionStatement;-
2675/. case $rule_number: Q_FALLTHROUGH(); ./-
2676Statement: ExpressionStatementLookahead IfStatement;-
2677/. case $rule_number: Q_FALLTHROUGH(); ./-
2678Statement: ExpressionStatementLookahead BreakableStatement;-
2679/. case $rule_number: Q_FALLTHROUGH(); ./-
2680Statement: ExpressionStatementLookahead ContinueStatement;-
2681/. case $rule_number: Q_FALLTHROUGH(); ./-
2682Statement: ExpressionStatementLookahead BreakStatement;-
2683/. case $rule_number: Q_FALLTHROUGH(); ./-
2684Statement: ExpressionStatementLookahead ReturnStatement;-
2685/. case $rule_number: Q_FALLTHROUGH(); ./-
2686Statement: ExpressionStatementLookahead WithStatement;-
2687/. case $rule_number: Q_FALLTHROUGH(); ./-
2688Statement: ExpressionStatementLookahead LabelledStatement;-
2689/. case $rule_number: Q_FALLTHROUGH(); ./-
2690Statement: ExpressionStatementLookahead ThrowStatement;-
2691/. case $rule_number: Q_FALLTHROUGH(); ./-
2692Statement: ExpressionStatementLookahead TryStatement;-
2693/. case $rule_number: Q_FALLTHROUGH(); ./-
2694Statement: ExpressionStatementLookahead DebuggerStatement;-
2695/.-
2696 case $rule_number: {-
2697 sym(1).Node = sym(2).Node;-
2698 } break;-
2699./-
2700-
2701Declaration: HoistableDeclaration;-
2702Declaration: ClassDeclaration;-
2703Declaration: LexicalDeclaration_In;-
2704-
2705HoistableDeclaration: FunctionDeclaration;-
2706HoistableDeclaration: GeneratorDeclaration;-
2707-
2708HoistableDeclaration_Default: FunctionDeclaration_Default;-
2709HoistableDeclaration_Default: GeneratorDeclaration_Default;-
2710-
2711BreakableStatement: IterationStatement;-
2712BreakableStatement: SwitchStatement;-
2713-
2714BlockStatement: Block;-
2715-
2716Block: T_LBRACE StatementListOpt T_RBRACE;-
2717/.-
2718 case $rule_number: {-
2719 AST::Block *node = new (pool) AST::Block(sym(2).StatementList);-
2720 node->lbraceToken = loc(1);-
2721 node->rbraceToken = loc(3);-
2722 sym(1).Node = node;-
2723 } break;-
2724./-
2725-
2726StatementList: StatementListItem;-
2727-
2728StatementList: StatementList StatementListItem;-
2729/.-
2730 case $rule_number: {-
2731 sym(1).StatementList = sym(1).StatementList->append(sym(2).StatementList);-
2732 } break;-
2733./-
2734-
2735StatementListItem: Statement;-
2736/.-
2737 case $rule_number: {-
2738 sym(1).StatementList = new (pool) AST::StatementList(sym(1).Statement);-
2739 } break;-
2740./-
2741-
2742StatementListItem: ExpressionStatementLookahead T_FORCE_DECLARATION Declaration T_AUTOMATIC_SEMICOLON;-
2743StatementListItem: ExpressionStatementLookahead T_FORCE_DECLARATION Declaration T_SEMICOLON;-
2744/.-
2745 case $rule_number: {-
2746 sym(1).Node = new (pool) AST::StatementList(sym(3).FunctionDeclaration);-
2747 } break;-
2748./-
2749-
2750StatementListOpt: ExpressionStatementLookahead;-
2751/.-
2752 case $rule_number: {-
2753 sym(1).Node = nullptr;-
2754 } break;-
2755./-
2756-
2757StatementListOpt: StatementList;-
2758/.-
2759 case $rule_number: {-
2760 sym(1).Node = sym(1).StatementList->finish();-
2761 } break;-
2762./-
2763-
2764LetOrConst: T_LET;-
2765/.-
2766 case $rule_number: {-
2767 sym(1).scope = AST::VariableScope::Let;-
2768 } break;-
2769./-
2770LetOrConst: T_CONST;-
2771/.-
2772 case $rule_number: {-
2773 sym(1).scope = AST::VariableScope::Const;-
2774 } break;-
2775./-
2776-
2777Var: T_VAR;-
2778/.-
2779 case $rule_number: {-
2780 sym(1).scope = AST::VariableScope::Var;-
2781 } break;-
2782./-
2783-
2784LexicalDeclaration: LetOrConst BindingList;-
2785/. case $rule_number: Q_FALLTHROUGH(); ./-
2786LexicalDeclaration_In: LetOrConst BindingList_In;-
2787/. case $rule_number: Q_FALLTHROUGH(); ./-
2788VarDeclaration: Var VariableDeclarationList;-
2789/. case $rule_number: Q_FALLTHROUGH(); ./-
2790VarDeclaration_In: Var VariableDeclarationList_In;-
2791/.-
2792 case $rule_number: {-
2793 AST::VariableStatement *node = new (pool) AST::VariableStatement(sym(2).VariableDeclarationList->finish(sym(1).scope));-
2794 node->declarationKindToken = loc(1);-
2795 sym(1).Node = node;-
2796 } break;-
2797./-
2798-
2799VariableStatement: VarDeclaration_In T_AUTOMATIC_SEMICOLON;-
2800VariableStatement: VarDeclaration_In T_SEMICOLON;-
2801-
2802BindingList: LexicalBinding_In;-
2803/. case $rule_number: Q_FALLTHROUGH(); ./-
2804BindingList_In: LexicalBinding_In;-
2805/. case $rule_number: Q_FALLTHROUGH(); ./-
2806VariableDeclarationList: VariableDeclaration;-
2807/. case $rule_number: Q_FALLTHROUGH(); ./-
2808VariableDeclarationList_In: VariableDeclaration_In;-
2809/.-
2810 case $rule_number: {-
2811 sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).PatternElement);-
2812 } break;-
2813./-
2814-
2815BindingList: BindingList T_COMMA LexicalBinding;-
2816/. case $rule_number: Q_FALLTHROUGH(); ./-
2817BindingList_In: BindingList_In T_COMMA LexicalBinding_In;-
2818/. case $rule_number: Q_FALLTHROUGH(); ./-
2819VariableDeclarationList: VariableDeclarationList T_COMMA VariableDeclaration;-
2820/. case $rule_number: Q_FALLTHROUGH(); ./-
2821VariableDeclarationList_In: VariableDeclarationList_In T_COMMA VariableDeclaration_In;-
2822/.-
2823 case $rule_number: {-
2824 AST::VariableDeclarationList *node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).PatternElement);-
2825 node->commaToken = loc(2);-
2826 sym(1).Node = node;-
2827 } break;-
2828./-
2829-
2830LexicalBinding: BindingIdentifier InitializerOpt;-
2831/. case $rule_number: Q_FALLTHROUGH(); ./-
2832LexicalBinding_In: BindingIdentifier InitializerOpt_In;-
2833/. case $rule_number: Q_FALLTHROUGH(); ./-
2834VariableDeclaration: BindingIdentifier InitializerOpt;-
2835/. case $rule_number: Q_FALLTHROUGH(); ./-
2836VariableDeclaration_In: BindingIdentifier InitializerOpt_In;-
2837/.-
2838 case $rule_number: {-
2839 auto *node = new (pool) AST::PatternElement(stringRef(1), sym(2).Expression);-
2840 node->identifierToken = loc(1);-
2841 sym(1).Node = node;-
2842 // if initializer is an anonymous function expression, we need to assign identifierref as it's name-
2843 if (auto *f = asAnonymousFunctionDefinition(sym(2).Expression))-
2844 f->name = stringRef(1);-
2845 if (auto *c = asAnonymousClassDefinition(sym(2).Expression))-
2846 c->name = stringRef(1);-
2847 } break;-
2848./-
2849-
2850LexicalBinding: BindingPattern Initializer;-
2851