1 /* Cycript - Remote 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 }
129 %token ColonColon "::"
130 %token LeftRight "<>"
131 %token LeftSlashRight "</>"
132 %token PeriodPeriod ".."
140 %token AmpersandAmpersand "&&"
141 %token AmpersandEqual "&="
143 %token CarrotEqual "^="
145 %token EqualEqual "=="
146 %token EqualEqualEqual "==="
147 %token Exclamation "!"
148 %token ExclamationEqual "!="
149 %token ExclamationEqualEqual "!=="
151 %token HyphenEqual "-="
152 %token HyphenHyphen "--"
153 %token HyphenHyphen_ "\n--"
154 %token HyphenRight "->"
156 %token LeftEqual "<="
158 %token LeftLeftEqual "<<="
160 %token PercentEqual "%="
163 %token PipeEqual "|="
166 %token PlusEqual "+="
168 %token PlusPlus_ "\n++"
170 %token RightEqual ">="
171 %token RightRight ">>"
172 %token RightRightEqual ">>="
173 %token RightRightRight ">>>"
174 %token RightRightRightEqual ">>>="
176 %token SlashEqual "/="
178 %token StarEqual "*="
188 %token CloseParen ")"
191 %token CloseBrace "}"
193 %token OpenBracket "["
194 %token CloseBracket "]"
196 %token AtClass "@class"
197 %token AtSelector "@selector"
200 %token <false_> False "false"
201 %token <null_> Null "null"
202 %token <true_> True "true"
204 // ES3/ES5/WIE/JSC Reserved
205 %token <word_> Break "break"
206 %token <word_> Case "case"
207 %token <word_> Catch "catch"
208 %token <word_> Continue "continue"
209 %token <word_> Default "default"
210 %token <word_> Delete "delete"
211 %token <word_> Do "do"
212 %token <word_> Else "else"
213 %token <word_> Finally "finally"
214 %token <word_> For "for"
215 %token <word_> Function "function"
216 %token <word_> If "if"
217 %token <word_> In "in"
218 %token <word_> InstanceOf "instanceof"
219 %token <word_> New "new"
220 %token <word_> Return "return"
221 %token <word_> Switch "switch"
222 %token <this_> This "this"
223 %token <word_> Throw "throw"
224 %token <word_> Try "try"
225 %token <word_> TypeOf "typeof"
226 %token <word_> Var "var"
227 %token <word_> Void "void"
228 %token <word_> While "while"
229 %token <word_> With "with"
231 // ES3/IE6 Future, ES5/JSC Reserved
232 %token <word_> Debugger "debugger"
234 // ES3/ES5/IE6 Future, JSC Reserved
235 %token <word_> Const "const"
237 // ES3/ES5/IE6/JSC Future
238 %token <word_> Class "class"
239 %token <word_> Enum "enum"
240 %token <word_> Export "export"
241 %token <word_> Extends "extends"
242 %token <word_> Import "import"
243 %token <word_> Super "super"
245 // ES3 Future, ES5 Strict Future
246 %token <identifier_> Implements "implements"
247 %token <identifier_> Interface "interface"
248 %token <identifier_> Package "package"
249 %token <identifier_> Private "private"
250 %token <identifier_> Protected "protected"
251 %token <identifier_> Public "public"
252 %token <identifier_> Static "static"
255 %token <identifier_> Abstract "abstract"
256 %token <identifier_> Boolean "boolean"
257 %token <identifier_> Byte "byte"
258 %token <identifier_> Char "char"
259 %token <identifier_> Double "double"
260 %token <identifier_> Final "final"
261 %token <identifier_> Float "float"
262 %token <identifier_> Goto "goto"
263 %token <identifier_> Int "int"
264 %token <identifier_> Long "long"
265 %token <identifier_> Native "native"
266 %token <identifier_> Short "short"
267 %token <identifier_> Synchronized "synchronized"
268 %token <identifier_> Throws "throws"
269 %token <identifier_> Transient "transient"
270 %token <identifier_> Volatile "volatile"
273 %token <identifier_> Let "let"
274 %token <identifier_> Yield "yield"
277 %token <identifier_> Each "each"
279 %token <identifier_> Identifier_
280 %token <number_> NumericLiteral
281 %token <string_> StringLiteral
282 %token <literal_> RegularExpressionLiteral
284 %type <expression_> AdditiveExpression
285 %type <expression_> AdditiveExpressionNoBF
286 %type <argument_> ArgumentList
287 %type <argument_> ArgumentList_
288 %type <argument_> ArgumentListOpt
289 %type <argument_> Arguments
290 %type <literal_> ArrayLiteral
291 %type <expression_> AssigneeExpression
292 %type <expression_> AssigneeExpressionNoBF
293 %type <expression_> AssignmentExpression
294 %type <assignment_> AssignmentExpression_
295 %type <expression_> AssignmentExpressionNoBF
296 %type <expression_> AssignmentExpressionNoIn
297 %type <expression_> BitwiseANDExpression
298 %type <expression_> BitwiseANDExpressionNoBF
299 %type <expression_> BitwiseANDExpressionNoIn
300 %type <statement_> Block
301 %type <statement_> Block_
302 %type <boolean_> BooleanLiteral
303 %type <expression_> BitwiseORExpression
304 %type <expression_> BitwiseORExpressionNoBF
305 %type <expression_> BitwiseORExpressionNoIn
306 %type <expression_> BitwiseXORExpression
307 %type <expression_> BitwiseXORExpressionNoBF
308 %type <expression_> BitwiseXORExpressionNoIn
309 %type <statement_> BreakStatement
310 %type <expression_> CallExpression
311 %type <expression_> CallExpressionNoBF
312 %type <clause_> CaseBlock
313 %type <clause_> CaseClause
314 %type <clause_> CaseClausesOpt
315 %type <catch_> CatchOpt
316 %type <comprehension_> ComprehensionList
317 %type <comprehension_> ComprehensionListOpt
318 %type <expression_> ConditionalExpression
319 %type <expression_> ConditionalExpressionNoBF
320 %type <expression_> ConditionalExpressionNoIn
321 %type <statement_> ContinueStatement
322 %type <clause_> DefaultClause
323 %type <statement_> DoWhileStatement
324 %type <expression_> Element
325 %type <expression_> ElementOpt
326 %type <element_> ElementList
327 %type <element_> ElementListOpt
328 %type <statement_> ElseStatementOpt
329 %type <statement_> EmptyStatement
330 %type <expression_> EqualityExpression
331 %type <expression_> EqualityExpressionNoBF
332 %type <expression_> EqualityExpressionNoIn
333 %type <expression_> Expression
334 %type <expression_> ExpressionOpt
335 %type <compound_> Expression_
336 %type <expression_> ExpressionNoBF
337 %type <expression_> ExpressionNoIn
338 %type <compound_> ExpressionNoIn_
339 %type <expression_> ExpressionNoInOpt
340 %type <statement_> ExpressionStatement
341 %type <finally_> FinallyOpt
342 %type <comprehension_> ForComprehension
343 %type <statement_> ForStatement
344 %type <for_> ForStatementInitialiser
345 %type <statement_> ForInStatement
346 %type <forin_> ForInStatementInitialiser
347 %type <functionParameter_> FormalParameterList
348 %type <functionParameter_> FormalParameterList_
349 %type <statement_> FunctionBody
350 %type <statement_> FunctionDeclaration
351 %type <expression_> FunctionExpression
352 %type <identifier_> Identifier
353 %type <identifier_> IdentifierOpt
354 %type <comprehension_> IfComprehension
355 %type <statement_> IfStatement
356 %type <expression_> Initialiser
357 %type <expression_> InitialiserOpt
358 %type <expression_> InitialiserNoIn
359 %type <expression_> InitialiserNoInOpt
360 %type <statement_> IterationStatement
361 %type <statement_> LabelledStatement
362 %type <expression_> LeftHandSideExpression
363 %type <expression_> LeftHandSideExpressionNoBF
364 //%type <statement_> LetStatement
365 %type <literal_> Literal
366 %type <expression_> LogicalANDExpression
367 %type <expression_> LogicalANDExpressionNoBF
368 %type <expression_> LogicalANDExpressionNoIn
369 %type <expression_> LogicalORExpression
370 %type <expression_> LogicalORExpressionNoBF
371 %type <expression_> LogicalORExpressionNoIn
372 %type <member_> MemberAccess
373 %type <expression_> MemberExpression
374 %type <expression_> MemberExpression_
375 %type <expression_> MemberExpressionNoBF
376 %type <expression_> MultiplicativeExpression
377 %type <expression_> MultiplicativeExpressionNoBF
378 %type <expression_> NewExpression
379 %type <expression_> NewExpression_
380 %type <expression_> NewExpressionNoBF
381 %type <null_> NullLiteral
382 %type <literal_> ObjectLiteral
383 %type <expression_> PostfixExpression
384 %type <expression_> PostfixExpressionNoBF
385 %type <expression_> PrimaryExpression
386 %type <expression_> PrimaryExpression_
387 %type <expression_> PrimaryExpressionNoBF
388 %type <expression_> PrimaryExpressionNoBF_
389 %type <statement_> Program
390 %type <propertyName_> PropertyName
391 %type <property_> PropertyNameAndValueList
392 %type <property_> PropertyNameAndValueList_
393 %type <property_> PropertyNameAndValueListOpt
394 %type <expression_> RelationalExpression
395 %type <infix_> RelationalExpression_
396 %type <expression_> RelationalExpressionNoBF
397 %type <expression_> RelationalExpressionNoIn
398 %type <infix_> RelationalExpressionNoIn_
399 %type <statement_> ReturnStatement
400 %type <expression_> ShiftExpression
401 %type <expression_> ShiftExpressionNoBF
402 %type <statement_> SourceElement
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_> UnaryAssigneeExpression
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
427 %type <statement_> CategoryStatement
428 %type <expression_> ClassExpression
429 %type <statement_> ClassStatement
430 %type <expression_> ClassSuperOpt
431 %type <field_> ClassFieldList
432 %type <message_> ClassMessageDeclaration
433 %type <message_> ClassMessageDeclarationListOpt
434 %type <className_> ClassName
435 %type <className_> ClassNameOpt
436 %type <expression_> MessageExpression
437 %type <messageParameter_> MessageParameter
438 %type <messageParameter_> MessageParameters
439 %type <messageParameter_> MessageParameterList
440 %type <messageParameter_> MessageParameterListOpt
441 %type <bool_> MessageScope
442 %type <argument_> SelectorCall
443 %type <argument_> SelectorCall_
444 %type <selector_> SelectorExpression
445 %type <selector_> SelectorExpression_
446 %type <selector_> SelectorExpressionOpt
447 %type <argument_> SelectorList
448 %type <expression_> TypeOpt
449 %type <argument_> VariadicCall
451 %type <word_> WordOpt
456 %left "<<" ">>" ">>>"
457 %left "<" ">" "<=" ">=" "instanceof" "in"
458 %left "==" "!=" "===" "!=="
465 %right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
475 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
485 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
490 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
510 : Identifier { $$ = $1; }
511 | "break" NewLineOpt { $$ = $1; }
512 | "case" { $$ = $1; }
513 | "catch" { $$ = $1; }
514 | "class" { $$ = $1; }
515 | "const" { $$ = $1; }
516 | "continue" NewLineOpt { $$ = $1; }
517 | "debugger" { $$ = $1; }
518 | "default" { $$ = $1; }
519 | "delete" { $$ = $1; }
521 | "else" { $$ = $1; }
522 | "enum" { $$ = $1; }
523 | "export" { $$ = $1; }
524 | "extends" { $$ = $1; }
525 | "false" { $$ = $1; }
526 | "finally" { $$ = $1; }
528 | "function" { $$ = $1; }
530 | "import" { $$ = $1; }
531 /* XXX: | "in" { $$ = $1; } */
532 /* XXX: | "instanceof" { $$ = $1; } */
534 | "null" { $$ = $1; }
535 | "return" NewLineOpt { $$ = $1; }
536 | "super" { $$ = $1; }
537 | "switch" { $$ = $1; }
538 | "this" { $$ = $1; }
539 | "throw" NewLineOpt { $$ = $1; }
540 | "true" { $$ = $1; }
542 | "typeof" { $$ = $1; }
544 | "void" { $$ = $1; }
545 | "while" { $$ = $1; }
546 | "with" { $$ = $1; }
551 : Identifier_ { $$ = $1; }
553 | "implements" { $$ = $1; }
554 | "interface" { $$ = $1; }
555 | "package" { $$ = $1; }
556 | "private" { $$ = $1; }
557 | "protected" { $$ = $1; }
558 | "public" { $$ = $1; }
559 | "static" { $$ = $1; }
561 | "abstract" { $$ = $1; }
562 | "boolean" { $$ = $1; }
563 | "byte" { $$ = $1; }
564 | "char" { $$ = $1; }
565 | "double" { $$ = $1; }
566 | "final" { $$ = $1; }
567 | "float" { $$ = $1; }
568 | "goto" { $$ = $1; }
570 | "long" { $$ = $1; }
571 | "native" { $$ = $1; }
572 | "short" { $$ = $1; }
573 | "synchronized" { $$ = $1; }
574 | "throws" { $$ = $1; }
575 | "transient" { $$ = $1; }
576 | "volatile" { $$ = $1; }
579 | "yield" { $$ = $1; }
581 | "each" { $$ = $1; }
585 : Identifier { $$ = $1; }
590 : NullLiteral { $$ = $1; }
591 | BooleanLiteral { $$ = $1; }
592 | NumericLiteral { $$ = $1; }
593 | StringLiteral { $$ = $1; }
594 | RegularExpressionLiteral { $$ = $1; }
598 : "null" { $$ = $1; }
602 : "true" { $$ = $1; }
603 | "false" { $$ = $1; }
606 /* 11.1 Primary Expressions {{{ */
608 : ObjectLiteral { $$ = $1; }
609 | PrimaryExpressionNoBF_ { $$ = $1; }
612 PrimaryExpressionNoBF_
613 : "this" { $$ = $1; }
614 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
615 | Literal { $$ = $1; }
616 | ArrayLiteral { $$ = $1; }
617 | "(" Expression ")" { $$ = $2; }
621 : { driver.BeginCondition(CYDriver::RegExpCondition); }
625 : LexBeginRegExp PrimaryExpression_ { $$ = $2; }
628 PrimaryExpressionNoBF
629 : PrimaryExpressionNoBF_ { $$ = $1; }
632 /* 11.1.4 Array Initialiser {{{ */
634 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
638 : AssignmentExpression { $$ = $1; }
642 : Element { $$ = $1; }
643 | LexBeginRegExp { $$ = NULL; }
647 : ElementList { $$ = $1; }
648 | LexBeginRegExp { $$ = NULL; }
652 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
653 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
656 /* 11.1.5 Object Initialiser {{{ */
658 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
661 PropertyNameAndValueList_
662 : "," PropertyNameAndValueList { $$ = $2; }
666 PropertyNameAndValueListOpt
667 : PropertyNameAndValueList { $$ = $1; }
671 PropertyNameAndValueList
672 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
676 : Identifier { $$ = $1; }
677 | StringLiteral { $$ = $1; }
678 | NumericLiteral { $$ = $1; }
682 /* 11.2 Left-Hand-Side Expressions {{{ */
684 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
688 : "[" Expression "]" { $$ = new(driver.pool_) CYDirectMember(NULL, $2); }
689 | "." Identifier { $$ = new(driver.pool_) CYDirectMember(NULL, new(driver.pool_) CYString($2)); }
693 : PrimaryExpression { $$ = $1; }
694 | FunctionExpression { $$ = $1; }
695 | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
696 | LexBeginRegExp MemberExpression_ { $$ = $2; }
700 : PrimaryExpressionNoBF { $$ = $1; }
701 | MemberExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
702 | MemberExpression_ { $$ = $1; }
706 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
710 : MemberExpression { $$ = $1; }
711 | LexBeginRegExp NewExpression_ { $$ = $2; }
715 : MemberExpressionNoBF { $$ = $1; }
716 | NewExpression_ { $$ = $1; }
720 : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
721 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
722 | CallExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
726 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
727 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
728 | CallExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
732 : "," ArgumentList { $$ = $2; }
737 : ArgumentList { $$ = $1; }
738 | LexBeginRegExp { $$ = NULL; }
742 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
746 : "(" ArgumentListOpt ")" { $$ = $2; }
749 LeftHandSideExpression
750 : NewExpression { $$ = $1; }
751 | CallExpression { $$ = $1; }
754 LeftHandSideExpressionNoBF
755 : NewExpressionNoBF { $$ = $1; }
756 | CallExpressionNoBF { $$ = $1; }
759 /* 11.3 Postfix Expressions {{{ */
761 : AssigneeExpression { $$ = $1; }
762 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
763 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
766 PostfixExpressionNoBF
767 : AssigneeExpressionNoBF { $$ = $1; }
768 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
769 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
772 /* 11.4 Unary Operators {{{ */
774 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
775 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
776 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
777 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
778 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
779 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
780 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
781 | "+" UnaryExpression { $$ = new(driver.pool_) CYAffirm($2); }
782 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
783 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
784 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
788 : PostfixExpression { $$ = $1; }
789 | LexBeginRegExp UnaryExpression_ { $$ = $2; }
793 : PostfixExpressionNoBF { $$ = $1; }
794 | UnaryExpression_ { $$ = $1; }
797 /* 11.5 Multiplicative Operators {{{ */
798 MultiplicativeExpression
799 : UnaryExpression { $$ = $1; }
800 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
801 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
802 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
805 MultiplicativeExpressionNoBF
806 : UnaryExpressionNoBF { $$ = $1; }
807 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
808 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
809 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
812 /* 11.6 Additive Operators {{{ */
814 : MultiplicativeExpression { $$ = $1; }
815 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
816 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
819 AdditiveExpressionNoBF
820 : MultiplicativeExpressionNoBF { $$ = $1; }
821 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
822 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
825 /* 11.7 Bitwise Shift Operators {{{ */
827 : AdditiveExpression { $$ = $1; }
828 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
829 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
830 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
834 : AdditiveExpressionNoBF { $$ = $1; }
835 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
836 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
837 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
840 /* 11.8 Relational Operators {{{ */
841 RelationalExpressionNoIn_
842 : "<" ShiftExpression { $$ = new(driver.pool_) CYLess(NULL, $2); }
843 | ">" ShiftExpression { $$ = new(driver.pool_) CYGreater(NULL, $2); }
844 | "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual(NULL, $2); }
845 | ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual(NULL, $2); }
846 | "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf(NULL, $2); }
849 RelationalExpression_
850 : RelationalExpressionNoIn_ { $$ = $1; }
851 | "in" ShiftExpression { $$ = new(driver.pool_) CYIn(NULL, $2); }
855 : ShiftExpression { $$ = $1; }
856 | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
859 RelationalExpressionNoIn
860 : ShiftExpression { $$ = $1; }
861 | RelationalExpressionNoIn RelationalExpressionNoIn_ { $2->SetLeft($1); $$ = $2; }
864 RelationalExpressionNoBF
865 : ShiftExpressionNoBF { $$ = $1; }
866 | RelationalExpressionNoBF RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
869 /* 11.9 Equality Operators {{{ */
871 : RelationalExpression { $$ = $1; }
872 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
873 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
874 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
875 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
878 EqualityExpressionNoIn
879 : RelationalExpressionNoIn { $$ = $1; }
880 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
881 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
882 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
883 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
886 EqualityExpressionNoBF
887 : RelationalExpressionNoBF { $$ = $1; }
888 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
889 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
890 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
891 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
894 /* 11.10 Binary Bitwise Operators {{{ */
896 : EqualityExpression { $$ = $1; }
897 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
900 BitwiseANDExpressionNoIn
901 : EqualityExpressionNoIn { $$ = $1; }
902 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
905 BitwiseANDExpressionNoBF
906 : EqualityExpressionNoBF { $$ = $1; }
907 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
911 : BitwiseANDExpression { $$ = $1; }
912 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
915 BitwiseXORExpressionNoIn
916 : BitwiseANDExpressionNoIn { $$ = $1; }
917 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
920 BitwiseXORExpressionNoBF
921 : BitwiseANDExpressionNoBF { $$ = $1; }
922 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
926 : BitwiseXORExpression { $$ = $1; }
927 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
930 BitwiseORExpressionNoIn
931 : BitwiseXORExpressionNoIn { $$ = $1; }
932 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
935 BitwiseORExpressionNoBF
936 : BitwiseXORExpressionNoBF { $$ = $1; }
937 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
940 /* 11.11 Binary Logical Operators {{{ */
942 : BitwiseORExpression { $$ = $1; }
943 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
946 LogicalANDExpressionNoIn
947 : BitwiseORExpressionNoIn { $$ = $1; }
948 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
951 LogicalANDExpressionNoBF
952 : BitwiseORExpressionNoBF { $$ = $1; }
953 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
957 : LogicalANDExpression { $$ = $1; }
958 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
961 LogicalORExpressionNoIn
962 : LogicalANDExpressionNoIn { $$ = $1; }
963 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
966 LogicalORExpressionNoBF
967 : LogicalANDExpressionNoBF { $$ = $1; }
968 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
971 /* 11.12 Conditional Operator ( ? : ) {{{ */
972 ConditionalExpression
973 : LogicalORExpression { $$ = $1; }
974 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
977 ConditionalExpressionNoIn
978 : LogicalORExpressionNoIn { $$ = $1; }
979 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
982 ConditionalExpressionNoBF
983 : LogicalORExpressionNoBF { $$ = $1; }
984 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
987 /* 11.13 Assignment Operators {{{ */
988 AssignmentExpression_
989 : "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign(NULL, $2); }
990 | "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign(NULL, $2); }
991 | "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign(NULL, $2); }
992 | "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign(NULL, $2); }
993 | "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign(NULL, $2); }
994 | "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign(NULL, $2); }
995 | "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign(NULL, $2); }
996 | ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign(NULL, $2); }
997 | ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign(NULL, $2); }
998 | "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign(NULL, $2); }
999 | "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign(NULL, $2); }
1000 | "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign(NULL, $2); }
1004 : LeftHandSideExpression { $$ = $1; }
1005 | LexBeginRegExp UnaryAssigneeExpression { $$ = $2; }
1008 AssigneeExpressionNoBF
1009 : LeftHandSideExpressionNoBF { $$ = $1; }
1010 | UnaryAssigneeExpression { $$ = $1; }
1013 AssignmentExpression
1014 : ConditionalExpression { $$ = $1; }
1015 | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1018 AssignmentExpressionNoIn
1019 : ConditionalExpressionNoIn { $$ = $1; }
1020 | AssigneeExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
1021 | AssigneeExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
1022 | AssigneeExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
1023 | AssigneeExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
1024 | AssigneeExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
1025 | AssigneeExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
1026 | AssigneeExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
1027 | AssigneeExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
1028 | AssigneeExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
1029 | AssigneeExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
1030 | AssigneeExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
1031 | AssigneeExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
1034 AssignmentExpressionNoBF
1035 : ConditionalExpressionNoBF { $$ = $1; }
1036 | AssigneeExpressionNoBF AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1039 /* 11.14 Comma Operator {{{ */
1041 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
1046 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
1051 : Expression { $$ = $1; }
1052 | LexBeginRegExp { $$ = NULL; }
1056 : ExpressionNoIn { $$ = $1; }
1057 | LexBeginRegExp { $$ = NULL; }
1061 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1065 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1069 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1073 /* 12 Statements {{{ */
1075 : Block { $$ = $1; }
1076 | VariableStatement { $$ = $1; }
1077 | EmptyStatement { $$ = $1; }
1078 | ExpressionStatement { $$ = $1; }
1079 | IfStatement { $$ = $1; }
1080 | IterationStatement { $$ = $1; }
1081 | ContinueStatement { $$ = $1; }
1082 | BreakStatement { $$ = $1; }
1083 | ReturnStatement { $$ = $1; }
1084 | WithStatement { $$ = $1; }
1085 | LabelledStatement { $$ = $1; }
1086 | SwitchStatement { $$ = $1; }
1087 | ThrowStatement { $$ = $1; }
1088 | TryStatement { $$ = $1; }
1092 : LexBeginRegExp Statement_ { $$ = $2; }
1095 /* 12.1 Block {{{ */
1097 : "{" StatementListOpt "}" { $$ = $2; }
1101 : Block_ { if ($1) $$ = new(driver.pool_) CYBlock($1); else $$ = new(driver.pool_) CYEmpty(); }
1105 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
1109 : StatementList { $$ = $1; }
1110 | LexBeginRegExp { $$ = NULL; }
1113 /* 12.2 Variable Statement {{{ */
1115 : "var" VariableDeclarationList Terminator { $$ = new(driver.pool_) CYVar($2); }
1118 VariableDeclarationList_
1119 : "," VariableDeclarationList { $$ = $2; }
1123 VariableDeclarationListNoIn_
1124 : "," VariableDeclarationListNoIn { $$ = $2; }
1128 VariableDeclarationList
1129 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1132 VariableDeclarationListNoIn
1133 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1137 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1140 VariableDeclarationNoIn
1141 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1145 : Initialiser { $$ = $1; }
1150 : InitialiserNoIn { $$ = $1; }
1155 : "=" AssignmentExpression { $$ = $2; }
1159 : "=" AssignmentExpressionNoIn { $$ = $2; }
1162 /* 12.3 Empty Statement {{{ */
1164 : ";" { $$ = new(driver.pool_) CYEmpty(); }
1167 /* 12.4 Expression Statement {{{ */
1169 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
1172 /* 12.5 The if Statement {{{ */
1174 : "else" Statement { $$ = $2; }
1175 | %prec "if" { $$ = NULL; }
1179 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1183 /* 12.6 Iteration Statements {{{ */
1185 : DoWhileStatement { $$ = $1; }
1186 | WhileStatement { $$ = $1; }
1187 | ForStatement { $$ = $1; }
1188 | ForInStatement { $$ = $1; }
1191 /* 12.6.1 The do-while Statement {{{ */
1193 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1196 /* 12.6.2 The while Statement {{{ */
1198 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1201 /* 12.6.3 The for Statement {{{ */
1203 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1206 ForStatementInitialiser
1207 : ExpressionNoInOpt { $$ = $1; }
1208 | LexBeginRegExp "var" VariableDeclarationListNoIn { $$ = $3; }
1211 /* 12.6.4 The for-in Statement {{{ */
1213 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1216 ForInStatementInitialiser
1217 : LeftHandSideExpression { $$ = $1; }
1218 | LexBeginRegExp "var" VariableDeclarationNoIn { $$ = $3; }
1222 /* 12.7 The continue Statement {{{ */
1224 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1227 /* 12.8 The break Statement {{{ */
1229 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1232 /* 12.9 The return Statement {{{ */
1234 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1237 /* 12.10 The with Statement {{{ */
1239 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1243 /* 12.11 The switch Statement {{{ */
1245 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1249 : "{" CaseClausesOpt "}" { $$ = $2; }
1253 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1254 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1259 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1263 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1266 /* 12.12 Labelled Statements {{{ */
1268 : Identifier ":" Statement { $$ = new(driver.pool_) CYLabel($1, $3); }
1271 /* 12.13 The throw Statement {{{ */
1273 : "throw" Expression Terminator { $$ = new(driver.pool_) CYThrow($2); }
1276 /* 12.14 The try Statement {{{ */
1278 : "try" Block_ CatchOpt FinallyOpt { $$ = new(driver.pool_) CYTry($2, $3, $4); }
1282 : "catch" "(" Identifier ")" Block_ { $$ = new(driver.pool_) CYCatch($3, $5); }
1287 : "finally" Block_ { $$ = new(driver.pool_) CYFinally($2); }
1292 /* 13 Function Definition {{{ */
1294 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionStatement($2, $4, $7); }
1298 : LexBeginRegExp "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($3, $5, $8); }
1301 FormalParameterList_
1302 : "," FormalParameterList { $$ = $2; }
1307 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYFunctionParameter($1, $2); }
1312 : SourceElements { $$ = $1; }
1315 /* 14 Program {{{ */
1317 : SourceElements { driver.program_ = new(driver.pool_) CYProgram($1); }
1321 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
1322 | LexBeginRegExp { $$ = NULL; }
1326 : Statement_ { $$ = $1; }
1327 | FunctionDeclaration { $$ = $1; }
1331 : LexBeginRegExp SourceElement_ { $$ = $2; }
1336 /* Cycript (Objective-C): @class Declaration {{{ */
1338 /* XXX: why the hell did I choose MemberExpressionNoBF? */
1339 : ":" LexBeginRegExp MemberExpressionNoBF { $$ = $3; }
1344 : "{" "}" { $$ = NULL; }
1348 : "+" { $$ = false; }
1349 | "-" { $$ = true; }
1353 : "(" Expression ")" { $$ = $2; }
1358 : Word ":" TypeOpt Identifier { $$ = new(driver.pool_) CYMessageParameter($1, $3, $4); }
1361 MessageParameterListOpt
1362 : MessageParameterList { $$ = $1; }
1366 MessageParameterList
1367 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1371 : MessageParameterList { $$ = $1; }
1372 | Word { $$ = new(driver.pool_) CYMessageParameter($1, NULL, NULL); }
1375 ClassMessageDeclaration
1376 : MessageScope TypeOpt MessageParameters "{" FunctionBody "}" { $$ = new(driver.pool_) CYMessage($1, $2, $3, $5); }
1379 ClassMessageDeclarationListOpt
1380 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1385 : Identifier { $$ = $1; }
1386 | "(" AssignmentExpression ")" { $$ = $2; }
1390 : ClassName { $$ = $1; }
1395 : "@class" ClassNameOpt ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5); }
1399 : "@class" ClassName ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5); }
1403 : "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $3); }
1407 : ClassExpression { $$ = $1; }
1411 : ClassStatement { $$ = $1; }
1412 | CategoryStatement { $$ = $1; }
1415 /* Cycript (Objective-C): Send Message {{{ */
1417 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1422 : SelectorCall { $$ = $1; }
1423 | VariadicCall { $$ = $1; }
1427 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1431 : SelectorCall { $$ = $1; }
1432 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1436 : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYSendDirect($2, $3); }
1437 | "[" LexBeginRegExp "super" SelectorList "]" { $$ = new(driver.pool_) CYSendSuper($4); }
1440 SelectorExpressionOpt
1441 : SelectorExpression_ { $$ = $1; }
1446 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
1450 : SelectorExpression_ { $$ = $1; }
1451 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
1454 PrimaryExpressionNoBF_
1455 : MessageExpression { $$ = $1; }
1456 | "@selector" "(" SelectorExpression ")" { $$ = new(driver.pool_) CYSelector($3); }
1462 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1463 UnaryAssigneeExpression
1464 : "*" UnaryExpression { $$ = new(driver.pool_) CYIndirect($2); }
1468 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }
1472 : "->" "[" Expression "]" { $$ = new(driver.pool_) CYIndirectMember(NULL, $3); }
1473 | "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
1479 /* 8.3 XML Initialiser Input Elements {{{ */
1486 /* 11.1 Primary Expressions {{{ */
1487 PrimaryExpressionNoBF_
1488 : PropertyIdentifier
1490 | XMLListInitialiser
1494 : AttributeIdentifier
1495 | QualifiedIdentifier
1496 | WildcardIdentifier
1499 /* 11.1.1 Attribute Identifiers {{{ */
1501 : "@" PropertySelector
1502 | "@" QualifiedIdentifier
1503 | "@" "[" Expression "]"
1508 | WildcardIdentifier
1511 /* 11.1.2 Qualified Identifiers {{{ */
1513 : PropertySelector "::" PropertySelector
1514 | PropertySelector "::" "[" Expression "]"
1517 /* 11.1.3 Wildcard Identifiers {{{ */
1522 /* 11.1.4 XML Initialiser {{{ */
1529 : "<" XMLTagContent XMLWhitespaceOpt "/>"
1530 | "<" XMLTagContent XMLWhitespace ">" XMLElementContentOpt "</" XMLTagName XMLWhitespaceOpt ">"
1534 : XMLTagName XMLAttributesOpt
1538 : "{" Expression "}"
1543 : XMLWhitespace "{" Expression "}"
1544 | XMLAttributeOpt XMLAttributes
1553 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt "{" Expression "}"
1554 | XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue
1563 : "{" Expression "}" XMLElementContentOpt
1564 | XMLMarkup XMLElementContentOpt
1565 | XMLText XMLElementContentOpt
1566 | XMLElement XMLElementContentOpt
1569 XMLElementContentOpt
1574 /* 11.1.5 XMLList Initialiser {{{ */
1576 : "<>" XMLElementContent "</>"
1581 /* ECMAScript5: Object Literal Trailing Comma {{{ */
1582 PropertyNameAndValueList_
1583 : "," { $$ = NULL; }
1586 /* JavaScript 1.7: Array Comprehensions {{{ */
1588 : "if" "(" Expression ")" { $$ = new(driver.pool_) CYIfComprehension($3); }
1592 : "for" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForInComprehension($3, $5); }
1593 | "for" "each" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForEachInComprehension($4, $6); }
1596 ComprehensionListOpt
1597 : ComprehensionList { $$ = $1; }
1598 | IfComprehension { $$ = $1; }
1603 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1606 PrimaryExpressionNoBF_
1607 : "[" AssignmentExpression ComprehensionList "]" { $$ = new(driver.pool_) CYArrayComprehension($2, $3); }
1610 /* JavaScript 1.7: for each {{{ */
1612 : "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForEachIn($4, $6, $8); }
1615 /* JavaScript 1.7: let Statements {{{ *//*
1617 : "let" "(" VariableDeclarationList ")" Block_ { $$ = new(driver.pool_) CYLet($3, $5); }
1624 /* JavaScript FTW: Function Statements {{{ */
1626 : LexBeginRegExp FunctionDeclaration { driver.Warning(yylloc, "warning, FunctionDeclaration is a SourceElement, not a Statement"); } { $$ = $2; }