1 /* Cycript - Inlining/Optimizing JavaScript Compiler
2 * Copyright (C) 2009 Jay Freeman (saurik)
5 /* Modified BSD License {{{ */
7 * Redistribution and use in source and binary
8 * forms, with or without modification, are permitted
9 * provided that the following conditions are met:
11 * 1. Redistributions of source code must retain the
12 * above copyright notice, this list of conditions
13 * and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the
15 * above copyright notice, this list of conditions
16 * and the following disclaimer in the documentation
17 * and/or other materials provided with the
19 * 3. The name of the author may not be used to endorse
20 * or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
25 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
34 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 #include "Cycript.tab.hh"
42 #define scanner driver.scanner_
43 #define YYSTACKEXPANDABLE 1
50 #include "ObjectiveC/Syntax.hpp"
54 #include "E4X/Syntax.hpp"
63 CYDriver::Condition condition_;
65 CYArgument *argument_;
66 CYAssignment *assignment_;
69 cy::Syntax::Catch *catch_;
70 CYComprehension *comprehension_;
71 CYCompound *compound_;
72 CYDeclaration *declaration_;
73 CYDeclarations *declarations_;
75 CYExpression *expression_;
78 CYForInitialiser *for_;
79 CYForInInitialiser *forin_;
80 CYFunctionParameter *functionParameter_;
81 CYIdentifier *identifier_;
88 CYProperty *property_;
89 CYPropertyName *propertyName_;
90 CYStatement *statement_;
97 CYClassName *className_;
100 CYMessageParameter *messageParameter_;
101 CYSelectorPart *selector_;
105 CYAttribute *attribute_;
106 CYPropertyIdentifier *propertyIdentifier_;
107 CYSelector *selector_;
115 int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner);
124 @$.begin.filename = @$.end.filename = &driver.filename_;
134 %parse-param { CYDriver &driver }
135 %lex-param { void *scanner }
142 %token XMLAttributeValue
144 %token XMLTagCharacters
150 %token LeftRight "<>"
151 %token LeftSlashRight "</>"
153 %token SlashRight "/>"
154 %token LeftSlash "</"
156 %token ColonColon "::"
157 %token PeriodPeriod ".."
160 @begin E4X ObjectiveC
165 %token AmpersandAmpersand "&&"
166 %token AmpersandEqual "&="
168 %token CarrotEqual "^="
170 %token EqualEqual "=="
171 %token EqualEqualEqual "==="
172 %token Exclamation "!"
173 %token ExclamationEqual "!="
174 %token ExclamationEqualEqual "!=="
176 %token HyphenEqual "-="
177 %token HyphenHyphen "--"
178 %token HyphenHyphen_ "\n--"
179 %token HyphenRight "->"
181 %token LeftEqual "<="
183 %token LeftLeftEqual "<<="
185 %token PercentEqual "%="
188 %token PipeEqual "|="
191 %token PlusEqual "+="
193 %token PlusPlus_ "\n++"
195 %token RightEqual ">="
196 %token RightRight ">>"
197 %token RightRightEqual ">>="
198 %token RightRightRight ">>>"
199 %token RightRightRightEqual ">>>="
201 %token SlashEqual "/="
203 %token StarEqual "*="
213 %token CloseParen ")"
216 %token CloseBrace "}"
218 %token OpenBracket "["
219 %token CloseBracket "]"
221 %token AtClass "@class"
222 %token AtSelector "@selector"
225 %token <false_> False "false"
226 %token <null_> Null "null"
227 %token <true_> True "true"
229 // ES3/ES5/WIE/JSC Reserved
230 %token <word_> Break "break"
231 %token <word_> Case "case"
232 %token <word_> Catch "catch"
233 %token <word_> Continue "continue"
234 %token <word_> Default "default"
235 %token <word_> Delete "delete"
236 %token <word_> Do "do"
237 %token <word_> Else "else"
238 %token <word_> Finally "finally"
239 %token <word_> For "for"
240 %token <word_> Function "function"
241 %token <word_> If "if"
242 %token <word_> In "in"
243 %token <word_> InstanceOf "instanceof"
244 %token <word_> New "new"
245 %token <word_> Return "return"
246 %token <word_> Switch "switch"
247 %token <this_> This "this"
248 %token <word_> Throw "throw"
249 %token <word_> Try "try"
250 %token <word_> TypeOf "typeof"
251 %token <word_> Var "var"
252 %token <word_> Void "void"
253 %token <word_> While "while"
254 %token <word_> With "with"
256 // ES3/IE6 Future, ES5/JSC Reserved
257 %token <word_> Debugger "debugger"
259 // ES3/ES5/IE6 Future, JSC Reserved
260 %token <word_> Const "const"
262 // ES3/ES5/IE6/JSC Future
263 %token <word_> Class "class"
264 %token <word_> Enum "enum"
265 %token <word_> Export "export"
266 %token <word_> Extends "extends"
267 %token <word_> Import "import"
268 %token <word_> Super "super"
270 // ES3 Future, ES5 Strict Future
271 %token <identifier_> Implements "implements"
272 %token <identifier_> Interface "interface"
273 %token <identifier_> Package "package"
274 %token <identifier_> Private "private"
275 %token <identifier_> Protected "protected"
276 %token <identifier_> Public "public"
277 %token <identifier_> Static "static"
280 %token <identifier_> Abstract "abstract"
281 %token <identifier_> Boolean "boolean"
282 %token <identifier_> Byte "byte"
283 %token <identifier_> Char "char"
284 %token <identifier_> Double "double"
285 %token <identifier_> Final "final"
286 %token <identifier_> Float "float"
287 %token <identifier_> Goto "goto"
288 %token <identifier_> Int "int"
289 %token <identifier_> Long "long"
290 %token <identifier_> Native "native"
291 %token <identifier_> Short "short"
292 %token <identifier_> Synchronized "synchronized"
293 %token <identifier_> Throws "throws"
294 %token <identifier_> Transient "transient"
295 %token <identifier_> Volatile "volatile"
298 %token <identifier_> Let "let"
299 %token <identifier_> Yield "yield"
302 %token <identifier_> Each "each"
306 %token <identifier_> Namespace "namespace"
307 %token <identifier_> XML "xml"
311 %type <expression_> AdditiveExpressionNoWC
312 %type <expression_> AssigneeExpressionNoWC
313 %type <expression_> AssignmentExpressionNoWC
314 %type <expression_> BitwiseANDExpressionNoWC
315 %type <expression_> BitwiseXORExpressionNoWC
316 %type <expression_> BitwiseORExpressionNoWC
317 %type <expression_> ConditionalExpressionNoWC
318 %type <expression_> EqualityExpressionNoWC
319 %type <expression_> LeftHandSideExpressionNoWC
320 %type <expression_> LogicalANDExpressionNoWC
321 %type <expression_> LogicalORExpressionNoWC
322 %type <expression_> MemberExpressionNoWC
323 %type <expression_> MultiplicativeExpressionNoWC
324 %type <expression_> NewExpressionNoWC
325 %type <expression_> PostfixExpressionNoWC
326 %type <expression_> RelationalExpressionNoWC
327 %type <expression_> ShiftExpressionNoWC
328 %type <expression_> UnaryExpressionNoWC
331 %token <identifier_> Identifier_
332 %token <number_> NumericLiteral
333 %token <string_> StringLiteral
334 %token <literal_> RegularExpressionLiteral
336 %type <expression_> AdditiveExpression
337 %type <expression_> AdditiveExpressionNoBF
338 %type <argument_> ArgumentList
339 %type <argument_> ArgumentList_
340 %type <argument_> ArgumentListOpt
341 %type <argument_> Arguments
342 %type <literal_> ArrayLiteral
343 %type <expression_> AssigneeExpression
344 %type <expression_> AssigneeExpressionNoBF
345 %type <expression_> AssigneeExpressionNoRE
346 %type <expression_> AssignmentExpression
347 %type <assignment_> AssignmentExpression_
348 %type <expression_> AssignmentExpressionNoBF
349 %type <expression_> AssignmentExpressionNoIn
350 %type <expression_> BitwiseANDExpression
351 %type <expression_> BitwiseANDExpressionNoBF
352 %type <expression_> BitwiseANDExpressionNoIn
353 %type <statement_> Block
354 %type <statement_> Block_
355 %type <boolean_> BooleanLiteral
356 %type <expression_> BitwiseORExpression
357 %type <expression_> BitwiseORExpressionNoBF
358 %type <expression_> BitwiseORExpressionNoIn
359 %type <expression_> BitwiseXORExpression
360 %type <expression_> BitwiseXORExpressionNoBF
361 %type <expression_> BitwiseXORExpressionNoIn
362 %type <statement_> BreakStatement
363 %type <expression_> CallExpression
364 %type <expression_> CallExpressionNoBF
365 %type <expression_> CallExpressionNoRE
366 %type <clause_> CaseBlock
367 %type <clause_> CaseClause
368 %type <clause_> CaseClausesOpt
369 %type <catch_> CatchOpt
370 %type <comprehension_> ComprehensionList
371 %type <comprehension_> ComprehensionListOpt
372 %type <expression_> ConditionalExpression
373 %type <expression_> ConditionalExpressionNoBF
374 %type <expression_> ConditionalExpressionNoIn
375 %type <statement_> ContinueStatement
376 %type <clause_> DefaultClause
377 %type <statement_> DoWhileStatement
378 %type <expression_> Element
379 %type <expression_> ElementOpt
380 %type <element_> ElementList
381 %type <element_> ElementListOpt
382 %type <statement_> ElseStatementOpt
383 %type <statement_> EmptyStatement
384 %type <expression_> EqualityExpression
385 %type <expression_> EqualityExpressionNoBF
386 %type <expression_> EqualityExpressionNoIn
387 %type <expression_> Expression
388 %type <expression_> ExpressionOpt
389 %type <compound_> Expression_
390 %type <expression_> ExpressionNoBF
391 %type <expression_> ExpressionNoIn
392 %type <compound_> ExpressionNoIn_
393 %type <expression_> ExpressionNoInOpt
394 %type <statement_> ExpressionStatement
395 %type <finally_> FinallyOpt
396 %type <comprehension_> ForComprehension
397 %type <statement_> ForStatement
398 %type <for_> ForStatementInitialiser
399 %type <statement_> ForInStatement
400 %type <forin_> ForInStatementInitialiser
401 %type <functionParameter_> FormalParameterList
402 %type <functionParameter_> FormalParameterList_
403 %type <statement_> FunctionBody
404 %type <statement_> FunctionDeclaration
405 %type <expression_> FunctionExpression
406 %type <identifier_> Identifier
407 %type <identifier_> IdentifierOpt
408 %type <comprehension_> IfComprehension
409 %type <statement_> IfStatement
410 %type <expression_> Initialiser
411 %type <expression_> InitialiserOpt
412 %type <expression_> InitialiserNoIn
413 %type <expression_> InitialiserNoInOpt
414 %type <statement_> IterationStatement
415 %type <statement_> LabelledStatement
416 %type <expression_> LeftHandSideExpression
417 %type <expression_> LeftHandSideExpressionNoBF
418 %type <expression_> LeftHandSideExpressionNoRE
419 //%type <statement_> LetStatement
420 %type <literal_> Literal
421 %type <literal_> LiteralNoRE
422 %type <literal_> LiteralRE
423 %type <expression_> LogicalANDExpression
424 %type <expression_> LogicalANDExpressionNoBF
425 %type <expression_> LogicalANDExpressionNoIn
426 %type <expression_> LogicalORExpression
427 %type <expression_> LogicalORExpressionNoBF
428 %type <expression_> LogicalORExpressionNoIn
429 %type <member_> MemberAccess
430 %type <expression_> MemberExpression
431 %type <expression_> MemberExpression_
432 %type <expression_> MemberExpressionNoBF
433 %type <expression_> MemberExpressionNoRE
434 %type <expression_> MultiplicativeExpression
435 %type <expression_> MultiplicativeExpressionNoBF
436 %type <expression_> NewExpression
437 %type <expression_> NewExpression_
438 %type <expression_> NewExpressionNoBF
439 %type <expression_> NewExpressionNoRE
440 %type <null_> NullLiteral
441 %type <literal_> ObjectLiteral
442 %type <expression_> PostfixExpression
443 %type <expression_> PostfixExpressionNoBF
444 %type <expression_> PostfixExpressionNoRE
445 %type <expression_> PrimaryExpression
446 %type <expression_> PrimaryExpressionNo
447 %type <expression_> PrimaryExpressionNoBF
448 %type <expression_> PrimaryExpressionNoRE
449 %type <expression_> PrimaryExpressionNoWC
450 %type <expression_> PrimaryExpressionNoWC_
452 %type <expression_> PrimaryExpressionWC
454 %type <expression_> PrimaryExpressionBF
455 %type <statement_> Program
456 %type <propertyName_> PropertyName
457 %type <propertyName_> PropertyName_
458 %type <property_> PropertyNameAndValueList
459 %type <property_> PropertyNameAndValueList_
460 %type <property_> PropertyNameAndValueListOpt
461 %type <expression_> RelationalExpression
462 %type <infix_> RelationalExpression_
463 %type <expression_> RelationalExpressionNoBF
464 %type <expression_> RelationalExpressionNoIn
465 %type <infix_> RelationalExpressionNoIn_
466 %type <statement_> ReturnStatement
467 %type <expression_> ShiftExpression
468 %type <expression_> ShiftExpressionNoBF
469 %type <statement_> SourceElement
470 %type <statement_> SourceElement_
471 %type <statement_> SourceElements
472 %type <statement_> Statement
473 %type <statement_> Statement_
474 %type <statement_> StatementList
475 %type <statement_> StatementListOpt
476 %type <statement_> SwitchStatement
477 %type <statement_> ThrowStatement
478 %type <statement_> TryStatement
479 %type <expression_> UnaryAssigneeExpression
480 %type <expression_> UnaryExpression
481 %type <expression_> UnaryExpression_
482 %type <expression_> UnaryExpressionNoBF
483 %type <expression_> UnaryExpressionNoRE
484 %type <declaration_> VariableDeclaration
485 %type <declaration_> VariableDeclarationNoIn
486 %type <declarations_> VariableDeclarationList
487 %type <declarations_> VariableDeclarationList_
488 %type <declarations_> VariableDeclarationListNoIn
489 %type <declarations_> VariableDeclarationListNoIn_
490 %type <statement_> VariableStatement
491 %type <statement_> WhileStatement
492 %type <statement_> WithStatement
495 %type <statement_> CategoryStatement
496 %type <expression_> ClassExpression
497 %type <statement_> ClassStatement
498 %type <expression_> ClassSuperOpt
499 %type <field_> ClassFieldList
500 %type <message_> ClassMessageDeclaration
501 %type <message_> ClassMessageDeclarationListOpt
502 %type <className_> ClassName
503 %type <className_> ClassNameOpt
504 %type <expression_> MessageExpression
505 %type <messageParameter_> MessageParameter
506 %type <messageParameter_> MessageParameters
507 %type <messageParameter_> MessageParameterList
508 %type <messageParameter_> MessageParameterListOpt
509 %type <bool_> MessageScope
510 %type <argument_> SelectorCall
511 %type <argument_> SelectorCall_
512 %type <selector_> SelectorExpression
513 %type <selector_> SelectorExpression_
514 %type <selector_> SelectorExpressionOpt
515 %type <argument_> SelectorList
516 %type <expression_> TypeOpt
517 %type <argument_> VariadicCall
519 %type <word_> WordOpt
523 %type <propertyIdentifier_> PropertyIdentifier_
524 %type <selector_> PropertySelector
525 %type <selector_> PropertySelector_
526 %type <identifier_> QualifiedIdentifier
527 %type <identifier_> QualifiedIdentifier_
528 %type <identifier_> WildcardIdentifier
529 %type <identifier_> XMLComment
530 %type <identifier_> XMLCDATA
531 %type <identifier_> XMLElement
532 %type <identifier_> XMLElementContent
533 %type <identifier_> XMLMarkup
534 %type <identifier_> XMLPI
536 %type <attribute_> AttributeIdentifier
537 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
538 %type <expression_> PropertyIdentifier
539 %type <expression_> XMLListInitialiser
540 %type <expression_> XMLInitialiser
545 %nonassoc Identifier_ "abstract" "boolean" "break" "byte" "case" "catch" "char" "class" "const" "continue" "debugger" "default" "delete" "do" "double" "each" "enum" "export" "extends" "false" "final" "finally" "float" /*"for"*/ "function" "goto" "implements" "import" /*"in"*/ /*"instanceof"*/ "int" "interface" "let" "long" "namespace" "native" "new" "null" "package" "private" "protected" "public" "return" "short" "super" "static" "switch" "synchronized" "this" "throw" "throws" "transient" "true" "try" "typeof" "var" "void" "volatile" "while" "with" "xml" "yield"
555 %left "<<" ">>" ">>>"
556 %left "<" ">" "<=" ">=" "instanceof" "in"
557 %left "==" "!=" "===" "!=="
564 %right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
570 /* Lexer State {{{ */
572 : { driver.SetCondition(CYDriver::RegExpCondition); }
577 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
587 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
592 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
612 : Identifier { $$ = $1; }
613 | "break" NewLineOpt { $$ = $1; }
614 | "case" { $$ = $1; }
615 | "catch" { $$ = $1; }
616 | "class" { $$ = $1; }
617 | "const" { $$ = $1; }
618 | "continue" NewLineOpt { $$ = $1; }
619 | "debugger" { $$ = $1; }
620 | "default" { $$ = $1; }
621 | "delete" { $$ = $1; }
623 | "else" { $$ = $1; }
624 | "enum" { $$ = $1; }
625 | "export" { $$ = $1; }
626 | "extends" { $$ = $1; }
627 | "false" { $$ = $1; }
628 | "finally" { $$ = $1; }
629 /* XXX: | "for" { $$ = $1; } */
630 | "function" { $$ = $1; }
632 | "import" { $$ = $1; }
633 /* XXX: | "in" { $$ = $1; } */
634 /* XXX: | "instanceof" { $$ = $1; } */
636 | "null" { $$ = $1; }
637 | "return" NewLineOpt { $$ = $1; }
638 | "super" { $$ = $1; }
639 | "switch" { $$ = $1; }
640 | "this" { $$ = $1; }
641 | "throw" NewLineOpt { $$ = $1; }
642 | "true" { $$ = $1; }
644 | "typeof" { $$ = $1; }
646 | "void" { $$ = $1; }
647 | "while" { $$ = $1; }
648 | "with" { $$ = $1; }
653 : Identifier_ { $$ = $1; }
655 | "implements" { $$ = $1; }
656 | "interface" { $$ = $1; }
657 | "package" { $$ = $1; }
658 | "private" { $$ = $1; }
659 | "protected" { $$ = $1; }
660 | "public" { $$ = $1; }
661 | "static" { $$ = $1; }
663 | "abstract" { $$ = $1; }
664 | "boolean" { $$ = $1; }
665 | "byte" { $$ = $1; }
666 | "char" { $$ = $1; }
667 | "double" { $$ = $1; }
668 | "final" { $$ = $1; }
669 | "float" { $$ = $1; }
670 | "goto" { $$ = $1; }
672 | "long" { $$ = $1; }
673 | "native" { $$ = $1; }
674 | "short" { $$ = $1; }
675 | "synchronized" { $$ = $1; }
676 | "throws" { $$ = $1; }
677 | "transient" { $$ = $1; }
678 | "volatile" { $$ = $1; }
681 | "yield" { $$ = $1; }
683 | "each" { $$ = $1; }
687 : Identifier { $$ = $1; }
692 : NullLiteral { $$ = $1; }
693 | BooleanLiteral { $$ = $1; }
694 | NumericLiteral { $$ = $1; }
695 | StringLiteral { $$ = $1; }
696 | "@" StringLiteral { $$ = $2; }
700 : RegularExpressionLiteral { $$ = $1; }
704 : LiteralNoRE { $$ = $1; }
705 | LiteralRE { $$ = $1; }
709 : "null" { $$ = $1; }
713 : "true" { $$ = $1; }
714 | "false" { $$ = $1; }
717 /* 11.1 Primary Expressions {{{ */
719 : PrimaryExpressionNoWC { $$ = $1; }
721 | LexSetRegExp PrimaryExpressionWC { $$ = $2; }
725 PrimaryExpressionNoBF
726 : PrimaryExpressionNo { $$ = $1; }
728 | PrimaryExpressionWC { $$ = $1; }
732 PrimaryExpressionNoRE
733 : PrimaryExpressionNoWC_ { $$ = $1; }
735 | PrimaryExpressionWC { $$ = $1; }
739 PrimaryExpressionNoWC_
740 : PrimaryExpressionBF { $$ = $1; }
741 | PrimaryExpressionNo { $$ = $1; }
744 PrimaryExpressionNoWC
745 : LexSetRegExp PrimaryExpressionNoWC_ { $$ = $2; }
749 : "this" { $$ = $1; }
750 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
751 | Literal { $$ = $1; }
752 | ArrayLiteral { $$ = $1; }
753 | "(" Expression ")" { $$ = $2; }
757 : ObjectLiteral { $$ = $1; }
760 /* 11.1.4 Array Initialiser {{{ */
762 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
766 : AssignmentExpression { $$ = $1; }
770 : Element { $$ = $1; }
771 | LexSetRegExp { $$ = NULL; }
775 : ElementList { $$ = $1; }
776 | LexSetRegExp { $$ = NULL; }
780 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
781 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
784 /* 11.1.5 Object Initialiser {{{ */
786 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
789 PropertyNameAndValueList_
790 : "," PropertyNameAndValueList { $$ = $2; }
794 PropertyNameAndValueListOpt
795 : PropertyNameAndValueList { $$ = $1; }
799 PropertyNameAndValueList
800 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
804 : Identifier { $$ = $1; }
805 | StringLiteral { $$ = $1; }
806 | NumericLiteral { $$ = $1; }
810 : LexSetRegExp PropertyName_ { $$ = $2; }
814 /* 11.2 Left-Hand-Side Expressions {{{ */
816 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
820 : "[" Expression "]" { $$ = new(driver.pool_) CYDirectMember(NULL, $2); }
821 | "." Identifier { $$ = new(driver.pool_) CYDirectMember(NULL, new(driver.pool_) CYString($2)); }
825 : PrimaryExpression { $$ = $1; }
826 | LexSetRegExp FunctionExpression { $$ = $2; }
827 | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
828 | LexSetRegExp MemberExpression_ { $$ = $2; }
832 : PrimaryExpressionNoBF { $$ = $1; }
833 | MemberExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
834 | MemberExpression_ { $$ = $1; }
838 : PrimaryExpressionNoRE { $$ = $1; }
839 | FunctionExpression { $$ = $1; }
840 | MemberExpressionNoRE MemberAccess { $2->SetLeft($1); $$ = $2; }
841 | MemberExpression_ { $$ = $1; }
846 : PrimaryExpression { $$ = $1; }
847 | LexSetRegExp FunctionExpression { $$ = $2; }
848 | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
849 | LexSetRegExp MemberExpression_ { $$ = $2; }
854 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
858 : MemberExpression { $$ = $1; }
859 | LexSetRegExp NewExpression_ { $$ = $2; }
863 : MemberExpressionNoBF { $$ = $1; }
864 | NewExpression_ { $$ = $1; }
868 : MemberExpressionNoRE { $$ = $1; }
869 | NewExpression_ { $$ = $1; }
874 : MemberExpressionNoWC { $$ = $1; }
875 | LexSetRegExp NewExpression_ { $$ = $2; }
880 : PrimaryExpressionNoWC Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
881 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
882 | CallExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
886 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
887 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
888 | CallExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
892 : PrimaryExpressionNoRE Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
893 | CallExpressionNoRE Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
894 | CallExpressionNoRE MemberAccess { $2->SetLeft($1); $$ = $2; }
898 : "," ArgumentList { $$ = $2; }
903 : ArgumentList { $$ = $1; }
904 | LexSetRegExp { $$ = NULL; }
908 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
912 : "(" ArgumentListOpt ")" { $$ = $2; }
915 LeftHandSideExpression
916 : NewExpression { $$ = $1; }
917 | CallExpression { $$ = $1; }
920 LeftHandSideExpressionNoBF
921 : NewExpressionNoBF { $$ = $1; }
922 | CallExpressionNoBF { $$ = $1; }
925 LeftHandSideExpressionNoRE
926 : NewExpressionNoRE { $$ = $1; }
927 | CallExpressionNoRE { $$ = $1; }
931 LeftHandSideExpressionNoWC
932 : NewExpressionNoWC { $$ = $1; }
933 | CallExpression { $$ = $1; }
937 /* 11.3 Postfix Expressions {{{ */
939 : AssigneeExpression { $$ = $1; }
940 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
941 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
944 PostfixExpressionNoBF
945 : AssigneeExpressionNoBF { $$ = $1; }
946 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
947 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
950 PostfixExpressionNoRE
951 : AssigneeExpressionNoRE { $$ = $1; }
952 | LeftHandSideExpressionNoRE "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
953 | LeftHandSideExpressionNoRE "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
957 PostfixExpressionNoWC
958 : AssigneeExpressionNoWC { $$ = $1; }
959 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
960 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
964 /* 11.4 Unary Operators {{{ */
966 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
967 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
968 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
969 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
970 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
971 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
972 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
973 | "+" UnaryExpression { $$ = new(driver.pool_) CYAffirm($2); }
974 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
975 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
976 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
980 : PostfixExpression { $$ = $1; }
981 | LexSetRegExp UnaryExpression_ { $$ = $2; }
985 : PostfixExpressionNoBF { $$ = $1; }
986 | UnaryExpression_ { $$ = $1; }
990 : PostfixExpressionNoRE { $$ = $1; }
991 | UnaryExpression_ { $$ = $1; }
996 : PostfixExpressionNoWC { $$ = $1; }
997 | LexSetRegExp UnaryExpression_ { $$ = $2; }
1001 /* 11.5 Multiplicative Operators {{{ */
1002 MultiplicativeExpression
1003 : UnaryExpression { $$ = $1; }
1004 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
1005 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
1006 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
1009 MultiplicativeExpressionNoBF
1010 : UnaryExpressionNoBF { $$ = $1; }
1011 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
1012 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
1013 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
1017 MultiplicativeExpressionNoWC
1018 : UnaryExpressionNoWC { $$ = $1; }
1019 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
1020 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
1021 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
1025 /* 11.6 Additive Operators {{{ */
1027 : MultiplicativeExpression { $$ = $1; }
1028 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
1029 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
1032 AdditiveExpressionNoBF
1033 : MultiplicativeExpressionNoBF { $$ = $1; }
1034 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
1035 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
1039 AdditiveExpressionNoWC
1040 : MultiplicativeExpressionNoWC { $$ = $1; }
1041 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
1042 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
1046 /* 11.7 Bitwise Shift Operators {{{ */
1048 : AdditiveExpression { $$ = $1; }
1049 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
1050 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
1051 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
1055 : AdditiveExpressionNoBF { $$ = $1; }
1056 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
1057 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
1058 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
1063 : AdditiveExpressionNoWC { $$ = $1; }
1064 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
1065 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
1066 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
1070 /* 11.8 Relational Operators {{{ */
1071 RelationalExpressionNoIn_
1072 : "<" ShiftExpression { $$ = new(driver.pool_) CYLess(NULL, $2); }
1073 | ">" ShiftExpression { $$ = new(driver.pool_) CYGreater(NULL, $2); }
1074 | "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual(NULL, $2); }
1075 | ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual(NULL, $2); }
1076 | "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf(NULL, $2); }
1079 RelationalExpression_
1080 : RelationalExpressionNoIn_ { $$ = $1; }
1081 | "in" ShiftExpression { $$ = new(driver.pool_) CYIn(NULL, $2); }
1084 RelationalExpression
1085 : ShiftExpression { $$ = $1; }
1086 | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
1089 RelationalExpressionNoIn
1090 : ShiftExpression { $$ = $1; }
1091 | RelationalExpressionNoIn RelationalExpressionNoIn_ { $2->SetLeft($1); $$ = $2; }
1094 RelationalExpressionNoBF
1095 : ShiftExpressionNoBF { $$ = $1; }
1096 | RelationalExpressionNoBF RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
1100 RelationalExpressionNoWC
1101 : ShiftExpressionNoWC { $$ = $1; }
1102 | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
1106 /* 11.9 Equality Operators {{{ */
1108 : RelationalExpression { $$ = $1; }
1109 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
1110 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
1111 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
1112 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
1115 EqualityExpressionNoIn
1116 : RelationalExpressionNoIn { $$ = $1; }
1117 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
1118 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
1119 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
1120 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
1123 EqualityExpressionNoBF
1124 : RelationalExpressionNoBF { $$ = $1; }
1125 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
1126 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
1127 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
1128 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
1132 EqualityExpressionNoWC
1133 : RelationalExpressionNoWC { $$ = $1; }
1134 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
1135 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
1136 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
1137 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
1141 /* 11.10 Binary Bitwise Operators {{{ */
1142 BitwiseANDExpression
1143 : EqualityExpression { $$ = $1; }
1144 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
1147 BitwiseANDExpressionNoIn
1148 : EqualityExpressionNoIn { $$ = $1; }
1149 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
1152 BitwiseANDExpressionNoBF
1153 : EqualityExpressionNoBF { $$ = $1; }
1154 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
1158 BitwiseANDExpressionNoWC
1159 : EqualityExpressionNoWC { $$ = $1; }
1160 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
1164 BitwiseXORExpression
1165 : BitwiseANDExpression { $$ = $1; }
1166 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
1169 BitwiseXORExpressionNoIn
1170 : BitwiseANDExpressionNoIn { $$ = $1; }
1171 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
1174 BitwiseXORExpressionNoBF
1175 : BitwiseANDExpressionNoBF { $$ = $1; }
1176 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
1180 BitwiseXORExpressionNoWC
1181 : BitwiseANDExpressionNoWC { $$ = $1; }
1182 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
1187 : BitwiseXORExpression { $$ = $1; }
1188 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
1191 BitwiseORExpressionNoIn
1192 : BitwiseXORExpressionNoIn { $$ = $1; }
1193 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
1196 BitwiseORExpressionNoBF
1197 : BitwiseXORExpressionNoBF { $$ = $1; }
1198 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
1202 BitwiseORExpressionNoWC
1203 : BitwiseXORExpressionNoWC { $$ = $1; }
1204 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
1208 /* 11.11 Binary Logical Operators {{{ */
1209 LogicalANDExpression
1210 : BitwiseORExpression { $$ = $1; }
1211 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
1214 LogicalANDExpressionNoIn
1215 : BitwiseORExpressionNoIn { $$ = $1; }
1216 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
1219 LogicalANDExpressionNoBF
1220 : BitwiseORExpressionNoBF { $$ = $1; }
1221 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
1225 LogicalANDExpressionNoWC
1226 : BitwiseORExpressionNoWC { $$ = $1; }
1227 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
1232 : LogicalANDExpression { $$ = $1; }
1233 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
1236 LogicalORExpressionNoIn
1237 : LogicalANDExpressionNoIn { $$ = $1; }
1238 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
1241 LogicalORExpressionNoBF
1242 : LogicalANDExpressionNoBF { $$ = $1; }
1243 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
1247 LogicalORExpressionNoWC
1248 : LogicalANDExpressionNoWC { $$ = $1; }
1249 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
1253 /* 11.12 Conditional Operator ( ? : ) {{{ */
1254 ConditionalExpression
1255 : LogicalORExpression { $$ = $1; }
1256 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
1259 ConditionalExpressionNoIn
1260 : LogicalORExpressionNoIn { $$ = $1; }
1261 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
1264 ConditionalExpressionNoBF
1265 : LogicalORExpressionNoBF { $$ = $1; }
1266 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
1270 ConditionalExpressionNoWC
1271 : LogicalORExpressionNoWC { $$ = $1; }
1272 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
1276 /* 11.13 Assignment Operators {{{ */
1277 AssignmentExpression_
1278 : "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign(NULL, $2); }
1279 | "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign(NULL, $2); }
1280 | "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign(NULL, $2); }
1281 | "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign(NULL, $2); }
1282 | "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign(NULL, $2); }
1283 | "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign(NULL, $2); }
1284 | "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign(NULL, $2); }
1285 | ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign(NULL, $2); }
1286 | ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign(NULL, $2); }
1287 | "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign(NULL, $2); }
1288 | "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign(NULL, $2); }
1289 | "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign(NULL, $2); }
1293 : LeftHandSideExpression { $$ = $1; }
1294 | LexSetRegExp UnaryAssigneeExpression { $$ = $2; }
1297 AssigneeExpressionNoBF
1298 : LeftHandSideExpressionNoBF { $$ = $1; }
1299 | UnaryAssigneeExpression { $$ = $1; }
1302 AssigneeExpressionNoRE
1303 : LeftHandSideExpressionNoRE { $$ = $1; }
1304 | UnaryAssigneeExpression { $$ = $1; }
1308 AssigneeExpressionNoWC
1309 : LeftHandSideExpressionNoWC { $$ = $1; }
1310 | LexSetRegExp UnaryAssigneeExpression { $$ = $2; }
1314 AssignmentExpression
1315 : ConditionalExpression { $$ = $1; }
1316 | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1319 AssignmentExpressionNoIn
1320 : ConditionalExpressionNoIn { $$ = $1; }
1321 | AssigneeExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
1322 | AssigneeExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
1323 | AssigneeExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
1324 | AssigneeExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
1325 | AssigneeExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
1326 | AssigneeExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
1327 | AssigneeExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
1328 | AssigneeExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
1329 | AssigneeExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
1330 | AssigneeExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
1331 | AssigneeExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
1332 | AssigneeExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
1335 AssignmentExpressionNoBF
1336 : ConditionalExpressionNoBF { $$ = $1; }
1337 | AssigneeExpressionNoBF AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1341 AssignmentExpressionNoWC
1342 : ConditionalExpressionNoWC { $$ = $1; }
1343 | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1347 /* 11.14 Comma Operator {{{ */
1349 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
1354 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
1359 : Expression { $$ = $1; }
1360 | LexSetRegExp { $$ = NULL; }
1364 : ExpressionNoIn { $$ = $1; }
1365 | LexSetRegExp { $$ = NULL; }
1369 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1373 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1377 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1381 /* 12 Statements {{{ */
1383 : Block { $$ = $1; }
1384 | VariableStatement { $$ = $1; }
1385 | EmptyStatement { $$ = $1; }
1386 | ExpressionStatement { $$ = $1; }
1387 | IfStatement { $$ = $1; }
1388 | IterationStatement { $$ = $1; }
1389 | ContinueStatement { $$ = $1; }
1390 | BreakStatement { $$ = $1; }
1391 | ReturnStatement { $$ = $1; }
1392 | WithStatement { $$ = $1; }
1393 | LabelledStatement { $$ = $1; }
1394 | SwitchStatement { $$ = $1; }
1395 | ThrowStatement { $$ = $1; }
1396 | TryStatement { $$ = $1; }
1400 : LexSetRegExp Statement_ { $$ = $2; }
1403 /* 12.1 Block {{{ */
1405 : "{" StatementListOpt "}" { $$ = $2; }
1409 : Block_ { if ($1) $$ = new(driver.pool_) CYBlock($1); else $$ = new(driver.pool_) CYEmpty(); }
1413 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
1417 : StatementList { $$ = $1; }
1418 | LexSetRegExp { $$ = NULL; }
1421 /* 12.2 Variable Statement {{{ */
1423 : "var" VariableDeclarationList Terminator { $$ = new(driver.pool_) CYVar($2); }
1426 VariableDeclarationList_
1427 : "," VariableDeclarationList { $$ = $2; }
1431 VariableDeclarationListNoIn_
1432 : "," VariableDeclarationListNoIn { $$ = $2; }
1436 VariableDeclarationList
1437 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1440 VariableDeclarationListNoIn
1441 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1445 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1448 VariableDeclarationNoIn
1449 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1453 : Initialiser { $$ = $1; }
1458 : InitialiserNoIn { $$ = $1; }
1463 : "=" AssignmentExpression { $$ = $2; }
1467 : "=" AssignmentExpressionNoIn { $$ = $2; }
1470 /* 12.3 Empty Statement {{{ */
1472 : ";" { $$ = new(driver.pool_) CYEmpty(); }
1475 /* 12.4 Expression Statement {{{ */
1477 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
1480 /* 12.5 The if Statement {{{ */
1482 : "else" Statement { $$ = $2; }
1483 | %prec "if" { $$ = NULL; }
1487 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1491 /* 12.6 Iteration Statements {{{ */
1493 : DoWhileStatement { $$ = $1; }
1494 | WhileStatement { $$ = $1; }
1495 | ForStatement { $$ = $1; }
1496 | ForInStatement { $$ = $1; }
1499 /* 12.6.1 The do-while Statement {{{ */
1501 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1504 /* 12.6.2 The while Statement {{{ */
1506 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1509 /* 12.6.3 The for Statement {{{ */
1511 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1514 ForStatementInitialiser
1515 : ExpressionNoInOpt { $$ = $1; }
1516 | LexSetRegExp "var" VariableDeclarationListNoIn { $$ = $3; }
1519 /* 12.6.4 The for-in Statement {{{ */
1521 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1524 ForInStatementInitialiser
1525 : LeftHandSideExpression { $$ = $1; }
1526 | LexSetRegExp "var" VariableDeclarationNoIn { $$ = $3; }
1530 /* 12.7 The continue Statement {{{ */
1532 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1535 /* 12.8 The break Statement {{{ */
1537 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1540 /* 12.9 The return Statement {{{ */
1542 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1545 /* 12.10 The with Statement {{{ */
1547 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1551 /* 12.11 The switch Statement {{{ */
1553 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1557 : "{" CaseClausesOpt "}" { $$ = $2; }
1561 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1562 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1567 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1571 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1574 /* 12.12 Labelled Statements {{{ */
1576 : Identifier ":" Statement { $$ = new(driver.pool_) CYLabel($1, $3); }
1579 /* 12.13 The throw Statement {{{ */
1581 : "throw" Expression Terminator { $$ = new(driver.pool_) cy::Syntax::Throw($2); }
1584 /* 12.14 The try Statement {{{ */
1586 : "try" Block_ CatchOpt FinallyOpt { $$ = new(driver.pool_) cy::Syntax::Try($2, $3, $4); }
1590 : "catch" "(" Identifier ")" Block_ { $$ = new(driver.pool_) cy::Syntax::Catch($3, $5); }
1595 : "finally" Block_ { $$ = new(driver.pool_) CYFinally($2); }
1600 /* 13 Function Definition {{{ */
1602 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionStatement($2, $4, $7); }
1606 : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($2, $4, $7); }
1609 FormalParameterList_
1610 : "," FormalParameterList { $$ = $2; }
1615 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYFunctionParameter($1, $2); }
1620 : SourceElements { $$ = $1; }
1623 /* 14 Program {{{ */
1625 : SourceElements { driver.program_ = new(driver.pool_) CYProgram($1); }
1629 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
1630 | LexSetRegExp { $$ = NULL; }
1634 : Statement_ { $$ = $1; }
1635 | FunctionDeclaration { $$ = $1; }
1639 : LexSetRegExp SourceElement_ { $$ = $2; }
1644 /* Cycript (Objective-C): @class Declaration {{{ */
1646 /* XXX: why the hell did I choose MemberExpressionNoBF? */
1647 : ":" LexSetRegExp MemberExpressionNoBF { $$ = $3; }
1652 : "{" "}" { $$ = NULL; }
1656 : "+" { $$ = false; }
1657 | "-" { $$ = true; }
1661 : "(" Expression ")" { $$ = $2; }
1666 : Word ":" TypeOpt Identifier { $$ = new(driver.pool_) CYMessageParameter($1, $3, $4); }
1669 MessageParameterListOpt
1670 : MessageParameterList { $$ = $1; }
1674 MessageParameterList
1675 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1679 : MessageParameterList { $$ = $1; }
1680 | Word { $$ = new(driver.pool_) CYMessageParameter($1, NULL, NULL); }
1683 ClassMessageDeclaration
1684 : MessageScope TypeOpt MessageParameters "{" FunctionBody "}" { $$ = new(driver.pool_) CYMessage($1, $2, $3, $5); }
1687 ClassMessageDeclarationListOpt
1688 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1693 : Identifier { $$ = $1; }
1694 | "(" AssignmentExpression ")" { $$ = $2; }
1698 : ClassName { $$ = $1; }
1703 : "@class" ClassNameOpt ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5); }
1707 : "@class" ClassName ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5); }
1711 : "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $3); }
1715 : ClassExpression { $$ = $1; }
1719 : ClassStatement { $$ = $1; }
1720 | CategoryStatement { $$ = $1; }
1723 /* Cycript (Objective-C): Send Message {{{ */
1725 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1730 : SelectorCall { $$ = $1; }
1731 | VariadicCall { $$ = $1; }
1735 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1739 : SelectorCall { $$ = $1; }
1740 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1744 : "[" AssignmentExpressionNoWC SelectorList "]" { $$ = new(driver.pool_) CYSendDirect($2, $3); }
1745 | "[" LexSetRegExp "super" SelectorList "]" { $$ = new(driver.pool_) CYSendSuper($4); }
1748 SelectorExpressionOpt
1749 : SelectorExpression_ { $$ = $1; }
1754 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
1758 : SelectorExpression_ { $$ = $1; }
1759 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
1763 : MessageExpression { $$ = $1; }
1764 | "@selector" "(" SelectorExpression ")" { $$ = new(driver.pool_) CYSelector($3); }
1770 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1771 UnaryAssigneeExpression
1772 : "*" UnaryExpressionNoRE { $$ = new(driver.pool_) CYIndirect($2); }
1776 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }
1780 : "->" "[" Expression "]" { $$ = new(driver.pool_) CYIndirectMember(NULL, $3); }
1781 | "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
1787 /* Lexer State {{{ */
1789 : { driver.PushCondition(CYDriver::RegExpCondition); }
1793 : { driver.PushCondition(CYDriver::XMLContentCondition); }
1797 : { driver.PushCondition(CYDriver::XMLTagCondition); }
1801 : { driver.PopCondition(); }
1805 : { driver.SetCondition(CYDriver::XMLContentCondition); }
1809 : { driver.SetCondition(CYDriver::XMLTagCondition); }
1818 /* 8.1 Context Keywords {{{ */
1820 : "namespace" { $$ = $1; }
1821 | "xml" { $$ = $1; }
1824 /* 8.3 XML Initialiser Input Elements {{{ */
1826 : XMLComment { $$ = $1; }
1827 | XMLCDATA { $$ = $1; }
1828 | XMLPI { $$ = $1; }
1831 /* 11.1 Primary Expressions {{{ */
1833 : PropertyIdentifier { $$ = new(driver.pool_) CYPropertyVariable($1); }
1834 | XMLInitialiser { $$ = $1; }
1835 | XMLListInitialiser { $$ = $1; }
1839 : AttributeIdentifier { $$ = $1; }
1840 | QualifiedIdentifier { $$ = $1; }
1841 | WildcardIdentifier { $$ = $1; }
1844 /* 11.1.1 Attribute Identifiers {{{ */
1846 : "@" QualifiedIdentifier_ { $$ = new(driver.pool_) CYAttribute($2); }
1850 : PropertySelector { $$ = $1; }
1851 | "[" Expression "]" { $$ = new(driver.pool_) CYSelector($2); }
1855 : Identifier { $$ = new(driver.pool_) CYSelector($1); }
1856 | WildcardIdentifier { $$ = $1; }
1859 /* 11.1.2 Qualified Identifiers {{{ */
1860 QualifiedIdentifier_
1861 : PropertySelector_ { $$ = new(driver.pool_) CYQualified(NULL, $1); }
1862 | QualifiedIdentifier { $$ = $1; }
1866 : PropertySelector "::" PropertySelector_ { $$ = new(driver.pool_) CYQualified($1, $3); }
1869 /* 11.1.3 Wildcard Identifiers {{{ */
1871 : "*" { $$ = new(driver.pool_) CYWildcard(); }
1874 /* 11.1.4 XML Initialiser {{{ */
1876 : XMLMarkup { $$ = $1; }
1877 | XMLElement { $$ = $1; }
1881 : "<" XMLTagContent "/>" LexPop
1882 | "<" XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt ">" LexPop
1886 : LexPushXMLTag XMLTagName XMLAttributes
1890 : "{" LexPushRegExp Expression "}" LexPop
1899 : XMLAttributes_ XMLAttribute
1904 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
1905 | XMLAttributes_ XMLWhitespaceOpt
1914 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
1918 : XMLExpression XMLElementContentOpt
1919 | XMLMarkup XMLElementContentOpt
1920 | XMLText XMLElementContentOpt
1921 | XMLElement XMLElementContentOpt
1924 XMLElementContentOpt
1929 /* 11.1.5 XMLList Initialiser {{{ */
1931 : "<>" LexPushXMLContent XMLElementContent "</>" LexPop { $$ = new(driver.pool_) CYXMLList($3); }
1934 /* 11.2 Left-Hand-Side Expressions {{{ */
1936 : Identifier { $$ = $1; }
1937 | PropertyIdentifier { $$ = $1; }
1941 : "." PropertyIdentifier { $$ = new(driver.pool_) CYPropertyMember(NULL, $2); }
1942 | ".." PropertyIdentifier_ { $$ = new(driver.pool_) CYDescendantMember(NULL, $2); }
1943 | "." "(" Expression ")" { $$ = new(driver.pool_) CYFilteringPredicate(NULL, $3); }
1946 /* 12.1 The default xml namespace Statement {{{ */
1947 /* XXX: DefaultXMLNamespaceStatement
1948 : "default" "xml" "namespace" "=" Expression Terminator { $$ = new(driver.pool_) CYDefaultXMLNamespace($5); }
1952 : DefaultXMLNamespaceStatement { $$ = $1; }
1957 /* ECMAScript5: Object Literal Trailing Comma {{{ */
1958 PropertyNameAndValueList_
1959 : "," { $$ = NULL; }
1962 /* JavaScript 1.7: Array Comprehensions {{{ */
1964 : "if" "(" Expression ")" { $$ = new(driver.pool_) CYIfComprehension($3); }
1968 : "for" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForInComprehension($3, $5); }
1969 | "for" "each" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForEachInComprehension($4, $6); }
1972 ComprehensionListOpt
1973 : ComprehensionList { $$ = $1; }
1974 | IfComprehension { $$ = $1; }
1979 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1983 : "[" AssignmentExpression ComprehensionList "]" { $$ = new(driver.pool_) CYArrayComprehension($2, $3); }
1986 /* JavaScript 1.7: for each {{{ */
1988 : "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForEachIn($4, $6, $8); }
1991 /* JavaScript 1.7: let Statements {{{ *//*
1993 : "let" "(" VariableDeclarationList ")" Block_ { $$ = new(driver.pool_) CYLet($3, $5); }
2000 /* JavaScript FTW: Function Statements {{{ */
2002 : LexSetRegExp FunctionDeclaration { driver.Warning(yylloc, "warning, FunctionDeclaration is a SourceElement, not a Statement"); } { $$ = $2; }