1 /* Cycript - Remove Execution Server and Disassembler
2 * Copyright (C) 2009 Jay Freeman (saurik)
5 /* Modified BSD License {{{ */
7 * Redistribution and use in source and binary
8 * forms, with or without modification, are permitted
9 * provided that the following conditions are met:
11 * 1. Redistributions of source code must retain the
12 * above copyright notice, this list of conditions
13 * and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the
15 * above copyright notice, this list of conditions
16 * and the following disclaimer in the documentation
17 * and/or other materials provided with the
19 * 3. The name of the author may not be used to endorse
20 * or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
25 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
34 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 #include "Cycript.tab.hh"
42 #define scanner driver.scanner_
43 #define YYSTACKEXPANDABLE 1
55 CYDriver::Condition condition_;
57 CYArgument *argument_;
58 CYAssignment *assignment_;
62 CYClassName *className_;
63 CYComprehension *comprehension_;
64 CYCompound *compound_;
65 CYDeclaration *declaration_;
66 CYDeclarations *declarations_;
68 CYExpression *expression_;
72 CYForInitialiser *for_;
73 CYForInInitialiser *forin_;
74 CYFunctionParameter *functionParameter_;
75 CYIdentifier *identifier_;
80 CYMessageParameter *messageParameter_;
83 CYProperty *property_;
84 CYPropertyName *propertyName_;
85 CYSelectorPart *selector_;
86 CYStatement *statement_;
97 int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner);
106 @$.begin.filename = @$.end.filename = &driver.filename_;
116 %parse-param { CYDriver &driver }
117 %lex-param { void *scanner }
122 %token AmpersandAmpersand "&&"
123 %token AmpersandEqual "&="
125 %token CarrotEqual "^="
127 %token EqualEqual "=="
128 %token EqualEqualEqual "==="
129 %token Exclamation "!"
130 %token ExclamationEqual "!="
131 %token ExclamationEqualEqual "!=="
133 %token HyphenEqual "-="
134 %token HyphenHyphen "--"
135 %token HyphenHyphen_ "\n--"
136 %token HyphenRight "->"
138 %token LeftEqual "<="
140 %token LeftLeftEqual "<<="
142 %token PercentEqual "%="
145 %token PipeEqual "|="
148 %token PlusEqual "+="
150 %token PlusPlus_ "\n++"
152 %token RightEqual ">="
153 %token RightRight ">>"
154 %token RightRightEqual ">>="
155 %token RightRightRight ">>>"
156 %token RightRightRightEqual ">>>="
158 %token SlashEqual "/="
160 %token StarEqual "*="
170 %token CloseParen ")"
173 %token CloseBrace "}"
175 %token OpenBracket "["
176 %token CloseBracket "]"
178 %token AtClass "@class"
179 %token AtSelector "@selector"
182 %token <false_> False "false"
183 %token <null_> Null "null"
184 %token <true_> True "true"
186 // ES3/ES5/WIE/JSC Reserved
187 %token <word_> Break "break"
188 %token <word_> Case "case"
189 %token <word_> Catch "catch"
190 %token <word_> Continue "continue"
191 %token <word_> Default "default"
192 %token <word_> Delete "delete"
193 %token <word_> Do "do"
194 %token <word_> Else "else"
195 %token <word_> Finally "finally"
196 %token <word_> For "for"
197 %token <word_> Function "function"
198 %token <word_> If "if"
199 %token <word_> In "in"
200 %token <word_> InstanceOf "instanceof"
201 %token <word_> New "new"
202 %token <word_> Return "return"
203 %token <word_> Switch "switch"
204 %token <this_> This "this"
205 %token <word_> Throw "throw"
206 %token <word_> Try "try"
207 %token <word_> TypeOf "typeof"
208 %token <word_> Var "var"
209 %token <word_> Void "void"
210 %token <word_> While "while"
211 %token <word_> With "with"
213 // ES3/IE6 Future, ES5/JSC Reserved
214 %token <word_> Debugger "debugger"
216 // ES3/ES5/IE6 Future, JSC Reserved
217 %token <word_> Const "const"
219 // ES3/ES5/IE6/JSC Future
220 %token <word_> Class "class"
221 %token <word_> Enum "enum"
222 %token <word_> Export "export"
223 %token <word_> Extends "extends"
224 %token <word_> Import "import"
225 %token <word_> Super "super"
227 // ES3 Future, ES5 Strict Future
228 %token <identifier_> Implements "implements"
229 %token <identifier_> Interface "interface"
230 %token <identifier_> Package "package"
231 %token <identifier_> Private "private"
232 %token <identifier_> Protected "protected"
233 %token <identifier_> Public "public"
234 %token <identifier_> Static "static"
237 %token <identifier_> Abstract "abstract"
238 %token <identifier_> Boolean "boolean"
239 %token <identifier_> Byte "byte"
240 %token <identifier_> Char "char"
241 %token <identifier_> Double "double"
242 %token <identifier_> Final "final"
243 %token <identifier_> Float "float"
244 %token <identifier_> Goto "goto"
245 %token <identifier_> Int "int"
246 %token <identifier_> Long "long"
247 %token <identifier_> Native "native"
248 %token <identifier_> Short "short"
249 %token <identifier_> Synchronized "synchronized"
250 %token <identifier_> Throws "throws"
251 %token <identifier_> Transient "transient"
252 %token <identifier_> Volatile "volatile"
255 %token <identifier_> Let "let"
256 %token <identifier_> Yield "yield"
259 %token <identifier_> Each "each"
261 %token <identifier_> Identifier_
262 %token <number_> NumericLiteral
263 %token <string_> StringLiteral
264 %token <literal_> RegularExpressionLiteral
266 %type <expression_> AdditiveExpression
267 %type <expression_> AdditiveExpressionNoBF
268 %type <argument_> ArgumentList
269 %type <argument_> ArgumentList_
270 %type <argument_> ArgumentListOpt
271 %type <argument_> Arguments
272 %type <literal_> ArrayLiteral
273 %type <expression_> AssigneeExpression
274 %type <expression_> AssigneeExpression_
275 %type <expression_> AssigneeExpressionNoBF
276 %type <expression_> AssignmentExpression
277 %type <assignment_> AssignmentExpression_
278 %type <expression_> AssignmentExpressionNoBF
279 %type <expression_> AssignmentExpressionNoIn
280 %type <expression_> BitwiseANDExpression
281 %type <expression_> BitwiseANDExpressionNoBF
282 %type <expression_> BitwiseANDExpressionNoIn
283 %type <statement_> Block
284 %type <statement_> Block_
285 %type <boolean_> BooleanLiteral
286 %type <expression_> BitwiseORExpression
287 %type <expression_> BitwiseORExpressionNoBF
288 %type <expression_> BitwiseORExpressionNoIn
289 %type <expression_> BitwiseXORExpression
290 %type <expression_> BitwiseXORExpressionNoBF
291 %type <expression_> BitwiseXORExpressionNoIn
292 %type <statement_> BreakStatement
293 %type <expression_> CallExpression
294 %type <expression_> CallExpressionNoBF
295 %type <clause_> CaseBlock
296 %type <clause_> CaseClause
297 %type <clause_> CaseClausesOpt
298 %type <catch_> CatchOpt
299 %type <statement_> CategoryStatement
300 %type <expression_> ClassExpression
301 %type <message_> ClassMessageDeclaration
302 %type <message_> ClassMessageDeclarationListOpt
303 %type <className_> ClassName
304 %type <className_> ClassNameOpt
305 %type <statement_> ClassStatement
306 %type <expression_> ClassSuperOpt
307 %type <field_> ClassFieldList
308 %type <comprehension_> ComprehensionList
309 %type <comprehension_> ComprehensionListOpt
310 %type <expression_> ConditionalExpression
311 %type <expression_> ConditionalExpressionNoBF
312 %type <expression_> ConditionalExpressionNoIn
313 %type <statement_> ContinueStatement
314 %type <clause_> DefaultClause
315 %type <statement_> DoWhileStatement
316 %type <expression_> Element
317 %type <expression_> ElementOpt
318 %type <element_> ElementList
319 %type <element_> ElementListOpt
320 %type <statement_> ElseStatementOpt
321 %type <statement_> EmptyStatement
322 %type <expression_> EqualityExpression
323 %type <expression_> EqualityExpressionNoBF
324 %type <expression_> EqualityExpressionNoIn
325 %type <expression_> Expression
326 %type <expression_> ExpressionOpt
327 %type <compound_> Expression_
328 %type <expression_> ExpressionNoBF
329 %type <expression_> ExpressionNoIn
330 %type <compound_> ExpressionNoIn_
331 %type <expression_> ExpressionNoInOpt
332 %type <statement_> ExpressionStatement
333 %type <finally_> FinallyOpt
334 %type <comprehension_> ForComprehension
335 %type <statement_> ForStatement
336 %type <for_> ForStatementInitialiser
337 %type <statement_> ForInStatement
338 %type <forin_> ForInStatementInitialiser
339 %type <functionParameter_> FormalParameterList
340 %type <functionParameter_> FormalParameterList_
341 %type <statement_> FunctionBody
342 %type <statement_> FunctionDeclaration
343 %type <expression_> FunctionExpression
344 %type <identifier_> Identifier
345 %type <identifier_> IdentifierOpt
346 %type <comprehension_> IfComprehension
347 %type <statement_> IfStatement
348 %type <expression_> Initialiser
349 %type <expression_> InitialiserOpt
350 %type <expression_> InitialiserNoIn
351 %type <expression_> InitialiserNoInOpt
352 %type <statement_> IterationStatement
353 %type <statement_> LabelledStatement
354 %type <expression_> LeftHandSideExpression
355 %type <expression_> LeftHandSideExpressionNoBF
356 //%type <statement_> LetStatement
357 %type <literal_> Literal
358 %type <expression_> LogicalANDExpression
359 %type <expression_> LogicalANDExpressionNoBF
360 %type <expression_> LogicalANDExpressionNoIn
361 %type <expression_> LogicalORExpression
362 %type <expression_> LogicalORExpressionNoBF
363 %type <expression_> LogicalORExpressionNoIn
364 %type <member_> MemberAccess
365 %type <expression_> MemberExpression
366 %type <expression_> MemberExpression_
367 %type <expression_> MemberExpressionNoBF
368 %type <messageParameter_> MessageParameter
369 %type <messageParameter_> MessageParameters
370 %type <messageParameter_> MessageParameterList
371 %type <messageParameter_> MessageParameterListOpt
372 %type <bool_> MessageScope
373 %type <expression_> MultiplicativeExpression
374 %type <expression_> MultiplicativeExpressionNoBF
375 %type <expression_> NewExpression
376 %type <expression_> NewExpression_
377 %type <expression_> NewExpressionNoBF
378 %type <null_> NullLiteral
379 %type <literal_> ObjectLiteral
380 %type <expression_> PostfixExpression
381 %type <expression_> PostfixExpressionNoBF
382 %type <expression_> PrimaryExpression
383 %type <expression_> PrimaryExpression_
384 %type <expression_> PrimaryExpressionNoBF
385 %type <statement_> Program
386 %type <propertyName_> PropertyName
387 %type <property_> PropertyNameAndValueList
388 %type <property_> PropertyNameAndValueList_
389 %type <property_> PropertyNameAndValueListOpt
390 %type <literal_> RegularExpressionLiteral_
391 %type <condition_> RegularExpressionToken
392 %type <expression_> RelationalExpression
393 %type <infix_> RelationalExpression_
394 %type <expression_> RelationalExpressionNoBF
395 %type <expression_> RelationalExpressionNoIn
396 %type <infix_> RelationalExpressionNoIn_
397 %type <statement_> ReturnStatement
398 %type <selector_> SelectorExpression
399 %type <selector_> SelectorExpression_
400 %type <selector_> SelectorExpressionOpt
401 %type <expression_> ShiftExpression
402 %type <expression_> ShiftExpressionNoBF
403 %type <statement_> SourceElement
404 %type <statement_> SourceElements
405 %type <statement_> Statement
406 %type <statement_> Statement_
407 %type <statement_> StatementList
408 %type <statement_> StatementListOpt
409 %type <statement_> SwitchStatement
410 %type <statement_> ThrowStatement
411 %type <statement_> TryStatement
412 %type <expression_> TypeOpt
413 %type <expression_> UnaryExpression
414 %type <expression_> UnaryExpression_
415 %type <expression_> UnaryExpressionNoBF
416 %type <declaration_> VariableDeclaration
417 %type <declaration_> VariableDeclarationNoIn
418 %type <declarations_> VariableDeclarationList
419 %type <declarations_> VariableDeclarationList_
420 %type <declarations_> VariableDeclarationListNoIn
421 %type <declarations_> VariableDeclarationListNoIn_
422 %type <statement_> VariableStatement
423 %type <statement_> WhileStatement
424 %type <statement_> WithStatement
426 %type <word_> WordOpt
428 %type <expression_> MessageExpression
429 %type <argument_> SelectorCall
430 %type <argument_> SelectorCall_
431 %type <argument_> SelectorList
432 %type <argument_> VariadicCall
436 %left "<<" ">>" ">>>"
437 %left "<" ">" "<=" ">=" "instanceof" "in"
438 %left "==" "!=" "===" "!=="
445 %right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
455 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
465 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
470 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
489 : Identifier { $$ = $1; }
490 | "break" NewLineOpt { $$ = $1; }
491 | "case" { $$ = $1; }
492 | "catch" { $$ = $1; }
493 | "class" { $$ = $1; }
494 | "const" { $$ = $1; }
495 | "continue" NewLineOpt { $$ = $1; }
496 | "debugger" { $$ = $1; }
497 | "default" { $$ = $1; }
498 | "delete" { $$ = $1; }
500 | "else" { $$ = $1; }
501 | "enum" { $$ = $1; }
502 | "export" { $$ = $1; }
503 | "extends" { $$ = $1; }
504 | "false" { $$ = $1; }
505 | "finally" { $$ = $1; }
507 | "function" { $$ = $1; }
509 | "import" { $$ = $1; }
510 /* XXX: | "in" { $$ = $1; } */
511 /* XXX: | "instanceof" { $$ = $1; } */
513 | "null" { $$ = $1; }
514 | "return" NewLineOpt { $$ = $1; }
515 | "super" { $$ = $1; }
516 | "switch" { $$ = $1; }
517 | "this" { $$ = $1; }
518 | "throw" NewLineOpt { $$ = $1; }
519 | "true" { $$ = $1; }
521 | "typeof" { $$ = $1; }
523 | "void" { $$ = $1; }
524 | "while" { $$ = $1; }
525 | "with" { $$ = $1; }
529 : Identifier_ { $$ = $1; }
531 | "implements" { $$ = $1; }
532 | "interface" { $$ = $1; }
533 | "package" { $$ = $1; }
534 | "private" { $$ = $1; }
535 | "protected" { $$ = $1; }
536 | "public" { $$ = $1; }
537 | "static" { $$ = $1; }
539 | "abstract" { $$ = $1; }
540 | "boolean" { $$ = $1; }
541 | "byte" { $$ = $1; }
542 | "char" { $$ = $1; }
543 | "double" { $$ = $1; }
544 | "final" { $$ = $1; }
545 | "float" { $$ = $1; }
546 | "goto" { $$ = $1; }
548 | "long" { $$ = $1; }
549 | "native" { $$ = $1; }
550 | "short" { $$ = $1; }
551 | "synchronized" { $$ = $1; }
552 | "throws" { $$ = $1; }
553 | "transient" { $$ = $1; }
554 | "volatile" { $$ = $1; }
557 | "yield" { $$ = $1; }
559 | "each" { $$ = $1; }
563 : Identifier { $$ = $1; }
567 RegularExpressionToken
568 : "/" { $$ = CYDriver::RegExStart; }
569 | "/=" { $$ = CYDriver::RegExRest; }
572 RegularExpressionLiteral_
573 : RegularExpressionToken { driver.SetCondition($1); } RegularExpressionLiteral { $$ = $3; }
577 : NullLiteral { $$ = $1; }
578 | BooleanLiteral { $$ = $1; }
579 | NumericLiteral { $$ = $1; }
580 | StringLiteral { $$ = $1; }
581 | RegularExpressionLiteral_ { $$ = $1; }
585 : "null" { $$ = $1; }
589 : "true" { $$ = $1; }
590 | "false" { $$ = $1; }
593 /* 11.1 Primary Expressions {{{ */
595 : "this" { $$ = $1; }
596 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
597 | Literal { $$ = $1; }
598 | ArrayLiteral { $$ = $1; }
599 | "(" Expression ")" { $$ = $2; }
603 : ObjectLiteral { $$ = $1; }
604 | PrimaryExpression_ { $$ = $1; }
607 PrimaryExpressionNoBF
608 : PrimaryExpression_ { $$ = $1; }
611 /* 11.1.4 Array Initialiser {{{ */
613 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
617 : AssignmentExpression { $$ = $1; }
621 : Element { $$ = $1; }
626 : ElementList { $$ = $1; }
631 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
632 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
635 /* 11.1.5 Object Initialiser {{{ */
637 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
640 PropertyNameAndValueList_
641 : "," PropertyNameAndValueList { $$ = $2; }
645 PropertyNameAndValueListOpt
646 : PropertyNameAndValueList { $$ = $1; }
650 PropertyNameAndValueList
651 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
655 : Identifier { $$ = $1; }
656 | StringLiteral { $$ = $1; }
657 | NumericLiteral { $$ = $1; }
661 /* 11.2 Left-Hand-Side Expressions {{{ */
663 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
667 : "[" Expression "]" { $$ = new(driver.pool_) CYDirectMember(NULL, $2); }
668 | "." Identifier { $$ = new(driver.pool_) CYDirectMember(NULL, new(driver.pool_) CYString($2)); }
672 : PrimaryExpression { $$ = $1; }
673 | FunctionExpression { $$ = $1; }
674 | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
675 | MemberExpression_ { $$ = $1; }
679 : PrimaryExpressionNoBF { $$ = $1; }
680 | MemberExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
681 | MemberExpression_ { $$ = $1; }
685 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
689 : MemberExpression { $$ = $1; }
690 | NewExpression_ { $$ = $1; }
694 : MemberExpressionNoBF { $$ = $1; }
695 | NewExpression_ { $$ = $1; }
699 : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
700 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
701 | CallExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
705 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
706 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
707 | CallExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
711 : "," ArgumentList { $$ = $2; }
716 : ArgumentList { $$ = $1; }
721 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
725 : "(" ArgumentListOpt ")" { $$ = $2; }
728 LeftHandSideExpression
729 : NewExpression { $$ = $1; }
730 | CallExpression { $$ = $1; }
733 LeftHandSideExpressionNoBF
734 : NewExpressionNoBF { $$ = $1; }
735 | CallExpressionNoBF { $$ = $1; }
738 /* 11.3 Postfix Expressions {{{ */
740 : AssigneeExpression { $$ = $1; }
741 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
742 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
745 PostfixExpressionNoBF
746 : AssigneeExpressionNoBF { $$ = $1; }
747 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
748 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
751 /* 11.4 Unary Operators {{{ */
753 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
754 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
755 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
756 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
757 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
758 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
759 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
760 | "+" UnaryExpression { $$ = new(driver.pool_) CYAffirm($2); }
761 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
762 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
763 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
767 : PostfixExpression { $$ = $1; }
768 | UnaryExpression_ { $$ = $1; }
772 : PostfixExpressionNoBF { $$ = $1; }
773 | UnaryExpression_ { $$ = $1; }
776 /* 11.5 Multiplicative Operators {{{ */
777 MultiplicativeExpression
778 : UnaryExpression { $$ = $1; }
779 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
780 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
781 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
784 MultiplicativeExpressionNoBF
785 : UnaryExpressionNoBF { $$ = $1; }
786 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
787 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
788 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
791 /* 11.6 Additive Operators {{{ */
793 : MultiplicativeExpression { $$ = $1; }
794 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
795 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
798 AdditiveExpressionNoBF
799 : MultiplicativeExpressionNoBF { $$ = $1; }
800 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
801 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
804 /* 11.7 Bitwise Shift Operators {{{ */
806 : AdditiveExpression { $$ = $1; }
807 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
808 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
809 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
813 : AdditiveExpressionNoBF { $$ = $1; }
814 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
815 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
816 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
819 /* 11.8 Relational Operators {{{ */
820 RelationalExpressionNoIn_
821 : "<" ShiftExpression { $$ = new(driver.pool_) CYLess(NULL, $2); }
822 | ">" ShiftExpression { $$ = new(driver.pool_) CYGreater(NULL, $2); }
823 | "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual(NULL, $2); }
824 | ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual(NULL, $2); }
825 | "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf(NULL, $2); }
828 RelationalExpression_
829 : RelationalExpressionNoIn_ { $$ = $1; }
830 | "in" ShiftExpression { $$ = new(driver.pool_) CYIn(NULL, $2); }
834 : ShiftExpression { $$ = $1; }
835 | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
838 RelationalExpressionNoIn
839 : ShiftExpression { $$ = $1; }
840 | RelationalExpressionNoIn RelationalExpressionNoIn_ { $2->SetLeft($1); $$ = $2; }
843 RelationalExpressionNoBF
844 : ShiftExpressionNoBF { $$ = $1; }
845 | RelationalExpressionNoBF RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
848 /* 11.9 Equality Operators {{{ */
850 : RelationalExpression { $$ = $1; }
851 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
852 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
853 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
854 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
857 EqualityExpressionNoIn
858 : RelationalExpressionNoIn { $$ = $1; }
859 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
860 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
861 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
862 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
865 EqualityExpressionNoBF
866 : RelationalExpressionNoBF { $$ = $1; }
867 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
868 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
869 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
870 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
873 /* 11.10 Binary Bitwise Operators {{{ */
875 : EqualityExpression { $$ = $1; }
876 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
879 BitwiseANDExpressionNoIn
880 : EqualityExpressionNoIn { $$ = $1; }
881 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
884 BitwiseANDExpressionNoBF
885 : EqualityExpressionNoBF { $$ = $1; }
886 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
890 : BitwiseANDExpression { $$ = $1; }
891 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
894 BitwiseXORExpressionNoIn
895 : BitwiseANDExpressionNoIn { $$ = $1; }
896 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
899 BitwiseXORExpressionNoBF
900 : BitwiseANDExpressionNoBF { $$ = $1; }
901 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
905 : BitwiseXORExpression { $$ = $1; }
906 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
909 BitwiseORExpressionNoIn
910 : BitwiseXORExpressionNoIn { $$ = $1; }
911 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
914 BitwiseORExpressionNoBF
915 : BitwiseXORExpressionNoBF { $$ = $1; }
916 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
919 /* 11.11 Binary Logical Operators {{{ */
921 : BitwiseORExpression { $$ = $1; }
922 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
925 LogicalANDExpressionNoIn
926 : BitwiseORExpressionNoIn { $$ = $1; }
927 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
930 LogicalANDExpressionNoBF
931 : BitwiseORExpressionNoBF { $$ = $1; }
932 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
936 : LogicalANDExpression { $$ = $1; }
937 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
940 LogicalORExpressionNoIn
941 : LogicalANDExpressionNoIn { $$ = $1; }
942 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
945 LogicalORExpressionNoBF
946 : LogicalANDExpressionNoBF { $$ = $1; }
947 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
950 /* 11.12 Conditional Operator ( ? : ) {{{ */
951 ConditionalExpression
952 : LogicalORExpression { $$ = $1; }
953 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
956 ConditionalExpressionNoIn
957 : LogicalORExpressionNoIn { $$ = $1; }
958 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
961 ConditionalExpressionNoBF
962 : LogicalORExpressionNoBF { $$ = $1; }
963 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
966 /* 11.13 Assignment Operators {{{ */
967 AssignmentExpression_
968 : "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign(NULL, $2); }
969 | "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign(NULL, $2); }
970 | "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign(NULL, $2); }
971 | "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign(NULL, $2); }
972 | "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign(NULL, $2); }
973 | "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign(NULL, $2); }
974 | "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign(NULL, $2); }
975 | ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign(NULL, $2); }
976 | ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign(NULL, $2); }
977 | "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign(NULL, $2); }
978 | "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign(NULL, $2); }
979 | "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign(NULL, $2); }
983 : LeftHandSideExpression { $$ = $1; }
984 | AssigneeExpression_ { $$ = $1; }
987 AssigneeExpressionNoBF
988 : LeftHandSideExpressionNoBF { $$ = $1; }
989 | AssigneeExpression_ { $$ = $1; }
993 : ConditionalExpression { $$ = $1; }
994 | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
997 AssignmentExpressionNoIn
998 : ConditionalExpressionNoIn { $$ = $1; }
999 | AssigneeExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
1000 | AssigneeExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
1001 | AssigneeExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
1002 | AssigneeExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
1003 | AssigneeExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
1004 | AssigneeExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
1005 | AssigneeExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
1006 | AssigneeExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
1007 | AssigneeExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
1008 | AssigneeExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
1009 | AssigneeExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
1010 | AssigneeExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
1013 AssignmentExpressionNoBF
1014 : ConditionalExpressionNoBF { $$ = $1; }
1015 | AssigneeExpressionNoBF AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1018 /* 11.14 Comma Operator {{{ */
1020 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
1025 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
1030 : Expression { $$ = $1; }
1035 : ExpressionNoIn { $$ = $1; }
1040 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1044 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1048 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1052 /* 12 Statements {{{ */
1054 : Block { $$ = $1; }
1055 | VariableStatement { $$ = $1; }
1056 | EmptyStatement { $$ = $1; }
1057 | ExpressionStatement { $$ = $1; }
1058 | IfStatement { $$ = $1; }
1059 | IterationStatement { $$ = $1; }
1060 | ContinueStatement { $$ = $1; }
1061 | BreakStatement { $$ = $1; }
1062 | ReturnStatement { $$ = $1; }
1063 | WithStatement { $$ = $1; }
1064 | LabelledStatement { $$ = $1; }
1065 | SwitchStatement { $$ = $1; }
1066 | ThrowStatement { $$ = $1; }
1067 | TryStatement { $$ = $1; }
1071 : Statement_ { $$ = $1; }
1074 /* 12.1 Block {{{ */
1076 : "{" StatementListOpt "}" { $$ = $2; }
1080 : Block_ { if ($1) $$ = new(driver.pool_) CYBlock($1); else $$ = new(driver.pool_) CYEmpty(); }
1084 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
1088 : StatementList { $$ = $1; }
1092 /* 12.2 Variable Statement {{{ */
1094 : "var" VariableDeclarationList Terminator { $$ = new(driver.pool_) CYVar($2); }
1097 VariableDeclarationList_
1098 : "," VariableDeclarationList { $$ = $2; }
1102 VariableDeclarationListNoIn_
1103 : "," VariableDeclarationListNoIn { $$ = $2; }
1107 VariableDeclarationList
1108 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1111 VariableDeclarationListNoIn
1112 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1116 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1119 VariableDeclarationNoIn
1120 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1124 : Initialiser { $$ = $1; }
1129 : InitialiserNoIn { $$ = $1; }
1134 : "=" AssignmentExpression { $$ = $2; }
1138 : "=" AssignmentExpressionNoIn { $$ = $2; }
1141 /* 12.3 Empty Statement {{{ */
1143 : ";" { $$ = new(driver.pool_) CYEmpty(); }
1146 /* 12.4 Expression Statement {{{ */
1148 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
1151 /* 12.5 The if Statement {{{ */
1153 : "else" Statement { $$ = $2; }
1154 | %prec "if" { $$ = NULL; }
1158 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1162 /* 12.6 Iteration Statements {{{ */
1164 : DoWhileStatement { $$ = $1; }
1165 | WhileStatement { $$ = $1; }
1166 | ForStatement { $$ = $1; }
1167 | ForInStatement { $$ = $1; }
1170 /* 12.6.1 The do-while Statement {{{ */
1172 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1175 /* 12.6.2 The while Statement {{{ */
1177 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1180 /* 12.6.3 The for Statement {{{ */
1182 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1185 ForStatementInitialiser
1186 : ExpressionNoInOpt { $$ = $1; }
1187 | "var" VariableDeclarationListNoIn { $$ = $2; }
1190 /* 12.6.4 The for-in Statement {{{ */
1192 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1195 ForInStatementInitialiser
1196 : LeftHandSideExpression { $$ = $1; }
1197 | "var" VariableDeclarationNoIn { $$ = $2; }
1201 /* 12.7 The continue Statement {{{ */
1203 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1206 /* 12.8 The break Statement {{{ */
1208 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1211 /* 12.9 The return Statement {{{ */
1213 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1216 /* 12.10 The with Statement {{{ */
1218 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1222 /* 12.11 The switch Statement {{{ */
1224 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1228 : "{" CaseClausesOpt "}" { $$ = $2; }
1232 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1233 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1238 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1242 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1245 /* 12.12 Labelled Statements {{{ */
1247 : Identifier ":" Statement { $3->AddLabel($1); $$ = $3; }
1250 /* 12.13 The throw Statement {{{ */
1252 : "throw" Expression Terminator { $$ = new(driver.pool_) CYThrow($2); }
1255 /* 12.14 The try Statement {{{ */
1257 : "try" Block_ CatchOpt FinallyOpt { $$ = new(driver.pool_) CYTry($2, $3, $4); }
1261 : "catch" "(" Identifier ")" Block_ { $$ = new(driver.pool_) CYCatch($3, $5); }
1266 : "finally" Block_ { $$ = new(driver.pool_) CYFinally($2); }
1271 /* 13 Function Definition {{{ */
1273 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionStatement($2, $4, $7); }
1277 : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($2, $4, $7); }
1280 FormalParameterList_
1281 : "," FormalParameterList { $$ = $2; }
1286 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYFunctionParameter($1, $2); }
1291 : SourceElements { $$ = $1; }
1294 /* 14 Program {{{ */
1296 : SourceElements { driver.program_ = $1; }
1300 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
1305 : Statement_ { $$ = $1; }
1306 | FunctionDeclaration { $$ = $1; }
1310 /* Cycript: @class Declaration {{{ */
1312 : ":" MemberExpressionNoBF { $$ = $2; }
1317 : "{" "}" { $$ = NULL; }
1321 : "+" { $$ = false; }
1322 | "-" { $$ = true; }
1326 : "(" Expression ")" { $$ = $2; }
1331 : Word ":" TypeOpt Identifier { $$ = new(driver.pool_) CYMessageParameter($1, $3, $4); }
1334 MessageParameterListOpt
1335 : MessageParameterList { $$ = $1; }
1339 MessageParameterList
1340 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1344 : MessageParameterList { $$ = $1; }
1345 | Word { $$ = new(driver.pool_) CYMessageParameter($1, NULL, NULL); }
1348 ClassMessageDeclaration
1349 : MessageScope TypeOpt MessageParameters "{" FunctionBody "}" { $$ = new(driver.pool_) CYMessage($1, $2, $3, $5); }
1352 ClassMessageDeclarationListOpt
1353 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1358 : Identifier { $$ = $1; }
1359 | "(" AssignmentExpression ")" { $$ = $2; }
1363 : ClassName { $$ = $1; }
1368 : "@class" ClassNameOpt ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5); }
1372 : "@class" ClassName ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5); }
1376 : "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $3); }
1380 : ClassExpression { $$ = $1; }
1384 : ClassStatement { $$ = $1; }
1385 | CategoryStatement { $$ = $1; }
1388 /* Cycript: Send Message {{{ */
1390 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1395 : SelectorCall { $$ = $1; }
1396 | VariadicCall { $$ = $1; }
1400 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1404 : SelectorCall { $$ = $1; }
1405 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1409 : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYSend($2, $3); }
1412 SelectorExpressionOpt
1413 : SelectorExpression_ { $$ = $1; }
1418 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
1422 : SelectorExpression_ { $$ = $1; }
1423 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
1427 : MessageExpression { $$ = $1; }
1428 | "@selector" "(" SelectorExpression ")" { $$ = new(driver.pool_) CYSelector($3); }
1431 /* Cycript: Pointer Indirection/Addressing {{{ */
1433 : "*" UnaryExpression { $$ = new(driver.pool_) CYIndirect($2); }
1437 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }
1441 : "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
1444 /* ECMAScript5: Object Literal Trailing Comma {{{ */
1445 PropertyNameAndValueList_
1446 : "," { $$ = NULL; }
1449 /* JavaScript 1.7: Array Comprehensions {{{ */
1451 : "if" "(" Expression ")" { $$ = new(driver.pool_) CYIfComprehension($3); }
1455 : "for" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForInComprehension($3, $5); }
1456 | "for" "each" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForEachInComprehension($4, $6); }
1459 ComprehensionListOpt
1460 : ComprehensionList { $$ = $1; }
1461 | IfComprehension { $$ = $1; }
1466 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1470 : "[" AssignmentExpression ComprehensionList "]" { $$ = new(driver.pool_) CYArrayComprehension($2, $3); }
1473 /* JavaScript 1.7: for each {{{ */
1475 : "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForEachIn($4, $6, $8); }
1478 /* JavaScript 1.7: let Statements {{{ *//*
1480 : "let" "(" VariableDeclarationList ")" Block_ { $$ = new(driver.pool_) CYLet($3, $5); }
1487 /* JavaScript FTW: Function Statements {{{ */
1489 : FunctionDeclaration { driver.Warning(yylloc, "warning, FunctionDeclaration is a SourceElement, not a Statement"); } { $$ = $1; }