2 #include "Cycript.tab.hh"
3 #define scanner driver.scanner_
4 #define YYSTACKEXPANDABLE 1
14 CYArgument *argument_;
18 CYCompound *compound_;
19 CYDeclaration *declaration_;
20 CYDeclarations *declarations_;
22 CYExpression *expression_;
24 CYForInitialiser *for_;
25 CYForInInitialiser *forin_;
26 CYIdentifier *identifier_;
31 CYParameter *parameter_;
32 CYProperty *property_;
33 CYSelectorPart *selector_;
35 CYStatement *statement_;
46 int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner);
55 @$.begin.filename = @$.end.filename = &driver.filename_;
63 %parse-param { CYDriver &driver }
64 %lex-param { void *scanner }
67 %token AmpersandAmpersand "&&"
68 %token AmpersandEqual "&="
70 %token CarrotEqual "^="
72 %token EqualEqual "=="
73 %token EqualEqualEqual "==="
74 %token Exclamation "!"
75 %token ExclamationEqual "!="
76 %token ExclamationEqualEqual "!=="
78 %token HyphenEqual "-="
79 %token HyphenHyphen "--"
80 %token HyphenHyphen_ "\n--"
81 %token HyphenRight "->"
85 %token LeftLeftEqual "<<="
87 %token PercentEqual "%="
95 %token PlusPlus_ "\n++"
97 %token RightEqual ">="
98 %token RightRight ">>"
99 %token RightRightEqual ">>="
100 %token RightRightRight ">>>"
101 %token RightRightRightEqual ">>>="
103 %token SlashEqual "/="
105 %token StarEqual "*="
115 %token CloseParen ")"
118 %token CloseBrace "}"
120 %token OpenBracket "["
121 %token CloseBracket "]"
123 %token AtSelector "@selector"
124 %token AtImplementation "@implementation"
127 %token <word_> Break "break"
128 %token <word_> Case "case"
129 %token <word_> Catch "catch"
130 %token <word_> Continue "continue"
131 %token <word_> Default "default"
132 %token <word_> Delete "delete"
133 %token <word_> Do "do"
134 %token <word_> Else "else"
135 %token <false_> False "false"
136 %token <word_> Finally "finally"
137 %token <word_> For "for"
138 %token <word_> Function "function"
139 %token <word_> If "if"
140 %token <word_> In "in"
141 %token <word_> InstanceOf "instanceof"
142 %token <word_> New "new"
143 %token <null_> Null "null"
144 %token <word_> Return "return"
145 %token <word_> Switch "switch"
146 %token <this_> This "this"
147 %token <word_> Throw "throw"
148 %token <true_> True "true"
149 %token <word_> Try "try"
150 %token <word_> TypeOf "typeof"
151 %token <word_> Var "var"
152 %token <word_> Void "void"
153 %token <word_> While "while"
154 %token <word_> With "with"
156 %token <word_> Abstract "abstract"
157 %token <word_> Boolean "boolean"
158 %token <word_> Byte "byte"
159 %token <word_> Char "char"
160 %token <word_> Class "class"
161 %token <word_> Const "const"
162 %token <word_> Debugger "debugger"
163 %token <word_> Double "double"
164 %token <word_> Enum "enum"
165 %token <word_> Export "export"
166 %token <word_> Extends "extends"
167 %token <word_> Final "final"
168 %token <word_> Float "float"
169 %token <word_> Goto "goto"
170 %token <word_> Implements "implements"
171 %token <word_> Import "import"
172 %token <word_> Int "int"
173 %token <word_> Interface "interface"
174 %token <word_> Long "long"
175 %token <word_> Native "native"
176 %token <word_> Package "package"
177 %token <word_> Private "private"
178 %token <word_> Protected "protected"
179 %token <word_> Public "public"
180 %token <word_> Short "short"
181 %token <word_> Static "static"
182 %token <word_> Super "super"
183 %token <word_> Synchronized "synchronized"
184 %token <word_> Throws "throws"
185 %token <word_> Transient "transient"
186 %token <word_> Volatile "volatile"
188 %token <identifier_> Identifier
189 %token <number_> NumericLiteral
190 %token <string_> StringLiteral
192 %type <expression_> AdditiveExpression
193 %type <expression_> AdditiveExpressionNoBF
194 %type <argument_> ArgumentList
195 %type <argument_> ArgumentList_
196 %type <argument_> ArgumentListOpt
197 %type <argument_> Arguments
198 %type <literal_> ArrayLiteral
199 %type <expression_> AssignmentExpression
200 %type <expression_> AssignmentExpressionNoBF
201 %type <expression_> AssignmentExpressionNoIn
202 %type <expression_> BitwiseANDExpression
203 %type <expression_> BitwiseANDExpressionNoBF
204 %type <expression_> BitwiseANDExpressionNoIn
205 %type <statement_> Block
206 %type <boolean_> BooleanLiteral
207 %type <expression_> BitwiseORExpression
208 %type <expression_> BitwiseORExpressionNoBF
209 %type <expression_> BitwiseORExpressionNoIn
210 %type <expression_> BitwiseXORExpression
211 %type <expression_> BitwiseXORExpressionNoBF
212 %type <expression_> BitwiseXORExpressionNoIn
213 %type <statement_> BreakStatement
214 %type <expression_> CallExpression
215 %type <expression_> CallExpressionNoBF
216 %type <clause_> CaseBlock
217 %type <clause_> CaseClause
218 %type <clause_> CaseClausesOpt
219 %type <catch_> CatchOpt
220 %type <expression_> ConditionalExpression
221 %type <expression_> ConditionalExpressionNoBF
222 %type <expression_> ConditionalExpressionNoIn
223 %type <statement_> ContinueStatement
224 %type <clause_> DefaultClause
225 %type <statement_> DoWhileStatement
226 %type <expression_> Element
227 %type <expression_> ElementOpt
228 %type <element_> ElementList
229 %type <element_> ElementListOpt
230 %type <statement_> ElseStatementOpt
231 %type <statement_> EmptyStatement
232 %type <expression_> EqualityExpression
233 %type <expression_> EqualityExpressionNoBF
234 %type <expression_> EqualityExpressionNoIn
235 %type <expression_> Expression
236 %type <expression_> ExpressionOpt
237 %type <compound_> Expression_
238 %type <expression_> ExpressionNoBF
239 %type <expression_> ExpressionNoIn
240 %type <compound_> ExpressionNoIn_
241 %type <expression_> ExpressionNoInOpt
242 %type <statement_> ExpressionStatement
243 %type <statement_> FinallyOpt
244 %type <statement_> ForStatement
245 %type <for_> ForStatementInitialiser
246 %type <statement_> ForInStatement
247 %type <forin_> ForInStatementInitialiser
248 %type <parameter_> FormalParameterList
249 %type <parameter_> FormalParameterList_
250 %type <source_> FunctionBody
251 %type <source_> FunctionDeclaration
252 %type <expression_> FunctionExpression
253 %type <identifier_> IdentifierOpt
254 %type <statement_> IfStatement
255 %type <expression_> Initialiser
256 %type <expression_> InitialiserOpt
257 %type <expression_> InitialiserNoIn
258 %type <expression_> InitialiserNoInOpt
259 %type <statement_> IterationStatement
260 %type <statement_> LabelledStatement
261 %type <expression_> LeftHandSideExpression
262 %type <expression_> LeftHandSideExpression_
263 %type <expression_> LeftHandSideExpressionNoBF
264 %type <literal_> Literal
265 %type <expression_> LogicalANDExpression
266 %type <expression_> LogicalANDExpressionNoBF
267 %type <expression_> LogicalANDExpressionNoIn
268 %type <expression_> LogicalORExpression
269 %type <expression_> LogicalORExpressionNoBF
270 %type <expression_> LogicalORExpressionNoIn
271 %type <expression_> MemberExpression
272 %type <expression_> MemberExpression_
273 %type <expression_> MemberExpressionNoBF
274 %type <expression_> MultiplicativeExpression
275 %type <expression_> MultiplicativeExpressionNoBF
276 %type <expression_> NewExpression
277 %type <expression_> NewExpression_
278 %type <expression_> NewExpressionNoBF
279 %type <null_> NullLiteral
280 %type <literal_> ObjectLiteral
281 %type <expression_> PostfixExpression
282 %type <expression_> PostfixExpressionNoBF
283 %type <expression_> PrimaryExpression
284 %type <expression_> PrimaryExpression_
285 %type <expression_> PrimaryExpressionNoBF
286 %type <source_> Program
287 %type <name_> PropertyName
288 %type <property_> PropertyNameAndValueList
289 %type <property_> PropertyNameAndValueList_
290 %type <property_> PropertyNameAndValueListOpt
291 %type <expression_> RelationalExpression
292 %type <expression_> RelationalExpressionNoBF
293 %type <expression_> RelationalExpressionNoIn
294 %type <statement_> ReturnStatement
295 %type <selector_> SelectorExpression
296 %type <selector_> SelectorExpression_
297 %type <selector_> SelectorExpressionOpt
298 %type <expression_> ShiftExpression
299 %type <expression_> ShiftExpressionNoBF
300 %type <source_> SourceElement
301 %type <source_> SourceElements
302 %type <statement_> Statement
303 %type <statement_> StatementList
304 %type <statement_> StatementListOpt
305 %type <statement_> SwitchStatement
306 %type <statement_> ThrowStatement
307 %type <statement_> TryStatement
308 %type <expression_> UnaryExpression
309 %type <expression_> UnaryExpression_
310 %type <expression_> UnaryExpressionNoBF
311 %type <declaration_> VariableDeclaration
312 %type <declaration_> VariableDeclarationNoIn
313 %type <declarations_> VariableDeclarationList
314 %type <declarations_> VariableDeclarationList_
315 %type <declarations_> VariableDeclarationListNoIn
316 %type <declarations_> VariableDeclarationListNoIn_
317 %type <statement_> VariableStatement
318 %type <statement_> WhileStatement
319 %type <statement_> WithStatement
321 %type <word_> WordOpt
323 %type <expression_> MessageExpression
324 %type <argument_> SelectorCall
325 %type <argument_> SelectorCall_
326 %type <argument_> SelectorList
327 %type <argument_> VariadicCall
331 %left "<<" ">>" ">>>"
332 %left "<" ">" "<=" ">=" "instanceof" "in"
333 %left "==" "!=" "===" "!=="
340 %right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
352 | error { yyerrok; driver.errors_.pop_back(); }
358 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } }
377 : Identifier { $$ = $1; }
378 | "abstract" { $$ = $1; }
379 | "boolean" { $$ = $1; }
380 | "break" NewLineOpt { $$ = $1; }
381 | "byte" { $$ = $1; }
382 | "case" { $$ = $1; }
383 | "catch" { $$ = $1; }
384 | "char" { $$ = $1; }
385 | "class" { $$ = $1; }
386 | "const" { $$ = $1; }
387 | "continue" NewLineOpt { $$ = $1; }
388 | "debugger" { $$ = $1; }
389 | "default" { $$ = $1; }
390 | "delete" { $$ = $1; }
392 | "double" { $$ = $1; }
393 | "else" { $$ = $1; }
394 | "enum" { $$ = $1; }
395 | "export" { $$ = $1; }
396 | "extends" { $$ = $1; }
397 | "false" { $$ = $1; }
398 | "final" { $$ = $1; }
399 | "finally" { $$ = $1; }
400 | "float" { $$ = $1; }
402 | "function" { $$ = $1; }
403 | "goto" { $$ = $1; }
405 | "implements" { $$ = $1; }
406 | "import" { $$ = $1; }
407 /* XXX: | "in" { $$ = $1; } */
408 /* XXX: | "instanceof" { $$ = $1; } */
410 | "interface" { $$ = $1; }
411 | "long" { $$ = $1; }
412 | "native" { $$ = $1; }
414 | "null" { $$ = $1; }
415 | "package" { $$ = $1; }
416 | "private" { $$ = $1; }
417 | "protected" { $$ = $1; }
418 | "public" { $$ = $1; }
419 | "return" NewLineOpt { $$ = $1; }
420 | "short" { $$ = $1; }
421 | "static" { $$ = $1; }
422 | "super" { $$ = $1; }
423 | "switch" { $$ = $1; }
424 | "synchronized" { $$ = $1; }
425 | "this" { $$ = $1; }
426 | "throw" NewLineOpt { $$ = $1; }
427 | "throws" { $$ = $1; }
428 | "transient" { $$ = $1; }
429 | "true" { $$ = $1; }
431 | "typeof" { $$ = $1; }
433 | "void" { $$ = $1; }
434 | "volatile" { $$ = $1; }
435 | "while" { $$ = $1; }
436 | "with" { $$ = $1; }
440 : Identifier { $$ = $1; }
445 : NullLiteral { $$ = $1; }
446 | BooleanLiteral { $$ = $1; }
447 | NumericLiteral { $$ = $1; }
448 | StringLiteral { $$ = $1; }
452 : "null" { $$ = $1; }
456 : "true" { $$ = $1; }
457 | "false" { $$ = $1; }
460 /* 11.1 Primary Expressions {{{ */
462 : "this" { $$ = $1; }
463 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
464 | Literal { $$ = $1; }
465 | ArrayLiteral { $$ = $1; }
466 | "(" Expression ")" { $$ = $2; }
470 : ObjectLiteral { $$ = $1; }
471 | PrimaryExpression_ { $$ = $1; }
474 PrimaryExpressionNoBF
475 : PrimaryExpression_ { $$ = $1; }
478 /* 11.1.4 Array Initialiser {{{ */
480 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
484 : AssignmentExpression { $$ = $1; }
488 : Element { $$ = $1; }
493 : ElementList { $$ = $1; }
498 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
499 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
502 /* 11.1.5 Object Initialiser {{{ */
504 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
507 PropertyNameAndValueList_
508 : "," PropertyNameAndValueList { $$ = $2; }
509 | CommaOpt { $$ = NULL; }
512 PropertyNameAndValueListOpt
513 : PropertyNameAndValueList { $$ = $1; }
517 PropertyNameAndValueList
518 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
522 : Identifier { $$ = $1; }
523 | StringLiteral { $$ = $1; }
524 | NumericLiteral { $$ = $1; }
529 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
533 : PrimaryExpression { $$ = $1; }
534 | FunctionExpression { $$ = $1; }
535 | MemberExpression "[" Expression "]" { $$ = new(driver.pool_) CYMember($1, $3); }
536 | MemberExpression "." Identifier { $$ = new(driver.pool_) CYMember($1, new(driver.pool_) CYString($3)); }
537 | MemberExpression_ { $$ = $1; }
541 : PrimaryExpressionNoBF { $$ = $1; }
542 | MemberExpressionNoBF "[" Expression "]" { $$ = new(driver.pool_) CYMember($1, $3); }
543 | MemberExpressionNoBF "." Identifier { $$ = new(driver.pool_) CYMember($1, new(driver.pool_) CYString($3)); }
544 | MemberExpression_ { $$ = $1; }
548 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
552 : MemberExpression { $$ = $1; }
553 | NewExpression_ { $$ = $1; }
557 : MemberExpressionNoBF { $$ = $1; }
558 | NewExpression_ { $$ = $1; }
562 : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
563 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
564 | CallExpression "[" Expression "]" { $$ = new(driver.pool_) CYMember($1, $3); }
565 | CallExpression "." Identifier { $$ = new(driver.pool_) CYMember($1, new(driver.pool_) CYString($3)); }
569 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
570 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
571 | CallExpressionNoBF "[" Expression "]" { $$ = new(driver.pool_) CYMember($1, $3); }
572 | CallExpressionNoBF "." Identifier { $$ = new(driver.pool_) CYMember($1, new(driver.pool_) CYString($3)); }
576 : "," ArgumentList { $$ = $2; }
581 : ArgumentList { $$ = $1; }
586 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
590 : "(" ArgumentListOpt ")" { $$ = $2; }
593 LeftHandSideExpression
594 : NewExpression { $$ = $1; }
595 | CallExpression { $$ = $1; }
596 | LeftHandSideExpression_ { $$ = $1; }
599 LeftHandSideExpressionNoBF
600 : NewExpressionNoBF { $$ = $1; }
601 | CallExpressionNoBF { $$ = $1; }
602 | LeftHandSideExpression_ { $$ = $1; }
606 : LeftHandSideExpression { $$ = $1; }
607 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
608 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
611 PostfixExpressionNoBF
612 : LeftHandSideExpressionNoBF { $$ = $1; }
613 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
614 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
618 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
619 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
620 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
621 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
622 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
623 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
624 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
625 | "+" UnaryExpression { $$ = $2; }
626 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
627 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
628 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
632 : PostfixExpression { $$ = $1; }
633 | UnaryExpression_ { $$ = $1; }
637 : PostfixExpressionNoBF { $$ = $1; }
638 | UnaryExpression_ { $$ = $1; }
641 MultiplicativeExpression
642 : UnaryExpression { $$ = $1; }
643 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
644 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
645 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
648 MultiplicativeExpressionNoBF
649 : UnaryExpressionNoBF { $$ = $1; }
650 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
651 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
652 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
656 : MultiplicativeExpression { $$ = $1; }
657 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
658 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
661 AdditiveExpressionNoBF
662 : MultiplicativeExpressionNoBF { $$ = $1; }
663 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
664 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
668 : AdditiveExpression { $$ = $1; }
669 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
670 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
671 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
675 : AdditiveExpressionNoBF { $$ = $1; }
676 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
677 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
678 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
682 : ShiftExpression { $$ = $1; }
683 | RelationalExpression "<" ShiftExpression { $$ = new(driver.pool_) CYLess($1, $3); }
684 | RelationalExpression ">" ShiftExpression { $$ = new(driver.pool_) CYGreater($1, $3); }
685 | RelationalExpression "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual($1, $3); }
686 | RelationalExpression ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual($1, $3); }
687 | RelationalExpression "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf($1, $3); }
688 | RelationalExpression "in" ShiftExpression { $$ = new(driver.pool_) CYIn($1, $3); }
691 RelationalExpressionNoIn
692 : ShiftExpression { $$ = $1; }
693 | RelationalExpressionNoIn "<" ShiftExpression { $$ = new(driver.pool_) CYLess($1, $3); }
694 | RelationalExpressionNoIn ">" ShiftExpression { $$ = new(driver.pool_) CYGreater($1, $3); }
695 | RelationalExpressionNoIn "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual($1, $3); }
696 | RelationalExpressionNoIn ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual($1, $3); }
697 | RelationalExpressionNoIn "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf($1, $3); }
700 RelationalExpressionNoBF
701 : ShiftExpressionNoBF { $$ = $1; }
702 | RelationalExpressionNoBF "<" ShiftExpression { $$ = new(driver.pool_) CYLess($1, $3); }
703 | RelationalExpressionNoBF ">" ShiftExpression { $$ = new(driver.pool_) CYGreater($1, $3); }
704 | RelationalExpressionNoBF "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual($1, $3); }
705 | RelationalExpressionNoBF ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual($1, $3); }
706 | RelationalExpressionNoBF "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf($1, $3); }
707 | RelationalExpressionNoBF "in" ShiftExpression { $$ = new(driver.pool_) CYIn($1, $3); }
711 : RelationalExpression { $$ = $1; }
712 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
713 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
714 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
715 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
718 EqualityExpressionNoIn
719 : RelationalExpressionNoIn { $$ = $1; }
720 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
721 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
722 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
723 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
726 EqualityExpressionNoBF
727 : RelationalExpressionNoBF { $$ = $1; }
728 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
729 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
730 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
731 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
735 : EqualityExpression { $$ = $1; }
736 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
739 BitwiseANDExpressionNoIn
740 : EqualityExpressionNoIn { $$ = $1; }
741 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
744 BitwiseANDExpressionNoBF
745 : EqualityExpressionNoBF { $$ = $1; }
746 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
750 : BitwiseANDExpression { $$ = $1; }
751 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
754 BitwiseXORExpressionNoIn
755 : BitwiseANDExpressionNoIn { $$ = $1; }
756 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
759 BitwiseXORExpressionNoBF
760 : BitwiseANDExpressionNoBF { $$ = $1; }
761 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
765 : BitwiseXORExpression { $$ = $1; }
766 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
769 BitwiseORExpressionNoIn
770 : BitwiseXORExpressionNoIn { $$ = $1; }
771 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
774 BitwiseORExpressionNoBF
775 : BitwiseXORExpressionNoBF { $$ = $1; }
776 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
780 : BitwiseORExpression { $$ = $1; }
781 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
784 LogicalANDExpressionNoIn
785 : BitwiseORExpressionNoIn { $$ = $1; }
786 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
789 LogicalANDExpressionNoBF
790 : BitwiseORExpressionNoBF { $$ = $1; }
791 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
795 : LogicalANDExpression { $$ = $1; }
796 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
799 LogicalORExpressionNoIn
800 : LogicalANDExpressionNoIn { $$ = $1; }
801 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
804 LogicalORExpressionNoBF
805 : LogicalANDExpressionNoBF { $$ = $1; }
806 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
809 ConditionalExpression
810 : LogicalORExpression { $$ = $1; }
811 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
814 ConditionalExpressionNoIn
815 : LogicalORExpressionNoIn { $$ = $1; }
816 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
819 ConditionalExpressionNoBF
820 : LogicalORExpressionNoBF { $$ = $1; }
821 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
825 : ConditionalExpression { $$ = $1; }
826 | LeftHandSideExpression "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign($1, $3); }
827 | LeftHandSideExpression "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
828 | LeftHandSideExpression "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
829 | LeftHandSideExpression "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
830 | LeftHandSideExpression "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign($1, $3); }
831 | LeftHandSideExpression "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
832 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
833 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
834 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
835 | LeftHandSideExpression "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
836 | LeftHandSideExpression "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
837 | LeftHandSideExpression "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
840 AssignmentExpressionNoIn
841 : ConditionalExpressionNoIn { $$ = $1; }
842 | LeftHandSideExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
843 | LeftHandSideExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
844 | LeftHandSideExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
845 | LeftHandSideExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
846 | LeftHandSideExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
847 | LeftHandSideExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
848 | LeftHandSideExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
849 | LeftHandSideExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
850 | LeftHandSideExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
851 | LeftHandSideExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
852 | LeftHandSideExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
853 | LeftHandSideExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
856 AssignmentExpressionNoBF
857 : ConditionalExpressionNoBF { $$ = $1; }
858 | LeftHandSideExpressionNoBF "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign($1, $3); }
859 | LeftHandSideExpressionNoBF "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
860 | LeftHandSideExpressionNoBF "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
861 | LeftHandSideExpressionNoBF "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
862 | LeftHandSideExpressionNoBF "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign($1, $3); }
863 | LeftHandSideExpressionNoBF "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
864 | LeftHandSideExpressionNoBF "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
865 | LeftHandSideExpressionNoBF ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
866 | LeftHandSideExpressionNoBF ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
867 | LeftHandSideExpressionNoBF "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
868 | LeftHandSideExpressionNoBF "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
869 | LeftHandSideExpressionNoBF "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
873 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
878 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
883 : Expression { $$ = $1; }
888 : ExpressionNoIn { $$ = $1; }
893 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
897 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
901 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
906 | VariableStatement { $$ = $1; }
907 | EmptyStatement { $$ = $1; }
908 | ExpressionStatement { $$ = $1; }
909 | IfStatement { $$ = $1; }
910 | IterationStatement { $$ = $1; }
911 | ContinueStatement { $$ = $1; }
912 | BreakStatement { $$ = $1; }
913 | ReturnStatement { $$ = $1; }
914 | WithStatement { $$ = $1; }
915 | LabelledStatement { $$ = $1; }
916 | SwitchStatement { $$ = $1; }
917 | ThrowStatement { $$ = $1; }
918 | TryStatement { $$ = $1; }
922 : "{" StatementListOpt "}" { $$ = $2 ?: new(driver.pool_) CYEmpty(); }
926 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
930 : StatementList { $$ = $1; }
935 : "var" VariableDeclarationList Terminator { $$ = $2; }
938 VariableDeclarationList_
939 : "," VariableDeclarationList { $$ = $2; }
943 VariableDeclarationListNoIn_
944 : "," VariableDeclarationListNoIn { $$ = $2; }
948 VariableDeclarationList
949 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
952 VariableDeclarationListNoIn
953 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
957 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
960 VariableDeclarationNoIn
961 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
965 : Initialiser { $$ = $1; }
970 : InitialiserNoIn { $$ = $1; }
975 : "=" AssignmentExpression { $$ = $2; }
979 : "=" AssignmentExpressionNoIn { $$ = $2; }
983 : ";" { $$ = new(driver.pool_) CYEmpty(); }
987 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
991 : "else" Statement { $$ = $2; }
992 | %prec "if" { $$ = NULL; }
996 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1000 : DoWhileStatement { $$ = $1; }
1001 | WhileStatement { $$ = $1; }
1002 | ForStatement { $$ = $1; }
1003 | ForInStatement { $$ = $1; }
1007 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1011 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1015 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1018 ForStatementInitialiser
1019 : ExpressionNoInOpt { $$ = $1; }
1020 | "var" VariableDeclarationListNoIn { $$ = $2; }
1024 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1027 ForInStatementInitialiser
1028 : LeftHandSideExpression { $$ = $1; }
1029 | "var" VariableDeclarationNoIn { $$ = $2; }
1033 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1037 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1041 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1045 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1049 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1053 : "{" CaseClausesOpt "}" { $$ = $2; }
1057 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1058 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1063 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1067 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1071 : Identifier ":" Statement { $3->AddLabel($1); $$ = $3; }
1075 : "throw" Expression Terminator { $$ = new(driver.pool_) CYThrow($2); }
1079 : "try" Block CatchOpt FinallyOpt { $$ = new(driver.pool_) CYTry($2, $3, $4); }
1083 : "catch" "(" Identifier ")" Block { $$ = new(driver.pool_) CYCatch($3, $5); }
1088 : "finally" Block { $$ = $2; }
1093 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunction($2, $4, $7); }
1097 : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYLambda($2, $4, $7); }
1100 FormalParameterList_
1101 : "," FormalParameterList { $$ = $2; }
1106 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYParameter($1, $2); }
1111 : SourceElements { $$ = $1; }
1115 : SourceElements { driver.source_ = $1; }
1119 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
1124 : Statement { $$ = $1; }
1125 | FunctionDeclaration { $$ = $1; }
1128 /* Objective-C Extensions {{{ */
1130 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1135 : SelectorCall { $$ = $1; }
1136 | VariadicCall { $$ = $1; }
1140 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1144 : SelectorCall { $$ = $1; }
1145 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1149 : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYMessage($2, $3); }
1152 SelectorExpressionOpt
1153 : SelectorExpression_ { $$ = $1; }
1158 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
1162 : SelectorExpression_ { $$ = $1; }
1163 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
1167 : MessageExpression { $$ = $1; }
1168 | "@selector" "(" SelectorExpression ")" { $$ = new CYSelector($3); }
1172 LeftHandSideExpression_
1173 : "*" LeftHandSideExpression { $$ = new(driver.pool_) CYIndirect($2); }
1177 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }