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_; }
538 : LexNoBrace LexNoFunction
541 /* Virtual Tokens {{{ */
548 /* 7.6 Identifier Names and Identifiers {{{ */
559 : Identifier { $$ = $1; }
560 | "break" NewLineOpt { $$ = $1; }
561 | "case" { $$ = $1; }
562 | "catch" { $$ = $1; }
563 | "class" { $$ = $1; }
564 | "const" { $$ = $1; }
565 | "continue" NewLineOpt { $$ = $1; }
566 | "debugger" { $$ = $1; }
567 | "default" { $$ = $1; }
568 | "delete" { $$ = $1; }
570 | "else" { $$ = $1; }
571 | "enum" { $$ = $1; }
572 | "export" { $$ = $1; }
573 | "extends" { $$ = $1; }
574 | "false" { $$ = $1; }
575 | "finally" { $$ = $1; }
576 /* XXX: | "for" { $$ = $1; } */
577 | "function" { $$ = $1; }
579 | "import" { $$ = $1; }
580 /* XXX: | "in" { $$ = $1; } */
582 /* XXX: | "instanceof" { $$ = $1; } */
584 // XXX: as it currently is not an Identifier
588 | "null" { $$ = $1; }
589 | "return" NewLineOpt { $$ = $1; }
590 | "super" { $$ = $1; }
591 | "switch" { $$ = $1; }
592 | "this" { $$ = $1; }
593 | "throw" NewLineOpt { $$ = $1; }
594 | "true" { $$ = $1; }
596 | "typeof" { $$ = $1; }
598 | "void" { $$ = $1; }
599 | "while" { $$ = $1; }
600 | "with" { $$ = $1; }
609 : Identifier_ { $$ = $1; }
611 | "implements" { $$ = $1; }
612 | "interface" { $$ = $1; }
613 | "package" { $$ = $1; }
614 | "private" { $$ = $1; }
615 | "protected" { $$ = $1; }
616 | "public" { $$ = $1; }
617 | "static" { $$ = $1; }
619 | "abstract" { $$ = $1; }
620 | "boolean" { $$ = $1; }
621 | "byte" { $$ = $1; }
622 | "char" { $$ = $1; }
623 | "double" { $$ = $1; }
624 | "final" { $$ = $1; }
625 | "float" { $$ = $1; }
626 | "goto" { $$ = $1; }
628 | "long" { $$ = $1; }
629 | "native" { $$ = $1; }
630 | "short" { $$ = $1; }
631 | "synchronized" { $$ = $1; }
632 | "throws" { $$ = $1; }
633 | "transient" { $$ = $1; }
634 | "volatile" { $$ = $1; }
636 // XXX: currently I only have this as Word
637 // | "let" { $$ = $1; }
639 | "yield" { $$ = $1; }
641 | "each" { $$ = $1; }
646 : Identifier { $$ = $1; }
651 /* 7.8 Literals {{{ */
653 : NullLiteral { $$ = $1; }
654 | ValueLiteral { $$ = $1; }
658 : BooleanLiteral { $$ = $1; }
659 | NumericLiteral { $$ = $1; }
660 | StringLiteral { $$ = $1; }
661 | RegularExpressionLiteral { $$ = $1; }
664 /* 7.8.1 Null Literals {{{ */
666 : "null" { $$ = $1; }
669 /* 7.8.2 Boolean Literals {{{ */
671 : "true" { $$ = $1; }
672 | "false" { $$ = $1; }
676 /* 7.9 Automatic Semicolon Insertion {{{ */
678 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
683 | error { if (yychar != yyeof_ && yychar != token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
688 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
692 /* 11.1 Primary Expressions {{{ */
694 : "(" LexPushInOff Expression LexPopIn ")" { $$ = $3; }
698 : Parenthetical { $$ = $1; }
703 : "this" { $$ = $1; }
704 | Identifier { $$ = CYNew CYVariable($1); }
705 | Literal { $$ = $1; }
706 | ArrayLiteral { $$ = $1; }
707 | ObjectLiteral { $$ = $1; }
708 | FunctionExpression { $$ = $1; }
709 | Parenthetical { $$ = $1; }
710 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
713 /* 11.1.4.1 Array Initialiser {{{ */
715 : "[" LexPushInOff ElementListOpt LexPopIn "]" { $$ = CYNew CYArray($3); }
719 : AssignmentExpression { $$ = $1; }
723 : Element { $$ = $1; }
724 | LexSetRegExp { $$ = NULL; }
728 : ElementOpt "," ElementListOpt { $$ = CYNew CYElement($1, $3); }
729 | Element { $$ = CYNew CYElement($1, NULL); }
733 : ElementList { $$ = $1; }
734 | LexSetRegExp { $$ = NULL; }
737 /* 11.1.5 Object Initialiser {{{ */
739 : BRACE LexPushInOff PropertyDefinitionListOpt LexPopIn "}" { $$ = CYNew CYObject($3); }
742 PropertyDefinitionList_
743 : "," PropertyDefinitionList { $$ = $2; }
748 PropertyDefinitionList
749 : PropertyDefinition PropertyDefinitionList_ { $1->SetNext($2); $$ = $1; }
752 PropertyDefinitionListOpt
753 : PropertyDefinitionList { $$ = $1; }
758 // XXX: this should be IdentifierName
759 : LexSetRegExp Identifier { $$ = CYNew CYProperty($2, CYNew CYVariable($2)); }
760 | PropertyName ":" AssignmentExpression { $$ = CYNew CYProperty($1, $3); }
765 : IdentifierName { $$ = $1; }
766 | StringLiteral { $$ = $1; }
767 | NumericLiteral { $$ = $1; }
771 : LexSetRegExp PropertyName_ { $$ = $2; }
775 /* 11.2 Left-Hand-Side Expressions {{{ */
777 : "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYDirectMember(NULL, $3); }
778 | "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
779 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
783 : MemberExpression { $$ = $1; }
784 //| "super" { $$ = $1; }
788 : LexSetRegExp PrimaryExpression { $$ = $2; }
789 | MemberExpression_ { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
790 | LexSetRegExp "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($3, $4); }
794 : MemberExpression { $$ = $1; }
795 | LexSetRegExp "new" NewExpression { $$ = CYNew cy::Syntax::New($3, NULL); }
804 : CallExpression_ Arguments { $$ = CYNew CYCall($1, $2); }
805 | CallExpression { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
809 : "(" LexPushInOff ArgumentListOpt LexPopIn ")" { $$ = $3; }
813 : "," ArgumentList { $$ = $2; }
818 : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
822 : ArgumentList { $$ = $1; }
823 | LexSetRegExp { $$ = NULL; }
826 LeftHandSideExpression
827 : NewExpression { $$ = $1; }
828 | CallExpression { $$ = $1; }
831 /* 11.3 Postfix Expressions {{{ */
833 : %prec "" LeftHandSideExpression { $$ = $1; }
834 | LeftHandSideExpression "++" { $$ = CYNew CYPostIncrement($1); }
835 | LeftHandSideExpression "--" { $$ = CYNew CYPostDecrement($1); }
838 /* 11.4 Unary Operators {{{ */
840 : "delete" UnaryExpression { $$ = CYNew CYDelete($2); }
841 | "void" UnaryExpression { $$ = CYNew CYVoid($2); }
842 | "typeof" UnaryExpression { $$ = CYNew CYTypeOf($2); }
843 | "++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
844 | "\n++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
845 | "--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
846 | "\n--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
847 | "+" UnaryExpression { $$ = CYNew CYAffirm($2); }
848 | "-" UnaryExpression { $$ = CYNew CYNegate($2); }
849 | "~" UnaryExpression { $$ = CYNew CYBitwiseNot($2); }
850 | "!" UnaryExpression { $$ = CYNew CYLogicalNot($2); }
854 : PostfixExpression { $$ = $1; }
855 | LexSetRegExp UnaryExpression_ { $$ = $2; }
858 /* 11.5 Multiplicative Operators {{{ */
859 MultiplicativeExpression
860 : UnaryExpression { $$ = $1; }
861 | MultiplicativeExpression "*" UnaryExpression { $$ = CYNew CYMultiply($1, $3); }
862 | MultiplicativeExpression "/" UnaryExpression { $$ = CYNew CYDivide($1, $3); }
863 | MultiplicativeExpression "%" UnaryExpression { $$ = CYNew CYModulus($1, $3); }
866 /* 11.6 Additive Operators {{{ */
868 : MultiplicativeExpression { $$ = $1; }
869 | AdditiveExpression "+" MultiplicativeExpression { $$ = CYNew CYAdd($1, $3); }
870 | AdditiveExpression "-" MultiplicativeExpression { $$ = CYNew CYSubtract($1, $3); }
873 /* 11.7 Bitwise Shift Operators {{{ */
875 : AdditiveExpression { $$ = $1; }
876 | ShiftExpression "<<" AdditiveExpression { $$ = CYNew CYShiftLeft($1, $3); }
877 | ShiftExpression ">>" AdditiveExpression { $$ = CYNew CYShiftRightSigned($1, $3); }
878 | ShiftExpression ">>>" AdditiveExpression { $$ = CYNew CYShiftRightUnsigned($1, $3); }
881 /* 11.8 Relational Operators {{{ */
883 : ShiftExpression { $$ = $1; }
884 | RelationalExpression "<" ShiftExpression { $$ = CYNew CYLess($1, $3); }
885 | RelationalExpression ">" ShiftExpression { $$ = CYNew CYGreater($1, $3); }
886 | RelationalExpression "<=" ShiftExpression { $$ = CYNew CYLessOrEqual($1, $3); }
887 | RelationalExpression ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual($1, $3); }
888 | RelationalExpression "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf($1, $3); }
889 | RelationalExpression "in" ShiftExpression { $$ = CYNew CYIn($1, $3); }
892 /* 11.9 Equality Operators {{{ */
894 : RelationalExpression { $$ = $1; }
895 | EqualityExpression "==" RelationalExpression { $$ = CYNew CYEqual($1, $3); }
896 | EqualityExpression "!=" RelationalExpression { $$ = CYNew CYNotEqual($1, $3); }
897 | EqualityExpression "===" RelationalExpression { $$ = CYNew CYIdentical($1, $3); }
898 | EqualityExpression "!==" RelationalExpression { $$ = CYNew CYNotIdentical($1, $3); }
901 /* 11.10 Binary Bitwise Operators {{{ */
903 : EqualityExpression { $$ = $1; }
904 | BitwiseANDExpression "&" EqualityExpression { $$ = CYNew CYBitwiseAnd($1, $3); }
908 : BitwiseANDExpression { $$ = $1; }
909 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = CYNew CYBitwiseXOr($1, $3); }
913 : BitwiseXORExpression { $$ = $1; }
914 | BitwiseORExpression "|" BitwiseXORExpression { $$ = CYNew CYBitwiseOr($1, $3); }
917 /* 11.11 Binary Logical Operators {{{ */
919 : BitwiseORExpression { $$ = $1; }
920 | LogicalANDExpression "&&" BitwiseORExpression { $$ = CYNew CYLogicalAnd($1, $3); }
924 : LogicalANDExpression { $$ = $1; }
925 | LogicalORExpression "||" LogicalANDExpression { $$ = CYNew CYLogicalOr($1, $3); }
928 /* 11.12 Conditional Operator ( ? : ) {{{ */
929 ConditionalExpression
930 : LogicalORExpression { $$ = $1; }
931 | LogicalORExpression "?" LexPushInOff AssignmentExpression LexPopIn ":" AssignmentExpression { $$ = CYNew CYCondition($1, $4, $7); }
934 /* 11.13 Assignment Operators {{{ */
936 : ConditionalExpression { $$ = $1; }
937 | ArrowFunction { $$ = $1; }
938 | LeftHandSideExpression "=" AssignmentExpression { $$ = CYNew CYAssign($1, $3); }
939 | LeftHandSideExpression "*=" AssignmentExpression { $$ = CYNew CYMultiplyAssign($1, $3); }
940 | LeftHandSideExpression "/=" AssignmentExpression { $$ = CYNew CYDivideAssign($1, $3); }
941 | LeftHandSideExpression "%=" AssignmentExpression { $$ = CYNew CYModulusAssign($1, $3); }
942 | LeftHandSideExpression "+=" AssignmentExpression { $$ = CYNew CYAddAssign($1, $3); }
943 | LeftHandSideExpression "-=" AssignmentExpression { $$ = CYNew CYSubtractAssign($1, $3); }
944 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = CYNew CYShiftLeftAssign($1, $3); }
945 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = CYNew CYShiftRightSignedAssign($1, $3); }
946 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = CYNew CYShiftRightUnsignedAssign($1, $3); }
947 | LeftHandSideExpression "&=" AssignmentExpression { $$ = CYNew CYBitwiseAndAssign($1, $3); }
948 | LeftHandSideExpression "^=" AssignmentExpression { $$ = CYNew CYBitwiseXOrAssign($1, $3); }
949 | LeftHandSideExpression "|=" AssignmentExpression { $$ = CYNew CYBitwiseOrAssign($1, $3); }
952 /* 11.14 Comma Operator {{{ */
954 : "," Expression { $$ = $2; }
955 | { $$ = CYNew CYCompound(); }
959 : AssignmentExpression Expression_ { $2->AddPrev($1); $$ = $2; }
963 : Expression { $$ = $1; }
964 | LexSetRegExp { $$ = NULL; }
968 /* 12 Statements {{{ */
971 | VariableStatement { $$ = $1; }
972 | EmptyStatement { $$ = $1; }
973 | IfStatement { $$ = $1; }
974 | BreakableStatement { $$ = $1; }
975 | ContinueStatement { $$ = $1; }
976 | BreakStatement { $$ = $1; }
977 | ReturnStatement { $$ = $1; }
978 | WithStatement { $$ = $1; }
979 | LabelledStatement { $$ = $1; }
980 | ThrowStatement { $$ = $1; }
981 | TryStatement { $$ = $1; }
982 | DebuggerStatement { $$ = $1; }
986 : LexSetRegExp Statement__ { $$ = $2; }
987 | ExpressionStatement { $$ = $1; }
991 : LexSetStatement Statement_ { $$ = $2; }
995 : FunctionDeclaration { $$ = $1; }
996 | LexicalDeclaration { $$ = $1; }
1000 : LexSetRegExp Declaration__ { $$ = $2; }
1004 : LexSetStatement Declaration_ { $$ = $2; }
1008 : IterationStatement { $$ = $1; }
1009 | SwitchStatement { $$ = $1; }
1012 /* 12.1 Block {{{ */
1014 : BRACE StatementListOpt "}" { $$ = $2; }
1018 : ";{" StatementListOpt "}" { $$ = CYNew CYBlock($2); }
1022 : StatementListItem StatementListOpt { $1->SetNext($2); $$ = $1; }
1026 : StatementList { $$ = $1; }
1027 | LexSetRegExp { $$ = NULL; }
1031 : Statement { $$ = $1; }
1032 | Declaration { $$ = $1; }
1036 /* 12.2 Declarations {{{ */
1038 : Identifier { $$ = $1; }
1041 // XXX: BindingPattern
1043 /* 12.2.1 Let and Const Declarations {{{ */
1045 : LetOrConst VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1053 /* 12.2.2 Variable Statement {{{ */
1055 : "var" VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1058 VariableDeclarationList_
1059 : "," VariableDeclarationList { $$ = $2; }
1063 VariableDeclarationList
1064 : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
1068 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1069 // XXX: | BindingPattern Initialiser { $$ = CYNew CYDeclaration($1, $2); }
1073 : "=" AssignmentExpression { $$ = $2; }
1077 : Initialiser { $$ = $1; }
1081 /* 12.2.4 Destructuring Binding Patterns {{{ */
1085 : SingleNameBinding { $$ = $1; }
1089 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1093 /* 12.3 Empty Statement {{{ */
1095 : ";" { $$ = CYNew CYEmpty(); }
1098 /* 12.4 Expression Statement {{{ */
1100 : Expression Terminator { $$ = CYNew CYExpress($1); }
1103 /* 12.5 The if Statement {{{ */
1105 : "else" Statement { $$ = $2; }
1106 | %prec "if" { $$ = NULL; }
1110 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = CYNew CYIf($3, $5, $6); }
1114 /* 12.6.1 The do-while Statement {{{ */
1116 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = CYNew CYDoWhile($5, $2); }
1119 /* 12.6.2 The while Statement {{{ */
1121 : "while" "(" Expression ")" Statement { $$ = CYNew CYWhile($3, $5); }
1124 /* 12.6.3 The for Statement {{{ */
1126 : "for" "(" LexPushInOn ForStatementInitialiser LexPopIn ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = CYNew CYFor($4, $7, $9, $11); }
1129 ForStatementInitialiser
1130 : ExpressionOpt { $$ = $1; }
1131 | LexSetRegExp "var" VariableDeclarationList { $$ = CYNew CYForDeclarations($3); }
1134 /* 12.6.4 The for-in and for-of Statements {{{ */
1136 : "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForIn($4, $7, $9); }
1137 | "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "of" Expression ")" Statement { $$ = CYNew CYForOf($4, $7, $9); }
1140 ForInStatementInitialiser
1141 : LeftHandSideExpression { $$ = $1; }
1142 | LexSetRegExp "var" VariableDeclaration { $$ = $3; }
1146 /* 12.7 The continue Statement {{{ */
1148 : "continue" "\n" StrictSemi { $$ = CYNew CYContinue(NULL); }
1149 | "continue" IdentifierOpt Terminator { $$ = CYNew CYContinue($2); }
1152 /* 12.8 The break Statement {{{ */
1154 : "break" "\n" StrictSemi { $$ = CYNew CYBreak(NULL); }
1155 | "break" IdentifierOpt Terminator { $$ = CYNew CYBreak($2); }
1158 /* 12.9 The return Statement {{{ */
1160 : "return" "\n" StrictSemi { $$ = CYNew CYReturn(NULL); }
1161 | "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); }
1164 /* 12.10 The with Statement {{{ */
1166 : "with" "(" Expression ")" Statement { $$ = CYNew CYWith($3, $5); }
1170 /* 12.11 The switch Statement {{{ */
1172 : "switch" "(" Expression ")" CaseBlock { $$ = CYNew CYSwitch($3, $5); }
1176 : BRACE CaseClausesOpt "}" { $$ = $2; }
1180 : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
1184 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1185 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1190 : "default" ":" StatementListOpt { $$ = CYNew CYClause(NULL, $3); }
1193 /* 12.12 Labelled Statements {{{ */
1195 : Identifier ":" Statement { $$ = CYNew CYLabel($1, $3); }
1198 /* 12.13 The throw Statement {{{ */
1200 : "throw" "\n" StrictSemi { YYABORT; }
1201 | "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); }
1204 /* 12.14 The try Statement {{{ */
1206 : "try" Block_ CatchOpt FinallyOpt { $$ = CYNew cy::Syntax::Try($2, $3, $4); }
1210 : "catch" "(" Identifier ")" Block_ { $$ = CYNew cy::Syntax::Catch($3, $5); }
1215 : "finally" Block_ { $$ = CYNew CYFinally($2); }
1219 /* 12.14 The debugger Statement {{{ */
1221 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1225 /* 13.1 Function Definitions {{{ */
1227 : ";function" Identifier "(" FormalParameterListOpt ")" BRACE FunctionBody "}" { $$ = CYNew CYFunctionStatement($2, $4, $7); }
1231 : "function" IdentifierOpt "(" LexPushInOff FormalParameterListOpt LexPopIn ")" BRACE LexPushInOff FunctionBody LexPopIn "}" { $$ = CYNew CYFunctionExpression($2, $5, $10); }
1234 FormalParameterList_
1235 : "," FormalParameterList { $$ = $2; }
1240 // XXX: : FunctionRestParameter { $$ = $1; }
1241 : FormalParameter FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
1244 FormalParameterListOpt
1245 : FormalParameterList
1249 /* XXX: FunctionRestParameter
1250 : "..." BindingIdentifier { $$ = CYNew CYFunctionRestParameter($2); }
1254 : BindingElement { $$ = $1; }
1258 : StatementListOpt { $$ = $1; }
1261 /* 13.2 Arrow Function Definitions {{{ */
1263 : LexSetRegExp ArrowParameters "=>" LexNoBrace ConciseBody { $$ = CYNew CYFunctionExpression(NULL, $2, $5); }
1267 : BindingIdentifier { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1)); }
1268 //| ParentheticalOpt { $$ = $1; }
1272 : AssignmentExpression { $$ = CYNew CYReturn($1); }
1273 | ";{" LexPushInOff FunctionBody LexPopIn "}" { $$ = $3; }
1276 /* 14 Program {{{ */
1278 : ProgramBodyOpt { driver.program_ = CYNew CYProgram($1); }
1282 : StatementList { $$ = $1; }
1286 : ProgramBody { $$ = $1; }
1292 /* Cycript (Objective-C): @class Declaration {{{ */
1294 /* XXX: why the hell did I choose MemberExpression? */
1295 : ":" LexSetRegExp MemberExpression { $$ = $3; }
1300 : Expression Identifier ";"
1304 : BRACE ClassFieldListOpt "}" { $$ = NULL; }
1308 : ClassFieldListOpt ClassField
1313 : "+" { $$ = false; }
1314 | "-" { $$ = true; }
1318 : "(" Expression ")" { $$ = $2; }
1319 | "(" LexSetRegExp "void" ")" { $$ = NULL; }
1324 : Word ":" TypeOpt Identifier { $$ = CYNew CYMessageParameter($1, $3, $4); }
1327 MessageParameterList
1328 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1331 MessageParameterListOpt
1332 : MessageParameterList { $$ = $1; }
1337 : MessageParameterList { $$ = $1; }
1338 | Word { $$ = CYNew CYMessageParameter($1, NULL, NULL); }
1341 ClassMessageDeclaration
1342 : MessageScope TypeOpt MessageParameters BRACE FunctionBody "}" { $$ = CYNew CYMessage($1, $2, $3, $5); }
1345 ClassMessageDeclarationListOpt
1346 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1347 | ClassMessageDeclarationListOpt Comment { $$ = $1; }
1352 : Identifier { $$ = $1; }
1353 | "(" AssignmentExpression ")" { $$ = $2; }
1357 : ClassName { $$ = $1; }
1361 // XXX: this should be AssignmentExpressionNoRight
1363 : ShiftExpression ClassProtocolsOpt { $$ = CYNew CYProtocol($1, $2); }
1367 : "," ClassProtocols { $$ = $2; }
1371 ClassProtocolListOpt
1372 : "<" ClassProtocols ">" { $$ = $2; }
1377 : "@implementation" LexPushInOff ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt LexPopIn "@end" { $$ = CYNew CYClassExpression($3, $4, $5, $6, $7); }
1381 : ";@implementation" ClassName ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYClassStatement($2, $3, $4, $5, $6); }
1389 : ";@implementation" ClassName CategoryName ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYCategory($2, $4); }
1393 : ClassExpression { $$ = $1; }
1397 : ClassStatement { $$ = $1; }
1398 | CategoryStatement { $$ = $1; }
1401 /* Cycript (Objective-C): Send Message {{{ */
1403 : "," AssignmentExpression VariadicCall { $$ = CYNew CYArgument(NULL, $2, $3); }
1408 : WordOpt { driver.contexts_.back().words_.push_back($1); } { $$ = $1; }
1409 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
1413 : SelectorCall { $$ = $1; }
1414 | VariadicCall { $$ = $1; }
1418 : SelectorWordOpt ":" AssignmentExpression SelectorCall_ { $$ = CYNew CYArgument($1 ?: CYNew CYBlank(), $3, $4); }
1422 : SelectorCall { $$ = $1; }
1423 | Word { $$ = CYNew CYArgument($1, NULL); }
1427 : "[" LexPushInOff AssignmentExpression { driver.contexts_.push_back($3); } SelectorList LexPopIn "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
1428 | "[" LexPushInOff LexSetRegExp "super" { driver.context_ = NULL; } SelectorList LexPopIn "]" { $$ = CYNew CYSendSuper($6); }
1432 : WordOpt ":" SelectorExpressionOpt { $$ = CYNew CYSelectorPart($1, true, $3); }
1436 : SelectorExpression_ { $$ = $1; }
1437 | Word { $$ = CYNew CYSelectorPart($1, false, NULL); }
1440 SelectorExpressionOpt
1441 : SelectorExpression_ { $$ = $1; }
1446 : MessageExpression { $$ = $1; }
1447 | "@selector" "(" LexPushInOff SelectorExpression LexPopIn ")" { $$ = CYNew CYSelector($4); }
1450 /* Cycript (Objective-C): @import Directive {{{ */
1464 : "@import" ImportPath { $$ = CYNew CYImport(); }
1467 /* Cycript (Objective-C): Boxed Expressions {{{ */
1469 : NullLiteral { $$ = $1; }
1470 | BooleanLiteral { $$ = $1; }
1471 | NumericLiteral { $$ = $1; }
1472 | StringLiteral { $$ = $1; }
1473 | ArrayLiteral { $$ = $1; }
1474 | ObjectLiteral { $$ = $1; }
1475 | Parenthetical { $$ = $1; }
1479 : "@" BoxableExpression { $$ = CYNew CYBox($2); }
1485 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1486 LeftHandSideExpression
1487 : LexSetRegExp "*" UnaryExpression { $$ = CYNew CYIndirect($3); }
1491 : "&" UnaryExpression { $$ = CYNew CYAddressOf($2); }
1495 : "->" "[" Expression "]" { $$ = CYNew CYIndirectMember(NULL, $3); }
1496 | "->" IdentifierName { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); }
1497 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
1502 /* YUI: Documentation Comments {{{ */
1504 : Comment { $$ = $1; }
1509 /* Lexer State {{{ */
1511 : { driver.PushCondition(CYDriver::RegExpCondition); }
1515 : { driver.PushCondition(CYDriver::XMLContentCondition); }
1519 : { driver.PushCondition(CYDriver::XMLTagCondition); }
1523 : { driver.PopCondition(); }
1527 : { driver.SetCondition(CYDriver::XMLContentCondition); }
1531 : { driver.SetCondition(CYDriver::XMLTagCondition); }
1534 /* Virtual Tokens {{{ */
1541 /* 8.1 Context Keywords {{{ */
1543 : "namespace" { $$ = $1; }
1544 | "xml" { $$ = $1; }
1547 /* 8.3 XML Initialiser Input Elements {{{ */
1549 : XMLComment { $$ = $1; }
1550 | XMLCDATA { $$ = $1; }
1551 | XMLPI { $$ = $1; }
1555 /* 11.1 Primary Expressions {{{ */
1557 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
1558 | XMLInitialiser { $$ = $1; }
1559 | XMLListInitialiser { $$ = $1; }
1563 : AttributeIdentifier { $$ = $1; }
1564 | QualifiedIdentifier { $$ = $1; }
1565 | WildcardIdentifier { $$ = $1; }
1568 /* 11.1.1 Attribute Identifiers {{{ */
1570 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
1574 : PropertySelector { $$ = $1; }
1575 | "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYSelector($3); }
1579 : Identifier { $$ = CYNew CYSelector($1); }
1580 | WildcardIdentifier { $$ = $1; }
1583 /* 11.1.2 Qualified Identifiers {{{ */
1584 QualifiedIdentifier_
1585 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
1586 | QualifiedIdentifier { $$ = $1; }
1590 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
1593 /* 11.1.3 Wildcard Identifiers {{{ */
1595 : "*" { $$ = CYNew CYWildcard(); }
1598 /* 11.1.4 XML Initialiser {{{ */
1600 : XMLMarkup { $$ = $1; }
1601 | XMLElement { $$ = $1; }
1605 : "<" LexPushInOff XMLTagContent LexPop LexPopIn "/>"
1606 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop LexPopIn ">"
1610 : LexPushXMLTag XMLTagName XMLAttributes
1614 : BRACE LexPushRegExp Expression LexPop "}"
1623 : XMLAttributes_ XMLAttribute
1628 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
1629 | XMLAttributes_ XMLWhitespaceOpt
1638 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
1642 : XMLExpression XMLElementContentOpt
1643 | XMLMarkup XMLElementContentOpt
1644 | XMLText XMLElementContentOpt
1645 | XMLElement XMLElementContentOpt
1648 XMLElementContentOpt
1653 /* 11.1.5 XMLList Initialiser {{{ */
1655 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop LexPopIn "</>" { $$ = CYNew CYXMLList($4); }
1659 /* 11.2 Left-Hand-Side Expressions {{{ */
1661 : Identifier { $$ = $1; }
1662 | PropertyIdentifier { $$ = $1; }
1666 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
1667 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
1668 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
1671 /* 12.1 The default xml namespace Statement {{{ */
1672 /* XXX: DefaultXMLNamespaceStatement
1673 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
1677 : DefaultXMLNamespaceStatement { $$ = $1; }
1682 /* JavaScript 1.7: Array Comprehensions {{{ */
1684 : "if" "(" Expression ")" { $$ = CYNew CYIfComprehension($3); }
1688 : "for" "(" LexPushInOn Identifier LexPopIn "!in" Expression ")" { $$ = CYNew CYForInComprehension($4, $7); }
1689 | "for" "each" "(" LexPushInOn Identifier LexPopIn "!in" Expression ")" { $$ = CYNew CYForOfComprehension($5, $8); }
1693 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1696 ComprehensionListOpt
1697 : ComprehensionList { $$ = $1; }
1698 | IfComprehension { $$ = $1; }
1703 : "[" LexPushInOff AssignmentExpression ComprehensionList LexPopIn "]" { $$ = CYNew CYArrayComprehension($3, $4); }
1706 /* JavaScript 1.7: for each {{{ */
1708 : "for" "each" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForOf($5, $8, $10); }
1711 /* JavaScript 1.7: let Statements {{{ */
1713 : "let" "(" VariableDeclarationList ")" Statement { $$ = CYNew CYLetStatement($3, $5); }
1721 /* JavaScript FTW: Ruby Blocks {{{ */
1722 RubyProcParameterList_
1723 : "," RubyProcParameterList { $$ = $2; }
1727 RubyProcParameterList
1728 : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1), $2); }
1733 : "|" RubyProcParameterList "|" { $$ = $2; }
1734 | "||" { $$ = NULL; }
1737 RubyProcParametersOpt
1738 : RubyProcParameters
1743 : "{" RubyProcParametersOpt StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
1747 : "{" LexPushInOff RubyProcParameters StatementListOpt LexPopIn "}" { $$ = CYNew CYRubyProc($3, $4); }
1751 : CallExpression_ RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); }