1%pure_parser
2
3%{
4
5/*
6 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
7 *  Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
8 *  Copyright (C) 2007 Eric Seidel <eric@webkit.org>
9 *
10 *  This library is free software; you can redistribute it and/or
11 *  modify it under the terms of the GNU Lesser General Public
12 *  License as published by the Free Software Foundation; either
13 *  version 2 of the License, or (at your option) any later version.
14 *
15 *  This library is distributed in the hope that it will be useful,
16 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 *  Lesser General Public License for more details.
19 *
20 *  You should have received a copy of the GNU Lesser General Public
21 *  License along with this library; if not, write to the Free Software
22 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23 *
24 */
25
26#include "config.h"
27
28#include "JSObject.h"
29#include "JSString.h"
30#include "Lexer.h"
31#include "NodeConstructors.h"
32#include "NodeInfo.h"
33#include <stdlib.h>
34#include <string.h>
35#include <wtf/MathExtras.h>
36
37#define YYMALLOC fastMalloc
38#define YYFREE fastFree
39
40#define YYMAXDEPTH 10000
41#define YYENABLE_NLS 0
42
43// Default values for bison.
44#define YYDEBUG 0 // Set to 1 to debug a parse error.
45#define jscyydebug 0 // Set to 1 to debug a parse error.
46#if !OS(DARWIN)
47// Avoid triggering warnings in older bison by not setting this on the Darwin platform.
48// FIXME: Is this still needed?
49#define YYERROR_VERBOSE
50#endif
51
52int jscyyerror(const char*);
53
54static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
55
56#define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr)
57#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*GLOBAL_DATA->lexer, yychar)) YYABORT; } while (0)
58
59using namespace JSC;
60using namespace std;
61
62static ExpressionNode* makeAssignNode(JSGlobalData*, ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end);
63static ExpressionNode* makePrefixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
64static ExpressionNode* makePostfixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
65static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData*, const Identifier& getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
66static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData*, ExpressionNodeInfo function, ArgumentsNodeInfo, int start, int divot, int end);
67static ExpressionNode* makeTypeOfNode(JSGlobalData*, ExpressionNode*);
68static ExpressionNode* makeDeleteNode(JSGlobalData*, ExpressionNode*, int start, int divot, int end);
69static ExpressionNode* makeNegateNode(JSGlobalData*, ExpressionNode*);
70static NumberNode* makeNumberNode(JSGlobalData*, double);
71static ExpressionNode* makeBitwiseNotNode(JSGlobalData*, ExpressionNode*);
72static ExpressionNode* makeMultNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
73static ExpressionNode* makeDivNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
74static ExpressionNode* makeAddNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
75static ExpressionNode* makeSubNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
76static ExpressionNode* makeLeftShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
77static ExpressionNode* makeRightShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
78static StatementNode* makeVarStatementNode(JSGlobalData*, ExpressionNode*);
79static ExpressionNode* combineCommaNodes(JSGlobalData*, ExpressionNode* list, ExpressionNode* init);
80
81#if COMPILER(MSVC)
82
83#pragma warning(disable: 4065)
84#pragma warning(disable: 4244)
85#pragma warning(disable: 4702)
86
87#endif
88
89#define YYPARSE_PARAM globalPtr
90#define YYLEX_PARAM globalPtr
91
92template <typename T> inline NodeDeclarationInfo<T> createNodeDeclarationInfo(T node,
93    ParserArenaData<DeclarationStacks::VarStack>* varDecls,
94    ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
95    CodeFeatures info, int numConstants)
96{
97    ASSERT((info & ~AllFeatures) == 0);
98    NodeDeclarationInfo<T> result = { node, varDecls, funcDecls, info, numConstants };
99    return result;
100}
101
102template <typename T> inline NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
103{
104    ASSERT((info & ~AllFeatures) == 0);
105    NodeInfo<T> result = { node, info, numConstants };
106    return result;
107}
108
109template <typename T> inline T mergeDeclarationLists(T decls1, T decls2)
110{
111    // decls1 or both are null
112    if (!decls1)
113        return decls2;
114    // only decls1 is non-null
115    if (!decls2)
116        return decls1;
117
118    // Both are non-null
119    decls1->data.append(decls2->data);
120
121    // Manually release as much as possible from the now-defunct declaration lists
122    // to avoid accumulating so many unused heap allocated vectors.
123    decls2->data.clear();
124
125    return decls1;
126}
127
128static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
129{
130    if (!varDecls)
131        varDecls = new (globalData) ParserArenaData<DeclarationStacks::VarStack>;
132
133    varDecls->data.append(make_pair(&ident, attrs));
134}
135
136static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
137{
138    unsigned attrs = DeclarationStacks::IsConstant;
139    if (decl->hasInitializer())
140        attrs |= DeclarationStacks::HasInitializer;
141    appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs);
142}
143
144%}
145
146%union {
147    int                 intValue;
148    double              doubleValue;
149    const Identifier*   ident;
150
151    // expression subtrees
152    ExpressionNodeInfo  expressionNode;
153    FuncDeclNodeInfo    funcDeclNode;
154    PropertyNodeInfo    propertyNode;
155    ArgumentsNodeInfo   argumentsNode;
156    ConstDeclNodeInfo   constDeclNode;
157    CaseBlockNodeInfo   caseBlockNode;
158    CaseClauseNodeInfo  caseClauseNode;
159    FuncExprNodeInfo    funcExprNode;
160
161    // statement nodes
162    StatementNodeInfo   statementNode;
163    FunctionBodyNode*   functionBodyNode;
164    ProgramNode*        programNode;
165
166    SourceElementsInfo  sourceElements;
167    PropertyListInfo    propertyList;
168    ArgumentListInfo    argumentList;
169    VarDeclListInfo     varDeclList;
170    ConstDeclListInfo   constDeclList;
171    ClauseListInfo      clauseList;
172    ElementListInfo     elementList;
173    ParameterListInfo   parameterList;
174
175    Operator            op;
176}
177
178%{
179
180template <typename T> inline void setStatementLocation(StatementNode* statement, const T& start, const T& end)
181{
182    statement->setLoc(start.first_line, end.last_line);
183}
184
185static inline void setExceptionLocation(ThrowableExpressionData* node, unsigned start, unsigned divot, unsigned end)
186{
187    node->setExceptionSourceCode(divot, divot - start, end - divot);
188}
189
190%}
191
192%start Program
193
194/* literals */
195%token NULLTOKEN TRUETOKEN FALSETOKEN
196
197/* keywords */
198%token BREAK CASE DEFAULT FOR NEW VAR CONSTTOKEN CONTINUE
199%token FUNCTION RETURN VOIDTOKEN DELETETOKEN
200%token IF THISTOKEN DO WHILE INTOKEN INSTANCEOF TYPEOF
201%token SWITCH WITH RESERVED
202%token THROW TRY CATCH FINALLY
203%token DEBUGGER
204
205/* give an if without an else higher precedence than an else to resolve the ambiguity */
206%nonassoc IF_WITHOUT_ELSE
207%nonassoc ELSE
208
209/* punctuators */
210%token EQEQ NE                     /* == and != */
211%token STREQ STRNEQ                /* === and !== */
212%token LE GE                       /* < and > */
213%token OR AND                      /* || and && */
214%token PLUSPLUS MINUSMINUS         /* ++ and --  */
215%token LSHIFT                      /* << */
216%token RSHIFT URSHIFT              /* >> and >>> */
217%token PLUSEQUAL MINUSEQUAL        /* += and -= */
218%token MULTEQUAL DIVEQUAL          /* *= and /= */
219%token LSHIFTEQUAL                 /* <<= */
220%token RSHIFTEQUAL URSHIFTEQUAL    /* >>= and >>>= */
221%token ANDEQUAL MODEQUAL           /* &= and %= */
222%token XOREQUAL OREQUAL            /* ^= and |= */
223%token <intValue> OPENBRACE        /* { (with char offset) */
224%token <intValue> CLOSEBRACE       /* } (with char offset) */
225
226/* terminal types */
227%token <doubleValue> NUMBER
228%token <ident> IDENT STRING
229
230/* automatically inserted semicolon */
231%token AUTOPLUSPLUS AUTOMINUSMINUS
232
233/* non-terminal types */
234%type <expressionNode>  Literal ArrayLiteral
235
236%type <expressionNode>  PrimaryExpr PrimaryExprNoBrace
237%type <expressionNode>  MemberExpr MemberExprNoBF /* BF => brace or function */
238%type <expressionNode>  NewExpr NewExprNoBF
239%type <expressionNode>  CallExpr CallExprNoBF
240%type <expressionNode>  LeftHandSideExpr LeftHandSideExprNoBF
241%type <expressionNode>  PostfixExpr PostfixExprNoBF
242%type <expressionNode>  UnaryExpr UnaryExprNoBF UnaryExprCommon
243%type <expressionNode>  MultiplicativeExpr MultiplicativeExprNoBF
244%type <expressionNode>  AdditiveExpr AdditiveExprNoBF
245%type <expressionNode>  ShiftExpr ShiftExprNoBF
246%type <expressionNode>  RelationalExpr RelationalExprNoIn RelationalExprNoBF
247%type <expressionNode>  EqualityExpr EqualityExprNoIn EqualityExprNoBF
248%type <expressionNode>  BitwiseANDExpr BitwiseANDExprNoIn BitwiseANDExprNoBF
249%type <expressionNode>  BitwiseXORExpr BitwiseXORExprNoIn BitwiseXORExprNoBF
250%type <expressionNode>  BitwiseORExpr BitwiseORExprNoIn BitwiseORExprNoBF
251%type <expressionNode>  LogicalANDExpr LogicalANDExprNoIn LogicalANDExprNoBF
252%type <expressionNode>  LogicalORExpr LogicalORExprNoIn LogicalORExprNoBF
253%type <expressionNode>  ConditionalExpr ConditionalExprNoIn ConditionalExprNoBF
254%type <expressionNode>  AssignmentExpr AssignmentExprNoIn AssignmentExprNoBF
255%type <expressionNode>  Expr ExprNoIn ExprNoBF
256
257%type <expressionNode>  ExprOpt ExprNoInOpt
258
259%type <statementNode>   Statement Block
260%type <statementNode>   VariableStatement ConstStatement EmptyStatement ExprStatement
261%type <statementNode>   IfStatement IterationStatement ContinueStatement
262%type <statementNode>   BreakStatement ReturnStatement WithStatement
263%type <statementNode>   SwitchStatement LabelledStatement
264%type <statementNode>   ThrowStatement TryStatement
265%type <statementNode>   DebuggerStatement
266
267%type <expressionNode>  Initializer InitializerNoIn
268%type <statementNode>   FunctionDeclaration
269%type <funcExprNode>    FunctionExpr
270%type <functionBodyNode> FunctionBody
271%type <sourceElements>  SourceElements
272%type <parameterList>   FormalParameterList
273%type <op>              AssignmentOperator
274%type <argumentsNode>   Arguments
275%type <argumentList>    ArgumentList
276%type <varDeclList>     VariableDeclarationList VariableDeclarationListNoIn
277%type <constDeclList>   ConstDeclarationList
278%type <constDeclNode>   ConstDeclaration
279%type <caseBlockNode>   CaseBlock
280%type <caseClauseNode>  CaseClause DefaultClause
281%type <clauseList>      CaseClauses CaseClausesOpt
282%type <intValue>        Elision ElisionOpt
283%type <elementList>     ElementList
284%type <propertyNode>    Property
285%type <propertyList>    PropertyList
286%%
287
288// FIXME: There are currently two versions of the grammar in this file, the normal one, and the NoNodes version used for
289// lazy recompilation of FunctionBodyNodes.  We should move to generating the two versions from a script to avoid bugs.
290// In the mean time, make sure to make any changes to the grammar in both versions.
291
292Literal:
293    NULLTOKEN                           { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NullNode(GLOBAL_DATA), 0, 1); }
294  | TRUETOKEN                           { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, true), 0, 1); }
295  | FALSETOKEN                          { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, false), 0, 1); }
296  | NUMBER                              { $$ = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, $1), 0, 1); }
297  | STRING                              { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *$1), 0, 1); }
298  | '/' /* regexp */                    {
299                                            Lexer& l = *GLOBAL_DATA->lexer;
300                                            const Identifier* pattern;
301                                            const Identifier* flags;
302                                            if (!l.scanRegExp(pattern, flags))
303                                                YYABORT;
304                                            RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
305                                            int size = pattern->size() + 2; // + 2 for the two /'s
306                                            setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size);
307                                            $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
308                                        }
309  | DIVEQUAL /* regexp with /= */       {
310                                            Lexer& l = *GLOBAL_DATA->lexer;
311                                            const Identifier* pattern;
312                                            const Identifier* flags;
313                                            if (!l.scanRegExp(pattern, flags, '='))
314                                                YYABORT;
315                                            RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
316                                            int size = pattern->size() + 2; // + 2 for the two /'s
317                                            setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size);
318                                            $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
319                                        }
320;
321
322Property:
323    IDENT ':' AssignmentExpr            { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
324  | STRING ':' AssignmentExpr           { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
325  | NUMBER ':' AssignmentExpr           { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, $1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
326  | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE    { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, 0, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); if (!$$.m_node) YYABORT; }
327  | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
328                                                             {
329                                                                 $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, $4.m_node.head, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
330                                                                 if ($4.m_features & ArgumentsFeature)
331                                                                     $7->setUsesArguments();
332                                                                 setStatementLocation($7, @6, @8);
333                                                                 if (!$$.m_node)
334                                                                     YYABORT;
335                                                             }
336;
337
338PropertyList:
339    Property                            { $$.m_node.head = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $1.m_node);
340                                          $$.m_node.tail = $$.m_node.head;
341                                          $$.m_features = $1.m_features;
342                                          $$.m_numConstants = $1.m_numConstants; }
343  | PropertyList ',' Property           { $$.m_node.head = $1.m_node.head;
344                                          $$.m_node.tail = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $3.m_node, $1.m_node.tail);
345                                          $$.m_features = $1.m_features | $3.m_features;
346                                          $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
347;
348
349PrimaryExpr:
350    PrimaryExprNoBrace
351  | OPENBRACE CLOSEBRACE                             { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA), 0, 0); }
352  | OPENBRACE PropertyList CLOSEBRACE                { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
353  /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
354  | OPENBRACE PropertyList ',' CLOSEBRACE            { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
355;
356
357PrimaryExprNoBrace:
358    THISTOKEN                           { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ThisNode(GLOBAL_DATA), ThisFeature, 0); }
359  | Literal
360  | ArrayLiteral
361  | IDENT                               { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ResolveNode(GLOBAL_DATA, *$1, @1.first_column), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
362  | '(' Expr ')'                        { $$ = $2; }
363;
364
365ArrayLiteral:
366    '[' ElisionOpt ']'                  { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2), 0, $2 ? 1 : 0); }
367  | '[' ElementList ']'                 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
368  | '[' ElementList ',' ElisionOpt ']'  { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $4, $2.m_node.head), $2.m_features, $4 ? $2.m_numConstants + 1 : $2.m_numConstants); }
369;
370
371ElementList:
372    ElisionOpt AssignmentExpr           { $$.m_node.head = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1, $2.m_node);
373                                          $$.m_node.tail = $$.m_node.head;
374                                          $$.m_features = $2.m_features;
375                                          $$.m_numConstants = $2.m_numConstants; }
376  | ElementList ',' ElisionOpt AssignmentExpr
377                                        { $$.m_node.head = $1.m_node.head;
378                                          $$.m_node.tail = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1.m_node.tail, $3, $4.m_node);
379                                          $$.m_features = $1.m_features | $4.m_features;
380                                          $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; }
381;
382
383ElisionOpt:
384    /* nothing */                       { $$ = 0; }
385  | Elision
386;
387
388Elision:
389    ','                                 { $$ = 1; }
390  | Elision ','                         { $$ = $1 + 1; }
391;
392
393MemberExpr:
394    PrimaryExpr
395  | FunctionExpr                        { $$ = createNodeInfo<ExpressionNode*>($1.m_node, $1.m_features, $1.m_numConstants); }
396  | MemberExpr '[' Expr ']'             { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
397                                          setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
398                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
399                                        }
400  | MemberExpr '.' IDENT                { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
401                                          setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
402                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
403                                        }
404  | NEW MemberExpr Arguments            { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
405                                          setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
406                                          $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
407                                        }
408;
409
410MemberExprNoBF:
411    PrimaryExprNoBrace
412  | MemberExprNoBF '[' Expr ']'         { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
413                                          setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
414                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
415                                        }
416  | MemberExprNoBF '.' IDENT            { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
417                                          setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
418                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
419                                        }
420  | NEW MemberExpr Arguments            { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
421                                          setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
422                                          $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
423                                        }
424;
425
426NewExpr:
427    MemberExpr
428  | NEW NewExpr                         { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
429                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
430                                          $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
431                                        }
432;
433
434NewExprNoBF:
435    MemberExprNoBF
436  | NEW NewExpr                         { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
437                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
438                                          $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
439                                        }
440;
441
442CallExpr:
443    MemberExpr Arguments                { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
444  | CallExpr Arguments                  { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
445  | CallExpr '[' Expr ']'               { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
446                                          setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
447                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
448                                        }
449  | CallExpr '.' IDENT                  { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
450                                          setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
451                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); }
452;
453
454CallExprNoBF:
455    MemberExprNoBF Arguments            { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
456  | CallExprNoBF Arguments              { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
457  | CallExprNoBF '[' Expr ']'           { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
458                                          setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
459                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
460                                        }
461  | CallExprNoBF '.' IDENT              { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
462                                          setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
463                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
464                                        }
465;
466
467Arguments:
468    '(' ')'                             { $$ = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA), 0, 0); }
469  | '(' ArgumentList ')'                { $$ = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
470;
471
472ArgumentList:
473    AssignmentExpr                      { $$.m_node.head = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node);
474                                          $$.m_node.tail = $$.m_node.head;
475                                          $$.m_features = $1.m_features;
476                                          $$.m_numConstants = $1.m_numConstants; }
477  | ArgumentList ',' AssignmentExpr     { $$.m_node.head = $1.m_node.head;
478                                          $$.m_node.tail = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node.tail, $3.m_node);
479                                          $$.m_features = $1.m_features | $3.m_features;
480                                          $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
481;
482
483LeftHandSideExpr:
484    NewExpr
485  | CallExpr
486;
487
488LeftHandSideExprNoBF:
489    NewExprNoBF
490  | CallExprNoBF
491;
492
493PostfixExpr:
494    LeftHandSideExpr
495  | LeftHandSideExpr PLUSPLUS           { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
496  | LeftHandSideExpr MINUSMINUS         { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
497;
498
499PostfixExprNoBF:
500    LeftHandSideExprNoBF
501  | LeftHandSideExprNoBF PLUSPLUS       { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
502  | LeftHandSideExprNoBF MINUSMINUS     { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
503;
504
505UnaryExprCommon:
506    DELETETOKEN UnaryExpr               { $$ = createNodeInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, $2.m_node, @1.first_column, @2.last_column, @2.last_column), $2.m_features, $2.m_numConstants); }
507  | VOIDTOKEN UnaryExpr                 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) VoidNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants + 1); }
508  | TYPEOF UnaryExpr                    { $$ = createNodeInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
509  | PLUSPLUS UnaryExpr                  { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
510  | AUTOPLUSPLUS UnaryExpr              { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
511  | MINUSMINUS UnaryExpr                { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
512  | AUTOMINUSMINUS UnaryExpr            { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
513  | '+' UnaryExpr                       { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
514  | '-' UnaryExpr                       { $$ = createNodeInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
515  | '~' UnaryExpr                       { $$ = createNodeInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
516  | '!' UnaryExpr                       { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
517
518UnaryExpr:
519    PostfixExpr
520  | UnaryExprCommon
521;
522
523UnaryExprNoBF:
524    PostfixExprNoBF
525  | UnaryExprCommon
526;
527
528MultiplicativeExpr:
529    UnaryExpr
530  | MultiplicativeExpr '*' UnaryExpr    { $$ = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
531  | MultiplicativeExpr '/' UnaryExpr    { $$ = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
532  | MultiplicativeExpr '%' UnaryExpr    { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
533;
534
535MultiplicativeExprNoBF:
536    UnaryExprNoBF
537  | MultiplicativeExprNoBF '*' UnaryExpr
538                                        { $$ = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
539  | MultiplicativeExprNoBF '/' UnaryExpr
540                                        { $$ = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
541  | MultiplicativeExprNoBF '%' UnaryExpr
542                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
543;
544
545AdditiveExpr:
546    MultiplicativeExpr
547  | AdditiveExpr '+' MultiplicativeExpr { $$ = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
548  | AdditiveExpr '-' MultiplicativeExpr { $$ = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
549;
550
551AdditiveExprNoBF:
552    MultiplicativeExprNoBF
553  | AdditiveExprNoBF '+' MultiplicativeExpr
554                                        { $$ = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
555  | AdditiveExprNoBF '-' MultiplicativeExpr
556                                        { $$ = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
557;
558
559ShiftExpr:
560    AdditiveExpr
561  | ShiftExpr LSHIFT AdditiveExpr       { $$ = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
562  | ShiftExpr RSHIFT AdditiveExpr       { $$ = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
563  | ShiftExpr URSHIFT AdditiveExpr      { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
564;
565
566ShiftExprNoBF:
567    AdditiveExprNoBF
568  | ShiftExprNoBF LSHIFT AdditiveExpr   { $$ = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
569  | ShiftExprNoBF RSHIFT AdditiveExpr   { $$ = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
570  | ShiftExprNoBF URSHIFT AdditiveExpr  { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
571;
572
573RelationalExpr:
574    ShiftExpr
575  | RelationalExpr '<' ShiftExpr        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
576  | RelationalExpr '>' ShiftExpr        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
577  | RelationalExpr LE ShiftExpr         { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
578  | RelationalExpr GE ShiftExpr         { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
579  | RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
580                                          setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
581                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
582  | RelationalExpr INTOKEN ShiftExpr    { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
583                                          setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
584                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
585;
586
587RelationalExprNoIn:
588    ShiftExpr
589  | RelationalExprNoIn '<' ShiftExpr    { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
590  | RelationalExprNoIn '>' ShiftExpr    { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
591  | RelationalExprNoIn LE ShiftExpr     { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
592  | RelationalExprNoIn GE ShiftExpr     { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
593  | RelationalExprNoIn INSTANCEOF ShiftExpr
594                                        { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
595                                          setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
596                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
597;
598
599RelationalExprNoBF:
600    ShiftExprNoBF
601  | RelationalExprNoBF '<' ShiftExpr    { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
602  | RelationalExprNoBF '>' ShiftExpr    { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
603  | RelationalExprNoBF LE ShiftExpr     { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
604  | RelationalExprNoBF GE ShiftExpr     { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
605  | RelationalExprNoBF INSTANCEOF ShiftExpr
606                                        { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
607                                          setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
608                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
609  | RelationalExprNoBF INTOKEN ShiftExpr
610                                        { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
611                                          setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
612                                          $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
613;
614
615EqualityExpr:
616    RelationalExpr
617  | EqualityExpr EQEQ RelationalExpr    { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
618  | EqualityExpr NE RelationalExpr      { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
619  | EqualityExpr STREQ RelationalExpr   { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
620  | EqualityExpr STRNEQ RelationalExpr  { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
621;
622
623EqualityExprNoIn:
624    RelationalExprNoIn
625  | EqualityExprNoIn EQEQ RelationalExprNoIn
626                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
627  | EqualityExprNoIn NE RelationalExprNoIn
628                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
629  | EqualityExprNoIn STREQ RelationalExprNoIn
630                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
631  | EqualityExprNoIn STRNEQ RelationalExprNoIn
632                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
633;
634
635EqualityExprNoBF:
636    RelationalExprNoBF
637  | EqualityExprNoBF EQEQ RelationalExpr
638                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
639  | EqualityExprNoBF NE RelationalExpr  { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
640  | EqualityExprNoBF STREQ RelationalExpr
641                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
642  | EqualityExprNoBF STRNEQ RelationalExpr
643                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
644;
645
646BitwiseANDExpr:
647    EqualityExpr
648  | BitwiseANDExpr '&' EqualityExpr     { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
649;
650
651BitwiseANDExprNoIn:
652    EqualityExprNoIn
653  | BitwiseANDExprNoIn '&' EqualityExprNoIn
654                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
655;
656
657BitwiseANDExprNoBF:
658    EqualityExprNoBF
659  | BitwiseANDExprNoBF '&' EqualityExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
660;
661
662BitwiseXORExpr:
663    BitwiseANDExpr
664  | BitwiseXORExpr '^' BitwiseANDExpr   { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
665;
666
667BitwiseXORExprNoIn:
668    BitwiseANDExprNoIn
669  | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn
670                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
671;
672
673BitwiseXORExprNoBF:
674    BitwiseANDExprNoBF
675  | BitwiseXORExprNoBF '^' BitwiseANDExpr
676                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
677;
678
679BitwiseORExpr:
680    BitwiseXORExpr
681  | BitwiseORExpr '|' BitwiseXORExpr    { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
682;
683
684BitwiseORExprNoIn:
685    BitwiseXORExprNoIn
686  | BitwiseORExprNoIn '|' BitwiseXORExprNoIn
687                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
688;
689
690BitwiseORExprNoBF:
691    BitwiseXORExprNoBF
692  | BitwiseORExprNoBF '|' BitwiseXORExpr
693                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
694;
695
696LogicalANDExpr:
697    BitwiseORExpr
698  | LogicalANDExpr AND BitwiseORExpr    { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
699;
700
701LogicalANDExprNoIn:
702    BitwiseORExprNoIn
703  | LogicalANDExprNoIn AND BitwiseORExprNoIn
704                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
705;
706
707LogicalANDExprNoBF:
708    BitwiseORExprNoBF
709  | LogicalANDExprNoBF AND BitwiseORExpr
710                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
711;
712
713LogicalORExpr:
714    LogicalANDExpr
715  | LogicalORExpr OR LogicalANDExpr     { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
716;
717
718LogicalORExprNoIn:
719    LogicalANDExprNoIn
720  | LogicalORExprNoIn OR LogicalANDExprNoIn
721                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
722;
723
724LogicalORExprNoBF:
725    LogicalANDExprNoBF
726  | LogicalORExprNoBF OR LogicalANDExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
727;
728
729ConditionalExpr:
730    LogicalORExpr
731  | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr
732                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
733;
734
735ConditionalExprNoIn:
736    LogicalORExprNoIn
737  | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn
738                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
739;
740
741ConditionalExprNoBF:
742    LogicalORExprNoBF
743  | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr
744                                        { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
745;
746
747AssignmentExpr:
748    ConditionalExpr
749  | LeftHandSideExpr AssignmentOperator AssignmentExpr
750                                        { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
751                                                                                                     @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
752                                        }
753;
754
755AssignmentExprNoIn:
756    ConditionalExprNoIn
757  | LeftHandSideExpr AssignmentOperator AssignmentExprNoIn
758                                        { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
759                                                                                                     @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
760                                        }
761;
762
763AssignmentExprNoBF:
764    ConditionalExprNoBF
765  | LeftHandSideExprNoBF AssignmentOperator AssignmentExpr
766                                        { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
767                                                                                                     @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
768                                        }
769;
770
771AssignmentOperator:
772    '='                                 { $$ = OpEqual; }
773  | PLUSEQUAL                           { $$ = OpPlusEq; }
774  | MINUSEQUAL                          { $$ = OpMinusEq; }
775  | MULTEQUAL                           { $$ = OpMultEq; }
776  | DIVEQUAL                            { $$ = OpDivEq; }
777  | LSHIFTEQUAL                         { $$ = OpLShift; }
778  | RSHIFTEQUAL                         { $$ = OpRShift; }
779  | URSHIFTEQUAL                        { $$ = OpURShift; }
780  | ANDEQUAL                            { $$ = OpAndEq; }
781  | XOREQUAL                            { $$ = OpXOrEq; }
782  | OREQUAL                             { $$ = OpOrEq; }
783  | MODEQUAL                            { $$ = OpModEq; }
784;
785
786Expr:
787    AssignmentExpr
788  | Expr ',' AssignmentExpr             { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
789;
790
791ExprNoIn:
792    AssignmentExprNoIn
793  | ExprNoIn ',' AssignmentExprNoIn     { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
794;
795
796ExprNoBF:
797    AssignmentExprNoBF
798  | ExprNoBF ',' AssignmentExpr         { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
799;
800
801Statement:
802    Block
803  | VariableStatement
804  | ConstStatement
805  | FunctionDeclaration
806  | EmptyStatement
807  | ExprStatement
808  | IfStatement
809  | IterationStatement
810  | ContinueStatement
811  | BreakStatement
812  | ReturnStatement
813  | WithStatement
814  | SwitchStatement
815  | LabelledStatement
816  | ThrowStatement
817  | TryStatement
818  | DebuggerStatement
819;
820
821Block:
822    OPENBRACE CLOSEBRACE                { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
823                                          setStatementLocation($$.m_node, @1, @2); }
824  | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
825                                          setStatementLocation($$.m_node, @1, @3); }
826;
827
828VariableStatement:
829    VAR VariableDeclarationList ';'     { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
830                                          setStatementLocation($$.m_node, @1, @3); }
831  | VAR VariableDeclarationList error   { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
832                                          setStatementLocation($$.m_node, @1, @2);
833                                          AUTO_SEMICOLON; }
834;
835
836VariableDeclarationList:
837    IDENT                               { $$.m_node = 0;
838                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
839                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
840                                          $$.m_funcDeclarations = 0;
841                                          $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
842                                          $$.m_numConstants = 0;
843                                        }
844  | IDENT Initializer                   { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
845                                          setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
846                                          $$.m_node = node;
847                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
848                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
849                                          $$.m_funcDeclarations = 0;
850                                          $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features;
851                                          $$.m_numConstants = $2.m_numConstants;
852                                        }
853  | VariableDeclarationList ',' IDENT
854                                        { $$.m_node = $1.m_node;
855                                          $$.m_varDeclarations = $1.m_varDeclarations;
856                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
857                                          $$.m_funcDeclarations = 0;
858                                          $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
859                                          $$.m_numConstants = $1.m_numConstants;
860                                        }
861  | VariableDeclarationList ',' IDENT Initializer
862                                        { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
863                                          setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
864                                          $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
865                                          $$.m_varDeclarations = $1.m_varDeclarations;
866                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
867                                          $$.m_funcDeclarations = 0;
868                                          $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features;
869                                          $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
870                                        }
871;
872
873VariableDeclarationListNoIn:
874    IDENT                               { $$.m_node = 0;
875                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
876                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
877                                          $$.m_funcDeclarations = 0;
878                                          $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
879                                          $$.m_numConstants = 0;
880                                        }
881  | IDENT InitializerNoIn               { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
882                                          setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
883                                          $$.m_node = node;
884                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
885                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
886                                          $$.m_funcDeclarations = 0;
887                                          $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features;
888                                          $$.m_numConstants = $2.m_numConstants;
889                                        }
890  | VariableDeclarationListNoIn ',' IDENT
891                                        { $$.m_node = $1.m_node;
892                                          $$.m_varDeclarations = $1.m_varDeclarations;
893                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
894                                          $$.m_funcDeclarations = 0;
895                                          $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
896                                          $$.m_numConstants = $1.m_numConstants;
897                                        }
898  | VariableDeclarationListNoIn ',' IDENT InitializerNoIn
899                                        { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
900                                          setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
901                                          $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
902                                          $$.m_varDeclarations = $1.m_varDeclarations;
903                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
904                                          $$.m_funcDeclarations = 0;
905                                          $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features;
906                                          $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
907                                        }
908;
909
910ConstStatement:
911    CONSTTOKEN ConstDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
912                                          setStatementLocation($$.m_node, @1, @3); }
913  | CONSTTOKEN ConstDeclarationList error
914                                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
915                                          setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
916;
917
918ConstDeclarationList:
919    ConstDeclaration                    { $$.m_node.head = $1.m_node;
920                                          $$.m_node.tail = $$.m_node.head;
921                                          $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
922                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $1.m_node);
923                                          $$.m_funcDeclarations = 0;
924                                          $$.m_features = $1.m_features;
925                                          $$.m_numConstants = $1.m_numConstants;
926    }
927  | ConstDeclarationList ',' ConstDeclaration
928                                        { $$.m_node.head = $1.m_node.head;
929                                          $1.m_node.tail->m_next = $3.m_node;
930                                          $$.m_node.tail = $3.m_node;
931                                          $$.m_varDeclarations = $1.m_varDeclarations;
932                                          appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $3.m_node);
933                                          $$.m_funcDeclarations = 0;
934                                          $$.m_features = $1.m_features | $3.m_features;
935                                          $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
936;
937
938ConstDeclaration:
939    IDENT                               { $$ = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, 0), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
940  | IDENT Initializer                   { $$ = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, $2.m_node), ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features, $2.m_numConstants); }
941;
942
943Initializer:
944    '=' AssignmentExpr                  { $$ = $2; }
945;
946
947InitializerNoIn:
948    '=' AssignmentExprNoIn              { $$ = $2; }
949;
950
951EmptyStatement:
952    ';'                                 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); }
953;
954
955ExprStatement:
956    ExprNoBF ';'                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
957                                          setStatementLocation($$.m_node, @1, @2); }
958  | ExprNoBF error                      { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
959                                          setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
960;
961
962IfStatement:
963    IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE
964                                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
965                                          setStatementLocation($$.m_node, @1, @4); }
966  | IF '(' Expr ')' Statement ELSE Statement
967                                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node),
968                                                                                         mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations),
969                                                                                         mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
970                                                                                         $3.m_features | $5.m_features | $7.m_features,
971                                                                                         $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
972                                          setStatementLocation($$.m_node, @1, @4); }
973;
974
975IterationStatement:
976    DO Statement WHILE '(' Expr ')' ';'    { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants);
977                                             setStatementLocation($$.m_node, @1, @3); }
978  | DO Statement WHILE '(' Expr ')' error  { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants);
979                                             setStatementLocation($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
980  | WHILE '(' Expr ')' Statement        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WhileNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
981                                          setStatementLocation($$.m_node, @1, @4); }
982  | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement
983                                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node, $9.m_node, false), $9.m_varDeclarations, $9.m_funcDeclarations,
984                                                                                         $3.m_features | $5.m_features | $7.m_features | $9.m_features,
985                                                                                         $3.m_numConstants + $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
986                                          setStatementLocation($$.m_node, @1, @8);
987                                        }
988  | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement
989                                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true),
990                                                                                         mergeDeclarationLists($4.m_varDeclarations, $10.m_varDeclarations),
991                                                                                         mergeDeclarationLists($4.m_funcDeclarations, $10.m_funcDeclarations),
992                                                                                         $4.m_features | $6.m_features | $8.m_features | $10.m_features,
993                                                                                         $4.m_numConstants + $6.m_numConstants + $8.m_numConstants + $10.m_numConstants);
994                                          setStatementLocation($$.m_node, @1, @9); }
995  | FOR '(' LeftHandSideExpr INTOKEN Expr ')' Statement
996                                        {
997                                            ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node);
998                                            setExceptionLocation(node, @3.first_column, @3.last_column, @5.last_column);
999                                            $$ = createNodeDeclarationInfo<StatementNode*>(node, $7.m_varDeclarations, $7.m_funcDeclarations,
1000                                                                                           $3.m_features | $5.m_features | $7.m_features,
1001                                                                                           $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
1002                                            setStatementLocation($$.m_node, @1, @6);
1003                                        }
1004  | FOR '(' VAR IDENT INTOKEN Expr ')' Statement
1005                                        { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, 0, $6.m_node, $8.m_node, @5.first_column, @5.first_column - @4.first_column, @6.last_column - @5.first_column);
1006                                          setExceptionLocation(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
1007                                          appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
1008                                          $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $8.m_varDeclarations, $8.m_funcDeclarations, ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $6.m_features | $8.m_features, $6.m_numConstants + $8.m_numConstants);
1009                                          setStatementLocation($$.m_node, @1, @7); }
1010  | FOR '(' VAR IDENT InitializerNoIn INTOKEN Expr ')' Statement
1011                                        { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, $5.m_node, $7.m_node, $9.m_node, @5.first_column, @5.first_column - @4.first_column, @5.last_column - @5.first_column);
1012                                          setExceptionLocation(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
1013                                          appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
1014                                          $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $9.m_varDeclarations, $9.m_funcDeclarations,
1015                                                                                         ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $5.m_features | $7.m_features | $9.m_features,
1016                                                                                         $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
1017                                          setStatementLocation($$.m_node, @1, @8); }
1018;
1019
1020ExprOpt:
1021    /* nothing */                       { $$ = createNodeInfo<ExpressionNode*>(0, 0, 0); }
1022  | Expr
1023;
1024
1025ExprNoInOpt:
1026    /* nothing */                       { $$ = createNodeInfo<ExpressionNode*>(0, 0, 0); }
1027  | ExprNoIn
1028;
1029
1030ContinueStatement:
1031    CONTINUE ';'                        { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
1032                                          setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1033                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1034                                          setStatementLocation($$.m_node, @1, @2); }
1035  | CONTINUE error                      { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
1036                                          setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1037                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1038                                          setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
1039  | CONTINUE IDENT ';'                  { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
1040                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1041                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1042                                          setStatementLocation($$.m_node, @1, @3); }
1043  | CONTINUE IDENT error                { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
1044                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1045                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1046                                          setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
1047;
1048
1049BreakStatement:
1050    BREAK ';'                           { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
1051                                          setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1052                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
1053  | BREAK error                         { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
1054                                          setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1055                                          $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
1056  | BREAK IDENT ';'                     { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
1057                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1058                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @3); }
1059  | BREAK IDENT error                   { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
1060                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1061                                          $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
1062;
1063
1064ReturnStatement:
1065    RETURN ';'                          { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
1066                                          setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1067                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
1068  | RETURN error                        { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
1069                                          setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1070                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
1071  | RETURN Expr ';'                     { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
1072                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1073                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @3); }
1074  | RETURN Expr error                   { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
1075                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1076                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
1077;
1078
1079WithStatement:
1080    WITH '(' Expr ')' Statement         { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WithNode(GLOBAL_DATA, $3.m_node, $5.m_node, @3.last_column, @3.last_column - @3.first_column),
1081                                                                                         $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features | WithFeature, $3.m_numConstants + $5.m_numConstants);
1082                                          setStatementLocation($$.m_node, @1, @4); }
1083;
1084
1085SwitchStatement:
1086    SWITCH '(' Expr ')' CaseBlock       { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations,
1087                                                                                         $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
1088                                          setStatementLocation($$.m_node, @1, @4); }
1089;
1090
1091CaseBlock:
1092    OPENBRACE CaseClausesOpt CLOSEBRACE              { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, 0, 0), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); }
1093  | OPENBRACE CaseClausesOpt DefaultClause CaseClausesOpt CLOSEBRACE
1094                                        { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, $3.m_node, $4.m_node.head),
1095                                                                                         mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $3.m_varDeclarations), $4.m_varDeclarations),
1096                                                                                         mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $3.m_funcDeclarations), $4.m_funcDeclarations),
1097                                                                                         $2.m_features | $3.m_features | $4.m_features,
1098                                                                                         $2.m_numConstants + $3.m_numConstants + $4.m_numConstants); }
1099;
1100
1101CaseClausesOpt:
1102  /* nothing */                         { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; }
1103  | CaseClauses
1104;
1105
1106CaseClauses:
1107    CaseClause                          { $$.m_node.head = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node);
1108                                          $$.m_node.tail = $$.m_node.head;
1109                                          $$.m_varDeclarations = $1.m_varDeclarations;
1110                                          $$.m_funcDeclarations = $1.m_funcDeclarations;
1111                                          $$.m_features = $1.m_features;
1112                                          $$.m_numConstants = $1.m_numConstants; }
1113  | CaseClauses CaseClause              { $$.m_node.head = $1.m_node.head;
1114                                          $$.m_node.tail = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node.tail, $2.m_node);
1115                                          $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1116                                          $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1117                                          $$.m_features = $1.m_features | $2.m_features;
1118                                          $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
1119                                        }
1120;
1121
1122CaseClause:
1123    CASE Expr ':'                       { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node), 0, 0, $2.m_features, $2.m_numConstants); }
1124  | CASE Expr ':' SourceElements        { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node, $4.m_node), $4.m_varDeclarations, $4.m_funcDeclarations, $2.m_features | $4.m_features, $2.m_numConstants + $4.m_numConstants); }
1125;
1126
1127DefaultClause:
1128    DEFAULT ':'                         { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); }
1129  | DEFAULT ':' SourceElements          { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0, $3.m_node), $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); }
1130;
1131
1132LabelledStatement:
1133    IDENT ':' Statement                 { LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *$1, $3.m_node);
1134                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1135                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); }
1136;
1137
1138ThrowStatement:
1139    THROW Expr ';'                      { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
1140                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1141                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2);
1142                                        }
1143  | THROW Expr error                    { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
1144                                          setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1145                                          $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON;
1146                                        }
1147;
1148
1149TryStatement:
1150    TRY Block FINALLY Block             { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->emptyIdentifier, false, 0, $4.m_node),
1151                                                                                         mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations),
1152                                                                                         mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
1153                                                                                         $2.m_features | $4.m_features,
1154                                                                                         $2.m_numConstants + $4.m_numConstants);
1155                                          setStatementLocation($$.m_node, @1, @2); }
1156  | TRY Block CATCH '(' IDENT ')' Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, 0),
1157                                                                                         mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations),
1158                                                                                         mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations),
1159                                                                                         $2.m_features | $7.m_features | CatchFeature,
1160                                                                                         $2.m_numConstants + $7.m_numConstants);
1161                                          setStatementLocation($$.m_node, @1, @2); }
1162  | TRY Block CATCH '(' IDENT ')' Block FINALLY Block
1163                                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, $9.m_node),
1164                                                                                         mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), $9.m_varDeclarations),
1165                                                                                         mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $9.m_funcDeclarations),
1166                                                                                         $2.m_features | $7.m_features | $9.m_features | CatchFeature,
1167                                                                                         $2.m_numConstants + $7.m_numConstants + $9.m_numConstants);
1168                                          setStatementLocation($$.m_node, @1, @2); }
1169;
1170
1171DebuggerStatement:
1172    DEBUGGER ';'                        { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
1173                                          setStatementLocation($$.m_node, @1, @2); }
1174  | DEBUGGER error                      { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
1175                                          setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
1176;
1177
1178FunctionDeclaration:
1179    FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); setStatementLocation($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body()); }
1180  | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1181      {
1182          $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0);
1183          if ($4.m_features & ArgumentsFeature)
1184              $7->setUsesArguments();
1185          setStatementLocation($7, @6, @8);
1186          $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body());
1187      }
1188;
1189
1190FunctionExpr:
1191    FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->emptyIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); }
1192    | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1193      {
1194          $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->emptyIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
1195          if ($3.m_features & ArgumentsFeature)
1196              $6->setUsesArguments();
1197          setStatementLocation($6, @5, @7);
1198      }
1199  | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); }
1200  | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1201      {
1202          $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0);
1203          if ($4.m_features & ArgumentsFeature)
1204              $7->setUsesArguments();
1205          setStatementLocation($7, @6, @8);
1206      }
1207;
1208
1209FormalParameterList:
1210    IDENT                               { $$.m_node.head = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, *$1);
1211                                          $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
1212                                          $$.m_node.tail = $$.m_node.head; }
1213  | FormalParameterList ',' IDENT       { $$.m_node.head = $1.m_node.head;
1214                                          $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
1215                                          $$.m_node.tail = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, $1.m_node.tail, *$3);  }
1216;
1217
1218FunctionBody:
1219    /* not in spec */                   { $$ = FunctionBodyNode::create(GLOBAL_DATA); }
1220  | SourceElements_NoNode               { $$ = FunctionBodyNode::create(GLOBAL_DATA); }
1221;
1222
1223Program:
1224    /* not in spec */                   { GLOBAL_DATA->parser->didFinishParsing(new (GLOBAL_DATA) SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, @0.last_line, 0); }
1225    | SourceElements                    { GLOBAL_DATA->parser->didFinishParsing($1.m_node, $1.m_varDeclarations, $1.m_funcDeclarations, $1.m_features,
1226                                                                                @1.last_line, $1.m_numConstants); }
1227;
1228
1229SourceElements:
1230    Statement                           { $$.m_node = new (GLOBAL_DATA) SourceElements(GLOBAL_DATA);
1231                                          $$.m_node->append($1.m_node);
1232                                          $$.m_varDeclarations = $1.m_varDeclarations;
1233                                          $$.m_funcDeclarations = $1.m_funcDeclarations;
1234                                          $$.m_features = $1.m_features;
1235                                          $$.m_numConstants = $1.m_numConstants;
1236                                        }
1237  | SourceElements Statement            { $$.m_node->append($2.m_node);
1238                                          $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1239                                          $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1240                                          $$.m_features = $1.m_features | $2.m_features;
1241                                          $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
1242                                        }
1243;
1244
1245// Start NoNodes
1246
1247Literal_NoNode:
1248    NULLTOKEN
1249  | TRUETOKEN
1250  | FALSETOKEN
1251  | NUMBER { }
1252  | STRING { }
1253  | '/' /* regexp */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
1254  | DIVEQUAL /* regexp with /= */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
1255;
1256
1257Property_NoNode:
1258    IDENT ':' AssignmentExpr_NoNode { }
1259  | STRING ':' AssignmentExpr_NoNode { }
1260  | NUMBER ':' AssignmentExpr_NoNode { }
1261  | IDENT IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
1262  | IDENT IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
1263;
1264
1265PropertyList_NoNode:
1266    Property_NoNode
1267  | PropertyList_NoNode ',' Property_NoNode
1268;
1269
1270PrimaryExpr_NoNode:
1271    PrimaryExprNoBrace_NoNode
1272  | OPENBRACE CLOSEBRACE { }
1273  | OPENBRACE PropertyList_NoNode CLOSEBRACE { }
1274  /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
1275  | OPENBRACE PropertyList_NoNode ',' CLOSEBRACE { }
1276;
1277
1278PrimaryExprNoBrace_NoNode:
1279    THISTOKEN
1280  | Literal_NoNode
1281  | ArrayLiteral_NoNode
1282  | IDENT { }
1283  | '(' Expr_NoNode ')'
1284;
1285
1286ArrayLiteral_NoNode:
1287    '[' ElisionOpt_NoNode ']'
1288  | '[' ElementList_NoNode ']'
1289  | '[' ElementList_NoNode ',' ElisionOpt_NoNode ']'
1290;
1291
1292ElementList_NoNode:
1293    ElisionOpt_NoNode AssignmentExpr_NoNode
1294  | ElementList_NoNode ',' ElisionOpt_NoNode AssignmentExpr_NoNode
1295;
1296
1297ElisionOpt_NoNode:
1298    /* nothing */
1299  | Elision_NoNode
1300;
1301
1302Elision_NoNode:
1303    ','
1304  | Elision_NoNode ','
1305;
1306
1307MemberExpr_NoNode:
1308    PrimaryExpr_NoNode
1309  | FunctionExpr_NoNode
1310  | MemberExpr_NoNode '[' Expr_NoNode ']'
1311  | MemberExpr_NoNode '.' IDENT
1312  | NEW MemberExpr_NoNode Arguments_NoNode
1313;
1314
1315MemberExprNoBF_NoNode:
1316    PrimaryExprNoBrace_NoNode
1317  | MemberExprNoBF_NoNode '[' Expr_NoNode ']'
1318  | MemberExprNoBF_NoNode '.' IDENT
1319  | NEW MemberExpr_NoNode Arguments_NoNode
1320;
1321
1322NewExpr_NoNode:
1323    MemberExpr_NoNode
1324  | NEW NewExpr_NoNode
1325;
1326
1327NewExprNoBF_NoNode:
1328    MemberExprNoBF_NoNode
1329  | NEW NewExpr_NoNode
1330;
1331
1332CallExpr_NoNode:
1333    MemberExpr_NoNode Arguments_NoNode
1334  | CallExpr_NoNode Arguments_NoNode
1335  | CallExpr_NoNode '[' Expr_NoNode ']'
1336  | CallExpr_NoNode '.' IDENT
1337;
1338
1339CallExprNoBF_NoNode:
1340    MemberExprNoBF_NoNode Arguments_NoNode
1341  | CallExprNoBF_NoNode Arguments_NoNode
1342  | CallExprNoBF_NoNode '[' Expr_NoNode ']'
1343  | CallExprNoBF_NoNode '.' IDENT
1344;
1345
1346Arguments_NoNode:
1347    '(' ')'
1348  | '(' ArgumentList_NoNode ')'
1349;
1350
1351ArgumentList_NoNode:
1352    AssignmentExpr_NoNode
1353  | ArgumentList_NoNode ',' AssignmentExpr_NoNode
1354;
1355
1356LeftHandSideExpr_NoNode:
1357    NewExpr_NoNode
1358  | CallExpr_NoNode
1359;
1360
1361LeftHandSideExprNoBF_NoNode:
1362    NewExprNoBF_NoNode
1363  | CallExprNoBF_NoNode
1364;
1365
1366PostfixExpr_NoNode:
1367    LeftHandSideExpr_NoNode
1368  | LeftHandSideExpr_NoNode PLUSPLUS
1369  | LeftHandSideExpr_NoNode MINUSMINUS
1370;
1371
1372PostfixExprNoBF_NoNode:
1373    LeftHandSideExprNoBF_NoNode
1374  | LeftHandSideExprNoBF_NoNode PLUSPLUS
1375  | LeftHandSideExprNoBF_NoNode MINUSMINUS
1376;
1377
1378UnaryExprCommon_NoNode:
1379    DELETETOKEN UnaryExpr_NoNode
1380  | VOIDTOKEN UnaryExpr_NoNode
1381  | TYPEOF UnaryExpr_NoNode
1382  | PLUSPLUS UnaryExpr_NoNode
1383  | AUTOPLUSPLUS UnaryExpr_NoNode
1384  | MINUSMINUS UnaryExpr_NoNode
1385  | AUTOMINUSMINUS UnaryExpr_NoNode
1386  | '+' UnaryExpr_NoNode
1387  | '-' UnaryExpr_NoNode
1388  | '~' UnaryExpr_NoNode
1389  | '!' UnaryExpr_NoNode
1390
1391UnaryExpr_NoNode:
1392    PostfixExpr_NoNode
1393  | UnaryExprCommon_NoNode
1394;
1395
1396UnaryExprNoBF_NoNode:
1397    PostfixExprNoBF_NoNode
1398  | UnaryExprCommon_NoNode
1399;
1400
1401MultiplicativeExpr_NoNode:
1402    UnaryExpr_NoNode
1403  | MultiplicativeExpr_NoNode '*' UnaryExpr_NoNode
1404  | MultiplicativeExpr_NoNode '/' UnaryExpr_NoNode
1405  | MultiplicativeExpr_NoNode '%' UnaryExpr_NoNode
1406;
1407
1408MultiplicativeExprNoBF_NoNode:
1409    UnaryExprNoBF_NoNode
1410  | MultiplicativeExprNoBF_NoNode '*' UnaryExpr_NoNode
1411  | MultiplicativeExprNoBF_NoNode '/' UnaryExpr_NoNode
1412  | MultiplicativeExprNoBF_NoNode '%' UnaryExpr_NoNode
1413;
1414
1415AdditiveExpr_NoNode:
1416    MultiplicativeExpr_NoNode
1417  | AdditiveExpr_NoNode '+' MultiplicativeExpr_NoNode
1418  | AdditiveExpr_NoNode '-' MultiplicativeExpr_NoNode
1419;
1420
1421AdditiveExprNoBF_NoNode:
1422    MultiplicativeExprNoBF_NoNode
1423  | AdditiveExprNoBF_NoNode '+' MultiplicativeExpr_NoNode
1424  | AdditiveExprNoBF_NoNode '-' MultiplicativeExpr_NoNode
1425;
1426
1427ShiftExpr_NoNode:
1428    AdditiveExpr_NoNode
1429  | ShiftExpr_NoNode LSHIFT AdditiveExpr_NoNode
1430  | ShiftExpr_NoNode RSHIFT AdditiveExpr_NoNode
1431  | ShiftExpr_NoNode URSHIFT AdditiveExpr_NoNode
1432;
1433
1434ShiftExprNoBF_NoNode:
1435    AdditiveExprNoBF_NoNode
1436  | ShiftExprNoBF_NoNode LSHIFT AdditiveExpr_NoNode
1437  | ShiftExprNoBF_NoNode RSHIFT AdditiveExpr_NoNode
1438  | ShiftExprNoBF_NoNode URSHIFT AdditiveExpr_NoNode
1439;
1440
1441RelationalExpr_NoNode:
1442    ShiftExpr_NoNode
1443  | RelationalExpr_NoNode '<' ShiftExpr_NoNode
1444  | RelationalExpr_NoNode '>' ShiftExpr_NoNode
1445  | RelationalExpr_NoNode LE ShiftExpr_NoNode
1446  | RelationalExpr_NoNode GE ShiftExpr_NoNode
1447  | RelationalExpr_NoNode INSTANCEOF ShiftExpr_NoNode
1448  | RelationalExpr_NoNode INTOKEN ShiftExpr_NoNode
1449;
1450
1451RelationalExprNoIn_NoNode:
1452    ShiftExpr_NoNode
1453  | RelationalExprNoIn_NoNode '<' ShiftExpr_NoNode
1454  | RelationalExprNoIn_NoNode '>' ShiftExpr_NoNode
1455  | RelationalExprNoIn_NoNode LE ShiftExpr_NoNode
1456  | RelationalExprNoIn_NoNode GE ShiftExpr_NoNode
1457  | RelationalExprNoIn_NoNode INSTANCEOF ShiftExpr_NoNode
1458;
1459
1460RelationalExprNoBF_NoNode:
1461    ShiftExprNoBF_NoNode
1462  | RelationalExprNoBF_NoNode '<' ShiftExpr_NoNode
1463  | RelationalExprNoBF_NoNode '>' ShiftExpr_NoNode
1464  | RelationalExprNoBF_NoNode LE ShiftExpr_NoNode
1465  | RelationalExprNoBF_NoNode GE ShiftExpr_NoNode
1466  | RelationalExprNoBF_NoNode INSTANCEOF ShiftExpr_NoNode
1467  | RelationalExprNoBF_NoNode INTOKEN ShiftExpr_NoNode
1468;
1469
1470EqualityExpr_NoNode:
1471    RelationalExpr_NoNode
1472  | EqualityExpr_NoNode EQEQ RelationalExpr_NoNode
1473  | EqualityExpr_NoNode NE RelationalExpr_NoNode
1474  | EqualityExpr_NoNode STREQ RelationalExpr_NoNode
1475  | EqualityExpr_NoNode STRNEQ RelationalExpr_NoNode
1476;
1477
1478EqualityExprNoIn_NoNode:
1479    RelationalExprNoIn_NoNode
1480  | EqualityExprNoIn_NoNode EQEQ RelationalExprNoIn_NoNode
1481  | EqualityExprNoIn_NoNode NE RelationalExprNoIn_NoNode
1482  | EqualityExprNoIn_NoNode STREQ RelationalExprNoIn_NoNode
1483  | EqualityExprNoIn_NoNode STRNEQ RelationalExprNoIn_NoNode
1484;
1485
1486EqualityExprNoBF_NoNode:
1487    RelationalExprNoBF_NoNode
1488  | EqualityExprNoBF_NoNode EQEQ RelationalExpr_NoNode
1489  | EqualityExprNoBF_NoNode NE RelationalExpr_NoNode
1490  | EqualityExprNoBF_NoNode STREQ RelationalExpr_NoNode
1491  | EqualityExprNoBF_NoNode STRNEQ RelationalExpr_NoNode
1492;
1493
1494BitwiseANDExpr_NoNode:
1495    EqualityExpr_NoNode
1496  | BitwiseANDExpr_NoNode '&' EqualityExpr_NoNode
1497;
1498
1499BitwiseANDExprNoIn_NoNode:
1500    EqualityExprNoIn_NoNode
1501  | BitwiseANDExprNoIn_NoNode '&' EqualityExprNoIn_NoNode
1502;
1503
1504BitwiseANDExprNoBF_NoNode:
1505    EqualityExprNoBF_NoNode
1506  | BitwiseANDExprNoBF_NoNode '&' EqualityExpr_NoNode
1507;
1508
1509BitwiseXORExpr_NoNode:
1510    BitwiseANDExpr_NoNode
1511  | BitwiseXORExpr_NoNode '^' BitwiseANDExpr_NoNode
1512;
1513
1514BitwiseXORExprNoIn_NoNode:
1515    BitwiseANDExprNoIn_NoNode
1516  | BitwiseXORExprNoIn_NoNode '^' BitwiseANDExprNoIn_NoNode
1517;
1518
1519BitwiseXORExprNoBF_NoNode:
1520    BitwiseANDExprNoBF_NoNode
1521  | BitwiseXORExprNoBF_NoNode '^' BitwiseANDExpr_NoNode
1522;
1523
1524BitwiseORExpr_NoNode:
1525    BitwiseXORExpr_NoNode
1526  | BitwiseORExpr_NoNode '|' BitwiseXORExpr_NoNode
1527;
1528
1529BitwiseORExprNoIn_NoNode:
1530    BitwiseXORExprNoIn_NoNode
1531  | BitwiseORExprNoIn_NoNode '|' BitwiseXORExprNoIn_NoNode
1532;
1533
1534BitwiseORExprNoBF_NoNode:
1535    BitwiseXORExprNoBF_NoNode
1536  | BitwiseORExprNoBF_NoNode '|' BitwiseXORExpr_NoNode
1537;
1538
1539LogicalANDExpr_NoNode:
1540    BitwiseORExpr_NoNode
1541  | LogicalANDExpr_NoNode AND BitwiseORExpr_NoNode
1542;
1543
1544LogicalANDExprNoIn_NoNode:
1545    BitwiseORExprNoIn_NoNode
1546  | LogicalANDExprNoIn_NoNode AND BitwiseORExprNoIn_NoNode
1547;
1548
1549LogicalANDExprNoBF_NoNode:
1550    BitwiseORExprNoBF_NoNode
1551  | LogicalANDExprNoBF_NoNode AND BitwiseORExpr_NoNode
1552;
1553
1554LogicalORExpr_NoNode:
1555    LogicalANDExpr_NoNode
1556  | LogicalORExpr_NoNode OR LogicalANDExpr_NoNode
1557;
1558
1559LogicalORExprNoIn_NoNode:
1560    LogicalANDExprNoIn_NoNode
1561  | LogicalORExprNoIn_NoNode OR LogicalANDExprNoIn_NoNode
1562;
1563
1564LogicalORExprNoBF_NoNode:
1565    LogicalANDExprNoBF_NoNode
1566  | LogicalORExprNoBF_NoNode OR LogicalANDExpr_NoNode
1567;
1568
1569ConditionalExpr_NoNode:
1570    LogicalORExpr_NoNode
1571  | LogicalORExpr_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode
1572;
1573
1574ConditionalExprNoIn_NoNode:
1575    LogicalORExprNoIn_NoNode
1576  | LogicalORExprNoIn_NoNode '?' AssignmentExprNoIn_NoNode ':' AssignmentExprNoIn_NoNode
1577;
1578
1579ConditionalExprNoBF_NoNode:
1580    LogicalORExprNoBF_NoNode
1581  | LogicalORExprNoBF_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode
1582;
1583
1584AssignmentExpr_NoNode:
1585    ConditionalExpr_NoNode
1586  | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode
1587;
1588
1589AssignmentExprNoIn_NoNode:
1590    ConditionalExprNoIn_NoNode
1591  | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExprNoIn_NoNode
1592;
1593
1594AssignmentExprNoBF_NoNode:
1595    ConditionalExprNoBF_NoNode
1596  | LeftHandSideExprNoBF_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode
1597;
1598
1599AssignmentOperator_NoNode:
1600    '='
1601  | PLUSEQUAL
1602  | MINUSEQUAL
1603  | MULTEQUAL
1604  | DIVEQUAL
1605  | LSHIFTEQUAL
1606  | RSHIFTEQUAL
1607  | URSHIFTEQUAL
1608  | ANDEQUAL
1609  | XOREQUAL
1610  | OREQUAL
1611  | MODEQUAL
1612;
1613
1614Expr_NoNode:
1615    AssignmentExpr_NoNode
1616  | Expr_NoNode ',' AssignmentExpr_NoNode
1617;
1618
1619ExprNoIn_NoNode:
1620    AssignmentExprNoIn_NoNode
1621  | ExprNoIn_NoNode ',' AssignmentExprNoIn_NoNode
1622;
1623
1624ExprNoBF_NoNode:
1625    AssignmentExprNoBF_NoNode
1626  | ExprNoBF_NoNode ',' AssignmentExpr_NoNode
1627;
1628
1629Statement_NoNode:
1630    Block_NoNode
1631  | VariableStatement_NoNode
1632  | ConstStatement_NoNode
1633  | FunctionDeclaration_NoNode
1634  | EmptyStatement_NoNode
1635  | ExprStatement_NoNode
1636  | IfStatement_NoNode
1637  | IterationStatement_NoNode
1638  | ContinueStatement_NoNode
1639  | BreakStatement_NoNode
1640  | ReturnStatement_NoNode
1641  | WithStatement_NoNode
1642  | SwitchStatement_NoNode
1643  | LabelledStatement_NoNode
1644  | ThrowStatement_NoNode
1645  | TryStatement_NoNode
1646  | DebuggerStatement_NoNode
1647;
1648
1649Block_NoNode:
1650    OPENBRACE CLOSEBRACE { }
1651  | OPENBRACE SourceElements_NoNode CLOSEBRACE { }
1652;
1653
1654VariableStatement_NoNode:
1655    VAR VariableDeclarationList_NoNode ';'
1656  | VAR VariableDeclarationList_NoNode error { AUTO_SEMICOLON; }
1657;
1658
1659VariableDeclarationList_NoNode:
1660    IDENT { }
1661  | IDENT Initializer_NoNode { }
1662  | VariableDeclarationList_NoNode ',' IDENT
1663  | VariableDeclarationList_NoNode ',' IDENT Initializer_NoNode
1664;
1665
1666VariableDeclarationListNoIn_NoNode:
1667    IDENT { }
1668  | IDENT InitializerNoIn_NoNode { }
1669  | VariableDeclarationListNoIn_NoNode ',' IDENT
1670  | VariableDeclarationListNoIn_NoNode ',' IDENT InitializerNoIn_NoNode
1671;
1672
1673ConstStatement_NoNode:
1674    CONSTTOKEN ConstDeclarationList_NoNode ';'
1675  | CONSTTOKEN ConstDeclarationList_NoNode error { AUTO_SEMICOLON; }
1676;
1677
1678ConstDeclarationList_NoNode:
1679    ConstDeclaration_NoNode
1680  | ConstDeclarationList_NoNode ',' ConstDeclaration_NoNode
1681;
1682
1683ConstDeclaration_NoNode:
1684    IDENT { }
1685  | IDENT Initializer_NoNode { }
1686;
1687
1688Initializer_NoNode:
1689    '=' AssignmentExpr_NoNode
1690;
1691
1692InitializerNoIn_NoNode:
1693    '=' AssignmentExprNoIn_NoNode
1694;
1695
1696EmptyStatement_NoNode:
1697    ';'
1698;
1699
1700ExprStatement_NoNode:
1701    ExprNoBF_NoNode ';'
1702  | ExprNoBF_NoNode error { AUTO_SEMICOLON; }
1703;
1704
1705IfStatement_NoNode:
1706    IF '(' Expr_NoNode ')' Statement_NoNode %prec IF_WITHOUT_ELSE
1707  | IF '(' Expr_NoNode ')' Statement_NoNode ELSE Statement_NoNode
1708;
1709
1710IterationStatement_NoNode:
1711    DO Statement_NoNode WHILE '(' Expr_NoNode ')' ';'
1712  | DO Statement_NoNode WHILE '(' Expr_NoNode ')' error // Always performs automatic semicolon insertion
1713  | WHILE '(' Expr_NoNode ')' Statement_NoNode
1714  | FOR '(' ExprNoInOpt_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode
1715  | FOR '(' VAR VariableDeclarationListNoIn_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode
1716  | FOR '(' LeftHandSideExpr_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode
1717  | FOR '(' VAR IDENT INTOKEN Expr_NoNode ')' Statement_NoNode
1718  | FOR '(' VAR IDENT InitializerNoIn_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode
1719;
1720
1721ExprOpt_NoNode:
1722    /* nothing */
1723  | Expr_NoNode
1724;
1725
1726ExprNoInOpt_NoNode:
1727    /* nothing */
1728  | ExprNoIn_NoNode
1729;
1730
1731ContinueStatement_NoNode:
1732    CONTINUE ';'
1733  | CONTINUE error { AUTO_SEMICOLON; }
1734  | CONTINUE IDENT ';'
1735  | CONTINUE IDENT error { AUTO_SEMICOLON; }
1736;
1737
1738BreakStatement_NoNode:
1739    BREAK ';'
1740  | BREAK error { AUTO_SEMICOLON; }
1741  | BREAK IDENT ';'
1742  | BREAK IDENT error { AUTO_SEMICOLON; }
1743;
1744
1745ReturnStatement_NoNode:
1746    RETURN ';'
1747  | RETURN error { AUTO_SEMICOLON; }
1748  | RETURN Expr_NoNode ';'
1749  | RETURN Expr_NoNode error { AUTO_SEMICOLON; }
1750;
1751
1752WithStatement_NoNode:
1753    WITH '(' Expr_NoNode ')' Statement_NoNode
1754;
1755
1756SwitchStatement_NoNode:
1757    SWITCH '(' Expr_NoNode ')' CaseBlock_NoNode
1758;
1759
1760CaseBlock_NoNode:
1761    OPENBRACE CaseClausesOpt_NoNode CLOSEBRACE { }
1762  | OPENBRACE CaseClausesOpt_NoNode DefaultClause_NoNode CaseClausesOpt_NoNode CLOSEBRACE { }
1763;
1764
1765CaseClausesOpt_NoNode:
1766    /* nothing */
1767  | CaseClauses_NoNode
1768;
1769
1770CaseClauses_NoNode:
1771    CaseClause_NoNode
1772  | CaseClauses_NoNode CaseClause_NoNode
1773;
1774
1775CaseClause_NoNode:
1776    CASE Expr_NoNode ':'
1777  | CASE Expr_NoNode ':' SourceElements_NoNode
1778;
1779
1780DefaultClause_NoNode:
1781    DEFAULT ':'
1782  | DEFAULT ':' SourceElements_NoNode
1783;
1784
1785LabelledStatement_NoNode:
1786    IDENT ':' Statement_NoNode { }
1787;
1788
1789ThrowStatement_NoNode:
1790    THROW Expr_NoNode ';'
1791  | THROW Expr_NoNode error { AUTO_SEMICOLON; }
1792;
1793
1794TryStatement_NoNode:
1795    TRY Block_NoNode FINALLY Block_NoNode
1796  | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode
1797  | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode FINALLY Block_NoNode
1798;
1799
1800DebuggerStatement_NoNode:
1801    DEBUGGER ';'
1802  | DEBUGGER error { AUTO_SEMICOLON; }
1803;
1804
1805FunctionDeclaration_NoNode:
1806    FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1807  | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1808;
1809
1810FunctionExpr_NoNode:
1811    FUNCTION '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1812  | FUNCTION '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1813  | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1814  | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1815;
1816
1817FormalParameterList_NoNode:
1818    IDENT { }
1819  | FormalParameterList_NoNode ',' IDENT
1820;
1821
1822FunctionBody_NoNode:
1823    /* not in spec */
1824  | SourceElements_NoNode
1825;
1826
1827SourceElements_NoNode:
1828    Statement_NoNode
1829  | SourceElements_NoNode Statement_NoNode
1830;
1831
1832// End NoNodes
1833
1834%%
1835
1836#undef GLOBAL_DATA
1837
1838static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
1839{
1840    if (!loc->isLocation())
1841        return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot);
1842
1843    if (loc->isResolveNode()) {
1844        ResolveNode* resolve = static_cast<ResolveNode*>(loc);
1845        if (op == OpEqual) {
1846            AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments);
1847            setExceptionLocation(node, start, divot, end);
1848            return node;
1849        } else
1850            return new (globalData) ReadModifyResolveNode(globalData, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1851    }
1852    if (loc->isBracketAccessorNode()) {
1853        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
1854        if (op == OpEqual)
1855            return new (globalData) AssignBracketNode(globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
1856        else {
1857            ReadModifyBracketNode* node = new (globalData) ReadModifyBracketNode(globalData, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
1858            node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1859            return node;
1860        }
1861    }
1862    ASSERT(loc->isDotAccessorNode());
1863    DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
1864    if (op == OpEqual)
1865        return new (globalData) AssignDotNode(globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
1866
1867    ReadModifyDotNode* node = new (globalData) ReadModifyDotNode(globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1868    node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1869    return node;
1870}
1871
1872static ExpressionNode* makePrefixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
1873{
1874    if (!expr->isLocation())
1875        return new (globalData) PrefixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
1876
1877    if (expr->isResolveNode()) {
1878        ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1879        return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
1880    }
1881    if (expr->isBracketAccessorNode()) {
1882        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1883        PrefixBracketNode* node = new (globalData) PrefixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1884        node->setSubexpressionInfo(bracket->divot(), bracket->startOffset());
1885        return node;
1886    }
1887    ASSERT(expr->isDotAccessorNode());
1888    DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1889    PrefixDotNode* node = new (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1890    node->setSubexpressionInfo(dot->divot(), dot->startOffset());
1891    return node;
1892}
1893
1894static ExpressionNode* makePostfixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
1895{
1896    if (!expr->isLocation())
1897        return new (globalData) PostfixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
1898
1899    if (expr->isResolveNode()) {
1900        ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1901        return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
1902    }
1903    if (expr->isBracketAccessorNode()) {
1904        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1905        PostfixBracketNode* node = new (globalData) PostfixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1906        node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1907        return node;
1908
1909    }
1910    ASSERT(expr->isDotAccessorNode());
1911    DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1912    PostfixDotNode* node = new (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1913    node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1914    return node;
1915}
1916
1917static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
1918{
1919    CodeFeatures features = func.m_features | args.m_features;
1920    int numConstants = func.m_numConstants + args.m_numConstants;
1921    if (!func.m_node->isLocation())
1922        return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
1923    if (func.m_node->isResolveNode()) {
1924        ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
1925        const Identifier& identifier = resolve->identifier();
1926        if (identifier == globalData->propertyNames->eval)
1927            return createNodeInfo<ExpressionNode*>(new (globalData) EvalFunctionCallNode(globalData, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
1928        return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallResolveNode(globalData, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
1929    }
1930    if (func.m_node->isBracketAccessorNode()) {
1931        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
1932        FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
1933        node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1934        return createNodeInfo<ExpressionNode*>(node, features, numConstants);
1935    }
1936    ASSERT(func.m_node->isDotAccessorNode());
1937    DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
1938    FunctionCallDotNode* node;
1939    if (dot->identifier() == globalData->propertyNames->call)
1940        node = new (globalData) CallFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1941    else if (dot->identifier() == globalData->propertyNames->apply)
1942        node = new (globalData) ApplyFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1943    else
1944        node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1945    node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1946    return createNodeInfo<ExpressionNode*>(node, features, numConstants);
1947}
1948
1949static ExpressionNode* makeTypeOfNode(JSGlobalData* globalData, ExpressionNode* expr)
1950{
1951    if (expr->isResolveNode()) {
1952        ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1953        return new (globalData) TypeOfResolveNode(globalData, resolve->identifier());
1954    }
1955    return new (globalData) TypeOfValueNode(globalData, expr);
1956}
1957
1958static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end)
1959{
1960    if (!expr->isLocation())
1961        return new (globalData) DeleteValueNode(globalData, expr);
1962    if (expr->isResolveNode()) {
1963        ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1964        return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot);
1965    }
1966    if (expr->isBracketAccessorNode()) {
1967        BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1968        return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
1969    }
1970    ASSERT(expr->isDotAccessorNode());
1971    DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1972    return new (globalData) DeleteDotNode(globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot);
1973}
1974
1975static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
1976{
1977    PropertyNode::Type type;
1978    if (getOrSet == "get")
1979        type = PropertyNode::Getter;
1980    else if (getOrSet == "set")
1981        type = PropertyNode::Setter;
1982    else
1983        return 0;
1984    return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->emptyIdentifier, body, source, params), type);
1985}
1986
1987static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
1988{
1989    if (n->isNumber()) {
1990        NumberNode* number = static_cast<NumberNode*>(n);
1991
1992        if (number->value() > 0.0) {
1993            number->setValue(-number->value());
1994            return number;
1995        }
1996    }
1997
1998    return new (globalData) NegateNode(globalData, n);
1999}
2000
2001static NumberNode* makeNumberNode(JSGlobalData* globalData, double d)
2002{
2003    return new (globalData) NumberNode(globalData, d);
2004}
2005
2006static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
2007{
2008    if (expr->isNumber())
2009        return makeNumberNode(globalData, ~toInt32(static_cast<NumberNode*>(expr)->value()));
2010    return new (globalData) BitwiseNotNode(globalData, expr);
2011}
2012
2013static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2014{
2015    expr1 = expr1->stripUnaryPlus();
2016    expr2 = expr2->stripUnaryPlus();
2017
2018    if (expr1->isNumber() && expr2->isNumber())
2019        return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
2020
2021    if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
2022        return new (globalData) UnaryPlusNode(globalData, expr2);
2023
2024    if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
2025        return new (globalData) UnaryPlusNode(globalData, expr1);
2026
2027    return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments);
2028}
2029
2030static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2031{
2032    expr1 = expr1->stripUnaryPlus();
2033    expr2 = expr2->stripUnaryPlus();
2034
2035    if (expr1->isNumber() && expr2->isNumber())
2036        return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
2037    return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments);
2038}
2039
2040static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2041{
2042    if (expr1->isNumber() && expr2->isNumber())
2043        return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
2044    return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments);
2045}
2046
2047static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2048{
2049    expr1 = expr1->stripUnaryPlus();
2050    expr2 = expr2->stripUnaryPlus();
2051
2052    if (expr1->isNumber() && expr2->isNumber())
2053        return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
2054    return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments);
2055}
2056
2057static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2058{
2059    if (expr1->isNumber() && expr2->isNumber())
2060        return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
2061    return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments);
2062}
2063
2064static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2065{
2066    if (expr1->isNumber() && expr2->isNumber())
2067        return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
2068    return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments);
2069}
2070
2071// Called by yyparse on error.
2072int yyerror(const char*)
2073{
2074    return 1;
2075}
2076
2077// May we automatically insert a semicolon?
2078static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
2079{
2080    return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
2081}
2082
2083static ExpressionNode* combineCommaNodes(JSGlobalData* globalData, ExpressionNode* list, ExpressionNode* init)
2084{
2085    if (!list)
2086        return init;
2087    if (list->isCommaNode()) {
2088        static_cast<CommaNode*>(list)->append(init);
2089        return list;
2090    }
2091    return new (globalData) CommaNode(globalData, list, init);
2092}
2093
2094// We turn variable declarations into either assignments or empty
2095// statements (which later get stripped out), because the actual
2096// declaration work is hoisted up to the start of the function body
2097static StatementNode* makeVarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
2098{
2099    if (!expr)
2100        return new (globalData) EmptyStatementNode(globalData);
2101    return new (globalData) VarStatementNode(globalData, expr);
2102}
2103