PageRenderTime 51ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/opensource.apple.com/source/JavaScriptCore/JavaScriptCore-521/parser/Grammar.y

#
Happy | 983 lines | 864 code | 119 blank | 0 comment | 0 complexity | 456ff63a36eb8ed0bbc345130c99208b MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, GPL-2.0, BSD-3-Clause, GPL-3.0, MPL-2.0, LGPL-2.0, LGPL-2.1, CC-BY-SA-3.0, IPL-1.0, ISC, AGPL-1.0, AGPL-3.0, JSON, Apache-2.0, 0BSD

Large files files are truncated, but you can click here to view the full file

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <title>Grammar.y</title>
  6. <style type="text/css">
  7. .enscript-comment { font-style: italic; color: rgb(178,34,34); }
  8. .enscript-function-name { font-weight: bold; color: rgb(0,0,255); }
  9. .enscript-variable-name { font-weight: bold; color: rgb(184,134,11); }
  10. .enscript-keyword { font-weight: bold; color: rgb(160,32,240); }
  11. .enscript-reference { font-weight: bold; color: rgb(95,158,160); }
  12. .enscript-string { font-weight: bold; color: rgb(188,143,143); }
  13. .enscript-builtin { font-weight: bold; color: rgb(218,112,214); }
  14. .enscript-type { font-weight: bold; color: rgb(34,139,34); }
  15. .enscript-highlight { text-decoration: underline; color: 0; }
  16. </style>
  17. </head>
  18. <body id="top">
  19. <h1 style="margin:8px;" id="f1">Grammar.y&nbsp;&nbsp;&nbsp;<span style="font-weight: normal; font-size: 0.5em;">[<a href="?txt">plain text</a>]</span></h1>
  20. <hr/>
  21. <div></div>
  22. <pre>
  23. %pure_parser
  24. %{
  25. /*
  26. * Copyright (C) 1999-2000 Harri Porten (<a href="mailto:porten@kde.org">porten@kde.org</a>)
  27. * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
  28. * Copyright (C) 2007 Eric Seidel &lt;<a href="mailto:eric@webkit.org">eric@webkit.org</a>&gt;
  29. *
  30. * This library is free software; you can redistribute it and/or
  31. * modify it under the terms of the GNU Lesser General Public
  32. * License as published by the Free Software Foundation; either
  33. * version 2 of the License, or (at your option) any later version.
  34. *
  35. * This library is distributed in the hope that it will be useful,
  36. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  37. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  38. * Lesser General Public License for more details.
  39. *
  40. * You should have received a copy of the GNU Lesser General Public
  41. * License along with this library; if not, write to the Free Software
  42. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  43. *
  44. */
  45. #include &quot;config.h&quot;
  46. #include &lt;string.h&gt;
  47. #include &lt;stdlib.h&gt;
  48. #include &quot;JSValue.h&quot;
  49. #include &quot;JSObject.h&quot;
  50. #include &quot;Nodes.h&quot;
  51. #include &quot;Lexer.h&quot;
  52. #include &quot;JSString.h&quot;
  53. #include &quot;JSGlobalData.h&quot;
  54. #include &quot;CommonIdentifiers.h&quot;
  55. #include &quot;NodeInfo.h&quot;
  56. #include &quot;Parser.h&quot;
  57. #include &lt;wtf/MathExtras.h&gt;
  58. #define YYMAXDEPTH 10000
  59. #define YYENABLE_NLS 0
  60. /* default values for bison */
  61. #define YYDEBUG 0 // Set to 1 to debug a parse error.
  62. #define jscyydebug 0 // Set to 1 to debug a parse error.
  63. #if !PLATFORM(DARWIN)
  64. // avoid triggering warnings in older bison
  65. #define YYERROR_VERBOSE
  66. #endif
  67. int jscyylex(void* lvalp, void* llocp, void* globalPtr);
  68. int jscyyerror(const char*);
  69. static inline bool allowAutomaticSemicolon(JSC::Lexer&amp;, int);
  70. #define GLOBAL_DATA static_cast&lt;JSGlobalData*&gt;(globalPtr)
  71. #define LEXER (GLOBAL_DATA-&gt;lexer)
  72. #define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0)
  73. #define SET_EXCEPTION_LOCATION(node, start, divot, end) node-&gt;setExceptionSourceCode((divot), (divot) - (start), (end) - (divot))
  74. #define DBG(l, s, e) (l)-&gt;setLoc((s).first_line, (e).last_line)
  75. using namespace JSC;
  76. using namespace std;
  77. static ExpressionNode* makeAssignNode(void*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end);
  78. static ExpressionNode* makePrefixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
  79. static ExpressionNode* makePostfixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end);
  80. static PropertyNode* makeGetterOrSetterPropertyNode(void*, const Identifier &amp;getOrSet, const Identifier&amp; name, ParameterNode*, FunctionBodyNode*, const SourceCode&amp;);
  81. static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end);
  82. static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*);
  83. static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end);
  84. static ExpressionNode* makeNegateNode(void*, ExpressionNode*);
  85. static NumberNode* makeNumberNode(void*, double);
  86. static ExpressionNode* makeBitwiseNotNode(void*, ExpressionNode*);
  87. static ExpressionNode* makeMultNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
  88. static ExpressionNode* makeDivNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
  89. static ExpressionNode* makeAddNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
  90. static ExpressionNode* makeSubNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
  91. static ExpressionNode* makeLeftShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
  92. static ExpressionNode* makeRightShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments);
  93. static StatementNode* makeVarStatementNode(void*, ExpressionNode*);
  94. static ExpressionNode* combineVarInitializers(void*, ExpressionNode* list, AssignResolveNode* init);
  95. #if COMPILER(MSVC)
  96. #pragma warning(disable: 4065)
  97. #pragma warning(disable: 4244)
  98. #pragma warning(disable: 4702)
  99. // At least some of the time, the declarations of malloc and free that bison
  100. // generates are causing warnings. A way to avoid this is to explicitly define
  101. // the macros so that bison doesn't try to declare malloc and free.
  102. #define YYMALLOC malloc
  103. #define YYFREE free
  104. #endif
  105. #define YYPARSE_PARAM globalPtr
  106. #define YYLEX_PARAM globalPtr
  107. template &lt;typename T&gt; NodeDeclarationInfo&lt;T&gt; createNodeDeclarationInfo(T node, ParserRefCountedData&lt;DeclarationStacks::VarStack&gt;* varDecls,
  108. ParserRefCountedData&lt;DeclarationStacks::FunctionStack&gt;* funcDecls,
  109. CodeFeatures info,
  110. int numConstants)
  111. {
  112. ASSERT((info &amp; ~AllFeatures) == 0);
  113. NodeDeclarationInfo&lt;T&gt; result = {node, varDecls, funcDecls, info, numConstants};
  114. return result;
  115. }
  116. template &lt;typename T&gt; NodeInfo&lt;T&gt; createNodeInfo(T node, CodeFeatures info, int numConstants)
  117. {
  118. ASSERT((info &amp; ~AllFeatures) == 0);
  119. NodeInfo&lt;T&gt; result = {node, info, numConstants};
  120. return result;
  121. }
  122. template &lt;typename T&gt; T mergeDeclarationLists(T decls1, T decls2)
  123. {
  124. // decls1 or both are null
  125. if (!decls1)
  126. return decls2;
  127. // only decls1 is non-null
  128. if (!decls2)
  129. return decls1;
  130. // Both are non-null
  131. decls1-&gt;data.append(decls2-&gt;data);
  132. // We manually release the declaration lists to avoid accumulating many many
  133. // unused heap allocated vectors
  134. decls2-&gt;ref();
  135. decls2-&gt;deref();
  136. return decls1;
  137. }
  138. static void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData&lt;DeclarationStacks::VarStack&gt;*&amp; varDecls, const Identifier&amp; ident, unsigned attrs)
  139. {
  140. if (!varDecls)
  141. varDecls = new ParserRefCountedData&lt;DeclarationStacks::VarStack&gt;(GLOBAL_DATA);
  142. varDecls-&gt;data.append(make_pair(ident, attrs));
  143. }
  144. static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData&lt;DeclarationStacks::VarStack&gt;*&amp; varDecls, ConstDeclNode* decl)
  145. {
  146. unsigned attrs = DeclarationStacks::IsConstant;
  147. if (decl-&gt;m_init)
  148. attrs |= DeclarationStacks::HasInitializer;
  149. appendToVarDeclarationList(globalPtr, varDecls, decl-&gt;m_ident, attrs);
  150. }
  151. %}
  152. %union {
  153. int intValue;
  154. double doubleValue;
  155. Identifier* ident;
  156. // expression subtrees
  157. ExpressionNodeInfo expressionNode;
  158. FuncDeclNodeInfo funcDeclNode;
  159. PropertyNodeInfo propertyNode;
  160. ArgumentsNodeInfo argumentsNode;
  161. ConstDeclNodeInfo constDeclNode;
  162. CaseBlockNodeInfo caseBlockNode;
  163. CaseClauseNodeInfo caseClauseNode;
  164. FuncExprNodeInfo funcExprNode;
  165. // statement nodes
  166. StatementNodeInfo statementNode;
  167. FunctionBodyNode* functionBodyNode;
  168. ProgramNode* programNode;
  169. SourceElementsInfo sourceElements;
  170. PropertyListInfo propertyList;
  171. ArgumentListInfo argumentList;
  172. VarDeclListInfo varDeclList;
  173. ConstDeclListInfo constDeclList;
  174. ClauseListInfo clauseList;
  175. ElementListInfo elementList;
  176. ParameterListInfo parameterList;
  177. Operator op;
  178. }
  179. %start Program
  180. /* literals */
  181. %token NULLTOKEN TRUETOKEN FALSETOKEN
  182. /* keywords */
  183. %token BREAK CASE DEFAULT FOR NEW VAR CONSTTOKEN CONTINUE
  184. %token FUNCTION RETURN VOIDTOKEN DELETETOKEN
  185. %token IF THISTOKEN DO WHILE INTOKEN INSTANCEOF TYPEOF
  186. %token SWITCH WITH RESERVED
  187. %token THROW TRY CATCH FINALLY
  188. %token DEBUGGER
  189. /* give an if without an else higher precedence than an else to resolve the ambiguity */
  190. %nonassoc IF_WITHOUT_ELSE
  191. %nonassoc ELSE
  192. /* punctuators */
  193. %token EQEQ NE /* == and != */
  194. %token STREQ STRNEQ /* === and !== */
  195. %token LE GE /* &lt; and &gt; */
  196. %token OR AND /* || and &amp;&amp; */
  197. %token PLUSPLUS MINUSMINUS /* ++ and -- */
  198. %token LSHIFT /* &lt;&lt; */
  199. %token RSHIFT URSHIFT /* &gt;&gt; and &gt;&gt;&gt; */
  200. %token PLUSEQUAL MINUSEQUAL /* += and -= */
  201. %token MULTEQUAL DIVEQUAL /* *= and /= */
  202. %token LSHIFTEQUAL /* &lt;&lt;= */
  203. %token RSHIFTEQUAL URSHIFTEQUAL /* &gt;&gt;= and &gt;&gt;&gt;= */
  204. %token ANDEQUAL MODEQUAL /* &amp;= and %= */
  205. %token XOREQUAL OREQUAL /* ^= and |= */
  206. %token &lt;intValue&gt; OPENBRACE /* { (with char offset) */
  207. %token &lt;intValue&gt; CLOSEBRACE /* { (with char offset) */
  208. /* terminal types */
  209. %token &lt;doubleValue&gt; NUMBER
  210. %token &lt;ident&gt; IDENT STRING
  211. /* automatically inserted semicolon */
  212. %token AUTOPLUSPLUS AUTOMINUSMINUS
  213. /* non-terminal types */
  214. %type &lt;expressionNode&gt; Literal ArrayLiteral
  215. %type &lt;expressionNode&gt; PrimaryExpr PrimaryExprNoBrace
  216. %type &lt;expressionNode&gt; MemberExpr MemberExprNoBF /* BF =&gt; brace or function */
  217. %type &lt;expressionNode&gt; NewExpr NewExprNoBF
  218. %type &lt;expressionNode&gt; CallExpr CallExprNoBF
  219. %type &lt;expressionNode&gt; LeftHandSideExpr LeftHandSideExprNoBF
  220. %type &lt;expressionNode&gt; PostfixExpr PostfixExprNoBF
  221. %type &lt;expressionNode&gt; UnaryExpr UnaryExprNoBF UnaryExprCommon
  222. %type &lt;expressionNode&gt; MultiplicativeExpr MultiplicativeExprNoBF
  223. %type &lt;expressionNode&gt; AdditiveExpr AdditiveExprNoBF
  224. %type &lt;expressionNode&gt; ShiftExpr ShiftExprNoBF
  225. %type &lt;expressionNode&gt; RelationalExpr RelationalExprNoIn RelationalExprNoBF
  226. %type &lt;expressionNode&gt; EqualityExpr EqualityExprNoIn EqualityExprNoBF
  227. %type &lt;expressionNode&gt; BitwiseANDExpr BitwiseANDExprNoIn BitwiseANDExprNoBF
  228. %type &lt;expressionNode&gt; BitwiseXORExpr BitwiseXORExprNoIn BitwiseXORExprNoBF
  229. %type &lt;expressionNode&gt; BitwiseORExpr BitwiseORExprNoIn BitwiseORExprNoBF
  230. %type &lt;expressionNode&gt; LogicalANDExpr LogicalANDExprNoIn LogicalANDExprNoBF
  231. %type &lt;expressionNode&gt; LogicalORExpr LogicalORExprNoIn LogicalORExprNoBF
  232. %type &lt;expressionNode&gt; ConditionalExpr ConditionalExprNoIn ConditionalExprNoBF
  233. %type &lt;expressionNode&gt; AssignmentExpr AssignmentExprNoIn AssignmentExprNoBF
  234. %type &lt;expressionNode&gt; Expr ExprNoIn ExprNoBF
  235. %type &lt;expressionNode&gt; ExprOpt ExprNoInOpt
  236. %type &lt;statementNode&gt; Statement Block
  237. %type &lt;statementNode&gt; VariableStatement ConstStatement EmptyStatement ExprStatement
  238. %type &lt;statementNode&gt; IfStatement IterationStatement ContinueStatement
  239. %type &lt;statementNode&gt; BreakStatement ReturnStatement WithStatement
  240. %type &lt;statementNode&gt; SwitchStatement LabelledStatement
  241. %type &lt;statementNode&gt; ThrowStatement TryStatement
  242. %type &lt;statementNode&gt; DebuggerStatement
  243. %type &lt;expressionNode&gt; Initializer InitializerNoIn
  244. %type &lt;statementNode&gt; FunctionDeclaration
  245. %type &lt;funcExprNode&gt; FunctionExpr
  246. %type &lt;functionBodyNode&gt; FunctionBody
  247. %type &lt;sourceElements&gt; SourceElements
  248. %type &lt;parameterList&gt; FormalParameterList
  249. %type &lt;op&gt; AssignmentOperator
  250. %type &lt;argumentsNode&gt; Arguments
  251. %type &lt;argumentList&gt; ArgumentList
  252. %type &lt;varDeclList&gt; VariableDeclarationList VariableDeclarationListNoIn
  253. %type &lt;constDeclList&gt; ConstDeclarationList
  254. %type &lt;constDeclNode&gt; ConstDeclaration
  255. %type &lt;caseBlockNode&gt; CaseBlock
  256. %type &lt;caseClauseNode&gt; CaseClause DefaultClause
  257. %type &lt;clauseList&gt; CaseClauses CaseClausesOpt
  258. %type &lt;intValue&gt; Elision ElisionOpt
  259. %type &lt;elementList&gt; ElementList
  260. %type &lt;propertyNode&gt; Property
  261. %type &lt;propertyList&gt; PropertyList
  262. %%
  263. // FIXME: There are currently two versions of the grammar in this file, the normal one, and the NoNodes version used for
  264. // lazy recompilation of FunctionBodyNodes. We should move to generating the two versions from a script to avoid bugs.
  265. // In the mean time, make sure to make any changes to the grammar in both versions.
  266. Literal:
  267. NULLTOKEN { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new NullNode(GLOBAL_DATA), 0, 1); }
  268. | TRUETOKEN { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BooleanNode(GLOBAL_DATA, true), 0, 1); }
  269. | FALSETOKEN { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BooleanNode(GLOBAL_DATA, false), 0, 1); }
  270. | NUMBER { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeNumberNode(GLOBAL_DATA, $1), 0, 1); }
  271. | STRING { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new StringNode(GLOBAL_DATA, *$1), 0, 1); }
  272. | '/' /* regexp */ {
  273. Lexer&amp; l = *LEXER;
  274. if (!l.scanRegExp())
  275. YYABORT;
  276. RegExpNode* node = new RegExpNode(GLOBAL_DATA, l.pattern(), l.flags());
  277. int size = l.pattern().size() + 2; // + 2 for the two /'s
  278. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
  279. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, 0, 0);
  280. }
  281. | DIVEQUAL /* regexp with /= */ {
  282. Lexer&amp; l = *LEXER;
  283. if (!l.scanRegExp())
  284. YYABORT;
  285. RegExpNode* node = new RegExpNode(GLOBAL_DATA, &quot;=&quot; + l.pattern(), l.flags());
  286. int size = l.pattern().size() + 2; // + 2 for the two /'s
  287. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
  288. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, 0, 0);
  289. }
  290. ;
  291. Property:
  292. IDENT ':' AssignmentExpr { $$ = createNodeInfo&lt;PropertyNode*&gt;(new PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
  293. | STRING ':' AssignmentExpr { $$ = createNodeInfo&lt;PropertyNode*&gt;(new PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
  294. | NUMBER ':' AssignmentExpr { $$ = createNodeInfo&lt;PropertyNode*&gt;(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); }
  295. | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo&lt;PropertyNode*&gt;(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, 0, $6, LEXER-&gt;sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); if (!$$.m_node) YYABORT; }
  296. | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
  297. {
  298. $$ = createNodeInfo&lt;PropertyNode*&gt;(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.m_node.head, $7, LEXER-&gt;sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0);
  299. if ($4.m_features &amp; ArgumentsFeature)
  300. $7-&gt;setUsesArguments();
  301. DBG($7, @6, @8);
  302. if (!$$.m_node)
  303. YYABORT;
  304. }
  305. ;
  306. PropertyList:
  307. Property { $$.m_node.head = new PropertyListNode(GLOBAL_DATA, $1.m_node);
  308. $$.m_node.tail = $$.m_node.head;
  309. $$.m_features = $1.m_features;
  310. $$.m_numConstants = $1.m_numConstants; }
  311. | PropertyList ',' Property { $$.m_node.head = $1.m_node.head;
  312. $$.m_node.tail = new PropertyListNode(GLOBAL_DATA, $3.m_node, $1.m_node.tail);
  313. $$.m_features = $1.m_features | $3.m_features;
  314. $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
  315. ;
  316. PrimaryExpr:
  317. PrimaryExprNoBrace
  318. | OPENBRACE CLOSEBRACE { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ObjectLiteralNode(GLOBAL_DATA), 0, 0); }
  319. | OPENBRACE PropertyList CLOSEBRACE { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
  320. /* allow extra comma, see <a href="http://bugs.webkit.org/show_bug.cgi?id=5939">http://bugs.webkit.org/show_bug.cgi?id=5939</a> */
  321. | OPENBRACE PropertyList ',' CLOSEBRACE { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ObjectLiteralNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
  322. ;
  323. PrimaryExprNoBrace:
  324. THISTOKEN { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ThisNode(GLOBAL_DATA), ThisFeature, 0); }
  325. | Literal
  326. | ArrayLiteral
  327. | IDENT { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ResolveNode(GLOBAL_DATA, *$1, @1.first_column), (*$1 == GLOBAL_DATA-&gt;propertyNames-&gt;arguments) ? ArgumentsFeature : 0, 0); }
  328. | '(' Expr ')' { $$ = $2; }
  329. ;
  330. ArrayLiteral:
  331. '[' ElisionOpt ']' { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ArrayNode(GLOBAL_DATA, $2), 0, $2 ? 1 : 0); }
  332. | '[' ElementList ']' { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ArrayNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
  333. | '[' ElementList ',' ElisionOpt ']' { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ArrayNode(GLOBAL_DATA, $4, $2.m_node.head), $2.m_features, $4 ? $2.m_numConstants + 1 : $2.m_numConstants); }
  334. ;
  335. ElementList:
  336. ElisionOpt AssignmentExpr { $$.m_node.head = new ElementNode(GLOBAL_DATA, $1, $2.m_node);
  337. $$.m_node.tail = $$.m_node.head;
  338. $$.m_features = $2.m_features;
  339. $$.m_numConstants = $2.m_numConstants; }
  340. | ElementList ',' ElisionOpt AssignmentExpr
  341. { $$.m_node.head = $1.m_node.head;
  342. $$.m_node.tail = new ElementNode(GLOBAL_DATA, $1.m_node.tail, $3, $4.m_node);
  343. $$.m_features = $1.m_features | $4.m_features;
  344. $$.m_numConstants = $1.m_numConstants + $4.m_numConstants; }
  345. ;
  346. ElisionOpt:
  347. /* nothing */ { $$ = 0; }
  348. | Elision
  349. ;
  350. Elision:
  351. ',' { $$ = 1; }
  352. | Elision ',' { $$ = $1 + 1; }
  353. ;
  354. MemberExpr:
  355. PrimaryExpr
  356. | FunctionExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;($1.m_node, $1.m_features, $1.m_numConstants); }
  357. | MemberExpr '[' Expr ']' { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  358. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
  359. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
  360. }
  361. | MemberExpr '.' IDENT { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
  362. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
  363. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features, $1.m_numConstants);
  364. }
  365. | NEW MemberExpr Arguments { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
  366. SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
  367. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
  368. }
  369. ;
  370. MemberExprNoBF:
  371. PrimaryExprNoBrace
  372. | MemberExprNoBF '[' Expr ']' { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  373. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
  374. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
  375. }
  376. | MemberExprNoBF '.' IDENT { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
  377. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
  378. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features, $1.m_numConstants);
  379. }
  380. | NEW MemberExpr Arguments { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node);
  381. SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column);
  382. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants);
  383. }
  384. ;
  385. NewExpr:
  386. MemberExpr
  387. | NEW NewExpr { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node);
  388. SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
  389. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $2.m_features, $2.m_numConstants);
  390. }
  391. ;
  392. NewExprNoBF:
  393. MemberExprNoBF
  394. | NEW NewExpr { NewExprNode* node = new NewExprNode(GLOBAL_DATA, $2.m_node);
  395. SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column);
  396. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $2.m_features, $2.m_numConstants);
  397. }
  398. ;
  399. CallExpr:
  400. MemberExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
  401. | CallExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
  402. | CallExpr '[' Expr ']' { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  403. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
  404. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
  405. }
  406. | CallExpr '.' IDENT { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
  407. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
  408. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features, $1.m_numConstants); }
  409. ;
  410. CallExprNoBF:
  411. MemberExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
  412. | CallExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); }
  413. | CallExprNoBF '[' Expr ']' { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  414. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column);
  415. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants);
  416. }
  417. | CallExprNoBF '.' IDENT { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3);
  418. SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column);
  419. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features, $1.m_numConstants);
  420. }
  421. ;
  422. Arguments:
  423. '(' ')' { $$ = createNodeInfo&lt;ArgumentsNode*&gt;(new ArgumentsNode(GLOBAL_DATA), 0, 0); }
  424. | '(' ArgumentList ')' { $$ = createNodeInfo&lt;ArgumentsNode*&gt;(new ArgumentsNode(GLOBAL_DATA, $2.m_node.head), $2.m_features, $2.m_numConstants); }
  425. ;
  426. ArgumentList:
  427. AssignmentExpr { $$.m_node.head = new ArgumentListNode(GLOBAL_DATA, $1.m_node);
  428. $$.m_node.tail = $$.m_node.head;
  429. $$.m_features = $1.m_features;
  430. $$.m_numConstants = $1.m_numConstants; }
  431. | ArgumentList ',' AssignmentExpr { $$.m_node.head = $1.m_node.head;
  432. $$.m_node.tail = new ArgumentListNode(GLOBAL_DATA, $1.m_node.tail, $3.m_node);
  433. $$.m_features = $1.m_features | $3.m_features;
  434. $$.m_numConstants = $1.m_numConstants + $3.m_numConstants; }
  435. ;
  436. LeftHandSideExpr:
  437. NewExpr
  438. | CallExpr
  439. ;
  440. LeftHandSideExprNoBF:
  441. NewExprNoBF
  442. | CallExprNoBF
  443. ;
  444. PostfixExpr:
  445. LeftHandSideExpr
  446. | LeftHandSideExpr PLUSPLUS { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
  447. | LeftHandSideExpr MINUSMINUS { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
  448. ;
  449. PostfixExprNoBF:
  450. LeftHandSideExprNoBF
  451. | LeftHandSideExprNoBF PLUSPLUS { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makePostfixNode(GLOBAL_DATA, $1.m_node, OpPlusPlus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
  452. | LeftHandSideExprNoBF MINUSMINUS { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makePostfixNode(GLOBAL_DATA, $1.m_node, OpMinusMinus, @1.first_column, @1.last_column, @2.last_column), $1.m_features | AssignFeature, $1.m_numConstants); }
  453. ;
  454. UnaryExprCommon:
  455. DELETETOKEN UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeDeleteNode(GLOBAL_DATA, $2.m_node, @1.first_column, @2.last_column, @2.last_column), $2.m_features, $2.m_numConstants); }
  456. | VOIDTOKEN UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new VoidNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants + 1); }
  457. | TYPEOF UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeTypeOfNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
  458. | PLUSPLUS UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
  459. | AUTOPLUSPLUS UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makePrefixNode(GLOBAL_DATA, $2.m_node, OpPlusPlus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
  460. | MINUSMINUS UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
  461. | AUTOMINUSMINUS UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makePrefixNode(GLOBAL_DATA, $2.m_node, OpMinusMinus, @1.first_column, @2.first_column + 1, @2.last_column), $2.m_features | AssignFeature, $2.m_numConstants); }
  462. | '+' UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new UnaryPlusNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
  463. | '-' UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeNegateNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
  464. | '~' UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeBitwiseNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
  465. | '!' UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LogicalNotNode(GLOBAL_DATA, $2.m_node), $2.m_features, $2.m_numConstants); }
  466. UnaryExpr:
  467. PostfixExpr
  468. | UnaryExprCommon
  469. ;
  470. UnaryExprNoBF:
  471. PostfixExprNoBF
  472. | UnaryExprCommon
  473. ;
  474. MultiplicativeExpr:
  475. UnaryExpr
  476. | MultiplicativeExpr '*' UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  477. | MultiplicativeExpr '/' UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  478. | MultiplicativeExpr '%' UnaryExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  479. ;
  480. MultiplicativeExprNoBF:
  481. UnaryExprNoBF
  482. | MultiplicativeExprNoBF '*' UnaryExpr
  483. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeMultNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  484. | MultiplicativeExprNoBF '/' UnaryExpr
  485. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeDivNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  486. | MultiplicativeExprNoBF '%' UnaryExpr
  487. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ModNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  488. ;
  489. AdditiveExpr:
  490. MultiplicativeExpr
  491. | AdditiveExpr '+' MultiplicativeExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  492. | AdditiveExpr '-' MultiplicativeExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  493. ;
  494. AdditiveExprNoBF:
  495. MultiplicativeExprNoBF
  496. | AdditiveExprNoBF '+' MultiplicativeExpr
  497. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeAddNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  498. | AdditiveExprNoBF '-' MultiplicativeExpr
  499. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeSubNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  500. ;
  501. ShiftExpr:
  502. AdditiveExpr
  503. | ShiftExpr LSHIFT AdditiveExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  504. | ShiftExpr RSHIFT AdditiveExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  505. | ShiftExpr URSHIFT AdditiveExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  506. ;
  507. ShiftExprNoBF:
  508. AdditiveExprNoBF
  509. | ShiftExprNoBF LSHIFT AdditiveExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeLeftShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  510. | ShiftExprNoBF RSHIFT AdditiveExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(makeRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  511. | ShiftExprNoBF URSHIFT AdditiveExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new UnsignedRightShiftNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  512. ;
  513. RelationalExpr:
  514. ShiftExpr
  515. | RelationalExpr '&lt;' ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  516. | RelationalExpr '&gt;' ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  517. | RelationalExpr LE ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  518. | RelationalExpr GE ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  519. | RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  520. SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
  521. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  522. | RelationalExpr INTOKEN ShiftExpr { InNode* node = new InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  523. SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
  524. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  525. ;
  526. RelationalExprNoIn:
  527. ShiftExpr
  528. | RelationalExprNoIn '&lt;' ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  529. | RelationalExprNoIn '&gt;' ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  530. | RelationalExprNoIn LE ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  531. | RelationalExprNoIn GE ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  532. | RelationalExprNoIn INSTANCEOF ShiftExpr
  533. { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  534. SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
  535. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  536. ;
  537. RelationalExprNoBF:
  538. ShiftExprNoBF
  539. | RelationalExprNoBF '&lt;' ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LessNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  540. | RelationalExprNoBF '&gt;' ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new GreaterNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  541. | RelationalExprNoBF LE ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  542. | RelationalExprNoBF GE ShiftExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  543. | RelationalExprNoBF INSTANCEOF ShiftExpr
  544. { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  545. SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
  546. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  547. | RelationalExprNoBF INTOKEN ShiftExpr
  548. { InNode* node = new InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature);
  549. SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column);
  550. $$ = createNodeInfo&lt;ExpressionNode*&gt;(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  551. ;
  552. EqualityExpr:
  553. RelationalExpr
  554. | EqualityExpr EQEQ RelationalExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  555. | EqualityExpr NE RelationalExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  556. | EqualityExpr STREQ RelationalExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  557. | EqualityExpr STRNEQ RelationalExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  558. ;
  559. EqualityExprNoIn:
  560. RelationalExprNoIn
  561. | EqualityExprNoIn EQEQ RelationalExprNoIn
  562. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  563. | EqualityExprNoIn NE RelationalExprNoIn
  564. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  565. | EqualityExprNoIn STREQ RelationalExprNoIn
  566. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  567. | EqualityExprNoIn STRNEQ RelationalExprNoIn
  568. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  569. ;
  570. EqualityExprNoBF:
  571. RelationalExprNoBF
  572. | EqualityExprNoBF EQEQ RelationalExpr
  573. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new EqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  574. | EqualityExprNoBF NE RelationalExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new NotEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  575. | EqualityExprNoBF STREQ RelationalExpr
  576. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new StrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  577. | EqualityExprNoBF STRNEQ RelationalExpr
  578. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new NotStrictEqualNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  579. ;
  580. BitwiseANDExpr:
  581. EqualityExpr
  582. | BitwiseANDExpr '&amp;' EqualityExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  583. ;
  584. BitwiseANDExprNoIn:
  585. EqualityExprNoIn
  586. | BitwiseANDExprNoIn '&amp;' EqualityExprNoIn
  587. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  588. ;
  589. BitwiseANDExprNoBF:
  590. EqualityExprNoBF
  591. | BitwiseANDExprNoBF '&amp;' EqualityExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitAndNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  592. ;
  593. BitwiseXORExpr:
  594. BitwiseANDExpr
  595. | BitwiseXORExpr '^' BitwiseANDExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  596. ;
  597. BitwiseXORExprNoIn:
  598. BitwiseANDExprNoIn
  599. | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn
  600. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  601. ;
  602. BitwiseXORExprNoBF:
  603. BitwiseANDExprNoBF
  604. | BitwiseXORExprNoBF '^' BitwiseANDExpr
  605. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitXOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  606. ;
  607. BitwiseORExpr:
  608. BitwiseXORExpr
  609. | BitwiseORExpr '|' BitwiseXORExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  610. ;
  611. BitwiseORExprNoIn:
  612. BitwiseXORExprNoIn
  613. | BitwiseORExprNoIn '|' BitwiseXORExprNoIn
  614. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  615. ;
  616. BitwiseORExprNoBF:
  617. BitwiseXORExprNoBF
  618. | BitwiseORExprNoBF '|' BitwiseXORExpr
  619. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new BitOrNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features &amp; AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  620. ;
  621. LogicalANDExpr:
  622. BitwiseORExpr
  623. | LogicalANDExpr AND BitwiseORExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  624. ;
  625. LogicalANDExprNoIn:
  626. BitwiseORExprNoIn
  627. | LogicalANDExprNoIn AND BitwiseORExprNoIn
  628. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  629. ;
  630. LogicalANDExprNoBF:
  631. BitwiseORExprNoBF
  632. | LogicalANDExprNoBF AND BitwiseORExpr
  633. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalAnd), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  634. ;
  635. LogicalORExpr:
  636. LogicalANDExpr
  637. | LogicalORExpr OR LogicalANDExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  638. ;
  639. LogicalORExprNoIn:
  640. LogicalANDExprNoIn
  641. | LogicalORExprNoIn OR LogicalANDExprNoIn
  642. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  643. ;
  644. LogicalORExprNoBF:
  645. LogicalANDExprNoBF
  646. | LogicalORExprNoBF OR LogicalANDExpr { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new LogicalOpNode(GLOBAL_DATA, $1.m_node, $3.m_node, OpLogicalOr), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); }
  647. ;
  648. ConditionalExpr:
  649. LogicalORExpr
  650. | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr
  651. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
  652. ;
  653. ConditionalExprNoIn:
  654. LogicalORExprNoIn
  655. | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn
  656. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.m_node), $1.m_features | $3.m_features | $5.m_features, $1.m_numConstants + $3.m_numConstants + $5.m_numConstants); }
  657. ;
  658. ConditionalExprNoBF:
  659. LogicalORExprNoBF
  660. | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr
  661. { $$ = createNodeInfo&lt;ExpressionNode*&gt;(new ConditionalNode(GLOBAL_DATA, $1.m_node, $3.m_node, $5.

Large files files are truncated, but you can click here to view the full file