1 /* Cycript - Optimizing JavaScript Compiler/Runtime
2 * Copyright (C) 2009-2012 Jay Freeman (saurik)
5 /* GNU Lesser General Public License, Version 3 {{{ */
7 * Cycript is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
12 * Cycript is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with Cycript. If not, see <http://www.gnu.org/licenses/>.
24 @if Bison24 %code top {
25 #define cyscanner driver.scanner_
26 #define YYSTACKEXPANDABLE 1
27 @if Bison23 #define yyerrok (yyerrstatus_ = 0)
30 @if Bison24 %code requires {
32 #define CYNew new($pool)
35 #include "ObjectiveC/Syntax.hpp"
39 #include "E4X/Syntax.hpp"
48 CYDriver::Condition condition_;
50 CYArgument *argument_;
51 CYAssignment *assignment_;
54 cy::Syntax::Catch *catch_;
56 CYComprehension *comprehension_;
57 CYCompound *compound_;
58 CYDeclaration *declaration_;
59 CYDeclarations *declarations_;
61 CYExpression *expression_;
64 CYForInitialiser *for_;
65 CYForInInitialiser *forin_;
66 CYFunctionParameter *functionParameter_;
67 CYIdentifier *identifier_;
74 CYProperty *property_;
75 CYPropertyName *propertyName_;
76 CYRubyProc *rubyProc_;
77 CYStatement *statement_;
84 CYClassName *className_;
87 CYMessageParameter *messageParameter_;
88 CYProtocol *protocol_;
89 CYSelectorPart *selector_;
93 CYAttribute *attribute_;
94 CYPropertyIdentifier *propertyIdentifier_;
95 CYSelector *selector_;
100 #define YYSTYPE YYSTYPE
103 @if Bison24 %code provides {
104 int cylex(YYSTYPE *, cy::location *, void *);
111 @if Bison23 %skeleton "lalr1.cc"
112 @if Bison24 %language "C++"
115 @$.begin.filename = @$.end.filename = &driver.filename_;
126 %parse-param { CYDriver &driver }
127 %lex-param { void *cyscanner }
129 /* Token Declarations {{{ */
135 %token XMLAttributeValue
137 %token XMLTagCharacters
143 %token LeftRight "<>"
144 %token LeftSlashRight "</>"
146 %token SlashRight "/>"
147 %token LeftSlash "</"
149 %token ColonColon "::"
150 %token PeriodPeriod ".."
153 @begin E4X ObjectiveC
158 %token AmpersandAmpersand "&&"
159 %token AmpersandEqual "&="
161 %token CarrotEqual "^="
163 %token EqualEqual "=="
164 %token EqualEqualEqual "==="
165 %token EqualRight "=>"
166 %token Exclamation "!"
167 %token ExclamationEqual "!="
168 %token ExclamationEqualEqual "!=="
170 %token HyphenEqual "-="
171 %token HyphenHyphen "--"
172 %token HyphenHyphen_ "\n--"
173 %token HyphenRight "->"
175 %token LeftEqual "<="
177 %token LeftLeftEqual "<<="
179 %token PercentEqual "%="
181 %token PeriodPeriodPeriod "..."
183 %token PipeEqual "|="
186 %token PlusEqual "+="
188 %token PlusPlus_ "\n++"
190 %token RightEqual ">="
191 %token RightRight ">>"
192 %token RightRightEqual ">>="
193 %token RightRightRight ">>>"
194 %token RightRightRightEqual ">>>="
196 %token SlashEqual "/="
198 %token StarEqual "*="
207 %token <comment_> Comment
210 %token CloseParen ")"
213 %token OpenBrace_ "\n{"
214 %token OpenBrace__ ";{"
215 %token CloseBrace "}"
217 %token OpenBracket "["
218 %token CloseBracket "]"
221 %token AtClass "@class"
225 %token AtImplementation "@implementation"
226 %token AtImplementation_ ";@implementation"
227 %token AtImport "@import"
229 %token AtSelector "@selector"
232 %token <false_> False "false"
233 %token <null_> Null "null"
234 %token <true_> True "true"
236 // ES3/ES5/WIE/JSC Reserved
237 %token <word_> Break "break"
238 %token <word_> Case "case"
239 %token <word_> Catch "catch"
240 %token <word_> Continue "continue"
241 %token <word_> Default "default"
242 %token <word_> Delete "delete"
243 %token <word_> Do "do"
244 %token <word_> Else "else"
245 %token <word_> Finally "finally"
246 %token <word_> For "for"
247 %token <word_> Function "function"
248 %token <word_> Function_ ";function"
249 %token <word_> If "if"
250 %token <word_> In "in"
251 %token <word_> In_ "!in"
252 %token <word_> InstanceOf "instanceof"
253 %token <word_> New "new"
254 %token <word_> Return "return"
255 %token <word_> Switch "switch"
256 %token <this_> This "this"
257 %token <word_> Throw "throw"
258 %token <word_> Try "try"
259 %token <word_> TypeOf "typeof"
260 %token <word_> Var "var"
261 %token <word_> Void "void"
262 %token <word_> While "while"
263 %token <word_> With "with"
265 // ES3/IE6 Future, ES5/JSC Reserved
266 %token <word_> Debugger "debugger"
268 // ES3/ES5/IE6 Future, JSC Reserved
269 %token <word_> Const "const"
271 // ES3/ES5/IE6/JSC Future
272 %token <word_> Class "class"
273 %token <word_> Enum "enum"
274 %token <word_> Export "export"
275 %token <word_> Extends "extends"
276 %token <word_> Import "import"
277 %token <word_> Super "super"
279 // ES3 Future, ES5 Strict Future
280 %token <identifier_> Implements "implements"
281 %token <identifier_> Interface "interface"
282 %token <identifier_> Package "package"
283 %token <identifier_> Private "private"
284 %token <identifier_> Protected "protected"
285 %token <identifier_> Public "public"
286 %token <identifier_> Static "static"
289 %token <identifier_> Abstract "abstract"
290 %token <identifier_> Boolean "boolean"
291 %token <identifier_> Byte "byte"
292 %token <identifier_> Char "char"
293 %token <identifier_> Double "double"
294 %token <identifier_> Final "final"
295 %token <identifier_> Float "float"
296 %token <identifier_> Goto "goto"
297 %token <identifier_> Int "int"
298 %token <identifier_> Long "long"
299 %token <identifier_> Native "native"
300 %token <identifier_> Short "short"
301 %token <identifier_> Synchronized "synchronized"
302 %token <identifier_> Throws "throws"
303 %token <identifier_> Transient "transient"
304 %token <identifier_> Volatile "volatile"
307 %token <identifier_> Let "let"
308 %token <identifier_> Yield "yield"
311 %token <identifier_> Each "each"
312 %token <identifier_> Of "of"
316 %token <identifier_> Namespace "namespace"
317 %token <identifier_> XML "xml"
322 %token <identifier_> Identifier_
323 %token <number_> NumericLiteral
324 %token <string_> StringLiteral
325 %token <literal_> RegularExpressionLiteral
327 %type <expression_> AdditiveExpression
328 %type <argument_> ArgumentList_
329 %type <argument_> ArgumentList
330 %type <argument_> ArgumentListOpt
331 %type <argument_> Arguments
332 %type <literal_> ArrayLiteral
333 %type <expression_> ArrowFunction
334 %type <functionParameter_> ArrowParameters
335 %type <expression_> AssignmentExpression
336 %type <identifier_> BindingIdentifier
337 %type <expression_> BitwiseANDExpression
338 %type <statement_> Block_
339 %type <statement_> Block
340 %type <boolean_> BooleanLiteral
341 %type <declaration_> BindingElement
342 %type <expression_> BitwiseORExpression
343 %type <expression_> BitwiseXORExpression
344 %type <statement_> BreakStatement
345 %type <statement_> BreakableStatement
346 %type <expression_> CallExpression_
347 %type <expression_> CallExpression
348 %type <clause_> CaseBlock
349 %type <clause_> CaseClause
350 %type <clause_> CaseClausesOpt
351 %type <catch_> CatchOpt
352 %type <comprehension_> ComprehensionList
353 %type <comprehension_> ComprehensionListOpt
354 %type <expression_> ConditionalExpression
355 %type <statement_> ContinueStatement
356 %type <statement_> ConciseBody
357 %type <statement_> DebuggerStatement
358 %type <statement_> Declaration__
359 %type <statement_> Declaration_
360 %type <statement_> Declaration
361 %type <clause_> DefaultClause
362 %type <expression_> Element
363 %type <expression_> ElementOpt
364 %type <element_> ElementList
365 %type <element_> ElementListOpt
366 %type <statement_> ElseStatementOpt
367 %type <statement_> EmptyStatement
368 %type <expression_> EqualityExpression
369 %type <compound_> Expression_
370 %type <compound_> Expression
371 %type <expression_> ExpressionOpt
372 %type <statement_> ExpressionStatement
373 %type <finally_> FinallyOpt
374 %type <comprehension_> ForComprehension
375 %type <for_> ForStatementInitialiser
376 %type <forin_> ForInStatementInitialiser
377 %type <declaration_> FormalParameter
378 %type <functionParameter_> FormalParameterList_
379 %type <functionParameter_> FormalParameterList
380 %type <functionParameter_> FormalParameterListOpt
381 %type <statement_> FunctionBody
382 %type <statement_> FunctionDeclaration
383 %type <expression_> FunctionExpression
384 %type <identifier_> Identifier
385 %type <identifier_> IdentifierOpt
386 %type <word_> IdentifierName
387 %type <comprehension_> IfComprehension
388 %type <statement_> IfStatement
389 %type <expression_> Initialiser
390 %type <expression_> InitialiserOpt
391 %type <statement_> IterationStatement
392 %type <statement_> LabelledStatement
393 %type <expression_> LeftHandSideExpression
394 %type <statement_> LetStatement
395 %type <statement_> LexicalDeclaration
396 %type <literal_> Literal
397 %type <literal_> ValueLiteral
398 %type <expression_> LogicalANDExpression
399 %type <expression_> LogicalORExpression
400 %type <member_> MemberAccess
401 %type <expression_> MemberExpression_
402 %type <expression_> MemberExpression
403 %type <expression_> MultiplicativeExpression
404 %type <expression_> NewExpression
405 %type <null_> NullLiteral
406 %type <literal_> ObjectLiteral
407 %type <compound_> Parenthetical
408 %type <compound_> ParentheticalOpt
409 %type <expression_> PostfixExpression
410 %type <expression_> PrimaryExpression
411 %type <statement_> Program
412 %type <statement_> ProgramBody
413 %type <statement_> ProgramBodyOpt
414 %type <propertyName_> PropertyName_
415 %type <propertyName_> PropertyName
416 %type <property_> PropertyDefinition
417 %type <property_> PropertyDefinitionList_
418 %type <property_> PropertyDefinitionList
419 %type <property_> PropertyDefinitionListOpt
420 %type <expression_> RelationalExpression
421 %type <statement_> ReturnStatement
422 %type <rubyProc_> RubyProcExpression
423 %type <functionParameter_> RubyProcParameterList_
424 %type <functionParameter_> RubyProcParameterList
425 %type <functionParameter_> RubyProcParameters
426 %type <functionParameter_> RubyProcParametersOpt
427 %type <expression_> ShiftExpression
428 %type <declaration_> SingleNameBinding
429 %type <statement_> Statement__
430 %type <statement_> Statement_
431 %type <statement_> Statement
432 %type <statement_> StatementList
433 %type <statement_> StatementListOpt
434 %type <statement_> StatementListItem
435 %type <statement_> SwitchStatement
436 %type <statement_> ThrowStatement
437 %type <statement_> TryStatement
438 %type <expression_> UnaryExpression_
439 %type <expression_> UnaryExpression
440 %type <declaration_> VariableDeclaration
441 %type <declarations_> VariableDeclarationList_
442 %type <declarations_> VariableDeclarationList
443 %type <statement_> VariableStatement
444 %type <statement_> WithStatement
446 %type <word_> WordOpt
449 %type <expression_> BoxableExpression
450 %type <statement_> CategoryStatement
451 %type <expression_> ClassExpression
452 %type <statement_> ClassStatement
453 %type <expression_> ClassSuperOpt
454 %type <field_> ClassFieldList
455 %type <message_> ClassMessageDeclaration
456 %type <message_> ClassMessageDeclarationListOpt
457 %type <className_> ClassName
458 %type <className_> ClassNameOpt
459 %type <protocol_> ClassProtocolListOpt
460 %type <protocol_> ClassProtocols
461 %type <protocol_> ClassProtocolsOpt
462 %type <expression_> MessageExpression
463 %type <messageParameter_> MessageParameter
464 %type <messageParameter_> MessageParameters
465 %type <messageParameter_> MessageParameterList
466 %type <messageParameter_> MessageParameterListOpt
467 %type <bool_> MessageScope
468 %type <argument_> SelectorCall_
469 %type <argument_> SelectorCall
470 %type <selector_> SelectorExpression_
471 %type <selector_> SelectorExpression
472 %type <selector_> SelectorExpressionOpt
473 %type <argument_> SelectorList
474 %type <word_> SelectorWordOpt
475 %type <expression_> TypeOpt
476 %type <argument_> VariadicCall
480 %type <propertyIdentifier_> PropertyIdentifier_
481 %type <selector_> PropertySelector_
482 %type <selector_> PropertySelector
483 %type <identifier_> QualifiedIdentifier_
484 %type <identifier_> QualifiedIdentifier
485 %type <identifier_> WildcardIdentifier
486 %type <identifier_> XMLComment
487 %type <identifier_> XMLCDATA
488 %type <identifier_> XMLElement
489 %type <identifier_> XMLElementContent
490 %type <identifier_> XMLMarkup
491 %type <identifier_> XMLPI
493 %type <attribute_> AttributeIdentifier
494 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
495 %type <expression_> PropertyIdentifier
496 %type <expression_> XMLListInitialiser
497 %type <expression_> XMLInitialiser
500 /* Token Priorities {{{ */
512 /* Lexer State {{{ */
514 : { driver.in_.push(true); }
518 : { driver.in_.push(false); }
522 : { driver.in_.pop(); }
526 : { driver.SetCondition(CYDriver::RegExpCondition); }
530 : { if (yychar == yyempty_) driver.nobrace_ = true; else if (yychar == token::OpenBrace || yychar == token::OpenBrace_) yychar = token::OpenBrace__; }
534 : { if (yychar == token::Function) yychar = token::Function_; }
537 LexNoAtImplementation
538 : { if (yychar == token::AtImplementation) yychar = token::AtImplementation_; }
542 : LexNoBrace LexNoFunction LexNoAtImplementation
545 /* Virtual Tokens {{{ */
552 /* 7.6 Identifier Names and Identifiers {{{ */
563 : Identifier { $$ = $1; }
564 | "break" NewLineOpt { $$ = $1; }
565 | "case" { $$ = $1; }
566 | "catch" { $$ = $1; }
567 | "class" { $$ = $1; }
568 | "const" { $$ = $1; }
569 | "continue" NewLineOpt { $$ = $1; }
570 | "debugger" { $$ = $1; }
571 | "default" { $$ = $1; }
572 | "delete" { $$ = $1; }
574 | "else" { $$ = $1; }
575 | "enum" { $$ = $1; }
576 | "export" { $$ = $1; }
577 | "extends" { $$ = $1; }
578 | "false" { $$ = $1; }
579 | "finally" { $$ = $1; }
580 /* XXX: | "for" { $$ = $1; } */
581 | "function" { $$ = $1; }
583 | "import" { $$ = $1; }
584 /* XXX: | "in" { $$ = $1; } */
586 /* XXX: | "instanceof" { $$ = $1; } */
588 // XXX: as it currently is not an Identifier
592 | "null" { $$ = $1; }
593 | "return" NewLineOpt { $$ = $1; }
594 | "super" { $$ = $1; }
595 | "switch" { $$ = $1; }
596 | "this" { $$ = $1; }
597 | "throw" NewLineOpt { $$ = $1; }
598 | "true" { $$ = $1; }
600 | "typeof" { $$ = $1; }
602 | "void" { $$ = $1; }
603 | "while" { $$ = $1; }
604 | "with" { $$ = $1; }
613 : Identifier_ { $$ = $1; }
615 | "implements" { $$ = $1; }
616 | "interface" { $$ = $1; }
617 | "package" { $$ = $1; }
618 | "private" { $$ = $1; }
619 | "protected" { $$ = $1; }
620 | "public" { $$ = $1; }
621 | "static" { $$ = $1; }
623 | "abstract" { $$ = $1; }
624 | "boolean" { $$ = $1; }
625 | "byte" { $$ = $1; }
626 | "char" { $$ = $1; }
627 | "double" { $$ = $1; }
628 | "final" { $$ = $1; }
629 | "float" { $$ = $1; }
630 | "goto" { $$ = $1; }
632 | "long" { $$ = $1; }
633 | "native" { $$ = $1; }
634 | "short" { $$ = $1; }
635 | "synchronized" { $$ = $1; }
636 | "throws" { $$ = $1; }
637 | "transient" { $$ = $1; }
638 | "volatile" { $$ = $1; }
640 // XXX: currently I only have this as Word
641 // | "let" { $$ = $1; }
643 | "yield" { $$ = $1; }
645 | "each" { $$ = $1; }
650 : Identifier { $$ = $1; }
655 /* 7.8 Literals {{{ */
657 : NullLiteral { $$ = $1; }
658 | ValueLiteral { $$ = $1; }
662 : BooleanLiteral { $$ = $1; }
663 | NumericLiteral { $$ = $1; }
664 | StringLiteral { $$ = $1; }
665 | RegularExpressionLiteral { $$ = $1; }
668 /* 7.8.1 Null Literals {{{ */
670 : "null" { $$ = $1; }
673 /* 7.8.2 Boolean Literals {{{ */
675 : "true" { $$ = $1; }
676 | "false" { $$ = $1; }
680 /* 7.9 Automatic Semicolon Insertion {{{ */
682 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
687 | error { if (yychar != yyeof_ && yychar != token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
692 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
696 /* 11.1 Primary Expressions {{{ */
698 : "(" LexPushInOff Expression LexPopIn ")" { $$ = $3; }
702 : Parenthetical { $$ = $1; }
707 : "this" { $$ = $1; }
708 | Identifier { $$ = CYNew CYVariable($1); }
709 | Literal { $$ = $1; }
710 | ArrayLiteral { $$ = $1; }
711 | ObjectLiteral { $$ = $1; }
712 | FunctionExpression { $$ = $1; }
713 | Parenthetical { $$ = $1; }
714 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
717 /* 11.1.4.1 Array Initialiser {{{ */
719 : "[" LexPushInOff ElementListOpt LexPopIn "]" { $$ = CYNew CYArray($3); }
723 : AssignmentExpression { $$ = $1; }
727 : Element { $$ = $1; }
728 | LexSetRegExp { $$ = NULL; }
732 : ElementOpt "," ElementListOpt { $$ = CYNew CYElement($1, $3); }
733 | Element { $$ = CYNew CYElement($1, NULL); }
737 : ElementList { $$ = $1; }
738 | LexSetRegExp { $$ = NULL; }
741 /* 11.1.5 Object Initialiser {{{ */
743 : BRACE LexPushInOff PropertyDefinitionListOpt LexPopIn "}" { $$ = CYNew CYObject($3); }
746 PropertyDefinitionList_
747 : "," PropertyDefinitionList { $$ = $2; }
752 PropertyDefinitionList
753 : PropertyDefinition PropertyDefinitionList_ { $1->SetNext($2); $$ = $1; }
756 PropertyDefinitionListOpt
757 : PropertyDefinitionList { $$ = $1; }
762 // XXX: this should be IdentifierName
763 : LexSetRegExp Identifier { $$ = CYNew CYProperty($2, CYNew CYVariable($2)); }
764 | PropertyName ":" AssignmentExpression { $$ = CYNew CYProperty($1, $3); }
769 : IdentifierName { $$ = $1; }
770 | StringLiteral { $$ = $1; }
771 | NumericLiteral { $$ = $1; }
775 : LexSetRegExp PropertyName_ { $$ = $2; }
779 /* 11.2 Left-Hand-Side Expressions {{{ */
781 : "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYDirectMember(NULL, $3); }
782 | "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
783 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
787 : MemberExpression { $$ = $1; }
788 //| "super" { $$ = $1; }
792 : LexSetRegExp PrimaryExpression { $$ = $2; }
793 | MemberExpression_ { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
794 | LexSetRegExp "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($3, $4); }
798 : MemberExpression { $$ = $1; }
799 | LexSetRegExp "new" NewExpression { $$ = CYNew cy::Syntax::New($3, NULL); }
808 : CallExpression_ Arguments { $$ = CYNew CYCall($1, $2); }
809 | CallExpression { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
813 : "(" LexPushInOff ArgumentListOpt LexPopIn ")" { $$ = $3; }
817 : "," ArgumentList { $$ = $2; }
822 : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
826 : ArgumentList { $$ = $1; }
827 | LexSetRegExp { $$ = NULL; }
830 LeftHandSideExpression
831 : NewExpression { $$ = $1; }
832 | CallExpression { $$ = $1; }
835 /* 11.3 Postfix Expressions {{{ */
837 : %prec "" LeftHandSideExpression { $$ = $1; }
838 | LeftHandSideExpression "++" { $$ = CYNew CYPostIncrement($1); }
839 | LeftHandSideExpression "--" { $$ = CYNew CYPostDecrement($1); }
842 /* 11.4 Unary Operators {{{ */
844 : "delete" UnaryExpression { $$ = CYNew CYDelete($2); }
845 | "void" UnaryExpression { $$ = CYNew CYVoid($2); }
846 | "typeof" UnaryExpression { $$ = CYNew CYTypeOf($2); }
847 | "++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
848 | "\n++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
849 | "--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
850 | "\n--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
851 | "+" UnaryExpression { $$ = CYNew CYAffirm($2); }
852 | "-" UnaryExpression { $$ = CYNew CYNegate($2); }
853 | "~" UnaryExpression { $$ = CYNew CYBitwiseNot($2); }
854 | "!" UnaryExpression { $$ = CYNew CYLogicalNot($2); }
858 : PostfixExpression { $$ = $1; }
859 | LexSetRegExp UnaryExpression_ { $$ = $2; }
862 /* 11.5 Multiplicative Operators {{{ */
863 MultiplicativeExpression
864 : UnaryExpression { $$ = $1; }
865 | MultiplicativeExpression "*" UnaryExpression { $$ = CYNew CYMultiply($1, $3); }
866 | MultiplicativeExpression "/" UnaryExpression { $$ = CYNew CYDivide($1, $3); }
867 | MultiplicativeExpression "%" UnaryExpression { $$ = CYNew CYModulus($1, $3); }
870 /* 11.6 Additive Operators {{{ */
872 : MultiplicativeExpression { $$ = $1; }
873 | AdditiveExpression "+" MultiplicativeExpression { $$ = CYNew CYAdd($1, $3); }
874 | AdditiveExpression "-" MultiplicativeExpression { $$ = CYNew CYSubtract($1, $3); }
877 /* 11.7 Bitwise Shift Operators {{{ */
879 : AdditiveExpression { $$ = $1; }
880 | ShiftExpression "<<" AdditiveExpression { $$ = CYNew CYShiftLeft($1, $3); }
881 | ShiftExpression ">>" AdditiveExpression { $$ = CYNew CYShiftRightSigned($1, $3); }
882 | ShiftExpression ">>>" AdditiveExpression { $$ = CYNew CYShiftRightUnsigned($1, $3); }
885 /* 11.8 Relational Operators {{{ */
887 : ShiftExpression { $$ = $1; }
888 | RelationalExpression "<" ShiftExpression { $$ = CYNew CYLess($1, $3); }
889 | RelationalExpression ">" ShiftExpression { $$ = CYNew CYGreater($1, $3); }
890 | RelationalExpression "<=" ShiftExpression { $$ = CYNew CYLessOrEqual($1, $3); }
891 | RelationalExpression ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual($1, $3); }
892 | RelationalExpression "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf($1, $3); }
893 | RelationalExpression "in" ShiftExpression { $$ = CYNew CYIn($1, $3); }
896 /* 11.9 Equality Operators {{{ */
898 : RelationalExpression { $$ = $1; }
899 | EqualityExpression "==" RelationalExpression { $$ = CYNew CYEqual($1, $3); }
900 | EqualityExpression "!=" RelationalExpression { $$ = CYNew CYNotEqual($1, $3); }
901 | EqualityExpression "===" RelationalExpression { $$ = CYNew CYIdentical($1, $3); }
902 | EqualityExpression "!==" RelationalExpression { $$ = CYNew CYNotIdentical($1, $3); }
905 /* 11.10 Binary Bitwise Operators {{{ */
907 : EqualityExpression { $$ = $1; }
908 | BitwiseANDExpression "&" EqualityExpression { $$ = CYNew CYBitwiseAnd($1, $3); }
912 : BitwiseANDExpression { $$ = $1; }
913 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = CYNew CYBitwiseXOr($1, $3); }
917 : BitwiseXORExpression { $$ = $1; }
918 | BitwiseORExpression "|" BitwiseXORExpression { $$ = CYNew CYBitwiseOr($1, $3); }
921 /* 11.11 Binary Logical Operators {{{ */
923 : BitwiseORExpression { $$ = $1; }
924 | LogicalANDExpression "&&" BitwiseORExpression { $$ = CYNew CYLogicalAnd($1, $3); }
928 : LogicalANDExpression { $$ = $1; }
929 | LogicalORExpression "||" LogicalANDExpression { $$ = CYNew CYLogicalOr($1, $3); }
932 /* 11.12 Conditional Operator ( ? : ) {{{ */
933 ConditionalExpression
934 : LogicalORExpression { $$ = $1; }
935 | LogicalORExpression "?" LexPushInOff AssignmentExpression LexPopIn ":" AssignmentExpression { $$ = CYNew CYCondition($1, $4, $7); }
938 /* 11.13 Assignment Operators {{{ */
940 : ConditionalExpression { $$ = $1; }
941 | ArrowFunction { $$ = $1; }
942 | LeftHandSideExpression "=" AssignmentExpression { $$ = CYNew CYAssign($1, $3); }
943 | LeftHandSideExpression "*=" AssignmentExpression { $$ = CYNew CYMultiplyAssign($1, $3); }
944 | LeftHandSideExpression "/=" AssignmentExpression { $$ = CYNew CYDivideAssign($1, $3); }
945 | LeftHandSideExpression "%=" AssignmentExpression { $$ = CYNew CYModulusAssign($1, $3); }
946 | LeftHandSideExpression "+=" AssignmentExpression { $$ = CYNew CYAddAssign($1, $3); }
947 | LeftHandSideExpression "-=" AssignmentExpression { $$ = CYNew CYSubtractAssign($1, $3); }
948 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = CYNew CYShiftLeftAssign($1, $3); }
949 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = CYNew CYShiftRightSignedAssign($1, $3); }
950 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = CYNew CYShiftRightUnsignedAssign($1, $3); }
951 | LeftHandSideExpression "&=" AssignmentExpression { $$ = CYNew CYBitwiseAndAssign($1, $3); }
952 | LeftHandSideExpression "^=" AssignmentExpression { $$ = CYNew CYBitwiseXOrAssign($1, $3); }
953 | LeftHandSideExpression "|=" AssignmentExpression { $$ = CYNew CYBitwiseOrAssign($1, $3); }
956 /* 11.14 Comma Operator {{{ */
958 : "," Expression { $$ = $2; }
959 | { $$ = CYNew CYCompound(); }
963 : AssignmentExpression Expression_ { $2->AddPrev($1); $$ = $2; }
967 : Expression { $$ = $1; }
968 | LexSetRegExp { $$ = NULL; }
972 /* 12 Statements {{{ */
975 | VariableStatement { $$ = $1; }
976 | EmptyStatement { $$ = $1; }
977 | IfStatement { $$ = $1; }
978 | BreakableStatement { $$ = $1; }
979 | ContinueStatement { $$ = $1; }
980 | BreakStatement { $$ = $1; }
981 | ReturnStatement { $$ = $1; }
982 | WithStatement { $$ = $1; }
983 | LabelledStatement { $$ = $1; }
984 | ThrowStatement { $$ = $1; }
985 | TryStatement { $$ = $1; }
986 | DebuggerStatement { $$ = $1; }
990 : LexSetRegExp Statement__ { $$ = $2; }
991 | ExpressionStatement { $$ = $1; }
995 : LexSetStatement Statement_ { $$ = $2; }
999 : FunctionDeclaration { $$ = $1; }
1000 | LexicalDeclaration { $$ = $1; }
1004 : LexSetRegExp Declaration__ { $$ = $2; }
1008 : LexSetStatement Declaration_ { $$ = $2; }
1012 : IterationStatement { $$ = $1; }
1013 | SwitchStatement { $$ = $1; }
1016 /* 12.1 Block {{{ */
1018 : BRACE StatementListOpt "}" { $$ = $2; }
1022 : ";{" StatementListOpt "}" { $$ = CYNew CYBlock($2); }
1026 : StatementListItem StatementListOpt { $1->SetNext($2); $$ = $1; }
1030 : StatementList { $$ = $1; }
1031 | LexSetRegExp { $$ = NULL; }
1035 : Statement { $$ = $1; }
1036 | Declaration { $$ = $1; }
1040 /* 12.2 Declarations {{{ */
1042 : Identifier { $$ = $1; }
1045 // XXX: BindingPattern
1047 /* 12.2.1 Let and Const Declarations {{{ */
1049 : LetOrConst VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1057 /* 12.2.2 Variable Statement {{{ */
1059 : "var" VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1062 VariableDeclarationList_
1063 : "," VariableDeclarationList { $$ = $2; }
1067 VariableDeclarationList
1068 : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
1072 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1073 // XXX: | BindingPattern Initialiser { $$ = CYNew CYDeclaration($1, $2); }
1077 : "=" AssignmentExpression { $$ = $2; }
1081 : Initialiser { $$ = $1; }
1085 /* 12.2.4 Destructuring Binding Patterns {{{ */
1089 : SingleNameBinding { $$ = $1; }
1093 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1097 /* 12.3 Empty Statement {{{ */
1099 : ";" { $$ = CYNew CYEmpty(); }
1102 /* 12.4 Expression Statement {{{ */
1104 : Expression Terminator { $$ = CYNew CYExpress($1); }
1107 /* 12.5 The if Statement {{{ */
1109 : "else" Statement { $$ = $2; }
1110 | %prec "if" { $$ = NULL; }
1114 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = CYNew CYIf($3, $5, $6); }
1118 /* 12.6.1 The do-while Statement {{{ */
1120 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = CYNew CYDoWhile($5, $2); }
1123 /* 12.6.2 The while Statement {{{ */
1125 : "while" "(" Expression ")" Statement { $$ = CYNew CYWhile($3, $5); }
1128 /* 12.6.3 The for Statement {{{ */
1130 : "for" "(" LexPushInOn ForStatementInitialiser LexPopIn ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = CYNew CYFor($4, $7, $9, $11); }
1133 ForStatementInitialiser
1134 : ExpressionOpt { $$ = $1; }
1135 | LexSetRegExp "var" VariableDeclarationList { $$ = CYNew CYForDeclarations($3); }
1138 /* 12.6.4 The for-in and for-of Statements {{{ */
1140 : "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForIn($4, $7, $9); }
1141 | "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "of" Expression ")" Statement { $$ = CYNew CYForOf($4, $7, $9); }
1144 ForInStatementInitialiser
1145 : LeftHandSideExpression { $$ = $1; }
1146 | LexSetRegExp "var" VariableDeclaration { $$ = $3; }
1150 /* 12.7 The continue Statement {{{ */
1152 : "continue" "\n" StrictSemi { $$ = CYNew CYContinue(NULL); }
1153 | "continue" IdentifierOpt Terminator { $$ = CYNew CYContinue($2); }
1156 /* 12.8 The break Statement {{{ */
1158 : "break" "\n" StrictSemi { $$ = CYNew CYBreak(NULL); }
1159 | "break" IdentifierOpt Terminator { $$ = CYNew CYBreak($2); }
1162 /* 12.9 The return Statement {{{ */
1164 : "return" "\n" StrictSemi { $$ = CYNew CYReturn(NULL); }
1165 | "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); }
1168 /* 12.10 The with Statement {{{ */
1170 : "with" "(" Expression ")" Statement { $$ = CYNew CYWith($3, $5); }
1174 /* 12.11 The switch Statement {{{ */
1176 : "switch" "(" Expression ")" CaseBlock { $$ = CYNew CYSwitch($3, $5); }
1180 : BRACE CaseClausesOpt "}" { $$ = $2; }
1184 : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
1188 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1189 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1194 : "default" ":" StatementListOpt { $$ = CYNew CYClause(NULL, $3); }
1197 /* 12.12 Labelled Statements {{{ */
1199 : Identifier ":" Statement { $$ = CYNew CYLabel($1, $3); }
1202 /* 12.13 The throw Statement {{{ */
1204 : "throw" "\n" StrictSemi { YYABORT; }
1205 | "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); }
1208 /* 12.14 The try Statement {{{ */
1210 : "try" Block_ CatchOpt FinallyOpt { $$ = CYNew cy::Syntax::Try($2, $3, $4); }
1214 : "catch" "(" Identifier ")" Block_ { $$ = CYNew cy::Syntax::Catch($3, $5); }
1219 : "finally" Block_ { $$ = CYNew CYFinally($2); }
1223 /* 12.14 The debugger Statement {{{ */
1225 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1229 /* 13.1 Function Definitions {{{ */
1231 : ";function" Identifier "(" FormalParameterListOpt ")" BRACE FunctionBody "}" { $$ = CYNew CYFunctionStatement($2, $4, $7); }
1235 : "function" IdentifierOpt "(" LexPushInOff FormalParameterListOpt LexPopIn ")" BRACE LexPushInOff FunctionBody LexPopIn "}" { $$ = CYNew CYFunctionExpression($2, $5, $10); }
1238 FormalParameterList_
1239 : "," FormalParameterList { $$ = $2; }
1244 // XXX: : FunctionRestParameter { $$ = $1; }
1245 : FormalParameter FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
1248 FormalParameterListOpt
1249 : FormalParameterList
1253 /* XXX: FunctionRestParameter
1254 : "..." BindingIdentifier { $$ = CYNew CYFunctionRestParameter($2); }
1258 : BindingElement { $$ = $1; }
1262 : StatementListOpt { $$ = $1; }
1265 /* 13.2 Arrow Function Definitions {{{ */
1267 : LexSetRegExp ArrowParameters "=>" LexNoBrace ConciseBody { $$ = CYNew CYFunctionExpression(NULL, $2, $5); }
1271 : BindingIdentifier { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1)); }
1272 //| ParentheticalOpt { $$ = $1; }
1276 : AssignmentExpression { $$ = CYNew CYReturn($1); }
1277 | ";{" LexPushInOff FunctionBody LexPopIn "}" { $$ = $3; }
1280 /* 14 Program {{{ */
1282 : ProgramBodyOpt { driver.program_ = CYNew CYProgram($1); }
1286 : StatementList { $$ = $1; }
1290 : ProgramBody { $$ = $1; }
1296 /* Cycript (Objective-C): @class Declaration {{{ */
1298 /* XXX: why the hell did I choose MemberExpression? */
1299 : ":" LexSetRegExp MemberExpression { $$ = $3; }
1304 : Expression Identifier ";"
1308 : BRACE ClassFieldListOpt "}" { $$ = NULL; }
1312 : ClassFieldListOpt ClassField
1317 : "+" { $$ = false; }
1318 | "-" { $$ = true; }
1322 : "(" Expression ")" { $$ = $2; }
1323 | "(" LexSetRegExp "void" ")" { $$ = NULL; }
1328 : Word ":" TypeOpt Identifier { $$ = CYNew CYMessageParameter($1, $3, $4); }
1331 MessageParameterList
1332 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1335 MessageParameterListOpt
1336 : MessageParameterList { $$ = $1; }
1341 : MessageParameterList { $$ = $1; }
1342 | Word { $$ = CYNew CYMessageParameter($1, NULL, NULL); }
1345 ClassMessageDeclaration
1346 : MessageScope TypeOpt MessageParameters BRACE FunctionBody "}" { $$ = CYNew CYMessage($1, $2, $3, $5); }
1349 ClassMessageDeclarationListOpt
1350 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1351 | ClassMessageDeclarationListOpt Comment { $$ = $1; }
1356 : Identifier { $$ = $1; }
1357 | "(" AssignmentExpression ")" { $$ = $2; }
1361 : ClassName { $$ = $1; }
1365 // XXX: this should be AssignmentExpressionNoRight
1367 : ShiftExpression ClassProtocolsOpt { $$ = CYNew CYProtocol($1, $2); }
1371 : "," ClassProtocols { $$ = $2; }
1375 ClassProtocolListOpt
1376 : "<" ClassProtocols ">" { $$ = $2; }
1381 : "@implementation" LexPushInOff ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt LexPopIn "@end" { $$ = CYNew CYClassExpression($3, $4, $5, $6, $7); }
1385 : ";@implementation" ClassName ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYClassStatement($2, $3, $4, $5, $6); }
1393 : ";@implementation" ClassName CategoryName ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYCategory($2, $4); }
1397 : ClassExpression { $$ = $1; }
1401 : ClassStatement { $$ = $1; }
1402 | CategoryStatement { $$ = $1; }
1405 /* Cycript (Objective-C): Send Message {{{ */
1407 : "," AssignmentExpression VariadicCall { $$ = CYNew CYArgument(NULL, $2, $3); }
1412 : WordOpt { driver.contexts_.back().words_.push_back($1); } { $$ = $1; }
1413 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
1417 : SelectorCall { $$ = $1; }
1418 | VariadicCall { $$ = $1; }
1422 : SelectorWordOpt ":" AssignmentExpression SelectorCall_ { $$ = CYNew CYArgument($1 ?: CYNew CYBlank(), $3, $4); }
1426 : SelectorCall { $$ = $1; }
1427 | Word { $$ = CYNew CYArgument($1, NULL); }
1431 : "[" LexPushInOff AssignmentExpression { driver.contexts_.push_back($3); } SelectorList LexPopIn "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
1432 | "[" LexPushInOff LexSetRegExp "super" { driver.context_ = NULL; } SelectorList LexPopIn "]" { $$ = CYNew CYSendSuper($6); }
1436 : WordOpt ":" SelectorExpressionOpt { $$ = CYNew CYSelectorPart($1, true, $3); }
1440 : SelectorExpression_ { $$ = $1; }
1441 | Word { $$ = CYNew CYSelectorPart($1, false, NULL); }
1444 SelectorExpressionOpt
1445 : SelectorExpression_ { $$ = $1; }
1450 : MessageExpression { $$ = $1; }
1451 | "@selector" "(" LexPushInOff SelectorExpression LexPopIn ")" { $$ = CYNew CYSelector($4); }
1454 /* Cycript (Objective-C): @import Directive {{{ */
1468 : "@import" ImportPath { $$ = CYNew CYImport(); }
1471 /* Cycript (Objective-C): Boxed Expressions {{{ */
1473 : NullLiteral { $$ = $1; }
1474 | BooleanLiteral { $$ = $1; }
1475 | NumericLiteral { $$ = $1; }
1476 | StringLiteral { $$ = $1; }
1477 | ArrayLiteral { $$ = $1; }
1478 | ObjectLiteral { $$ = $1; }
1479 | Parenthetical { $$ = $1; }
1483 : "@" BoxableExpression { $$ = CYNew CYBox($2); }
1489 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1490 LeftHandSideExpression
1491 : LexSetRegExp "*" UnaryExpression { $$ = CYNew CYIndirect($3); }
1495 : "&" UnaryExpression { $$ = CYNew CYAddressOf($2); }
1499 : "->" "[" Expression "]" { $$ = CYNew CYIndirectMember(NULL, $3); }
1500 | "->" IdentifierName { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); }
1501 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
1506 /* YUI: Documentation Comments {{{ */
1508 : Comment { $$ = $1; }
1513 /* Lexer State {{{ */
1515 : { driver.PushCondition(CYDriver::RegExpCondition); }
1519 : { driver.PushCondition(CYDriver::XMLContentCondition); }
1523 : { driver.PushCondition(CYDriver::XMLTagCondition); }
1527 : { driver.PopCondition(); }
1531 : { driver.SetCondition(CYDriver::XMLContentCondition); }
1535 : { driver.SetCondition(CYDriver::XMLTagCondition); }
1538 /* Virtual Tokens {{{ */
1545 /* 8.1 Context Keywords {{{ */
1547 : "namespace" { $$ = $1; }
1548 | "xml" { $$ = $1; }
1551 /* 8.3 XML Initialiser Input Elements {{{ */
1553 : XMLComment { $$ = $1; }
1554 | XMLCDATA { $$ = $1; }
1555 | XMLPI { $$ = $1; }
1559 /* 11.1 Primary Expressions {{{ */
1561 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
1562 | XMLInitialiser { $$ = $1; }
1563 | XMLListInitialiser { $$ = $1; }
1567 : AttributeIdentifier { $$ = $1; }
1568 | QualifiedIdentifier { $$ = $1; }
1569 | WildcardIdentifier { $$ = $1; }
1572 /* 11.1.1 Attribute Identifiers {{{ */
1574 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
1578 : PropertySelector { $$ = $1; }
1579 | "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYSelector($3); }
1583 : Identifier { $$ = CYNew CYSelector($1); }
1584 | WildcardIdentifier { $$ = $1; }
1587 /* 11.1.2 Qualified Identifiers {{{ */
1588 QualifiedIdentifier_
1589 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
1590 | QualifiedIdentifier { $$ = $1; }
1594 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
1597 /* 11.1.3 Wildcard Identifiers {{{ */
1599 : "*" { $$ = CYNew CYWildcard(); }
1602 /* 11.1.4 XML Initialiser {{{ */
1604 : XMLMarkup { $$ = $1; }
1605 | XMLElement { $$ = $1; }
1609 : "<" LexPushInOff XMLTagContent LexPop LexPopIn "/>"
1610 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop LexPopIn ">"
1614 : LexPushXMLTag XMLTagName XMLAttributes
1618 : BRACE LexPushRegExp Expression LexPop "}"
1627 : XMLAttributes_ XMLAttribute
1632 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
1633 | XMLAttributes_ XMLWhitespaceOpt
1642 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
1646 : XMLExpression XMLElementContentOpt
1647 | XMLMarkup XMLElementContentOpt
1648 | XMLText XMLElementContentOpt
1649 | XMLElement XMLElementContentOpt
1652 XMLElementContentOpt
1657 /* 11.1.5 XMLList Initialiser {{{ */
1659 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop LexPopIn "</>" { $$ = CYNew CYXMLList($4); }
1663 /* 11.2 Left-Hand-Side Expressions {{{ */
1665 : Identifier { $$ = $1; }
1666 | PropertyIdentifier { $$ = $1; }
1670 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
1671 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
1672 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
1675 /* 12.1 The default xml namespace Statement {{{ */
1676 /* XXX: DefaultXMLNamespaceStatement
1677 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
1681 : DefaultXMLNamespaceStatement { $$ = $1; }
1686 /* JavaScript 1.7: Array Comprehensions {{{ */
1688 : "if" "(" Expression ")" { $$ = CYNew CYIfComprehension($3); }
1692 : "for" "(" LexPushInOn Identifier LexPopIn "!in" Expression ")" { $$ = CYNew CYForInComprehension($4, $7); }
1693 | "for" "each" "(" LexPushInOn Identifier LexPopIn "!in" Expression ")" { $$ = CYNew CYForOfComprehension($5, $8); }
1697 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1700 ComprehensionListOpt
1701 : ComprehensionList { $$ = $1; }
1702 | IfComprehension { $$ = $1; }
1707 : "[" LexPushInOff AssignmentExpression ComprehensionList LexPopIn "]" { $$ = CYNew CYArrayComprehension($3, $4); }
1710 /* JavaScript 1.7: for each {{{ */
1712 : "for" "each" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForOf($5, $8, $10); }
1715 /* JavaScript 1.7: let Statements {{{ */
1717 : "let" "(" VariableDeclarationList ")" Statement { $$ = CYNew CYLetStatement($3, $5); }
1725 /* JavaScript FTW: Ruby Blocks {{{ */
1726 RubyProcParameterList_
1727 : "," RubyProcParameterList { $$ = $2; }
1731 RubyProcParameterList
1732 : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1), $2); }
1737 : "|" RubyProcParameterList "|" { $$ = $2; }
1738 | "||" { $$ = NULL; }
1741 RubyProcParametersOpt
1742 : RubyProcParameters
1747 : "{" RubyProcParametersOpt StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
1751 : "{" LexPushInOff RubyProcParameters StatementListOpt LexPopIn "}" { $$ = CYNew CYRubyProc($3, $4); }
1755 : CallExpression_ RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); }