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
31 #include "NodeConstructors.h"
35 #include <wtf/MathExtras.h>
37 #define YYMALLOC fastMalloc
38 #define YYFREE fastFree
40 #define YYMAXDEPTH 10000
41 #define YYENABLE_NLS 0
43 // Default values for bison.
44 #define YYDEBUG 0 // Set to 1 to debug a parse error.
45 #define jscyydebug 0 // Set to 1 to debug a parse error.
47 // Avoid triggering warnings in older bison by not setting this on the Darwin platform.
48 // FIXME: Is this still needed?
49 #define YYERROR_VERBOSE
52 int jscyyerror(const char*);
54 static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
56 #define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr)
57 #define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*GLOBAL_DATA->lexer, yychar)) YYABORT; } while (0)
62 static ExpressionNode* makeAssignNode(JSGlobalData*, ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end);
63 static ExpressionNode* makePrefixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
64 static ExpressionNode* makePostfixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end);
65 static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData*, const Identifier& getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
66 static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData*, ExpressionNodeInfo function, ArgumentsNodeInfo, int start, int divot, int end);
67 static ExpressionNode* makeTypeOfNode(JSGlobalData*, ExpressionNode*);
68 static ExpressionNode* makeDeleteNode(JSGlobalData*, ExpressionNode*, int start, int divot, int end);
69 static ExpressionNode* makeNegateNode(JSGlobalData*, ExpressionNode*);
70 static NumberNode* makeNumberNode(JSGlobalData*, double);
71 static ExpressionNode* makeBitwiseNotNode(JSGlobalData*, ExpressionNode*);
72 static ExpressionNode* makeMultNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
73 static ExpressionNode* makeDivNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
74 static ExpressionNode* makeAddNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
75 static ExpressionNode* makeSubNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
76 static ExpressionNode* makeLeftShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
77 static ExpressionNode* makeRightShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
78 static StatementNode* makeVarStatementNode(JSGlobalData*, ExpressionNode*);
79 static ExpressionNode* combineCommaNodes(JSGlobalData*, ExpressionNode* list, ExpressionNode* init);
83 #pragma warning(disable: 4065)
84 #pragma warning(disable: 4244)
85 #pragma warning(disable: 4702)
89 #define YYPARSE_PARAM globalPtr
90 #define YYLEX_PARAM globalPtr
92 template <typename T> inline NodeDeclarationInfo<T> createNodeDeclarationInfo(T node,
93 ParserArenaData<DeclarationStacks::VarStack>* varDecls,
94 ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls,
95 CodeFeatures info, int numConstants)
97 ASSERT((info & ~AllFeatures) == 0);
98 NodeDeclarationInfo<T> result = { node, varDecls, funcDecls, info, numConstants };
102 template <typename T> inline NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants)
104 ASSERT((info & ~AllFeatures) == 0);
105 NodeInfo<T> result = { node, info, numConstants };
109 template <typename T> inline T mergeDeclarationLists(T decls1, T decls2)
111 // decls1 or both are null
114 // only decls1 is non-null
119 decls1->data.append(decls2->data);
121 // Manually release as much as possible from the now-defunct declaration lists
122 // to avoid accumulating so many unused heap allocated vectors.
123 decls2->data.clear();
128 static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
131 varDecls = new (globalData) ParserArenaData<DeclarationStacks::VarStack>;
133 varDecls->data.append(make_pair(&ident, attrs));
136 static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
138 unsigned attrs = DeclarationStacks::IsConstant;
139 if (decl->hasInitializer())
140 attrs |= DeclarationStacks::HasInitializer;
141 appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs);
149 const Identifier* ident;
151 // expression subtrees
152 ExpressionNodeInfo expressionNode;
153 FuncDeclNodeInfo funcDeclNode;
154 PropertyNodeInfo propertyNode;
155 ArgumentsNodeInfo argumentsNode;
156 ConstDeclNodeInfo constDeclNode;
157 CaseBlockNodeInfo caseBlockNode;
158 CaseClauseNodeInfo caseClauseNode;
159 FuncExprNodeInfo funcExprNode;
162 StatementNodeInfo statementNode;
163 FunctionBodyNode* functionBodyNode;
164 ProgramNode* programNode;
166 SourceElementsInfo sourceElements;
167 PropertyListInfo propertyList;
168 ArgumentListInfo argumentList;
169 VarDeclListInfo varDeclList;
170 ConstDeclListInfo constDeclList;
171 ClauseListInfo clauseList;
172 ElementListInfo elementList;
173 ParameterListInfo parameterList;
180 template <typename T> inline void setStatementLocation(StatementNode* statement, const T& start, const T& end)
182 statement->setLoc(start.first_line, end.last_line);
185 static inline void setExceptionLocation(ThrowableExpressionData* node, unsigned start, unsigned divot, unsigned end)
187 node->setExceptionSourceCode(divot, divot - start, end - divot);
195 %token NULLTOKEN TRUETOKEN FALSETOKEN
198 %token BREAK CASE DEFAULT FOR NEW VAR CONSTTOKEN CONTINUE
199 %token FUNCTION RETURN VOIDTOKEN DELETETOKEN
200 %token IF THISTOKEN DO WHILE INTOKEN INSTANCEOF TYPEOF
201 %token SWITCH WITH RESERVED
202 %token THROW TRY CATCH FINALLY
205 /* give an if without an else higher precedence than an else to resolve the ambiguity */
206 %nonassoc IF_WITHOUT_ELSE
210 %token EQEQ NE /* == and != */
211 %token STREQ STRNEQ /* === and !== */
212 %token LE GE /* < and > */
213 %token OR AND /* || and && */
214 %token PLUSPLUS MINUSMINUS /* ++ and -- */
215 %token LSHIFT /* << */
216 %token RSHIFT URSHIFT /* >> and >>> */
217 %token PLUSEQUAL MINUSEQUAL /* += and -= */
218 %token MULTEQUAL DIVEQUAL /* *= and /= */
219 %token LSHIFTEQUAL /* <<= */
220 %token RSHIFTEQUAL URSHIFTEQUAL /* >>= and >>>= */
221 %token ANDEQUAL MODEQUAL /* &= and %= */
222 %token XOREQUAL OREQUAL /* ^= and |= */
223 %token <intValue> OPENBRACE /* { (with char offset) */
224 %token <intValue> CLOSEBRACE /* } (with char offset) */
227 %token <doubleValue> NUMBER
228 %token <ident> IDENT STRING
230 /* automatically inserted semicolon */
231 %token AUTOPLUSPLUS AUTOMINUSMINUS
233 /* non-terminal types */
234 %type <expressionNode> Literal ArrayLiteral
236 %type <expressionNode> PrimaryExpr PrimaryExprNoBrace
237 %type <expressionNode> MemberExpr MemberExprNoBF /* BF => brace or function */
238 %type <expressionNode> NewExpr NewExprNoBF
239 %type <expressionNode> CallExpr CallExprNoBF
240 %type <expressionNode> LeftHandSideExpr LeftHandSideExprNoBF
241 %type <expressionNode> PostfixExpr PostfixExprNoBF
242 %type <expressionNode> UnaryExpr UnaryExprNoBF UnaryExprCommon
243 %type <expressionNode> MultiplicativeExpr MultiplicativeExprNoBF
244 %type <expressionNode> AdditiveExpr AdditiveExprNoBF
245 %type <expressionNode> ShiftExpr ShiftExprNoBF
246 %type <expressionNode> RelationalExpr RelationalExprNoIn RelationalExprNoBF
247 %type <expressionNode> EqualityExpr EqualityExprNoIn EqualityExprNoBF
248 %type <expressionNode> BitwiseANDExpr BitwiseANDExprNoIn BitwiseANDExprNoBF
249 %type <expressionNode> BitwiseXORExpr BitwiseXORExprNoIn BitwiseXORExprNoBF
250 %type <expressionNode> BitwiseORExpr BitwiseORExprNoIn BitwiseORExprNoBF
251 %type <expressionNode> LogicalANDExpr LogicalANDExprNoIn LogicalANDExprNoBF
252 %type <expressionNode> LogicalORExpr LogicalORExprNoIn LogicalORExprNoBF
253 %type <expressionNode> ConditionalExpr ConditionalExprNoIn ConditionalExprNoBF
254 %type <expressionNode> AssignmentExpr AssignmentExprNoIn AssignmentExprNoBF
255 %type <expressionNode> Expr ExprNoIn ExprNoBF
257 %type <expressionNode> ExprOpt ExprNoInOpt
259 %type <statementNode> Statement Block
260 %type <statementNode> VariableStatement ConstStatement EmptyStatement ExprStatement
261 %type <statementNode> IfStatement IterationStatement ContinueStatement
262 %type <statementNode> BreakStatement ReturnStatement WithStatement
263 %type <statementNode> SwitchStatement LabelledStatement
264 %type <statementNode> ThrowStatement TryStatement
265 %type <statementNode> DebuggerStatement
267 %type <expressionNode> Initializer InitializerNoIn
268 %type <statementNode> FunctionDeclaration
269 %type <funcExprNode> FunctionExpr
270 %type <functionBodyNode> FunctionBody
271 %type <sourceElements> SourceElements
272 %type <parameterList> FormalParameterList
273 %type <op> AssignmentOperator
274 %type <argumentsNode> Arguments
275 %type <argumentList> ArgumentList
276 %type <varDeclList> VariableDeclarationList VariableDeclarationListNoIn
277 %type <constDeclList> ConstDeclarationList
278 %type <constDeclNode> ConstDeclaration
279 %type <caseBlockNode> CaseBlock
280 %type <caseClauseNode> CaseClause DefaultClause
281 %type <clauseList> CaseClauses CaseClausesOpt
282 %type <intValue> Elision ElisionOpt
283 %type <elementList> ElementList
284 %type <propertyNode> Property
285 %type <propertyList> PropertyList
288 // FIXME: There are currently two versions of the grammar in this file, the normal one, and the NoNodes version used for
289 // lazy recompilation of FunctionBodyNodes. We should move to generating the two versions from a script to avoid bugs.
290 // In the mean time, make sure to make any changes to the grammar in both versions.
293 NULLTOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NullNode(GLOBAL_DATA), 0, 1); }
294 | TRUETOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, true), 0, 1); }
295 | FALSETOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BooleanNode(GLOBAL_DATA, false), 0, 1); }
296 | NUMBER { $$ = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, $1), 0, 1); }
297 | STRING { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *$1), 0, 1); }
299 Lexer& l = *GLOBAL_DATA->lexer;
300 const Identifier* pattern;
301 const Identifier* flags;
302 if (!l.scanRegExp(pattern, flags))
304 RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
305 int size = pattern->size() + 2; // + 2 for the two /'s
306 setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size);
307 $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
309 | DIVEQUAL /* regexp with /= */ {
310 Lexer& l = *GLOBAL_DATA->lexer;
311 const Identifier* pattern;
312 const Identifier* flags;
313 if (!l.scanRegExp(pattern, flags, '='))
315 RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags);
316 int size = pattern->size() + 2; // + 2 for the two /'s
317 setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size);
318 $$ = createNodeInfo<ExpressionNode*>(node, 0, 0);
323 IDENT ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
324 | STRING ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
325 | NUMBER ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, $1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
326 | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, 0, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); if (!$$.m_node) YYABORT; }
327 | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
329 $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, $4.m_node.head, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
330 if ($4.m_features & ArgumentsFeature)
331 $7->setUsesArguments();
332 setStatementLocation($7, @6, @8);
339 Property { $$.m_node.head = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $1.m_node);
340 $$.m_node.tail = $$.m_node.head;
341 $$.m_features = $1.m_features;
342 $$.m_numConstants = $1.m_numConstants; }
343 | PropertyList ',' Property { $$.m_node.head = $1.m_node.head;
344 $$.m_node.tail = new (GLOBAL_DATA) PropertyListNode(GLOBAL_DATA, $3.m_node, $1.m_node.tail);
345 $$.m_features = $1.m_features | $3.m_features;
346 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
351 | OPENBRACE CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA), 0, 0); }
352 | OPENBRACE PropertyList CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
353 /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
354 | OPENBRACE PropertyList ',' CLOSEBRACE { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
358 THISTOKEN { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ThisNode(GLOBAL_DATA), ThisFeature, 0); }
361 | IDENT { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ResolveNode(GLOBAL_DATA, *$1, @1.first_column), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
362 | '(' Expr ')' { $$ = $2; }
366 '[' ElisionOpt ']' { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2), 0, $2 ? 1 : 0); }
367 | '[' ElementList ']' { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
368 | '[' ElementList ',' ElisionOpt ']' { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ArrayNode(GLOBAL_DATA, $4, $2.m_node.head), $2.m_features, $4 ? $2.m_numConstants + 1 : $2.m_numConstants); }
372 ElisionOpt AssignmentExpr { $$.m_node.head = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1, $2.m_node);
373 $$.m_node.tail = $$.m_node.head;
374 $$.m_features = $2.m_features;
375 $$.m_numConstants = $2.m_numConstants; }
376 | ElementList ',' ElisionOpt AssignmentExpr
377 { $$.m_node.head = $1.m_node.head;
378 $$.m_node.tail = new (GLOBAL_DATA) ElementNode(GLOBAL_DATA, $1.m_node.tail, $3, $4.m_node);
379 $$.m_features = $1.m_features | $4.m_features;
380 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; }
384 /* nothing */ { $$ = 0; }
390 | Elision ',' { $$ = $1 + 1; }
395 | FunctionExpr { $$ = createNodeInfo<ExpressionNode*>($1.m_node, $1.m_features, $1.m_numConstants); }
396 | MemberExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
397 setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
398 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
400 | MemberExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
401 setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
402 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
404 | NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
405 setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
406 $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
412 | MemberExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
413 setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
414 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
416 | MemberExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
417 setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
418 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
420 | NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
421 setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column);
422 $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
428 | NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
429 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
430 $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
436 | NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node);
437 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
438 $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants);
443 MemberExpr Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
444 | CallExpr Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
445 | CallExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
446 setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
447 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
449 | CallExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
450 setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
451 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); }
455 MemberExprNoBF Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
456 | CallExprNoBF Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
457 | CallExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
458 setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column);
459 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
461 | CallExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
462 setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column);
463 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants);
468 '(' ')' { $$ = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA), 0, 0); }
469 | '(' ArgumentList ')' { $$ = createNodeInfo<ArgumentsNode*>(new (GLOBAL_DATA) ArgumentsNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
473 AssignmentExpr { $$.m_node.head = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node);
474 $$.m_node.tail = $$.m_node.head;
475 $$.m_features = $1.m_features;
476 $$.m_numConstants = $1.m_numConstants; }
477 | ArgumentList ',' AssignmentExpr { $$.m_node.head = $1.m_node.head;
478 $$.m_node.tail = new (GLOBAL_DATA) ArgumentListNode(GLOBAL_DATA, $1.m_node.tail, $3.m_node);
479 $$.m_features = $1.m_features | $3.m_features;
480 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
488 LeftHandSideExprNoBF:
495 | LeftHandSideExpr PLUSPLUS { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
496 | LeftHandSideExpr MINUSMINUS { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
501 | LeftHandSideExprNoBF PLUSPLUS { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
502 | LeftHandSideExprNoBF MINUSMINUS { $$ = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
506 DELETETOKEN UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, $2.m_node, @1.first_column, @2.last_column, @2.last_column), $2.m_features, $2.m_numConstants); }
507 | VOIDTOKEN UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) VoidNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants + 1); }
508 | TYPEOF UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
509 | PLUSPLUS UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
510 | AUTOPLUSPLUS UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
511 | MINUSMINUS UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
512 | AUTOMINUSMINUS UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
513 | '+' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
514 | '-' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
515 | '~' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
516 | '!' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
530 | MultiplicativeExpr '*' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
531 | MultiplicativeExpr '/' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
532 | MultiplicativeExpr '%' UnaryExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
535 MultiplicativeExprNoBF:
537 | MultiplicativeExprNoBF '*' UnaryExpr
538 { $$ = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
539 | MultiplicativeExprNoBF '/' UnaryExpr
540 { $$ = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
541 | MultiplicativeExprNoBF '%' UnaryExpr
542 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
547 | AdditiveExpr '+' MultiplicativeExpr { $$ = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
548 | AdditiveExpr '-' MultiplicativeExpr { $$ = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
552 MultiplicativeExprNoBF
553 | AdditiveExprNoBF '+' MultiplicativeExpr
554 { $$ = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
555 | AdditiveExprNoBF '-' MultiplicativeExpr
556 { $$ = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
561 | ShiftExpr LSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
562 | ShiftExpr RSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
563 | ShiftExpr URSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
568 | ShiftExprNoBF LSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
569 | ShiftExprNoBF RSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
570 | ShiftExprNoBF URSHIFT AdditiveExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
575 | RelationalExpr '<' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
576 | RelationalExpr '>' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
577 | RelationalExpr LE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
578 | RelationalExpr GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
579 | RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
580 setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
581 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
582 | RelationalExpr INTOKEN ShiftExpr { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
583 setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
584 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
589 | RelationalExprNoIn '<' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
590 | RelationalExprNoIn '>' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
591 | RelationalExprNoIn LE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
592 | RelationalExprNoIn GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
593 | RelationalExprNoIn INSTANCEOF ShiftExpr
594 { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
595 setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
596 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
601 | RelationalExprNoBF '<' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
602 | RelationalExprNoBF '>' ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
603 | RelationalExprNoBF LE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
604 | RelationalExprNoBF GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
605 | RelationalExprNoBF INSTANCEOF ShiftExpr
606 { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
607 setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
608 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
609 | RelationalExprNoBF INTOKEN ShiftExpr
610 { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature);
611 setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column);
612 $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
617 | EqualityExpr EQEQ RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
618 | EqualityExpr NE RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
619 | EqualityExpr STREQ RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
620 | EqualityExpr STRNEQ RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
625 | EqualityExprNoIn EQEQ RelationalExprNoIn
626 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
627 | EqualityExprNoIn NE RelationalExprNoIn
628 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
629 | EqualityExprNoIn STREQ RelationalExprNoIn
630 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
631 | EqualityExprNoIn STRNEQ RelationalExprNoIn
632 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
637 | EqualityExprNoBF EQEQ RelationalExpr
638 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
639 | EqualityExprNoBF NE RelationalExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
640 | EqualityExprNoBF STREQ RelationalExpr
641 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
642 | EqualityExprNoBF STRNEQ RelationalExpr
643 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
648 | BitwiseANDExpr '&' EqualityExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
653 | BitwiseANDExprNoIn '&' EqualityExprNoIn
654 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
659 | BitwiseANDExprNoBF '&' EqualityExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
664 | BitwiseXORExpr '^' BitwiseANDExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
669 | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn
670 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
675 | BitwiseXORExprNoBF '^' BitwiseANDExpr
676 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
681 | BitwiseORExpr '|' BitwiseXORExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
686 | BitwiseORExprNoIn '|' BitwiseXORExprNoIn
687 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
692 | BitwiseORExprNoBF '|' BitwiseXORExpr
693 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
698 | LogicalANDExpr AND BitwiseORExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
703 | LogicalANDExprNoIn AND BitwiseORExprNoIn
704 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
709 | LogicalANDExprNoBF AND BitwiseORExpr
710 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
715 | LogicalORExpr OR LogicalANDExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
720 | LogicalORExprNoIn OR LogicalANDExprNoIn
721 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
726 | LogicalORExprNoBF OR LogicalANDExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
731 | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr
732 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
737 | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn
738 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
743 | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr
744 { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
749 | LeftHandSideExpr AssignmentOperator AssignmentExpr
750 { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
751 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
757 | LeftHandSideExpr AssignmentOperator AssignmentExprNoIn
758 { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
759 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
765 | LeftHandSideExprNoBF AssignmentOperator AssignmentExpr
766 { $$ = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_features & AssignFeature, $3.m_features & AssignFeature,
767 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_features | $3.m_features | AssignFeature, $1.m_numConstants + $3.m_numConstants);
772 '=' { $$ = OpEqual; }
773 | PLUSEQUAL { $$ = OpPlusEq; }
774 | MINUSEQUAL { $$ = OpMinusEq; }
775 | MULTEQUAL { $$ = OpMultEq; }
776 | DIVEQUAL { $$ = OpDivEq; }
777 | LSHIFTEQUAL { $$ = OpLShift; }
778 | RSHIFTEQUAL { $$ = OpRShift; }
779 | URSHIFTEQUAL { $$ = OpURShift; }
780 | ANDEQUAL { $$ = OpAndEq; }
781 | XOREQUAL { $$ = OpXOrEq; }
782 | OREQUAL { $$ = OpOrEq; }
783 | MODEQUAL { $$ = OpModEq; }
788 | Expr ',' AssignmentExpr { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
793 | ExprNoIn ',' AssignmentExprNoIn { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
798 | ExprNoBF ',' AssignmentExpr { $$ = createNodeInfo<ExpressionNode*>(combineCommaNodes(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
805 | FunctionDeclaration
822 OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
823 setStatementLocation($$.m_node, @1, @2); }
824 | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
825 setStatementLocation($$.m_node, @1, @3); }
829 VAR VariableDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
830 setStatementLocation($$.m_node, @1, @3); }
831 | VAR VariableDeclarationList error { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
832 setStatementLocation($$.m_node, @1, @2);
836 VariableDeclarationList:
837 IDENT { $$.m_node = 0;
838 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
839 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
840 $$.m_funcDeclarations = 0;
841 $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
842 $$.m_numConstants = 0;
844 | IDENT Initializer { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
845 setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
847 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
848 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
849 $$.m_funcDeclarations = 0;
850 $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features;
851 $$.m_numConstants = $2.m_numConstants;
853 | VariableDeclarationList ',' IDENT
854 { $$.m_node = $1.m_node;
855 $$.m_varDeclarations = $1.m_varDeclarations;
856 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
857 $$.m_funcDeclarations = 0;
858 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
859 $$.m_numConstants = $1.m_numConstants;
861 | VariableDeclarationList ',' IDENT Initializer
862 { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
863 setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
864 $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
865 $$.m_varDeclarations = $1.m_varDeclarations;
866 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
867 $$.m_funcDeclarations = 0;
868 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features;
869 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
873 VariableDeclarationListNoIn:
874 IDENT { $$.m_node = 0;
875 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
876 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
877 $$.m_funcDeclarations = 0;
878 $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
879 $$.m_numConstants = 0;
881 | IDENT InitializerNoIn { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature);
882 setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column);
884 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
885 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
886 $$.m_funcDeclarations = 0;
887 $$.m_features = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features;
888 $$.m_numConstants = $2.m_numConstants;
890 | VariableDeclarationListNoIn ',' IDENT
891 { $$.m_node = $1.m_node;
892 $$.m_varDeclarations = $1.m_varDeclarations;
893 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
894 $$.m_funcDeclarations = 0;
895 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
896 $$.m_numConstants = $1.m_numConstants;
898 | VariableDeclarationListNoIn ',' IDENT InitializerNoIn
899 { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature);
900 setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column);
901 $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node);
902 $$.m_varDeclarations = $1.m_varDeclarations;
903 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
904 $$.m_funcDeclarations = 0;
905 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features;
906 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
911 CONSTTOKEN ConstDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
912 setStatementLocation($$.m_node, @1, @3); }
913 | CONSTTOKEN ConstDeclarationList error
914 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants);
915 setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
918 ConstDeclarationList:
919 ConstDeclaration { $$.m_node.head = $1.m_node;
920 $$.m_node.tail = $$.m_node.head;
921 $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>;
922 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $1.m_node);
923 $$.m_funcDeclarations = 0;
924 $$.m_features = $1.m_features;
925 $$.m_numConstants = $1.m_numConstants;
927 | ConstDeclarationList ',' ConstDeclaration
928 { $$.m_node.head = $1.m_node.head;
929 $1.m_node.tail->m_next = $3.m_node;
930 $$.m_node.tail = $3.m_node;
931 $$.m_varDeclarations = $1.m_varDeclarations;
932 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $3.m_node);
933 $$.m_funcDeclarations = 0;
934 $$.m_features = $1.m_features | $3.m_features;
935 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
939 IDENT { $$ = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, 0), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
940 | IDENT Initializer { $$ = createNodeInfo<ConstDeclNode*>(new (GLOBAL_DATA) ConstDeclNode(GLOBAL_DATA, *$1, $2.m_node), ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_features, $2.m_numConstants); }
944 '=' AssignmentExpr { $$ = $2; }
948 '=' AssignmentExprNoIn { $$ = $2; }
952 ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); }
956 ExprNoBF ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
957 setStatementLocation($$.m_node, @1, @2); }
958 | ExprNoBF error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants);
959 setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
963 IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE
964 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
965 setStatementLocation($$.m_node, @1, @4); }
966 | IF '(' Expr ')' Statement ELSE Statement
967 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node),
968 mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations),
969 mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
970 $3.m_features | $5.m_features | $7.m_features,
971 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
972 setStatementLocation($$.m_node, @1, @4); }
976 DO Statement WHILE '(' Expr ')' ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants);
977 setStatementLocation($$.m_node, @1, @3); }
978 | DO Statement WHILE '(' Expr ')' error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants);
979 setStatementLocation($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
980 | WHILE '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WhileNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
981 setStatementLocation($$.m_node, @1, @4); }
982 | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement
983 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node, $9.m_node, false), $9.m_varDeclarations, $9.m_funcDeclarations,
984 $3.m_features | $5.m_features | $7.m_features | $9.m_features,
985 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
986 setStatementLocation($$.m_node, @1, @8);
988 | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement
989 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true),
990 mergeDeclarationLists($4.m_varDeclarations, $10.m_varDeclarations),
991 mergeDeclarationLists($4.m_funcDeclarations, $10.m_funcDeclarations),
992 $4.m_features | $6.m_features | $8.m_features | $10.m_features,
993 $4.m_numConstants + $6.m_numConstants + $8.m_numConstants + $10.m_numConstants);
994 setStatementLocation($$.m_node, @1, @9); }
995 | FOR '(' LeftHandSideExpr INTOKEN Expr ')' Statement
997 ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node);
998 setExceptionLocation(node, @3.first_column, @3.last_column, @5.last_column);
999 $$ = createNodeDeclarationInfo<StatementNode*>(node, $7.m_varDeclarations, $7.m_funcDeclarations,
1000 $3.m_features | $5.m_features | $7.m_features,
1001 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
1002 setStatementLocation($$.m_node, @1, @6);
1004 | FOR '(' VAR IDENT INTOKEN Expr ')' Statement
1005 { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, 0, $6.m_node, $8.m_node, @5.first_column, @5.first_column - @4.first_column, @6.last_column - @5.first_column);
1006 setExceptionLocation(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
1007 appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
1008 $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $8.m_varDeclarations, $8.m_funcDeclarations, ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $6.m_features | $8.m_features, $6.m_numConstants + $8.m_numConstants);
1009 setStatementLocation($$.m_node, @1, @7); }
1010 | FOR '(' VAR IDENT InitializerNoIn INTOKEN Expr ')' Statement
1011 { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, $5.m_node, $7.m_node, $9.m_node, @5.first_column, @5.first_column - @4.first_column, @5.last_column - @5.first_column);
1012 setExceptionLocation(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
1013 appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
1014 $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $9.m_varDeclarations, $9.m_funcDeclarations,
1015 ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $5.m_features | $7.m_features | $9.m_features,
1016 $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
1017 setStatementLocation($$.m_node, @1, @8); }
1021 /* nothing */ { $$ = createNodeInfo<ExpressionNode*>(0, 0, 0); }
1026 /* nothing */ { $$ = createNodeInfo<ExpressionNode*>(0, 0, 0); }
1031 CONTINUE ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
1032 setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1033 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1034 setStatementLocation($$.m_node, @1, @2); }
1035 | CONTINUE error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA);
1036 setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1037 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1038 setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
1039 | CONTINUE IDENT ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
1040 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1041 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1042 setStatementLocation($$.m_node, @1, @3); }
1043 | CONTINUE IDENT error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2);
1044 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1045 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1046 setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
1050 BREAK ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
1051 setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1052 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
1053 | BREAK error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA);
1054 setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1055 $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
1056 | BREAK IDENT ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
1057 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1058 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @3); }
1059 | BREAK IDENT error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2);
1060 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1061 $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
1065 RETURN ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
1066 setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1067 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); }
1068 | RETURN error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0);
1069 setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column);
1070 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
1071 | RETURN Expr ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
1072 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1073 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @3); }
1074 | RETURN Expr error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node);
1075 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1076 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; }
1080 WITH '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WithNode(GLOBAL_DATA, $3.m_node, $5.m_node, @3.last_column, @3.last_column - @3.first_column),
1081 $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features | WithFeature, $3.m_numConstants + $5.m_numConstants);
1082 setStatementLocation($$.m_node, @1, @4); }
1086 SWITCH '(' Expr ')' CaseBlock { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations,
1087 $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants);
1088 setStatementLocation($$.m_node, @1, @4); }
1092 OPENBRACE CaseClausesOpt CLOSEBRACE { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, 0, 0), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); }
1093 | OPENBRACE CaseClausesOpt DefaultClause CaseClausesOpt CLOSEBRACE
1094 { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new (GLOBAL_DATA) CaseBlockNode(GLOBAL_DATA, $2.m_node.head, $3.m_node, $4.m_node.head),
1095 mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $3.m_varDeclarations), $4.m_varDeclarations),
1096 mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $3.m_funcDeclarations), $4.m_funcDeclarations),
1097 $2.m_features | $3.m_features | $4.m_features,
1098 $2.m_numConstants + $3.m_numConstants + $4.m_numConstants); }
1102 /* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; }
1107 CaseClause { $$.m_node.head = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node);
1108 $$.m_node.tail = $$.m_node.head;
1109 $$.m_varDeclarations = $1.m_varDeclarations;
1110 $$.m_funcDeclarations = $1.m_funcDeclarations;
1111 $$.m_features = $1.m_features;
1112 $$.m_numConstants = $1.m_numConstants; }
1113 | CaseClauses CaseClause { $$.m_node.head = $1.m_node.head;
1114 $$.m_node.tail = new (GLOBAL_DATA) ClauseListNode(GLOBAL_DATA, $1.m_node.tail, $2.m_node);
1115 $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1116 $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1117 $$.m_features = $1.m_features | $2.m_features;
1118 $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
1123 CASE Expr ':' { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node), 0, 0, $2.m_features, $2.m_numConstants); }
1124 | CASE Expr ':' SourceElements { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, $2.m_node, $4.m_node), $4.m_varDeclarations, $4.m_funcDeclarations, $2.m_features | $4.m_features, $2.m_numConstants + $4.m_numConstants); }
1128 DEFAULT ':' { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); }
1129 | DEFAULT ':' SourceElements { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new (GLOBAL_DATA) CaseClauseNode(GLOBAL_DATA, 0, $3.m_node), $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); }
1133 IDENT ':' Statement { LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *$1, $3.m_node);
1134 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1135 $$ = createNodeDeclarationInfo<StatementNode*>(node, $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); }
1139 THROW Expr ';' { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
1140 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1141 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2);
1143 | THROW Expr error { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node);
1144 setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column);
1145 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON;
1150 TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, $4.m_node),
1151 mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations),
1152 mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
1153 $2.m_features | $4.m_features,
1154 $2.m_numConstants + $4.m_numConstants);
1155 setStatementLocation($$.m_node, @1, @2); }
1156 | TRY Block CATCH '(' IDENT ')' Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, 0),
1157 mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations),
1158 mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations),
1159 $2.m_features | $7.m_features | CatchFeature,
1160 $2.m_numConstants + $7.m_numConstants);
1161 setStatementLocation($$.m_node, @1, @2); }
1162 | TRY Block CATCH '(' IDENT ')' Block FINALLY Block
1163 { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, $9.m_node),
1164 mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), $9.m_varDeclarations),
1165 mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $9.m_funcDeclarations),
1166 $2.m_features | $7.m_features | $9.m_features | CatchFeature,
1167 $2.m_numConstants + $7.m_numConstants + $9.m_numConstants);
1168 setStatementLocation($$.m_node, @1, @2); }
1172 DEBUGGER ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
1173 setStatementLocation($$.m_node, @1, @2); }
1174 | DEBUGGER error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
1175 setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; }
1178 FunctionDeclaration:
1179 FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); setStatementLocation($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body()); }
1180 | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1182 $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0);
1183 if ($4.m_features & ArgumentsFeature)
1184 $7->setUsesArguments();
1185 setStatementLocation($7, @6, @8);
1186 $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body());
1191 FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); }
1192 | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1194 $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
1195 if ($3.m_features & ArgumentsFeature)
1196 $6->setUsesArguments();
1197 setStatementLocation($6, @5, @7);
1199 | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); }
1200 | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1202 $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0);
1203 if ($4.m_features & ArgumentsFeature)
1204 $7->setUsesArguments();
1205 setStatementLocation($7, @6, @8);
1209 FormalParameterList:
1210 IDENT { $$.m_node.head = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, *$1);
1211 $$.m_features = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
1212 $$.m_node.tail = $$.m_node.head; }
1213 | FormalParameterList ',' IDENT { $$.m_node.head = $1.m_node.head;
1214 $$.m_features = $1.m_features | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
1215 $$.m_node.tail = new (GLOBAL_DATA) ParameterNode(GLOBAL_DATA, $1.m_node.tail, *$3); }
1219 /* not in spec */ { $$ = FunctionBodyNode::create(GLOBAL_DATA); }
1220 | SourceElements_NoNode { $$ = FunctionBodyNode::create(GLOBAL_DATA); }
1224 /* not in spec */ { GLOBAL_DATA->parser->didFinishParsing(new (GLOBAL_DATA) SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, @0.last_line, 0); }
1225 | SourceElements { GLOBAL_DATA->parser->didFinishParsing($1.m_node, $1.m_varDeclarations, $1.m_funcDeclarations, $1.m_features,
1226 @1.last_line, $1.m_numConstants); }
1230 Statement { $$.m_node = new (GLOBAL_DATA) SourceElements(GLOBAL_DATA);
1231 $$.m_node->append($1.m_node);
1232 $$.m_varDeclarations = $1.m_varDeclarations;
1233 $$.m_funcDeclarations = $1.m_funcDeclarations;
1234 $$.m_features = $1.m_features;
1235 $$.m_numConstants = $1.m_numConstants;
1237 | SourceElements Statement { $$.m_node->append($2.m_node);
1238 $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1239 $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1240 $$.m_features = $1.m_features | $2.m_features;
1241 $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
1253 | '/' /* regexp */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
1254 | DIVEQUAL /* regexp with /= */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; }
1258 IDENT ':' AssignmentExpr_NoNode { }
1259 | STRING ':' AssignmentExpr_NoNode { }
1260 | NUMBER ':' AssignmentExpr_NoNode { }
1261 | IDENT IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
1262 | IDENT IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE { if (*$1 != "get" && *$1 != "set") YYABORT; }
1265 PropertyList_NoNode:
1267 | PropertyList_NoNode ',' Property_NoNode
1271 PrimaryExprNoBrace_NoNode
1272 | OPENBRACE CLOSEBRACE { }
1273 | OPENBRACE PropertyList_NoNode CLOSEBRACE { }
1274 /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
1275 | OPENBRACE PropertyList_NoNode ',' CLOSEBRACE { }
1278 PrimaryExprNoBrace_NoNode:
1281 | ArrayLiteral_NoNode
1283 | '(' Expr_NoNode ')'
1286 ArrayLiteral_NoNode:
1287 '[' ElisionOpt_NoNode ']'
1288 | '[' ElementList_NoNode ']'
1289 | '[' ElementList_NoNode ',' ElisionOpt_NoNode ']'
1293 ElisionOpt_NoNode AssignmentExpr_NoNode
1294 | ElementList_NoNode ',' ElisionOpt_NoNode AssignmentExpr_NoNode
1304 | Elision_NoNode ','
1309 | FunctionExpr_NoNode
1310 | MemberExpr_NoNode '[' Expr_NoNode ']'
1311 | MemberExpr_NoNode '.' IDENT
1312 | NEW MemberExpr_NoNode Arguments_NoNode
1315 MemberExprNoBF_NoNode:
1316 PrimaryExprNoBrace_NoNode
1317 | MemberExprNoBF_NoNode '[' Expr_NoNode ']'
1318 | MemberExprNoBF_NoNode '.' IDENT
1319 | NEW MemberExpr_NoNode Arguments_NoNode
1324 | NEW NewExpr_NoNode
1328 MemberExprNoBF_NoNode
1329 | NEW NewExpr_NoNode
1333 MemberExpr_NoNode Arguments_NoNode
1334 | CallExpr_NoNode Arguments_NoNode
1335 | CallExpr_NoNode '[' Expr_NoNode ']'
1336 | CallExpr_NoNode '.' IDENT
1339 CallExprNoBF_NoNode:
1340 MemberExprNoBF_NoNode Arguments_NoNode
1341 | CallExprNoBF_NoNode Arguments_NoNode
1342 | CallExprNoBF_NoNode '[' Expr_NoNode ']'
1343 | CallExprNoBF_NoNode '.' IDENT
1348 | '(' ArgumentList_NoNode ')'
1351 ArgumentList_NoNode:
1352 AssignmentExpr_NoNode
1353 | ArgumentList_NoNode ',' AssignmentExpr_NoNode
1356 LeftHandSideExpr_NoNode:
1361 LeftHandSideExprNoBF_NoNode:
1363 | CallExprNoBF_NoNode
1367 LeftHandSideExpr_NoNode
1368 | LeftHandSideExpr_NoNode PLUSPLUS
1369 | LeftHandSideExpr_NoNode MINUSMINUS
1372 PostfixExprNoBF_NoNode:
1373 LeftHandSideExprNoBF_NoNode
1374 | LeftHandSideExprNoBF_NoNode PLUSPLUS
1375 | LeftHandSideExprNoBF_NoNode MINUSMINUS
1378 UnaryExprCommon_NoNode:
1379 DELETETOKEN UnaryExpr_NoNode
1380 | VOIDTOKEN UnaryExpr_NoNode
1381 | TYPEOF UnaryExpr_NoNode
1382 | PLUSPLUS UnaryExpr_NoNode
1383 | AUTOPLUSPLUS UnaryExpr_NoNode
1384 | MINUSMINUS UnaryExpr_NoNode
1385 | AUTOMINUSMINUS UnaryExpr_NoNode
1386 | '+' UnaryExpr_NoNode
1387 | '-' UnaryExpr_NoNode
1388 | '~' UnaryExpr_NoNode
1389 | '!' UnaryExpr_NoNode
1393 | UnaryExprCommon_NoNode
1396 UnaryExprNoBF_NoNode:
1397 PostfixExprNoBF_NoNode
1398 | UnaryExprCommon_NoNode
1401 MultiplicativeExpr_NoNode:
1403 | MultiplicativeExpr_NoNode '*' UnaryExpr_NoNode
1404 | MultiplicativeExpr_NoNode '/' UnaryExpr_NoNode
1405 | MultiplicativeExpr_NoNode '%' UnaryExpr_NoNode
1408 MultiplicativeExprNoBF_NoNode:
1409 UnaryExprNoBF_NoNode
1410 | MultiplicativeExprNoBF_NoNode '*' UnaryExpr_NoNode
1411 | MultiplicativeExprNoBF_NoNode '/' UnaryExpr_NoNode
1412 | MultiplicativeExprNoBF_NoNode '%' UnaryExpr_NoNode
1415 AdditiveExpr_NoNode:
1416 MultiplicativeExpr_NoNode
1417 | AdditiveExpr_NoNode '+' MultiplicativeExpr_NoNode
1418 | AdditiveExpr_NoNode '-' MultiplicativeExpr_NoNode
1421 AdditiveExprNoBF_NoNode:
1422 MultiplicativeExprNoBF_NoNode
1423 | AdditiveExprNoBF_NoNode '+' MultiplicativeExpr_NoNode
1424 | AdditiveExprNoBF_NoNode '-' MultiplicativeExpr_NoNode
1429 | ShiftExpr_NoNode LSHIFT AdditiveExpr_NoNode
1430 | ShiftExpr_NoNode RSHIFT AdditiveExpr_NoNode
1431 | ShiftExpr_NoNode URSHIFT AdditiveExpr_NoNode
1434 ShiftExprNoBF_NoNode:
1435 AdditiveExprNoBF_NoNode
1436 | ShiftExprNoBF_NoNode LSHIFT AdditiveExpr_NoNode
1437 | ShiftExprNoBF_NoNode RSHIFT AdditiveExpr_NoNode
1438 | ShiftExprNoBF_NoNode URSHIFT AdditiveExpr_NoNode
1441 RelationalExpr_NoNode:
1443 | RelationalExpr_NoNode '<' ShiftExpr_NoNode
1444 | RelationalExpr_NoNode '>' ShiftExpr_NoNode
1445 | RelationalExpr_NoNode LE ShiftExpr_NoNode
1446 | RelationalExpr_NoNode GE ShiftExpr_NoNode
1447 | RelationalExpr_NoNode INSTANCEOF ShiftExpr_NoNode
1448 | RelationalExpr_NoNode INTOKEN ShiftExpr_NoNode
1451 RelationalExprNoIn_NoNode:
1453 | RelationalExprNoIn_NoNode '<' ShiftExpr_NoNode
1454 | RelationalExprNoIn_NoNode '>' ShiftExpr_NoNode
1455 | RelationalExprNoIn_NoNode LE ShiftExpr_NoNode
1456 | RelationalExprNoIn_NoNode GE ShiftExpr_NoNode
1457 | RelationalExprNoIn_NoNode INSTANCEOF ShiftExpr_NoNode
1460 RelationalExprNoBF_NoNode:
1461 ShiftExprNoBF_NoNode
1462 | RelationalExprNoBF_NoNode '<' ShiftExpr_NoNode
1463 | RelationalExprNoBF_NoNode '>' ShiftExpr_NoNode
1464 | RelationalExprNoBF_NoNode LE ShiftExpr_NoNode
1465 | RelationalExprNoBF_NoNode GE ShiftExpr_NoNode
1466 | RelationalExprNoBF_NoNode INSTANCEOF ShiftExpr_NoNode
1467 | RelationalExprNoBF_NoNode INTOKEN ShiftExpr_NoNode
1470 EqualityExpr_NoNode:
1471 RelationalExpr_NoNode
1472 | EqualityExpr_NoNode EQEQ RelationalExpr_NoNode
1473 | EqualityExpr_NoNode NE RelationalExpr_NoNode
1474 | EqualityExpr_NoNode STREQ RelationalExpr_NoNode
1475 | EqualityExpr_NoNode STRNEQ RelationalExpr_NoNode
1478 EqualityExprNoIn_NoNode:
1479 RelationalExprNoIn_NoNode
1480 | EqualityExprNoIn_NoNode EQEQ RelationalExprNoIn_NoNode
1481 | EqualityExprNoIn_NoNode NE RelationalExprNoIn_NoNode
1482 | EqualityExprNoIn_NoNode STREQ RelationalExprNoIn_NoNode
1483 | EqualityExprNoIn_NoNode STRNEQ RelationalExprNoIn_NoNode
1486 EqualityExprNoBF_NoNode:
1487 RelationalExprNoBF_NoNode
1488 | EqualityExprNoBF_NoNode EQEQ RelationalExpr_NoNode
1489 | EqualityExprNoBF_NoNode NE RelationalExpr_NoNode
1490 | EqualityExprNoBF_NoNode STREQ RelationalExpr_NoNode
1491 | EqualityExprNoBF_NoNode STRNEQ RelationalExpr_NoNode
1494 BitwiseANDExpr_NoNode:
1496 | BitwiseANDExpr_NoNode '&' EqualityExpr_NoNode
1499 BitwiseANDExprNoIn_NoNode:
1500 EqualityExprNoIn_NoNode
1501 | BitwiseANDExprNoIn_NoNode '&' EqualityExprNoIn_NoNode
1504 BitwiseANDExprNoBF_NoNode:
1505 EqualityExprNoBF_NoNode
1506 | BitwiseANDExprNoBF_NoNode '&' EqualityExpr_NoNode
1509 BitwiseXORExpr_NoNode:
1510 BitwiseANDExpr_NoNode
1511 | BitwiseXORExpr_NoNode '^' BitwiseANDExpr_NoNode
1514 BitwiseXORExprNoIn_NoNode:
1515 BitwiseANDExprNoIn_NoNode
1516 | BitwiseXORExprNoIn_NoNode '^' BitwiseANDExprNoIn_NoNode
1519 BitwiseXORExprNoBF_NoNode:
1520 BitwiseANDExprNoBF_NoNode
1521 | BitwiseXORExprNoBF_NoNode '^' BitwiseANDExpr_NoNode
1524 BitwiseORExpr_NoNode:
1525 BitwiseXORExpr_NoNode
1526 | BitwiseORExpr_NoNode '|' BitwiseXORExpr_NoNode
1529 BitwiseORExprNoIn_NoNode:
1530 BitwiseXORExprNoIn_NoNode
1531 | BitwiseORExprNoIn_NoNode '|' BitwiseXORExprNoIn_NoNode
1534 BitwiseORExprNoBF_NoNode:
1535 BitwiseXORExprNoBF_NoNode
1536 | BitwiseORExprNoBF_NoNode '|' BitwiseXORExpr_NoNode
1539 LogicalANDExpr_NoNode:
1540 BitwiseORExpr_NoNode
1541 | LogicalANDExpr_NoNode AND BitwiseORExpr_NoNode
1544 LogicalANDExprNoIn_NoNode:
1545 BitwiseORExprNoIn_NoNode
1546 | LogicalANDExprNoIn_NoNode AND BitwiseORExprNoIn_NoNode
1549 LogicalANDExprNoBF_NoNode:
1550 BitwiseORExprNoBF_NoNode
1551 | LogicalANDExprNoBF_NoNode AND BitwiseORExpr_NoNode
1554 LogicalORExpr_NoNode:
1555 LogicalANDExpr_NoNode
1556 | LogicalORExpr_NoNode OR LogicalANDExpr_NoNode
1559 LogicalORExprNoIn_NoNode:
1560 LogicalANDExprNoIn_NoNode
1561 | LogicalORExprNoIn_NoNode OR LogicalANDExprNoIn_NoNode
1564 LogicalORExprNoBF_NoNode:
1565 LogicalANDExprNoBF_NoNode
1566 | LogicalORExprNoBF_NoNode OR LogicalANDExpr_NoNode
1569 ConditionalExpr_NoNode:
1570 LogicalORExpr_NoNode
1571 | LogicalORExpr_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode
1574 ConditionalExprNoIn_NoNode:
1575 LogicalORExprNoIn_NoNode
1576 | LogicalORExprNoIn_NoNode '?' AssignmentExprNoIn_NoNode ':' AssignmentExprNoIn_NoNode
1579 ConditionalExprNoBF_NoNode:
1580 LogicalORExprNoBF_NoNode
1581 | LogicalORExprNoBF_NoNode '?' AssignmentExpr_NoNode ':' AssignmentExpr_NoNode
1584 AssignmentExpr_NoNode:
1585 ConditionalExpr_NoNode
1586 | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode
1589 AssignmentExprNoIn_NoNode:
1590 ConditionalExprNoIn_NoNode
1591 | LeftHandSideExpr_NoNode AssignmentOperator_NoNode AssignmentExprNoIn_NoNode
1594 AssignmentExprNoBF_NoNode:
1595 ConditionalExprNoBF_NoNode
1596 | LeftHandSideExprNoBF_NoNode AssignmentOperator_NoNode AssignmentExpr_NoNode
1599 AssignmentOperator_NoNode:
1615 AssignmentExpr_NoNode
1616 | Expr_NoNode ',' AssignmentExpr_NoNode
1620 AssignmentExprNoIn_NoNode
1621 | ExprNoIn_NoNode ',' AssignmentExprNoIn_NoNode
1625 AssignmentExprNoBF_NoNode
1626 | ExprNoBF_NoNode ',' AssignmentExpr_NoNode
1631 | VariableStatement_NoNode
1632 | ConstStatement_NoNode
1633 | FunctionDeclaration_NoNode
1634 | EmptyStatement_NoNode
1635 | ExprStatement_NoNode
1636 | IfStatement_NoNode
1637 | IterationStatement_NoNode
1638 | ContinueStatement_NoNode
1639 | BreakStatement_NoNode
1640 | ReturnStatement_NoNode
1641 | WithStatement_NoNode
1642 | SwitchStatement_NoNode
1643 | LabelledStatement_NoNode
1644 | ThrowStatement_NoNode
1645 | TryStatement_NoNode
1646 | DebuggerStatement_NoNode
1650 OPENBRACE CLOSEBRACE { }
1651 | OPENBRACE SourceElements_NoNode CLOSEBRACE { }
1654 VariableStatement_NoNode:
1655 VAR VariableDeclarationList_NoNode ';'
1656 | VAR VariableDeclarationList_NoNode error { AUTO_SEMICOLON; }
1659 VariableDeclarationList_NoNode:
1661 | IDENT Initializer_NoNode { }
1662 | VariableDeclarationList_NoNode ',' IDENT
1663 | VariableDeclarationList_NoNode ',' IDENT Initializer_NoNode
1666 VariableDeclarationListNoIn_NoNode:
1668 | IDENT InitializerNoIn_NoNode { }
1669 | VariableDeclarationListNoIn_NoNode ',' IDENT
1670 | VariableDeclarationListNoIn_NoNode ',' IDENT InitializerNoIn_NoNode
1673 ConstStatement_NoNode:
1674 CONSTTOKEN ConstDeclarationList_NoNode ';'
1675 | CONSTTOKEN ConstDeclarationList_NoNode error { AUTO_SEMICOLON; }
1678 ConstDeclarationList_NoNode:
1679 ConstDeclaration_NoNode
1680 | ConstDeclarationList_NoNode ',' ConstDeclaration_NoNode
1683 ConstDeclaration_NoNode:
1685 | IDENT Initializer_NoNode { }
1689 '=' AssignmentExpr_NoNode
1692 InitializerNoIn_NoNode:
1693 '=' AssignmentExprNoIn_NoNode
1696 EmptyStatement_NoNode:
1700 ExprStatement_NoNode:
1702 | ExprNoBF_NoNode error { AUTO_SEMICOLON; }
1706 IF '(' Expr_NoNode ')' Statement_NoNode %prec IF_WITHOUT_ELSE
1707 | IF '(' Expr_NoNode ')' Statement_NoNode ELSE Statement_NoNode
1710 IterationStatement_NoNode:
1711 DO Statement_NoNode WHILE '(' Expr_NoNode ')' ';'
1712 | DO Statement_NoNode WHILE '(' Expr_NoNode ')' error // Always performs automatic semicolon insertion
1713 | WHILE '(' Expr_NoNode ')' Statement_NoNode
1714 | FOR '(' ExprNoInOpt_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode
1715 | FOR '(' VAR VariableDeclarationListNoIn_NoNode ';' ExprOpt_NoNode ';' ExprOpt_NoNode ')' Statement_NoNode
1716 | FOR '(' LeftHandSideExpr_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode
1717 | FOR '(' VAR IDENT INTOKEN Expr_NoNode ')' Statement_NoNode
1718 | FOR '(' VAR IDENT InitializerNoIn_NoNode INTOKEN Expr_NoNode ')' Statement_NoNode
1731 ContinueStatement_NoNode:
1733 | CONTINUE error { AUTO_SEMICOLON; }
1734 | CONTINUE IDENT ';'
1735 | CONTINUE IDENT error { AUTO_SEMICOLON; }
1738 BreakStatement_NoNode:
1740 | BREAK error { AUTO_SEMICOLON; }
1742 | BREAK IDENT error { AUTO_SEMICOLON; }
1745 ReturnStatement_NoNode:
1747 | RETURN error { AUTO_SEMICOLON; }
1748 | RETURN Expr_NoNode ';'
1749 | RETURN Expr_NoNode error { AUTO_SEMICOLON; }
1752 WithStatement_NoNode:
1753 WITH '(' Expr_NoNode ')' Statement_NoNode
1756 SwitchStatement_NoNode:
1757 SWITCH '(' Expr_NoNode ')' CaseBlock_NoNode
1761 OPENBRACE CaseClausesOpt_NoNode CLOSEBRACE { }
1762 | OPENBRACE CaseClausesOpt_NoNode DefaultClause_NoNode CaseClausesOpt_NoNode CLOSEBRACE { }
1765 CaseClausesOpt_NoNode:
1767 | CaseClauses_NoNode
1772 | CaseClauses_NoNode CaseClause_NoNode
1776 CASE Expr_NoNode ':'
1777 | CASE Expr_NoNode ':' SourceElements_NoNode
1780 DefaultClause_NoNode:
1782 | DEFAULT ':' SourceElements_NoNode
1785 LabelledStatement_NoNode:
1786 IDENT ':' Statement_NoNode { }
1789 ThrowStatement_NoNode:
1790 THROW Expr_NoNode ';'
1791 | THROW Expr_NoNode error { AUTO_SEMICOLON; }
1794 TryStatement_NoNode:
1795 TRY Block_NoNode FINALLY Block_NoNode
1796 | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode
1797 | TRY Block_NoNode CATCH '(' IDENT ')' Block_NoNode FINALLY Block_NoNode
1800 DebuggerStatement_NoNode:
1802 | DEBUGGER error { AUTO_SEMICOLON; }
1805 FunctionDeclaration_NoNode:
1806 FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1807 | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1810 FunctionExpr_NoNode:
1811 FUNCTION '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1812 | FUNCTION '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1813 | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1814 | FUNCTION IDENT '(' FormalParameterList_NoNode ')' OPENBRACE FunctionBody_NoNode CLOSEBRACE
1817 FormalParameterList_NoNode:
1819 | FormalParameterList_NoNode ',' IDENT
1822 FunctionBody_NoNode:
1824 | SourceElements_NoNode
1827 SourceElements_NoNode:
1829 | SourceElements_NoNode Statement_NoNode
1838 static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
1840 if (!loc->isLocation())
1841 return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot);
1843 if (loc->isResolveNode()) {
1844 ResolveNode* resolve = static_cast<ResolveNode*>(loc);
1845 if (op == OpEqual) {
1846 AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments);
1847 setExceptionLocation(node, start, divot, end);
1850 return new (globalData) ReadModifyResolveNode(globalData, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1852 if (loc->isBracketAccessorNode()) {
1853 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
1855 return new (globalData) AssignBracketNode(globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
1857 ReadModifyBracketNode* node = new (globalData) ReadModifyBracketNode(globalData, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
1858 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1862 ASSERT(loc->isDotAccessorNode());
1863 DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
1865 return new (globalData) AssignDotNode(globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
1867 ReadModifyDotNode* node = new (globalData) ReadModifyDotNode(globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1868 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1872 static ExpressionNode* makePrefixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
1874 if (!expr->isLocation())
1875 return new (globalData) PrefixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
1877 if (expr->isResolveNode()) {
1878 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1879 return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
1881 if (expr->isBracketAccessorNode()) {
1882 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1883 PrefixBracketNode* node = new (globalData) PrefixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1884 node->setSubexpressionInfo(bracket->divot(), bracket->startOffset());
1887 ASSERT(expr->isDotAccessorNode());
1888 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1889 PrefixDotNode* node = new (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1890 node->setSubexpressionInfo(dot->divot(), dot->startOffset());
1894 static ExpressionNode* makePostfixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end)
1896 if (!expr->isLocation())
1897 return new (globalData) PostfixErrorNode(globalData, expr, op, divot, divot - start, end - divot);
1899 if (expr->isResolveNode()) {
1900 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1901 return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot);
1903 if (expr->isBracketAccessorNode()) {
1904 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1905 PostfixBracketNode* node = new (globalData) PostfixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1906 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1910 ASSERT(expr->isDotAccessorNode());
1911 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1912 PostfixDotNode* node = new (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1913 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1917 static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
1919 CodeFeatures features = func.m_features | args.m_features;
1920 int numConstants = func.m_numConstants + args.m_numConstants;
1921 if (!func.m_node->isLocation())
1922 return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
1923 if (func.m_node->isResolveNode()) {
1924 ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
1925 const Identifier& identifier = resolve->identifier();
1926 if (identifier == globalData->propertyNames->eval)
1927 return createNodeInfo<ExpressionNode*>(new (globalData) EvalFunctionCallNode(globalData, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
1928 return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallResolveNode(globalData, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
1930 if (func.m_node->isBracketAccessorNode()) {
1931 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
1932 FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
1933 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1934 return createNodeInfo<ExpressionNode*>(node, features, numConstants);
1936 ASSERT(func.m_node->isDotAccessorNode());
1937 DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
1938 FunctionCallDotNode* node;
1939 if (dot->identifier() == globalData->propertyNames->call)
1940 node = new (globalData) CallFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1941 else if (dot->identifier() == globalData->propertyNames->apply)
1942 node = new (globalData) ApplyFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1944 node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1945 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1946 return createNodeInfo<ExpressionNode*>(node, features, numConstants);
1949 static ExpressionNode* makeTypeOfNode(JSGlobalData* globalData, ExpressionNode* expr)
1951 if (expr->isResolveNode()) {
1952 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1953 return new (globalData) TypeOfResolveNode(globalData, resolve->identifier());
1955 return new (globalData) TypeOfValueNode(globalData, expr);
1958 static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end)
1960 if (!expr->isLocation())
1961 return new (globalData) DeleteValueNode(globalData, expr);
1962 if (expr->isResolveNode()) {
1963 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1964 return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot);
1966 if (expr->isBracketAccessorNode()) {
1967 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1968 return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
1970 ASSERT(expr->isDotAccessorNode());
1971 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1972 return new (globalData) DeleteDotNode(globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot);
1975 static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
1977 PropertyNode::Type type;
1978 if (getOrSet == "get")
1979 type = PropertyNode::Getter;
1980 else if (getOrSet == "set")
1981 type = PropertyNode::Setter;
1984 return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type);
1987 static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
1989 if (n->isNumber()) {
1990 NumberNode* numberNode = static_cast<NumberNode*>(n);
1991 numberNode->setValue(-numberNode->value());
1995 return new (globalData) NegateNode(globalData, n);
1998 static NumberNode* makeNumberNode(JSGlobalData* globalData, double d)
2000 return new (globalData) NumberNode(globalData, d);
2003 static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
2005 if (expr->isNumber())
2006 return makeNumberNode(globalData, ~toInt32(static_cast<NumberNode*>(expr)->value()));
2007 return new (globalData) BitwiseNotNode(globalData, expr);
2010 static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2012 expr1 = expr1->stripUnaryPlus();
2013 expr2 = expr2->stripUnaryPlus();
2015 if (expr1->isNumber() && expr2->isNumber())
2016 return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
2018 if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
2019 return new (globalData) UnaryPlusNode(globalData, expr2);
2021 if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
2022 return new (globalData) UnaryPlusNode(globalData, expr1);
2024 return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments);
2027 static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2029 expr1 = expr1->stripUnaryPlus();
2030 expr2 = expr2->stripUnaryPlus();
2032 if (expr1->isNumber() && expr2->isNumber())
2033 return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
2034 return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments);
2037 static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2039 if (expr1->isNumber() && expr2->isNumber())
2040 return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
2041 return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments);
2044 static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2046 expr1 = expr1->stripUnaryPlus();
2047 expr2 = expr2->stripUnaryPlus();
2049 if (expr1->isNumber() && expr2->isNumber())
2050 return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
2051 return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments);
2054 static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2056 if (expr1->isNumber() && expr2->isNumber())
2057 return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
2058 return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments);
2061 static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
2063 if (expr1->isNumber() && expr2->isNumber())
2064 return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
2065 return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments);
2068 // Called by yyparse on error.
2069 int yyerror(const char*)
2074 // May we automatically insert a semicolon?
2075 static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
2077 return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
2080 static ExpressionNode* combineCommaNodes(JSGlobalData* globalData, ExpressionNode* list, ExpressionNode* init)
2084 if (list->isCommaNode()) {
2085 static_cast<CommaNode*>(list)->append(init);
2088 return new (globalData) CommaNode(globalData, list, init);
2091 // We turn variable declarations into either assignments or empty
2092 // statements (which later get stripped out), because the actual
2093 // declaration work is hoisted up to the start of the function body
2094 static StatementNode* makeVarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
2097 return new (globalData) EmptyStatementNode(globalData);
2098 return new (globalData) VarStatementNode(globalData, expr);