00aaeaef873c515a519f440ad4aefae6625724ea
[WebKit-https.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 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(KJS::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 KJS;
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 SourceRange&);
70 static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end);
71 static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*);
72 static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end);
73 static ExpressionNode* makeNegateNode(void*, ExpressionNode*);
74 static NumberNode* makeNumberNode(void*, double);
75 static StatementNode* makeVarStatementNode(void*, ExpressionNode*);
76 static ExpressionNode* combineVarInitializers(void*, ExpressionNode* list, AssignResolveNode* init);
77
78
79 #if COMPILER(MSVC)
80
81 #pragma warning(disable: 4065)
82 #pragma warning(disable: 4244)
83 #pragma warning(disable: 4702)
84
85 // At least some of the time, the declarations of malloc and free that bison
86 // generates are causing warnings. A way to avoid this is to explicitly define
87 // the macros so that bison doesn't try to declare malloc and free.
88 #define YYMALLOC malloc
89 #define YYFREE free
90
91 #endif
92
93 #define YYPARSE_PARAM globalPtr
94 #define YYLEX_PARAM globalPtr
95
96 template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserRefCountedData<DeclarationStacks::VarStack>* varDecls, 
97                                                                        ParserRefCountedData<DeclarationStacks::FunctionStack>* funcDecls,
98                                                                        FeatureInfo info) 
99 {
100     ASSERT((info & ~(EvalFeature | ClosureFeature | AssignFeature)) == 0);
101     NodeDeclarationInfo<T> result = {node, varDecls, funcDecls, info};
102     return result;
103 }
104
105 template <typename T> NodeFeatureInfo<T> createNodeFeatureInfo(T node, FeatureInfo info) 
106 {
107     ASSERT((info & ~(EvalFeature | ClosureFeature | AssignFeature)) == 0);
108     NodeFeatureInfo<T> result = {node, info};
109     return result;
110 }
111
112 template <typename T> T mergeDeclarationLists(T decls1, T decls2) 
113 {
114     // decls1 or both are null
115     if (!decls1)
116         return decls2;
117     // only decls1 is non-null
118     if (!decls2)
119         return decls1;
120
121     // Both are non-null
122     decls1->data.append(decls2->data);
123     
124     // We manually release the declaration lists to avoid accumulating many many
125     // unused heap allocated vectors
126     decls2->ref();
127     decls2->deref();
128     return decls1;
129 }
130
131 static void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs)
132 {
133     if (!varDecls)
134         varDecls = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
135
136     varDecls->data.append(make_pair(ident, attrs));
137
138 }
139
140 static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl)
141 {
142     unsigned attrs = DeclarationStacks::IsConstant;
143     if (decl->m_init)
144         attrs |= DeclarationStacks::HasInitializer;        
145     appendToVarDeclarationList(globalPtr, varDecls, decl->m_ident, attrs);
146 }
147
148 %}
149
150 %union {
151     int                 intValue;
152     double              doubleValue;
153     UString*            string;
154     Identifier*         ident;
155
156     // expression subtrees
157     ExpressionNodeInfo  expressionNode;
158     FuncDeclNode*       funcDeclNode;
159     PropertyNodeInfo    propertyNode;
160     ArgumentsNodeInfo   argumentsNode;
161     ConstDeclNodeInfo   constDeclNode;
162     CaseBlockNodeInfo   caseBlockNode;
163     CaseClauseNodeInfo  caseClauseNode;
164     FuncExprNodeInfo    funcExprNode;
165
166     // statement nodes
167     StatementNodeInfo   statementNode;
168     FunctionBodyNode*   functionBodyNode;
169     ProgramNode*        programNode;
170
171     SourceElementsInfo  sourceElements;
172     PropertyListInfo    propertyList;
173     ArgumentListInfo    argumentList;
174     VarDeclListInfo     varDeclList;
175     ConstDeclListInfo   constDeclList;
176     ClauseListInfo      clauseList;
177     ElementListInfo     elementList;
178     ParameterList       parameterList;
179
180     Operator            op;
181 }
182
183 %start Program
184
185 /* literals */
186 %token NULLTOKEN TRUETOKEN FALSETOKEN
187
188 /* keywords */
189 %token BREAK CASE DEFAULT FOR NEW VAR CONSTTOKEN CONTINUE
190 %token FUNCTION RETURN VOIDTOKEN DELETETOKEN
191 %token IF THISTOKEN DO WHILE INTOKEN INSTANCEOF TYPEOF
192 %token SWITCH WITH RESERVED
193 %token THROW TRY CATCH FINALLY
194 %token DEBUGGER
195
196 /* give an if without an else higher precedence than an else to resolve the ambiguity */
197 %nonassoc IF_WITHOUT_ELSE
198 %nonassoc ELSE
199
200 /* punctuators */
201 %token EQEQ NE                     /* == and != */
202 %token STREQ STRNEQ                /* === and !== */
203 %token LE GE                       /* < and > */
204 %token OR AND                      /* || and && */
205 %token PLUSPLUS MINUSMINUS         /* ++ and --  */
206 %token LSHIFT                      /* << */
207 %token RSHIFT URSHIFT              /* >> and >>> */
208 %token PLUSEQUAL MINUSEQUAL        /* += and -= */
209 %token MULTEQUAL DIVEQUAL          /* *= and /= */
210 %token LSHIFTEQUAL                 /* <<= */
211 %token RSHIFTEQUAL URSHIFTEQUAL    /* >>= and >>>= */
212 %token ANDEQUAL MODEQUAL           /* &= and %= */
213 %token XOREQUAL OREQUAL            /* ^= and |= */
214 %token <intValue> OPENBRACE        /* { (with char offset) */
215 %token <intValue> CLOSEBRACE        /* { (with char offset) */
216
217 /* terminal types */
218 %token <doubleValue> NUMBER
219 %token <string> STRING
220 %token <ident> IDENT
221
222 /* automatically inserted semicolon */
223 %token AUTOPLUSPLUS AUTOMINUSMINUS
224
225 /* non-terminal types */
226 %type <expressionNode>  Literal ArrayLiteral
227
228 %type <expressionNode>  PrimaryExpr PrimaryExprNoBrace
229 %type <expressionNode>  MemberExpr MemberExprNoBF /* BF => brace or function */
230 %type <expressionNode>  NewExpr NewExprNoBF
231 %type <expressionNode>  CallExpr CallExprNoBF
232 %type <expressionNode>  LeftHandSideExpr LeftHandSideExprNoBF
233 %type <expressionNode>  PostfixExpr PostfixExprNoBF
234 %type <expressionNode>  UnaryExpr UnaryExprNoBF UnaryExprCommon
235 %type <expressionNode>  MultiplicativeExpr MultiplicativeExprNoBF
236 %type <expressionNode>  AdditiveExpr AdditiveExprNoBF
237 %type <expressionNode>  ShiftExpr ShiftExprNoBF
238 %type <expressionNode>  RelationalExpr RelationalExprNoIn RelationalExprNoBF
239 %type <expressionNode>  EqualityExpr EqualityExprNoIn EqualityExprNoBF
240 %type <expressionNode>  BitwiseANDExpr BitwiseANDExprNoIn BitwiseANDExprNoBF
241 %type <expressionNode>  BitwiseXORExpr BitwiseXORExprNoIn BitwiseXORExprNoBF
242 %type <expressionNode>  BitwiseORExpr BitwiseORExprNoIn BitwiseORExprNoBF
243 %type <expressionNode>  LogicalANDExpr LogicalANDExprNoIn LogicalANDExprNoBF
244 %type <expressionNode>  LogicalORExpr LogicalORExprNoIn LogicalORExprNoBF
245 %type <expressionNode>  ConditionalExpr ConditionalExprNoIn ConditionalExprNoBF
246 %type <expressionNode>  AssignmentExpr AssignmentExprNoIn AssignmentExprNoBF
247 %type <expressionNode>  Expr ExprNoIn ExprNoBF
248
249 %type <expressionNode>  ExprOpt ExprNoInOpt
250
251 %type <statementNode>   Statement Block
252 %type <statementNode>   VariableStatement ConstStatement EmptyStatement ExprStatement
253 %type <statementNode>   IfStatement IterationStatement ContinueStatement
254 %type <statementNode>   BreakStatement ReturnStatement WithStatement
255 %type <statementNode>   SwitchStatement LabelledStatement
256 %type <statementNode>   ThrowStatement TryStatement
257 %type <statementNode>   DebuggerStatement
258 %type <statementNode>   SourceElement
259
260 %type <expressionNode>  Initializer InitializerNoIn
261 %type <funcDeclNode>    FunctionDeclaration
262 %type <funcExprNode>    FunctionExpr
263 %type <functionBodyNode>  FunctionBody
264 %type <sourceElements>  SourceElements
265 %type <parameterList>   FormalParameterList
266 %type <op>              AssignmentOperator
267 %type <argumentsNode>   Arguments
268 %type <argumentList>    ArgumentList
269 %type <varDeclList>     VariableDeclarationList VariableDeclarationListNoIn
270 %type <constDeclList>   ConstDeclarationList
271 %type <constDeclNode>   ConstDeclaration
272 %type <caseBlockNode>   CaseBlock
273 %type <caseClauseNode>  CaseClause DefaultClause
274 %type <clauseList>      CaseClauses CaseClausesOpt
275 %type <intValue>        Elision ElisionOpt
276 %type <elementList>     ElementList
277 %type <propertyNode>    Property
278 %type <propertyList>    PropertyList
279 %%
280
281 Literal:
282     NULLTOKEN                           { $$ = createNodeFeatureInfo<ExpressionNode*>(new NullNode(GLOBAL_DATA), 0); }
283   | TRUETOKEN                           { $$ = createNodeFeatureInfo<ExpressionNode*>(new BooleanNode(GLOBAL_DATA, true), 0); }
284   | FALSETOKEN                          { $$ = createNodeFeatureInfo<ExpressionNode*>(new BooleanNode(GLOBAL_DATA, false), 0); }
285   | NUMBER                              { $$ = createNodeFeatureInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, $1), 0); }
286   | STRING                              { $$ = createNodeFeatureInfo<ExpressionNode*>(new StringNode(GLOBAL_DATA, $1), 0); }
287   | '/' /* regexp */                    {
288                                             Lexer& l = *LEXER;
289                                             if (!l.scanRegExp())
290                                                 YYABORT;
291                                             RegExpNode* node = new RegExpNode(GLOBAL_DATA, l.pattern(), l.flags());
292                                             int size = l.pattern().size() + 2; // + 2 for the two /'s
293                                             SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
294                                             $$ = createNodeFeatureInfo<ExpressionNode*>(node, 0);
295                                         }
296   | DIVEQUAL /* regexp with /= */       {
297                                             Lexer& l = *LEXER;
298                                             if (!l.scanRegExp())
299                                                 YYABORT;
300                                             RegExpNode* node = new RegExpNode(GLOBAL_DATA, "=" + l.pattern(), l.flags());
301                                             int size = l.pattern().size() + 2; // + 2 for the two /'s
302                                             SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
303                                             $$ = createNodeFeatureInfo<ExpressionNode*>(node, 0);
304                                         }
305 ;
306
307 Property:
308     IDENT ':' AssignmentExpr            { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_featureInfo); }
309   | STRING ':' AssignmentExpr           { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, *$1), $3.m_node, PropertyNode::Constant), $3.m_featureInfo); }
310   | NUMBER ':' AssignmentExpr           { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_featureInfo); }
311   | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE    { $$ = createNodeFeatureInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, 0, $6, LEXER->sourceRange($5, $7)), ClosureFeature); DBG($6, @5, @7); if (!$$.m_node) YYABORT; }
312   | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
313                                         { $$ = createNodeFeatureInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.head, $7, LEXER->sourceRange($6, $8)), ClosureFeature); DBG($7, @6, @8); if (!$$.m_node) YYABORT; }
314 ;
315
316 PropertyList:
317     Property                            { $$.m_node.head = new PropertyListNode(GLOBAL_DATA, $1.m_node); 
318                                           $$.m_node.tail = $$.m_node.head;
319                                           $$.m_featureInfo = $1.m_featureInfo; }
320   | PropertyList ',' Property           { $$.m_node.head = $1.m_node.head;
321                                           $$.m_node.tail = new PropertyListNode(GLOBAL_DATA, $3.m_node, $1.m_node.tail);
322                                           $$.m_featureInfo = $1.m_featureInfo | $3.m_featureInfo;  }
323 ;
324
325 PrimaryExpr:
326     PrimaryExprNoBrace
327   | OPENBRACE CLOSEBRACE                             { $$ = createNodeFeatureInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA), 0); }
328   | OPENBRACE PropertyList CLOSEBRACE                { $$ = createNodeFeatureInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_featureInfo); }
329   /* allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939 */
330   | OPENBRACE PropertyList ',' CLOSEBRACE            { $$ = createNodeFeatureInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_featureInfo); }
331 ;
332
333 PrimaryExprNoBrace:
334     THISTOKEN                           { $$ = createNodeFeatureInfo<ExpressionNode*>(new ThisNode(GLOBAL_DATA), 0); }
335   | Literal
336   | ArrayLiteral
337   | IDENT                               { $$ = createNodeFeatureInfo<ExpressionNode*>(new ResolveNode(GLOBAL_DATA, *$1, @1.first_column), 0); }
338   | '(' Expr ')'                        { $$ = $2; }
339 ;
340
341 ArrayLiteral:
342     '[' ElisionOpt ']'                  { $$ = createNodeFeatureInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, $2), 0); }
343   | '[' ElementList ']'                 { $$ = createNodeFeatureInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, $2.m_node.head), $2.m_featureInfo); }
344   | '[' ElementList ',' ElisionOpt ']'  { $$ = createNodeFeatureInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, $4, $2.m_node.head), $2.m_featureInfo); }
345 ;
346
347 ElementList:
348     ElisionOpt AssignmentExpr           { $$.m_node.head = new ElementNode(GLOBAL_DATA, $1, $2.m_node);
349                                           $$.m_node.tail = $$.m_node.head;
350                                           $$.m_featureInfo = $2.m_featureInfo; }
351   | ElementList ',' ElisionOpt AssignmentExpr
352                                         { $$.m_node.head = $1.m_node.head;
353                                           $$.m_node.tail = new ElementNode(GLOBAL_DATA, $1.m_node.tail, $3, $4.m_node);
354                                           $$.m_featureInfo = $1.m_featureInfo | $4.m_featureInfo; }
355 ;
356
357 ElisionOpt:
358     /* nothing */                       { $$ = 0; }
359   | Elision
360 ;
361
362 Elision:
363     ','                                 { $$ = 1; }
364   | Elision ','                         { $$ = $1 + 1; }
365 ;
366
367 MemberExpr:
368     PrimaryExpr
369   | FunctionExpr                        { $$ = createNodeFeatureInfo<ExpressionNode*>($1.m_node, $1.m_featureInfo); }
370   | MemberExpr '[' Expr ']'             { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
371                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
372                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); 
373                                         }
374   | MemberExpr '.' IDENT                { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
375                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
376                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo);
377                                         }
378   | NEW MemberExpr Arguments            { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
379                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
380                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $2.m_featureInfo | $3.m_featureInfo);
381                                         }
382 ;
383
384 MemberExprNoBF:
385     PrimaryExprNoBrace
386   | MemberExprNoBF '[' Expr ']'         { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
387                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
388                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); 
389                                         }
390   | MemberExprNoBF '.' IDENT            { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
391                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
392                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo);
393                                         }
394   | NEW MemberExpr Arguments            { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
395                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
396                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $2.m_featureInfo | $3.m_featureInfo);
397                                         }
398 ;
399
400 NewExpr:
401     MemberExpr
402   | NEW NewExpr                         { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node);
403                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
404                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $2.m_featureInfo); 
405                                         }
406 ;
407
408 NewExprNoBF:
409     MemberExprNoBF
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); 
413                                         }
414 ;
415
416 CallExpr:
417     MemberExpr Arguments                { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
418   | CallExpr Arguments                  { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
419   | CallExpr '[' Expr ']'               { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
420                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
421                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); 
422                                         }
423   | CallExpr '.' IDENT                  { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
424                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
425                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo); }
426 ;
427
428 CallExprNoBF:
429     MemberExprNoBF Arguments            { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
430   | CallExprNoBF Arguments              { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
431   | CallExprNoBF '[' Expr ']'           { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
432                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
433                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); 
434                                         }
435   | CallExprNoBF '.' IDENT              { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
436                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
437                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo); 
438                                         }
439 ;
440
441 Arguments:
442     '(' ')'                             { $$ = createNodeFeatureInfo<ArgumentsNode*>(new ArgumentsNode(GLOBAL_DATA), 0); }
443   | '(' ArgumentList ')'                { $$ = createNodeFeatureInfo<ArgumentsNode*>(new ArgumentsNode(GLOBAL_DATA, $2.m_node.head), $2.m_featureInfo); }
444 ;
445
446 ArgumentList:
447     AssignmentExpr                      { $$.m_node.head = new ArgumentListNode(GLOBAL_DATA, $1.m_node);
448                                           $$.m_node.tail = $$.m_node.head;
449                                           $$.m_featureInfo = $1.m_featureInfo; }
450   | ArgumentList ',' AssignmentExpr     { $$.m_node.head = $1.m_node.head;
451                                           $$.m_node.tail = new ArgumentListNode(GLOBAL_DATA, $1.m_node.tail, $3.m_node);
452                                           $$.m_featureInfo = $1.m_featureInfo | $3.m_featureInfo; }
453 ;
454
455 LeftHandSideExpr:
456     NewExpr
457   | CallExpr
458 ;
459
460 LeftHandSideExprNoBF:
461     NewExprNoBF
462   | CallExprNoBF
463 ;
464
465 PostfixExpr:
466     LeftHandSideExpr
467   | LeftHandSideExpr PLUSPLUS           { $$ = createNodeFeatureInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_featureInfo | AssignFeature); }
468   | LeftHandSideExpr MINUSMINUS         { $$ = createNodeFeatureInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_featureInfo | AssignFeature); }
469 ;
470
471 PostfixExprNoBF:
472     LeftHandSideExprNoBF
473   | LeftHandSideExprNoBF PLUSPLUS       { $$ = createNodeFeatureInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_featureInfo | AssignFeature); }
474   | LeftHandSideExprNoBF MINUSMINUS     { $$ = createNodeFeatureInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_featureInfo | AssignFeature); }
475 ;
476
477 UnaryExprCommon:
478     DELETETOKEN UnaryExpr               { $$ = createNodeFeatureInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, $2.m_node, @1.first_column, @2.last_column, @2.last_column), $2.m_featureInfo); }
479   | VOIDTOKEN UnaryExpr                 { $$ = createNodeFeatureInfo<ExpressionNode*>(new VoidNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo); }
480   | TYPEOF UnaryExpr                    { $$ = createNodeFeatureInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo); }
481   | 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); }
482   | 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); }
483   | 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); }
484   | 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); }
485   | '+' UnaryExpr                       { $$ = createNodeFeatureInfo<ExpressionNode*>(new UnaryPlusNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo); }
486   | '-' UnaryExpr                       { $$ = createNodeFeatureInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo); }
487   | '~' UnaryExpr                       { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitwiseNotNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo); }
488   | '!' UnaryExpr                       { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalNotNode(GLOBAL_DATA, $2.m_node), $2.m_featureInfo); }
489
490 UnaryExpr:
491     PostfixExpr
492   | UnaryExprCommon
493 ;
494
495 UnaryExprNoBF:
496     PostfixExprNoBF
497   | UnaryExprCommon
498 ;
499
500 MultiplicativeExpr:
501     UnaryExpr
502   | MultiplicativeExpr '*' UnaryExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new MultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
503   | MultiplicativeExpr '/' UnaryExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new DivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
504   | MultiplicativeExpr '%' UnaryExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
505 ;
506
507 MultiplicativeExprNoBF:
508     UnaryExprNoBF
509   | MultiplicativeExprNoBF '*' UnaryExpr
510                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new MultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
511   | MultiplicativeExprNoBF '/' UnaryExpr
512                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new DivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
513   | MultiplicativeExprNoBF '%' UnaryExpr
514                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
515 ;
516
517 AdditiveExpr:
518     MultiplicativeExpr
519   | AdditiveExpr '+' MultiplicativeExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new AddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
520   | AdditiveExpr '-' MultiplicativeExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new SubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
521 ;
522
523 AdditiveExprNoBF:
524     MultiplicativeExprNoBF
525   | AdditiveExprNoBF '+' MultiplicativeExpr
526                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new AddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
527   | AdditiveExprNoBF '-' MultiplicativeExpr
528                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new SubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
529 ;
530
531 ShiftExpr:
532     AdditiveExpr
533   | ShiftExpr LSHIFT AdditiveExpr       { $$ = createNodeFeatureInfo<ExpressionNode*>(new LeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
534   | ShiftExpr RSHIFT AdditiveExpr       { $$ = createNodeFeatureInfo<ExpressionNode*>(new RightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
535   | 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); }
536 ;
537
538 ShiftExprNoBF:
539     AdditiveExprNoBF
540   | 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); }
541   | 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); }
542   | 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); }
543 ;
544
545 RelationalExpr:
546     ShiftExpr
547   | RelationalExpr '<' ShiftExpr        { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
548   | RelationalExpr '>' ShiftExpr        { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
549   | 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); }
550   | 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); }
551   | RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
552                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);  
553                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); }
554   | RelationalExpr INTOKEN ShiftExpr    { InNode* node = new InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
555                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);  
556                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); }
557 ;
558
559 RelationalExprNoIn:
560     ShiftExpr
561   | RelationalExprNoIn '<' ShiftExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
562   | RelationalExprNoIn '>' ShiftExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
563   | 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); }
564   | 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); }
565   | RelationalExprNoIn INSTANCEOF ShiftExpr
566                                         { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
567                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);  
568                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); }
569 ;
570
571 RelationalExprNoBF:
572     ShiftExprNoBF
573   | RelationalExprNoBF '<' ShiftExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
574   | RelationalExprNoBF '>' ShiftExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
575   | 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); }
576   | 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); }
577   | RelationalExprNoBF INSTANCEOF ShiftExpr
578                                         { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
579                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);  
580                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); }
581   | RelationalExprNoBF INTOKEN ShiftExpr 
582                                         { InNode* node = new InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature);
583                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);  
584                                           $$ = createNodeFeatureInfo<ExpressionNode*>(node, $1.m_featureInfo | $3.m_featureInfo); }
585 ;
586
587 EqualityExpr:
588     RelationalExpr
589   | 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); }
590   | 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); }
591   | 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); }
592   | 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); }
593 ;
594
595 EqualityExprNoIn:
596     RelationalExprNoIn
597   | EqualityExprNoIn EQEQ RelationalExprNoIn
598                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
599   | EqualityExprNoIn NE RelationalExprNoIn
600                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
601   | EqualityExprNoIn STREQ RelationalExprNoIn
602                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
603   | EqualityExprNoIn STRNEQ RelationalExprNoIn
604                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
605 ;
606
607 EqualityExprNoBF:
608     RelationalExprNoBF
609   | EqualityExprNoBF EQEQ RelationalExpr
610                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
611   | 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); }
612   | EqualityExprNoBF STREQ RelationalExpr
613                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
614   | EqualityExprNoBF STRNEQ RelationalExpr
615                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
616 ;
617
618 BitwiseANDExpr:
619     EqualityExpr
620   | BitwiseANDExpr '&' EqualityExpr     { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
621 ;
622
623 BitwiseANDExprNoIn:
624     EqualityExprNoIn
625   | BitwiseANDExprNoIn '&' EqualityExprNoIn
626                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
627 ;
628
629 BitwiseANDExprNoBF:
630     EqualityExprNoBF
631   | BitwiseANDExprNoBF '&' EqualityExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
632 ;
633
634 BitwiseXORExpr:
635     BitwiseANDExpr
636   | BitwiseXORExpr '^' BitwiseANDExpr   { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
637 ;
638
639 BitwiseXORExprNoIn:
640     BitwiseANDExprNoIn
641   | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn
642                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
643 ;
644
645 BitwiseXORExprNoBF:
646     BitwiseANDExprNoBF
647   | BitwiseXORExprNoBF '^' BitwiseANDExpr
648                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
649 ;
650
651 BitwiseORExpr:
652     BitwiseXORExpr
653   | BitwiseORExpr '|' BitwiseXORExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
654 ;
655
656 BitwiseORExprNoIn:
657     BitwiseXORExprNoIn
658   | BitwiseORExprNoIn '|' BitwiseXORExprNoIn
659                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
660 ;
661
662 BitwiseORExprNoBF:
663     BitwiseXORExprNoBF
664   | BitwiseORExprNoBF '|' BitwiseXORExpr
665                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_featureInfo & AssignFeature), $1.m_featureInfo | $3.m_featureInfo); }
666 ;
667
668 LogicalANDExpr:
669     BitwiseORExpr
670   | LogicalANDExpr AND BitwiseORExpr    { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_featureInfo | $3.m_featureInfo); }
671 ;
672
673 LogicalANDExprNoIn:
674     BitwiseORExprNoIn
675   | LogicalANDExprNoIn AND BitwiseORExprNoIn
676                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_featureInfo | $3.m_featureInfo); }
677 ;
678
679 LogicalANDExprNoBF:
680     BitwiseORExprNoBF
681   | LogicalANDExprNoBF AND BitwiseORExpr
682                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_featureInfo | $3.m_featureInfo); }
683 ;
684
685 LogicalORExpr:
686     LogicalANDExpr
687   | LogicalORExpr OR LogicalANDExpr     { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_featureInfo | $3.m_featureInfo); }
688 ;
689
690 LogicalORExprNoIn:
691     LogicalANDExprNoIn
692   | LogicalORExprNoIn OR LogicalANDExprNoIn
693                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_featureInfo | $3.m_featureInfo); }
694 ;
695
696 LogicalORExprNoBF:
697     LogicalANDExprNoBF
698   | LogicalORExprNoBF OR LogicalANDExpr { $$ = createNodeFeatureInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_featureInfo | $3.m_featureInfo); }
699 ;
700
701 ConditionalExpr:
702     LogicalORExpr
703   | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr
704                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_featureInfo | $3.m_featureInfo | $5.m_featureInfo); }
705 ;
706
707 ConditionalExprNoIn:
708     LogicalORExprNoIn
709   | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn
710                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_featureInfo | $3.m_featureInfo | $5.m_featureInfo); }
711 ;
712
713 ConditionalExprNoBF:
714     LogicalORExprNoBF
715   | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr
716                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_featureInfo | $3.m_featureInfo | $5.m_featureInfo); }
717 ;
718
719 AssignmentExpr:
720     ConditionalExpr
721   | LeftHandSideExpr AssignmentOperator AssignmentExpr
722                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_featureInfo & AssignFeature, $3.m_featureInfo & AssignFeature, 
723                                                                                                      @1.first_column, @2.first_column + 1, @3.last_column), $1.m_featureInfo | $3.m_featureInfo | AssignFeature); 
724                                         }
725 ;
726
727 AssignmentExprNoIn:
728     ConditionalExprNoIn
729   | LeftHandSideExpr AssignmentOperator AssignmentExprNoIn
730                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_featureInfo & AssignFeature, $3.m_featureInfo & AssignFeature, 
731                                                                                                      @1.first_column, @2.first_column + 1, @3.last_column), $1.m_featureInfo | $3.m_featureInfo | AssignFeature);
732                                         }
733 ;
734
735 AssignmentExprNoBF:
736     ConditionalExprNoBF
737   | LeftHandSideExprNoBF AssignmentOperator AssignmentExpr
738                                         { $$ = createNodeFeatureInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, $1.m_node, $2, $3.m_node, $1.m_featureInfo & AssignFeature, $3.m_featureInfo & AssignFeature,
739                                                                                                      @1.first_column, @2.first_column + 1, @3.last_column), $1.m_featureInfo | $3.m_featureInfo | AssignFeature); 
740                                         }
741 ;
742
743 AssignmentOperator:
744     '='                                 { $$ = OpEqual; }
745   | PLUSEQUAL                           { $$ = OpPlusEq; }
746   | MINUSEQUAL                          { $$ = OpMinusEq; }
747   | MULTEQUAL                           { $$ = OpMultEq; }
748   | DIVEQUAL                            { $$ = OpDivEq; }
749   | LSHIFTEQUAL                         { $$ = OpLShift; }
750   | RSHIFTEQUAL                         { $$ = OpRShift; }
751   | URSHIFTEQUAL                        { $$ = OpURShift; }
752   | ANDEQUAL                            { $$ = OpAndEq; }
753   | XOREQUAL                            { $$ = OpXOrEq; }
754   | OREQUAL                             { $$ = OpOrEq; }
755   | MODEQUAL                            { $$ = OpModEq; }
756 ;
757
758 Expr:
759     AssignmentExpr
760   | Expr ',' AssignmentExpr             { $$ = createNodeFeatureInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_featureInfo | $3.m_featureInfo); }
761 ;
762
763 ExprNoIn:
764     AssignmentExprNoIn
765   | ExprNoIn ',' AssignmentExprNoIn     { $$ = createNodeFeatureInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_featureInfo | $3.m_featureInfo); }
766 ;
767
768 ExprNoBF:
769     AssignmentExprNoBF
770   | ExprNoBF ',' AssignmentExpr         { $$ = createNodeFeatureInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, $1.m_node, $3.m_node), $1.m_featureInfo | $3.m_featureInfo); }
771 ;
772
773 Statement:
774     Block
775   | VariableStatement
776   | ConstStatement
777   | EmptyStatement
778   | ExprStatement
779   | IfStatement
780   | IterationStatement
781   | ContinueStatement
782   | BreakStatement
783   | ReturnStatement
784   | WithStatement
785   | SwitchStatement
786   | LabelledStatement
787   | ThrowStatement
788   | TryStatement
789   | DebuggerStatement
790 ;
791
792 Block:
793     OPENBRACE CLOSEBRACE                             { $$ = createNodeDeclarationInfo<StatementNode*>(new BlockNode(GLOBAL_DATA, 0), 0, 0, 0);
794                                           DBG($$.m_node, @1, @2); }
795   | OPENBRACE SourceElements CLOSEBRACE              { $$ = createNodeDeclarationInfo<StatementNode*>(new BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo);
796                                           DBG($$.m_node, @1, @3); }
797 ;
798
799 VariableStatement:
800     VAR VariableDeclarationList ';'     { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo);
801                                           DBG($$.m_node, @1, @3); }
802   | VAR VariableDeclarationList error   { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo);
803                                           DBG($$.m_node, @1, @2);
804                                           AUTO_SEMICOLON; }
805 ;
806
807 VariableDeclarationList:
808     IDENT                               { $$.m_node = 0;
809                                           $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
810                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
811                                           $$.m_funcDeclarations = 0;
812                                           $$.m_featureInfo = 0;
813                                         }
814   | IDENT Initializer                   { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_featureInfo & AssignFeature);
815                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
816                                           $$.m_node = node;
817                                           $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
818                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
819                                           $$.m_funcDeclarations = 0;
820                                           $$.m_featureInfo = $2.m_featureInfo;
821                                         }
822   | VariableDeclarationList ',' IDENT
823                                         { $$.m_node = $1.m_node;
824                                           $$.m_varDeclarations = $1.m_varDeclarations;
825                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
826                                           $$.m_funcDeclarations = 0;
827                                           $$.m_featureInfo = $1.m_featureInfo;
828                                         }
829   | VariableDeclarationList ',' IDENT Initializer
830                                         { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_featureInfo & AssignFeature);
831                                           SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column);
832                                           $$.m_node = combineVarInitializers(GLOBAL_DATA, $1.m_node, node);
833                                           $$.m_varDeclarations = $1.m_varDeclarations;
834                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
835                                           $$.m_funcDeclarations = 0;
836                                           $$.m_featureInfo = $1.m_featureInfo | $4.m_featureInfo;
837                                         }
838 ;
839
840 VariableDeclarationListNoIn:
841     IDENT                               { $$.m_node = 0;
842                                           $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
843                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, 0);
844                                           $$.m_funcDeclarations = 0;
845                                           $$.m_featureInfo = 0;
846                                         }
847   | IDENT InitializerNoIn               { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_featureInfo & AssignFeature);
848                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column);
849                                           $$.m_node = node;
850                                           $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
851                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer);
852                                           $$.m_funcDeclarations = 0;
853                                           $$.m_featureInfo = $2.m_featureInfo;
854                                         }
855   | VariableDeclarationListNoIn ',' IDENT
856                                         { $$.m_node = $1.m_node;
857                                           $$.m_varDeclarations = $1.m_varDeclarations;
858                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, 0);
859                                           $$.m_funcDeclarations = 0;
860                                           $$.m_featureInfo = $1.m_featureInfo;
861                                         }
862   | VariableDeclarationListNoIn ',' IDENT InitializerNoIn
863                                         { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_featureInfo & AssignFeature);
864                                           SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column);
865                                           $$.m_node = combineVarInitializers(GLOBAL_DATA, $1.m_node, node);
866                                           $$.m_varDeclarations = $1.m_varDeclarations;
867                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer);
868                                           $$.m_funcDeclarations = 0;
869                                           $$.m_featureInfo = $1.m_featureInfo | $4.m_featureInfo;
870                                         }
871 ;
872
873 ConstStatement:
874     CONSTTOKEN ConstDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo);
875                                           DBG($$.m_node, @1, @3); }
876   | CONSTTOKEN ConstDeclarationList error
877                                         { $$ = createNodeDeclarationInfo<StatementNode*>(new ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo);
878                                           DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
879 ;
880
881 ConstDeclarationList:
882     ConstDeclaration                    { $$.m_node.head = $1.m_node;
883                                           $$.m_node.tail = $$.m_node.head;
884                                           $$.m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA);
885                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $1.m_node);
886                                           $$.m_funcDeclarations = 0; 
887                                           $$.m_featureInfo = $1.m_featureInfo;
888     }
889   | ConstDeclarationList ',' ConstDeclaration
890                                         {  $$.m_node.head = $1.m_node.head;
891                                           $1.m_node.tail->m_next = $3.m_node;
892                                           $$.m_node.tail = $3.m_node;
893                                           $$.m_varDeclarations = $1.m_varDeclarations;
894                                           appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, $3.m_node);
895                                           $$.m_funcDeclarations = 0;
896                                           $$.m_featureInfo = $1.m_featureInfo | $3.m_featureInfo;}
897 ;
898
899 ConstDeclaration:
900     IDENT                               { $$ = createNodeFeatureInfo<ConstDeclNode*>(new ConstDeclNode(GLOBAL_DATA, *$1, 0), 0); }
901   | IDENT Initializer                   { $$ = createNodeFeatureInfo<ConstDeclNode*>(new ConstDeclNode(GLOBAL_DATA, *$1, $2.m_node), $2.m_featureInfo); }
902 ;
903
904 Initializer:
905     '=' AssignmentExpr                  { $$ = $2; }
906 ;
907
908 InitializerNoIn:
909     '=' AssignmentExprNoIn              { $$ = $2; }
910 ;
911
912 EmptyStatement:
913     ';'                                 { $$ = createNodeDeclarationInfo<StatementNode*>(new EmptyStatementNode(GLOBAL_DATA), 0, 0, 0); }
914 ;
915
916 ExprStatement:
917     ExprNoBF ';'                        { $$ = createNodeDeclarationInfo<StatementNode*>(new ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_featureInfo);
918                                           DBG($$.m_node, @1, @2); }
919   | ExprNoBF error                      { $$ = createNodeDeclarationInfo<StatementNode*>(new ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_featureInfo);
920                                           DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
921 ;
922
923 IfStatement:
924     IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE
925                                         { $$ = createNodeDeclarationInfo<StatementNode*>(new IfNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_featureInfo | $5.m_featureInfo);
926                                           DBG($$.m_node, @1, @4); }
927   | IF '(' Expr ')' Statement ELSE Statement
928                                         { $$ = createNodeDeclarationInfo<StatementNode*>(new IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node), 
929                                                                                          mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations), mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations),
930                                                                                          $3.m_featureInfo | $5.m_featureInfo | $7.m_featureInfo); 
931                                           DBG($$.m_node, @1, @4); }
932 ;
933
934 IterationStatement:
935     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);
936                                              DBG($$.m_node, @1, @3); }
937   | 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);
938                                              DBG($$.m_node, @1, @3); } // Always performs automatic semicolon insertion.
939   | 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);
940                                           DBG($$.m_node, @1, @4); }
941   | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement
942                                         { $$ = 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, 
943                                                                                          $3.m_featureInfo | $5.m_featureInfo | $7.m_featureInfo | $9.m_featureInfo);
944                                           DBG($$.m_node, @1, @8); 
945                                         }
946   | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement
947                                         { $$ = createNodeDeclarationInfo<StatementNode*>(new ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true),
948                                                                                          mergeDeclarationLists($4.m_varDeclarations, $10.m_varDeclarations),
949                                                                                          mergeDeclarationLists($4.m_funcDeclarations, $10.m_funcDeclarations),
950                                                                                          $4.m_featureInfo | $6.m_featureInfo | $8.m_featureInfo | $10.m_featureInfo);
951                                           DBG($$.m_node, @1, @9); }
952   | FOR '(' LeftHandSideExpr INTOKEN Expr ')' Statement
953                                         {
954                                             ExpressionNode* n = $3.m_node;
955                                             if (!n->isLocation())
956                                                 YYABORT;
957                                             ForInNode* node = new ForInNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node);
958                                             SET_EXCEPTION_LOCATION(node, @3.first_column, @3.last_column, @5.last_column);
959                                             $$ = createNodeDeclarationInfo<StatementNode*>(node, $7.m_varDeclarations, $7.m_funcDeclarations,
960                                                                                            $3.m_featureInfo | $5.m_featureInfo | $7.m_featureInfo);
961                                             DBG($$.m_node, @1, @6);
962                                         }
963   | FOR '(' VAR IDENT INTOKEN Expr ')' Statement
964                                         { 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);
965                                           SET_EXCEPTION_LOCATION(forIn, @4.first_column, @5.first_column + 1, @6.last_column);
966                                           appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
967                                           $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $8.m_varDeclarations, $8.m_funcDeclarations, $6.m_featureInfo | $8.m_featureInfo);
968                                           DBG($$.m_node, @1, @7); }
969   | FOR '(' VAR IDENT InitializerNoIn INTOKEN Expr ')' Statement
970                                         { 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);
971                                           SET_EXCEPTION_LOCATION(forIn, @4.first_column, @6.first_column + 1, @7.last_column);
972                                           appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer);
973                                           $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $9.m_varDeclarations, $9.m_funcDeclarations,
974                                                                                          $5.m_featureInfo | $7.m_featureInfo | $9.m_featureInfo);
975                                           DBG($$.m_node, @1, @8); }
976 ;
977
978 ExprOpt:
979     /* nothing */                       { $$ = createNodeFeatureInfo<ExpressionNode*>(0, 0); }
980   | Expr
981 ;
982
983 ExprNoInOpt:
984     /* nothing */                       { $$ = createNodeFeatureInfo<ExpressionNode*>(0, 0); }
985   | ExprNoIn
986 ;
987
988 ContinueStatement:
989     CONTINUE ';'                        { ContinueNode* node = new ContinueNode(GLOBAL_DATA);
990                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); 
991                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0);
992                                           DBG($$.m_node, @1, @2); }
993   | CONTINUE error                      { ContinueNode* node = new ContinueNode(GLOBAL_DATA);
994                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); 
995                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0);
996                                           DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
997   | CONTINUE IDENT ';'                  { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *$2);
998                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); 
999                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0);
1000                                           DBG($$.m_node, @1, @3); }
1001   | CONTINUE IDENT error                { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *$2);
1002                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); 
1003                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0);
1004                                           DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1005 ;
1006
1007 BreakStatement:
1008     BREAK ';'                           { BreakNode* node = new BreakNode(GLOBAL_DATA);
1009                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1010                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0); DBG($$.m_node, @1, @2); }
1011   | BREAK error                         { BreakNode* node = new BreakNode(GLOBAL_DATA);
1012                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column);
1013                                           $$ = createNodeDeclarationInfo<StatementNode*>(new BreakNode(GLOBAL_DATA), 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1014   | BREAK IDENT ';'                     { BreakNode* node = new BreakNode(GLOBAL_DATA, *$2);
1015                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1016                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0); DBG($$.m_node, @1, @3); }
1017   | BREAK IDENT error                   { BreakNode* node = new BreakNode(GLOBAL_DATA, *$2);
1018                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1019                                           $$ = createNodeDeclarationInfo<StatementNode*>(new BreakNode(GLOBAL_DATA, *$2), 0, 0, 0); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1020 ;
1021
1022 ReturnStatement:
1023     RETURN ';'                          { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); 
1024                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); 
1025                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0); DBG($$.m_node, @1, @2); }
1026   | RETURN error                        { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); 
1027                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); 
1028                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1029   | RETURN Expr ';'                     { ReturnNode* node = new ReturnNode(GLOBAL_DATA, $2.m_node); 
1030                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1031                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_featureInfo); DBG($$.m_node, @1, @3); }
1032   | RETURN Expr error                   { ReturnNode* node = new ReturnNode(GLOBAL_DATA, $2.m_node); 
1033                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); 
1034                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_featureInfo); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; }
1035 ;
1036
1037 WithStatement:
1038     WITH '(' Expr ')' Statement         { $$ = createNodeDeclarationInfo<StatementNode*>(new WithNode(GLOBAL_DATA, $3.m_node, $5.m_node, @3.last_column, @3.last_column - @3.first_column),
1039                                                                                          $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_featureInfo | $5.m_featureInfo);
1040                                           DBG($$.m_node, @1, @4); }
1041 ;
1042
1043 SwitchStatement:
1044     SWITCH '(' Expr ')' CaseBlock       { $$ = createNodeDeclarationInfo<StatementNode*>(new SwitchNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations,
1045                                                                                          $3.m_featureInfo | $5.m_featureInfo);
1046                                           DBG($$.m_node, @1, @4); }
1047 ;
1048
1049 CaseBlock:
1050     OPENBRACE CaseClausesOpt CLOSEBRACE              { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new CaseBlockNode(GLOBAL_DATA, $2.m_node.head, 0, 0), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_featureInfo); }
1051   | OPENBRACE CaseClausesOpt DefaultClause CaseClausesOpt CLOSEBRACE
1052                                         { $$ = createNodeDeclarationInfo<CaseBlockNode*>(new CaseBlockNode(GLOBAL_DATA, $2.m_node.head, $3.m_node, $4.m_node.head),
1053                                                                                          mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $3.m_varDeclarations), $4.m_varDeclarations),
1054                                                                                          mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $3.m_funcDeclarations), $4.m_funcDeclarations),
1055                                                                                          $2.m_featureInfo | $3.m_featureInfo | $4.m_featureInfo); }
1056 ;
1057
1058 CaseClausesOpt:
1059 /* nothing */                       { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_featureInfo = 0; }
1060   | CaseClauses
1061 ;
1062
1063 CaseClauses:
1064     CaseClause                          { $$.m_node.head = new ClauseListNode(GLOBAL_DATA, $1.m_node);
1065                                           $$.m_node.tail = $$.m_node.head;
1066                                           $$.m_varDeclarations = $1.m_varDeclarations;
1067                                           $$.m_funcDeclarations = $1.m_funcDeclarations; 
1068                                           $$.m_featureInfo = $1.m_featureInfo; } 
1069   | CaseClauses CaseClause              { $$.m_node.head = $1.m_node.head;
1070                                           $$.m_node.tail = new ClauseListNode(GLOBAL_DATA, $1.m_node.tail, $2.m_node);
1071                                           $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1072                                           $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1073                                           $$.m_featureInfo = $1.m_featureInfo | $2.m_featureInfo;
1074                                         }
1075 ;
1076
1077 CaseClause:
1078     CASE Expr ':'                       { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, $2.m_node), 0, 0, $2.m_featureInfo); }
1079   | 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); }
1080 ;
1081
1082 DefaultClause:
1083     DEFAULT ':'                         { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0); }
1084   | DEFAULT ':' SourceElements          { $$ = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, 0, $3.m_node), $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_featureInfo); }
1085 ;
1086
1087 LabelledStatement:
1088     IDENT ':' Statement                 { $3.m_node->pushLabel(*$1);
1089                                           LabelNode* node = new LabelNode(GLOBAL_DATA, *$1, $3.m_node);
1090                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1091                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_featureInfo); }
1092 ;
1093
1094 ThrowStatement:
1095     THROW Expr ';'                      { ThrowNode* node = new ThrowNode(GLOBAL_DATA, $2.m_node);
1096                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1097                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_featureInfo); DBG($$.m_node, @1, @2);
1098                                         }
1099   | THROW Expr error                    { ThrowNode* node = new ThrowNode(GLOBAL_DATA, $2.m_node);
1100                                           SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
1101                                           $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_featureInfo); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; 
1102                                         }
1103 ;
1104
1105 TryStatement:
1106     TRY Block FINALLY Block             { $$ = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->nullIdentifier, 0, $4.m_node),
1107                                                                                          mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations),
1108                                                                                          mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
1109                                                                                          $2.m_featureInfo | $4.m_featureInfo);
1110                                           DBG($$.m_node, @1, @2); }
1111   | TRY Block CATCH '(' IDENT ')' Block { $$ = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, $2.m_node, *$5, $7.m_node, 0),
1112                                                                                          mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations),
1113                                                                                          mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations),
1114                                                                                          $2.m_featureInfo | $7.m_featureInfo);
1115                                           DBG($$.m_node, @1, @2); }
1116   | TRY Block CATCH '(' IDENT ')' Block FINALLY Block
1117                                         { $$ = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, $2.m_node, *$5, $7.m_node, $9.m_node),
1118                                                                                          mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), $9.m_varDeclarations),
1119                                                                                          mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $9.m_funcDeclarations),
1120                                                                                          $2.m_featureInfo | $7.m_featureInfo | $9.m_featureInfo);
1121                                           DBG($$.m_node, @1, @2); }
1122 ;
1123
1124 DebuggerStatement:
1125     DEBUGGER ';'                        { $$ = createNodeDeclarationInfo<StatementNode*>(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0);
1126                                           DBG($$.m_node, @1, @2); }
1127   | DEBUGGER error                      { $$ = createNodeDeclarationInfo<StatementNode*>(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0);
1128                                           DBG($$.m_node, @1, @1); AUTO_SEMICOLON; }
1129 ;
1130
1131 FunctionDeclaration:
1132     FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = new FuncDeclNode(GLOBAL_DATA, *$2, $6, LEXER->sourceRange($5, $7)); DBG($6, @5, @7); }
1133   | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
1134                                         { $$ = new FuncDeclNode(GLOBAL_DATA, *$2, $7, LEXER->sourceRange($6, $8), $4.head); DBG($7, @6, @8); }
1135 ;
1136
1137 FunctionExpr:
1138     FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, LEXER->sourceRange($4, $6)), ClosureFeature); DBG($5, @4, @6); }
1139   | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, LEXER->sourceRange($5, $7), $3.head), ClosureFeature); DBG($6, @5, @7); }
1140   | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, *$2, $6, LEXER->sourceRange($5, $7)), ClosureFeature); DBG($6, @5, @7); }
1141   | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeFeatureInfo(new FuncExprNode(GLOBAL_DATA, *$2, $7, LEXER->sourceRange($6, $8), $4.head), ClosureFeature); DBG($7, @6, @8); }
1142 ;
1143
1144 FormalParameterList:
1145     IDENT                               { $$.head = new ParameterNode(GLOBAL_DATA, *$1);
1146                                           $$.tail = $$.head; }
1147   | FormalParameterList ',' IDENT       { $$.head = $1.head;
1148                                           $$.tail = new ParameterNode(GLOBAL_DATA, $1.tail, *$3); }
1149 ;
1150
1151 FunctionBody:
1152     /* not in spec */           { $$ = FunctionBodyNode::create(GLOBAL_DATA, 0, 0, 0, false, false); }
1153   | SourceElements              { $$ = FunctionBodyNode::create(GLOBAL_DATA, $1.m_node, $1.m_varDeclarations ? &$1.m_varDeclarations->data : 0, 
1154                                                                 $1.m_funcDeclarations ? &$1.m_funcDeclarations->data : 0,
1155                                                                 ($1.m_featureInfo & EvalFeature) != 0, ($1.m_featureInfo & ClosureFeature) != 0);
1156                                   // As in mergeDeclarationLists() we have to ref/deref to safely get rid of
1157                                   // the declaration lists.
1158                                   if ($1.m_varDeclarations) {
1159                                       $1.m_varDeclarations->ref();
1160                                       $1.m_varDeclarations->deref();
1161                                   }
1162                                   if ($1.m_funcDeclarations) {
1163                                       $1.m_funcDeclarations->ref();
1164                                       $1.m_funcDeclarations->deref();
1165                                   }
1166                                 }
1167 ;
1168
1169 Program:
1170     /* not in spec */                   { GLOBAL_DATA->parser->didFinishParsing(new SourceElements(GLOBAL_DATA), 0, 0, false, false, @0.last_line); }
1171     | SourceElements                    { GLOBAL_DATA->parser->didFinishParsing($1.m_node, $1.m_varDeclarations, $1.m_funcDeclarations, 
1172                                                                     ($1.m_featureInfo & EvalFeature) != 0, ($1.m_featureInfo & ClosureFeature) != 0,
1173                                                                     @1.last_line); }
1174 ;
1175
1176 SourceElements:
1177     SourceElement                       { $$.m_node = new SourceElements(GLOBAL_DATA);
1178                                           $$.m_node->append($1.m_node);
1179                                           $$.m_varDeclarations = $1.m_varDeclarations;
1180                                           $$.m_funcDeclarations = $1.m_funcDeclarations;
1181                                           $$.m_featureInfo = $1.m_featureInfo;
1182                                         }
1183   | SourceElements SourceElement        { $$.m_node->append($2.m_node);
1184                                           $$.m_varDeclarations = mergeDeclarationLists($1.m_varDeclarations, $2.m_varDeclarations);
1185                                           $$.m_funcDeclarations = mergeDeclarationLists($1.m_funcDeclarations, $2.m_funcDeclarations);
1186                                           $$.m_featureInfo = $1.m_featureInfo | $2.m_featureInfo;
1187                                         }
1188 ;
1189
1190 SourceElement:
1191     FunctionDeclaration                 { $$ = createNodeDeclarationInfo<StatementNode*>($1, 0, new ParserRefCountedData<DeclarationStacks::FunctionStack>(GLOBAL_DATA), ClosureFeature); $$.m_funcDeclarations->data.append($1); }
1192   | Statement                           { $$ = $1; }
1193 ;
1194  
1195 %%
1196
1197 static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
1198 {
1199     if (!loc->isLocation())
1200         return new AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot);
1201
1202     if (loc->isResolveNode()) {
1203         ResolveNode* resolve = static_cast<ResolveNode*>(loc);
1204         if (op == OpEqual) {
1205             AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, resolve->identifier(), expr, exprHasAssignments);
1206             SET_EXCEPTION_LOCATION(node, start, divot, end);
1207             return node;
1208         } else
1209             return new ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1210     }
1211     if (loc->isBracketAccessorNode()) {
1212         BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
1213         if (op == OpEqual)
1214             return new AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
1215         else {
1216             ReadModifyBracketNode* node = new ReadModifyBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
1217             node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1218             return node;
1219         }
1220     }
1221     ASSERT(loc->isDotAccessorNode());
1222     DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
1223     if (op == OpEqual)
1224         return new AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
1225
1226     ReadModifyDotNode* node = new ReadModifyDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
1227     node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1228     return node;
1229 }
1230
1231 static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
1232 {
1233     if (!expr->isLocation())
1234         return new PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
1235     
1236     if (expr->isResolveNode()) {
1237         ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1238         return new PrefixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
1239     }
1240     if (expr->isBracketAccessorNode()) {
1241         BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1242         PrefixBracketNode* node = new PrefixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1243         node->setSubexpressionInfo(bracket->divot(), bracket->startOffset());
1244         return node;
1245     }
1246     ASSERT(expr->isDotAccessorNode());
1247     DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1248     PrefixDotNode* node = new PrefixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1249     node->setSubexpressionInfo(dot->divot(), dot->startOffset());
1250     return node;
1251 }
1252
1253 static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end)
1254
1255     if (!expr->isLocation())
1256         return new PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot);
1257     
1258     if (expr->isResolveNode()) {
1259         ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1260         return new PostfixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot);
1261     }
1262     if (expr->isBracketAccessorNode()) {
1263         BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1264         PostfixBracketNode* node = new PostfixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
1265         node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1266         return node;
1267         
1268     }
1269     ASSERT(expr->isDotAccessorNode());
1270     DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1271     PostfixDotNode* node = new PostfixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
1272     node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1273     return node;
1274 }
1275
1276 static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end)
1277 {
1278     FeatureInfo features = func.m_featureInfo | args.m_featureInfo;
1279     if (!func.m_node->isLocation())
1280         return createNodeFeatureInfo<ExpressionNode*>(new FunctionCallValueNode(GLOBAL_DATA, func.m_node, args.m_node, divot, divot - start, end - divot), features);
1281     if (func.m_node->isResolveNode()) {
1282         ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node);
1283         const Identifier& identifier = resolve->identifier();
1284         if (identifier == GLOBAL_DATA->propertyNames->eval)
1285             return createNodeFeatureInfo<ExpressionNode*>(new EvalFunctionCallNode(GLOBAL_DATA, args.m_node, divot, divot - start, end - divot), EvalFeature | features);
1286         return createNodeFeatureInfo<ExpressionNode*>(new FunctionCallResolveNode(GLOBAL_DATA, identifier, args.m_node, divot, divot - start, end - divot), features);
1287     }
1288     if (func.m_node->isBracketAccessorNode()) {
1289         BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node);
1290         FunctionCallBracketNode* node = new FunctionCallBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot);
1291         node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
1292         return createNodeFeatureInfo<ExpressionNode*>(node, features);
1293     }
1294     ASSERT(func.m_node->isDotAccessorNode());
1295     DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node);
1296     FunctionCallDotNode* node = new FunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot);
1297     node->setSubexpressionInfo(dot->divot(), dot->endOffset());
1298     return createNodeFeatureInfo<ExpressionNode*>(node, features);
1299 }
1300
1301 static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr)
1302 {
1303     if (expr->isResolveNode()) {
1304         ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1305         return new TypeOfResolveNode(GLOBAL_DATA, resolve->identifier());
1306     }
1307     return new TypeOfValueNode(GLOBAL_DATA, expr);
1308 }
1309
1310 static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end)
1311 {
1312     if (!expr->isLocation())
1313         return new DeleteValueNode(GLOBAL_DATA, expr);
1314     if (expr->isResolveNode()) {
1315         ResolveNode* resolve = static_cast<ResolveNode*>(expr);
1316         return new DeleteResolveNode(GLOBAL_DATA, resolve->identifier(), divot, divot - start, end - divot);
1317     }
1318     if (expr->isBracketAccessorNode()) {
1319         BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
1320         return new DeleteBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
1321     }
1322     ASSERT(expr->isDotAccessorNode());
1323     DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
1324     return new DeleteDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), divot, divot - start, end - divot);
1325 }
1326
1327 static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceRange& source)
1328 {
1329     PropertyNode::Type type;
1330     if (getOrSet == "get")
1331         type = PropertyNode::Getter;
1332     else if (getOrSet == "set")
1333         type = PropertyNode::Setter;
1334     else
1335         return 0;
1336     return new PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type);
1337 }
1338
1339 static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n)
1340 {
1341     if (n->isNumber()) {
1342         NumberNode* number = static_cast<NumberNode*>(n);
1343
1344         if (number->value() > 0.0) {
1345             number->setValue(-number->value());
1346             return number;
1347         }
1348     }
1349
1350     return new NegateNode(GLOBAL_DATA, n);
1351 }
1352
1353 static NumberNode* makeNumberNode(void* globalPtr, double d)
1354 {
1355     JSValue* value = JSImmediate::from(d);
1356     if (value)
1357         return new ImmediateNumberNode(GLOBAL_DATA, value, d);
1358     return new NumberNode(GLOBAL_DATA, d);
1359 }
1360
1361 /* called by yyparse on error */
1362 int yyerror(const char *)
1363 {
1364     return 1;
1365 }
1366
1367 /* may we automatically insert a semicolon ? */
1368 static bool allowAutomaticSemicolon(Lexer& lexer, int yychar)
1369 {
1370     return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator();
1371 }
1372
1373 static ExpressionNode* combineVarInitializers(void* globalPtr, ExpressionNode* list, AssignResolveNode* init)
1374 {
1375     if (!list)
1376         return init;
1377     return new VarDeclCommaNode(GLOBAL_DATA, list, init);
1378 }
1379
1380 // We turn variable declarations into either assignments or empty
1381 // statements (which later get stripped out), because the actual
1382 // declaration work is hoisted up to the start of the function body
1383 static StatementNode* makeVarStatementNode(void* globalPtr, ExpressionNode* expr)
1384 {
1385     if (!expr)
1386         return new EmptyStatementNode(GLOBAL_DATA);
1387     return new VarStatementNode(GLOBAL_DATA, expr);
1388 }
1389
1390 #undef GLOBAL_DATA