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"
42 #include "Highlight.hpp"
51 CYDriver::Condition condition_;
53 CYArgument *argument_;
54 CYAssignment *assignment_;
57 cy::Syntax::Catch *catch_;
59 CYComprehension *comprehension_;
60 CYCompound *compound_;
61 CYDeclaration *declaration_;
62 CYDeclarations *declarations_;
64 CYExpression *expression_;
67 CYForInitialiser *for_;
68 CYForInInitialiser *forin_;
69 CYFunctionParameter *functionParameter_;
70 CYIdentifier *identifier_;
77 CYProperty *property_;
78 CYPropertyName *propertyName_;
79 CYRubyProc *rubyProc_;
80 CYStatement *statement_;
87 CYClassName *className_;
90 CYMessageParameter *messageParameter_;
91 CYProtocol *protocol_;
92 CYSelectorPart *selector_;
96 CYAttribute *attribute_;
97 CYPropertyIdentifier *propertyIdentifier_;
98 CYSelector *selector_;
103 #define YYSTYPE YYSTYPE
106 @if Bison24 %code provides {
107 int cylex(YYSTYPE *, cy::location *, void *);
114 @if Bison23 %skeleton "lalr1.cc"
115 @if Bison24 %language "C++"
118 @$.begin.filename = @$.end.filename = &driver.filename_;
129 %parse-param { CYDriver &driver }
130 %lex-param { void *cyscanner }
132 /* Token Declarations {{{ */
138 %token XMLAttributeValue
140 %token XMLTagCharacters
146 %token LeftRight "<>"
147 %token LeftSlashRight "</>"
149 %token SlashRight "/>"
150 %token LeftSlash "</"
152 %token ColonColon "::"
153 %token PeriodPeriod ".."
156 @begin E4X ObjectiveC
161 %token AmpersandAmpersand "&&"
162 %token AmpersandEqual "&="
164 %token CarrotEqual "^="
166 %token EqualEqual "=="
167 %token EqualEqualEqual "==="
168 %token EqualRight "=>"
169 %token Exclamation "!"
170 %token ExclamationEqual "!="
171 %token ExclamationEqualEqual "!=="
173 %token HyphenEqual "-="
174 %token HyphenHyphen "--"
175 %token HyphenHyphen_ "\n--"
176 %token HyphenRight "->"
178 %token LeftEqual "<="
180 %token LeftLeftEqual "<<="
182 %token PercentEqual "%="
184 %token PeriodPeriodPeriod "..."
186 %token PipeEqual "|="
189 %token PlusEqual "+="
191 %token PlusPlus_ "\n++"
193 %token RightEqual ">="
194 %token RightRight ">>"
195 %token RightRightEqual ">>="
196 %token RightRightRight ">>>"
197 %token RightRightRightEqual ">>>="
199 %token SlashEqual "/="
201 %token StarEqual "*="
210 %token <comment_> Comment
213 %token CloseParen ")"
216 %token OpenBrace_ "\n{"
217 %token OpenBrace__ ";{"
218 %token CloseBrace "}"
220 %token OpenBracket "["
221 %token CloseBracket "]"
224 %token AtClass "@class"
228 %token AtImplementation "@implementation"
229 %token AtImplementation_ ";@implementation"
230 %token AtImport "@import"
232 %token AtSelector "@selector"
235 %token <false_> False "false"
236 %token <null_> Null "null"
237 %token <true_> True "true"
239 // ES3/ES5/WIE/JSC Reserved
240 %token <word_> Auto "auto"
241 %token <word_> Break "break"
242 %token <word_> Case "case"
243 %token <word_> Catch "catch"
244 %token <word_> Continue "continue"
245 %token <word_> Default "default"
246 %token <word_> Delete "delete"
247 %token <word_> Do "do"
248 %token <word_> Else "else"
249 %token <word_> Finally "finally"
250 %token <word_> For "for"
251 %token <word_> Function "function"
252 %token <word_> Function_ ";function"
253 %token <word_> If "if"
254 %token <word_> In "in"
255 %token <word_> In_ "!in"
256 %token <word_> InstanceOf "instanceof"
257 %token <word_> New "new"
258 %token <word_> Return "return"
259 %token <word_> Switch "switch"
260 %token <this_> This "this"
261 %token <word_> Throw "throw"
262 %token <word_> Try "try"
263 %token <word_> TypeOf "typeof"
264 %token <word_> Var "var"
265 %token <word_> Void "void"
266 %token <word_> While "while"
267 %token <word_> With "with"
269 // ES3/IE6 Future, ES5/JSC Reserved
270 %token <word_> Debugger "debugger"
272 // ES3/ES5/IE6 Future, JSC Reserved
273 %token <word_> Const "const"
275 // ES3/ES5/IE6/JSC Future
276 %token <word_> Class "class"
277 %token <word_> Enum "enum"
278 %token <word_> Export "export"
279 %token <word_> Extends "extends"
280 %token <word_> Import "import"
281 %token <word_> Super "super"
283 // ES3 Future, ES5 Strict Future
284 %token <identifier_> Implements "implements"
285 %token <identifier_> Interface "interface"
286 %token <identifier_> Package "package"
287 %token <identifier_> Private "private"
288 %token <identifier_> Protected "protected"
289 %token <identifier_> Public "public"
290 %token <identifier_> Static "static"
293 %token <identifier_> Abstract "abstract"
294 %token <identifier_> Boolean "boolean"
295 %token <identifier_> Byte "byte"
296 %token <identifier_> Char "char"
297 %token <identifier_> Double "double"
298 %token <identifier_> Final "final"
299 %token <identifier_> Float "float"
300 %token <identifier_> Goto "goto"
301 %token <identifier_> Int "int"
302 %token <identifier_> Long "long"
303 %token <identifier_> Native "native"
304 %token <identifier_> Short "short"
305 %token <identifier_> Synchronized "synchronized"
306 %token <identifier_> Throws "throws"
307 %token <identifier_> Transient "transient"
308 %token <identifier_> Volatile "volatile"
311 %token <identifier_> Let "let"
312 %token <identifier_> Yield "yield"
315 %token <identifier_> Each "each"
316 %token <identifier_> Of "of"
320 %token <identifier_> Namespace "namespace"
321 %token <identifier_> XML "xml"
326 %token <identifier_> Identifier_
327 %token <number_> NumericLiteral
328 %token <string_> StringLiteral
329 %token <literal_> RegularExpressionLiteral
331 %type <expression_> AdditiveExpression
332 %type <argument_> ArgumentList_
333 %type <argument_> ArgumentList
334 %type <argument_> ArgumentListOpt
335 %type <argument_> Arguments
336 %type <literal_> ArrayLiteral
337 %type <expression_> ArrowFunction
338 %type <functionParameter_> ArrowParameters
339 %type <expression_> AssignmentExpression
340 %type <identifier_> Binding
341 %type <identifier_> BindingIdentifier
342 %type <expression_> BitwiseANDExpression
343 %type <statement_> Block_
344 %type <statement_> Block
345 %type <boolean_> BooleanLiteral
346 %type <declaration_> BindingElement
347 %type <expression_> BitwiseORExpression
348 %type <expression_> BitwiseXORExpression
349 %type <statement_> BreakStatement
350 %type <statement_> BreakableStatement
351 %type <expression_> CallExpression_
352 %type <expression_> CallExpression
353 %type <clause_> CaseBlock
354 %type <clause_> CaseClause
355 %type <clause_> CaseClausesOpt
356 %type <catch_> CatchOpt
357 %type <comprehension_> ComprehensionForList
358 %type <comprehension_> ComprehensionForListOpt
359 %type <comprehension_> ComprehensionList
360 %type <comprehension_> ComprehensionListOpt
361 %type <expression_> ConditionalExpression
362 %type <statement_> ContinueStatement
363 %type <statement_> ConciseBody
364 %type <statement_> DebuggerStatement
365 %type <statement_> Declaration__
366 %type <statement_> Declaration_
367 %type <statement_> Declaration
368 %type <clause_> DefaultClause
369 %type <expression_> Element
370 %type <expression_> ElementOpt
371 %type <element_> ElementList
372 %type <element_> ElementListOpt
373 %type <statement_> ElseStatementOpt
374 %type <statement_> EmptyStatement
375 %type <expression_> EqualityExpression
376 %type <compound_> Expression_
377 %type <compound_> Expression
378 %type <expression_> ExpressionOpt
379 %type <statement_> ExpressionStatement
380 %type <finally_> FinallyOpt
381 %type <comprehension_> ForComprehension
382 %type <for_> ForStatementInitialiser
383 %type <forin_> ForInStatementInitialiser
384 %type <declaration_> FormalParameter
385 %type <functionParameter_> FormalParameterList_
386 %type <functionParameter_> FormalParameterList
387 %type <functionParameter_> FormalParameterListOpt
388 %type <statement_> FunctionBody
389 %type <statement_> FunctionDeclaration
390 %type <expression_> FunctionExpression
391 %type <identifier_> Identifier
392 %type <identifier_> IdentifierOpt
393 %type <word_> IdentifierName
394 %type <comprehension_> IfComprehension
395 %type <statement_> IfStatement
396 %type <expression_> Initialiser
397 %type <expression_> InitialiserOpt
398 %type <statement_> IterationStatement
399 %type <statement_> LabelledStatement
400 %type <expression_> LeftHandSideExpression
401 %type <statement_> LetStatement
402 %type <statement_> LexicalDeclaration
403 %type <literal_> Literal
404 %type <literal_> ValueLiteral
405 %type <expression_> LogicalANDExpression
406 %type <expression_> LogicalORExpression
407 %type <member_> MemberAccess
408 %type <expression_> MemberExpression_
409 %type <expression_> MemberExpression
410 %type <expression_> MultiplicativeExpression
411 %type <expression_> NewExpression
412 %type <null_> NullLiteral
413 %type <literal_> ObjectLiteral
414 %type <compound_> Parenthetical
415 %type <compound_> ParentheticalOpt
416 %type <expression_> PostfixExpression
417 %type <expression_> PrimaryExpression
418 %type <statement_> Program
419 %type <statement_> ProgramBody
420 %type <statement_> ProgramBodyOpt
421 %type <propertyName_> PropertyName_
422 %type <propertyName_> PropertyName
423 %type <property_> PropertyDefinition
424 %type <property_> PropertyDefinitionList_
425 %type <property_> PropertyDefinitionList
426 %type <property_> PropertyDefinitionListOpt
427 %type <expression_> RelationalExpression
428 %type <statement_> ReturnStatement
429 %type <rubyProc_> RubyProcExpression
430 %type <functionParameter_> RubyProcParameterList_
431 %type <functionParameter_> RubyProcParameterList
432 %type <functionParameter_> RubyProcParameters
433 %type <functionParameter_> RubyProcParametersOpt
434 %type <expression_> ShiftExpression
435 %type <declaration_> SingleNameBinding
436 %type <statement_> Statement__
437 %type <statement_> Statement_
438 %type <statement_> Statement
439 %type <statement_> StatementList
440 %type <statement_> StatementListOpt
441 %type <statement_> StatementListItem
442 %type <statement_> SwitchStatement
443 %type <statement_> ThrowStatement
444 %type <statement_> TryStatement
445 %type <expression_> UnaryExpression_
446 %type <expression_> UnaryExpression
447 %type <declaration_> VariableDeclaration
448 %type <declarations_> VariableDeclarationList_
449 %type <declarations_> VariableDeclarationList
450 %type <statement_> VariableStatement
451 %type <statement_> WithStatement
453 %type <word_> WordOpt
456 %type <expression_> BoxableExpression
457 %type <statement_> CategoryStatement
458 %type <expression_> ClassExpression
459 %type <field_> ClassFieldListOpt
460 %type <field_> ClassFields
461 %type <statement_> ClassStatement
462 %type <expression_> ClassSuperOpt
463 %type <message_> ClassMessageDeclaration
464 %type <message_> ClassMessageDeclarationListOpt
465 %type <className_> ClassName
466 %type <className_> ClassNameOpt
467 %type <protocol_> ClassProtocolListOpt
468 %type <protocol_> ClassProtocols
469 %type <protocol_> ClassProtocolsOpt
470 %type <expression_> MessageExpression
471 %type <messageParameter_> MessageParameter
472 %type <messageParameter_> MessageParameters
473 %type <messageParameter_> MessageParameterList
474 %type <messageParameter_> MessageParameterListOpt
475 %type <bool_> MessageScope
476 %type <argument_> SelectorCall_
477 %type <argument_> SelectorCall
478 %type <selector_> SelectorExpression_
479 %type <selector_> SelectorExpression
480 %type <selector_> SelectorExpressionOpt
481 %type <argument_> SelectorList
482 %type <word_> SelectorWordOpt
483 %type <expression_> TypeOpt
484 %type <argument_> VariadicCall
488 %type <propertyIdentifier_> PropertyIdentifier_
489 %type <selector_> PropertySelector_
490 %type <selector_> PropertySelector
491 %type <identifier_> QualifiedIdentifier_
492 %type <identifier_> QualifiedIdentifier
493 %type <identifier_> WildcardIdentifier
494 %type <identifier_> XMLComment
495 %type <identifier_> XMLCDATA
496 %type <identifier_> XMLElement
497 %type <identifier_> XMLElementContent
498 %type <identifier_> XMLMarkup
499 %type <identifier_> XMLPI
501 %type <attribute_> AttributeIdentifier
502 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
503 %type <expression_> PropertyIdentifier
504 %type <expression_> XMLListInitialiser
505 %type <expression_> XMLInitialiser
508 /* Token Priorities {{{ */
520 /* Lexer State {{{ */
522 : { driver.in_.push(true); }
526 : { driver.in_.push(false); }
530 : { driver.in_.pop(); }
534 : { driver.SetCondition(CYDriver::RegExpCondition); }
538 : { if (yychar == yyempty_) driver.no_.OpenBrace = true; else if (yychar == token::OpenBrace || yychar == token::OpenBrace_) yychar = token::OpenBrace__; }
542 : { if (yychar == yyempty_) driver.no_.Function = true; else if (yychar == token::Function) yychar = token::Function_; }
545 LexNoAtImplementation
546 : { if (yychar == yyempty_) driver.no_.AtImplementation = true; else if (yychar == token::AtImplementation) yychar = token::AtImplementation_; }
550 : LexNoBrace LexNoFunction LexNoAtImplementation
553 /* Virtual Tokens {{{ */
564 /* 7.6 Identifier Names and Identifiers {{{ */
575 : Identifier { $$ = $1; }
576 | "auto" { $$ = $1; }
577 | "break" NewLineOpt { $$ = $1; }
578 | "case" { $$ = $1; }
579 | "catch" { $$ = $1; }
580 | "class" { $$ = $1; }
581 | "const" { $$ = $1; }
582 | "continue" NewLineOpt { $$ = $1; }
583 | "debugger" { $$ = $1; }
584 | "default" { $$ = $1; }
585 | "delete" { $$ = $1; }
587 | "else" { $$ = $1; }
588 | "enum" { $$ = $1; }
589 | "export" { $$ = $1; }
590 | "extends" { $$ = $1; }
591 | "false" { $$ = $1; }
592 | "finally" { $$ = $1; }
593 /* XXX: | "for" { $$ = $1; } */
594 | "function" { $$ = $1; }
596 | "import" { $$ = $1; }
597 /* XXX: | "in" { $$ = $1; } */
599 /* XXX: | "instanceof" { $$ = $1; } */
601 // XXX: as it currently is not an Identifier
605 | "null" { $$ = $1; }
606 | "return" NewLineOpt { $$ = $1; }
607 | "super" { $$ = $1; }
608 | "switch" { $$ = $1; }
609 | "this" { $$ = $1; }
610 | "throw" NewLineOpt { $$ = $1; }
611 | "true" { $$ = $1; }
613 | "typeof" { $$ = $1; }
615 | "void" { $$ = $1; }
616 | "while" { $$ = $1; }
617 | "with" { $$ = $1; }
626 : Identifier_ { $$ = $1; }
628 | "implements" { $$ = $1; }
629 | "interface" { $$ = $1; }
630 | "package" { $$ = $1; }
631 | "private" { $$ = $1; }
632 | "protected" { $$ = $1; }
633 | "public" { $$ = $1; }
634 | "static" { $$ = $1; }
636 | "abstract" { $$ = $1; }
637 | "boolean" { $$ = $1; }
638 | "byte" { $$ = $1; }
639 | "char" { $$ = $1; }
640 | "double" { $$ = $1; }
641 | "final" { $$ = $1; }
642 | "float" { $$ = $1; }
643 | "goto" { $$ = $1; }
645 | "long" { $$ = $1; }
646 | "native" { $$ = $1; }
647 | "short" { $$ = $1; }
648 | "synchronized" { $$ = $1; }
649 | "throws" { $$ = $1; }
650 | "transient" { $$ = $1; }
651 | "volatile" { $$ = $1; }
653 // XXX: currently I only have this as Word
654 // | "let" { $$ = $1; }
656 | "yield" { $$ = $1; }
658 | "each" { $$ = $1; }
663 : Identifier { $$ = $1; }
668 /* 7.8 Literals {{{ */
670 : NullLiteral { $$ = $1; }
671 | ValueLiteral { $$ = $1; }
675 : BooleanLiteral { $$ = $1; }
676 | NumericLiteral { $$ = $1; }
677 | StringLiteral { $$ = $1; }
678 | RegularExpressionLiteral { $$ = $1; }
681 /* 7.8.1 Null Literals {{{ */
683 : "null" { $$ = $1; }
686 /* 7.8.2 Boolean Literals {{{ */
688 : "true" { $$ = $1; }
689 | "false" { $$ = $1; }
693 /* 7.9 Automatic Semicolon Insertion {{{ */
695 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
700 | error { if (yychar != yyeof_ && yychar != token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
705 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
709 /* 11.1 Primary Expressions {{{ */
711 : "(" LexPushInOff Expression LexPopIn ")" { $$ = $3; }
715 : Parenthetical { $$ = $1; }
720 : "this" { $$ = $1; }
721 | Identifier { $$ = CYNew CYVariable($1); }
722 | Literal { $$ = $1; }
723 | ArrayLiteral { $$ = $1; }
724 | ObjectLiteral { $$ = $1; }
725 | FunctionExpression { $$ = $1; }
726 | Parenthetical { $$ = $1; }
727 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
730 /* 11.1.4.1 Array Initialiser {{{ */
732 : "[" LexPushInOff ElementListOpt LexPopIn "]" { $$ = CYNew CYArray($3); }
736 : AssignmentExpression { $$ = $1; }
740 : Element { $$ = $1; }
741 | LexSetRegExp { $$ = NULL; }
745 : ElementOpt "," ElementListOpt { $$ = CYNew CYElement($1, $3); }
746 | Element { $$ = CYNew CYElement($1, NULL); }
750 : ElementList { $$ = $1; }
751 | LexSetRegExp { $$ = NULL; }
754 /* 11.1.4.2 Array Comprehension {{{ */
756 : "[" LexPushInOff AssignmentExpression ComprehensionForList LexPopIn "]" { $$ = CYNew CYArrayComprehension($3, $4); }
760 : "for" Binding "in" Expression ComprehensionForListOpt { $$ = CYNew CYForInComprehension($2, $4, $5); }
761 | "for" Binding "of" Expression ComprehensionForListOpt { $$ = CYNew CYForOfComprehension($2, $4, $5); }
764 ComprehensionForListOpt
765 : ComprehensionForList { $$ = $1; }
766 | "if" Expression { $$ = CYNew CYIfComprehension($2); }
770 /* 11.1.5 Object Initialiser {{{ */
772 : BRACE LexPushInOff PropertyDefinitionListOpt LexPopIn "}" { $$ = CYNew CYObject($3); }
775 PropertyDefinitionList_
776 : "," PropertyDefinitionList { $$ = $2; }
781 PropertyDefinitionList
782 : PropertyDefinition PropertyDefinitionList_ { $1->SetNext($2); $$ = $1; }
785 PropertyDefinitionListOpt
786 : PropertyDefinitionList { $$ = $1; }
791 // XXX: this should be IdentifierName
792 : LexSetRegExp Identifier { $$ = CYNew CYProperty($2, CYNew CYVariable($2)); }
793 | PropertyName ":" AssignmentExpression { $$ = CYNew CYProperty($1, $3); }
798 : IdentifierName { $$ = $1; }
799 | StringLiteral { $$ = $1; }
800 | NumericLiteral { $$ = $1; }
804 : LexSetRegExp PropertyName_ { $$ = $2; }
808 /* 11.2 Left-Hand-Side Expressions {{{ */
810 : "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYDirectMember(NULL, $3); }
811 | "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
812 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
816 : MemberExpression { $$ = $1; }
817 //| "super" { $$ = $1; }
821 : LexSetRegExp PrimaryExpression { $$ = $2; }
822 | MemberExpression_ { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
823 | LexSetRegExp "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($3, $4); }
827 : MemberExpression { $$ = $1; }
828 | LexSetRegExp "new" NewExpression { $$ = CYNew cy::Syntax::New($3, NULL); }
837 : CallExpression_ Arguments { $$ = CYNew CYCall($1, $2); }
838 | CallExpression { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
842 : "(" LexPushInOff ArgumentListOpt LexPopIn ")" { $$ = $3; }
846 : "," ArgumentList { $$ = $2; }
851 : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
855 : ArgumentList { $$ = $1; }
856 | LexSetRegExp { $$ = NULL; }
859 LeftHandSideExpression
860 : NewExpression { $$ = $1; }
861 | CallExpression { $$ = $1; }
864 /* 11.3 Postfix Expressions {{{ */
866 : %prec "" LeftHandSideExpression { $$ = $1; }
867 | LeftHandSideExpression "++" { $$ = CYNew CYPostIncrement($1); }
868 | LeftHandSideExpression "--" { $$ = CYNew CYPostDecrement($1); }
871 /* 11.4 Unary Operators {{{ */
873 : "delete" UnaryExpression { $$ = CYNew CYDelete($2); }
874 | "void" UnaryExpression { $$ = CYNew CYVoid($2); }
875 | "typeof" UnaryExpression { $$ = CYNew CYTypeOf($2); }
876 | "++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
877 | "\n++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
878 | "--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
879 | "\n--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
880 | "+" UnaryExpression { $$ = CYNew CYAffirm($2); }
881 | "-" UnaryExpression { $$ = CYNew CYNegate($2); }
882 | "~" UnaryExpression { $$ = CYNew CYBitwiseNot($2); }
883 | "!" UnaryExpression { $$ = CYNew CYLogicalNot($2); }
887 : PostfixExpression { $$ = $1; }
888 | LexSetRegExp UnaryExpression_ { $$ = $2; }
891 /* 11.5 Multiplicative Operators {{{ */
892 MultiplicativeExpression
893 : UnaryExpression { $$ = $1; }
894 | MultiplicativeExpression "*" UnaryExpression { $$ = CYNew CYMultiply($1, $3); }
895 | MultiplicativeExpression "/" UnaryExpression { $$ = CYNew CYDivide($1, $3); }
896 | MultiplicativeExpression "%" UnaryExpression { $$ = CYNew CYModulus($1, $3); }
899 /* 11.6 Additive Operators {{{ */
901 : MultiplicativeExpression { $$ = $1; }
902 | AdditiveExpression "+" MultiplicativeExpression { $$ = CYNew CYAdd($1, $3); }
903 | AdditiveExpression "-" MultiplicativeExpression { $$ = CYNew CYSubtract($1, $3); }
906 /* 11.7 Bitwise Shift Operators {{{ */
908 : AdditiveExpression { $$ = $1; }
909 | ShiftExpression "<<" AdditiveExpression { $$ = CYNew CYShiftLeft($1, $3); }
910 | ShiftExpression ">>" AdditiveExpression { $$ = CYNew CYShiftRightSigned($1, $3); }
911 | ShiftExpression ">>>" AdditiveExpression { $$ = CYNew CYShiftRightUnsigned($1, $3); }
914 /* 11.8 Relational Operators {{{ */
916 : ShiftExpression { $$ = $1; }
917 | RelationalExpression "<" ShiftExpression { $$ = CYNew CYLess($1, $3); }
918 | RelationalExpression ">" ShiftExpression { $$ = CYNew CYGreater($1, $3); }
919 | RelationalExpression "<=" ShiftExpression { $$ = CYNew CYLessOrEqual($1, $3); }
920 | RelationalExpression ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual($1, $3); }
921 | RelationalExpression "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf($1, $3); }
922 | RelationalExpression "in" ShiftExpression { $$ = CYNew CYIn($1, $3); }
925 /* 11.9 Equality Operators {{{ */
927 : RelationalExpression { $$ = $1; }
928 | EqualityExpression "==" RelationalExpression { $$ = CYNew CYEqual($1, $3); }
929 | EqualityExpression "!=" RelationalExpression { $$ = CYNew CYNotEqual($1, $3); }
930 | EqualityExpression "===" RelationalExpression { $$ = CYNew CYIdentical($1, $3); }
931 | EqualityExpression "!==" RelationalExpression { $$ = CYNew CYNotIdentical($1, $3); }
934 /* 11.10 Binary Bitwise Operators {{{ */
936 : EqualityExpression { $$ = $1; }
937 | BitwiseANDExpression "&" EqualityExpression { $$ = CYNew CYBitwiseAnd($1, $3); }
941 : BitwiseANDExpression { $$ = $1; }
942 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = CYNew CYBitwiseXOr($1, $3); }
946 : BitwiseXORExpression { $$ = $1; }
947 | BitwiseORExpression "|" BitwiseXORExpression { $$ = CYNew CYBitwiseOr($1, $3); }
950 /* 11.11 Binary Logical Operators {{{ */
952 : BitwiseORExpression { $$ = $1; }
953 | LogicalANDExpression "&&" BitwiseORExpression { $$ = CYNew CYLogicalAnd($1, $3); }
957 : LogicalANDExpression { $$ = $1; }
958 | LogicalORExpression "||" LogicalANDExpression { $$ = CYNew CYLogicalOr($1, $3); }
961 /* 11.12 Conditional Operator ( ? : ) {{{ */
962 ConditionalExpression
963 : LogicalORExpression { $$ = $1; }
964 | LogicalORExpression "?" LexPushInOff AssignmentExpression LexPopIn ":" AssignmentExpression { $$ = CYNew CYCondition($1, $4, $7); }
967 /* 11.13 Assignment Operators {{{ */
969 : ConditionalExpression { $$ = $1; }
970 | ArrowFunction { $$ = $1; }
971 | LeftHandSideExpression "=" AssignmentExpression { $$ = CYNew CYAssign($1, $3); }
972 | LeftHandSideExpression "*=" AssignmentExpression { $$ = CYNew CYMultiplyAssign($1, $3); }
973 | LeftHandSideExpression "/=" AssignmentExpression { $$ = CYNew CYDivideAssign($1, $3); }
974 | LeftHandSideExpression "%=" AssignmentExpression { $$ = CYNew CYModulusAssign($1, $3); }
975 | LeftHandSideExpression "+=" AssignmentExpression { $$ = CYNew CYAddAssign($1, $3); }
976 | LeftHandSideExpression "-=" AssignmentExpression { $$ = CYNew CYSubtractAssign($1, $3); }
977 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = CYNew CYShiftLeftAssign($1, $3); }
978 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = CYNew CYShiftRightSignedAssign($1, $3); }
979 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = CYNew CYShiftRightUnsignedAssign($1, $3); }
980 | LeftHandSideExpression "&=" AssignmentExpression { $$ = CYNew CYBitwiseAndAssign($1, $3); }
981 | LeftHandSideExpression "^=" AssignmentExpression { $$ = CYNew CYBitwiseXOrAssign($1, $3); }
982 | LeftHandSideExpression "|=" AssignmentExpression { $$ = CYNew CYBitwiseOrAssign($1, $3); }
985 /* 11.14 Comma Operator {{{ */
987 : "," Expression { $$ = $2; }
988 | { $$ = CYNew CYCompound(); }
992 : AssignmentExpression Expression_ { $2->AddPrev($1); $$ = $2; }
996 : Expression { $$ = $1; }
997 | LexSetRegExp { $$ = NULL; }
1001 /* 12 Statements {{{ */
1003 : Block { $$ = $1; }
1004 | VariableStatement { $$ = $1; }
1005 | EmptyStatement { $$ = $1; }
1006 | IfStatement { $$ = $1; }
1007 | BreakableStatement { $$ = $1; }
1008 | ContinueStatement { $$ = $1; }
1009 | BreakStatement { $$ = $1; }
1010 | ReturnStatement { $$ = $1; }
1011 | WithStatement { $$ = $1; }
1012 | LabelledStatement { $$ = $1; }
1013 | ThrowStatement { $$ = $1; }
1014 | TryStatement { $$ = $1; }
1015 | DebuggerStatement { $$ = $1; }
1019 : LexSetRegExp Statement__ { $$ = $2; }
1020 | ExpressionStatement { $$ = $1; }
1024 : LexSetStatement Statement_ { $$ = $2; }
1028 : FunctionDeclaration { $$ = $1; }
1029 | LexicalDeclaration { $$ = $1; }
1033 : LexSetRegExp Declaration__ { $$ = $2; }
1037 : LexSetStatement Declaration_ { $$ = $2; }
1041 : IterationStatement { $$ = $1; }
1042 | SwitchStatement { $$ = $1; }
1045 /* 12.1 Block {{{ */
1047 : BRACE StatementListOpt "}" { $$ = $2; }
1051 : ";{" StatementListOpt "}" { $$ = CYNew CYBlock($2); }
1055 : StatementListItem StatementListOpt { $1->SetNext($2); $$ = $1; }
1059 : StatementList { $$ = $1; }
1060 | LexSetStatement LexSetRegExp { $$ = NULL; }
1064 : Statement { $$ = $1; }
1065 | Declaration { $$ = $1; }
1069 /* 12.2 Declarations {{{ */
1071 : Identifier { $$ = $1; }
1078 // XXX: BindingPattern
1080 /* 12.2.1 Let and Const Declarations {{{ */
1082 : LetOrConst VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1090 /* 12.2.2 Variable Statement {{{ */
1092 : Var_ VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1095 VariableDeclarationList_
1096 : "," VariableDeclarationList { $$ = $2; }
1100 VariableDeclarationList
1101 : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
1105 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1106 // XXX: | BindingPattern Initialiser { $$ = CYNew CYDeclaration($1, $2); }
1110 : "=" AssignmentExpression { $$ = $2; }
1114 : Initialiser { $$ = $1; }
1118 /* 12.2.4 Destructuring Binding Patterns {{{ */
1122 : SingleNameBinding { $$ = $1; }
1126 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1130 /* 12.3 Empty Statement {{{ */
1132 : ";" { $$ = CYNew CYEmpty(); }
1135 /* 12.4 Expression Statement {{{ */
1137 : Expression Terminator { $$ = CYNew CYExpress($1); }
1140 /* 12.5 The if Statement {{{ */
1142 : "else" Statement { $$ = $2; }
1143 | %prec "if" { $$ = NULL; }
1147 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = CYNew CYIf($3, $5, $6); }
1151 /* 12.6.1 The do-while Statement {{{ */
1153 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = CYNew CYDoWhile($5, $2); }
1156 /* 12.6.2 The while Statement {{{ */
1158 : "while" "(" Expression ")" Statement { $$ = CYNew CYWhile($3, $5); }
1161 /* 12.6.3 The for Statement {{{ */
1163 : "for" "(" LexPushInOn ForStatementInitialiser LexPopIn ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = CYNew CYFor($4, $7, $9, $11); }
1166 ForStatementInitialiser
1167 : ExpressionOpt { $$ = $1; }
1168 | LexSetRegExp Var_ VariableDeclarationList { $$ = CYNew CYForDeclarations($3); }
1171 /* 12.6.4 The for-in and for-of Statements {{{ */
1173 : "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForIn($4, $7, $9); }
1174 | "for" "(" LexPushInOn ForInStatementInitialiser LexPopIn "of" Expression ")" Statement { $$ = CYNew CYForOf($4, $7, $9); }
1177 ForInStatementInitialiser
1178 : LeftHandSideExpression { $$ = $1; }
1179 | LexSetRegExp Var_ VariableDeclaration { $$ = $3; }
1183 /* 12.7 The continue Statement {{{ */
1185 : "continue" "\n" StrictSemi { $$ = CYNew CYContinue(NULL); }
1186 | "continue" IdentifierOpt Terminator { $$ = CYNew CYContinue($2); }
1189 /* 12.8 The break Statement {{{ */
1191 : "break" "\n" StrictSemi { $$ = CYNew CYBreak(NULL); }
1192 | "break" IdentifierOpt Terminator { $$ = CYNew CYBreak($2); }
1195 /* 12.9 The return Statement {{{ */
1197 : "return" "\n" StrictSemi { $$ = CYNew CYReturn(NULL); }
1198 | "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); }
1201 /* 12.10 The with Statement {{{ */
1203 : "with" "(" Expression ")" Statement { $$ = CYNew CYWith($3, $5); }
1207 /* 12.11 The switch Statement {{{ */
1209 : "switch" "(" Expression ")" CaseBlock { $$ = CYNew CYSwitch($3, $5); }
1213 : BRACE CaseClausesOpt "}" { $$ = $2; }
1217 : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
1221 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1222 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1227 : "default" ":" StatementListOpt { $$ = CYNew CYClause(NULL, $3); }
1230 /* 12.12 Labelled Statements {{{ */
1232 : Identifier ":" Statement { $$ = CYNew CYLabel($1, $3); }
1235 /* 12.13 The throw Statement {{{ */
1237 : "throw" "\n" StrictSemi { YYABORT; }
1238 | "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); }
1241 /* 12.14 The try Statement {{{ */
1243 : "try" Block_ CatchOpt FinallyOpt { $$ = CYNew cy::Syntax::Try($2, $3, $4); }
1247 : "catch" "(" Identifier ")" Block_ { $$ = CYNew cy::Syntax::Catch($3, $5); }
1252 : "finally" Block_ { $$ = CYNew CYFinally($2); }
1256 /* 12.14 The debugger Statement {{{ */
1258 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1262 /* 13.1 Function Definitions {{{ */
1264 : ";function" Identifier "(" FormalParameterListOpt ")" BRACE FunctionBody "}" { $$ = CYNew CYFunctionStatement($2, $4, $7); }
1268 : "function" IdentifierOpt "(" LexPushInOff FormalParameterListOpt LexPopIn ")" BRACE LexPushInOff FunctionBody LexPopIn "}" { $$ = CYNew CYFunctionExpression($2, $5, $10); }
1271 FormalParameterList_
1272 : "," FormalParameterList { $$ = $2; }
1277 // XXX: : FunctionRestParameter { $$ = $1; }
1278 : FormalParameter FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
1281 FormalParameterListOpt
1282 : FormalParameterList
1286 /* XXX: FunctionRestParameter
1287 : "..." BindingIdentifier { $$ = CYNew CYFunctionRestParameter($2); }
1291 : BindingElement { $$ = $1; }
1295 : StatementListOpt { $$ = $1; }
1298 /* 13.2 Arrow Function Definitions {{{ */
1300 : LexSetRegExp ArrowParameters "=>" LexNoBrace ConciseBody { $$ = CYNew CYFatArrow($2, $5); }
1304 : BindingIdentifier { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1)); }
1305 //| ParentheticalOpt { $$ = $1; }
1309 : AssignmentExpression { $$ = CYNew CYReturn($1); }
1310 | ";{" LexPushInOff FunctionBody LexPopIn "}" { $$ = $3; }
1313 /* 14 Program {{{ */
1315 : ProgramBodyOpt { driver.program_ = CYNew CYProgram($1); }
1319 : StatementList { $$ = $1; }
1323 : ProgramBody { $$ = $1; }
1324 | LexSetStatement LexSetRegExp { $$ = NULL; }
1329 /* Cycript (Objective-C): @class Declaration {{{ */
1331 /* XXX: why the hell did I choose MemberExpression? */
1332 : ":" LexSetRegExp MemberExpression { $$ = $3; }
1337 : Expression Identifier ";" ClassFieldListOpt { $$ = CYNew CYField($1, $2, $4); }
1342 : BRACE ClassFieldListOpt "}" { $$ = $2; }
1346 : "+" { $$ = false; }
1347 | "-" { $$ = true; }
1351 : "(" Expression ")" { $$ = $2; }
1352 | "(" LexSetRegExp "void" ")" { $$ = CYNew CYString("v"); }
1357 : Word ":" TypeOpt Identifier { $$ = CYNew CYMessageParameter($1, $3, $4); }
1360 MessageParameterList
1361 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1364 MessageParameterListOpt
1365 : MessageParameterList { $$ = $1; }
1370 : MessageParameterList { $$ = $1; }
1371 | Word { $$ = CYNew CYMessageParameter($1, NULL, NULL); }
1374 ClassMessageDeclaration
1375 : MessageScope TypeOpt MessageParameters BRACE FunctionBody "}" { $$ = CYNew CYMessage($1, $2, $3, $5); }
1378 ClassMessageDeclarationListOpt
1379 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1380 | ClassMessageDeclarationListOpt Comment { $$ = $1; }
1385 : Identifier { $$ = $1; }
1386 | "(" AssignmentExpression ")" { $$ = $2; }
1390 : ClassName { $$ = $1; }
1394 // XXX: this should be AssignmentExpressionNoRight
1396 : ShiftExpression ClassProtocolsOpt { $$ = CYNew CYProtocol($1, $2); }
1400 : "," ClassProtocols { $$ = $2; }
1404 ClassProtocolListOpt
1405 : "<" ClassProtocols ">" { $$ = $2; }
1410 : "@implementation" LexPushInOff ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFields ClassMessageDeclarationListOpt LexPopIn "@end" { $$ = CYNew CYClassExpression($3, $4, $5, $6, $7); }
1414 : ";@implementation" ClassName ClassSuperOpt ClassProtocolListOpt ClassFields ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYClassStatement($2, $3, $4, $5, $6); }
1422 : ";@implementation" ClassName CategoryName ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYCategory($2, $4); }
1426 : ClassExpression { $$ = $1; }
1430 : ClassStatement { $$ = $1; }
1431 | CategoryStatement { $$ = $1; }
1434 /* Cycript (Objective-C): Send Message {{{ */
1436 : "," AssignmentExpression VariadicCall { $$ = CYNew CYArgument(NULL, $2, $3); }
1441 : WordOpt { driver.contexts_.back().words_.push_back($1); } { $$ = $1; }
1442 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
1446 : SelectorCall { $$ = $1; }
1447 | VariadicCall { $$ = $1; }
1451 : SelectorWordOpt ":" AssignmentExpression SelectorCall_ { $$ = CYNew CYArgument($1 ?: CYNew CYBlank(), $3, $4); }
1455 : SelectorCall { $$ = $1; }
1456 | Word { $$ = CYNew CYArgument($1, NULL); }
1460 : "[" LexPushInOff AssignmentExpression { driver.contexts_.push_back($3); } SelectorList LexPopIn "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
1461 | "[" LexPushInOff LexSetRegExp "super" { driver.context_ = NULL; } SelectorList LexPopIn "]" { $$ = CYNew CYSendSuper($6); }
1465 : WordOpt ":" SelectorExpressionOpt { $$ = CYNew CYSelectorPart($1, true, $3); }
1469 : SelectorExpression_ { $$ = $1; }
1470 | Word { $$ = CYNew CYSelectorPart($1, false, NULL); }
1473 SelectorExpressionOpt
1474 : SelectorExpression_ { $$ = $1; }
1479 : MessageExpression { $$ = $1; }
1480 | "@selector" "(" LexPushInOff SelectorExpression LexPopIn ")" { $$ = CYNew CYSelector($4); }
1483 /* Cycript (Objective-C): @import Directive {{{ */
1497 : LexSetStatement LexSetRegExp "@import" ImportPath { $$ = CYNew CYImport(); }
1500 /* Cycript (Objective-C): Boxed Expressions {{{ */
1502 : NullLiteral { $$ = $1; }
1503 | BooleanLiteral { $$ = $1; }
1504 | NumericLiteral { $$ = $1; }
1505 | StringLiteral { $$ = $1; }
1506 | ArrayLiteral { $$ = $1; }
1507 | ObjectLiteral { $$ = $1; }
1508 | Parenthetical { $$ = $1; }
1512 : "@" BoxableExpression { $$ = CYNew CYBox($2); }
1518 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1519 LeftHandSideExpression
1520 : LexSetRegExp "*" UnaryExpression { $$ = CYNew CYIndirect($3); }
1524 : "&" UnaryExpression { $$ = CYNew CYAddressOf($2); }
1528 : "->" "[" Expression "]" { $$ = CYNew CYIndirectMember(NULL, $3); }
1529 | "->" IdentifierName { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); }
1530 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
1533 /* Cycript (C): auto Compatibility {{{ */
1540 /* YUI: Documentation Comments {{{ */
1542 : Comment { $$ = $1; }
1547 /* Lexer State {{{ */
1549 : { driver.PushCondition(CYDriver::RegExpCondition); }
1553 : { driver.PushCondition(CYDriver::XMLContentCondition); }
1557 : { driver.PushCondition(CYDriver::XMLTagCondition); }
1561 : { driver.PopCondition(); }
1565 : { driver.SetCondition(CYDriver::XMLContentCondition); }
1569 : { driver.SetCondition(CYDriver::XMLTagCondition); }
1572 /* Virtual Tokens {{{ */
1579 /* 8.1 Context Keywords {{{ */
1581 : "namespace" { $$ = $1; }
1582 | "xml" { $$ = $1; }
1585 /* 8.3 XML Initialiser Input Elements {{{ */
1587 : XMLComment { $$ = $1; }
1588 | XMLCDATA { $$ = $1; }
1589 | XMLPI { $$ = $1; }
1593 /* 11.1 Primary Expressions {{{ */
1595 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
1596 | XMLInitialiser { $$ = $1; }
1597 | XMLListInitialiser { $$ = $1; }
1601 : AttributeIdentifier { $$ = $1; }
1602 | QualifiedIdentifier { $$ = $1; }
1603 | WildcardIdentifier { $$ = $1; }
1606 /* 11.1.1 Attribute Identifiers {{{ */
1608 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
1612 : PropertySelector { $$ = $1; }
1613 | "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYSelector($3); }
1617 : Identifier { $$ = CYNew CYSelector($1); }
1618 | WildcardIdentifier { $$ = $1; }
1621 /* 11.1.2 Qualified Identifiers {{{ */
1622 QualifiedIdentifier_
1623 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
1624 | QualifiedIdentifier { $$ = $1; }
1628 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
1631 /* 11.1.3 Wildcard Identifiers {{{ */
1633 : "*" { $$ = CYNew CYWildcard(); }
1636 /* 11.1.4 XML Initialiser {{{ */
1638 : XMLMarkup { $$ = $1; }
1639 | XMLElement { $$ = $1; }
1643 : "<" LexPushInOff XMLTagContent LexPop LexPopIn "/>"
1644 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop LexPopIn ">"
1648 : LexPushXMLTag XMLTagName XMLAttributes
1652 : BRACE LexPushRegExp Expression LexPop "}"
1661 : XMLAttributes_ XMLAttribute
1666 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
1667 | XMLAttributes_ XMLWhitespaceOpt
1676 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
1680 : XMLExpression XMLElementContentOpt
1681 | XMLMarkup XMLElementContentOpt
1682 | XMLText XMLElementContentOpt
1683 | XMLElement XMLElementContentOpt
1686 XMLElementContentOpt
1691 /* 11.1.5 XMLList Initialiser {{{ */
1693 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop LexPopIn "</>" { $$ = CYNew CYXMLList($4); }
1697 /* 11.2 Left-Hand-Side Expressions {{{ */
1699 : Identifier { $$ = $1; }
1700 | PropertyIdentifier { $$ = $1; }
1704 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
1705 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
1706 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
1709 /* 12.1 The default xml namespace Statement {{{ */
1710 /* XXX: DefaultXMLNamespaceStatement
1711 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
1715 : DefaultXMLNamespaceStatement { $$ = $1; }
1720 /* JavaScript 1.7: Array Comprehensions {{{ */
1722 : "if" "(" Expression ")" { $$ = CYNew CYIfComprehension($3); }
1726 : "for" "(" Identifier "in" Expression ")" { $$ = CYNew CYForInComprehension($3, $5); }
1727 | "for" "each" "(" Identifier "in" Expression ")" { $$ = CYNew CYForOfComprehension($4, $6); }
1731 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1734 ComprehensionListOpt
1735 : ComprehensionList { $$ = $1; }
1736 | IfComprehension { $$ = $1; }
1741 : "[" LexPushInOff AssignmentExpression ComprehensionList LexPopIn "]" { $$ = CYNew CYArrayComprehension($3, $4); }
1744 /* JavaScript 1.7: for each {{{ */
1746 : "for" "each" "(" LexPushInOn ForInStatementInitialiser LexPopIn "!in" Expression ")" Statement { $$ = CYNew CYForOf($5, $8, $10); }
1749 /* JavaScript 1.7: let Statements {{{ */
1751 : "let" "(" VariableDeclarationList ")" Statement { $$ = CYNew CYLetStatement($3, $5); }
1759 /* JavaScript FTW: Ruby Blocks {{{ */
1760 RubyProcParameterList_
1761 : "," RubyProcParameterList { $$ = $2; }
1765 RubyProcParameterList
1766 : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1), $2); }
1771 : "|" RubyProcParameterList "|" { $$ = $2; }
1772 | "||" { $$ = NULL; }
1775 RubyProcParametersOpt
1776 : RubyProcParameters
1781 : "{" RubyProcParametersOpt StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
1785 : "{" LexPushInOff RubyProcParameters StatementListOpt LexPopIn "}" { $$ = CYNew CYRubyProc($3, $4); }
1789 : CallExpression_ RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); }