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
50 #include "ObjectiveC.hpp"
59 CYDriver::Condition condition_;
61 CYArgument *argument_;
62 CYAssignment *assignment_;
66 CYComprehension *comprehension_;
67 CYCompound *compound_;
68 CYDeclaration *declaration_;
69 CYDeclarations *declarations_;
71 CYExpression *expression_;
74 CYForInitialiser *for_;
75 CYForInInitialiser *forin_;
76 CYFunctionParameter *functionParameter_;
77 CYIdentifier *identifier_;
84 CYProperty *property_;
85 CYPropertyName *propertyName_;
86 CYStatement *statement_;
93 CYClassName *className_;
96 CYMessageParameter *messageParameter_;
97 CYSelectorPart *selector_;
105 int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner);
114 @$.begin.filename = @$.end.filename = &driver.filename_;
124 %parse-param { CYDriver &driver }
125 %lex-param { void *scanner }
130 %token AmpersandAmpersand "&&"
131 %token AmpersandEqual "&="
133 %token CarrotEqual "^="
135 %token EqualEqual "=="
136 %token EqualEqualEqual "==="
137 %token Exclamation "!"
138 %token ExclamationEqual "!="
139 %token ExclamationEqualEqual "!=="
141 %token HyphenEqual "-="
142 %token HyphenHyphen "--"
143 %token HyphenHyphen_ "\n--"
144 %token HyphenRight "->"
146 %token LeftEqual "<="
148 %token LeftLeftEqual "<<="
150 %token PercentEqual "%="
153 %token PipeEqual "|="
156 %token PlusEqual "+="
158 %token PlusPlus_ "\n++"
160 %token RightEqual ">="
161 %token RightRight ">>"
162 %token RightRightEqual ">>="
163 %token RightRightRight ">>>"
164 %token RightRightRightEqual ">>>="
166 %token SlashEqual "/="
168 %token StarEqual "*="
178 %token CloseParen ")"
181 %token CloseBrace "}"
183 %token OpenBracket "["
184 %token CloseBracket "]"
186 %token AtClass "@class"
187 %token AtSelector "@selector"
190 %token <false_> False "false"
191 %token <null_> Null "null"
192 %token <true_> True "true"
194 // ES3/ES5/WIE/JSC Reserved
195 %token <word_> Break "break"
196 %token <word_> Case "case"
197 %token <word_> Catch "catch"
198 %token <word_> Continue "continue"
199 %token <word_> Default "default"
200 %token <word_> Delete "delete"
201 %token <word_> Do "do"
202 %token <word_> Else "else"
203 %token <word_> Finally "finally"
204 %token <word_> For "for"
205 %token <word_> Function "function"
206 %token <word_> If "if"
207 %token <word_> In "in"
208 %token <word_> InstanceOf "instanceof"
209 %token <word_> New "new"
210 %token <word_> Return "return"
211 %token <word_> Switch "switch"
212 %token <this_> This "this"
213 %token <word_> Throw "throw"
214 %token <word_> Try "try"
215 %token <word_> TypeOf "typeof"
216 %token <word_> Var "var"
217 %token <word_> Void "void"
218 %token <word_> While "while"
219 %token <word_> With "with"
221 // ES3/IE6 Future, ES5/JSC Reserved
222 %token <word_> Debugger "debugger"
224 // ES3/ES5/IE6 Future, JSC Reserved
225 %token <word_> Const "const"
227 // ES3/ES5/IE6/JSC Future
228 %token <word_> Class "class"
229 %token <word_> Enum "enum"
230 %token <word_> Export "export"
231 %token <word_> Extends "extends"
232 %token <word_> Import "import"
233 %token <word_> Super "super"
235 // ES3 Future, ES5 Strict Future
236 %token <identifier_> Implements "implements"
237 %token <identifier_> Interface "interface"
238 %token <identifier_> Package "package"
239 %token <identifier_> Private "private"
240 %token <identifier_> Protected "protected"
241 %token <identifier_> Public "public"
242 %token <identifier_> Static "static"
245 %token <identifier_> Abstract "abstract"
246 %token <identifier_> Boolean "boolean"
247 %token <identifier_> Byte "byte"
248 %token <identifier_> Char "char"
249 %token <identifier_> Double "double"
250 %token <identifier_> Final "final"
251 %token <identifier_> Float "float"
252 %token <identifier_> Goto "goto"
253 %token <identifier_> Int "int"
254 %token <identifier_> Long "long"
255 %token <identifier_> Native "native"
256 %token <identifier_> Short "short"
257 %token <identifier_> Synchronized "synchronized"
258 %token <identifier_> Throws "throws"
259 %token <identifier_> Transient "transient"
260 %token <identifier_> Volatile "volatile"
263 %token <identifier_> Let "let"
264 %token <identifier_> Yield "yield"
267 %token <identifier_> Each "each"
269 %token <identifier_> Identifier_
270 %token <number_> NumericLiteral
271 %token <string_> StringLiteral
272 %token <literal_> RegularExpressionLiteral
274 %type <expression_> AdditiveExpression
275 %type <expression_> AdditiveExpressionNoBF
276 %type <argument_> ArgumentList
277 %type <argument_> ArgumentList_
278 %type <argument_> ArgumentListOpt
279 %type <argument_> Arguments
280 %type <literal_> ArrayLiteral
281 %type <expression_> AssigneeExpression
282 %type <expression_> AssigneeExpression_
283 %type <expression_> AssigneeExpressionNoBF
284 %type <expression_> AssignmentExpression
285 %type <assignment_> AssignmentExpression_
286 %type <expression_> AssignmentExpressionNoBF
287 %type <expression_> AssignmentExpressionNoIn
288 %type <expression_> BitwiseANDExpression
289 %type <expression_> BitwiseANDExpressionNoBF
290 %type <expression_> BitwiseANDExpressionNoIn
291 %type <statement_> Block
292 %type <statement_> Block_
293 %type <boolean_> BooleanLiteral
294 %type <expression_> BitwiseORExpression
295 %type <expression_> BitwiseORExpressionNoBF
296 %type <expression_> BitwiseORExpressionNoIn
297 %type <expression_> BitwiseXORExpression
298 %type <expression_> BitwiseXORExpressionNoBF
299 %type <expression_> BitwiseXORExpressionNoIn
300 %type <statement_> BreakStatement
301 %type <expression_> CallExpression
302 %type <expression_> CallExpressionNoBF
303 %type <clause_> CaseBlock
304 %type <clause_> CaseClause
305 %type <clause_> CaseClausesOpt
306 %type <catch_> CatchOpt
307 %type <comprehension_> ComprehensionList
308 %type <comprehension_> ComprehensionListOpt
309 %type <expression_> ConditionalExpression
310 %type <expression_> ConditionalExpressionNoBF
311 %type <expression_> ConditionalExpressionNoIn
312 %type <statement_> ContinueStatement
313 %type <clause_> DefaultClause
314 %type <statement_> DoWhileStatement
315 %type <expression_> Element
316 %type <expression_> ElementOpt
317 %type <element_> ElementList
318 %type <element_> ElementListOpt
319 %type <statement_> ElseStatementOpt
320 %type <statement_> EmptyStatement
321 %type <expression_> EqualityExpression
322 %type <expression_> EqualityExpressionNoBF
323 %type <expression_> EqualityExpressionNoIn
324 %type <expression_> Expression
325 %type <expression_> ExpressionOpt
326 %type <compound_> Expression_
327 %type <expression_> ExpressionNoBF
328 %type <expression_> ExpressionNoIn
329 %type <compound_> ExpressionNoIn_
330 %type <expression_> ExpressionNoInOpt
331 %type <statement_> ExpressionStatement
332 %type <finally_> FinallyOpt
333 %type <comprehension_> ForComprehension
334 %type <statement_> ForStatement
335 %type <for_> ForStatementInitialiser
336 %type <statement_> ForInStatement
337 %type <forin_> ForInStatementInitialiser
338 %type <functionParameter_> FormalParameterList
339 %type <functionParameter_> FormalParameterList_
340 %type <statement_> FunctionBody
341 %type <statement_> FunctionDeclaration
342 %type <expression_> FunctionExpression
343 %type <identifier_> Identifier
344 %type <identifier_> IdentifierOpt
345 %type <comprehension_> IfComprehension
346 %type <statement_> IfStatement
347 %type <expression_> Initialiser
348 %type <expression_> InitialiserOpt
349 %type <expression_> InitialiserNoIn
350 %type <expression_> InitialiserNoInOpt
351 %type <statement_> IterationStatement
352 %type <statement_> LabelledStatement
353 %type <expression_> LeftHandSideExpression
354 %type <expression_> LeftHandSideExpressionNoBF
355 //%type <statement_> LetStatement
356 %type <literal_> Literal
357 %type <expression_> LogicalANDExpression
358 %type <expression_> LogicalANDExpressionNoBF
359 %type <expression_> LogicalANDExpressionNoIn
360 %type <expression_> LogicalORExpression
361 %type <expression_> LogicalORExpressionNoBF
362 %type <expression_> LogicalORExpressionNoIn
363 %type <member_> MemberAccess
364 %type <expression_> MemberExpression
365 %type <expression_> MemberExpression_
366 %type <expression_> MemberExpressionNoBF
367 %type <expression_> MultiplicativeExpression
368 %type <expression_> MultiplicativeExpressionNoBF
369 %type <expression_> NewExpression
370 %type <expression_> NewExpression_
371 %type <expression_> NewExpressionNoBF
372 %type <null_> NullLiteral
373 %type <literal_> ObjectLiteral
374 %type <expression_> PostfixExpression
375 %type <expression_> PostfixExpressionNoBF
376 %type <expression_> PrimaryExpression
377 %type <expression_> PrimaryExpression_
378 %type <expression_> PrimaryExpressionNoBF
379 %type <statement_> Program
380 %type <propertyName_> PropertyName
381 %type <property_> PropertyNameAndValueList
382 %type <property_> PropertyNameAndValueList_
383 %type <property_> PropertyNameAndValueListOpt
384 %type <literal_> RegularExpressionLiteral_
385 %type <condition_> RegularExpressionToken
386 %type <expression_> RelationalExpression
387 %type <infix_> RelationalExpression_
388 %type <expression_> RelationalExpressionNoBF
389 %type <expression_> RelationalExpressionNoIn
390 %type <infix_> RelationalExpressionNoIn_
391 %type <statement_> ReturnStatement
392 %type <expression_> ShiftExpression
393 %type <expression_> ShiftExpressionNoBF
394 %type <statement_> SourceElement
395 %type <statement_> SourceElements
396 %type <statement_> Statement
397 %type <statement_> Statement_
398 %type <statement_> StatementList
399 %type <statement_> StatementListOpt
400 %type <statement_> SwitchStatement
401 %type <statement_> ThrowStatement
402 %type <statement_> TryStatement
403 %type <expression_> UnaryExpression
404 %type <expression_> UnaryExpression_
405 %type <expression_> UnaryExpressionNoBF
406 %type <declaration_> VariableDeclaration
407 %type <declaration_> VariableDeclarationNoIn
408 %type <declarations_> VariableDeclarationList
409 %type <declarations_> VariableDeclarationList_
410 %type <declarations_> VariableDeclarationListNoIn
411 %type <declarations_> VariableDeclarationListNoIn_
412 %type <statement_> VariableStatement
413 %type <statement_> WhileStatement
414 %type <statement_> WithStatement
417 %type <statement_> CategoryStatement
418 %type <expression_> ClassExpression
419 %type <statement_> ClassStatement
420 %type <expression_> ClassSuperOpt
421 %type <field_> ClassFieldList
422 %type <message_> ClassMessageDeclaration
423 %type <message_> ClassMessageDeclarationListOpt
424 %type <className_> ClassName
425 %type <className_> ClassNameOpt
426 %type <expression_> MessageExpression
427 %type <messageParameter_> MessageParameter
428 %type <messageParameter_> MessageParameters
429 %type <messageParameter_> MessageParameterList
430 %type <messageParameter_> MessageParameterListOpt
431 %type <bool_> MessageScope
432 %type <argument_> SelectorCall
433 %type <argument_> SelectorCall_
434 %type <selector_> SelectorExpression
435 %type <selector_> SelectorExpression_
436 %type <selector_> SelectorExpressionOpt
437 %type <argument_> SelectorList
438 %type <expression_> TypeOpt
439 %type <argument_> VariadicCall
441 %type <word_> WordOpt
446 %left "<<" ">>" ">>>"
447 %left "<" ">" "<=" ">=" "instanceof" "in"
448 %left "==" "!=" "===" "!=="
455 %right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
465 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
475 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
480 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
500 : Identifier { $$ = $1; }
501 | "break" NewLineOpt { $$ = $1; }
502 | "case" { $$ = $1; }
503 | "catch" { $$ = $1; }
504 | "class" { $$ = $1; }
505 | "const" { $$ = $1; }
506 | "continue" NewLineOpt { $$ = $1; }
507 | "debugger" { $$ = $1; }
508 | "default" { $$ = $1; }
509 | "delete" { $$ = $1; }
511 | "else" { $$ = $1; }
512 | "enum" { $$ = $1; }
513 | "export" { $$ = $1; }
514 | "extends" { $$ = $1; }
515 | "false" { $$ = $1; }
516 | "finally" { $$ = $1; }
518 | "function" { $$ = $1; }
520 | "import" { $$ = $1; }
521 /* XXX: | "in" { $$ = $1; } */
522 /* XXX: | "instanceof" { $$ = $1; } */
524 | "null" { $$ = $1; }
525 | "return" NewLineOpt { $$ = $1; }
526 | "super" { $$ = $1; }
527 | "switch" { $$ = $1; }
528 | "this" { $$ = $1; }
529 | "throw" NewLineOpt { $$ = $1; }
530 | "true" { $$ = $1; }
532 | "typeof" { $$ = $1; }
534 | "void" { $$ = $1; }
535 | "while" { $$ = $1; }
536 | "with" { $$ = $1; }
541 : Identifier_ { $$ = $1; }
543 | "implements" { $$ = $1; }
544 | "interface" { $$ = $1; }
545 | "package" { $$ = $1; }
546 | "private" { $$ = $1; }
547 | "protected" { $$ = $1; }
548 | "public" { $$ = $1; }
549 | "static" { $$ = $1; }
551 | "abstract" { $$ = $1; }
552 | "boolean" { $$ = $1; }
553 | "byte" { $$ = $1; }
554 | "char" { $$ = $1; }
555 | "double" { $$ = $1; }
556 | "final" { $$ = $1; }
557 | "float" { $$ = $1; }
558 | "goto" { $$ = $1; }
560 | "long" { $$ = $1; }
561 | "native" { $$ = $1; }
562 | "short" { $$ = $1; }
563 | "synchronized" { $$ = $1; }
564 | "throws" { $$ = $1; }
565 | "transient" { $$ = $1; }
566 | "volatile" { $$ = $1; }
569 | "yield" { $$ = $1; }
571 | "each" { $$ = $1; }
575 : Identifier { $$ = $1; }
579 RegularExpressionToken
580 : "/" { $$ = CYDriver::RegExStart; }
581 | "/=" { $$ = CYDriver::RegExRest; }
584 RegularExpressionLiteral_
585 : RegularExpressionToken { driver.SetCondition($1); } RegularExpressionLiteral { $$ = $3; }
589 : NullLiteral { $$ = $1; }
590 | BooleanLiteral { $$ = $1; }
591 | NumericLiteral { $$ = $1; }
592 | StringLiteral { $$ = $1; }
593 | RegularExpressionLiteral_ { $$ = $1; }
597 : "null" { $$ = $1; }
601 : "true" { $$ = $1; }
602 | "false" { $$ = $1; }
605 /* 11.1 Primary Expressions {{{ */
607 : "this" { $$ = $1; }
608 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
609 | Literal { $$ = $1; }
610 | ArrayLiteral { $$ = $1; }
611 | "(" Expression ")" { $$ = $2; }
615 : ObjectLiteral { $$ = $1; }
616 | PrimaryExpression_ { $$ = $1; }
619 PrimaryExpressionNoBF
620 : PrimaryExpression_ { $$ = $1; }
623 /* 11.1.4 Array Initialiser {{{ */
625 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
629 : AssignmentExpression { $$ = $1; }
633 : Element { $$ = $1; }
638 : ElementList { $$ = $1; }
643 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
644 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
647 /* 11.1.5 Object Initialiser {{{ */
649 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
652 PropertyNameAndValueList_
653 : "," PropertyNameAndValueList { $$ = $2; }
657 PropertyNameAndValueListOpt
658 : PropertyNameAndValueList { $$ = $1; }
662 PropertyNameAndValueList
663 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
667 : Identifier { $$ = $1; }
668 | StringLiteral { $$ = $1; }
669 | NumericLiteral { $$ = $1; }
673 /* 11.2 Left-Hand-Side Expressions {{{ */
675 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
679 : "[" Expression "]" { $$ = new(driver.pool_) CYDirectMember(NULL, $2); }
680 | "." Identifier { $$ = new(driver.pool_) CYDirectMember(NULL, new(driver.pool_) CYString($2)); }
684 : PrimaryExpression { $$ = $1; }
685 | FunctionExpression { $$ = $1; }
686 | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
687 | MemberExpression_ { $$ = $1; }
691 : PrimaryExpressionNoBF { $$ = $1; }
692 | MemberExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
693 | MemberExpression_ { $$ = $1; }
697 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
701 : MemberExpression { $$ = $1; }
702 | NewExpression_ { $$ = $1; }
706 : MemberExpressionNoBF { $$ = $1; }
707 | NewExpression_ { $$ = $1; }
711 : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
712 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
713 | CallExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
717 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
718 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
719 | CallExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
723 : "," ArgumentList { $$ = $2; }
728 : ArgumentList { $$ = $1; }
733 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
737 : "(" ArgumentListOpt ")" { $$ = $2; }
740 LeftHandSideExpression
741 : NewExpression { $$ = $1; }
742 | CallExpression { $$ = $1; }
745 LeftHandSideExpressionNoBF
746 : NewExpressionNoBF { $$ = $1; }
747 | CallExpressionNoBF { $$ = $1; }
750 /* 11.3 Postfix Expressions {{{ */
752 : AssigneeExpression { $$ = $1; }
753 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
754 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
757 PostfixExpressionNoBF
758 : AssigneeExpressionNoBF { $$ = $1; }
759 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
760 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
763 /* 11.4 Unary Operators {{{ */
765 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
766 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
767 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
768 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
769 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
770 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
771 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
772 | "+" UnaryExpression { $$ = new(driver.pool_) CYAffirm($2); }
773 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
774 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
775 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
779 : PostfixExpression { $$ = $1; }
780 | UnaryExpression_ { $$ = $1; }
784 : PostfixExpressionNoBF { $$ = $1; }
785 | UnaryExpression_ { $$ = $1; }
788 /* 11.5 Multiplicative Operators {{{ */
789 MultiplicativeExpression
790 : UnaryExpression { $$ = $1; }
791 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
792 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
793 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
796 MultiplicativeExpressionNoBF
797 : UnaryExpressionNoBF { $$ = $1; }
798 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
799 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
800 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
803 /* 11.6 Additive Operators {{{ */
805 : MultiplicativeExpression { $$ = $1; }
806 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
807 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
810 AdditiveExpressionNoBF
811 : MultiplicativeExpressionNoBF { $$ = $1; }
812 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
813 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
816 /* 11.7 Bitwise Shift Operators {{{ */
818 : AdditiveExpression { $$ = $1; }
819 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
820 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
821 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
825 : AdditiveExpressionNoBF { $$ = $1; }
826 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
827 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
828 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
831 /* 11.8 Relational Operators {{{ */
832 RelationalExpressionNoIn_
833 : "<" ShiftExpression { $$ = new(driver.pool_) CYLess(NULL, $2); }
834 | ">" ShiftExpression { $$ = new(driver.pool_) CYGreater(NULL, $2); }
835 | "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual(NULL, $2); }
836 | ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual(NULL, $2); }
837 | "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf(NULL, $2); }
840 RelationalExpression_
841 : RelationalExpressionNoIn_ { $$ = $1; }
842 | "in" ShiftExpression { $$ = new(driver.pool_) CYIn(NULL, $2); }
846 : ShiftExpression { $$ = $1; }
847 | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
850 RelationalExpressionNoIn
851 : ShiftExpression { $$ = $1; }
852 | RelationalExpressionNoIn RelationalExpressionNoIn_ { $2->SetLeft($1); $$ = $2; }
855 RelationalExpressionNoBF
856 : ShiftExpressionNoBF { $$ = $1; }
857 | RelationalExpressionNoBF RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
860 /* 11.9 Equality Operators {{{ */
862 : RelationalExpression { $$ = $1; }
863 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
864 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
865 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
866 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
869 EqualityExpressionNoIn
870 : RelationalExpressionNoIn { $$ = $1; }
871 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
872 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
873 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
874 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
877 EqualityExpressionNoBF
878 : RelationalExpressionNoBF { $$ = $1; }
879 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
880 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
881 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
882 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
885 /* 11.10 Binary Bitwise Operators {{{ */
887 : EqualityExpression { $$ = $1; }
888 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
891 BitwiseANDExpressionNoIn
892 : EqualityExpressionNoIn { $$ = $1; }
893 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
896 BitwiseANDExpressionNoBF
897 : EqualityExpressionNoBF { $$ = $1; }
898 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
902 : BitwiseANDExpression { $$ = $1; }
903 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
906 BitwiseXORExpressionNoIn
907 : BitwiseANDExpressionNoIn { $$ = $1; }
908 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
911 BitwiseXORExpressionNoBF
912 : BitwiseANDExpressionNoBF { $$ = $1; }
913 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
917 : BitwiseXORExpression { $$ = $1; }
918 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
921 BitwiseORExpressionNoIn
922 : BitwiseXORExpressionNoIn { $$ = $1; }
923 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
926 BitwiseORExpressionNoBF
927 : BitwiseXORExpressionNoBF { $$ = $1; }
928 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
931 /* 11.11 Binary Logical Operators {{{ */
933 : BitwiseORExpression { $$ = $1; }
934 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
937 LogicalANDExpressionNoIn
938 : BitwiseORExpressionNoIn { $$ = $1; }
939 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
942 LogicalANDExpressionNoBF
943 : BitwiseORExpressionNoBF { $$ = $1; }
944 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
948 : LogicalANDExpression { $$ = $1; }
949 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
952 LogicalORExpressionNoIn
953 : LogicalANDExpressionNoIn { $$ = $1; }
954 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
957 LogicalORExpressionNoBF
958 : LogicalANDExpressionNoBF { $$ = $1; }
959 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
962 /* 11.12 Conditional Operator ( ? : ) {{{ */
963 ConditionalExpression
964 : LogicalORExpression { $$ = $1; }
965 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
968 ConditionalExpressionNoIn
969 : LogicalORExpressionNoIn { $$ = $1; }
970 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
973 ConditionalExpressionNoBF
974 : LogicalORExpressionNoBF { $$ = $1; }
975 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
978 /* 11.13 Assignment Operators {{{ */
979 AssignmentExpression_
980 : "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign(NULL, $2); }
981 | "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign(NULL, $2); }
982 | "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign(NULL, $2); }
983 | "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign(NULL, $2); }
984 | "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign(NULL, $2); }
985 | "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign(NULL, $2); }
986 | "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign(NULL, $2); }
987 | ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign(NULL, $2); }
988 | ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign(NULL, $2); }
989 | "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign(NULL, $2); }
990 | "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign(NULL, $2); }
991 | "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign(NULL, $2); }
995 : LeftHandSideExpression { $$ = $1; }
996 | AssigneeExpression_ { $$ = $1; }
999 AssigneeExpressionNoBF
1000 : LeftHandSideExpressionNoBF { $$ = $1; }
1001 | AssigneeExpression_ { $$ = $1; }
1004 AssignmentExpression
1005 : ConditionalExpression { $$ = $1; }
1006 | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1009 AssignmentExpressionNoIn
1010 : ConditionalExpressionNoIn { $$ = $1; }
1011 | AssigneeExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
1012 | AssigneeExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
1013 | AssigneeExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
1014 | AssigneeExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
1015 | AssigneeExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
1016 | AssigneeExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
1017 | AssigneeExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
1018 | AssigneeExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
1019 | AssigneeExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
1020 | AssigneeExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
1021 | AssigneeExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
1022 | AssigneeExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
1025 AssignmentExpressionNoBF
1026 : ConditionalExpressionNoBF { $$ = $1; }
1027 | AssigneeExpressionNoBF AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1030 /* 11.14 Comma Operator {{{ */
1032 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
1037 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
1042 : Expression { $$ = $1; }
1047 : ExpressionNoIn { $$ = $1; }
1052 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1056 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1060 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1064 /* 12 Statements {{{ */
1066 : Block { $$ = $1; }
1067 | VariableStatement { $$ = $1; }
1068 | EmptyStatement { $$ = $1; }
1069 | ExpressionStatement { $$ = $1; }
1070 | IfStatement { $$ = $1; }
1071 | IterationStatement { $$ = $1; }
1072 | ContinueStatement { $$ = $1; }
1073 | BreakStatement { $$ = $1; }
1074 | ReturnStatement { $$ = $1; }
1075 | WithStatement { $$ = $1; }
1076 | LabelledStatement { $$ = $1; }
1077 | SwitchStatement { $$ = $1; }
1078 | ThrowStatement { $$ = $1; }
1079 | TryStatement { $$ = $1; }
1083 : Statement_ { $$ = $1; }
1086 /* 12.1 Block {{{ */
1088 : "{" StatementListOpt "}" { $$ = $2; }
1092 : Block_ { if ($1) $$ = new(driver.pool_) CYBlock($1); else $$ = new(driver.pool_) CYEmpty(); }
1096 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
1100 : StatementList { $$ = $1; }
1104 /* 12.2 Variable Statement {{{ */
1106 : "var" VariableDeclarationList Terminator { $$ = new(driver.pool_) CYVar($2); }
1109 VariableDeclarationList_
1110 : "," VariableDeclarationList { $$ = $2; }
1114 VariableDeclarationListNoIn_
1115 : "," VariableDeclarationListNoIn { $$ = $2; }
1119 VariableDeclarationList
1120 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1123 VariableDeclarationListNoIn
1124 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1128 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1131 VariableDeclarationNoIn
1132 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1136 : Initialiser { $$ = $1; }
1141 : InitialiserNoIn { $$ = $1; }
1146 : "=" AssignmentExpression { $$ = $2; }
1150 : "=" AssignmentExpressionNoIn { $$ = $2; }
1153 /* 12.3 Empty Statement {{{ */
1155 : ";" { $$ = new(driver.pool_) CYEmpty(); }
1158 /* 12.4 Expression Statement {{{ */
1160 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
1163 /* 12.5 The if Statement {{{ */
1165 : "else" Statement { $$ = $2; }
1166 | %prec "if" { $$ = NULL; }
1170 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1174 /* 12.6 Iteration Statements {{{ */
1176 : DoWhileStatement { $$ = $1; }
1177 | WhileStatement { $$ = $1; }
1178 | ForStatement { $$ = $1; }
1179 | ForInStatement { $$ = $1; }
1182 /* 12.6.1 The do-while Statement {{{ */
1184 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1187 /* 12.6.2 The while Statement {{{ */
1189 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1192 /* 12.6.3 The for Statement {{{ */
1194 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1197 ForStatementInitialiser
1198 : ExpressionNoInOpt { $$ = $1; }
1199 | "var" VariableDeclarationListNoIn { $$ = $2; }
1202 /* 12.6.4 The for-in Statement {{{ */
1204 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1207 ForInStatementInitialiser
1208 : LeftHandSideExpression { $$ = $1; }
1209 | "var" VariableDeclarationNoIn { $$ = $2; }
1213 /* 12.7 The continue Statement {{{ */
1215 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1218 /* 12.8 The break Statement {{{ */
1220 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1223 /* 12.9 The return Statement {{{ */
1225 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1228 /* 12.10 The with Statement {{{ */
1230 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1234 /* 12.11 The switch Statement {{{ */
1236 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1240 : "{" CaseClausesOpt "}" { $$ = $2; }
1244 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1245 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1250 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1254 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1257 /* 12.12 Labelled Statements {{{ */
1259 : Identifier ":" Statement { $$ = new(driver.pool_) CYLabel($1, $3); }
1262 /* 12.13 The throw Statement {{{ */
1264 : "throw" Expression Terminator { $$ = new(driver.pool_) CYThrow($2); }
1267 /* 12.14 The try Statement {{{ */
1269 : "try" Block_ CatchOpt FinallyOpt { $$ = new(driver.pool_) CYTry($2, $3, $4); }
1273 : "catch" "(" Identifier ")" Block_ { $$ = new(driver.pool_) CYCatch($3, $5); }
1278 : "finally" Block_ { $$ = new(driver.pool_) CYFinally($2); }
1283 /* 13 Function Definition {{{ */
1285 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionStatement($2, $4, $7); }
1289 : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($2, $4, $7); }
1292 FormalParameterList_
1293 : "," FormalParameterList { $$ = $2; }
1298 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYFunctionParameter($1, $2); }
1303 : SourceElements { $$ = $1; }
1306 /* 14 Program {{{ */
1308 : SourceElements { driver.program_ = new(driver.pool_) CYProgram($1); }
1312 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
1317 : Statement_ { $$ = $1; }
1318 | FunctionDeclaration { $$ = $1; }
1323 /* Cycript (Objective-C): @class Declaration {{{ */
1325 : ":" MemberExpressionNoBF { $$ = $2; }
1330 : "{" "}" { $$ = NULL; }
1334 : "+" { $$ = false; }
1335 | "-" { $$ = true; }
1339 : "(" Expression ")" { $$ = $2; }
1344 : Word ":" TypeOpt Identifier { $$ = new(driver.pool_) CYMessageParameter($1, $3, $4); }
1347 MessageParameterListOpt
1348 : MessageParameterList { $$ = $1; }
1352 MessageParameterList
1353 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1357 : MessageParameterList { $$ = $1; }
1358 | Word { $$ = new(driver.pool_) CYMessageParameter($1, NULL, NULL); }
1361 ClassMessageDeclaration
1362 : MessageScope TypeOpt MessageParameters "{" FunctionBody "}" { $$ = new(driver.pool_) CYMessage($1, $2, $3, $5); }
1365 ClassMessageDeclarationListOpt
1366 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1371 : Identifier { $$ = $1; }
1372 | "(" AssignmentExpression ")" { $$ = $2; }
1376 : ClassName { $$ = $1; }
1381 : "@class" ClassNameOpt ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5); }
1385 : "@class" ClassName ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5); }
1389 : "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $3); }
1393 : ClassExpression { $$ = $1; }
1397 : ClassStatement { $$ = $1; }
1398 | CategoryStatement { $$ = $1; }
1401 /* Cycript (Objective-C): Send Message {{{ */
1403 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1408 : SelectorCall { $$ = $1; }
1409 | VariadicCall { $$ = $1; }
1413 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1417 : SelectorCall { $$ = $1; }
1418 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1422 : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYSend($2, $3); }
1425 SelectorExpressionOpt
1426 : SelectorExpression_ { $$ = $1; }
1431 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
1435 : SelectorExpression_ { $$ = $1; }
1436 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
1440 : MessageExpression { $$ = $1; }
1441 | "@selector" "(" SelectorExpression ")" { $$ = new(driver.pool_) CYSelector($3); }
1447 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1449 : "*" UnaryExpression { $$ = new(driver.pool_) CYIndirect($2); }
1453 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }
1457 : "->" "[" Expression "]" { $$ = new(driver.pool_) CYIndirectMember(NULL, $3); }
1458 | "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
1463 /* ECMAScript5: Object Literal Trailing Comma {{{ */
1464 PropertyNameAndValueList_
1465 : "," { $$ = NULL; }
1468 /* JavaScript 1.7: Array Comprehensions {{{ */
1470 : "if" "(" Expression ")" { $$ = new(driver.pool_) CYIfComprehension($3); }
1474 : "for" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForInComprehension($3, $5); }
1475 | "for" "each" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForEachInComprehension($4, $6); }
1478 ComprehensionListOpt
1479 : ComprehensionList { $$ = $1; }
1480 | IfComprehension { $$ = $1; }
1485 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1489 : "[" AssignmentExpression ComprehensionList "]" { $$ = new(driver.pool_) CYArrayComprehension($2, $3); }
1492 /* JavaScript 1.7: for each {{{ */
1494 : "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForEachIn($4, $6, $8); }
1497 /* JavaScript 1.7: let Statements {{{ *//*
1499 : "let" "(" VariableDeclarationList ")" Block_ { $$ = new(driver.pool_) CYLet($3, $5); }
1506 /* JavaScript FTW: Function Statements {{{ */
1508 : FunctionDeclaration { driver.Warning(yylloc, "warning, FunctionDeclaration is a SourceElement, not a Statement"); } { $$ = $1; }