6 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
7 * Copyright (C) 2006, 2007, 2008 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
35 #include "JSGlobalData.h"
36 #include "CommonIdentifiers.h"
39 #include <wtf/MathExtras.h>
41 #define YYMAXDEPTH 10000
42 #define YYENABLE_NLS 0
44 /* default values for bison */
45 #define YYDEBUG 0 // Set to 1 to debug a parse error.
46 #define kjsyydebug 0 // Set to 1 to debug a parse error.
48 // avoid triggering warnings in older bison
49 #define YYERROR_VERBOSE
52 int kjsyylex(void* lvalp, void* llocp, void* globalPtr);
53 int kjsyyerror(const char*);
54 static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
56 #define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr)
57 #define LEXER (GLOBAL_DATA->lexer)
59 #define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0)
60 #define SET_EXCEPTION_LOCATION(node, start, divot, end) node->setExceptionSourceRange((divot), (divot) - (start), (end) - (divot))
61 #define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line)
66 static ExpressionNode* makeAssignNode(void*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end);
67 static ExpressionNode* makePrefixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
68 static ExpressionNode* makePostfixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
69 static PropertyNode* makeGetterOrSetterPropertyNode(void*, const Identifier &getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceRange&);
70 static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end);
71 static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*);
72 static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end);
73 static ExpressionNode* makeNegateNode(void*, ExpressionNode*);
74 static NumberNode* makeNumberNode(void*, double);
75 static ExpressionNode* makeBitwiseNotNode(void*, ExpressionNode*);
76 static ExpressionNode* makeMultNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
77 static ExpressionNode* makeDivNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
78 static ExpressionNode* makeAddNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
79 static ExpressionNode* makeLeftShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
80 static ExpressionNode* makeRightShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
81 static StatementNode* makeVarStatementNode(void*, ExpressionNode*);
82 static ExpressionNode* combineVarInitializers(void*, ExpressionNode* list, AssignResolveNode* init);
86 #pragma warning(disable: 4065)
87 #pragma warning(disable: 4244)
88 #pragma warning(disable: 4702)
90 // At least some of the time, the declarations of malloc and free that bison
91 // generates are causing warnings. A way to avoid this is to explicitly define
92 // the macros so that bison doesn't try to declare malloc and free.
93 #define YYMALLOC malloc
98 #define YYPARSE_PARAM globalPtr
99 #define YYLEX_PARAM globalPtr
101 template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserRefCountedData<DeclarationStacks::VarStack>* varDecls,
102 ParserRefCountedData<DeclarationStacks::FunctionStack>* funcDecls,
106 ASSERT((info & ~AllFeatures) == 0);
107 NodeDeclarationInfo<T> result = {node, varDecls, funcDecls, info, numConstants};
111 template <typename T> NodeFeatureInfo<T> createNodeFeatureInfo(T node, FeatureInfo info, int numConstants)
113 ASSERT((info & ~AllFeatures) == 0);
114 NodeFeatureInfo<T> result = {node, info, numConstants};
118 template <typename T> T mergeDeclarationLists(T decls1, T decls2)
120 // decls1 or both are null
123 // only decls1 is non-null
128 decls1->data.append(decls2->data);
130 // We manually release the declaration lists to avoid accumulating many many
131 // unused heap allocated vectors
137 static void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
140 varDecls = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
142 varDecls->data.append(make_pair(ident, attrs));
146 static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
148 unsigned attrs = DeclarationStacks::IsConstant;
150 attrs |= DeclarationStacks::HasInitializer;
151 appendToVarDeclarationList(globalPtr, varDecls, decl->m_ident, attrs);
161 // expression subtrees
162 ExpressionNodeInfo expressionNode;
163 FuncDeclNodeInfo funcDeclNode;
164 PropertyNodeInfo propertyNode;
165 ArgumentsNodeInfo argumentsNode;
166 ConstDeclNodeInfo constDeclNode;
167 CaseBlockNodeInfo caseBlockNode;
168 CaseClauseNodeInfo caseClauseNode;
169 FuncExprNodeInfo funcExprNode;
172 StatementNodeInfo statementNode;
173 FunctionBodyNode* functionBodyNode;
174 ProgramNode* programNode;
176 SourceElementsInfo sourceElements;
177 PropertyListInfo propertyList;
178 ArgumentListInfo argumentList;
179 VarDeclListInfo varDeclList;
180 ConstDeclListInfo constDeclList;
181 ClauseListInfo clauseList;
182 ElementListInfo elementList;
183 ParameterListInfo parameterList;
191 %token NULLTOKEN TRUETOKEN FALSETOKEN
194 %token BREAK CASE DEFAULT FOR NEW VAR CONSTTOKEN CONTINUE
195 %token FUNCTION RETURN VOIDTOKEN DELETETOKEN
196 %token IF THISTOKEN DO WHILE INTOKEN INSTANCEOF TYPEOF
197 %token SWITCH WITH RESERVED
198 %token THROW TRY CATCH FINALLY
201 /* give an if without an else higher precedence than an else to resolve the ambiguity */
202 %nonassoc IF_WITHOUT_ELSE
206 %token EQEQ NE /* == and != */
207 %token STREQ STRNEQ /* === and !== */
208 %token LE GE /* < and > */
209 %token OR AND /* || and && */
210 %token PLUSPLUS MINUSMINUS /* ++ and -- */
211 %token LSHIFT /* << */
212 %token RSHIFT URSHIFT /* >> and >>> */
213 %token PLUSEQUAL MINUSEQUAL /* += and -= */
214 %token MULTEQUAL DIVEQUAL /* *= and /= */
215 %token LSHIFTEQUAL /* <<= */
216 %token RSHIFTEQUAL URSHIFTEQUAL /* >>= and >>>= */
217 %token ANDEQUAL MODEQUAL /* &= and %= */
218 %token XOREQUAL OREQUAL /* ^= and |= */
219 %token <intValue> OPENBRACE /* { (with char offset) */
220 %token <intValue> CLOSEBRACE /* { (with char offset) */
223 %token <doubleValue> NUMBER
224 %token <ident> IDENT STRING
226 /* automatically inserted semicolon */
227 %token AUTOPLUSPLUS AUTOMINUSMINUS
229 /* non-terminal types */
230 %type <expressionNode> Literal ArrayLiteral
232 %type <expressionNode> PrimaryExpr PrimaryExprNoBrace
233 %type <expressionNode> MemberExpr MemberExprNoBF /* BF => brace or function */
234 %type <expressionNode> NewExpr NewExprNoBF
235 %type <expressionNode> CallExpr CallExprNoBF
236 %type <expressionNode> LeftHandSideExpr LeftHandSideExprNoBF
237 %type <expressionNode> PostfixExpr PostfixExprNoBF
238 %type <expressionNode> UnaryExpr UnaryExprNoBF UnaryExprCommon
239 %type <expressionNode> MultiplicativeExpr MultiplicativeExprNoBF
240 %type <expressionNode> AdditiveExpr AdditiveExprNoBF
241 %type <expressionNode> ShiftExpr ShiftExprNoBF
242 %type <expressionNode> RelationalExpr RelationalExprNoIn RelationalExprNoBF
243 %type <expressionNode> EqualityExpr EqualityExprNoIn EqualityExprNoBF
244 %type <expressionNode> BitwiseANDExpr BitwiseANDExprNoIn BitwiseANDExprNoBF
245 %type <expressionNode> BitwiseXORExpr BitwiseXORExprNoIn BitwiseXORExprNoBF
246 %type <expressionNode> BitwiseORExpr BitwiseORExprNoIn BitwiseORExprNoBF
247 %type <expressionNode> LogicalANDExpr LogicalANDExprNoIn LogicalANDExprNoBF
248 %type <expressionNode> LogicalORExpr LogicalORExprNoIn LogicalORExprNoBF
249 %type <expressionNode> ConditionalExpr ConditionalExprNoIn ConditionalExprNoBF
250 %type <expressionNode> AssignmentExpr AssignmentExprNoIn AssignmentExprNoBF
251 %type <expressionNode> Expr ExprNoIn ExprNoBF
253 %type <expressionNode> ExprOpt ExprNoInOpt
255 %type <statementNode> Statement Block
256 %type <statementNode> VariableStatement ConstStatement EmptyStatement ExprStatement
257 %type <statementNode> IfStatement IterationStatement ContinueStatement
258 %type <statementNode> BreakStatement ReturnStatement WithStatement
259 %type <statementNode> SwitchStatement LabelledStatement
260 %type <statementNode> ThrowStatement TryStatement
261 %type <statementNode> DebuggerStatement
262 %type <statementNode> SourceElement
264 %type <expressionNode> Initializer InitializerNoIn
265 %type <funcDeclNode> FunctionDeclaration
266 %type <funcExprNode> FunctionExpr
267 %type <functionBodyNode> FunctionBody
268 %type <sourceElements> SourceElements
269 %type <parameterList> FormalParameterList
270 %type <op> AssignmentOperator
271 %type <argumentsNode> Arguments
272 %type <argumentList> ArgumentList
273 %type <varDeclList> VariableDeclarationList VariableDeclarationListNoIn
274 %type <constDeclList> ConstDeclarationList
275 %type <constDeclNode> ConstDeclaration
276 %type <caseBlockNode> CaseBlock
277 %type <caseClauseNode> CaseClause DefaultClause
278 %type <clauseList> CaseClauses CaseClausesOpt
279 %type <intValue> Elision ElisionOpt
280 %type <elementList> ElementList
281 %type <propertyNode> Property
282 %type <propertyList> PropertyList
286 NULLTOKEN { $$ = createNodeFeatureInfo<ExpressionNode*>(new NullNode(GLOBAL_DATA), 0, 1); }
287 | TRUETOKEN { $$ = createNodeFeatureInfo<ExpressionNode*>(new BooleanNode(GLOBAL_DATA, true), 0, 1); }
288 | FALSETOKEN { $$ = createNodeFeatureInfo<ExpressionNode*>(new BooleanNode(GLOBAL_DATA, false), 0, 1); }
289 | NUMBER { $$ = createNodeFeatureInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, $1), 0, 1); }
290 | STRING { $$ = createNodeFeatureInfo<ExpressionNode*>(new StringNode(GLOBAL_DATA, *$1), 0, 1); }
295 RegExpNode* node = new RegExpNode(GLOBAL_DATA, l.pattern(), l.flags());
296 int size = l.pattern().size() + 2; // + 2 for the two /'s
297 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
298 $$ = createNodeFeatureInfo<ExpressionNode*>(node, 0, 0);
300 | DIVEQUAL /* regexp with /= */ {
304 RegExpNode* node = new RegExpNode(GLOBAL_DATA, "=" + l.pattern(), l.flags());
305 int size = l.pattern().size() + 2; // + 2 for the two /'s
306 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
307 $$ = createNodeFeatureInfo<ExpressionNode*>(node, 0, 0);
312 IDENT ':' AssignmentExpr { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_featureInfo, $3.m_numConstants); }
313 | STRING ':' AssignmentExpr { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_featureInfo, $3.m_numConstants); }
314 | NUMBER ':' AssignmentExpr { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_featureInfo, $3.m_numConstants); }
315 | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, 0, $6, LEXER->sourceRange($5, $7)), ClosureFeature, 0); DBG($6, @5, @7); if (!$$.m_node) YYABORT; }
316 | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
317 { $$ = createNodeFeatureInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.m_node.head, $7, LEXER->sourceRange($6, $8)), $4.m_featureInfo | ClosureFeature, 0); DBG($7, @6, @8); if (!$$.m_node) YYABORT; }
321 Property { $$.m_node.head = new PropertyListNode(GLOBAL_DATA, $1.m_node);
322 $$.m_node.tail = $$.m_node.head;
323 $$.m_featureInfo = $1.m_featureInfo;
324 $$.m_numConstants = $1.m_numConstants; }
325 | PropertyList ',' Property { $$.m_node.head = $1.m_node.head;
326 $$.m_node.tail = new PropertyListNode(GLOBAL_DATA, $3.m_node, $1.m_node.tail);
327 $$.m_featureInfo = $1.m_featureInfo | $3.m_featureInfo;
328 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
333 | OPENBRACE CLOSEBRACE { $$ = createNodeFeatureInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA), 0, 0); }
334 | OPENBRACE PropertyList CLOSEBRACE { $$ = createNodeFeatureInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_featureInfo, $2.m_numConstants); }
335 /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
336 | OPENBRACE PropertyList ',' CLOSEBRACE { $$ = createNodeFeatureInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_featureInfo, $2.m_numConstants); }
340 THISTOKEN { $$ = createNodeFeatureInfo<ExpressionNode*>(new ThisNode(GLOBAL_DATA), ThisFeature, 0); }
343 | IDENT { $$ = createNodeFeatureInfo<ExpressionNode*>(new ResolveNode(GLOBAL_DATA, *$1, @1.first_column), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
344 | '(' Expr ')' { $$ = $2; }
348 '[' ElisionOpt ']' { $$ = createNodeFeatureInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, $2), 0, $2 ? 1 : 0); }
349 | '[' ElementList ']' { $$ = createNodeFeatureInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, $2.m_node.head), $2.m_featureInfo, $2.m_numConstants); }
350 | '[' ElementList ',' ElisionOpt ']' { $$ = createNodeFeatureInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, $4, $2.m_node.head), $2.m_featureInfo, $4 ? $2.m_numConstants + 1 : $2.m_numConstants); }
354 ElisionOpt AssignmentExpr { $$.m_node.head = new ElementNode(GLOBAL_DATA, $1, $2.m_node);
355 $$.m_node.tail = $$.m_node.head;
356 $$.m_featureInfo = $2.m_featureInfo;
357 $$.m_numConstants = $2.m_numConstants; }
358 | ElementList ',' ElisionOpt AssignmentExpr
359 { $$.m_node.head = $1.m_node.head;
360 $$.m_node.tail = new ElementNode(GLOBAL_DATA, $1.m_node.tail, $3, $4.m_node);
361 $$.m_featureInfo = $1.m_featureInfo | $4.m_featureInfo;
362 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; }
366 /* nothing */ { $$ = 0; }
372 | Elision ',' { $$ = $1 + 1; }
377 | FunctionExpr { $$ = createNodeFeatureInfo<ExpressionNode*>($1.m_node, $1.m_featureInfo, $1.m_numConstants); }
378 | MemberExpr '[' Expr ']' { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
379 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
380 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants);
382 | MemberExpr '.' IDENT { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
383 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
384 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo, $1.m_numConstants);
386 | NEW MemberExpr Arguments { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
387 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
388 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $2.m_featureInfo | $3.m_featureInfo, $2.m_numConstants + $3.m_numConstants);
394 | MemberExprNoBF '[' Expr ']' { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
395 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
396 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants);
398 | MemberExprNoBF '.' IDENT { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
399 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
400 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo, $1.m_numConstants);
402 | NEW MemberExpr Arguments { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
403 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
404 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $2.m_featureInfo | $3.m_featureInfo, $2.m_numConstants + $3.m_numConstants);
410 | NEW NewExpr { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node);
411 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
412 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $2.m_featureInfo, $2.m_numConstants);
418 | NEW NewExpr { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node);
419 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
420 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $2.m_featureInfo, $2.m_numConstants);
425 MemberExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
426 | CallExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
427 | CallExpr '[' Expr ']' { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
428 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
429 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants);
431 | CallExpr '.' IDENT { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
432 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
433 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo, $1.m_numConstants); }
437 MemberExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
438 | CallExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
439 | CallExprNoBF '[' Expr ']' { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
440 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
441 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants);
443 | CallExprNoBF '.' IDENT { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
444 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
445 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo, $1.m_numConstants);
450 '(' ')' { $$ = createNodeFeatureInfo<ArgumentsNode*>(new ArgumentsNode(GLOBAL_DATA), 0, 0); }
451 | '(' ArgumentList ')' { $$ = createNodeFeatureInfo<ArgumentsNode*>(new ArgumentsNode(GLOBAL_DATA, $2.m_node.head), $2.m_featureInfo, $2.m_numConstants); }
455 AssignmentExpr { $$.m_node.head = new ArgumentListNode(GLOBAL_DATA, $1.m_node);
456 $$.m_node.tail = $$.m_node.head;
457 $$.m_featureInfo = $1.m_featureInfo;
458 $$.m_numConstants = $1.m_numConstants; }
459 | ArgumentList ',' AssignmentExpr { $$.m_node.head = $1.m_node.head;
460 $$.m_node.tail = new ArgumentListNode(GLOBAL_DATA, $1.m_node.tail, $3.m_node);
461 $$.m_featureInfo = $1.m_featureInfo | $3.m_featureInfo;
462 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
470 LeftHandSideExprNoBF:
477 | LeftHandSideExpr PLUSPLUS { $$ = createNodeFeatureInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_featureInfo | AssignFeature, $1.m_numConstants); }
478 | LeftHandSideExpr MINUSMINUS { $$ = createNodeFeatureInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_featureInfo | AssignFeature, $1.m_numConstants); }
483 | LeftHandSideExprNoBF PLUSPLUS { $$ = createNodeFeatureInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_featureInfo | AssignFeature, $1.m_numConstants); }
484 | LeftHandSideExprNoBF MINUSMINUS { $$ = createNodeFeatureInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_featureInfo | AssignFeature, $1.m_numConstants); }
488 DELETETOKEN UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, $2.m_node, @1.first_column, @2.last_column, @2.last_column), $2.m_featureInfo, $2.m_numConstants); }
489 | VOIDTOKEN UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new VoidNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo, $2.m_numConstants + 1); }
490 | TYPEOF UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo, $2.m_numConstants); }
491 | PLUSPLUS UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_featureInfo | AssignFeature, $2.m_numConstants); }
492 | AUTOPLUSPLUS UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_featureInfo | AssignFeature, $2.m_numConstants); }
493 | MINUSMINUS UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_featureInfo | AssignFeature, $2.m_numConstants); }
494 | AUTOMINUSMINUS UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_featureInfo | AssignFeature, $2.m_numConstants); }
495 | '+' UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new UnaryPlusNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo, $2.m_numConstants); }
496 | '-' UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo, $2.m_numConstants); }
497 | '~' UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo, $2.m_numConstants); }
498 | '!' UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalNotNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo, $2.m_numConstants); }
512 | MultiplicativeExpr '*' UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
513 | MultiplicativeExpr '/' UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
514 | MultiplicativeExpr '%' UnaryExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
517 MultiplicativeExprNoBF:
519 | MultiplicativeExprNoBF '*' UnaryExpr
520 { $$ = createNodeFeatureInfo<ExpressionNode*>(new MultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
521 | MultiplicativeExprNoBF '/' UnaryExpr
522 { $$ = createNodeFeatureInfo<ExpressionNode*>(new DivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
523 | MultiplicativeExprNoBF '%' UnaryExpr
524 { $$ = createNodeFeatureInfo<ExpressionNode*>(new ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
529 | AdditiveExpr '+' MultiplicativeExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
530 | AdditiveExpr '-' MultiplicativeExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new SubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
534 MultiplicativeExprNoBF
535 | AdditiveExprNoBF '+' MultiplicativeExpr
536 { $$ = createNodeFeatureInfo<ExpressionNode*>(new AddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
537 | AdditiveExprNoBF '-' MultiplicativeExpr
538 { $$ = createNodeFeatureInfo<ExpressionNode*>(new SubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
543 | ShiftExpr LSHIFT AdditiveExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
544 | ShiftExpr RSHIFT AdditiveExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
545 | ShiftExpr URSHIFT AdditiveExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
550 | ShiftExprNoBF LSHIFT AdditiveExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
551 | ShiftExprNoBF RSHIFT AdditiveExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new RightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
552 | ShiftExprNoBF URSHIFT AdditiveExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
557 | RelationalExpr '<' ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
558 | RelationalExpr '>' ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
559 | RelationalExpr LE ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
560 | RelationalExpr GE ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
561 | RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
562 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
563 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
564 | RelationalExpr INTOKEN ShiftExpr { InNode* node = new InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
565 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
566 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
571 | RelationalExprNoIn '<' ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
572 | RelationalExprNoIn '>' ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
573 | RelationalExprNoIn LE ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
574 | RelationalExprNoIn GE ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
575 | RelationalExprNoIn INSTANCEOF ShiftExpr
576 { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
577 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
578 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
583 | RelationalExprNoBF '<' ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
584 | RelationalExprNoBF '>' ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
585 | RelationalExprNoBF LE ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
586 | RelationalExprNoBF GE ShiftExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
587 | RelationalExprNoBF INSTANCEOF ShiftExpr
588 { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
589 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
590 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
591 | RelationalExprNoBF INTOKEN ShiftExpr
592 { InNode* node = new InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
593 SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
594 $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
599 | EqualityExpr EQEQ RelationalExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
600 | EqualityExpr NE RelationalExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
601 | EqualityExpr STREQ RelationalExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
602 | EqualityExpr STRNEQ RelationalExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
607 | EqualityExprNoIn EQEQ RelationalExprNoIn
608 { $$ = createNodeFeatureInfo<ExpressionNode*>(new EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
609 | EqualityExprNoIn NE RelationalExprNoIn
610 { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
611 | EqualityExprNoIn STREQ RelationalExprNoIn
612 { $$ = createNodeFeatureInfo<ExpressionNode*>(new StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
613 | EqualityExprNoIn STRNEQ RelationalExprNoIn
614 { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
619 | EqualityExprNoBF EQEQ RelationalExpr
620 { $$ = createNodeFeatureInfo<ExpressionNode*>(new EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
621 | EqualityExprNoBF NE RelationalExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
622 | EqualityExprNoBF STREQ RelationalExpr
623 { $$ = createNodeFeatureInfo<ExpressionNode*>(new StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
624 | EqualityExprNoBF STRNEQ RelationalExpr
625 { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
630 | BitwiseANDExpr '&' EqualityExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
635 | BitwiseANDExprNoIn '&' EqualityExprNoIn
636 { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
641 | BitwiseANDExprNoBF '&' EqualityExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
646 | BitwiseXORExpr '^' BitwiseANDExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
651 | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn
652 { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
657 | BitwiseXORExprNoBF '^' BitwiseANDExpr
658 { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
663 | BitwiseORExpr '|' BitwiseXORExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
668 | BitwiseORExprNoIn '|' BitwiseXORExprNoIn
669 { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
674 | BitwiseORExprNoBF '|' BitwiseXORExpr
675 { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
680 | LogicalANDExpr AND BitwiseORExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
685 | LogicalANDExprNoIn AND BitwiseORExprNoIn
686 { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
691 | LogicalANDExprNoBF AND BitwiseORExpr
692 { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
697 | LogicalORExpr OR LogicalANDExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
702 | LogicalORExprNoIn OR LogicalANDExprNoIn
703 { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
708 | LogicalORExprNoBF OR LogicalANDExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
713 | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr
714 { $$ = createNodeFeatureInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_featureInfo | $3.m_featureInfo | $5.m_featureInfo, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
719 | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn
720 { $$ = createNodeFeatureInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_featureInfo | $3.m_featureInfo | $5.m_featureInfo, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
725 | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr
726 { $$ = createNodeFeatureInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_featureInfo | $3.m_featureInfo | $5.m_featureInfo, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
731 | LeftHandSideExpr AssignmentOperator AssignmentExpr
732 { $$ = createNodeFeatureInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_featureInfo & AssignFeature, $3.m_featureInfo & AssignFeature,
733 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_featureInfo | $3.m_featureInfo | AssignFeature, $1.m_numConstants + $3.m_numConstants);
739 | LeftHandSideExpr AssignmentOperator AssignmentExprNoIn
740 { $$ = createNodeFeatureInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_featureInfo & AssignFeature, $3.m_featureInfo & AssignFeature,
741 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_featureInfo | $3.m_featureInfo | AssignFeature, $1.m_numConstants + $3.m_numConstants);
747 | LeftHandSideExprNoBF AssignmentOperator AssignmentExpr
748 { $$ = createNodeFeatureInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_featureInfo & AssignFeature, $3.m_featureInfo & AssignFeature,
749 @1.first_column, @2.first_column + 1, @3.last_column), $1.m_featureInfo | $3.m_featureInfo | AssignFeature, $1.m_numConstants + $3.m_numConstants);
754 '=' { $$ = OpEqual; }
755 | PLUSEQUAL { $$ = OpPlusEq; }
756 | MINUSEQUAL { $$ = OpMinusEq; }
757 | MULTEQUAL { $$ = OpMultEq; }
758 | DIVEQUAL { $$ = OpDivEq; }
759 | LSHIFTEQUAL { $$ = OpLShift; }
760 | RSHIFTEQUAL { $$ = OpRShift; }
761 | URSHIFTEQUAL { $$ = OpURShift; }
762 | ANDEQUAL { $$ = OpAndEq; }
763 | XOREQUAL { $$ = OpXOrEq; }
764 | OREQUAL { $$ = OpOrEq; }
765 | MODEQUAL { $$ = OpModEq; }
770 | Expr ',' AssignmentExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
775 | ExprNoIn ',' AssignmentExprNoIn { $$ = createNodeFeatureInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
780 | ExprNoBF ',' AssignmentExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_featureInfo | $3.m_featureInfo, $1.m_numConstants + $3.m_numConstants); }
803 OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0);
804 DBG($$.m_node, @1, @2); }
805 | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo, $2.m_numConstants);
806 DBG($$.m_node, @1, @3); }
810 VAR VariableDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo, $2.m_numConstants);
811 DBG($$.m_node, @1, @3); }
812 | VAR VariableDeclarationList error { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo, $2.m_numConstants);
813 DBG($$.m_node, @1, @2);
817 VariableDeclarationList:
818 IDENT { $$.m_node = 0;
819 $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
820 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
821 $$.m_funcDeclarations = 0;
822 $$.m_featureInfo = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
823 $$.m_numConstants = 0;
825 | IDENT Initializer { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_featureInfo & AssignFeature);
826 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
828 $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
829 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
830 $$.m_funcDeclarations = 0;
831 $$.m_featureInfo = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_featureInfo;
832 $$.m_numConstants = $2.m_numConstants;
834 | VariableDeclarationList ',' IDENT
835 { $$.m_node = $1.m_node;
836 $$.m_varDeclarations = $1.m_varDeclarations;
837 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
838 $$.m_funcDeclarations = 0;
839 $$.m_featureInfo = $1.m_featureInfo | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
840 $$.m_numConstants = $1.m_numConstants;
842 | VariableDeclarationList ',' IDENT Initializer
843 { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_featureInfo & AssignFeature);
844 SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column);
845 $$.m_node = combineVarInitializers(GLOBAL_DATA, $1.m_node, node);
846 $$.m_varDeclarations = $1.m_varDeclarations;
847 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
848 $$.m_funcDeclarations = 0;
849 $$.m_featureInfo = $1.m_featureInfo | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_featureInfo;
850 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
854 VariableDeclarationListNoIn:
855 IDENT { $$.m_node = 0;
856 $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
857 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
858 $$.m_funcDeclarations = 0;
859 $$.m_featureInfo = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
860 $$.m_numConstants = 0;
862 | IDENT InitializerNoIn { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_featureInfo & AssignFeature);
863 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
865 $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
866 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
867 $$.m_funcDeclarations = 0;
868 $$.m_featureInfo = ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_featureInfo;
869 $$.m_numConstants = $2.m_numConstants;
871 | VariableDeclarationListNoIn ',' IDENT
872 { $$.m_node = $1.m_node;
873 $$.m_varDeclarations = $1.m_varDeclarations;
874 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
875 $$.m_funcDeclarations = 0;
876 $$.m_featureInfo = $1.m_featureInfo | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
877 $$.m_numConstants = $1.m_numConstants;
879 | VariableDeclarationListNoIn ',' IDENT InitializerNoIn
880 { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_featureInfo & AssignFeature);
881 SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column);
882 $$.m_node = combineVarInitializers(GLOBAL_DATA, $1.m_node, node);
883 $$.m_varDeclarations = $1.m_varDeclarations;
884 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
885 $$.m_funcDeclarations = 0;
886 $$.m_featureInfo = $1.m_featureInfo | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_featureInfo;
887 $$.m_numConstants = $1.m_numConstants + $4.m_numConstants;
892 CONSTTOKEN ConstDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo, $2.m_numConstants);
893 DBG($$.m_node, @1, @3); }
894 | CONSTTOKEN ConstDeclarationList error
895 { $$ = createNodeDeclarationInfo<StatementNode*>(new ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo, $2.m_numConstants);
896 DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
899 ConstDeclarationList:
900 ConstDeclaration { $$.m_node.head = $1.m_node;
901 $$.m_node.tail = $$.m_node.head;
902 $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
903 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $1.m_node);
904 $$.m_funcDeclarations = 0;
905 $$.m_featureInfo = $1.m_featureInfo;
906 $$.m_numConstants = $1.m_numConstants;
908 | ConstDeclarationList ',' ConstDeclaration
909 { $$.m_node.head = $1.m_node.head;
910 $1.m_node.tail->m_next = $3.m_node;
911 $$.m_node.tail = $3.m_node;
912 $$.m_varDeclarations = $1.m_varDeclarations;
913 appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $3.m_node);
914 $$.m_funcDeclarations = 0;
915 $$.m_featureInfo = $1.m_featureInfo | $3.m_featureInfo;
916 $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
920 IDENT { $$ = createNodeFeatureInfo<ConstDeclNode*>(new ConstDeclNode(GLOBAL_DATA, *$1, 0), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
921 | IDENT Initializer { $$ = createNodeFeatureInfo<ConstDeclNode*>(new ConstDeclNode(GLOBAL_DATA, *$1, $2.m_node), ((*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $2.m_featureInfo, $2.m_numConstants); }
925 '=' AssignmentExpr { $$ = $2; }
929 '=' AssignmentExprNoIn { $$ = $2; }
933 ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); }
937 ExprNoBF ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_featureInfo, $1.m_numConstants);
938 DBG($$.m_node, @1, @2); }
939 | ExprNoBF error { $$ = createNodeDeclarationInfo<StatementNode*>(new ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_featureInfo, $1.m_numConstants);
940 DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
944 IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE
945 { $$ = createNodeDeclarationInfo<StatementNode*>(new IfNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_featureInfo | $5.m_featureInfo, $3.m_numConstants + $5.m_numConstants);
946 DBG($$.m_node, @1, @4); }
947 | IF '(' Expr ')' Statement ELSE Statement
948 { $$ = createNodeDeclarationInfo<StatementNode*>(new IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node),
949 mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations), mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
950 $3.m_featureInfo | $5.m_featureInfo | $7.m_featureInfo,
951 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
952 DBG($$.m_node, @1, @4); }
956 DO Statement WHILE '(' Expr ')' ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo | $5.m_featureInfo, $2.m_numConstants + $5.m_numConstants);
957 DBG($$.m_node, @1, @3); }
958 | DO Statement WHILE '(' Expr ')' error { $$ = createNodeDeclarationInfo<StatementNode*>(new DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo | $5.m_featureInfo, $2.m_numConstants + $5.m_numConstants);
959 DBG($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
960 | WHILE '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new WhileNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_featureInfo | $5.m_featureInfo, $3.m_numConstants + $5.m_numConstants);
961 DBG($$.m_node, @1, @4); }
962 | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement
963 { $$ = createNodeDeclarationInfo<StatementNode*>(new ForNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node, $9.m_node, false), $9.m_varDeclarations, $9.m_funcDeclarations,
964 $3.m_featureInfo | $5.m_featureInfo | $7.m_featureInfo | $9.m_featureInfo,
965 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
966 DBG($$.m_node, @1, @8);
968 | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement
969 { $$ = createNodeDeclarationInfo<StatementNode*>(new ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true),
970 mergeDeclarationLists($4.m_varDeclarations, $10.m_varDeclarations),
971 mergeDeclarationLists($4.m_funcDeclarations, $10.m_funcDeclarations),
972 $4.m_featureInfo | $6.m_featureInfo | $8.m_featureInfo | $10.m_featureInfo,
973 $4.m_numConstants + $6.m_numConstants + $8.m_numConstants + $10.m_numConstants);
974 DBG($$.m_node, @1, @9); }
975 | FOR '(' LeftHandSideExpr INTOKEN Expr ')' Statement
977 ForInNode* node = new ForInNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node);
978 SET_EXCEPTION_LOCATION(node, @3.first_column, @3.last_column, @5.last_column);
979 $$ = createNodeDeclarationInfo<StatementNode*>(node, $7.m_varDeclarations, $7.m_funcDeclarations,
980 $3.m_featureInfo | $5.m_featureInfo | $7.m_featureInfo,
981 $3.m_numConstants + $5.m_numConstants + $7.m_numConstants);
982 DBG($$.m_node, @1, @6);
984 | FOR '(' VAR IDENT INTOKEN Expr ')' Statement
985 { ForInNode *forIn = new 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);
986 SET_EXCEPTION_LOCATION(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
987 appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
988 $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $8.m_varDeclarations, $8.m_funcDeclarations, ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $6.m_featureInfo | $8.m_featureInfo, $6.m_numConstants + $8.m_numConstants);
989 DBG($$.m_node, @1, @7); }
990 | FOR '(' VAR IDENT InitializerNoIn INTOKEN Expr ')' Statement
991 { ForInNode *forIn = new 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);
992 SET_EXCEPTION_LOCATION(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
993 appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
994 $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $9.m_varDeclarations, $9.m_funcDeclarations,
995 ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $5.m_featureInfo | $7.m_featureInfo | $9.m_featureInfo,
996 $5.m_numConstants + $7.m_numConstants + $9.m_numConstants);
997 DBG($$.m_node, @1, @8); }
1001 /* nothing */ { $$ = createNodeFeatureInfo<ExpressionNode*>(0, 0, 0); }
1006 /* nothing */ { $$ = createNodeFeatureInfo<ExpressionNode*>(0, 0, 0); }
1011 CONTINUE ';' { ContinueNode* node = new ContinueNode(GLOBAL_DATA);
1012 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1013 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1014 DBG($$.m_node, @1, @2); }
1015 | CONTINUE error { ContinueNode* node = new ContinueNode(GLOBAL_DATA);
1016 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1017 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1018 DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1019 | CONTINUE IDENT ';' { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *$2);
1020 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1021 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1022 DBG($$.m_node, @1, @3); }
1023 | CONTINUE IDENT error { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *$2);
1024 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1025 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0);
1026 DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1030 BREAK ';' { BreakNode* node = new BreakNode(GLOBAL_DATA);
1031 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1032 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @2); }
1033 | BREAK error { BreakNode* node = new BreakNode(GLOBAL_DATA);
1034 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1035 $$ = createNodeDeclarationInfo<StatementNode*>(new BreakNode(GLOBAL_DATA), 0, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1036 | BREAK IDENT ';' { BreakNode* node = new BreakNode(GLOBAL_DATA, *$2);
1037 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1038 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @3); }
1039 | BREAK IDENT error { BreakNode* node = new BreakNode(GLOBAL_DATA, *$2);
1040 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1041 $$ = createNodeDeclarationInfo<StatementNode*>(new BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1045 RETURN ';' { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0);
1046 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1047 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @2); }
1048 | RETURN error { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0);
1049 SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1050 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1051 | RETURN Expr ';' { ReturnNode* node = new ReturnNode(GLOBAL_DATA, $2.m_node);
1052 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1053 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_featureInfo, $2.m_numConstants); DBG($$.m_node, @1, @3); }
1054 | RETURN Expr error { ReturnNode* node = new ReturnNode(GLOBAL_DATA, $2.m_node);
1055 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1056 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_featureInfo, $2.m_numConstants); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1060 WITH '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new WithNode(GLOBAL_DATA, $3.m_node, $5.m_node, @3.last_column, @3.last_column - @3.first_column),
1061 $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_featureInfo | $5.m_featureInfo | WithFeature, $3.m_numConstants + $5.m_numConstants);
1062 DBG($$.m_node, @1, @4); }
1066 SWITCH '(' Expr ')' CaseBlock { $$ = createNodeDeclarationInfo<StatementNode*>(new SwitchNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations,
1067 $3.m_featureInfo | $5.m_featureInfo, $3.m_numConstants + $5.m_numConstants);
1068 DBG($$.m_node, @1, @4); }
1072 OPENBRACE CaseClausesOpt CLOSEBRACE { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new CaseBlockNode(GLOBAL_DATA, $2.m_node.head, 0, 0), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo, $2.m_numConstants); }
1073 | OPENBRACE CaseClausesOpt DefaultClause CaseClausesOpt CLOSEBRACE
1074 { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new CaseBlockNode(GLOBAL_DATA, $2.m_node.head, $3.m_node, $4.m_node.head),
1075 mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $3.m_varDeclarations), $4.m_varDeclarations),
1076 mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $3.m_funcDeclarations), $4.m_funcDeclarations),
1077 $2.m_featureInfo | $3.m_featureInfo | $4.m_featureInfo,
1078 $2.m_numConstants + $3.m_numConstants + $4.m_numConstants); }
1082 /* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_featureInfo = 0; $$.m_numConstants = 0; }
1087 CaseClause { $$.m_node.head = new ClauseListNode(GLOBAL_DATA, $1.m_node);
1088 $$.m_node.tail = $$.m_node.head;
1089 $$.m_varDeclarations = $1.m_varDeclarations;
1090 $$.m_funcDeclarations = $1.m_funcDeclarations;
1091 $$.m_featureInfo = $1.m_featureInfo;
1092 $$.m_numConstants = $1.m_numConstants; }
1093 | CaseClauses CaseClause { $$.m_node.head = $1.m_node.head;
1094 $$.m_node.tail = new ClauseListNode(GLOBAL_DATA, $1.m_node.tail, $2.m_node);
1095 $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1096 $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1097 $$.m_featureInfo = $1.m_featureInfo | $2.m_featureInfo;
1098 $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
1103 CASE Expr ':' { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, $2.m_node), 0, 0, $2.m_featureInfo, $2.m_numConstants); }
1104 | CASE Expr ':' SourceElements { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, $2.m_node, $4.m_node), $4.m_varDeclarations, $4.m_funcDeclarations, $2.m_featureInfo | $4.m_featureInfo, $2.m_numConstants + $4.m_numConstants); }
1108 DEFAULT ':' { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); }
1109 | DEFAULT ':' SourceElements { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, 0, $3.m_node), $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_featureInfo, $3.m_numConstants); }
1113 IDENT ':' Statement { $3.m_node->pushLabel(*$1);
1114 LabelNode* node = new LabelNode(GLOBAL_DATA, *$1, $3.m_node);
1115 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1116 $$ = createNodeDeclarationInfo<StatementNode*>(node, $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_featureInfo, $3.m_numConstants); }
1120 THROW Expr ';' { ThrowNode* node = new ThrowNode(GLOBAL_DATA, $2.m_node);
1121 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1122 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_featureInfo, $2.m_numConstants); DBG($$.m_node, @1, @2);
1124 | THROW Expr error { ThrowNode* node = new ThrowNode(GLOBAL_DATA, $2.m_node);
1125 SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1126 $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_featureInfo, $2.m_numConstants); DBG($$.m_node, @1, @2); AUTO_SEMICOLON;
1131 TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->nullIdentifier, 0, $4.m_node),
1132 mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations),
1133 mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
1134 $2.m_featureInfo | $4.m_featureInfo,
1135 $2.m_numConstants + $4.m_numConstants);
1136 DBG($$.m_node, @1, @2); }
1137 | TRY Block CATCH '(' IDENT ')' Block { $$ = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, $2.m_node, *$5, $7.m_node, 0),
1138 mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations),
1139 mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations),
1140 $2.m_featureInfo | $7.m_featureInfo | CatchFeature,
1141 $2.m_numConstants + $7.m_numConstants);
1142 DBG($$.m_node, @1, @2); }
1143 | TRY Block CATCH '(' IDENT ')' Block FINALLY Block
1144 { $$ = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, $2.m_node, *$5, $7.m_node, $9.m_node),
1145 mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), $9.m_varDeclarations),
1146 mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $9.m_funcDeclarations),
1147 $2.m_featureInfo | $7.m_featureInfo | $9.m_featureInfo | CatchFeature,
1148 $2.m_numConstants + $7.m_numConstants + $9.m_numConstants);
1149 DBG($$.m_node, @1, @2); }
1153 DEBUGGER ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
1154 DBG($$.m_node, @1, @2); }
1155 | DEBUGGER error { $$ = createNodeDeclarationInfo<StatementNode*>(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0);
1156 DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1159 FunctionDeclaration:
1160 FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncDeclNode(GLOBAL_DATA, *$2, $6, LEXER->sourceRange($5, $7)), ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG($6, @5, @7); }
1161 | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1162 { $$ = createNodeFeatureInfo(new FuncDeclNode(GLOBAL_DATA, *$2, $7, LEXER->sourceRange($6, $8), $4.m_node.head), ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_featureInfo | ClosureFeature, 0); DBG($7, @6, @8); }
1166 FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, LEXER->sourceRange($4, $6)), ClosureFeature, 0); DBG($5, @4, @6); }
1167 | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, LEXER->sourceRange($5, $7), $3.m_node.head), $3.m_featureInfo | ClosureFeature, 0); DBG($6, @5, @7); }
1168 | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, *$2, $6, LEXER->sourceRange($5, $7)), ClosureFeature, 0); DBG($6, @5, @7); }
1169 | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, *$2, $7, LEXER->sourceRange($6, $8), $4.m_node.head), $4.m_featureInfo | ClosureFeature, 0); DBG($7, @6, @8); }
1172 FormalParameterList:
1173 IDENT { $$.m_node.head = new ParameterNode(GLOBAL_DATA, *$1);
1174 $$.m_featureInfo = (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0;
1175 $$.m_node.tail = $$.m_node.head; }
1176 | FormalParameterList ',' IDENT { $$.m_node.head = $1.m_node.head;
1177 $$.m_featureInfo = $1.m_featureInfo | ((*$3 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0);
1178 $$.m_node.tail = new ParameterNode(GLOBAL_DATA, $1.m_node.tail, *$3); }
1182 /* not in spec */ { $$ = FunctionBodyNode::create(GLOBAL_DATA, 0, 0, 0, false, false, false, 0); }
1183 | SourceElements { $$ = FunctionBodyNode::create(GLOBAL_DATA, $1.m_node, $1.m_varDeclarations ? &$1.m_varDeclarations->data : 0,
1184 $1.m_funcDeclarations ? &$1.m_funcDeclarations->data : 0,
1185 ($1.m_featureInfo & EvalFeature) != 0, ($1.m_featureInfo & ClosureFeature) != 0,
1186 ($1.m_featureInfo & ArgumentsFeature) != 0, $1.m_numConstants);
1187 // As in mergeDeclarationLists() we have to ref/deref to safely get rid of
1188 // the declaration lists.
1189 if ($1.m_varDeclarations) {
1190 $1.m_varDeclarations->ref();
1191 $1.m_varDeclarations->deref();
1193 if ($1.m_funcDeclarations) {
1194 $1.m_funcDeclarations->ref();
1195 $1.m_funcDeclarations->deref();
1201 /* not in spec */ { GLOBAL_DATA->parser->didFinishParsing(new SourceElements(GLOBAL_DATA), 0, 0, false, false, false, @0.last_line, 0); }
1202 | SourceElements { GLOBAL_DATA->parser->didFinishParsing($1.m_node, $1.m_varDeclarations, $1.m_funcDeclarations,
1203 ($1.m_featureInfo & EvalFeature) != 0, ($1.m_featureInfo & ClosureFeature) != 0,
1204 ($1.m_featureInfo & ArgumentsFeature) != 0, @1.last_line, $1.m_numConstants); }
1208 SourceElement { $$.m_node = new SourceElements(GLOBAL_DATA);
1209 $$.m_node->append($1.m_node);
1210 $$.m_varDeclarations = $1.m_varDeclarations;
1211 $$.m_funcDeclarations = $1.m_funcDeclarations;
1212 $$.m_featureInfo = $1.m_featureInfo;
1213 $$.m_numConstants = $1.m_numConstants;
1215 | SourceElements SourceElement { $$.m_node->append($2.m_node);
1216 $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1217 $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1218 $$.m_featureInfo = $1.m_featureInfo | $2.m_featureInfo;
1219 $$.m_numConstants = $1.m_numConstants + $2.m_numConstants;
1224 FunctionDeclaration { $$ = createNodeDeclarationInfo<StatementNode*>($1.m_node, 0, new ParserRefCountedData<DeclarationStacks::FunctionStack>(GLOBAL_DATA), $1.m_featureInfo, 0); $$.m_funcDeclarations->data.append($1.m_node); }
1225 | Statement { $$ = $1; }
1230 static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
1232 if (!loc->isLocation())
1233 return new AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot);
1235 if (loc->isResolveNode()) {
1236 ResolveNode* resolve = static_cast<ResolveNode*>(loc);
1237 if (op == OpEqual) {
1238 AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, resolve->identifier(), expr, exprHasAssignments);
1239 SET_EXCEPTION_LOCATION(node, start, divot, end);
1242 return new ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1244 if (loc->isBracketAccessorNode()) {
1245 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
1247 return new AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
1249 ReadModifyBracketNode* node = new ReadModifyBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
1250 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1254 ASSERT(loc->isDotAccessorNode());
1255 DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
1257 return new AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
1259 ReadModifyDotNode* node = new ReadModifyDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1260 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1264 static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
1266 if (!expr->isLocation())
1267 return new PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
1269 if (expr->isResolveNode()) {
1270 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1271 return new PrefixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
1273 if (expr->isBracketAccessorNode()) {
1274 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1275 PrefixBracketNode* node = new PrefixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1276 node->setSubexpressionInfo(bracket->divot(), bracket->startOffset());
1279 ASSERT(expr->isDotAccessorNode());
1280 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1281 PrefixDotNode* node = new PrefixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1282 node->setSubexpressionInfo(dot->divot(), dot->startOffset());
1286 static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
1288 if (!expr->isLocation())
1289 return new PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
1291 if (expr->isResolveNode()) {
1292 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1293 return new PostfixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
1295 if (expr->isBracketAccessorNode()) {
1296 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1297 PostfixBracketNode* node = new PostfixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1298 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1302 ASSERT(expr->isDotAccessorNode());
1303 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1304 PostfixDotNode* node = new PostfixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1305 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1309 static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
1311 FeatureInfo features = func.m_featureInfo | args.m_featureInfo;
1312 int numConstants = func.m_numConstants + args.m_numConstants;
1313 if (!func.m_node->isLocation())
1314 return createNodeFeatureInfo<ExpressionNode*>(new FunctionCallValueNode(GLOBAL_DATA, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants);
1315 if (func.m_node->isResolveNode()) {
1316 ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
1317 const Identifier& identifier = resolve->identifier();
1318 if (identifier == GLOBAL_DATA->propertyNames->eval)
1319 return createNodeFeatureInfo<ExpressionNode*>(new EvalFunctionCallNode(GLOBAL_DATA, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants);
1320 return createNodeFeatureInfo<ExpressionNode*>(new FunctionCallResolveNode(GLOBAL_DATA, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants);
1322 if (func.m_node->isBracketAccessorNode()) {
1323 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
1324 FunctionCallBracketNode* node = new FunctionCallBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
1325 node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1326 return createNodeFeatureInfo<ExpressionNode*>(node, features, numConstants);
1328 ASSERT(func.m_node->isDotAccessorNode());
1329 DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
1330 FunctionCallDotNode* node = new FunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1331 node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1332 return createNodeFeatureInfo<ExpressionNode*>(node, features, numConstants);
1335 static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr)
1337 if (expr->isResolveNode()) {
1338 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1339 return new TypeOfResolveNode(GLOBAL_DATA, resolve->identifier());
1341 return new TypeOfValueNode(GLOBAL_DATA, expr);
1344 static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end)
1346 if (!expr->isLocation())
1347 return new DeleteValueNode(GLOBAL_DATA, expr);
1348 if (expr->isResolveNode()) {
1349 ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1350 return new DeleteResolveNode(GLOBAL_DATA, resolve->identifier(), divot, divot - start, end - divot);
1352 if (expr->isBracketAccessorNode()) {
1353 BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1354 return new DeleteBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
1356 ASSERT(expr->isDotAccessorNode());
1357 DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1358 return new DeleteDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), divot, divot - start, end - divot);
1361 static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceRange& source)
1363 PropertyNode::Type type;
1364 if (getOrSet == "get")
1365 type = PropertyNode::Getter;
1366 else if (getOrSet == "set")
1367 type = PropertyNode::Setter;
1370 return new PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
1373 static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n)
1375 if (n->isNumber()) {
1376 NumberNode* number = static_cast<NumberNode*>(n);
1378 if (number->value() > 0.0) {
1379 number->setValue(-number->value());
1384 return new NegateNode(GLOBAL_DATA, n);
1387 static NumberNode* makeNumberNode(void* globalPtr, double d)
1389 JSValue* value = JSImmediate::from(d);
1391 return new ImmediateNumberNode(GLOBAL_DATA, value, d);
1392 return new NumberNode(GLOBAL_DATA, d);
1395 static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr)
1397 if (expr->isNumber())
1398 return makeNumberNode(globalPtr, ~JSValue::toInt32(static_cast<NumberNode*>(expr)->value()));
1399 return new BitwiseNotNode(GLOBAL_DATA, expr);
1402 static ExpressionNode* makeMultNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1404 if (expr1->isNumber() && expr2->isNumber())
1405 return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
1406 return new MultNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
1409 static ExpressionNode* makeDivNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1411 if (expr1->isNumber() && expr2->isNumber())
1412 return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
1413 return new DivNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
1416 static ExpressionNode* makeAddNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1418 if (expr1->isNumber() && expr2->isNumber())
1419 return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
1420 return new AddNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
1423 static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1425 if (expr1->isNumber() && expr2->isNumber())
1426 return makeNumberNode(globalPtr, JSValue::toInt32(static_cast<NumberNode*>(expr1)->value()) << (JSValue::toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
1427 return new LeftShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
1430 static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1432 if (expr1->isNumber() && expr2->isNumber())
1433 return makeNumberNode(globalPtr, JSValue::toInt32(static_cast<NumberNode*>(expr1)->value()) >> (JSValue::toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
1434 return new RightShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
1437 /* called by yyparse on error */
1438 int yyerror(const char *)
1443 /* may we automatically insert a semicolon ? */
1444 static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
1446 return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
1449 static ExpressionNode* combineVarInitializers(void* globalPtr, ExpressionNode* list, AssignResolveNode* init)
1453 return new VarDeclCommaNode(GLOBAL_DATA, list, init);
1456 // We turn variable declarations into either assignments or empty
1457 // statements (which later get stripped out), because the actual
1458 // declaration work is hoisted up to the start of the function body
1459 static StatementNode* makeVarStatementNode(void* globalPtr, ExpressionNode* expr)
1462 return new EmptyStatementNode(GLOBAL_DATA);
1463 return new VarStatementNode(GLOBAL_DATA, expr);