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 <field_> ClassFieldListOpt
453 %type <field_> ClassFields
454 %type <statement_> ClassStatement
455 %type <expression_> ClassSuperOpt
456 %type <message_> ClassMessageDeclaration
457 %type <message_> ClassMessageDeclarationListOpt
458 %type <className_> ClassName
459 %type <className_> ClassNameOpt
460 %type <protocol_> ClassProtocolListOpt
461 %type <protocol_> ClassProtocols
462 %type <protocol_> ClassProtocolsOpt
463 %type <expression_> MessageExpression
464 %type <messageParameter_> MessageParameter
465 %type <messageParameter_> MessageParameters
466 %type <messageParameter_> MessageParameterList
467 %type <messageParameter_> MessageParameterListOpt
468 %type <bool_> MessageScope
469 %type <argument_> SelectorCall_
470 %type <argument_> SelectorCall
471 %type <selector_> SelectorExpression_
472 %type <selector_> SelectorExpression
473 %type <selector_> SelectorExpressionOpt
474 %type <argument_> SelectorList
475 %type <word_> SelectorWordOpt
476 %type <expression_> TypeOpt
477 %type <argument_> VariadicCall
481 %type <propertyIdentifier_> PropertyIdentifier_
482 %type <selector_> PropertySelector_
483 %type <selector_> PropertySelector
484 %type <identifier_> QualifiedIdentifier_
485 %type <identifier_> QualifiedIdentifier
486 %type <identifier_> WildcardIdentifier
487 %type <identifier_> XMLComment
488 %type <identifier_> XMLCDATA
489 %type <identifier_> XMLElement
490 %type <identifier_> XMLElementContent
491 %type <identifier_> XMLMarkup
492 %type <identifier_> XMLPI
494 %type <attribute_> AttributeIdentifier
495 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
496 %type <expression_> PropertyIdentifier
497 %type <expression_> XMLListInitialiser
498 %type <expression_> XMLInitialiser
501 /* Token Priorities {{{ */
513 /* Lexer State {{{ */
515 : { driver.in_.push(true); }
519 : { driver.in_.push(false); }
523 : { driver.in_.pop(); }
527 : { driver.SetCondition(CYDriver::RegExpCondition); }
531 : { if (yychar == yyempty_) driver.nobrace_ = true; else if (yychar == token::OpenBrace || yychar == token::OpenBrace_) yychar = token::OpenBrace__; }
535 : { if (yychar == token::Function) yychar = token::Function_; }
538 LexNoAtImplementation
539 : { if (yychar == token::AtImplementation) yychar = token::AtImplementation_; }
543 : LexNoBrace LexNoFunction LexNoAtImplementation
546 /* Virtual Tokens {{{ */
553 /* 7.6 Identifier Names and Identifiers {{{ */
564 : Identifier { $$ = $1; }
565 | "break" NewLineOpt { $$ = $1; }
566 | "case" { $$ = $1; }
567 | "catch" { $$ = $1; }
568 | "class" { $$ = $1; }
569 | "const" { $$ = $1; }
570 | "continue" NewLineOpt { $$ = $1; }
571 | "debugger" { $$ = $1; }
572 | "default" { $$ = $1; }
573 | "delete" { $$ = $1; }
575 | "else" { $$ = $1; }
576 | "enum" { $$ = $1; }
577 | "export" { $$ = $1; }
578 | "extends" { $$ = $1; }
579 | "false" { $$ = $1; }
580 | "finally" { $$ = $1; }
581 /* XXX: | "for" { $$ = $1; } */
582 | "function" { $$ = $1; }
584 | "import" { $$ = $1; }
585 /* XXX: | "in" { $$ = $1; } */
587 /* XXX: | "instanceof" { $$ = $1; } */
589 // XXX: as it currently is not an Identifier
593 | "null" { $$ = $1; }
594 | "return" NewLineOpt { $$ = $1; }
595 | "super" { $$ = $1; }
596 | "switch" { $$ = $1; }
597 | "this" { $$ = $1; }
598 | "throw" NewLineOpt { $$ = $1; }
599 | "true" { $$ = $1; }
601 | "typeof" { $$ = $1; }
603 | "void" { $$ = $1; }
604 | "while" { $$ = $1; }
605 | "with" { $$ = $1; }
614 : Identifier_ { $$ = $1; }
616 | "implements" { $$ = $1; }
617 | "interface" { $$ = $1; }
618 | "package" { $$ = $1; }
619 | "private" { $$ = $1; }
620 | "protected" { $$ = $1; }
621 | "public" { $$ = $1; }
622 | "static" { $$ = $1; }
624 | "abstract" { $$ = $1; }
625 | "boolean" { $$ = $1; }
626 | "byte" { $$ = $1; }
627 | "char" { $$ = $1; }
628 | "double" { $$ = $1; }
629 | "final" { $$ = $1; }
630 | "float" { $$ = $1; }
631 | "goto" { $$ = $1; }
633 | "long" { $$ = $1; }
634 | "native" { $$ = $1; }
635 | "short" { $$ = $1; }
636 | "synchronized" { $$ = $1; }
637 | "throws" { $$ = $1; }
638 | "transient" { $$ = $1; }
639 | "volatile" { $$ = $1; }
641 // XXX: currently I only have this as Word
642 // | "let" { $$ = $1; }
644 | "yield" { $$ = $1; }
646 | "each" { $$ = $1; }
651 : Identifier { $$ = $1; }
656 /* 7.8 Literals {{{ */
658 : NullLiteral { $$ = $1; }
659 | ValueLiteral { $$ = $1; }
663 : BooleanLiteral { $$ = $1; }
664 | NumericLiteral { $$ = $1; }
665 | StringLiteral { $$ = $1; }
666 | RegularExpressionLiteral { $$ = $1; }
669 /* 7.8.1 Null Literals {{{ */
671 : "null" { $$ = $1; }
674 /* 7.8.2 Boolean Literals {{{ */
676 : "true" { $$ = $1; }
677 | "false" { $$ = $1; }
681 /* 7.9 Automatic Semicolon Insertion {{{ */
683 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
688 | error { if (yychar != yyeof_ && yychar != token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
693 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
697 /* 11.1 Primary Expressions {{{ */
699 : "(" LexPushInOff Expression LexPopIn ")" { $$ = $3; }
703 : Parenthetical { $$ = $1; }
708 : "this" { $$ = $1; }
709 | Identifier { $$ = CYNew CYVariable($1); }
710 | Literal { $$ = $1; }
711 | ArrayLiteral { $$ = $1; }
712 | ObjectLiteral { $$ = $1; }
713 | FunctionExpression { $$ = $1; }
714 | Parenthetical { $$ = $1; }
715 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
718 /* 11.1.4.1 Array Initialiser {{{ */
720 : "[" LexPushInOff ElementListOpt LexPopIn "]" { $$ = CYNew CYArray($3); }
724 : AssignmentExpression { $$ = $1; }
728 : Element { $$ = $1; }
729 | LexSetRegExp { $$ = NULL; }
733 : ElementOpt "," ElementListOpt { $$ = CYNew CYElement($1, $3); }
734 | Element { $$ = CYNew CYElement($1, NULL); }
738 : ElementList { $$ = $1; }
739 | LexSetRegExp { $$ = NULL; }
742 /* 11.1.5 Object Initialiser {{{ */
744 : BRACE LexPushInOff PropertyDefinitionListOpt LexPopIn "}" { $$ = CYNew CYObject($3); }
747 PropertyDefinitionList_
748 : "," PropertyDefinitionList { $$ = $2; }
753 PropertyDefinitionList
754 : PropertyDefinition PropertyDefinitionList_ { $1->SetNext($2); $$ = $1; }
757 PropertyDefinitionListOpt
758 : PropertyDefinitionList { $$ = $1; }
763 // XXX: this should be IdentifierName
764 : LexSetRegExp Identifier { $$ = CYNew CYProperty($2, CYNew CYVariable($2)); }
765 | PropertyName ":" AssignmentExpression { $$ = CYNew CYProperty($1, $3); }
770 : IdentifierName { $$ = $1; }
771 | StringLiteral { $$ = $1; }
772 | NumericLiteral { $$ = $1; }
776 : LexSetRegExp PropertyName_ { $$ = $2; }
780 /* 11.2 Left-Hand-Side Expressions {{{ */
782 : "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYDirectMember(NULL, $3); }
783 | "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
784 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
788 : MemberExpression { $$ = $1; }
789 //| "super" { $$ = $1; }
793 : LexSetRegExp PrimaryExpression { $$ = $2; }
794 | MemberExpression_ { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
795 | LexSetRegExp "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($3, $4); }
799 : MemberExpression { $$ = $1; }
800 | LexSetRegExp "new" NewExpression { $$ = CYNew cy::Syntax::New($3, NULL); }
809 : CallExpression_ Arguments { $$ = CYNew CYCall($1, $2); }
810 | CallExpression { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
814 : "(" LexPushInOff ArgumentListOpt LexPopIn ")" { $$ = $3; }
818 : "," ArgumentList { $$ = $2; }
823 : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
827 : ArgumentList { $$ = $1; }
828 | LexSetRegExp { $$ = NULL; }
831 LeftHandSideExpression
832 : NewExpression { $$ = $1; }
833 | CallExpression { $$ = $1; }
836 /* 11.3 Postfix Expressions {{{ */
838 : %prec "" LeftHandSideExpression { $$ = $1; }
839 | LeftHandSideExpression "++" { $$ = CYNew CYPostIncrement($1); }
840 | LeftHandSideExpression "--" { $$ = CYNew CYPostDecrement($1); }
843 /* 11.4 Unary Operators {{{ */
845 : "delete" UnaryExpression { $$ = CYNew CYDelete($2); }
846 | "void" UnaryExpression { $$ = CYNew CYVoid($2); }
847 | "typeof" UnaryExpression { $$ = CYNew CYTypeOf($2); }
848 | "++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
849 | "\n++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
850 | "--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
851 | "\n--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
852 | "+" UnaryExpression { $$ = CYNew CYAffirm($2); }
853 | "-" UnaryExpression { $$ = CYNew CYNegate($2); }
854 | "~" UnaryExpression { $$ = CYNew CYBitwiseNot($2); }
855 | "!" UnaryExpression { $$ = CYNew CYLogicalNot($2); }
859 : PostfixExpression { $$ = $1; }
860 | LexSetRegExp UnaryExpression_ { $$ = $2; }
863 /* 11.5 Multiplicative Operators {{{ */
864 MultiplicativeExpression
865 : UnaryExpression { $$ = $1; }
866 | MultiplicativeExpression "*" UnaryExpression { $$ = CYNew CYMultiply($1, $3); }
867 | MultiplicativeExpression "/" UnaryExpression { $$ = CYNew CYDivide($1, $3); }
868 | MultiplicativeExpression "%" UnaryExpression { $$ = CYNew CYModulus($1, $3); }
871 /* 11.6 Additive Operators {{{ */
873 : MultiplicativeExpression { $$ = $1; }
874 | AdditiveExpression "+" MultiplicativeExpression { $$ = CYNew CYAdd($1, $3); }
875 | AdditiveExpression "-" MultiplicativeExpression { $$ = CYNew CYSubtract($1, $3); }
878 /* 11.7 Bitwise Shift Operators {{{ */
880 : AdditiveExpression { $$ = $1; }
881 | ShiftExpression "<<" AdditiveExpression { $$ = CYNew CYShiftLeft($1, $3); }
882 | ShiftExpression ">>" AdditiveExpression { $$ = CYNew CYShiftRightSigned($1, $3); }
883 | ShiftExpression ">>>" AdditiveExpression { $$ = CYNew CYShiftRightUnsigned($1, $3); }
886 /* 11.8 Relational Operators {{{ */
888 : ShiftExpression { $$ = $1; }
889 | RelationalExpression "<" ShiftExpression { $$ = CYNew CYLess($1, $3); }
890 | RelationalExpression ">" ShiftExpression { $$ = CYNew CYGreater($1, $3); }
891 | RelationalExpression "<=" ShiftExpression { $$ = CYNew CYLessOrEqual($1, $3); }
892 | RelationalExpression ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual($1, $3); }
893 | RelationalExpression "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf($1, $3); }
894 | RelationalExpression "in" ShiftExpression { $$ = CYNew CYIn($1, $3); }
897 /* 11.9 Equality Operators {{{ */
899 : RelationalExpression { $$ = $1; }
900 | EqualityExpression "==" RelationalExpression { $$ = CYNew CYEqual($1, $3); }
901 | EqualityExpression "!=" RelationalExpression { $$ = CYNew CYNotEqual($1, $3); }
902 | EqualityExpression "===" RelationalExpression { $$ = CYNew CYIdentical($1, $3); }
903 | EqualityExpression "!==" RelationalExpression { $$ = CYNew CYNotIdentical($1, $3); }
906 /* 11.10 Binary Bitwise Operators {{{ */
908 : EqualityExpression { $$ = $1; }
909 | BitwiseANDExpression "&" EqualityExpression { $$ = CYNew CYBitwiseAnd($1, $3); }
913 : BitwiseANDExpression { $$ = $1; }
914 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = CYNew CYBitwiseXOr($1, $3); }
918 : BitwiseXORExpression { $$ = $1; }
919 | BitwiseORExpression "|" BitwiseXORExpression { $$ = CYNew CYBitwiseOr($1, $3); }
922 /* 11.11 Binary Logical Operators {{{ */
924 : BitwiseORExpression { $$ = $1; }
925 | LogicalANDExpression "&&" BitwiseORExpression { $$ = CYNew CYLogicalAnd($1, $3); }
929 : LogicalANDExpression { $$ = $1; }
930 | LogicalORExpression "||" LogicalANDExpression { $$ = CYNew CYLogicalOr($1, $3); }
933 /* 11.12 Conditional Operator ( ? : ) {{{ */
934 ConditionalExpression
935 : LogicalORExpression { $$ = $1; }
936 | LogicalORExpression "?" LexPushInOff AssignmentExpression LexPopIn ":" AssignmentExpression { $$ = CYNew CYCondition($1, $4, $7); }
939 /* 11.13 Assignment Operators {{{ */
941 : ConditionalExpression { $$ = $1; }
942 | ArrowFunction { $$ = $1; }
943 | LeftHandSideExpression "=" AssignmentExpression { $$ = CYNew CYAssign($1, $3); }
944 | LeftHandSideExpression "*=" AssignmentExpression { $$ = CYNew CYMultiplyAssign($1, $3); }
945 | LeftHandSideExpression "/=" AssignmentExpression { $$ = CYNew CYDivideAssign($1, $3); }
946 | LeftHandSideExpression "%=" AssignmentExpression { $$ = CYNew CYModulusAssign($1, $3); }
947 | LeftHandSideExpression "+=" AssignmentExpression { $$ = CYNew CYAddAssign($1, $3); }
948 | LeftHandSideExpression "-=" AssignmentExpression { $$ = CYNew CYSubtractAssign($1, $3); }
949 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = CYNew CYShiftLeftAssign($1, $3); }
950 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = CYNew CYShiftRightSignedAssign($1, $3); }
951 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = CYNew CYShiftRightUnsignedAssign($1, $3); }
952 | LeftHandSideExpression "&=" AssignmentExpression { $$ = CYNew CYBitwiseAndAssign($1, $3); }
953 | LeftHandSideExpression "^=" AssignmentExpression { $$ = CYNew CYBitwiseXOrAssign($1, $3); }
954 | LeftHandSideExpression "|=" AssignmentExpression { $$ = CYNew CYBitwiseOrAssign($1, $3); }
957 /* 11.14 Comma Operator {{{ */
959 : "," Expression { $$ = $2; }
960 | { $$ = CYNew CYCompound(); }
964 : AssignmentExpression Expression_ { $2->AddPrev($1); $$ = $2; }
968 : Expression { $$ = $1; }
969 | LexSetRegExp { $$ = NULL; }
973 /* 12 Statements {{{ */
976 | VariableStatement { $$ = $1; }
977 | EmptyStatement { $$ = $1; }
978 | IfStatement { $$ = $1; }
979 | BreakableStatement { $$ = $1; }
980 | ContinueStatement { $$ = $1; }
981 | BreakStatement { $$ = $1; }
982 | ReturnStatement { $$ = $1; }
983 | WithStatement { $$ = $1; }
984 | LabelledStatement { $$ = $1; }
985 | ThrowStatement { $$ = $1; }
986 | TryStatement { $$ = $1; }
987 | DebuggerStatement { $$ = $1; }
991 : LexSetRegExp Statement__ { $$ = $2; }
992 | ExpressionStatement { $$ = $1; }
996 : LexSetStatement Statement_ { $$ = $2; }
1000 : FunctionDeclaration { $$ = $1; }
1001 | LexicalDeclaration { $$ = $1; }
1005 : LexSetRegExp Declaration__ { $$ = $2; }
1009 : LexSetStatement Declaration_ { $$ = $2; }
1013 : IterationStatement { $$ = $1; }
1014 | SwitchStatement { $$ = $1; }
1017 /* 12.1 Block {{{ */
1019 : BRACE StatementListOpt "}" { $$ = $2; }
1023 : ";{" StatementListOpt "}" { $$ = CYNew CYBlock($2); }
1027 : StatementListItem StatementListOpt { $1->SetNext($2); $$ = $1; }
1031 : StatementList { $$ = $1; }
1032 | LexSetRegExp { $$ = NULL; }
1036 : Statement { $$ = $1; }
1037 | Declaration { $$ = $1; }
1041 /* 12.2 Declarations {{{ */
1043 : Identifier { $$ = $1; }
1046 // XXX: BindingPattern
1048 /* 12.2.1 Let and Const Declarations {{{ */
1050 : LetOrConst VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1058 /* 12.2.2 Variable Statement {{{ */
1060 : "var" VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1063 VariableDeclarationList_
1064 : "," VariableDeclarationList { $$ = $2; }
1068 VariableDeclarationList
1069 : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
1073 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1074 // XXX: | BindingPattern Initialiser { $$ = CYNew CYDeclaration($1, $2); }
1078 : "=" AssignmentExpression { $$ = $2; }
1082 : Initialiser { $$ = $1; }
1086 /* 12.2.4 Destructuring Binding Patterns {{{ */
1090 : SingleNameBinding { $$ = $1; }
1094 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1098 /* 12.3 Empty Statement {{{ */
1100 : ";" { $$ = CYNew CYEmpty(); }
1103 /* 12.4 Expression Statement {{{ */
1105 : Expression Terminator { $$ = CYNew CYExpress($1); }
1108 /* 12.5 The if Statement {{{ */
1110 : "else" Statement { $$ = $2; }
1111 | %prec "if" { $$ = NULL; }
1115 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = CYNew CYIf($3, $5, $6); }
1119 /* 12.6.1 The do-while Statement {{{ */
1121 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = CYNew CYDoWhile($5, $2); }
1124 /* 12.6.2 The while Statement {{{ */
1126 : "while" "(" Expression ")" Statement { $$ = CYNew CYWhile($3, $5); }
1129 /* 12.6.3 The for Statement {{{ */
1131 : "for" "(" LexPushInOn ForStatementInitialiser LexPopIn ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = CYNew CYFor($4, $7, $9, $11); }
1134 ForStatementInitialiser
1135 : ExpressionOpt { $$ = $1; }
1136 | LexSetRegExp "var" VariableDeclarationList { $$ = CYNew CYForDeclarations($3); }
1139 /* 12.6.4 The for-in and for-of Statements {{{ */
1141 : "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForIn($4, $7, $9); }
1142 | "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "of" Expression ")" Statement { $$ = CYNew CYForOf($4, $7, $9); }
1145 ForInStatementInitialiser
1146 : LeftHandSideExpression { $$ = $1; }
1147 | LexSetRegExp "var" VariableDeclaration { $$ = $3; }
1151 /* 12.7 The continue Statement {{{ */
1153 : "continue" "\n" StrictSemi { $$ = CYNew CYContinue(NULL); }
1154 | "continue" IdentifierOpt Terminator { $$ = CYNew CYContinue($2); }
1157 /* 12.8 The break Statement {{{ */
1159 : "break" "\n" StrictSemi { $$ = CYNew CYBreak(NULL); }
1160 | "break" IdentifierOpt Terminator { $$ = CYNew CYBreak($2); }
1163 /* 12.9 The return Statement {{{ */
1165 : "return" "\n" StrictSemi { $$ = CYNew CYReturn(NULL); }
1166 | "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); }
1169 /* 12.10 The with Statement {{{ */
1171 : "with" "(" Expression ")" Statement { $$ = CYNew CYWith($3, $5); }
1175 /* 12.11 The switch Statement {{{ */
1177 : "switch" "(" Expression ")" CaseBlock { $$ = CYNew CYSwitch($3, $5); }
1181 : BRACE CaseClausesOpt "}" { $$ = $2; }
1185 : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
1189 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1190 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1195 : "default" ":" StatementListOpt { $$ = CYNew CYClause(NULL, $3); }
1198 /* 12.12 Labelled Statements {{{ */
1200 : Identifier ":" Statement { $$ = CYNew CYLabel($1, $3); }
1203 /* 12.13 The throw Statement {{{ */
1205 : "throw" "\n" StrictSemi { YYABORT; }
1206 | "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); }
1209 /* 12.14 The try Statement {{{ */
1211 : "try" Block_ CatchOpt FinallyOpt { $$ = CYNew cy::Syntax::Try($2, $3, $4); }
1215 : "catch" "(" Identifier ")" Block_ { $$ = CYNew cy::Syntax::Catch($3, $5); }
1220 : "finally" Block_ { $$ = CYNew CYFinally($2); }
1224 /* 12.14 The debugger Statement {{{ */
1226 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1230 /* 13.1 Function Definitions {{{ */
1232 : ";function" Identifier "(" FormalParameterListOpt ")" BRACE FunctionBody "}" { $$ = CYNew CYFunctionStatement($2, $4, $7); }
1236 : "function" IdentifierOpt "(" LexPushInOff FormalParameterListOpt LexPopIn ")" BRACE LexPushInOff FunctionBody LexPopIn "}" { $$ = CYNew CYFunctionExpression($2, $5, $10); }
1239 FormalParameterList_
1240 : "," FormalParameterList { $$ = $2; }
1245 // XXX: : FunctionRestParameter { $$ = $1; }
1246 : FormalParameter FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
1249 FormalParameterListOpt
1250 : FormalParameterList
1254 /* XXX: FunctionRestParameter
1255 : "..." BindingIdentifier { $$ = CYNew CYFunctionRestParameter($2); }
1259 : BindingElement { $$ = $1; }
1263 : StatementListOpt { $$ = $1; }
1266 /* 13.2 Arrow Function Definitions {{{ */
1268 : LexSetRegExp ArrowParameters "=>" LexNoBrace ConciseBody { $$ = CYNew CYFunctionExpression(NULL, $2, $5); }
1272 : BindingIdentifier { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1)); }
1273 //| ParentheticalOpt { $$ = $1; }
1277 : AssignmentExpression { $$ = CYNew CYReturn($1); }
1278 | ";{" LexPushInOff FunctionBody LexPopIn "}" { $$ = $3; }
1281 /* 14 Program {{{ */
1283 : ProgramBodyOpt { driver.program_ = CYNew CYProgram($1); }
1287 : StatementList { $$ = $1; }
1291 : ProgramBody { $$ = $1; }
1297 /* Cycript (Objective-C): @class Declaration {{{ */
1299 /* XXX: why the hell did I choose MemberExpression? */
1300 : ":" LexSetRegExp MemberExpression { $$ = $3; }
1305 : Expression Identifier ";" ClassFieldListOpt { $$ = CYNew CYField($1, $2, $4); }
1310 : BRACE ClassFieldListOpt "}" { $$ = $2; }
1314 : "+" { $$ = false; }
1315 | "-" { $$ = true; }
1319 : "(" Expression ")" { $$ = $2; }
1320 | "(" LexSetRegExp "void" ")" { $$ = CYNew CYString("v"); }
1325 : Word ":" TypeOpt Identifier { $$ = CYNew CYMessageParameter($1, $3, $4); }
1328 MessageParameterList
1329 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1332 MessageParameterListOpt
1333 : MessageParameterList { $$ = $1; }
1338 : MessageParameterList { $$ = $1; }
1339 | Word { $$ = CYNew CYMessageParameter($1, NULL, NULL); }
1342 ClassMessageDeclaration
1343 : MessageScope TypeOpt MessageParameters BRACE FunctionBody "}" { $$ = CYNew CYMessage($1, $2, $3, $5); }
1346 ClassMessageDeclarationListOpt
1347 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1348 | ClassMessageDeclarationListOpt Comment { $$ = $1; }
1353 : Identifier { $$ = $1; }
1354 | "(" AssignmentExpression ")" { $$ = $2; }
1358 : ClassName { $$ = $1; }
1362 // XXX: this should be AssignmentExpressionNoRight
1364 : ShiftExpression ClassProtocolsOpt { $$ = CYNew CYProtocol($1, $2); }
1368 : "," ClassProtocols { $$ = $2; }
1372 ClassProtocolListOpt
1373 : "<" ClassProtocols ">" { $$ = $2; }
1378 : "@implementation" LexPushInOff ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFields ClassMessageDeclarationListOpt LexPopIn "@end" { $$ = CYNew CYClassExpression($3, $4, $5, $6, $7); }
1382 : ";@implementation" ClassName ClassSuperOpt ClassProtocolListOpt ClassFields ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYClassStatement($2, $3, $4, $5, $6); }
1390 : ";@implementation" ClassName CategoryName ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYCategory($2, $4); }
1394 : ClassExpression { $$ = $1; }
1398 : ClassStatement { $$ = $1; }
1399 | CategoryStatement { $$ = $1; }
1402 /* Cycript (Objective-C): Send Message {{{ */
1404 : "," AssignmentExpression VariadicCall { $$ = CYNew CYArgument(NULL, $2, $3); }
1409 : WordOpt { driver.contexts_.back().words_.push_back($1); } { $$ = $1; }
1410 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
1414 : SelectorCall { $$ = $1; }
1415 | VariadicCall { $$ = $1; }
1419 : SelectorWordOpt ":" AssignmentExpression SelectorCall_ { $$ = CYNew CYArgument($1 ?: CYNew CYBlank(), $3, $4); }
1423 : SelectorCall { $$ = $1; }
1424 | Word { $$ = CYNew CYArgument($1, NULL); }
1428 : "[" LexPushInOff AssignmentExpression { driver.contexts_.push_back($3); } SelectorList LexPopIn "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
1429 | "[" LexPushInOff LexSetRegExp "super" { driver.context_ = NULL; } SelectorList LexPopIn "]" { $$ = CYNew CYSendSuper($6); }
1433 : WordOpt ":" SelectorExpressionOpt { $$ = CYNew CYSelectorPart($1, true, $3); }
1437 : SelectorExpression_ { $$ = $1; }
1438 | Word { $$ = CYNew CYSelectorPart($1, false, NULL); }
1441 SelectorExpressionOpt
1442 : SelectorExpression_ { $$ = $1; }
1447 : MessageExpression { $$ = $1; }
1448 | "@selector" "(" LexPushInOff SelectorExpression LexPopIn ")" { $$ = CYNew CYSelector($4); }
1451 /* Cycript (Objective-C): @import Directive {{{ */
1465 : "@import" ImportPath { $$ = CYNew CYImport(); }
1468 /* Cycript (Objective-C): Boxed Expressions {{{ */
1470 : NullLiteral { $$ = $1; }
1471 | BooleanLiteral { $$ = $1; }
1472 | NumericLiteral { $$ = $1; }
1473 | StringLiteral { $$ = $1; }
1474 | ArrayLiteral { $$ = $1; }
1475 | ObjectLiteral { $$ = $1; }
1476 | Parenthetical { $$ = $1; }
1480 : "@" BoxableExpression { $$ = CYNew CYBox($2); }
1486 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1487 LeftHandSideExpression
1488 : LexSetRegExp "*" UnaryExpression { $$ = CYNew CYIndirect($3); }
1492 : "&" UnaryExpression { $$ = CYNew CYAddressOf($2); }
1496 : "->" "[" Expression "]" { $$ = CYNew CYIndirectMember(NULL, $3); }
1497 | "->" IdentifierName { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); }
1498 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
1503 /* YUI: Documentation Comments {{{ */
1505 : Comment { $$ = $1; }
1510 /* Lexer State {{{ */
1512 : { driver.PushCondition(CYDriver::RegExpCondition); }
1516 : { driver.PushCondition(CYDriver::XMLContentCondition); }
1520 : { driver.PushCondition(CYDriver::XMLTagCondition); }
1524 : { driver.PopCondition(); }
1528 : { driver.SetCondition(CYDriver::XMLContentCondition); }
1532 : { driver.SetCondition(CYDriver::XMLTagCondition); }
1535 /* Virtual Tokens {{{ */
1542 /* 8.1 Context Keywords {{{ */
1544 : "namespace" { $$ = $1; }
1545 | "xml" { $$ = $1; }
1548 /* 8.3 XML Initialiser Input Elements {{{ */
1550 : XMLComment { $$ = $1; }
1551 | XMLCDATA { $$ = $1; }
1552 | XMLPI { $$ = $1; }
1556 /* 11.1 Primary Expressions {{{ */
1558 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
1559 | XMLInitialiser { $$ = $1; }
1560 | XMLListInitialiser { $$ = $1; }
1564 : AttributeIdentifier { $$ = $1; }
1565 | QualifiedIdentifier { $$ = $1; }
1566 | WildcardIdentifier { $$ = $1; }
1569 /* 11.1.1 Attribute Identifiers {{{ */
1571 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
1575 : PropertySelector { $$ = $1; }
1576 | "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYSelector($3); }
1580 : Identifier { $$ = CYNew CYSelector($1); }
1581 | WildcardIdentifier { $$ = $1; }
1584 /* 11.1.2 Qualified Identifiers {{{ */
1585 QualifiedIdentifier_
1586 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
1587 | QualifiedIdentifier { $$ = $1; }
1591 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
1594 /* 11.1.3 Wildcard Identifiers {{{ */
1596 : "*" { $$ = CYNew CYWildcard(); }
1599 /* 11.1.4 XML Initialiser {{{ */
1601 : XMLMarkup { $$ = $1; }
1602 | XMLElement { $$ = $1; }
1606 : "<" LexPushInOff XMLTagContent LexPop LexPopIn "/>"
1607 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop LexPopIn ">"
1611 : LexPushXMLTag XMLTagName XMLAttributes
1615 : BRACE LexPushRegExp Expression LexPop "}"
1624 : XMLAttributes_ XMLAttribute
1629 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
1630 | XMLAttributes_ XMLWhitespaceOpt
1639 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
1643 : XMLExpression XMLElementContentOpt
1644 | XMLMarkup XMLElementContentOpt
1645 | XMLText XMLElementContentOpt
1646 | XMLElement XMLElementContentOpt
1649 XMLElementContentOpt
1654 /* 11.1.5 XMLList Initialiser {{{ */
1656 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop LexPopIn "</>" { $$ = CYNew CYXMLList($4); }
1660 /* 11.2 Left-Hand-Side Expressions {{{ */
1662 : Identifier { $$ = $1; }
1663 | PropertyIdentifier { $$ = $1; }
1667 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
1668 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
1669 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
1672 /* 12.1 The default xml namespace Statement {{{ */
1673 /* XXX: DefaultXMLNamespaceStatement
1674 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
1678 : DefaultXMLNamespaceStatement { $$ = $1; }
1683 /* JavaScript 1.7: Array Comprehensions {{{ */
1685 : "if" "(" Expression ")" { $$ = CYNew CYIfComprehension($3); }
1689 : "for" "(" Identifier "in" Expression ")" { $$ = CYNew CYForInComprehension($3, $5); }
1690 | "for" "each" "(" Identifier "in" Expression ")" { $$ = CYNew CYForOfComprehension($4, $6); }
1694 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1697 ComprehensionListOpt
1698 : ComprehensionList { $$ = $1; }
1699 | IfComprehension { $$ = $1; }
1704 : "[" LexPushInOff AssignmentExpression ComprehensionList LexPopIn "]" { $$ = CYNew CYArrayComprehension($3, $4); }
1707 /* JavaScript 1.7: for each {{{ */
1709 : "for" "each" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForOf($5, $8, $10); }
1712 /* JavaScript 1.7: let Statements {{{ */
1714 : "let" "(" VariableDeclarationList ")" Statement { $$ = CYNew CYLetStatement($3, $5); }
1722 /* JavaScript FTW: Ruby Blocks {{{ */
1723 RubyProcParameterList_
1724 : "," RubyProcParameterList { $$ = $2; }
1728 RubyProcParameterList
1729 : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1), $2); }
1734 : "|" RubyProcParameterList "|" { $$ = $2; }
1735 | "||" { $$ = NULL; }
1738 RubyProcParametersOpt
1739 : RubyProcParameters
1744 : "{" RubyProcParametersOpt StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
1748 : "{" LexPushInOff RubyProcParameters StatementListOpt LexPopIn "}" { $$ = CYNew CYRubyProc($3, $4); }
1752 : CallExpression_ RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); }