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_> Auto "auto"
238 %token <word_> Break "break"
239 %token <word_> Case "case"
240 %token <word_> Catch "catch"
241 %token <word_> Continue "continue"
242 %token <word_> Default "default"
243 %token <word_> Delete "delete"
244 %token <word_> Do "do"
245 %token <word_> Else "else"
246 %token <word_> Finally "finally"
247 %token <word_> For "for"
248 %token <word_> Function "function"
249 %token <word_> Function_ ";function"
250 %token <word_> If "if"
251 %token <word_> In "in"
252 %token <word_> In_ "!in"
253 %token <word_> InstanceOf "instanceof"
254 %token <word_> New "new"
255 %token <word_> Return "return"
256 %token <word_> Switch "switch"
257 %token <this_> This "this"
258 %token <word_> Throw "throw"
259 %token <word_> Try "try"
260 %token <word_> TypeOf "typeof"
261 %token <word_> Var "var"
262 %token <word_> Void "void"
263 %token <word_> While "while"
264 %token <word_> With "with"
266 // ES3/IE6 Future, ES5/JSC Reserved
267 %token <word_> Debugger "debugger"
269 // ES3/ES5/IE6 Future, JSC Reserved
270 %token <word_> Const "const"
272 // ES3/ES5/IE6/JSC Future
273 %token <word_> Class "class"
274 %token <word_> Enum "enum"
275 %token <word_> Export "export"
276 %token <word_> Extends "extends"
277 %token <word_> Import "import"
278 %token <word_> Super "super"
280 // ES3 Future, ES5 Strict Future
281 %token <identifier_> Implements "implements"
282 %token <identifier_> Interface "interface"
283 %token <identifier_> Package "package"
284 %token <identifier_> Private "private"
285 %token <identifier_> Protected "protected"
286 %token <identifier_> Public "public"
287 %token <identifier_> Static "static"
290 %token <identifier_> Abstract "abstract"
291 %token <identifier_> Boolean "boolean"
292 %token <identifier_> Byte "byte"
293 %token <identifier_> Char "char"
294 %token <identifier_> Double "double"
295 %token <identifier_> Final "final"
296 %token <identifier_> Float "float"
297 %token <identifier_> Goto "goto"
298 %token <identifier_> Int "int"
299 %token <identifier_> Long "long"
300 %token <identifier_> Native "native"
301 %token <identifier_> Short "short"
302 %token <identifier_> Synchronized "synchronized"
303 %token <identifier_> Throws "throws"
304 %token <identifier_> Transient "transient"
305 %token <identifier_> Volatile "volatile"
308 %token <identifier_> Let "let"
309 %token <identifier_> Yield "yield"
312 %token <identifier_> Each "each"
313 %token <identifier_> Of "of"
317 %token <identifier_> Namespace "namespace"
318 %token <identifier_> XML "xml"
323 %token <identifier_> Identifier_
324 %token <number_> NumericLiteral
325 %token <string_> StringLiteral
326 %token <literal_> RegularExpressionLiteral
328 %type <expression_> AdditiveExpression
329 %type <argument_> ArgumentList_
330 %type <argument_> ArgumentList
331 %type <argument_> ArgumentListOpt
332 %type <argument_> Arguments
333 %type <literal_> ArrayLiteral
334 %type <expression_> ArrowFunction
335 %type <functionParameter_> ArrowParameters
336 %type <expression_> AssignmentExpression
337 %type <identifier_> Binding
338 %type <identifier_> BindingIdentifier
339 %type <expression_> BitwiseANDExpression
340 %type <statement_> Block_
341 %type <statement_> Block
342 %type <boolean_> BooleanLiteral
343 %type <declaration_> BindingElement
344 %type <expression_> BitwiseORExpression
345 %type <expression_> BitwiseXORExpression
346 %type <statement_> BreakStatement
347 %type <statement_> BreakableStatement
348 %type <expression_> CallExpression_
349 %type <expression_> CallExpression
350 %type <clause_> CaseBlock
351 %type <clause_> CaseClause
352 %type <clause_> CaseClausesOpt
353 %type <catch_> CatchOpt
354 %type <comprehension_> ComprehensionForList
355 %type <comprehension_> ComprehensionForListOpt
356 %type <comprehension_> ComprehensionList
357 %type <comprehension_> ComprehensionListOpt
358 %type <expression_> ConditionalExpression
359 %type <statement_> ContinueStatement
360 %type <statement_> ConciseBody
361 %type <statement_> DebuggerStatement
362 %type <statement_> Declaration__
363 %type <statement_> Declaration_
364 %type <statement_> Declaration
365 %type <clause_> DefaultClause
366 %type <expression_> Element
367 %type <expression_> ElementOpt
368 %type <element_> ElementList
369 %type <element_> ElementListOpt
370 %type <statement_> ElseStatementOpt
371 %type <statement_> EmptyStatement
372 %type <expression_> EqualityExpression
373 %type <compound_> Expression_
374 %type <compound_> Expression
375 %type <expression_> ExpressionOpt
376 %type <statement_> ExpressionStatement
377 %type <finally_> FinallyOpt
378 %type <comprehension_> ForComprehension
379 %type <for_> ForStatementInitialiser
380 %type <forin_> ForInStatementInitialiser
381 %type <declaration_> FormalParameter
382 %type <functionParameter_> FormalParameterList_
383 %type <functionParameter_> FormalParameterList
384 %type <functionParameter_> FormalParameterListOpt
385 %type <statement_> FunctionBody
386 %type <statement_> FunctionDeclaration
387 %type <expression_> FunctionExpression
388 %type <identifier_> Identifier
389 %type <identifier_> IdentifierOpt
390 %type <word_> IdentifierName
391 %type <comprehension_> IfComprehension
392 %type <statement_> IfStatement
393 %type <expression_> Initialiser
394 %type <expression_> InitialiserOpt
395 %type <statement_> IterationStatement
396 %type <statement_> LabelledStatement
397 %type <expression_> LeftHandSideExpression
398 %type <statement_> LetStatement
399 %type <statement_> LexicalDeclaration
400 %type <literal_> Literal
401 %type <literal_> ValueLiteral
402 %type <expression_> LogicalANDExpression
403 %type <expression_> LogicalORExpression
404 %type <member_> MemberAccess
405 %type <expression_> MemberExpression_
406 %type <expression_> MemberExpression
407 %type <expression_> MultiplicativeExpression
408 %type <expression_> NewExpression
409 %type <null_> NullLiteral
410 %type <literal_> ObjectLiteral
411 %type <compound_> Parenthetical
412 %type <compound_> ParentheticalOpt
413 %type <expression_> PostfixExpression
414 %type <expression_> PrimaryExpression
415 %type <statement_> Program
416 %type <statement_> ProgramBody
417 %type <statement_> ProgramBodyOpt
418 %type <propertyName_> PropertyName_
419 %type <propertyName_> PropertyName
420 %type <property_> PropertyDefinition
421 %type <property_> PropertyDefinitionList_
422 %type <property_> PropertyDefinitionList
423 %type <property_> PropertyDefinitionListOpt
424 %type <expression_> RelationalExpression
425 %type <statement_> ReturnStatement
426 %type <rubyProc_> RubyProcExpression
427 %type <functionParameter_> RubyProcParameterList_
428 %type <functionParameter_> RubyProcParameterList
429 %type <functionParameter_> RubyProcParameters
430 %type <functionParameter_> RubyProcParametersOpt
431 %type <expression_> ShiftExpression
432 %type <declaration_> SingleNameBinding
433 %type <statement_> Statement__
434 %type <statement_> Statement_
435 %type <statement_> Statement
436 %type <statement_> StatementList
437 %type <statement_> StatementListOpt
438 %type <statement_> StatementListItem
439 %type <statement_> SwitchStatement
440 %type <statement_> ThrowStatement
441 %type <statement_> TryStatement
442 %type <expression_> UnaryExpression_
443 %type <expression_> UnaryExpression
444 %type <declaration_> VariableDeclaration
445 %type <declarations_> VariableDeclarationList_
446 %type <declarations_> VariableDeclarationList
447 %type <statement_> VariableStatement
448 %type <statement_> WithStatement
450 %type <word_> WordOpt
453 %type <expression_> BoxableExpression
454 %type <statement_> CategoryStatement
455 %type <expression_> ClassExpression
456 %type <field_> ClassFieldListOpt
457 %type <field_> ClassFields
458 %type <statement_> ClassStatement
459 %type <expression_> ClassSuperOpt
460 %type <message_> ClassMessageDeclaration
461 %type <message_> ClassMessageDeclarationListOpt
462 %type <className_> ClassName
463 %type <className_> ClassNameOpt
464 %type <protocol_> ClassProtocolListOpt
465 %type <protocol_> ClassProtocols
466 %type <protocol_> ClassProtocolsOpt
467 %type <expression_> MessageExpression
468 %type <messageParameter_> MessageParameter
469 %type <messageParameter_> MessageParameters
470 %type <messageParameter_> MessageParameterList
471 %type <messageParameter_> MessageParameterListOpt
472 %type <bool_> MessageScope
473 %type <argument_> SelectorCall_
474 %type <argument_> SelectorCall
475 %type <selector_> SelectorExpression_
476 %type <selector_> SelectorExpression
477 %type <selector_> SelectorExpressionOpt
478 %type <argument_> SelectorList
479 %type <word_> SelectorWordOpt
480 %type <expression_> TypeOpt
481 %type <argument_> VariadicCall
485 %type <propertyIdentifier_> PropertyIdentifier_
486 %type <selector_> PropertySelector_
487 %type <selector_> PropertySelector
488 %type <identifier_> QualifiedIdentifier_
489 %type <identifier_> QualifiedIdentifier
490 %type <identifier_> WildcardIdentifier
491 %type <identifier_> XMLComment
492 %type <identifier_> XMLCDATA
493 %type <identifier_> XMLElement
494 %type <identifier_> XMLElementContent
495 %type <identifier_> XMLMarkup
496 %type <identifier_> XMLPI
498 %type <attribute_> AttributeIdentifier
499 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
500 %type <expression_> PropertyIdentifier
501 %type <expression_> XMLListInitialiser
502 %type <expression_> XMLInitialiser
505 /* Token Priorities {{{ */
517 /* Lexer State {{{ */
519 : { driver.in_.push(true); }
523 : { driver.in_.push(false); }
527 : { driver.in_.pop(); }
531 : { driver.SetCondition(CYDriver::RegExpCondition); }
535 : { if (yychar == yyempty_) driver.nobrace_ = true; else if (yychar == token::OpenBrace || yychar == token::OpenBrace_) yychar = token::OpenBrace__; }
539 : { if (yychar == token::Function) yychar = token::Function_; }
542 LexNoAtImplementation
543 : { if (yychar == token::AtImplementation) yychar = token::AtImplementation_; }
547 : LexNoBrace LexNoFunction LexNoAtImplementation
550 /* Virtual Tokens {{{ */
561 /* 7.6 Identifier Names and Identifiers {{{ */
572 : Identifier { $$ = $1; }
573 | "auto" { $$ = $1; }
574 | "break" NewLineOpt { $$ = $1; }
575 | "case" { $$ = $1; }
576 | "catch" { $$ = $1; }
577 | "class" { $$ = $1; }
578 | "const" { $$ = $1; }
579 | "continue" NewLineOpt { $$ = $1; }
580 | "debugger" { $$ = $1; }
581 | "default" { $$ = $1; }
582 | "delete" { $$ = $1; }
584 | "else" { $$ = $1; }
585 | "enum" { $$ = $1; }
586 | "export" { $$ = $1; }
587 | "extends" { $$ = $1; }
588 | "false" { $$ = $1; }
589 | "finally" { $$ = $1; }
590 /* XXX: | "for" { $$ = $1; } */
591 | "function" { $$ = $1; }
593 | "import" { $$ = $1; }
594 /* XXX: | "in" { $$ = $1; } */
596 /* XXX: | "instanceof" { $$ = $1; } */
598 // XXX: as it currently is not an Identifier
602 | "null" { $$ = $1; }
603 | "return" NewLineOpt { $$ = $1; }
604 | "super" { $$ = $1; }
605 | "switch" { $$ = $1; }
606 | "this" { $$ = $1; }
607 | "throw" NewLineOpt { $$ = $1; }
608 | "true" { $$ = $1; }
610 | "typeof" { $$ = $1; }
612 | "void" { $$ = $1; }
613 | "while" { $$ = $1; }
614 | "with" { $$ = $1; }
623 : Identifier_ { $$ = $1; }
625 | "implements" { $$ = $1; }
626 | "interface" { $$ = $1; }
627 | "package" { $$ = $1; }
628 | "private" { $$ = $1; }
629 | "protected" { $$ = $1; }
630 | "public" { $$ = $1; }
631 | "static" { $$ = $1; }
633 | "abstract" { $$ = $1; }
634 | "boolean" { $$ = $1; }
635 | "byte" { $$ = $1; }
636 | "char" { $$ = $1; }
637 | "double" { $$ = $1; }
638 | "final" { $$ = $1; }
639 | "float" { $$ = $1; }
640 | "goto" { $$ = $1; }
642 | "long" { $$ = $1; }
643 | "native" { $$ = $1; }
644 | "short" { $$ = $1; }
645 | "synchronized" { $$ = $1; }
646 | "throws" { $$ = $1; }
647 | "transient" { $$ = $1; }
648 | "volatile" { $$ = $1; }
650 // XXX: currently I only have this as Word
651 // | "let" { $$ = $1; }
653 | "yield" { $$ = $1; }
655 | "each" { $$ = $1; }
660 : Identifier { $$ = $1; }
665 /* 7.8 Literals {{{ */
667 : NullLiteral { $$ = $1; }
668 | ValueLiteral { $$ = $1; }
672 : BooleanLiteral { $$ = $1; }
673 | NumericLiteral { $$ = $1; }
674 | StringLiteral { $$ = $1; }
675 | RegularExpressionLiteral { $$ = $1; }
678 /* 7.8.1 Null Literals {{{ */
680 : "null" { $$ = $1; }
683 /* 7.8.2 Boolean Literals {{{ */
685 : "true" { $$ = $1; }
686 | "false" { $$ = $1; }
690 /* 7.9 Automatic Semicolon Insertion {{{ */
692 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
697 | error { if (yychar != yyeof_ && yychar != token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
702 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
706 /* 11.1 Primary Expressions {{{ */
708 : "(" LexPushInOff Expression LexPopIn ")" { $$ = $3; }
712 : Parenthetical { $$ = $1; }
717 : "this" { $$ = $1; }
718 | Identifier { $$ = CYNew CYVariable($1); }
719 | Literal { $$ = $1; }
720 | ArrayLiteral { $$ = $1; }
721 | ObjectLiteral { $$ = $1; }
722 | FunctionExpression { $$ = $1; }
723 | Parenthetical { $$ = $1; }
724 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
727 /* 11.1.4.1 Array Initialiser {{{ */
729 : "[" LexPushInOff ElementListOpt LexPopIn "]" { $$ = CYNew CYArray($3); }
733 : AssignmentExpression { $$ = $1; }
737 : Element { $$ = $1; }
738 | LexSetRegExp { $$ = NULL; }
742 : ElementOpt "," ElementListOpt { $$ = CYNew CYElement($1, $3); }
743 | Element { $$ = CYNew CYElement($1, NULL); }
747 : ElementList { $$ = $1; }
748 | LexSetRegExp { $$ = NULL; }
751 /* 11.1.4.2 Array Comprehension {{{ */
753 : "[" LexPushInOff AssignmentExpression ComprehensionForList LexPopIn "]" { $$ = CYNew CYArrayComprehension($3, $4); }
757 : "for" Binding "in" Expression ComprehensionForListOpt { $$ = CYNew CYForInComprehension($2, $4, $5); }
758 | "for" Binding "of" Expression ComprehensionForListOpt { $$ = CYNew CYForOfComprehension($2, $4, $5); }
761 ComprehensionForListOpt
762 : ComprehensionForList { $$ = $1; }
763 | "if" Expression { $$ = CYNew CYIfComprehension($2); }
767 /* 11.1.5 Object Initialiser {{{ */
769 : BRACE LexPushInOff PropertyDefinitionListOpt LexPopIn "}" { $$ = CYNew CYObject($3); }
772 PropertyDefinitionList_
773 : "," PropertyDefinitionList { $$ = $2; }
778 PropertyDefinitionList
779 : PropertyDefinition PropertyDefinitionList_ { $1->SetNext($2); $$ = $1; }
782 PropertyDefinitionListOpt
783 : PropertyDefinitionList { $$ = $1; }
788 // XXX: this should be IdentifierName
789 : LexSetRegExp Identifier { $$ = CYNew CYProperty($2, CYNew CYVariable($2)); }
790 | PropertyName ":" AssignmentExpression { $$ = CYNew CYProperty($1, $3); }
795 : IdentifierName { $$ = $1; }
796 | StringLiteral { $$ = $1; }
797 | NumericLiteral { $$ = $1; }
801 : LexSetRegExp PropertyName_ { $$ = $2; }
805 /* 11.2 Left-Hand-Side Expressions {{{ */
807 : "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYDirectMember(NULL, $3); }
808 | "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
809 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
813 : MemberExpression { $$ = $1; }
814 //| "super" { $$ = $1; }
818 : LexSetRegExp PrimaryExpression { $$ = $2; }
819 | MemberExpression_ { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
820 | LexSetRegExp "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($3, $4); }
824 : MemberExpression { $$ = $1; }
825 | LexSetRegExp "new" NewExpression { $$ = CYNew cy::Syntax::New($3, NULL); }
834 : CallExpression_ Arguments { $$ = CYNew CYCall($1, $2); }
835 | CallExpression { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
839 : "(" LexPushInOff ArgumentListOpt LexPopIn ")" { $$ = $3; }
843 : "," ArgumentList { $$ = $2; }
848 : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
852 : ArgumentList { $$ = $1; }
853 | LexSetRegExp { $$ = NULL; }
856 LeftHandSideExpression
857 : NewExpression { $$ = $1; }
858 | CallExpression { $$ = $1; }
861 /* 11.3 Postfix Expressions {{{ */
863 : %prec "" LeftHandSideExpression { $$ = $1; }
864 | LeftHandSideExpression "++" { $$ = CYNew CYPostIncrement($1); }
865 | LeftHandSideExpression "--" { $$ = CYNew CYPostDecrement($1); }
868 /* 11.4 Unary Operators {{{ */
870 : "delete" UnaryExpression { $$ = CYNew CYDelete($2); }
871 | "void" UnaryExpression { $$ = CYNew CYVoid($2); }
872 | "typeof" UnaryExpression { $$ = CYNew CYTypeOf($2); }
873 | "++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
874 | "\n++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
875 | "--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
876 | "\n--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
877 | "+" UnaryExpression { $$ = CYNew CYAffirm($2); }
878 | "-" UnaryExpression { $$ = CYNew CYNegate($2); }
879 | "~" UnaryExpression { $$ = CYNew CYBitwiseNot($2); }
880 | "!" UnaryExpression { $$ = CYNew CYLogicalNot($2); }
884 : PostfixExpression { $$ = $1; }
885 | LexSetRegExp UnaryExpression_ { $$ = $2; }
888 /* 11.5 Multiplicative Operators {{{ */
889 MultiplicativeExpression
890 : UnaryExpression { $$ = $1; }
891 | MultiplicativeExpression "*" UnaryExpression { $$ = CYNew CYMultiply($1, $3); }
892 | MultiplicativeExpression "/" UnaryExpression { $$ = CYNew CYDivide($1, $3); }
893 | MultiplicativeExpression "%" UnaryExpression { $$ = CYNew CYModulus($1, $3); }
896 /* 11.6 Additive Operators {{{ */
898 : MultiplicativeExpression { $$ = $1; }
899 | AdditiveExpression "+" MultiplicativeExpression { $$ = CYNew CYAdd($1, $3); }
900 | AdditiveExpression "-" MultiplicativeExpression { $$ = CYNew CYSubtract($1, $3); }
903 /* 11.7 Bitwise Shift Operators {{{ */
905 : AdditiveExpression { $$ = $1; }
906 | ShiftExpression "<<" AdditiveExpression { $$ = CYNew CYShiftLeft($1, $3); }
907 | ShiftExpression ">>" AdditiveExpression { $$ = CYNew CYShiftRightSigned($1, $3); }
908 | ShiftExpression ">>>" AdditiveExpression { $$ = CYNew CYShiftRightUnsigned($1, $3); }
911 /* 11.8 Relational Operators {{{ */
913 : ShiftExpression { $$ = $1; }
914 | RelationalExpression "<" ShiftExpression { $$ = CYNew CYLess($1, $3); }
915 | RelationalExpression ">" ShiftExpression { $$ = CYNew CYGreater($1, $3); }
916 | RelationalExpression "<=" ShiftExpression { $$ = CYNew CYLessOrEqual($1, $3); }
917 | RelationalExpression ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual($1, $3); }
918 | RelationalExpression "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf($1, $3); }
919 | RelationalExpression "in" ShiftExpression { $$ = CYNew CYIn($1, $3); }
922 /* 11.9 Equality Operators {{{ */
924 : RelationalExpression { $$ = $1; }
925 | EqualityExpression "==" RelationalExpression { $$ = CYNew CYEqual($1, $3); }
926 | EqualityExpression "!=" RelationalExpression { $$ = CYNew CYNotEqual($1, $3); }
927 | EqualityExpression "===" RelationalExpression { $$ = CYNew CYIdentical($1, $3); }
928 | EqualityExpression "!==" RelationalExpression { $$ = CYNew CYNotIdentical($1, $3); }
931 /* 11.10 Binary Bitwise Operators {{{ */
933 : EqualityExpression { $$ = $1; }
934 | BitwiseANDExpression "&" EqualityExpression { $$ = CYNew CYBitwiseAnd($1, $3); }
938 : BitwiseANDExpression { $$ = $1; }
939 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = CYNew CYBitwiseXOr($1, $3); }
943 : BitwiseXORExpression { $$ = $1; }
944 | BitwiseORExpression "|" BitwiseXORExpression { $$ = CYNew CYBitwiseOr($1, $3); }
947 /* 11.11 Binary Logical Operators {{{ */
949 : BitwiseORExpression { $$ = $1; }
950 | LogicalANDExpression "&&" BitwiseORExpression { $$ = CYNew CYLogicalAnd($1, $3); }
954 : LogicalANDExpression { $$ = $1; }
955 | LogicalORExpression "||" LogicalANDExpression { $$ = CYNew CYLogicalOr($1, $3); }
958 /* 11.12 Conditional Operator ( ? : ) {{{ */
959 ConditionalExpression
960 : LogicalORExpression { $$ = $1; }
961 | LogicalORExpression "?" LexPushInOff AssignmentExpression LexPopIn ":" AssignmentExpression { $$ = CYNew CYCondition($1, $4, $7); }
964 /* 11.13 Assignment Operators {{{ */
966 : ConditionalExpression { $$ = $1; }
967 | ArrowFunction { $$ = $1; }
968 | LeftHandSideExpression "=" AssignmentExpression { $$ = CYNew CYAssign($1, $3); }
969 | LeftHandSideExpression "*=" AssignmentExpression { $$ = CYNew CYMultiplyAssign($1, $3); }
970 | LeftHandSideExpression "/=" AssignmentExpression { $$ = CYNew CYDivideAssign($1, $3); }
971 | LeftHandSideExpression "%=" AssignmentExpression { $$ = CYNew CYModulusAssign($1, $3); }
972 | LeftHandSideExpression "+=" AssignmentExpression { $$ = CYNew CYAddAssign($1, $3); }
973 | LeftHandSideExpression "-=" AssignmentExpression { $$ = CYNew CYSubtractAssign($1, $3); }
974 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = CYNew CYShiftLeftAssign($1, $3); }
975 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = CYNew CYShiftRightSignedAssign($1, $3); }
976 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = CYNew CYShiftRightUnsignedAssign($1, $3); }
977 | LeftHandSideExpression "&=" AssignmentExpression { $$ = CYNew CYBitwiseAndAssign($1, $3); }
978 | LeftHandSideExpression "^=" AssignmentExpression { $$ = CYNew CYBitwiseXOrAssign($1, $3); }
979 | LeftHandSideExpression "|=" AssignmentExpression { $$ = CYNew CYBitwiseOrAssign($1, $3); }
982 /* 11.14 Comma Operator {{{ */
984 : "," Expression { $$ = $2; }
985 | { $$ = CYNew CYCompound(); }
989 : AssignmentExpression Expression_ { $2->AddPrev($1); $$ = $2; }
993 : Expression { $$ = $1; }
994 | LexSetRegExp { $$ = NULL; }
998 /* 12 Statements {{{ */
1000 : Block { $$ = $1; }
1001 | VariableStatement { $$ = $1; }
1002 | EmptyStatement { $$ = $1; }
1003 | IfStatement { $$ = $1; }
1004 | BreakableStatement { $$ = $1; }
1005 | ContinueStatement { $$ = $1; }
1006 | BreakStatement { $$ = $1; }
1007 | ReturnStatement { $$ = $1; }
1008 | WithStatement { $$ = $1; }
1009 | LabelledStatement { $$ = $1; }
1010 | ThrowStatement { $$ = $1; }
1011 | TryStatement { $$ = $1; }
1012 | DebuggerStatement { $$ = $1; }
1016 : LexSetRegExp Statement__ { $$ = $2; }
1017 | ExpressionStatement { $$ = $1; }
1021 : LexSetStatement Statement_ { $$ = $2; }
1025 : FunctionDeclaration { $$ = $1; }
1026 | LexicalDeclaration { $$ = $1; }
1030 : LexSetRegExp Declaration__ { $$ = $2; }
1034 : LexSetStatement Declaration_ { $$ = $2; }
1038 : IterationStatement { $$ = $1; }
1039 | SwitchStatement { $$ = $1; }
1042 /* 12.1 Block {{{ */
1044 : BRACE StatementListOpt "}" { $$ = $2; }
1048 : ";{" StatementListOpt "}" { $$ = CYNew CYBlock($2); }
1052 : StatementListItem StatementListOpt { $1->SetNext($2); $$ = $1; }
1056 : StatementList { $$ = $1; }
1057 | LexSetRegExp { $$ = NULL; }
1061 : Statement { $$ = $1; }
1062 | Declaration { $$ = $1; }
1066 /* 12.2 Declarations {{{ */
1068 : Identifier { $$ = $1; }
1075 // XXX: BindingPattern
1077 /* 12.2.1 Let and Const Declarations {{{ */
1079 : LetOrConst VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1087 /* 12.2.2 Variable Statement {{{ */
1089 : Var_ VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1092 VariableDeclarationList_
1093 : "," VariableDeclarationList { $$ = $2; }
1097 VariableDeclarationList
1098 : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
1102 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1103 // XXX: | BindingPattern Initialiser { $$ = CYNew CYDeclaration($1, $2); }
1107 : "=" AssignmentExpression { $$ = $2; }
1111 : Initialiser { $$ = $1; }
1115 /* 12.2.4 Destructuring Binding Patterns {{{ */
1119 : SingleNameBinding { $$ = $1; }
1123 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1127 /* 12.3 Empty Statement {{{ */
1129 : ";" { $$ = CYNew CYEmpty(); }
1132 /* 12.4 Expression Statement {{{ */
1134 : Expression Terminator { $$ = CYNew CYExpress($1); }
1137 /* 12.5 The if Statement {{{ */
1139 : "else" Statement { $$ = $2; }
1140 | %prec "if" { $$ = NULL; }
1144 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = CYNew CYIf($3, $5, $6); }
1148 /* 12.6.1 The do-while Statement {{{ */
1150 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = CYNew CYDoWhile($5, $2); }
1153 /* 12.6.2 The while Statement {{{ */
1155 : "while" "(" Expression ")" Statement { $$ = CYNew CYWhile($3, $5); }
1158 /* 12.6.3 The for Statement {{{ */
1160 : "for" "(" LexPushInOn ForStatementInitialiser LexPopIn ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = CYNew CYFor($4, $7, $9, $11); }
1163 ForStatementInitialiser
1164 : ExpressionOpt { $$ = $1; }
1165 | LexSetRegExp Var_ VariableDeclarationList { $$ = CYNew CYForDeclarations($3); }
1168 /* 12.6.4 The for-in and for-of Statements {{{ */
1170 : "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForIn($4, $7, $9); }
1171 | "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "of" Expression ")" Statement { $$ = CYNew CYForOf($4, $7, $9); }
1174 ForInStatementInitialiser
1175 : LeftHandSideExpression { $$ = $1; }
1176 | LexSetRegExp Var_ VariableDeclaration { $$ = $3; }
1180 /* 12.7 The continue Statement {{{ */
1182 : "continue" "\n" StrictSemi { $$ = CYNew CYContinue(NULL); }
1183 | "continue" IdentifierOpt Terminator { $$ = CYNew CYContinue($2); }
1186 /* 12.8 The break Statement {{{ */
1188 : "break" "\n" StrictSemi { $$ = CYNew CYBreak(NULL); }
1189 | "break" IdentifierOpt Terminator { $$ = CYNew CYBreak($2); }
1192 /* 12.9 The return Statement {{{ */
1194 : "return" "\n" StrictSemi { $$ = CYNew CYReturn(NULL); }
1195 | "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); }
1198 /* 12.10 The with Statement {{{ */
1200 : "with" "(" Expression ")" Statement { $$ = CYNew CYWith($3, $5); }
1204 /* 12.11 The switch Statement {{{ */
1206 : "switch" "(" Expression ")" CaseBlock { $$ = CYNew CYSwitch($3, $5); }
1210 : BRACE CaseClausesOpt "}" { $$ = $2; }
1214 : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
1218 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1219 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1224 : "default" ":" StatementListOpt { $$ = CYNew CYClause(NULL, $3); }
1227 /* 12.12 Labelled Statements {{{ */
1229 : Identifier ":" Statement { $$ = CYNew CYLabel($1, $3); }
1232 /* 12.13 The throw Statement {{{ */
1234 : "throw" "\n" StrictSemi { YYABORT; }
1235 | "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); }
1238 /* 12.14 The try Statement {{{ */
1240 : "try" Block_ CatchOpt FinallyOpt { $$ = CYNew cy::Syntax::Try($2, $3, $4); }
1244 : "catch" "(" Identifier ")" Block_ { $$ = CYNew cy::Syntax::Catch($3, $5); }
1249 : "finally" Block_ { $$ = CYNew CYFinally($2); }
1253 /* 12.14 The debugger Statement {{{ */
1255 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1259 /* 13.1 Function Definitions {{{ */
1261 : ";function" Identifier "(" FormalParameterListOpt ")" BRACE FunctionBody "}" { $$ = CYNew CYFunctionStatement($2, $4, $7); }
1265 : "function" IdentifierOpt "(" LexPushInOff FormalParameterListOpt LexPopIn ")" BRACE LexPushInOff FunctionBody LexPopIn "}" { $$ = CYNew CYFunctionExpression($2, $5, $10); }
1268 FormalParameterList_
1269 : "," FormalParameterList { $$ = $2; }
1274 // XXX: : FunctionRestParameter { $$ = $1; }
1275 : FormalParameter FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
1278 FormalParameterListOpt
1279 : FormalParameterList
1283 /* XXX: FunctionRestParameter
1284 : "..." BindingIdentifier { $$ = CYNew CYFunctionRestParameter($2); }
1288 : BindingElement { $$ = $1; }
1292 : StatementListOpt { $$ = $1; }
1295 /* 13.2 Arrow Function Definitions {{{ */
1297 : LexSetRegExp ArrowParameters "=>" LexNoBrace ConciseBody { $$ = CYNew CYFatArrow($2, $5); }
1301 : BindingIdentifier { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1)); }
1302 //| ParentheticalOpt { $$ = $1; }
1306 : AssignmentExpression { $$ = CYNew CYReturn($1); }
1307 | ";{" LexPushInOff FunctionBody LexPopIn "}" { $$ = $3; }
1310 /* 14 Program {{{ */
1312 : ProgramBodyOpt { driver.program_ = CYNew CYProgram($1); }
1316 : StatementList { $$ = $1; }
1320 : ProgramBody { $$ = $1; }
1326 /* Cycript (Objective-C): @class Declaration {{{ */
1328 /* XXX: why the hell did I choose MemberExpression? */
1329 : ":" LexSetRegExp MemberExpression { $$ = $3; }
1334 : Expression Identifier ";" ClassFieldListOpt { $$ = CYNew CYField($1, $2, $4); }
1339 : BRACE ClassFieldListOpt "}" { $$ = $2; }
1343 : "+" { $$ = false; }
1344 | "-" { $$ = true; }
1348 : "(" Expression ")" { $$ = $2; }
1349 | "(" LexSetRegExp "void" ")" { $$ = CYNew CYString("v"); }
1354 : Word ":" TypeOpt Identifier { $$ = CYNew CYMessageParameter($1, $3, $4); }
1357 MessageParameterList
1358 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1361 MessageParameterListOpt
1362 : MessageParameterList { $$ = $1; }
1367 : MessageParameterList { $$ = $1; }
1368 | Word { $$ = CYNew CYMessageParameter($1, NULL, NULL); }
1371 ClassMessageDeclaration
1372 : MessageScope TypeOpt MessageParameters BRACE FunctionBody "}" { $$ = CYNew CYMessage($1, $2, $3, $5); }
1375 ClassMessageDeclarationListOpt
1376 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1377 | ClassMessageDeclarationListOpt Comment { $$ = $1; }
1382 : Identifier { $$ = $1; }
1383 | "(" AssignmentExpression ")" { $$ = $2; }
1387 : ClassName { $$ = $1; }
1391 // XXX: this should be AssignmentExpressionNoRight
1393 : ShiftExpression ClassProtocolsOpt { $$ = CYNew CYProtocol($1, $2); }
1397 : "," ClassProtocols { $$ = $2; }
1401 ClassProtocolListOpt
1402 : "<" ClassProtocols ">" { $$ = $2; }
1407 : "@implementation" LexPushInOff ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFields ClassMessageDeclarationListOpt LexPopIn "@end" { $$ = CYNew CYClassExpression($3, $4, $5, $6, $7); }
1411 : ";@implementation" ClassName ClassSuperOpt ClassProtocolListOpt ClassFields ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYClassStatement($2, $3, $4, $5, $6); }
1419 : ";@implementation" ClassName CategoryName ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYCategory($2, $4); }
1423 : ClassExpression { $$ = $1; }
1427 : ClassStatement { $$ = $1; }
1428 | CategoryStatement { $$ = $1; }
1431 /* Cycript (Objective-C): Send Message {{{ */
1433 : "," AssignmentExpression VariadicCall { $$ = CYNew CYArgument(NULL, $2, $3); }
1438 : WordOpt { driver.contexts_.back().words_.push_back($1); } { $$ = $1; }
1439 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
1443 : SelectorCall { $$ = $1; }
1444 | VariadicCall { $$ = $1; }
1448 : SelectorWordOpt ":" AssignmentExpression SelectorCall_ { $$ = CYNew CYArgument($1 ?: CYNew CYBlank(), $3, $4); }
1452 : SelectorCall { $$ = $1; }
1453 | Word { $$ = CYNew CYArgument($1, NULL); }
1457 : "[" LexPushInOff AssignmentExpression { driver.contexts_.push_back($3); } SelectorList LexPopIn "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
1458 | "[" LexPushInOff LexSetRegExp "super" { driver.context_ = NULL; } SelectorList LexPopIn "]" { $$ = CYNew CYSendSuper($6); }
1462 : WordOpt ":" SelectorExpressionOpt { $$ = CYNew CYSelectorPart($1, true, $3); }
1466 : SelectorExpression_ { $$ = $1; }
1467 | Word { $$ = CYNew CYSelectorPart($1, false, NULL); }
1470 SelectorExpressionOpt
1471 : SelectorExpression_ { $$ = $1; }
1476 : MessageExpression { $$ = $1; }
1477 | "@selector" "(" LexPushInOff SelectorExpression LexPopIn ")" { $$ = CYNew CYSelector($4); }
1480 /* Cycript (Objective-C): @import Directive {{{ */
1494 : "@import" ImportPath { $$ = CYNew CYImport(); }
1497 /* Cycript (Objective-C): Boxed Expressions {{{ */
1499 : NullLiteral { $$ = $1; }
1500 | BooleanLiteral { $$ = $1; }
1501 | NumericLiteral { $$ = $1; }
1502 | StringLiteral { $$ = $1; }
1503 | ArrayLiteral { $$ = $1; }
1504 | ObjectLiteral { $$ = $1; }
1505 | Parenthetical { $$ = $1; }
1509 : "@" BoxableExpression { $$ = CYNew CYBox($2); }
1515 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1516 LeftHandSideExpression
1517 : LexSetRegExp "*" UnaryExpression { $$ = CYNew CYIndirect($3); }
1521 : "&" UnaryExpression { $$ = CYNew CYAddressOf($2); }
1525 : "->" "[" Expression "]" { $$ = CYNew CYIndirectMember(NULL, $3); }
1526 | "->" IdentifierName { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); }
1527 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
1530 /* Cycript (C): auto Compatibility {{{ */
1537 /* YUI: Documentation Comments {{{ */
1539 : Comment { $$ = $1; }
1544 /* Lexer State {{{ */
1546 : { driver.PushCondition(CYDriver::RegExpCondition); }
1550 : { driver.PushCondition(CYDriver::XMLContentCondition); }
1554 : { driver.PushCondition(CYDriver::XMLTagCondition); }
1558 : { driver.PopCondition(); }
1562 : { driver.SetCondition(CYDriver::XMLContentCondition); }
1566 : { driver.SetCondition(CYDriver::XMLTagCondition); }
1569 /* Virtual Tokens {{{ */
1576 /* 8.1 Context Keywords {{{ */
1578 : "namespace" { $$ = $1; }
1579 | "xml" { $$ = $1; }
1582 /* 8.3 XML Initialiser Input Elements {{{ */
1584 : XMLComment { $$ = $1; }
1585 | XMLCDATA { $$ = $1; }
1586 | XMLPI { $$ = $1; }
1590 /* 11.1 Primary Expressions {{{ */
1592 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
1593 | XMLInitialiser { $$ = $1; }
1594 | XMLListInitialiser { $$ = $1; }
1598 : AttributeIdentifier { $$ = $1; }
1599 | QualifiedIdentifier { $$ = $1; }
1600 | WildcardIdentifier { $$ = $1; }
1603 /* 11.1.1 Attribute Identifiers {{{ */
1605 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
1609 : PropertySelector { $$ = $1; }
1610 | "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYSelector($3); }
1614 : Identifier { $$ = CYNew CYSelector($1); }
1615 | WildcardIdentifier { $$ = $1; }
1618 /* 11.1.2 Qualified Identifiers {{{ */
1619 QualifiedIdentifier_
1620 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
1621 | QualifiedIdentifier { $$ = $1; }
1625 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
1628 /* 11.1.3 Wildcard Identifiers {{{ */
1630 : "*" { $$ = CYNew CYWildcard(); }
1633 /* 11.1.4 XML Initialiser {{{ */
1635 : XMLMarkup { $$ = $1; }
1636 | XMLElement { $$ = $1; }
1640 : "<" LexPushInOff XMLTagContent LexPop LexPopIn "/>"
1641 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop LexPopIn ">"
1645 : LexPushXMLTag XMLTagName XMLAttributes
1649 : BRACE LexPushRegExp Expression LexPop "}"
1658 : XMLAttributes_ XMLAttribute
1663 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
1664 | XMLAttributes_ XMLWhitespaceOpt
1673 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
1677 : XMLExpression XMLElementContentOpt
1678 | XMLMarkup XMLElementContentOpt
1679 | XMLText XMLElementContentOpt
1680 | XMLElement XMLElementContentOpt
1683 XMLElementContentOpt
1688 /* 11.1.5 XMLList Initialiser {{{ */
1690 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop LexPopIn "</>" { $$ = CYNew CYXMLList($4); }
1694 /* 11.2 Left-Hand-Side Expressions {{{ */
1696 : Identifier { $$ = $1; }
1697 | PropertyIdentifier { $$ = $1; }
1701 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
1702 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
1703 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
1706 /* 12.1 The default xml namespace Statement {{{ */
1707 /* XXX: DefaultXMLNamespaceStatement
1708 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
1712 : DefaultXMLNamespaceStatement { $$ = $1; }
1717 /* JavaScript 1.7: Array Comprehensions {{{ */
1719 : "if" "(" Expression ")" { $$ = CYNew CYIfComprehension($3); }
1723 : "for" "(" Identifier "in" Expression ")" { $$ = CYNew CYForInComprehension($3, $5); }
1724 | "for" "each" "(" Identifier "in" Expression ")" { $$ = CYNew CYForOfComprehension($4, $6); }
1728 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1731 ComprehensionListOpt
1732 : ComprehensionList { $$ = $1; }
1733 | IfComprehension { $$ = $1; }
1738 : "[" LexPushInOff AssignmentExpression ComprehensionList LexPopIn "]" { $$ = CYNew CYArrayComprehension($3, $4); }
1741 /* JavaScript 1.7: for each {{{ */
1743 : "for" "each" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForOf($5, $8, $10); }
1746 /* JavaScript 1.7: let Statements {{{ */
1748 : "let" "(" VariableDeclarationList ")" Statement { $$ = CYNew CYLetStatement($3, $5); }
1756 /* JavaScript FTW: Ruby Blocks {{{ */
1757 RubyProcParameterList_
1758 : "," RubyProcParameterList { $$ = $2; }
1762 RubyProcParameterList
1763 : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1), $2); }
1768 : "|" RubyProcParameterList "|" { $$ = $2; }
1769 | "||" { $$ = NULL; }
1772 RubyProcParametersOpt
1773 : RubyProcParameters
1778 : "{" RubyProcParametersOpt StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
1782 : "{" LexPushInOff RubyProcParameters StatementListOpt LexPopIn "}" { $$ = CYNew CYRubyProc($3, $4); }
1786 : CallExpression_ RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); }