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 }
120 %token AmpersandAmpersand "&&"
121 %token AmpersandEqual "&="
123 %token CarrotEqual "^="
125 %token EqualEqual "=="
126 %token EqualEqualEqual "==="
127 %token Exclamation "!"
128 %token ExclamationEqual "!="
129 %token ExclamationEqualEqual "!=="
131 %token HyphenEqual "-="
132 %token HyphenHyphen "--"
133 %token HyphenHyphen_ "\n--"
134 %token HyphenRight "->"
136 %token LeftEqual "<="
138 %token LeftLeftEqual "<<="
140 %token PercentEqual "%="
143 %token PipeEqual "|="
146 %token PlusEqual "+="
148 %token PlusPlus_ "\n++"
150 %token RightEqual ">="
151 %token RightRight ">>"
152 %token RightRightEqual ">>="
153 %token RightRightRight ">>>"
154 %token RightRightRightEqual ">>>="
156 %token SlashEqual "/="
158 %token StarEqual "*="
168 %token CloseParen ")"
171 %token CloseBrace "}"
173 %token OpenBracket "["
174 %token CloseBracket "]"
176 %token AtClass "@class"
177 %token AtSelector "@selector"
180 %token <false_> False "false"
181 %token <null_> Null "null"
182 %token <true_> True "true"
184 // ES3/ES5/WIE/JSC Reserved
185 %token <word_> Break "break"
186 %token <word_> Case "case"
187 %token <word_> Catch "catch"
188 %token <word_> Continue "continue"
189 %token <word_> Default "default"
190 %token <word_> Delete "delete"
191 %token <word_> Do "do"
192 %token <word_> Else "else"
193 %token <word_> Finally "finally"
194 %token <word_> For "for"
195 %token <word_> Function "function"
196 %token <word_> If "if"
197 %token <word_> In "in"
198 %token <word_> InstanceOf "instanceof"
199 %token <word_> New "new"
200 %token <word_> Return "return"
201 %token <word_> Switch "switch"
202 %token <this_> This "this"
203 %token <word_> Throw "throw"
204 %token <word_> Try "try"
205 %token <word_> TypeOf "typeof"
206 %token <word_> Var "var"
207 %token <word_> Void "void"
208 %token <word_> While "while"
209 %token <word_> With "with"
211 // ES3/IE6 Future, ES5/JSC Reserved
212 %token <word_> Debugger "debugger"
214 // ES3/ES5/IE6 Future, JSC Reserved
215 %token <word_> Const "const"
217 // ES3/ES5/IE6/JSC Future
218 %token <word_> Class "class"
219 %token <word_> Enum "enum"
220 %token <word_> Export "export"
221 %token <word_> Extends "extends"
222 %token <word_> Import "import"
223 %token <word_> Super "super"
225 // ES3 Future, ES5 Strict Future
226 %token <identifier_> Implements "implements"
227 %token <identifier_> Interface "interface"
228 %token <identifier_> Package "package"
229 %token <identifier_> Private "private"
230 %token <identifier_> Protected "protected"
231 %token <identifier_> Public "public"
232 %token <identifier_> Static "static"
235 %token <identifier_> Abstract "abstract"
236 %token <identifier_> Boolean "boolean"
237 %token <identifier_> Byte "byte"
238 %token <identifier_> Char "char"
239 %token <identifier_> Double "double"
240 %token <identifier_> Final "final"
241 %token <identifier_> Float "float"
242 %token <identifier_> Goto "goto"
243 %token <identifier_> Int "int"
244 %token <identifier_> Long "long"
245 %token <identifier_> Native "native"
246 %token <identifier_> Short "short"
247 %token <identifier_> Synchronized "synchronized"
248 %token <identifier_> Throws "throws"
249 %token <identifier_> Transient "transient"
250 %token <identifier_> Volatile "volatile"
253 %token <identifier_> Let "let"
254 %token <identifier_> Yield "yield"
257 %token <identifier_> Each "each"
259 %token <identifier_> Identifier_
260 %token <number_> NumericLiteral
261 %token <string_> StringLiteral
262 %token <literal_> RegularExpressionLiteral
264 %type <expression_> AdditiveExpression
265 %type <expression_> AdditiveExpressionNoBF
266 %type <argument_> ArgumentList
267 %type <argument_> ArgumentList_
268 %type <argument_> ArgumentListOpt
269 %type <argument_> Arguments
270 %type <literal_> ArrayLiteral
271 %type <expression_> AssigneeExpression
272 %type <expression_> AssigneeExpression_
273 %type <expression_> AssigneeExpressionNoBF
274 %type <expression_> AssignmentExpression
275 %type <assignment_> AssignmentExpression_
276 %type <expression_> AssignmentExpressionNoBF
277 %type <expression_> AssignmentExpressionNoIn
278 %type <expression_> BitwiseANDExpression
279 %type <expression_> BitwiseANDExpressionNoBF
280 %type <expression_> BitwiseANDExpressionNoIn
281 %type <statement_> Block
282 %type <statement_> Block_
283 %type <boolean_> BooleanLiteral
284 %type <expression_> BitwiseORExpression
285 %type <expression_> BitwiseORExpressionNoBF
286 %type <expression_> BitwiseORExpressionNoIn
287 %type <expression_> BitwiseXORExpression
288 %type <expression_> BitwiseXORExpressionNoBF
289 %type <expression_> BitwiseXORExpressionNoIn
290 %type <statement_> BreakStatement
291 %type <expression_> CallExpression
292 %type <expression_> CallExpressionNoBF
293 %type <clause_> CaseBlock
294 %type <clause_> CaseClause
295 %type <clause_> CaseClausesOpt
296 %type <catch_> CatchOpt
297 %type <statement_> CategoryStatement
298 %type <expression_> ClassExpression
299 %type <message_> ClassMessageDeclaration
300 %type <message_> ClassMessageDeclarationListOpt
301 %type <className_> ClassName
302 %type <className_> ClassNameOpt
303 %type <statement_> ClassStatement
304 %type <expression_> ClassSuperOpt
305 %type <field_> ClassFieldList
306 %type <comprehension_> ComprehensionList
307 %type <comprehension_> ComprehensionListOpt
308 %type <expression_> ConditionalExpression
309 %type <expression_> ConditionalExpressionNoBF
310 %type <expression_> ConditionalExpressionNoIn
311 %type <statement_> ContinueStatement
312 %type <clause_> DefaultClause
313 %type <statement_> DoWhileStatement
314 %type <expression_> Element
315 %type <expression_> ElementOpt
316 %type <element_> ElementList
317 %type <element_> ElementListOpt
318 %type <statement_> ElseStatementOpt
319 %type <statement_> EmptyStatement
320 %type <expression_> EqualityExpression
321 %type <expression_> EqualityExpressionNoBF
322 %type <expression_> EqualityExpressionNoIn
323 %type <expression_> Expression
324 %type <expression_> ExpressionOpt
325 %type <compound_> Expression_
326 %type <expression_> ExpressionNoBF
327 %type <expression_> ExpressionNoIn
328 %type <compound_> ExpressionNoIn_
329 %type <expression_> ExpressionNoInOpt
330 %type <statement_> ExpressionStatement
331 %type <finally_> FinallyOpt
332 %type <comprehension_> ForComprehension
333 %type <statement_> ForStatement
334 %type <for_> ForStatementInitialiser
335 %type <statement_> ForInStatement
336 %type <forin_> ForInStatementInitialiser
337 %type <functionParameter_> FormalParameterList
338 %type <functionParameter_> FormalParameterList_
339 %type <statement_> FunctionBody
340 %type <statement_> FunctionDeclaration
341 %type <expression_> FunctionExpression
342 %type <identifier_> Identifier
343 %type <identifier_> IdentifierOpt
344 %type <comprehension_> IfComprehension
345 %type <statement_> IfStatement
346 %type <expression_> Initialiser
347 %type <expression_> InitialiserOpt
348 %type <expression_> InitialiserNoIn
349 %type <expression_> InitialiserNoInOpt
350 %type <statement_> IterationStatement
351 %type <statement_> LabelledStatement
352 %type <expression_> LeftHandSideExpression
353 %type <expression_> LeftHandSideExpressionNoBF
354 //%type <statement_> LetStatement
355 %type <literal_> Literal
356 %type <expression_> LogicalANDExpression
357 %type <expression_> LogicalANDExpressionNoBF
358 %type <expression_> LogicalANDExpressionNoIn
359 %type <expression_> LogicalORExpression
360 %type <expression_> LogicalORExpressionNoBF
361 %type <expression_> LogicalORExpressionNoIn
362 %type <member_> MemberAccess
363 %type <expression_> MemberExpression
364 %type <expression_> MemberExpression_
365 %type <expression_> MemberExpressionNoBF
366 %type <messageParameter_> MessageParameter
367 %type <messageParameter_> MessageParameters
368 %type <messageParameter_> MessageParameterList
369 %type <messageParameter_> MessageParameterListOpt
370 %type <bool_> MessageScope
371 %type <expression_> MultiplicativeExpression
372 %type <expression_> MultiplicativeExpressionNoBF
373 %type <expression_> NewExpression
374 %type <expression_> NewExpression_
375 %type <expression_> NewExpressionNoBF
376 %type <null_> NullLiteral
377 %type <literal_> ObjectLiteral
378 %type <expression_> PostfixExpression
379 %type <expression_> PostfixExpressionNoBF
380 %type <expression_> PrimaryExpression
381 %type <expression_> PrimaryExpression_
382 %type <expression_> PrimaryExpressionNoBF
383 %type <statement_> Program
384 %type <propertyName_> PropertyName
385 %type <property_> PropertyNameAndValueList
386 %type <property_> PropertyNameAndValueList_
387 %type <property_> PropertyNameAndValueListOpt
388 %type <literal_> RegularExpressionLiteral_
389 %type <condition_> RegularExpressionToken
390 %type <expression_> RelationalExpression
391 %type <infix_> RelationalExpression_
392 %type <expression_> RelationalExpressionNoBF
393 %type <expression_> RelationalExpressionNoIn
394 %type <infix_> RelationalExpressionNoIn_
395 %type <statement_> ReturnStatement
396 %type <selector_> SelectorExpression
397 %type <selector_> SelectorExpression_
398 %type <selector_> SelectorExpressionOpt
399 %type <expression_> ShiftExpression
400 %type <expression_> ShiftExpressionNoBF
401 %type <statement_> SourceElement
402 %type <statement_> SourceElements
403 %type <statement_> Statement
404 %type <statement_> Statement_
405 %type <statement_> StatementList
406 %type <statement_> StatementListOpt
407 %type <statement_> SwitchStatement
408 %type <statement_> ThrowStatement
409 %type <statement_> TryStatement
410 %type <expression_> TypeOpt
411 %type <expression_> UnaryExpression
412 %type <expression_> UnaryExpression_
413 %type <expression_> UnaryExpressionNoBF
414 %type <declaration_> VariableDeclaration
415 %type <declaration_> VariableDeclarationNoIn
416 %type <declarations_> VariableDeclarationList
417 %type <declarations_> VariableDeclarationList_
418 %type <declarations_> VariableDeclarationListNoIn
419 %type <declarations_> VariableDeclarationListNoIn_
420 %type <statement_> VariableStatement
421 %type <statement_> WhileStatement
422 %type <statement_> WithStatement
424 %type <word_> WordOpt
426 %type <expression_> MessageExpression
427 %type <argument_> SelectorCall
428 %type <argument_> SelectorCall_
429 %type <argument_> SelectorList
430 %type <argument_> VariadicCall
434 %left "<<" ">>" ">>>"
435 %left "<" ">" "<=" ">=" "instanceof" "in"
436 %left "==" "!=" "===" "!=="
443 %right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
453 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
463 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
468 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
487 : Identifier { $$ = $1; }
488 | "break" NewLineOpt { $$ = $1; }
489 | "case" { $$ = $1; }
490 | "catch" { $$ = $1; }
491 | "class" { $$ = $1; }
492 | "const" { $$ = $1; }
493 | "continue" NewLineOpt { $$ = $1; }
494 | "debugger" { $$ = $1; }
495 | "default" { $$ = $1; }
496 | "delete" { $$ = $1; }
498 | "else" { $$ = $1; }
499 | "enum" { $$ = $1; }
500 | "export" { $$ = $1; }
501 | "extends" { $$ = $1; }
502 | "false" { $$ = $1; }
503 | "finally" { $$ = $1; }
505 | "function" { $$ = $1; }
507 | "import" { $$ = $1; }
508 /* XXX: | "in" { $$ = $1; } */
509 /* XXX: | "instanceof" { $$ = $1; } */
511 | "null" { $$ = $1; }
512 | "return" NewLineOpt { $$ = $1; }
513 | "super" { $$ = $1; }
514 | "switch" { $$ = $1; }
515 | "this" { $$ = $1; }
516 | "throw" NewLineOpt { $$ = $1; }
517 | "true" { $$ = $1; }
519 | "typeof" { $$ = $1; }
521 | "void" { $$ = $1; }
522 | "while" { $$ = $1; }
523 | "with" { $$ = $1; }
527 : Identifier_ { $$ = $1; }
529 | "implements" { $$ = $1; }
530 | "interface" { $$ = $1; }
531 | "package" { $$ = $1; }
532 | "private" { $$ = $1; }
533 | "protected" { $$ = $1; }
534 | "public" { $$ = $1; }
535 | "static" { $$ = $1; }
537 | "abstract" { $$ = $1; }
538 | "boolean" { $$ = $1; }
539 | "byte" { $$ = $1; }
540 | "char" { $$ = $1; }
541 | "double" { $$ = $1; }
542 | "final" { $$ = $1; }
543 | "float" { $$ = $1; }
544 | "goto" { $$ = $1; }
546 | "long" { $$ = $1; }
547 | "native" { $$ = $1; }
548 | "short" { $$ = $1; }
549 | "synchronized" { $$ = $1; }
550 | "throws" { $$ = $1; }
551 | "transient" { $$ = $1; }
552 | "volatile" { $$ = $1; }
555 | "yield" { $$ = $1; }
557 | "each" { $$ = $1; }
561 : Identifier { $$ = $1; }
565 RegularExpressionToken
566 : "/" { $$ = CYDriver::RegExStart; }
567 | "/=" { $$ = CYDriver::RegExRest; }
570 RegularExpressionLiteral_
571 : RegularExpressionToken { driver.SetCondition($1); } RegularExpressionLiteral { $$ = $3; }
575 : NullLiteral { $$ = $1; }
576 | BooleanLiteral { $$ = $1; }
577 | NumericLiteral { $$ = $1; }
578 | StringLiteral { $$ = $1; }
579 | RegularExpressionLiteral_ { $$ = $1; }
583 : "null" { $$ = $1; }
587 : "true" { $$ = $1; }
588 | "false" { $$ = $1; }
591 /* 11.1 Primary Expressions {{{ */
593 : "this" { $$ = $1; }
594 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
595 | Literal { $$ = $1; }
596 | ArrayLiteral { $$ = $1; }
597 | "(" Expression ")" { $$ = $2; }
601 : ObjectLiteral { $$ = $1; }
602 | PrimaryExpression_ { $$ = $1; }
605 PrimaryExpressionNoBF
606 : PrimaryExpression_ { $$ = $1; }
609 /* 11.1.4 Array Initialiser {{{ */
611 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
615 : AssignmentExpression { $$ = $1; }
619 : Element { $$ = $1; }
624 : ElementList { $$ = $1; }
629 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
630 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
633 /* 11.1.5 Object Initialiser {{{ */
635 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
638 PropertyNameAndValueList_
639 : "," PropertyNameAndValueList { $$ = $2; }
643 PropertyNameAndValueListOpt
644 : PropertyNameAndValueList { $$ = $1; }
648 PropertyNameAndValueList
649 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
653 : Identifier { $$ = $1; }
654 | StringLiteral { $$ = $1; }
655 | NumericLiteral { $$ = $1; }
659 /* 11.2 Left-Hand-Side Expressions {{{ */
661 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
665 : "[" Expression "]" { $$ = new(driver.pool_) CYDirectMember(NULL, $2); }
666 | "." Identifier { $$ = new(driver.pool_) CYDirectMember(NULL, new(driver.pool_) CYString($2)); }
670 : PrimaryExpression { $$ = $1; }
671 | FunctionExpression { $$ = $1; }
672 | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
673 | MemberExpression_ { $$ = $1; }
677 : PrimaryExpressionNoBF { $$ = $1; }
678 | MemberExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
679 | MemberExpression_ { $$ = $1; }
683 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
687 : MemberExpression { $$ = $1; }
688 | NewExpression_ { $$ = $1; }
692 : MemberExpressionNoBF { $$ = $1; }
693 | NewExpression_ { $$ = $1; }
697 : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
698 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
699 | CallExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
703 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
704 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
705 | CallExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
709 : "," ArgumentList { $$ = $2; }
714 : ArgumentList { $$ = $1; }
719 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
723 : "(" ArgumentListOpt ")" { $$ = $2; }
726 LeftHandSideExpression
727 : NewExpression { $$ = $1; }
728 | CallExpression { $$ = $1; }
731 LeftHandSideExpressionNoBF
732 : NewExpressionNoBF { $$ = $1; }
733 | CallExpressionNoBF { $$ = $1; }
736 /* 11.3 Postfix Expressions {{{ */
738 : AssigneeExpression { $$ = $1; }
739 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
740 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
743 PostfixExpressionNoBF
744 : AssigneeExpressionNoBF { $$ = $1; }
745 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
746 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
749 /* 11.4 Unary Operators {{{ */
751 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
752 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
753 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
754 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
755 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
756 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
757 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
758 | "+" UnaryExpression { $$ = $2; }
759 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
760 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
761 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
765 : PostfixExpression { $$ = $1; }
766 | UnaryExpression_ { $$ = $1; }
770 : PostfixExpressionNoBF { $$ = $1; }
771 | UnaryExpression_ { $$ = $1; }
774 /* 11.5 Multiplicative Operators {{{ */
775 MultiplicativeExpression
776 : UnaryExpression { $$ = $1; }
777 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
778 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
779 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
782 MultiplicativeExpressionNoBF
783 : UnaryExpressionNoBF { $$ = $1; }
784 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
785 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
786 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
789 /* 11.6 Additive Operators {{{ */
791 : MultiplicativeExpression { $$ = $1; }
792 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
793 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
796 AdditiveExpressionNoBF
797 : MultiplicativeExpressionNoBF { $$ = $1; }
798 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
799 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
802 /* 11.7 Bitwise Shift Operators {{{ */
804 : AdditiveExpression { $$ = $1; }
805 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
806 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
807 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
811 : AdditiveExpressionNoBF { $$ = $1; }
812 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
813 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
814 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
817 /* 11.8 Relational Operators {{{ */
818 RelationalExpressionNoIn_
819 : "<" ShiftExpression { $$ = new(driver.pool_) CYLess(NULL, $2); }
820 | ">" ShiftExpression { $$ = new(driver.pool_) CYGreater(NULL, $2); }
821 | "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual(NULL, $2); }
822 | ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual(NULL, $2); }
823 | "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf(NULL, $2); }
826 RelationalExpression_
827 : RelationalExpressionNoIn_ { $$ = $1; }
828 | "in" ShiftExpression { $$ = new(driver.pool_) CYIn(NULL, $2); }
832 : ShiftExpression { $$ = $1; }
833 | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
836 RelationalExpressionNoIn
837 : ShiftExpression { $$ = $1; }
838 | RelationalExpressionNoIn RelationalExpressionNoIn_ { $2->SetLeft($1); $$ = $2; }
841 RelationalExpressionNoBF
842 : ShiftExpressionNoBF { $$ = $1; }
843 | RelationalExpressionNoBF RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
846 /* 11.9 Equality Operators {{{ */
848 : RelationalExpression { $$ = $1; }
849 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
850 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
851 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
852 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
855 EqualityExpressionNoIn
856 : RelationalExpressionNoIn { $$ = $1; }
857 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
858 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
859 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
860 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
863 EqualityExpressionNoBF
864 : RelationalExpressionNoBF { $$ = $1; }
865 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
866 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
867 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
868 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
871 /* 11.10 Binary Bitwise Operators {{{ */
873 : EqualityExpression { $$ = $1; }
874 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
877 BitwiseANDExpressionNoIn
878 : EqualityExpressionNoIn { $$ = $1; }
879 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
882 BitwiseANDExpressionNoBF
883 : EqualityExpressionNoBF { $$ = $1; }
884 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
888 : BitwiseANDExpression { $$ = $1; }
889 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
892 BitwiseXORExpressionNoIn
893 : BitwiseANDExpressionNoIn { $$ = $1; }
894 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
897 BitwiseXORExpressionNoBF
898 : BitwiseANDExpressionNoBF { $$ = $1; }
899 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
903 : BitwiseXORExpression { $$ = $1; }
904 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
907 BitwiseORExpressionNoIn
908 : BitwiseXORExpressionNoIn { $$ = $1; }
909 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
912 BitwiseORExpressionNoBF
913 : BitwiseXORExpressionNoBF { $$ = $1; }
914 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
917 /* 11.11 Binary Logical Operators {{{ */
919 : BitwiseORExpression { $$ = $1; }
920 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
923 LogicalANDExpressionNoIn
924 : BitwiseORExpressionNoIn { $$ = $1; }
925 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
928 LogicalANDExpressionNoBF
929 : BitwiseORExpressionNoBF { $$ = $1; }
930 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
934 : LogicalANDExpression { $$ = $1; }
935 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
938 LogicalORExpressionNoIn
939 : LogicalANDExpressionNoIn { $$ = $1; }
940 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
943 LogicalORExpressionNoBF
944 : LogicalANDExpressionNoBF { $$ = $1; }
945 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
948 /* 11.12 Conditional Operator ( ? : ) {{{ */
949 ConditionalExpression
950 : LogicalORExpression { $$ = $1; }
951 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
954 ConditionalExpressionNoIn
955 : LogicalORExpressionNoIn { $$ = $1; }
956 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
959 ConditionalExpressionNoBF
960 : LogicalORExpressionNoBF { $$ = $1; }
961 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
964 /* 11.13 Assignment Operators {{{ */
965 AssignmentExpression_
966 : "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign(NULL, $2); }
967 | "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign(NULL, $2); }
968 | "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign(NULL, $2); }
969 | "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign(NULL, $2); }
970 | "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign(NULL, $2); }
971 | "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign(NULL, $2); }
972 | "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign(NULL, $2); }
973 | ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign(NULL, $2); }
974 | ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign(NULL, $2); }
975 | "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign(NULL, $2); }
976 | "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign(NULL, $2); }
977 | "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign(NULL, $2); }
981 : LeftHandSideExpression { $$ = $1; }
982 | AssigneeExpression_ { $$ = $1; }
985 AssigneeExpressionNoBF
986 : LeftHandSideExpressionNoBF { $$ = $1; }
987 | AssigneeExpression_ { $$ = $1; }
991 : ConditionalExpression { $$ = $1; }
992 | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
995 AssignmentExpressionNoIn
996 : ConditionalExpressionNoIn { $$ = $1; }
997 | AssigneeExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
998 | AssigneeExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
999 | AssigneeExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
1000 | AssigneeExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
1001 | AssigneeExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
1002 | AssigneeExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
1003 | AssigneeExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
1004 | AssigneeExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
1005 | AssigneeExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
1006 | AssigneeExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
1007 | AssigneeExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
1008 | AssigneeExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
1011 AssignmentExpressionNoBF
1012 : ConditionalExpressionNoBF { $$ = $1; }
1013 | AssigneeExpressionNoBF AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1016 /* 11.14 Comma Operator {{{ */
1018 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
1023 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
1028 : Expression { $$ = $1; }
1033 : ExpressionNoIn { $$ = $1; }
1038 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1042 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1046 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1050 /* 12 Statements {{{ */
1052 : Block { $$ = $1; }
1053 | VariableStatement { $$ = $1; }
1054 | EmptyStatement { $$ = $1; }
1055 | ExpressionStatement { $$ = $1; }
1056 | IfStatement { $$ = $1; }
1057 | IterationStatement { $$ = $1; }
1058 | ContinueStatement { $$ = $1; }
1059 | BreakStatement { $$ = $1; }
1060 | ReturnStatement { $$ = $1; }
1061 | WithStatement { $$ = $1; }
1062 | LabelledStatement { $$ = $1; }
1063 | SwitchStatement { $$ = $1; }
1064 | ThrowStatement { $$ = $1; }
1065 | TryStatement { $$ = $1; }
1069 : Statement_ { $$ = $1; }
1072 /* 12.1 Block {{{ */
1074 : "{" StatementListOpt "}" { $$ = $2; }
1078 : Block_ { if ($1) $$ = new(driver.pool_) CYBlock($1); else $$ = new(driver.pool_) CYEmpty(); }
1082 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
1086 : StatementList { $$ = $1; }
1090 /* 12.2 Variable Statement {{{ */
1092 : "var" VariableDeclarationList Terminator { $$ = new(driver.pool_) CYVar($2); }
1095 VariableDeclarationList_
1096 : "," VariableDeclarationList { $$ = $2; }
1100 VariableDeclarationListNoIn_
1101 : "," VariableDeclarationListNoIn { $$ = $2; }
1105 VariableDeclarationList
1106 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1109 VariableDeclarationListNoIn
1110 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1114 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1117 VariableDeclarationNoIn
1118 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1122 : Initialiser { $$ = $1; }
1127 : InitialiserNoIn { $$ = $1; }
1132 : "=" AssignmentExpression { $$ = $2; }
1136 : "=" AssignmentExpressionNoIn { $$ = $2; }
1139 /* 12.3 Empty Statement {{{ */
1141 : ";" { $$ = new(driver.pool_) CYEmpty(); }
1144 /* 12.4 Expression Statement {{{ */
1146 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
1149 /* 12.5 The if Statement {{{ */
1151 : "else" Statement { $$ = $2; }
1152 | %prec "if" { $$ = NULL; }
1156 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1160 /* 12.6 Iteration Statements {{{ */
1162 : DoWhileStatement { $$ = $1; }
1163 | WhileStatement { $$ = $1; }
1164 | ForStatement { $$ = $1; }
1165 | ForInStatement { $$ = $1; }
1168 /* 12.6.1 The do-while Statement {{{ */
1170 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1173 /* 12.6.2 The while Statement {{{ */
1175 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1178 /* 12.6.3 The for Statement {{{ */
1180 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1183 ForStatementInitialiser
1184 : ExpressionNoInOpt { $$ = $1; }
1185 | "var" VariableDeclarationListNoIn { $$ = $2; }
1188 /* 12.6.4 The for-in Statement {{{ */
1190 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1193 ForInStatementInitialiser
1194 : LeftHandSideExpression { $$ = $1; }
1195 | "var" VariableDeclarationNoIn { $$ = $2; }
1199 /* 12.7 The continue Statement {{{ */
1201 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1204 /* 12.8 The break Statement {{{ */
1206 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1209 /* 12.9 The return Statement {{{ */
1211 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1214 /* 12.10 The with Statement {{{ */
1216 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1220 /* 12.11 The switch Statement {{{ */
1222 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1226 : "{" CaseClausesOpt "}" { $$ = $2; }
1230 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1231 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1236 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1240 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1243 /* 12.12 Labelled Statements {{{ */
1245 : Identifier ":" Statement { $3->AddLabel($1); $$ = $3; }
1248 /* 12.13 The throw Statement {{{ */
1250 : "throw" Expression Terminator { $$ = new(driver.pool_) CYThrow($2); }
1253 /* 12.14 The try Statement {{{ */
1255 : "try" Block_ CatchOpt FinallyOpt { $$ = new(driver.pool_) CYTry($2, $3, $4); }
1259 : "catch" "(" Identifier ")" Block_ { $$ = new(driver.pool_) CYCatch($3, $5); }
1264 : "finally" Block_ { $$ = new(driver.pool_) CYFinally($2); }
1269 /* 13 Function Definition {{{ */
1271 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionStatement($2, $4, $7); }
1275 : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($2, $4, $7); }
1278 FormalParameterList_
1279 : "," FormalParameterList { $$ = $2; }
1284 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYFunctionParameter($1, $2); }
1289 : SourceElements { $$ = $1; }
1292 /* 14 Program {{{ */
1294 : SourceElements { driver.program_ = $1; }
1298 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
1303 : Statement_ { $$ = $1; }
1304 | FunctionDeclaration { $$ = $1; }
1308 /* Cycript: @class Declaration {{{ */
1310 : ":" MemberExpressionNoBF { $$ = $2; }
1315 : "{" "}" { $$ = NULL; }
1319 : "+" { $$ = false; }
1320 | "-" { $$ = true; }
1324 : "(" Expression ")" { $$ = $2; }
1329 : Word ":" TypeOpt Identifier { $$ = new(driver.pool_) CYMessageParameter($1, $3, $4); }
1332 MessageParameterListOpt
1333 : MessageParameterList { $$ = $1; }
1337 MessageParameterList
1338 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1342 : MessageParameterList { $$ = $1; }
1343 | Word { $$ = new(driver.pool_) CYMessageParameter($1, NULL, NULL); }
1346 ClassMessageDeclaration
1347 : MessageScope TypeOpt MessageParameters "{" FunctionBody "}" { $$ = new(driver.pool_) CYMessage($1, $2, $3, $5); }
1350 ClassMessageDeclarationListOpt
1351 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1356 : Identifier { $$ = $1; }
1357 | "(" AssignmentExpression ")" { $$ = $2; }
1361 : ClassName { $$ = $1; }
1366 : "@class" ClassNameOpt ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5); }
1370 : "@class" ClassName ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5); }
1374 : "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $3); }
1378 : ClassExpression { $$ = $1; }
1382 : ClassStatement { $$ = $1; }
1383 | CategoryStatement { $$ = $1; }
1386 /* Cycript: Send Message {{{ */
1388 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1393 : SelectorCall { $$ = $1; }
1394 | VariadicCall { $$ = $1; }
1398 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1402 : SelectorCall { $$ = $1; }
1403 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1407 : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYSend($2, $3); }
1410 SelectorExpressionOpt
1411 : SelectorExpression_ { $$ = $1; }
1416 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
1420 : SelectorExpression_ { $$ = $1; }
1421 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
1425 : MessageExpression { $$ = $1; }
1426 | "@selector" "(" SelectorExpression ")" { $$ = new(driver.pool_) CYSelector($3); }
1429 /* Cycript: Pointer Indirection/Addressing {{{ */
1431 : "*" UnaryExpression { $$ = new(driver.pool_) CYIndirect($2); }
1435 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }
1439 : "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
1442 /* ECMAScript5: Object Literal Trailing Comma {{{ */
1443 PropertyNameAndValueList_
1444 : "," { $$ = NULL; }
1447 /* JavaScript 1.7: Array Comprehensions {{{ */
1449 : "if" "(" Expression ")" { $$ = new(driver.pool_) CYIfComprehension($3); }
1453 : "for" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForInComprehension($3, $5); }
1454 | "for" "each" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForEachInComprehension($4, $6); }
1457 ComprehensionListOpt
1458 : ComprehensionList { $$ = $1; }
1459 | IfComprehension { $$ = $1; }
1464 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1468 : "[" AssignmentExpression ComprehensionList "]" { $$ = new(driver.pool_) CYArrayComprehension($2, $3); }
1471 /* JavaScript 1.7: for each {{{ */
1473 : "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForEachIn($4, $6, $8); }
1476 /* JavaScript 1.7: let Statements {{{ *//*
1478 : "let" "(" VariableDeclarationList ")" Block_ { $$ = new(driver.pool_) CYLet($3, $5); }
1485 /* JavaScript FTW: Function Statements {{{ */
1487 : FunctionDeclaration { driver.Warning(yylloc, "warning, FunctionDeclaration is a SourceElement, not a Statement"); } { $$ = $1; }