2 #include "Cycript.tab.hh"
3 #define scanner driver.scanner_
4 #define YYSTACKEXPANDABLE 1
16 CYArgument *argument_;
20 CYCompound *compound_;
21 CYDeclaration *declaration_;
22 CYDeclarations *declarations_;
24 CYExpression *expression_;
27 CYForInitialiser *for_;
28 CYForInInitialiser *forin_;
29 CYFunctionParameter *functionParameter_;
30 CYIdentifier *identifier_;
33 CYMessageParameter *messageParameter_;
37 CYProperty *property_;
38 CYSelectorPart *selector_;
40 CYStatement *statement_;
51 int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner);
60 @$.begin.filename = @$.end.filename = &driver.filename_;
68 %parse-param { CYDriver &driver }
69 %lex-param { void *scanner }
72 %token AmpersandAmpersand "&&"
73 %token AmpersandEqual "&="
75 %token CarrotEqual "^="
77 %token EqualEqual "=="
78 %token EqualEqualEqual "==="
79 %token Exclamation "!"
80 %token ExclamationEqual "!="
81 %token ExclamationEqualEqual "!=="
83 %token HyphenEqual "-="
84 %token HyphenHyphen "--"
85 %token HyphenHyphen_ "\n--"
86 %token HyphenRight "->"
90 %token LeftLeftEqual "<<="
92 %token PercentEqual "%="
100 %token PlusPlus_ "\n++"
102 %token RightEqual ">="
103 %token RightRight ">>"
104 %token RightRightEqual ">>="
105 %token RightRightRight ">>>"
106 %token RightRightRightEqual ">>>="
108 %token SlashEqual "/="
110 %token StarEqual "*="
120 %token CloseParen ")"
123 %token CloseBrace "}"
125 %token OpenBracket "["
126 %token CloseBracket "]"
128 %token AtClass "@class"
129 %token AtSelector "@selector"
132 %token <word_> Break "break"
133 %token <word_> Case "case"
134 %token <word_> Catch "catch"
135 %token <word_> Continue "continue"
136 %token <word_> Default "default"
137 %token <word_> Delete "delete"
138 %token <word_> Do "do"
139 %token <word_> Else "else"
140 %token <false_> False "false"
141 %token <word_> Finally "finally"
142 %token <word_> For "for"
143 %token <word_> Function "function"
144 %token <word_> If "if"
145 %token <word_> In "in"
146 %token <word_> InstanceOf "instanceof"
147 %token <word_> New "new"
148 %token <null_> Null "null"
149 %token <word_> Return "return"
150 %token <word_> Switch "switch"
151 %token <this_> This "this"
152 %token <word_> Throw "throw"
153 %token <true_> True "true"
154 %token <word_> Try "try"
155 %token <word_> TypeOf "typeof"
156 %token <word_> Var "var"
157 %token <word_> Void "void"
158 %token <word_> While "while"
159 %token <word_> With "with"
161 %token <word_> Abstract "abstract"
162 %token <word_> Boolean "boolean"
163 %token <word_> Byte "byte"
164 %token <word_> Char "char"
165 %token <word_> Class "class"
166 %token <word_> Const "const"
167 %token <word_> Debugger "debugger"
168 %token <word_> Double "double"
169 %token <word_> Enum "enum"
170 %token <word_> Export "export"
171 %token <word_> Extends "extends"
172 %token <word_> Final "final"
173 %token <word_> Float "float"
174 %token <word_> Goto "goto"
175 %token <word_> Implements "implements"
176 %token <word_> Import "import"
177 %token <word_> Int "int"
178 %token <word_> Interface "interface"
179 %token <word_> Long "long"
180 %token <word_> Native "native"
181 %token <word_> Package "package"
182 %token <word_> Private "private"
183 %token <word_> Protected "protected"
184 %token <word_> Public "public"
185 %token <word_> Short "short"
186 %token <word_> Static "static"
187 %token <word_> Super "super"
188 %token <word_> Synchronized "synchronized"
189 %token <word_> Throws "throws"
190 %token <word_> Transient "transient"
191 %token <word_> Volatile "volatile"
193 %token <identifier_> Identifier
194 %token <number_> NumericLiteral
195 %token <string_> StringLiteral
197 %type <expression_> AdditiveExpression
198 %type <expression_> AdditiveExpressionNoBF
199 %type <argument_> ArgumentList
200 %type <argument_> ArgumentList_
201 %type <argument_> ArgumentListOpt
202 %type <argument_> Arguments
203 %type <literal_> ArrayLiteral
204 %type <expression_> AssignmentExpression
205 %type <expression_> AssignmentExpressionNoBF
206 %type <expression_> AssignmentExpressionNoIn
207 %type <expression_> BitwiseANDExpression
208 %type <expression_> BitwiseANDExpressionNoBF
209 %type <expression_> BitwiseANDExpressionNoIn
210 %type <statement_> Block
211 %type <boolean_> BooleanLiteral
212 %type <expression_> BitwiseORExpression
213 %type <expression_> BitwiseORExpressionNoBF
214 %type <expression_> BitwiseORExpressionNoIn
215 %type <expression_> BitwiseXORExpression
216 %type <expression_> BitwiseXORExpressionNoBF
217 %type <expression_> BitwiseXORExpressionNoIn
218 %type <statement_> BreakStatement
219 %type <expression_> CallExpression
220 %type <expression_> CallExpressionNoBF
221 %type <clause_> CaseBlock
222 %type <clause_> CaseClause
223 %type <clause_> CaseClausesOpt
224 %type <catch_> CatchOpt
225 %type <source_> ClassDeclaration
226 %type <message_> ClassMessageDeclaration
227 %type <message_> ClassMessageDeclarationListOpt
228 %type <expression_> ClassSuperOpt
229 %type <field_> ClassFieldList
230 %type <expression_> ConditionalExpression
231 %type <expression_> ConditionalExpressionNoBF
232 %type <expression_> ConditionalExpressionNoIn
233 %type <statement_> ContinueStatement
234 %type <clause_> DefaultClause
235 %type <statement_> DoWhileStatement
236 %type <expression_> Element
237 %type <expression_> ElementOpt
238 %type <element_> ElementList
239 %type <element_> ElementListOpt
240 %type <statement_> ElseStatementOpt
241 %type <statement_> EmptyStatement
242 %type <expression_> EqualityExpression
243 %type <expression_> EqualityExpressionNoBF
244 %type <expression_> EqualityExpressionNoIn
245 %type <expression_> Expression
246 %type <expression_> ExpressionOpt
247 %type <compound_> Expression_
248 %type <expression_> ExpressionNoBF
249 %type <expression_> ExpressionNoIn
250 %type <compound_> ExpressionNoIn_
251 %type <expression_> ExpressionNoInOpt
252 %type <statement_> ExpressionStatement
253 %type <statement_> FinallyOpt
254 %type <statement_> ForStatement
255 %type <for_> ForStatementInitialiser
256 %type <statement_> ForInStatement
257 %type <forin_> ForInStatementInitialiser
258 %type <functionParameter_> FormalParameterList
259 %type <functionParameter_> FormalParameterList_
260 %type <source_> FunctionBody
261 %type <source_> FunctionDeclaration
262 %type <expression_> FunctionExpression
263 %type <identifier_> IdentifierOpt
264 %type <statement_> IfStatement
265 %type <expression_> Initialiser
266 %type <expression_> InitialiserOpt
267 %type <expression_> InitialiserNoIn
268 %type <expression_> InitialiserNoInOpt
269 %type <statement_> IterationStatement
270 %type <statement_> LabelledStatement
271 %type <expression_> LeftHandSideExpression
272 %type <expression_> LeftHandSideExpression_
273 %type <expression_> LeftHandSideExpressionNoBF
274 %type <literal_> Literal
275 %type <expression_> LogicalANDExpression
276 %type <expression_> LogicalANDExpressionNoBF
277 %type <expression_> LogicalANDExpressionNoIn
278 %type <expression_> LogicalORExpression
279 %type <expression_> LogicalORExpressionNoBF
280 %type <expression_> LogicalORExpressionNoIn
281 %type <expression_> MemberExpression
282 %type <expression_> MemberExpression_
283 %type <expression_> MemberExpressionNoBF
284 %type <messageParameter_> MessageParameter
285 %type <messageParameter_> MessageParameters
286 %type <messageParameter_> MessageParameterList
287 %type <messageParameter_> MessageParameterListOpt
288 %type <bool_> MessageScope
289 %type <expression_> MultiplicativeExpression
290 %type <expression_> MultiplicativeExpressionNoBF
291 %type <expression_> NewExpression
292 %type <expression_> NewExpression_
293 %type <expression_> NewExpressionNoBF
294 %type <null_> NullLiteral
295 %type <literal_> ObjectLiteral
296 %type <expression_> PostfixExpression
297 %type <expression_> PostfixExpressionNoBF
298 %type <expression_> PrimaryExpression
299 %type <expression_> PrimaryExpression_
300 %type <expression_> PrimaryExpressionNoBF
301 %type <source_> Program
302 %type <name_> PropertyName
303 %type <property_> PropertyNameAndValueList
304 %type <property_> PropertyNameAndValueList_
305 %type <property_> PropertyNameAndValueListOpt
306 %type <expression_> RelationalExpression
307 %type <expression_> RelationalExpressionNoBF
308 %type <expression_> RelationalExpressionNoIn
309 %type <statement_> ReturnStatement
310 %type <selector_> SelectorExpression
311 %type <selector_> SelectorExpression_
312 %type <selector_> SelectorExpressionOpt
313 %type <expression_> ShiftExpression
314 %type <expression_> ShiftExpressionNoBF
315 %type <source_> SourceElement
316 %type <source_> SourceElements
317 %type <statement_> Statement
318 %type <statement_> StatementList
319 %type <statement_> StatementListOpt
320 %type <statement_> SwitchStatement
321 %type <statement_> ThrowStatement
322 %type <statement_> TryStatement
323 %type <expression_> TypeOpt
324 %type <expression_> UnaryExpression
325 %type <expression_> UnaryExpression_
326 %type <expression_> UnaryExpressionNoBF
327 %type <declaration_> VariableDeclaration
328 %type <declaration_> VariableDeclarationNoIn
329 %type <declarations_> VariableDeclarationList
330 %type <declarations_> VariableDeclarationList_
331 %type <declarations_> VariableDeclarationListNoIn
332 %type <declarations_> VariableDeclarationListNoIn_
333 %type <statement_> VariableStatement
334 %type <statement_> WhileStatement
335 %type <statement_> WithStatement
337 %type <word_> WordOpt
339 %type <expression_> MessageExpression
340 %type <argument_> SelectorCall
341 %type <argument_> SelectorCall_
342 %type <argument_> SelectorList
343 %type <argument_> VariadicCall
347 %left "<<" ">>" ">>>"
348 %left "<" ">" "<=" ">=" "instanceof" "in"
349 %left "==" "!=" "===" "!=="
356 %right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
368 | error { yyerrok; driver.errors_.pop_back(); }
374 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } }
393 : Identifier { $$ = $1; }
394 | "abstract" { $$ = $1; }
395 | "boolean" { $$ = $1; }
396 | "break" NewLineOpt { $$ = $1; }
397 | "byte" { $$ = $1; }
398 | "case" { $$ = $1; }
399 | "catch" { $$ = $1; }
400 | "char" { $$ = $1; }
401 | "class" { $$ = $1; }
402 | "const" { $$ = $1; }
403 | "continue" NewLineOpt { $$ = $1; }
404 | "debugger" { $$ = $1; }
405 | "default" { $$ = $1; }
406 | "delete" { $$ = $1; }
408 | "double" { $$ = $1; }
409 | "else" { $$ = $1; }
410 | "enum" { $$ = $1; }
411 | "export" { $$ = $1; }
412 | "extends" { $$ = $1; }
413 | "false" { $$ = $1; }
414 | "final" { $$ = $1; }
415 | "finally" { $$ = $1; }
416 | "float" { $$ = $1; }
418 | "function" { $$ = $1; }
419 | "goto" { $$ = $1; }
421 | "implements" { $$ = $1; }
422 | "import" { $$ = $1; }
423 /* XXX: | "in" { $$ = $1; } */
424 /* XXX: | "instanceof" { $$ = $1; } */
426 | "interface" { $$ = $1; }
427 | "long" { $$ = $1; }
428 | "native" { $$ = $1; }
430 | "null" { $$ = $1; }
431 | "package" { $$ = $1; }
432 | "private" { $$ = $1; }
433 | "protected" { $$ = $1; }
434 | "public" { $$ = $1; }
435 | "return" NewLineOpt { $$ = $1; }
436 | "short" { $$ = $1; }
437 | "static" { $$ = $1; }
438 | "super" { $$ = $1; }
439 | "switch" { $$ = $1; }
440 | "synchronized" { $$ = $1; }
441 | "this" { $$ = $1; }
442 | "throw" NewLineOpt { $$ = $1; }
443 | "throws" { $$ = $1; }
444 | "transient" { $$ = $1; }
445 | "true" { $$ = $1; }
447 | "typeof" { $$ = $1; }
449 | "void" { $$ = $1; }
450 | "volatile" { $$ = $1; }
451 | "while" { $$ = $1; }
452 | "with" { $$ = $1; }
456 : Identifier { $$ = $1; }
461 : NullLiteral { $$ = $1; }
462 | BooleanLiteral { $$ = $1; }
463 | NumericLiteral { $$ = $1; }
464 | StringLiteral { $$ = $1; }
468 : "null" { $$ = $1; }
472 : "true" { $$ = $1; }
473 | "false" { $$ = $1; }
476 /* 11.1 Primary Expressions {{{ */
478 : "this" { $$ = $1; }
479 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
480 | Literal { $$ = $1; }
481 | ArrayLiteral { $$ = $1; }
482 | "(" Expression ")" { $$ = $2; }
486 : ObjectLiteral { $$ = $1; }
487 | PrimaryExpression_ { $$ = $1; }
490 PrimaryExpressionNoBF
491 : PrimaryExpression_ { $$ = $1; }
494 /* 11.1.4 Array Initialiser {{{ */
496 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
500 : AssignmentExpression { $$ = $1; }
504 : Element { $$ = $1; }
509 : ElementList { $$ = $1; }
514 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
515 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
518 /* 11.1.5 Object Initialiser {{{ */
520 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
523 PropertyNameAndValueList_
524 : "," PropertyNameAndValueList { $$ = $2; }
525 | CommaOpt { $$ = NULL; }
528 PropertyNameAndValueListOpt
529 : PropertyNameAndValueList { $$ = $1; }
533 PropertyNameAndValueList
534 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
538 : Identifier { $$ = $1; }
539 | StringLiteral { $$ = $1; }
540 | NumericLiteral { $$ = $1; }
545 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
549 : PrimaryExpression { $$ = $1; }
550 | FunctionExpression { $$ = $1; }
551 | MemberExpression "[" Expression "]" { $$ = new(driver.pool_) CYMember($1, $3); }
552 | MemberExpression "." Identifier { $$ = new(driver.pool_) CYMember($1, new(driver.pool_) CYString($3)); }
553 | MemberExpression_ { $$ = $1; }
557 : PrimaryExpressionNoBF { $$ = $1; }
558 | MemberExpressionNoBF "[" Expression "]" { $$ = new(driver.pool_) CYMember($1, $3); }
559 | MemberExpressionNoBF "." Identifier { $$ = new(driver.pool_) CYMember($1, new(driver.pool_) CYString($3)); }
560 | MemberExpression_ { $$ = $1; }
564 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
568 : MemberExpression { $$ = $1; }
569 | NewExpression_ { $$ = $1; }
573 : MemberExpressionNoBF { $$ = $1; }
574 | NewExpression_ { $$ = $1; }
578 : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
579 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
580 | CallExpression "[" Expression "]" { $$ = new(driver.pool_) CYMember($1, $3); }
581 | CallExpression "." Identifier { $$ = new(driver.pool_) CYMember($1, new(driver.pool_) CYString($3)); }
585 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
586 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
587 | CallExpressionNoBF "[" Expression "]" { $$ = new(driver.pool_) CYMember($1, $3); }
588 | CallExpressionNoBF "." Identifier { $$ = new(driver.pool_) CYMember($1, new(driver.pool_) CYString($3)); }
592 : "," ArgumentList { $$ = $2; }
597 : ArgumentList { $$ = $1; }
602 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
606 : "(" ArgumentListOpt ")" { $$ = $2; }
609 LeftHandSideExpression
610 : NewExpression { $$ = $1; }
611 | CallExpression { $$ = $1; }
612 | LeftHandSideExpression_ { $$ = $1; }
615 LeftHandSideExpressionNoBF
616 : NewExpressionNoBF { $$ = $1; }
617 | CallExpressionNoBF { $$ = $1; }
618 | LeftHandSideExpression_ { $$ = $1; }
622 : LeftHandSideExpression { $$ = $1; }
623 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
624 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
627 PostfixExpressionNoBF
628 : LeftHandSideExpressionNoBF { $$ = $1; }
629 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
630 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
634 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
635 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
636 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
637 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
638 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
639 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
640 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
641 | "+" UnaryExpression { $$ = $2; }
642 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
643 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
644 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
648 : PostfixExpression { $$ = $1; }
649 | UnaryExpression_ { $$ = $1; }
653 : PostfixExpressionNoBF { $$ = $1; }
654 | UnaryExpression_ { $$ = $1; }
657 MultiplicativeExpression
658 : UnaryExpression { $$ = $1; }
659 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
660 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
661 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
664 MultiplicativeExpressionNoBF
665 : UnaryExpressionNoBF { $$ = $1; }
666 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
667 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
668 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
672 : MultiplicativeExpression { $$ = $1; }
673 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
674 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
677 AdditiveExpressionNoBF
678 : MultiplicativeExpressionNoBF { $$ = $1; }
679 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
680 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
684 : AdditiveExpression { $$ = $1; }
685 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
686 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
687 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
691 : AdditiveExpressionNoBF { $$ = $1; }
692 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
693 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
694 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
698 : ShiftExpression { $$ = $1; }
699 | RelationalExpression "<" ShiftExpression { $$ = new(driver.pool_) CYLess($1, $3); }
700 | RelationalExpression ">" ShiftExpression { $$ = new(driver.pool_) CYGreater($1, $3); }
701 | RelationalExpression "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual($1, $3); }
702 | RelationalExpression ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual($1, $3); }
703 | RelationalExpression "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf($1, $3); }
704 | RelationalExpression "in" ShiftExpression { $$ = new(driver.pool_) CYIn($1, $3); }
707 RelationalExpressionNoIn
708 : ShiftExpression { $$ = $1; }
709 | RelationalExpressionNoIn "<" ShiftExpression { $$ = new(driver.pool_) CYLess($1, $3); }
710 | RelationalExpressionNoIn ">" ShiftExpression { $$ = new(driver.pool_) CYGreater($1, $3); }
711 | RelationalExpressionNoIn "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual($1, $3); }
712 | RelationalExpressionNoIn ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual($1, $3); }
713 | RelationalExpressionNoIn "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf($1, $3); }
716 RelationalExpressionNoBF
717 : ShiftExpressionNoBF { $$ = $1; }
718 | RelationalExpressionNoBF "<" ShiftExpression { $$ = new(driver.pool_) CYLess($1, $3); }
719 | RelationalExpressionNoBF ">" ShiftExpression { $$ = new(driver.pool_) CYGreater($1, $3); }
720 | RelationalExpressionNoBF "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual($1, $3); }
721 | RelationalExpressionNoBF ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual($1, $3); }
722 | RelationalExpressionNoBF "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf($1, $3); }
723 | RelationalExpressionNoBF "in" ShiftExpression { $$ = new(driver.pool_) CYIn($1, $3); }
727 : RelationalExpression { $$ = $1; }
728 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
729 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
730 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
731 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
734 EqualityExpressionNoIn
735 : RelationalExpressionNoIn { $$ = $1; }
736 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
737 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
738 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
739 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
742 EqualityExpressionNoBF
743 : RelationalExpressionNoBF { $$ = $1; }
744 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
745 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
746 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
747 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
751 : EqualityExpression { $$ = $1; }
752 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
755 BitwiseANDExpressionNoIn
756 : EqualityExpressionNoIn { $$ = $1; }
757 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
760 BitwiseANDExpressionNoBF
761 : EqualityExpressionNoBF { $$ = $1; }
762 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
766 : BitwiseANDExpression { $$ = $1; }
767 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
770 BitwiseXORExpressionNoIn
771 : BitwiseANDExpressionNoIn { $$ = $1; }
772 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
775 BitwiseXORExpressionNoBF
776 : BitwiseANDExpressionNoBF { $$ = $1; }
777 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
781 : BitwiseXORExpression { $$ = $1; }
782 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
785 BitwiseORExpressionNoIn
786 : BitwiseXORExpressionNoIn { $$ = $1; }
787 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
790 BitwiseORExpressionNoBF
791 : BitwiseXORExpressionNoBF { $$ = $1; }
792 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
796 : BitwiseORExpression { $$ = $1; }
797 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
800 LogicalANDExpressionNoIn
801 : BitwiseORExpressionNoIn { $$ = $1; }
802 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
805 LogicalANDExpressionNoBF
806 : BitwiseORExpressionNoBF { $$ = $1; }
807 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
811 : LogicalANDExpression { $$ = $1; }
812 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
815 LogicalORExpressionNoIn
816 : LogicalANDExpressionNoIn { $$ = $1; }
817 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
820 LogicalORExpressionNoBF
821 : LogicalANDExpressionNoBF { $$ = $1; }
822 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
825 ConditionalExpression
826 : LogicalORExpression { $$ = $1; }
827 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
830 ConditionalExpressionNoIn
831 : LogicalORExpressionNoIn { $$ = $1; }
832 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
835 ConditionalExpressionNoBF
836 : LogicalORExpressionNoBF { $$ = $1; }
837 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
841 : ConditionalExpression { $$ = $1; }
842 | LeftHandSideExpression "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign($1, $3); }
843 | LeftHandSideExpression "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
844 | LeftHandSideExpression "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
845 | LeftHandSideExpression "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
846 | LeftHandSideExpression "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign($1, $3); }
847 | LeftHandSideExpression "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
848 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
849 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
850 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
851 | LeftHandSideExpression "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
852 | LeftHandSideExpression "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
853 | LeftHandSideExpression "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
856 AssignmentExpressionNoIn
857 : ConditionalExpressionNoIn { $$ = $1; }
858 | LeftHandSideExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
859 | LeftHandSideExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
860 | LeftHandSideExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
861 | LeftHandSideExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
862 | LeftHandSideExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
863 | LeftHandSideExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
864 | LeftHandSideExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
865 | LeftHandSideExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
866 | LeftHandSideExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
867 | LeftHandSideExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
868 | LeftHandSideExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
869 | LeftHandSideExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
872 AssignmentExpressionNoBF
873 : ConditionalExpressionNoBF { $$ = $1; }
874 | LeftHandSideExpressionNoBF "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign($1, $3); }
875 | LeftHandSideExpressionNoBF "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
876 | LeftHandSideExpressionNoBF "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
877 | LeftHandSideExpressionNoBF "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
878 | LeftHandSideExpressionNoBF "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign($1, $3); }
879 | LeftHandSideExpressionNoBF "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
880 | LeftHandSideExpressionNoBF "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
881 | LeftHandSideExpressionNoBF ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
882 | LeftHandSideExpressionNoBF ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
883 | LeftHandSideExpressionNoBF "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
884 | LeftHandSideExpressionNoBF "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
885 | LeftHandSideExpressionNoBF "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
889 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
894 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
899 : Expression { $$ = $1; }
904 : ExpressionNoIn { $$ = $1; }
909 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
913 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
917 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
922 | VariableStatement { $$ = $1; }
923 | EmptyStatement { $$ = $1; }
924 | ExpressionStatement { $$ = $1; }
925 | IfStatement { $$ = $1; }
926 | IterationStatement { $$ = $1; }
927 | ContinueStatement { $$ = $1; }
928 | BreakStatement { $$ = $1; }
929 | ReturnStatement { $$ = $1; }
930 | WithStatement { $$ = $1; }
931 | LabelledStatement { $$ = $1; }
932 | SwitchStatement { $$ = $1; }
933 | ThrowStatement { $$ = $1; }
934 | TryStatement { $$ = $1; }
938 : "{" StatementListOpt "}" { $$ = $2 ?: new(driver.pool_) CYEmpty(); }
942 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
946 : StatementList { $$ = $1; }
951 : "var" VariableDeclarationList Terminator { $$ = $2; }
954 VariableDeclarationList_
955 : "," VariableDeclarationList { $$ = $2; }
959 VariableDeclarationListNoIn_
960 : "," VariableDeclarationListNoIn { $$ = $2; }
964 VariableDeclarationList
965 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
968 VariableDeclarationListNoIn
969 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
973 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
976 VariableDeclarationNoIn
977 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
981 : Initialiser { $$ = $1; }
986 : InitialiserNoIn { $$ = $1; }
991 : "=" AssignmentExpression { $$ = $2; }
995 : "=" AssignmentExpressionNoIn { $$ = $2; }
999 : ";" { $$ = new(driver.pool_) CYEmpty(); }
1003 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
1007 : "else" Statement { $$ = $2; }
1008 | %prec "if" { $$ = NULL; }
1012 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1016 : DoWhileStatement { $$ = $1; }
1017 | WhileStatement { $$ = $1; }
1018 | ForStatement { $$ = $1; }
1019 | ForInStatement { $$ = $1; }
1023 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1027 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1031 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1034 ForStatementInitialiser
1035 : ExpressionNoInOpt { $$ = $1; }
1036 | "var" VariableDeclarationListNoIn { $$ = $2; }
1040 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1043 ForInStatementInitialiser
1044 : LeftHandSideExpression { $$ = $1; }
1045 | "var" VariableDeclarationNoIn { $$ = $2; }
1049 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1053 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1057 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1061 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1065 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1069 : "{" CaseClausesOpt "}" { $$ = $2; }
1073 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1074 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1079 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1083 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1087 : Identifier ":" Statement { $3->AddLabel($1); $$ = $3; }
1091 : "throw" Expression Terminator { $$ = new(driver.pool_) CYThrow($2); }
1095 : "try" Block CatchOpt FinallyOpt { $$ = new(driver.pool_) CYTry($2, $3, $4); }
1099 : "catch" "(" Identifier ")" Block { $$ = new(driver.pool_) CYCatch($3, $5); }
1104 : "finally" Block { $$ = $2; }
1109 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunction($2, $4, $7); }
1113 : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYLambda($2, $4, $7); }
1116 FormalParameterList_
1117 : "," FormalParameterList { $$ = $2; }
1122 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYFunctionParameter($1, $2); }
1127 : SourceElements { $$ = $1; }
1131 : SourceElements { driver.source_ = $1; }
1135 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
1140 : Statement { $$ = $1; }
1141 | FunctionDeclaration { $$ = $1; }
1144 /* Objective-C Extensions {{{ */
1146 : ":" MemberExpressionNoBF { $$ = $2; }
1151 : "{" "}" { $$ = NULL; }
1155 : "+" { $$ = false; }
1156 | "-" { $$ = true; }
1160 : "(" Expression ")" { $$ = $2; }
1165 : Word ":" TypeOpt Identifier { $$ = new CYMessageParameter($1, $3, $4); }
1168 MessageParameterListOpt
1169 : MessageParameterList { $$ = $1; }
1173 MessageParameterList
1174 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1178 : MessageParameterList { $$ = $1; }
1179 | Word { $$ = new CYMessageParameter($1, NULL, NULL); }
1182 ClassMessageDeclaration
1183 : MessageScope TypeOpt MessageParameters "{" FunctionBody "}" { $$ = new CYMessage($1, $2, $3, $5); }
1186 ClassMessageDeclarationListOpt
1187 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1192 : "@class" Identifier ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new CYClass($2, $3, $4, $5); }
1196 : ClassDeclaration { $$ = $1; }
1200 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1205 : SelectorCall { $$ = $1; }
1206 | VariadicCall { $$ = $1; }
1210 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1214 : SelectorCall { $$ = $1; }
1215 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1219 : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYSend($2, $3); }
1222 SelectorExpressionOpt
1223 : SelectorExpression_ { $$ = $1; }
1228 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
1232 : SelectorExpression_ { $$ = $1; }
1233 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
1237 : MessageExpression { $$ = $1; }
1238 | "@selector" "(" SelectorExpression ")" { $$ = new CYSelector($3); }
1242 LeftHandSideExpression_
1243 : "*" LeftHandSideExpression { $$ = new(driver.pool_) CYIndirect($2); }
1247 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }