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>
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.
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.
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
32 #include "NodeConstructors.h"
35 #include "JSGlobalData.h"
36 #include "CommonIdentifiers.h"
39 #include <wtf/MathExtras.h>
41 #define YYMAXDEPTH 10000
42 #define YYENABLE_NLS 0
44 /* default values for bison */
45 #define YYDEBUG 0 // Set to 1 to debug a parse error.
46 #define jscyydebug 0 // Set to 1 to debug a parse error.
48 // avoid triggering warnings in older bison
49 #define YYERROR_VERBOSE
52 int jscyylex(void* lvalp, void* llocp, void* globalPtr);
53 int jscyyerror(const char*);
54 static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
56 #define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr)
57 #define LEXER (GLOBAL_DATA->lexer)
59 #define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0)
60 #define SET_EXCEPTION_LOCATION(node, start, divot, end) node->setExceptionSourceCode((divot), (divot) - (start), (end) - (divot))
61 #define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line)
66 static ExpressionNode* makeAssignNode(void*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end);
67 static ExpressionNode* makePrefixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
68 static ExpressionNode* makePostfixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
69 static PropertyNode* makeGetterOrSetterPropertyNode(void*, const Identifier &getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
70 static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end);
71 static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*);
72 static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end);
73 static ExpressionNode* makeNegateNode(void*, ExpressionNode*);
74 static NumberNode* makeNumberNode(void*, double);
75 static ExpressionNode* makeBitwiseNotNode(void*, ExpressionNode*);
76 static ExpressionNode* makeMultNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
77 static ExpressionNode* makeDivNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
78 static ExpressionNode* makeAddNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
79 static ExpressionNode* makeSubNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
80 static ExpressionNode* makeLeftShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
81 static ExpressionNode* makeRightShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
82 static StatementNode* makeVarStatementNode(void*, ExpressionNode*);
83 static ExpressionNode* combineCommaNodes(void*, ExpressionNode* list, ExpressionNode* init);
87 #pragma warning(disable: 4065)
88 #pragma warning(disable: 4244)
89 #pragma warning(disable: 4702)
91 // At least some of the time, the declarations of malloc and free that bison
92 // generates are causing warnings. A way to avoid this is to explicitly define
93 // the macros so that bison doesn't try to declare malloc and free.
94 #define YYMALLOC malloc
99 #define YYPARSE_PARAM globalPtr
100 #define YYLEX_PARAM globalPtr
102 template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserArenaData<DeclarationStacks::VarStack>* varDecls,
103 ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
107 ASSERT((info & ~AllFeatures) == 0);
108 NodeDeclarationInfo<T> result = { node, varDecls, funcDecls, info, numConstants };
112 template <typename T> NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
114 ASSERT((info & ~AllFeatures) == 0);
115 NodeInfo<T> result = { node, info, numConstants };
119 template <typename T> inline T mergeDeclarationLists(T decls1, T decls2)
121 // decls1 or both are null
124 // only decls1 is non-null
129 decls1->data.append(decls2->data);
131 // Manually release as much as possible from the now-defunct declaration lists
132 // to avoid accumulating so many unused heap allocated vectors.
133 decls2->data.clear();
138 static void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
141 varDecls = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
143 varDecls->data.append(make_pair(ident, attrs));
147 static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
149 unsigned attrs = DeclarationStacks::IsConstant;
150 if (decl->hasInitializer())
151 attrs |= DeclarationStacks::HasInitializer;
152 appendToVarDeclarationList(globalPtr, varDecls, decl->ident(), attrs);
162 // expression subtrees
163 ExpressionNodeInfo expressionNode;
164 FuncDeclNodeInfo funcDeclNode;
165 PropertyNodeInfo propertyNode;
166 ArgumentsNodeInfo argumentsNode;
167 ConstDeclNodeInfo constDeclNode;
168 CaseBlockNodeInfo caseBlockNode;
169 CaseClauseNodeInfo caseClauseNode;
170 FuncExprNodeInfo funcExprNode;
173 StatementNodeInfo statementNode;
174 FunctionBodyNode* functionBodyNode;
175 ProgramNode* programNode;
177 SourceElementsInfo sourceElements;
178 PropertyListInfo propertyList;
179 ArgumentListInfo argumentList;
180 VarDeclListInfo varDeclList;
181 ConstDeclListInfo constDeclList;
182 ClauseListInfo clauseList;
183 ElementListInfo elementList;
184 ParameterListInfo parameterList;
192 %token NULLTOKEN TRUETOKEN FALSETOKEN
195 %token BREAK CASE DEFAULT FOR NEW VAR CONSTTOKEN CONTINUE
196 %token FUNCTION RETURN VOIDTOKEN DELETETOKEN
197 %token IF THISTOKEN DO WHILE INTOKEN INSTANCEOF TYPEOF
198 %token SWITCH WITH RESERVED
199 %token THROW TRY CATCH FINALLY
202 /* give an if without an else higher precedence than an else to resolve the ambiguity */
203 %nonassoc IF_WITHOUT_ELSE
207 %token EQEQ NE /* == and != */
208 %token STREQ STRNEQ /* === and !== */
209 %token LE GE /* < and > */
210 %token OR AND /* || and && */
211 %token PLUSPLUS MINUSMINUS /* ++ and -- */
212 %token LSHIFT /* << */
213 %token RSHIFT URSHIFT /* >> and >>> */
214 %token PLUSEQUAL MINUSEQUAL /* += and -= */
215 %token MULTEQUAL DIVEQUAL /* *= and /= */
216 %token LSHIFTEQUAL /* <<= */
217 %token RSHIFTEQUAL URSHIFTEQUAL /* >>= and >>>= */
218 %token ANDEQUAL MODEQUAL /* &= and %= */
219 %token XOREQUAL OREQUAL /* ^= and |= */
220 %token <intValue> OPENBRACE /* { (with char offset) */
221 %token <intValue> CLOSEBRACE /* } (with char offset) */
224 %token <doubleValue> NUMBER
225 %token <ident> IDENT STRING
227 /* automatically inserted semicolon */
228 %token AUTOPLUSPLUS AUTOMINUSMINUS
230 /* non-terminal types */
231 %type <expressionNode> Literal ArrayLiteral
233 %type <expressionNode> PrimaryExpr PrimaryExprNoBrace
234 %type <expressionNode> MemberExpr MemberExprNoBF /* BF => brace or function */
235 %type <expressionNode> NewExpr NewExprNoBF
236 %type <expressionNode> CallExpr CallExprNoBF
237 %type <expressionNode> LeftHandSideExpr LeftHandSideExprNoBF
238 %type <expressionNode> PostfixExpr PostfixExprNoBF
239 %type <expressionNode> UnaryExpr UnaryExprNoBF UnaryExprCommon
240 %type <expressionNode> MultiplicativeExpr MultiplicativeExprNoBF
241 %type <expressionNode> AdditiveExpr AdditiveExprNoBF
242 %type <expressionNode> ShiftExpr ShiftExprNoBF
243 %type <expressionNode> RelationalExpr RelationalExprNoIn RelationalExprNoBF
244 %type <expressionNode> EqualityExpr EqualityExprNoIn EqualityExprNoBF
245 %type <expressionNode> BitwiseANDExpr BitwiseANDExprNoIn BitwiseANDExprNoBF
246 %type <expressionNode> BitwiseXORExpr BitwiseXORExprNoIn BitwiseXORExprNoBF
247 %type <expressionNode> BitwiseORExpr BitwiseORExprNoIn BitwiseORExprNoBF
248 %type <expressionNode> LogicalANDExpr LogicalANDExprNoIn LogicalANDExprNoBF
249 %type <expressionNode> LogicalORExpr LogicalORExprNoIn LogicalORExprNoBF
250 %type <expressionNode> ConditionalExpr ConditionalExprNoIn ConditionalExprNoBF
251 %type <expressionNode> AssignmentExpr AssignmentExprNoIn AssignmentExprNoBF
252 %type <expressionNode> Expr ExprNoIn ExprNoBF
254 %type <expressionNode> ExprOpt ExprNoInOpt
256 %type <statementNode> Statement Block
257 %type <statementNode> VariableStatement ConstStatement EmptyStatement ExprStatement
258 %type <statementNode> IfStatement IterationStatement ContinueStatement
259 %type <statementNode> BreakStatement ReturnStatement WithStatement
260 %type <statementNode> SwitchStatement LabelledStatement
261 %type <statementNode> ThrowStatement TryStatement
262 %type <statementNode> DebuggerStatement
264 %type <expressionNode> Initializer InitializerNoIn
265 %type <statementNode> FunctionDeclaration
266 %type <funcExprNode> FunctionExpr
267 %type <functionBodyNode> FunctionBody
268 %type <sourceElements> SourceElements
269 %type <parameterList> FormalParameterList
270 %type <op> AssignmentOperator
271 %type <argumentsNode> Arguments
272 %type <argumentList> ArgumentList
273 %type <varDeclList> VariableDeclarationList VariableDeclarationListNoIn
274 %type <constDeclList> ConstDeclarationList
275 %type <constDeclNode> ConstDeclaration
276 %type <caseBlockNode> CaseBlock
277 %type <caseClauseNode> CaseClause DefaultClause
278 %type <clauseList> CaseClauses CaseClausesOpt
279 %type <intValue> Elision ElisionOpt
280 %type <elementList> ElementList
281 %type <propertyNode> Property
282 %type <propertyList> PropertyList
285 // FIXME: There are currently two versions of the grammar in this file, the normal one, and the NoNodes version used for
286 // lazy recompilation of FunctionBodyNodes. We should move to generating the two versions from a script to avoid bugs.
287 // In the mean time, make sure to make any changes to the grammar in both versions.
290 NULLTOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NullNode(GLOBAL_DATA), 0, 1); }
291 | TRUETOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, true), 0, 1); }
292 | FALSETOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, false), 0, 1); }
293 | NUMBER { $$ = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, $1), 0, 1); }
294 | STRING { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *$1), 0, 1); }
299 RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, l.pattern(), l.flags());
300 int size = l.pattern().size() + 2; // + 2 for the two /'s
301 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
302 $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
304 | DIVEQUAL /* regexp with /= */ {
308 RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, "=" + l.pattern(), l.flags());
309 int size = l.pattern().size() + 2; // + 2 for the two /'s
310 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
311 $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
316 IDENT ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
317 | STRING ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
318 | NUMBER ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
319 | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, 0, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); if (!$$.m_node) YYABORT; }
320 | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
322 $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.m_node.head, $7, LEXER->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
323 if ($4.m_features & ArgumentsFeature)
324 $7->setUsesArguments();
332 Property { $$.m_node.head = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $1.m_node);
333 $$.m_node.tail = $$.m_node.head;
334 $$.m_features = $1.m_features;
335 $$.m_numConstants = $1.m_numConstants; }
336 | PropertyList ',' Property { $$.m_node.head = $1.m_node.head;
337 $$.m_node.tail = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $3.m_node, $1.m_node.tail);
338 $$.m_features = $1.m_features | $3.m_features;
339 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
344 | OPENBRACE CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA), 0, 0); }
345 | OPENBRACE PropertyList CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
346 /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
347 | OPENBRACE PropertyList ',' CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
351 THISTOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ThisNode(GLOBAL_DATA), ThisFeature, 0); }
354 | IDENT { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ResolveNode(GLOBAL_DATA, *$1, @1.first_column), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
355 | '(' Expr ')' { $$ = $2; }
359 '[' ElisionOpt ']' { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2), 0, $2 ? 1 : 0); }
360 | '[' ElementList ']' { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
361 | '[' 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); }
365 ElisionOpt AssignmentExpr { $$.m_node.head = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1, $2.m_node);
366 $$.m_node.tail = $$.m_node.head;
367 $$.m_features = $2.m_features;
368 $$.m_numConstants = $2.m_numConstants; }
369 | ElementList ',' ElisionOpt AssignmentExpr
370 { $$.m_node.head = $1.m_node.head;
371 $$.m_node.tail = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1.m_node.tail, $3, $4.m_node);
372 $$.m_features = $1.m_features | $4.m_features;
373 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; }
377 /* nothing */ { $$ = 0; }
383 | Elision ',' { $$ = $1 + 1; }
388 | FunctionExpr { $$ = createNodeInfo<ExpressionNode*>($1.m_node, $1.m_features, $1.m_numConstants); }
389 | MemberExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
390 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
391 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
393 | MemberExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
394 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
395 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
397 | NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
398 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
399 $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
405 | MemberExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
406 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
407 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
409 | MemberExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
410 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
411 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
413 | NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
414 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
415 $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
421 | NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
422 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
423 $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
429 | NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
430 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
431 $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
436 MemberExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
437 | CallExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
438 | CallExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
439 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
440 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
442 | CallExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
443 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
444 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); }
448 MemberExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
449 | CallExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
450 | CallExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
451 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
452 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
454 | CallExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
455 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
456 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
461 '(' ')' { $$ = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA), 0, 0); }
462 | '(' ArgumentList ')' { $$ = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
466 AssignmentExpr { $$.m_node.head = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node);
467 $$.m_node.tail = $$.m_node.head;
468 $$.m_features = $1.m_features;
469 $$.m_numConstants = $1.m_numConstants; }
470 | ArgumentList ',' AssignmentExpr { $$.m_node.head = $1.m_node.head;
471 $$.m_node.tail = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node.tail, $3.m_node);
472 $$.m_features = $1.m_features | $3.m_features;
473 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
481 LeftHandSideExprNoBF:
488 | 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); }
489 | 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); }
494 | 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); }
495 | 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); }
499 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); }
500 | VOIDTOKEN UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) VoidNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants + 1); }
501 | TYPEOF UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
502 | 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); }
503 | 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); }
504 | 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); }
505 | 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); }
506 | '+' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
507 | '-' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
508 | '~' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
509 | '!' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
523 | 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); }
524 | 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); }
525 | 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); }
528 MultiplicativeExprNoBF:
530 | MultiplicativeExprNoBF '*' UnaryExpr
531 { $$ = 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); }
532 | MultiplicativeExprNoBF '/' UnaryExpr
533 { $$ = 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); }
534 | MultiplicativeExprNoBF '%' UnaryExpr
535 { $$ = 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); }
540 | 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); }
541 | 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); }
545 MultiplicativeExprNoBF
546 | AdditiveExprNoBF '+' MultiplicativeExpr
547 { $$ = 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 | AdditiveExprNoBF '-' MultiplicativeExpr
549 { $$ = 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); }
554 | 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); }
555 | 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); }
556 | 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); }
561 | 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); }
562 | 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); }
563 | 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); }
568 | 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); }
569 | 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); }
570 | 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); }
571 | 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); }
572 | RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
573 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
574 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
575 | RelationalExpr INTOKEN ShiftExpr { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
576 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
577 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
582 | 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); }
583 | 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); }
584 | 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); }
585 | 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); }
586 | RelationalExprNoIn INSTANCEOF ShiftExpr
587 { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
588 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
589 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
594 | 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); }
595 | 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); }
596 | 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); }
597 | 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); }
598 | RelationalExprNoBF INSTANCEOF ShiftExpr
599 { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
600 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
601 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
602 | RelationalExprNoBF INTOKEN ShiftExpr
603 { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
604 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
605 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
610 | 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); }
611 | 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); }
612 | 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); }
613 | 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); }
618 | EqualityExprNoIn EQEQ RelationalExprNoIn
619 { $$ = 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); }
620 | EqualityExprNoIn NE RelationalExprNoIn
621 { $$ = 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); }
622 | EqualityExprNoIn STREQ RelationalExprNoIn
623 { $$ = 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); }
624 | EqualityExprNoIn STRNEQ RelationalExprNoIn
625 { $$ = 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); }
630 | EqualityExprNoBF EQEQ RelationalExpr
631 { $$ = 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); }
632 | 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); }
633 | EqualityExprNoBF STREQ RelationalExpr
634 { $$ = 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); }
635 | EqualityExprNoBF STRNEQ RelationalExpr
636 { $$ = 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); }
641 | 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); }
646 | BitwiseANDExprNoIn '&' EqualityExprNoIn
647 { $$ = 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); }
652 | 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); }
657 | 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); }
662 | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn
663 { $$ = 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); }
668 | BitwiseXORExprNoBF '^' BitwiseANDExpr
669 { $$ = 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); }
674 | 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); }
679 | BitwiseORExprNoIn '|' BitwiseXORExprNoIn
680 { $$ = 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); }
685 | BitwiseORExprNoBF '|' BitwiseXORExpr
686 { $$ = 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); }
691 | 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); }
696 | LogicalANDExprNoIn AND BitwiseORExprNoIn
697 { $$ = 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); }
702 | LogicalANDExprNoBF AND BitwiseORExpr
703 { $$ = 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); }
708 | 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); }
713 | LogicalORExprNoIn OR LogicalANDExprNoIn
714 { $$ = 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); }
719 | 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); }
724 | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr
725 { $$ = 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); }
730 | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn
731 { $$ = 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); }
736 | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr
737 { $$ = 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); }
742 | LeftHandSideExpr AssignmentOperator AssignmentExpr
743 { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
744 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
750 | LeftHandSideExpr AssignmentOperator AssignmentExprNoIn
751 { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
752 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
758 | LeftHandSideExprNoBF AssignmentOperator AssignmentExpr
759 { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
760 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
765 '=' { $$ = OpEqual; }
766 | PLUSEQUAL { $$ = OpPlusEq; }
767 | MINUSEQUAL { $$ = OpMinusEq; }
768 | MULTEQUAL { $$ = OpMultEq; }
769 | DIVEQUAL { $$ = OpDivEq; }
770 | LSHIFTEQUAL { $$ = OpLShift; }
771 | RSHIFTEQUAL { $$ = OpRShift; }
772 | URSHIFTEQUAL { $$ = OpURShift; }
773 | ANDEQUAL { $$ = OpAndEq; }
774 | XOREQUAL { $$ = OpXOrEq; }
775 | OREQUAL { $$ = OpOrEq; }
776 | MODEQUAL { $$ = OpModEq; }
781 | 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); }
786 | 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); }
791 | 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); }
798 | FunctionDeclaration
815 OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
816 DBG($$.m_node, @1, @2); }
817 | 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);
818 DBG($$.m_node, @1, @3); }
822 VAR VariableDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
823 DBG($$.m_node, @1, @3); }
824 | VAR VariableDeclarationList error { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
825 DBG($$.m_node, @1, @2);
829 VariableDeclarationList:
830 IDENT { $$.m_node = 0;
831 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
832 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
833 $$.m_funcDeclarations = 0;
834 $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
835 $$.m_numConstants = 0;
837 | IDENT Initializer { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
838 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
840 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
841 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
842 $$.m_funcDeclarations = 0;
843 $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features;
844 $$.m_numConstants = $2.m_numConstants;
846 | VariableDeclarationList ',' IDENT
847 { $$.m_node = $1.m_node;
848 $$.m_varDeclarations = $1.m_varDeclarations;
849 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
850 $$.m_funcDeclarations = 0;
851 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
852 $$.m_numConstants = $1.m_numConstants;
854 | VariableDeclarationList ',' IDENT Initializer
855 { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
856 SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column);
857 $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
858 $$.m_varDeclarations = $1.m_varDeclarations;
859 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
860 $$.m_funcDeclarations = 0;
861 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features;
862 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
866 VariableDeclarationListNoIn:
867 IDENT { $$.m_node = 0;
868 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
869 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
870 $$.m_funcDeclarations = 0;
871 $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
872 $$.m_numConstants = 0;
874 | IDENT InitializerNoIn { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
875 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
877 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
878 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
879 $$.m_funcDeclarations = 0;
880 $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features;
881 $$.m_numConstants = $2.m_numConstants;
883 | VariableDeclarationListNoIn ',' IDENT
884 { $$.m_node = $1.m_node;
885 $$.m_varDeclarations = $1.m_varDeclarations;
886 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
887 $$.m_funcDeclarations = 0;
888 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
889 $$.m_numConstants = $1.m_numConstants;
891 | VariableDeclarationListNoIn ',' IDENT InitializerNoIn
892 { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
893 SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column);
894 $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
895 $$.m_varDeclarations = $1.m_varDeclarations;
896 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
897 $$.m_funcDeclarations = 0;
898 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features;
899 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
904 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);
905 DBG($$.m_node, @1, @3); }
906 | CONSTTOKEN ConstDeclarationList error
907 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
908 DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
911 ConstDeclarationList:
912 ConstDeclaration { $$.m_node.head = $1.m_node;
913 $$.m_node.tail = $$.m_node.head;
914 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
915 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $1.m_node);
916 $$.m_funcDeclarations = 0;
917 $$.m_features = $1.m_features;
918 $$.m_numConstants = $1.m_numConstants;
920 | ConstDeclarationList ',' ConstDeclaration
921 { $$.m_node.head = $1.m_node.head;
922 $1.m_node.tail->m_next = $3.m_node;
923 $$.m_node.tail = $3.m_node;
924 $$.m_varDeclarations = $1.m_varDeclarations;
925 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $3.m_node);
926 $$.m_funcDeclarations = 0;
927 $$.m_features = $1.m_features | $3.m_features;
928 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
932 IDENT { $$ = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, 0), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
933 | 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); }
937 '=' AssignmentExpr { $$ = $2; }
941 '=' AssignmentExprNoIn { $$ = $2; }
945 ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); }
949 ExprNoBF ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
950 DBG($$.m_node, @1, @2); }
951 | ExprNoBF error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
952 DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
956 IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE
957 { $$ = 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);
958 DBG($$.m_node, @1, @4); }
959 | IF '(' Expr ')' Statement ELSE Statement
960 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node),
961 mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations),
962 mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
963 $3.m_features | $5.m_features | $7.m_features,
964 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
965 DBG($$.m_node, @1, @4); }
969 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);
970 DBG($$.m_node, @1, @3); }
971 | 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);
972 DBG($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
973 | 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);
974 DBG($$.m_node, @1, @4); }
975 | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement
976 { $$ = 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,
977 $3.m_features | $5.m_features | $7.m_features | $9.m_features,
978 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
979 DBG($$.m_node, @1, @8);
981 | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement
982 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true),
983 mergeDeclarationLists($4.m_varDeclarations, $10.m_varDeclarations),
984 mergeDeclarationLists($4.m_funcDeclarations, $10.m_funcDeclarations),
985 $4.m_features | $6.m_features | $8.m_features | $10.m_features,
986 $4.m_numConstants + $6.m_numConstants + $8.m_numConstants + $10.m_numConstants);
987 DBG($$.m_node, @1, @9); }
988 | FOR '(' LeftHandSideExpr INTOKEN Expr ')' Statement
990 ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node);
991 SET_EXCEPTION_LOCATION(node, @3.first_column, @3.last_column, @5.last_column);
992 $$ = createNodeDeclarationInfo<StatementNode*>(node, $7.m_varDeclarations, $7.m_funcDeclarations,
993 $3.m_features | $5.m_features | $7.m_features,
994 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
995 DBG($$.m_node, @1, @6);
997 | FOR '(' VAR IDENT INTOKEN Expr ')' Statement
998 { 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);
999 SET_EXCEPTION_LOCATION(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
1000 appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
1001 $$ = 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);
1002 DBG($$.m_node, @1, @7); }
1003 | FOR '(' VAR IDENT InitializerNoIn INTOKEN Expr ')' Statement
1004 { 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);
1005 SET_EXCEPTION_LOCATION(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
1006 appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
1007 $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $9.m_varDeclarations, $9.m_funcDeclarations,
1008 ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $5.m_features | $7.m_features | $9.m_features,
1009 $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
1010 DBG($$.m_node, @1, @8); }
1014 /* nothing */ { $$ = createNodeInfo<ExpressionNode*>(0, 0, 0); }
1019 /* nothing */ { $$ = createNodeInfo<ExpressionNode*>(0, 0, 0); }
1024 CONTINUE ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
1025 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1026 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1027 DBG($$.m_node, @1, @2); }
1028 | CONTINUE error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
1029 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1030 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1031 DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1032 | CONTINUE IDENT ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
1033 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1034 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1035 DBG($$.m_node, @1, @3); }
1036 | CONTINUE IDENT error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
1037 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1038 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1039 DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1043 BREAK ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
1044 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1045 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @2); }
1046 | BREAK error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
1047 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1048 $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1049 | BREAK IDENT ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
1050 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1051 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @3); }
1052 | BREAK IDENT error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
1053 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1054 $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1058 RETURN ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
1059 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1060 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @2); }
1061 | RETURN error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
1062 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1063 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1064 | RETURN Expr ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
1065 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1066 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @3); }
1067 | RETURN Expr error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
1068 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1069 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1073 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),
1074 $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features | WithFeature, $3.m_numConstants + $5.m_numConstants);
1075 DBG($$.m_node, @1, @4); }
1079 SWITCH '(' Expr ')' CaseBlock { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations,
1080 $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
1081 DBG($$.m_node, @1, @4); }
1085 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); }
1086 | OPENBRACE CaseClausesOpt DefaultClause CaseClausesOpt CLOSEBRACE
1087 { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, $3.m_node, $4.m_node.head),
1088 mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $3.m_varDeclarations), $4.m_varDeclarations),
1089 mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $3.m_funcDeclarations), $4.m_funcDeclarations),
1090 $2.m_features | $3.m_features | $4.m_features,
1091 $2.m_numConstants + $3.m_numConstants + $4.m_numConstants); }
1095 /* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; }
1100 CaseClause { $$.m_node.head = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node);
1101 $$.m_node.tail = $$.m_node.head;
1102 $$.m_varDeclarations = $1.m_varDeclarations;
1103 $$.m_funcDeclarations = $1.m_funcDeclarations;
1104 $$.m_features = $1.m_features;
1105 $$.m_numConstants = $1.m_numConstants; }
1106 | CaseClauses CaseClause { $$.m_node.head = $1.m_node.head;
1107 $$.m_node.tail = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node.tail, $2.m_node);
1108 $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1109 $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1110 $$.m_features = $1.m_features | $2.m_features;
1111 $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
1116 CASE Expr ':' { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node), 0, 0, $2.m_features, $2.m_numConstants); }
1117 | 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); }
1121 DEFAULT ':' { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); }
1122 | 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); }
1126 IDENT ':' Statement { LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *$1, $3.m_node);
1127 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1128 $$ = createNodeDeclarationInfo<StatementNode*>(node, $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); }
1132 THROW Expr ';' { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
1133 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1134 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2);
1136 | THROW Expr error { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
1137 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1138 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2); AUTO_SEMICOLON;
1143 TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, $4.m_node),
1144 mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations),
1145 mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
1146 $2.m_features | $4.m_features,
1147 $2.m_numConstants + $4.m_numConstants);
1148 DBG($$.m_node, @1, @2); }
1149 | 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),
1150 mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations),
1151 mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations),
1152 $2.m_features | $7.m_features | CatchFeature,
1153 $2.m_numConstants + $7.m_numConstants);
1154 DBG($$.m_node, @1, @2); }
1155 | TRY Block CATCH '(' IDENT ')' Block FINALLY Block
1156 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, $9.m_node),
1157 mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), $9.m_varDeclarations),
1158 mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $9.m_funcDeclarations),
1159 $2.m_features | $7.m_features | $9.m_features | CatchFeature,
1160 $2.m_numConstants + $7.m_numConstants + $9.m_numConstants);
1161 DBG($$.m_node, @1, @2); }
1165 DEBUGGER ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
1166 DBG($$.m_node, @1, @2); }
1167 | DEBUGGER error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
1168 DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1171 FunctionDeclaration:
1172 FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)); }
1173 | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1175 $$ = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *$2, $7, 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);
1176 if ($4.m_features & ArgumentsFeature)
1177 $7->setUsesArguments();
1179 $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node));
1184 FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, LEXER->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); DBG($5, @4, @6); }
1185 | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1187 $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, LEXER->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
1188 if ($3.m_features & ArgumentsFeature)
1189 $6->setUsesArguments();
1192 | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); }
1193 | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1195 $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0);
1196 if ($4.m_features & ArgumentsFeature)
1197 $7->setUsesArguments();
1202 FormalParameterList:
1203 IDENT { $$.m_node.head = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, *$1);
1204 $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
1205 $$.m_node.tail = $$.m_node.head; }
1206 | FormalParameterList ',' IDENT { $$.m_node.head = $1.m_node.head;
1207 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
1208 $$.m_node.tail = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, $1.m_node.tail, *$3); }
1212 /* not in spec */ { $$ = FunctionBodyNode::create(GLOBAL_DATA); }
1213 | SourceElements_NoNode { $$ = FunctionBodyNode::create(GLOBAL_DATA); }
1217 /* not in spec */ { GLOBAL_DATA->parser->didFinishParsing(new (GLOBAL_DATA) SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, @0.last_line, 0); }
1218 | SourceElements { GLOBAL_DATA->parser->didFinishParsing($1.m_node, $1.m_varDeclarations, $1.m_funcDeclarations, $1.m_features,
1219 @1.last_line, $1.m_numConstants); }
1223 Statement { $$.m_node = new (GLOBAL_DATA) SourceElements(GLOBAL_DATA);
1224 $$.m_node->append($1.m_node);
1225 $$.m_varDeclarations = $1.m_varDeclarations;
1226 $$.m_funcDeclarations = $1.m_funcDeclarations;
1227 $$.m_features = $1.m_features;
1228 $$.m_numConstants = $1.m_numConstants;
1230 | SourceElements Statement { $$.m_node->append($2.m_node);
1231 $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1232 $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1233 $$.m_features = $1.m_features | $2.m_features;
1234 $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
1246 | '/' /* regexp */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; }
1247 | DIVEQUAL /* regexp with /= */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; }
1251 IDENT ':' AssignmentExpr_NoNode { }
1252 | STRING ':' AssignmentExpr_NoNode { }
1253 | NUMBER ':' AssignmentExpr_NoNode { }
1254 | IDENT IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
1255 | IDENT IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
1258 PropertyList_NoNode:
1260 | PropertyList_NoNode ',' Property_NoNode
1264 PrimaryExprNoBrace_NoNode
1265 | OPENBRACE CLOSEBRACE { }
1266 | OPENBRACE PropertyList_NoNode CLOSEBRACE { }
1267 /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
1268 | OPENBRACE PropertyList_NoNode ',' CLOSEBRACE { }
1271 PrimaryExprNoBrace_NoNode:
1274 | ArrayLiteral_NoNode
1276 | '(' Expr_NoNode ')'
1279 ArrayLiteral_NoNode:
1280 '[' ElisionOpt_NoNode ']'
1281 | '[' ElementList_NoNode ']'
1282 | '[' ElementList_NoNode ',' ElisionOpt_NoNode ']'
1286 ElisionOpt_NoNode AssignmentExpr_NoNode
1287 | ElementList_NoNode ',' ElisionOpt_NoNode AssignmentExpr_NoNode
1297 | Elision_NoNode ','
1302 | FunctionExpr_NoNode
1303 | MemberExpr_NoNode '[' Expr_NoNode ']'
1304 | MemberExpr_NoNode '.' IDENT
1305 | NEW MemberExpr_NoNode Arguments_NoNode
1308 MemberExprNoBF_NoNode:
1309 PrimaryExprNoBrace_NoNode
1310 | MemberExprNoBF_NoNode '[' Expr_NoNode ']'
1311 | MemberExprNoBF_NoNode '.' IDENT
1312 | NEW MemberExpr_NoNode Arguments_NoNode
1317 | NEW NewExpr_NoNode
1321 MemberExprNoBF_NoNode
1322 | NEW NewExpr_NoNode
1326 MemberExpr_NoNode Arguments_NoNode
1327 | CallExpr_NoNode Arguments_NoNode
1328 | CallExpr_NoNode '[' Expr_NoNode ']'
1329 | CallExpr_NoNode '.' IDENT
1332 CallExprNoBF_NoNode:
1333 MemberExprNoBF_NoNode Arguments_NoNode
1334 | CallExprNoBF_NoNode Arguments_NoNode
1335 | CallExprNoBF_NoNode '[' Expr_NoNode ']'
1336 | CallExprNoBF_NoNode '.' IDENT
1341 | '(' ArgumentList_NoNode ')'
1344 ArgumentList_NoNode:
1345 AssignmentExpr_NoNode
1346 | ArgumentList_NoNode ',' AssignmentExpr_NoNode
1349 LeftHandSideExpr_NoNode:
1354 LeftHandSideExprNoBF_NoNode:
1356 | CallExprNoBF_NoNode
1360 LeftHandSideExpr_NoNode
1361 | LeftHandSideExpr_NoNode PLUSPLUS
1362 | LeftHandSideExpr_NoNode MINUSMINUS
1365 PostfixExprNoBF_NoNode:
1366 LeftHandSideExprNoBF_NoNode
1367 | LeftHandSideExprNoBF_NoNode PLUSPLUS
1368 | LeftHandSideExprNoBF_NoNode MINUSMINUS
1371 UnaryExprCommon_NoNode:
1372 DELETETOKEN UnaryExpr_NoNode
1373 | VOIDTOKEN UnaryExpr_NoNode
1374 | TYPEOF UnaryExpr_NoNode
1375 | PLUSPLUS UnaryExpr_NoNode
1376 | AUTOPLUSPLUS UnaryExpr_NoNode
1377 | MINUSMINUS UnaryExpr_NoNode
1378 | AUTOMINUSMINUS UnaryExpr_NoNode
1379 | '+' UnaryExpr_NoNode
1380 | '-' UnaryExpr_NoNode
1381 | '~' UnaryExpr_NoNode
1382 | '!' UnaryExpr_NoNode
1386 | UnaryExprCommon_NoNode
1389 UnaryExprNoBF_NoNode:
1390 PostfixExprNoBF_NoNode
1391 | UnaryExprCommon_NoNode
1394 MultiplicativeExpr_NoNode:
1396 | MultiplicativeExpr_NoNode '*' UnaryExpr_NoNode
1397 | MultiplicativeExpr_NoNode '/' UnaryExpr_NoNode
1398 | MultiplicativeExpr_NoNode '%' UnaryExpr_NoNode
1401 MultiplicativeExprNoBF_NoNode:
1402 UnaryExprNoBF_NoNode
1403 | MultiplicativeExprNoBF_NoNode '*' UnaryExpr_NoNode
1404 | MultiplicativeExprNoBF_NoNode '/' UnaryExpr_NoNode
1405 | MultiplicativeExprNoBF_NoNode '%' UnaryExpr_NoNode
1408 AdditiveExpr_NoNode:
1409 MultiplicativeExpr_NoNode
1410 | AdditiveExpr_NoNode '+' MultiplicativeExpr_NoNode
1411 | AdditiveExpr_NoNode '-' MultiplicativeExpr_NoNode
1414 AdditiveExprNoBF_NoNode:
1415 MultiplicativeExprNoBF_NoNode
1416 | AdditiveExprNoBF_NoNode '+' MultiplicativeExpr_NoNode
1417 | AdditiveExprNoBF_NoNode '-' MultiplicativeExpr_NoNode
1422 | ShiftExpr_NoNode LSHIFT AdditiveExpr_NoNode
1423 | ShiftExpr_NoNode RSHIFT AdditiveExpr_NoNode
1424 | ShiftExpr_NoNode URSHIFT AdditiveExpr_NoNode
1427 ShiftExprNoBF_NoNode:
1428 AdditiveExprNoBF_NoNode
1429 | ShiftExprNoBF_NoNode LSHIFT AdditiveExpr_NoNode
1430 | ShiftExprNoBF_NoNode RSHIFT AdditiveExpr_NoNode
1431 | ShiftExprNoBF_NoNode URSHIFT AdditiveExpr_NoNode
1434 RelationalExpr_NoNode:
1436 | RelationalExpr_NoNode '<' ShiftExpr_NoNode
1437 | RelationalExpr_NoNode '>' ShiftExpr_NoNode
1438 | RelationalExpr_NoNode LE ShiftExpr_NoNode
1439 | RelationalExpr_NoNode GE ShiftExpr_NoNode
1440 | RelationalExpr_NoNode INSTANCEOF ShiftExpr_NoNode
1441 | RelationalExpr_NoNode INTOKEN ShiftExpr_NoNode
1444 RelationalExprNoIn_NoNode:
1446 | RelationalExprNoIn_NoNode '<' ShiftExpr_NoNode
1447 | RelationalExprNoIn_NoNode '>' ShiftExpr_NoNode
1448 | RelationalExprNoIn_NoNode LE ShiftExpr_NoNode
1449 | RelationalExprNoIn_NoNode GE ShiftExpr_NoNode
1450 | RelationalExprNoIn_NoNode INSTANCEOF ShiftExpr_NoNode
1453 RelationalExprNoBF_NoNode:
1454 ShiftExprNoBF_NoNode
1455 | RelationalExprNoBF_NoNode '<' ShiftExpr_NoNode
1456 | RelationalExprNoBF_NoNode '>' ShiftExpr_NoNode
1457 | RelationalExprNoBF_NoNode LE ShiftExpr_NoNode
1458 | RelationalExprNoBF_NoNode GE ShiftExpr_NoNode
1459 | RelationalExprNoBF_NoNode INSTANCEOF ShiftExpr_NoNode
1460 | RelationalExprNoBF_NoNode INTOKEN ShiftExpr_NoNode
1463 EqualityExpr_NoNode:
1464 RelationalExpr_NoNode
1465 | EqualityExpr_NoNode EQEQ RelationalExpr_NoNode
1466 | EqualityExpr_NoNode NE RelationalExpr_NoNode
1467 | EqualityExpr_NoNode STREQ RelationalExpr_NoNode
1468 | EqualityExpr_NoNode STRNEQ RelationalExpr_NoNode
1471 EqualityExprNoIn_NoNode:
1472 RelationalExprNoIn_NoNode
1473 | EqualityExprNoIn_NoNode EQEQ RelationalExprNoIn_NoNode
1474 | EqualityExprNoIn_NoNode NE RelationalExprNoIn_NoNode
1475 | EqualityExprNoIn_NoNode STREQ RelationalExprNoIn_NoNode
1476 | EqualityExprNoIn_NoNode STRNEQ RelationalExprNoIn_NoNode
1479 EqualityExprNoBF_NoNode:
1480 RelationalExprNoBF_NoNode
1481 | EqualityExprNoBF_NoNode EQEQ RelationalExpr_NoNode
1482 | EqualityExprNoBF_NoNode NE RelationalExpr_NoNode
1483 | EqualityExprNoBF_NoNode STREQ RelationalExpr_NoNode
1484 | EqualityExprNoBF_NoNode STRNEQ RelationalExpr_NoNode
1487 BitwiseANDExpr_NoNode:
1489 | BitwiseANDExpr_NoNode '&' EqualityExpr_NoNode
1492 BitwiseANDExprNoIn_NoNode:
1493 EqualityExprNoIn_NoNode
1494 | BitwiseANDExprNoIn_NoNode '&' EqualityExprNoIn_NoNode
1497 BitwiseANDExprNoBF_NoNode:
1498 EqualityExprNoBF_NoNode
1499 | BitwiseANDExprNoBF_NoNode '&' EqualityExpr_NoNode
1502 BitwiseXORExpr_NoNode:
1503 BitwiseANDExpr_NoNode
1504 | BitwiseXORExpr_NoNode '^' BitwiseANDExpr_NoNode
1507 BitwiseXORExprNoIn_NoNode:
1508 BitwiseANDExprNoIn_NoNode
1509 | BitwiseXORExprNoIn_NoNode '^' BitwiseANDExprNoIn_NoNode
1512 BitwiseXORExprNoBF_NoNode:
1513 BitwiseANDExprNoBF_NoNode
1514 | BitwiseXORExprNoBF_NoNode '^' BitwiseANDExpr_NoNode
1517 BitwiseORExpr_NoNode:
1518 BitwiseXORExpr_NoNode
1519 | BitwiseORExpr_NoNode '|' BitwiseXORExpr_NoNode
1522 BitwiseORExprNoIn_NoNode:
1523 BitwiseXORExprNoIn_NoNode
1524 | BitwiseORExprNoIn_NoNode '|' BitwiseXORExprNoIn_NoNode
1527 BitwiseORExprNoBF_NoNode:
1528 BitwiseXORExprNoBF_NoNode
1529 | BitwiseORExprNoBF_NoNode '|' BitwiseXORExpr_NoNode
1532 LogicalANDExpr_NoNode:
1533 BitwiseORExpr_NoNode
1534 | LogicalANDExpr_NoNode AND BitwiseORExpr_NoNode
1537 LogicalANDExprNoIn_NoNode:
1538 BitwiseORExprNoIn_NoNode
1539 | LogicalANDExprNoIn_NoNode AND BitwiseORExprNoIn_NoNode
1542 LogicalANDExprNoBF_NoNode:
1543 BitwiseORExprNoBF_NoNode
1544 | LogicalANDExprNoBF_NoNode AND BitwiseORExpr_NoNode
1547 LogicalORExpr_NoNode:
1548 LogicalANDExpr_NoNode
1549 | LogicalORExpr_NoNode OR LogicalANDExpr_NoNode
1552 LogicalORExprNoIn_NoNode:
1553 LogicalANDExprNoIn_NoNode
1554 | LogicalORExprNoIn_NoNode OR LogicalANDExprNoIn_NoNode
1557 LogicalORExprNoBF_NoNode:
1558 LogicalANDExprNoBF_NoNode
1559 | LogicalORExprNoBF_NoNode OR LogicalANDExpr_NoNode
1562 ConditionalExpr_NoNode:
1563 LogicalORExpr_NoNode
1564 | LogicalORExpr_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode
1567 ConditionalExprNoIn_NoNode:
1568 LogicalORExprNoIn_NoNode
1569 | LogicalORExprNoIn_NoNode '?' AssignmentExprNoIn_NoNode ':' AssignmentExprNoIn_NoNode
1572 ConditionalExprNoBF_NoNode:
1573 LogicalORExprNoBF_NoNode
1574 | LogicalORExprNoBF_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode
1577 AssignmentExpr_NoNode:
1578 ConditionalExpr_NoNode
1579 | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode
1582 AssignmentExprNoIn_NoNode:
1583 ConditionalExprNoIn_NoNode
1584 | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExprNoIn_NoNode
1587 AssignmentExprNoBF_NoNode:
1588 ConditionalExprNoBF_NoNode
1589 | LeftHandSideExprNoBF_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode
1592 AssignmentOperator_NoNode:
1608 AssignmentExpr_NoNode
1609 | Expr_NoNode ',' AssignmentExpr_NoNode
1613 AssignmentExprNoIn_NoNode
1614 | ExprNoIn_NoNode ',' AssignmentExprNoIn_NoNode
1618 AssignmentExprNoBF_NoNode
1619 | ExprNoBF_NoNode ',' AssignmentExpr_NoNode
1624 | VariableStatement_NoNode
1625 | ConstStatement_NoNode
1626 | FunctionDeclaration_NoNode
1627 | EmptyStatement_NoNode
1628 | ExprStatement_NoNode
1629 | IfStatement_NoNode
1630 | IterationStatement_NoNode
1631 | ContinueStatement_NoNode
1632 | BreakStatement_NoNode
1633 | ReturnStatement_NoNode
1634 | WithStatement_NoNode
1635 | SwitchStatement_NoNode
1636 | LabelledStatement_NoNode
1637 | ThrowStatement_NoNode
1638 | TryStatement_NoNode
1639 | DebuggerStatement_NoNode
1643 OPENBRACE CLOSEBRACE { }
1644 | OPENBRACE SourceElements_NoNode CLOSEBRACE { }
1647 VariableStatement_NoNode:
1648 VAR VariableDeclarationList_NoNode ';'
1649 | VAR VariableDeclarationList_NoNode error { AUTO_SEMICOLON; }
1652 VariableDeclarationList_NoNode:
1654 | IDENT Initializer_NoNode { }
1655 | VariableDeclarationList_NoNode ',' IDENT
1656 | VariableDeclarationList_NoNode ',' IDENT Initializer_NoNode
1659 VariableDeclarationListNoIn_NoNode:
1661 | IDENT InitializerNoIn_NoNode { }
1662 | VariableDeclarationListNoIn_NoNode ',' IDENT
1663 | VariableDeclarationListNoIn_NoNode ',' IDENT InitializerNoIn_NoNode
1666 ConstStatement_NoNode:
1667 CONSTTOKEN ConstDeclarationList_NoNode ';'
1668 | CONSTTOKEN ConstDeclarationList_NoNode error { AUTO_SEMICOLON; }
1671 ConstDeclarationList_NoNode:
1672 ConstDeclaration_NoNode
1673 | ConstDeclarationList_NoNode ',' ConstDeclaration_NoNode
1676 ConstDeclaration_NoNode:
1678 | IDENT Initializer_NoNode { }
1682 '=' AssignmentExpr_NoNode
1685 InitializerNoIn_NoNode:
1686 '=' AssignmentExprNoIn_NoNode
1689 EmptyStatement_NoNode:
1693 ExprStatement_NoNode:
1695 | ExprNoBF_NoNode error { AUTO_SEMICOLON; }
1699 IF '(' Expr_NoNode ')' Statement_NoNode %prec IF_WITHOUT_ELSE
1700 | IF '(' Expr_NoNode ')' Statement_NoNode ELSE Statement_NoNode
1703 IterationStatement_NoNode:
1704 DO Statement_NoNode WHILE '(' Expr_NoNode ')' ';'
1705 | DO Statement_NoNode WHILE '(' Expr_NoNode ')' error // Always performs automatic semicolon insertion
1706 | WHILE '(' Expr_NoNode ')' Statement_NoNode
1707 | FOR '(' ExprNoInOpt_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode
1708 | FOR '(' VAR VariableDeclarationListNoIn_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode
1709 | FOR '(' LeftHandSideExpr_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode
1710 | FOR '(' VAR IDENT INTOKEN Expr_NoNode ')' Statement_NoNode
1711 | FOR '(' VAR IDENT InitializerNoIn_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode
1724 ContinueStatement_NoNode:
1726 | CONTINUE error { AUTO_SEMICOLON; }
1727 | CONTINUE IDENT ';'
1728 | CONTINUE IDENT error { AUTO_SEMICOLON; }
1731 BreakStatement_NoNode:
1733 | BREAK error { AUTO_SEMICOLON; }
1735 | BREAK IDENT error { AUTO_SEMICOLON; }
1738 ReturnStatement_NoNode:
1740 | RETURN error { AUTO_SEMICOLON; }
1741 | RETURN Expr_NoNode ';'
1742 | RETURN Expr_NoNode error { AUTO_SEMICOLON; }
1745 WithStatement_NoNode:
1746 WITH '(' Expr_NoNode ')' Statement_NoNode
1749 SwitchStatement_NoNode:
1750 SWITCH '(' Expr_NoNode ')' CaseBlock_NoNode
1754 OPENBRACE CaseClausesOpt_NoNode CLOSEBRACE { }
1755 | OPENBRACE CaseClausesOpt_NoNode DefaultClause_NoNode CaseClausesOpt_NoNode CLOSEBRACE { }
1758 CaseClausesOpt_NoNode:
1760 | CaseClauses_NoNode
1765 | CaseClauses_NoNode CaseClause_NoNode
1769 CASE Expr_NoNode ':'
1770 | CASE Expr_NoNode ':' SourceElements_NoNode
1773 DefaultClause_NoNode:
1775 | DEFAULT ':' SourceElements_NoNode
1778 LabelledStatement_NoNode:
1779 IDENT ':' Statement_NoNode { }
1782 ThrowStatement_NoNode:
1783 THROW Expr_NoNode ';'
1784 | THROW Expr_NoNode error { AUTO_SEMICOLON; }
1787 TryStatement_NoNode:
1788 TRY Block_NoNode FINALLY Block_NoNode
1789 | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode
1790 | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode FINALLY Block_NoNode
1793 DebuggerStatement_NoNode:
1795 | DEBUGGER error { AUTO_SEMICOLON; }
1798 FunctionDeclaration_NoNode:
1799 FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1800 | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1803 FunctionExpr_NoNode:
1804 FUNCTION '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1805 | FUNCTION '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1806 | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1807 | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1810 FormalParameterList_NoNode:
1812 | FormalParameterList_NoNode ',' IDENT
1815 FunctionBody_NoNode:
1817 | SourceElements_NoNode
1820 SourceElements_NoNode:
1822 | SourceElements_NoNode Statement_NoNode
1829 static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
1831 if (!loc->isLocation())
1832 return new (GLOBAL_DATA) AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot);
1834 if (loc->isResolveNode()) {
1835 ResolveNode* resolve = static_cast<ResolveNode*>(loc);
1836 if (op == OpEqual) {
1837 AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, resolve->identifier(), expr, exprHasAssignments);
1838 SET_EXCEPTION_LOCATION(node, start, divot, end);
1841 return new (GLOBAL_DATA) ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1843 if (loc->isBracketAccessorNode()) {
1844 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
1846 return new (GLOBAL_DATA) AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
1848 ReadModifyBracketNode* node = new (GLOBAL_DATA) ReadModifyBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
1849 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1853 ASSERT(loc->isDotAccessorNode());
1854 DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
1856 return new (GLOBAL_DATA) AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
1858 ReadModifyDotNode* node = new (GLOBAL_DATA) ReadModifyDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1859 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1863 static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
1865 if (!expr->isLocation())
1866 return new (GLOBAL_DATA) PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
1868 if (expr->isResolveNode()) {
1869 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1870 return new (GLOBAL_DATA) PrefixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
1872 if (expr->isBracketAccessorNode()) {
1873 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1874 PrefixBracketNode* node = new (GLOBAL_DATA) PrefixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1875 node->setSubexpressionInfo(bracket->divot(), bracket->startOffset());
1878 ASSERT(expr->isDotAccessorNode());
1879 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1880 PrefixDotNode* node = new (GLOBAL_DATA) PrefixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1881 node->setSubexpressionInfo(dot->divot(), dot->startOffset());
1885 static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
1887 if (!expr->isLocation())
1888 return new (GLOBAL_DATA) PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
1890 if (expr->isResolveNode()) {
1891 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1892 return new (GLOBAL_DATA) PostfixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
1894 if (expr->isBracketAccessorNode()) {
1895 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1896 PostfixBracketNode* node = new (GLOBAL_DATA) PostfixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1897 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1901 ASSERT(expr->isDotAccessorNode());
1902 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1903 PostfixDotNode* node = new (GLOBAL_DATA) PostfixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1904 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1908 static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
1910 CodeFeatures features = func.m_features | args.m_features;
1911 int numConstants = func.m_numConstants + args.m_numConstants;
1912 if (!func.m_node->isLocation())
1913 return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallValueNode(GLOBAL_DATA, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
1914 if (func.m_node->isResolveNode()) {
1915 ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
1916 const Identifier& identifier = resolve->identifier();
1917 if (identifier == GLOBAL_DATA->propertyNames->eval)
1918 return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EvalFunctionCallNode(GLOBAL_DATA, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
1919 return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallResolveNode(GLOBAL_DATA, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
1921 if (func.m_node->isBracketAccessorNode()) {
1922 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
1923 FunctionCallBracketNode* node = new (GLOBAL_DATA) FunctionCallBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
1924 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1925 return createNodeInfo<ExpressionNode*>(node, features, numConstants);
1927 ASSERT(func.m_node->isDotAccessorNode());
1928 DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
1929 FunctionCallDotNode* node;
1930 if (dot->identifier() == GLOBAL_DATA->propertyNames->call)
1931 node = new (GLOBAL_DATA) CallFunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1932 else if (dot->identifier() == GLOBAL_DATA->propertyNames->apply)
1933 node = new (GLOBAL_DATA) ApplyFunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1935 node = new (GLOBAL_DATA) FunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1936 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1937 return createNodeInfo<ExpressionNode*>(node, features, numConstants);
1940 static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr)
1942 if (expr->isResolveNode()) {
1943 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1944 return new (GLOBAL_DATA) TypeOfResolveNode(GLOBAL_DATA, resolve->identifier());
1946 return new (GLOBAL_DATA) TypeOfValueNode(GLOBAL_DATA, expr);
1949 static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end)
1951 if (!expr->isLocation())
1952 return new (GLOBAL_DATA) DeleteValueNode(GLOBAL_DATA, expr);
1953 if (expr->isResolveNode()) {
1954 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1955 return new (GLOBAL_DATA) DeleteResolveNode(GLOBAL_DATA, resolve->identifier(), divot, divot - start, end - divot);
1957 if (expr->isBracketAccessorNode()) {
1958 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1959 return new (GLOBAL_DATA) DeleteBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
1961 ASSERT(expr->isDotAccessorNode());
1962 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1963 return new (GLOBAL_DATA) DeleteDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), divot, divot - start, end - divot);
1966 static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
1968 PropertyNode::Type type;
1969 if (getOrSet == "get")
1970 type = PropertyNode::Getter;
1971 else if (getOrSet == "set")
1972 type = PropertyNode::Setter;
1975 return new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
1978 static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n)
1980 if (n->isNumber()) {
1981 NumberNode* number = static_cast<NumberNode*>(n);
1983 if (number->value() > 0.0) {
1984 number->setValue(-number->value());
1989 return new (GLOBAL_DATA) NegateNode(GLOBAL_DATA, n);
1992 static NumberNode* makeNumberNode(void* globalPtr, double d)
1994 return new (GLOBAL_DATA) NumberNode(GLOBAL_DATA, d);
1997 static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr)
1999 if (expr->isNumber())
2000 return makeNumberNode(globalPtr, ~toInt32(static_cast<NumberNode*>(expr)->value()));
2001 return new (GLOBAL_DATA) BitwiseNotNode(GLOBAL_DATA, expr);
2004 static ExpressionNode* makeMultNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2006 expr1 = expr1->stripUnaryPlus();
2007 expr2 = expr2->stripUnaryPlus();
2009 if (expr1->isNumber() && expr2->isNumber())
2010 return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
2012 if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
2013 return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr2);
2015 if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
2016 return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr1);
2018 return new (GLOBAL_DATA) MultNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
2021 static ExpressionNode* makeDivNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2023 expr1 = expr1->stripUnaryPlus();
2024 expr2 = expr2->stripUnaryPlus();
2026 if (expr1->isNumber() && expr2->isNumber())
2027 return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
2028 return new (GLOBAL_DATA) DivNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
2031 static ExpressionNode* makeAddNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2033 if (expr1->isNumber() && expr2->isNumber())
2034 return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
2035 return new (GLOBAL_DATA) AddNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
2038 static ExpressionNode* makeSubNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2040 expr1 = expr1->stripUnaryPlus();
2041 expr2 = expr2->stripUnaryPlus();
2043 if (expr1->isNumber() && expr2->isNumber())
2044 return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
2045 return new (GLOBAL_DATA) SubNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
2048 static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2050 if (expr1->isNumber() && expr2->isNumber())
2051 return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
2052 return new (GLOBAL_DATA) LeftShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
2055 static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2057 if (expr1->isNumber() && expr2->isNumber())
2058 return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
2059 return new (GLOBAL_DATA) RightShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
2062 /* called by yyparse on error */
2063 int yyerror(const char *)
2068 /* may we automatically insert a semicolon ? */
2069 static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
2071 return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
2074 static ExpressionNode* combineCommaNodes(void* globalPtr, ExpressionNode* list, ExpressionNode* init)
2078 if (list->isCommaNode()) {
2079 static_cast<CommaNode*>(list)->append(init);
2082 return new (GLOBAL_DATA) CommaNode(GLOBAL_DATA, list, init);
2085 // We turn variable declarations into either assignments or empty
2086 // statements (which later get stripped out), because the actual
2087 // declaration work is hoisted up to the start of the function body
2088 static StatementNode* makeVarStatementNode(void* globalPtr, ExpressionNode* expr)
2091 return new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA);
2092 return new (GLOBAL_DATA) VarStatementNode(GLOBAL_DATA, expr);