2008-10-03 Maciej Stachowiak <mjs@apple.com>
[WebKit.git] / JavaScriptCore / kjs / grammar.y
1 %pure_parser
2
3 %{
4
5 /*
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>
9  *
10  *  This library is free software; you can redistribute it and/or
11  *  modify it under the terms of the GNU Lesser General Public
12  *  License as published by the Free Software Foundation; either
13  *  version 2 of the License, or (at your option) any later version.
14  *
15  *  This library is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  *  Lesser General Public License for more details.
19  *
20  *  You should have received a copy of the GNU Lesser General Public
21  *  License along with this library; if not, write to the Free Software
22  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23  *
24  */
25
26 #include "config.h"
27
28 #include <string.h>
29 #include <stdlib.h>
30 #include "JSValue.h"
31 #include "JSObject.h"
32 #include "nodes.h"
33 #include "lexer.h"
34 #include "JSString.h"
35 #include "JSGlobalData.h"
36 #include "CommonIdentifiers.h"
37 #include "NodeInfo.h"
38 #include "Parser.h"
39 #include <wtf/MathExtras.h>
40
41 #define YYMAXDEPTH 10000
42 #define YYENABLE_NLS 0
43
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.
47 #if !PLATFORM(DARWIN)
48     // avoid triggering warnings in older bison
49 #define YYERROR_VERBOSE
50 #endif
51
52 int kjsyylex(void* lvalp, void* llocp, void* globalPtr);
53 int kjsyyerror(const char*);
54 static inline bool allowAutomaticSemicolon(JSC::Lexer&, int);
55
56 #define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr)
57 #define LEXER (GLOBAL_DATA->lexer)
58
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)
62
63 using namespace JSC;
64 using namespace std;
65
66 static ExpressionNode* makeAssignNode(void*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end);
67 static ExpressionNode* makePrefixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
68 static ExpressionNode* makePostfixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
69 static PropertyNode* makeGetterOrSetterPropertyNode(void*, const Identifier &getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&);
70 static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end);
71 static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*);
72 static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end);
73 static ExpressionNode* makeNegateNode(void*, ExpressionNode*);
74 static NumberNode* makeNumberNode(void*, double);
75 static ExpressionNode* makeBitwiseNotNode(void*, ExpressionNode*);
76 static ExpressionNode* makeMultNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
77 static ExpressionNode* makeDivNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
78 static ExpressionNode* makeAddNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
79 static ExpressionNode* 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);
83
84 #if COMPILER(MSVC)
85
86 #pragma warning(disable: 4065)
87 #pragma warning(disable: 4244)
88 #pragma warning(disable: 4702)
89
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
94 #define YYFREE free
95
96 #endif
97
98 #define YYPARSE_PARAM globalPtr
99 #define YYLEX_PARAM globalPtr
100
101 template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserRefCountedData<DeclarationStacks::VarStack>* varDecls, 
102                                                                        ParserRefCountedData<DeclarationStacks::FunctionStack>* funcDecls,
103                                                                        FeatureInfo info,
104                                                                        int numConstants) 
105 {
106     ASSERT((info & ~AllFeatures) == 0);
107     NodeDeclarationInfo<T> result = {node, varDecls, funcDecls, info, numConstants};
108     return result;
109 }
110
111 template <typename T> NodeFeatureInfo<T> createNodeFeatureInfo(T node, FeatureInfo info, int numConstants)
112 {
113     ASSERT((info & ~AllFeatures) == 0);
114     NodeFeatureInfo<T> result = {node, info, numConstants};
115     return result;
116 }
117
118 template <typename T> T mergeDeclarationLists(T decls1, T decls2) 
119 {
120     // decls1 or both are null
121     if (!decls1)
122         return decls2;
123     // only decls1 is non-null
124     if (!decls2)
125         return decls1;
126
127     // Both are non-null
128     decls1->data.append(decls2->data);
129     
130     // We manually release the declaration lists to avoid accumulating many many
131     // unused heap allocated vectors
132     decls2->ref();
133     decls2->deref();
134     return decls1;
135 }
136
137 static void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
138 {
139     if (!varDecls)
140         varDecls = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
141
142     varDecls->data.append(make_pair(ident, attrs));
143
144 }
145
146 static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
147 {
148     unsigned attrs = DeclarationStacks::IsConstant;
149     if (decl->m_init)
150         attrs |= DeclarationStacks::HasInitializer;        
151     appendToVarDeclarationList(globalPtr, varDecls, decl->m_ident, attrs);
152 }
153
154 %}
155
156 %union {
157     int                 intValue;
158     double              doubleValue;
159     Identifier*         ident;
160
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;
170
171     // statement nodes
172     StatementNodeInfo   statementNode;
173     FunctionBodyNode*   functionBodyNode;
174     ProgramNode*        programNode;
175
176     SourceElementsInfo  sourceElements;
177     PropertyListInfo    propertyList;
178     ArgumentListInfo    argumentList;
179     VarDeclListInfo     varDeclList;
180     ConstDeclListInfo   constDeclList;
181     ClauseListInfo      clauseList;
182     ElementListInfo     elementList;
183     ParameterListInfo   parameterList;
184
185     Operator            op;
186 }
187
188 %start Program
189
190 /* literals */
191 %token NULLTOKEN TRUETOKEN FALSETOKEN
192
193 /* keywords */
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
199 %token DEBUGGER
200
201 /* give an if without an else higher precedence than an else to resolve the ambiguity */
202 %nonassoc IF_WITHOUT_ELSE
203 %nonassoc ELSE
204
205 /* punctuators */
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) */
221
222 /* terminal types */
223 %token <doubleValue> NUMBER
224 %token <ident> IDENT STRING
225
226 /* automatically inserted semicolon */
227 %token AUTOPLUSPLUS AUTOMINUSMINUS
228
229 /* non-terminal types */
230 %type <expressionNode>  Literal ArrayLiteral
231
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
252
253 %type <expressionNode>  ExprOpt ExprNoInOpt
254
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
263
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
283 %%
284
285 Literal:
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); }
291   | '/' /* regexp */                    {
292                                             Lexer& l = *LEXER;
293                                             if (!l.scanRegExp())
294                                                 YYABORT;
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);
299                                         }
300   | DIVEQUAL /* regexp with /= */       {
301                                             Lexer& l = *LEXER;
302                                             if (!l.scanRegExp())
303                                                 YYABORT;
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);
308                                         }
309 ;
310
311 Property:
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->sourceCode($5, $7, @5.first_line)), 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->sourceCode($6, $8, @6.first_line)), $4.m_featureInfo | ClosureFeature, 0); $7->setUsesArguments($7->usesArguments() || (($4.m_featureInfo & ArgumentsFeature) != 0)); DBG($7, @6, @8); if (!$$.m_node) YYABORT; }
318 ;
319
320 PropertyList:
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; }
329 ;
330
331 PrimaryExpr:
332     PrimaryExprNoBrace
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); }
337 ;
338
339 PrimaryExprNoBrace:
340     THISTOKEN                           { $$ = createNodeFeatureInfo<ExpressionNode*>(new ThisNode(GLOBAL_DATA), ThisFeature, 0); }
341   | Literal
342   | ArrayLiteral
343   | IDENT                               { $$ = createNodeFeatureInfo<ExpressionNode*>(new ResolveNode(GLOBAL_DATA, *$1, @1.first_column), (*$1 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); }
344   | '(' Expr ')'                        { $$ = $2; }
345 ;
346
347 ArrayLiteral:
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); }
351 ;
352
353 ElementList:
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; }
363 ;
364
365 ElisionOpt:
366     /* nothing */                       { $$ = 0; }
367   | Elision
368 ;
369
370 Elision:
371     ','                                 { $$ = 1; }
372   | Elision ','                         { $$ = $1 + 1; }
373 ;
374
375 MemberExpr:
376     PrimaryExpr
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); 
381                                         }
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);
385                                         }
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);
389                                         }
390 ;
391
392 MemberExprNoBF:
393     PrimaryExprNoBrace
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); 
397                                         }
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);
401                                         }
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);
405                                         }
406 ;
407
408 NewExpr:
409     MemberExpr
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); 
413                                         }
414 ;
415
416 NewExprNoBF:
417     MemberExprNoBF
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);
421                                         }
422 ;
423
424 CallExpr:
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); 
430                                         }
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); }
434 ;
435
436 CallExprNoBF:
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); 
442                                         }
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); 
446                                         }
447 ;
448
449 Arguments:
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); }
452 ;
453
454 ArgumentList:
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; }
463 ;
464
465 LeftHandSideExpr:
466     NewExpr
467   | CallExpr
468 ;
469
470 LeftHandSideExprNoBF:
471     NewExprNoBF
472   | CallExprNoBF
473 ;
474
475 PostfixExpr:
476     LeftHandSideExpr
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); }
479 ;
480
481 PostfixExprNoBF:
482     LeftHandSideExprNoBF
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); }
485 ;
486
487 UnaryExprCommon:
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); }
499
500 UnaryExpr:
501     PostfixExpr
502   | UnaryExprCommon
503 ;
504
505 UnaryExprNoBF:
506     PostfixExprNoBF
507   | UnaryExprCommon
508 ;
509
510 MultiplicativeExpr:
511     UnaryExpr
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); }
515 ;
516
517 MultiplicativeExprNoBF:
518     UnaryExprNoBF
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); }
525 ;
526
527 AdditiveExpr:
528     MultiplicativeExpr
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); }
531 ;
532
533 AdditiveExprNoBF:
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); }
539 ;
540
541 ShiftExpr:
542     AdditiveExpr
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); }
546 ;
547
548 ShiftExprNoBF:
549     AdditiveExprNoBF
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); }
553 ;
554
555 RelationalExpr:
556     ShiftExpr
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); }
567 ;
568
569 RelationalExprNoIn:
570     ShiftExpr
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); }
579 ;
580
581 RelationalExprNoBF:
582     ShiftExprNoBF
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); }
595 ;
596
597 EqualityExpr:
598     RelationalExpr
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); }
603 ;
604
605 EqualityExprNoIn:
606     RelationalExprNoIn
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); }
615 ;
616
617 EqualityExprNoBF:
618     RelationalExprNoBF
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); }
626 ;
627
628 BitwiseANDExpr:
629     EqualityExpr
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); }
631 ;
632
633 BitwiseANDExprNoIn:
634     EqualityExprNoIn
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); }
637 ;
638
639 BitwiseANDExprNoBF:
640     EqualityExprNoBF
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); }
642 ;
643
644 BitwiseXORExpr:
645     BitwiseANDExpr
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); }
647 ;
648
649 BitwiseXORExprNoIn:
650     BitwiseANDExprNoIn
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); }
653 ;
654
655 BitwiseXORExprNoBF:
656     BitwiseANDExprNoBF
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); }
659 ;
660
661 BitwiseORExpr:
662     BitwiseXORExpr
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); }
664 ;
665
666 BitwiseORExprNoIn:
667     BitwiseXORExprNoIn
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); }
670 ;
671
672 BitwiseORExprNoBF:
673     BitwiseXORExprNoBF
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); }
676 ;
677
678 LogicalANDExpr:
679     BitwiseORExpr
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); }
681 ;
682
683 LogicalANDExprNoIn:
684     BitwiseORExprNoIn
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); }
687 ;
688
689 LogicalANDExprNoBF:
690     BitwiseORExprNoBF
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); }
693 ;
694
695 LogicalORExpr:
696     LogicalANDExpr
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); }
698 ;
699
700 LogicalORExprNoIn:
701     LogicalANDExprNoIn
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); }
704 ;
705
706 LogicalORExprNoBF:
707     LogicalANDExprNoBF
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); }
709 ;
710
711 ConditionalExpr:
712     LogicalORExpr
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); }
715 ;
716
717 ConditionalExprNoIn:
718     LogicalORExprNoIn
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); }
721 ;
722
723 ConditionalExprNoBF:
724     LogicalORExprNoBF
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); }
727 ;
728
729 AssignmentExpr:
730     ConditionalExpr
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); 
734                                         }
735 ;
736
737 AssignmentExprNoIn:
738     ConditionalExprNoIn
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);
742                                         }
743 ;
744
745 AssignmentExprNoBF:
746     ConditionalExprNoBF
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); 
750                                         }
751 ;
752
753 AssignmentOperator:
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; }
766 ;
767
768 Expr:
769     AssignmentExpr
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); }
771 ;
772
773 ExprNoIn:
774     AssignmentExprNoIn
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); }
776 ;
777
778 ExprNoBF:
779     AssignmentExprNoBF
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); }
781 ;
782
783 Statement:
784     Block
785   | VariableStatement
786   | ConstStatement
787   | EmptyStatement
788   | ExprStatement
789   | IfStatement
790   | IterationStatement
791   | ContinueStatement
792   | BreakStatement
793   | ReturnStatement
794   | WithStatement
795   | SwitchStatement
796   | LabelledStatement
797   | ThrowStatement
798   | TryStatement
799   | DebuggerStatement
800 ;
801
802 Block:
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); }
807 ;
808
809 VariableStatement:
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);
814                                           AUTO_SEMICOLON; }
815 ;
816
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;
824                                         }
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);
827                                           $$.m_node = node;
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;
833                                         }
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;
841                                         }
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;
851                                         }
852 ;
853
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;
861                                         }
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);
864                                           $$.m_node = node;
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;
870                                         }
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;
878                                         }
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;
888                                         }
889 ;
890
891 ConstStatement:
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; }
897 ;
898
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;
907     }
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; }
917 ;
918
919 ConstDeclaration:
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); }
922 ;
923
924 Initializer:
925     '=' AssignmentExpr                  { $$ = $2; }
926 ;
927
928 InitializerNoIn:
929     '=' AssignmentExprNoIn              { $$ = $2; }
930 ;
931
932 EmptyStatement:
933     ';'                                 { $$ = createNodeDeclarationInfo<StatementNode*>(new EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); }
934 ;
935
936 ExprStatement:
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; }
941 ;
942
943 IfStatement:
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); }
953 ;
954
955 IterationStatement:
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); 
967                                         }
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
976                                         {
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);
983                                         }
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); }
998 ;
999
1000 ExprOpt:
1001     /* nothing */                       { $$ = createNodeFeatureInfo<ExpressionNode*>(0, 0, 0); }
1002   | Expr
1003 ;
1004
1005 ExprNoInOpt:
1006     /* nothing */                       { $$ = createNodeFeatureInfo<ExpressionNode*>(0, 0, 0); }
1007   | ExprNoIn
1008 ;
1009
1010 ContinueStatement:
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; }
1027 ;
1028
1029 BreakStatement:
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; }
1042 ;
1043
1044 ReturnStatement:
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; }
1057 ;
1058
1059 WithStatement:
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); }
1063 ;
1064
1065 SwitchStatement:
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); }
1069 ;
1070
1071 CaseBlock:
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); }
1079 ;
1080
1081 CaseClausesOpt:
1082 /* nothing */                       { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_featureInfo = 0; $$.m_numConstants = 0; }
1083   | CaseClauses
1084 ;
1085
1086 CaseClauses:
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;
1099                                         }
1100 ;
1101
1102 CaseClause:
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); }
1105 ;
1106
1107 DefaultClause:
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); }
1110 ;
1111
1112 LabelledStatement:
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); }
1117 ;
1118
1119 ThrowStatement:
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);
1123                                         }
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; 
1127                                         }
1128 ;
1129
1130 TryStatement:
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); }
1150 ;
1151
1152 DebuggerStatement:
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; }
1157 ;
1158
1159 FunctionDeclaration:
1160     FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncDeclNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), ((*$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->sourceCode($6, $8, @6.first_line), $4.m_node.head), ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_featureInfo | ClosureFeature, 0); $7->setUsesArguments($7->usesArguments() || (($4.m_featureInfo & ArgumentsFeature) != 0)); DBG($7, @6, @8); }
1163 ;
1164
1165 FunctionExpr:
1166     FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, LEXER->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); DBG($5, @4, @6); }
1167     | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, LEXER->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_featureInfo | ClosureFeature, 0); $6->setUsesArguments($6->usesArguments() || (($3.m_featureInfo & ArgumentsFeature) != 0)); DBG($6, @5, @7); }
1168   | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); }
1169   | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_featureInfo | ClosureFeature, 0); $7->setUsesArguments($7->usesArguments() || (($4.m_featureInfo & ArgumentsFeature) != 0)); DBG($7, @6, @8); }
1170 ;
1171
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);  }
1179 ;
1180
1181 FunctionBody:
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();
1192                                   }
1193                                   if ($1.m_funcDeclarations) {
1194                                       $1.m_funcDeclarations->ref();
1195                                       $1.m_funcDeclarations->deref();
1196                                   }
1197                                 }
1198 ;
1199
1200 Program:
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); }
1205 ;
1206
1207 SourceElements:
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;
1214                                         }
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;
1220                                         }
1221 ;
1222
1223 SourceElement:
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; }
1226 ;
1227  
1228 %%
1229
1230 static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
1231 {
1232     if (!loc->isLocation())
1233         return new AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot);
1234
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);
1240             return node;
1241         } else
1242             return new ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1243     }
1244     if (loc->isBracketAccessorNode()) {
1245         BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
1246         if (op == OpEqual)
1247             return new AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
1248         else {
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());
1251             return node;
1252         }
1253     }
1254     ASSERT(loc->isDotAccessorNode());
1255     DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
1256     if (op == OpEqual)
1257         return new AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
1258
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());
1261     return node;
1262 }
1263
1264 static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
1265 {
1266     if (!expr->isLocation())
1267         return new PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
1268     
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);
1272     }
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());
1277         return node;
1278     }
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());
1283     return node;
1284 }
1285
1286 static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
1287
1288     if (!expr->isLocation())
1289         return new PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
1290     
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);
1294     }
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());
1299         return node;
1300         
1301     }
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());
1306     return node;
1307 }
1308
1309 static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
1310 {
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);
1321     }
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);
1327     }
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);
1333 }
1334
1335 static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr)
1336 {
1337     if (expr->isResolveNode()) {
1338         ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1339         return new TypeOfResolveNode(GLOBAL_DATA, resolve->identifier());
1340     }
1341     return new TypeOfValueNode(GLOBAL_DATA, expr);
1342 }
1343
1344 static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end)
1345 {
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);
1351     }
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);
1355     }
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);
1359 }
1360
1361 static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source)
1362 {
1363     PropertyNode::Type type;
1364     if (getOrSet == "get")
1365         type = PropertyNode::Getter;
1366     else if (getOrSet == "set")
1367         type = PropertyNode::Setter;
1368     else
1369         return 0;
1370     return new PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
1371 }
1372
1373 static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n)
1374 {
1375     if (n->isNumber()) {
1376         NumberNode* number = static_cast<NumberNode*>(n);
1377
1378         if (number->value() > 0.0) {
1379             number->setValue(-number->value());
1380             return number;
1381         }
1382     }
1383
1384     return new NegateNode(GLOBAL_DATA, n);
1385 }
1386
1387 static NumberNode* makeNumberNode(void* globalPtr, double d)
1388 {
1389     JSValue* value = JSImmediate::from(d);
1390     if (value)
1391         return new ImmediateNumberNode(GLOBAL_DATA, value, d);
1392     return new NumberNode(GLOBAL_DATA, d);
1393 }
1394
1395 static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr)
1396 {
1397     if (expr->isNumber())
1398         return makeNumberNode(globalPtr, ~JSValue::toInt32(static_cast<NumberNode*>(expr)->value()));
1399     return new BitwiseNotNode(GLOBAL_DATA, expr);
1400 }
1401
1402 static ExpressionNode* makeMultNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1403 {
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);
1407 }
1408
1409 static ExpressionNode* makeDivNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1410 {
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);
1414 }
1415
1416 static ExpressionNode* makeAddNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1417 {
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);
1421 }
1422
1423 static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1424 {
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);
1428 }
1429
1430 static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
1431 {
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);
1435 }
1436
1437 /* called by yyparse on error */
1438 int yyerror(const char *)
1439 {
1440     return 1;
1441 }
1442
1443 /* may we automatically insert a semicolon ? */
1444 static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
1445 {
1446     return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
1447 }
1448
1449 static ExpressionNode* combineVarInitializers(void* globalPtr, ExpressionNode* list, AssignResolveNode* init)
1450 {
1451     if (!list)
1452         return init;
1453     return new VarDeclCommaNode(GLOBAL_DATA, list, init);
1454 }
1455
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)
1460 {
1461     if (!expr)
1462         return new EmptyStatementNode(GLOBAL_DATA);
1463     return new VarStatementNode(GLOBAL_DATA, expr);
1464 }
1465
1466 #undef GLOBAL_DATA