]> git.saurik.com Git - cycript.git/blame_incremental - Cycript.y.in
Milestone #1: YUI has been destroyed, with room to spare.
[cycript.git] / Cycript.y.in
... / ...
CommitLineData
1/* Cycript - Inlining/Optimizing JavaScript Compiler
2 * Copyright (C) 2009 Jay Freeman (saurik)
3*/
4
5/* Modified BSD License {{{ */
6/*
7 * Redistribution and use in source and binary
8 * forms, with or without modification, are permitted
9 * provided that the following conditions are met:
10 *
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
18 * distribution.
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.
22 *
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.
37*/
38/* }}} */
39
40%code top {
41#include "Cycript.tab.hh"
42#define scanner driver.scanner_
43#define YYSTACKEXPANDABLE 1
44}
45
46%code requires {
47#include "Parser.hpp"
48
49@begin ObjectiveC
50#include "ObjectiveC/Syntax.hpp"
51@end
52
53@begin E4X
54#include "E4X/Syntax.hpp"
55@end
56
57typedef struct {
58 bool newline_;
59
60 union {
61 bool bool_;
62
63 CYDriver::Condition condition_;
64
65 CYArgument *argument_;
66 CYAssignment *assignment_;
67 CYBoolean *boolean_;
68 CYClause *clause_;
69 cy::Syntax::Catch *catch_;
70 CYComment *comment_;
71 CYComprehension *comprehension_;
72 CYCompound *compound_;
73 CYDeclaration *declaration_;
74 CYDeclarations *declarations_;
75 CYElement *element_;
76 CYExpression *expression_;
77 CYFalse *false_;
78 CYFinally *finally_;
79 CYForInitialiser *for_;
80 CYForInInitialiser *forin_;
81 CYFunctionParameter *functionParameter_;
82 CYIdentifier *identifier_;
83 CYInfix *infix_;
84 CYLiteral *literal_;
85 CYMember *member_;
86 CYNull *null_;
87 CYNumber *number_;
88 CYProgram *program_;
89 CYProperty *property_;
90 CYPropertyName *propertyName_;
91 CYStatement *statement_;
92 CYString *string_;
93 CYThis *this_;
94 CYTrue *true_;
95 CYWord *word_;
96
97@begin ObjectiveC
98 CYClassName *className_;
99 CYField *field_;
100 CYMessage *message_;
101 CYMessageParameter *messageParameter_;
102 CYSelectorPart *selector_;
103@end
104
105@begin E4X
106 CYAttribute *attribute_;
107 CYPropertyIdentifier *propertyIdentifier_;
108 CYSelector *selector_;
109@end
110 };
111} YYSTYPE;
112
113}
114
115%code provides {
116int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner);
117}
118
119%name-prefix "cy"
120
121%language "C++"
122%locations
123
124%initial-action {
125 @$.begin.filename = @$.end.filename = &driver.filename_;
126};
127
128%defines
129
130//%glr-parser
131//%expect 1
132
133%error-verbose
134
135%parse-param { CYDriver &driver }
136%lex-param { void *scanner }
137
138@begin E4X
139%token XMLCDATA
140%token XMLComment
141%token XMLPI
142
143%token XMLAttributeValue
144%token XMLName
145%token XMLTagCharacters
146%token XMLText
147%token XMLWhitespace
148@end
149
150@begin E4X
151%token LeftRight "<>"
152%token LeftSlashRight "</>"
153
154%token SlashRight "/>"
155%token LeftSlash "</"
156
157%token ColonColon "::"
158%token PeriodPeriod ".."
159@end
160
161@begin E4X ObjectiveC
162%token At "@"
163@end
164
165%token Ampersand "&"
166%token AmpersandAmpersand "&&"
167%token AmpersandEqual "&="
168%token Carrot "^"
169%token CarrotEqual "^="
170%token Equal "="
171%token EqualEqual "=="
172%token EqualEqualEqual "==="
173%token Exclamation "!"
174%token ExclamationEqual "!="
175%token ExclamationEqualEqual "!=="
176%token Hyphen "-"
177%token HyphenEqual "-="
178%token HyphenHyphen "--"
179%token HyphenHyphen_ "\n--"
180%token HyphenRight "->"
181%token Left "<"
182%token LeftEqual "<="
183%token LeftLeft "<<"
184%token LeftLeftEqual "<<="
185%token Percent "%"
186%token PercentEqual "%="
187%token Period "."
188%token Pipe "|"
189%token PipeEqual "|="
190%token PipePipe "||"
191%token Plus "+"
192%token PlusEqual "+="
193%token PlusPlus "++"
194%token PlusPlus_ "\n++"
195%token Right ">"
196%token RightEqual ">="
197%token RightRight ">>"
198%token RightRightEqual ">>="
199%token RightRightRight ">>>"
200%token RightRightRightEqual ">>>="
201%token Slash "/"
202%token SlashEqual "/="
203%token Star "*"
204%token StarEqual "*="
205%token Tilde "~"
206
207%token Colon ":"
208%token Comma ","
209%token Question "?"
210%token SemiColon ";"
211%token NewLine "\n"
212
213%token <comment_> Comment
214
215%token OpenParen "("
216%token CloseParen ")"
217
218%token OpenBrace "{"
219%token CloseBrace "}"
220
221%token OpenBracket "["
222%token CloseBracket "]"
223
224%token AtClass "@class"
225%token AtSelector "@selector"
226%token AtEnd "@end"
227
228%token <false_> False "false"
229%token <null_> Null "null"
230%token <true_> True "true"
231
232// ES3/ES5/WIE/JSC Reserved
233%token <word_> Break "break"
234%token <word_> Case "case"
235%token <word_> Catch "catch"
236%token <word_> Continue "continue"
237%token <word_> Default "default"
238%token <word_> Delete "delete"
239%token <word_> Do "do"
240%token <word_> Else "else"
241%token <word_> Finally "finally"
242%token <word_> For "for"
243%token <word_> Function "function"
244%token <word_> If "if"
245%token <word_> In "in"
246%token <word_> InstanceOf "instanceof"
247%token <word_> New "new"
248%token <word_> Return "return"
249%token <word_> Switch "switch"
250%token <this_> This "this"
251%token <word_> Throw "throw"
252%token <word_> Try "try"
253%token <word_> TypeOf "typeof"
254%token <word_> Var "var"
255%token <word_> Void "void"
256%token <word_> While "while"
257%token <word_> With "with"
258
259// ES3/IE6 Future, ES5/JSC Reserved
260%token <word_> Debugger "debugger"
261
262// ES3/ES5/IE6 Future, JSC Reserved
263%token <word_> Const "const"
264
265// ES3/ES5/IE6/JSC Future
266%token <word_> Class "class"
267%token <word_> Enum "enum"
268%token <word_> Export "export"
269%token <word_> Extends "extends"
270%token <word_> Import "import"
271%token <word_> Super "super"
272
273// ES3 Future, ES5 Strict Future
274%token <identifier_> Implements "implements"
275%token <identifier_> Interface "interface"
276%token <identifier_> Package "package"
277%token <identifier_> Private "private"
278%token <identifier_> Protected "protected"
279%token <identifier_> Public "public"
280%token <identifier_> Static "static"
281
282// ES3 Future
283%token <identifier_> Abstract "abstract"
284%token <identifier_> Boolean "boolean"
285%token <identifier_> Byte "byte"
286%token <identifier_> Char "char"
287%token <identifier_> Double "double"
288%token <identifier_> Final "final"
289%token <identifier_> Float "float"
290%token <identifier_> Goto "goto"
291%token <identifier_> Int "int"
292%token <identifier_> Long "long"
293%token <identifier_> Native "native"
294%token <identifier_> Short "short"
295%token <identifier_> Synchronized "synchronized"
296%token <identifier_> Throws "throws"
297%token <identifier_> Transient "transient"
298%token <identifier_> Volatile "volatile"
299
300// ES5 Strict
301%token <identifier_> Let "let"
302%token <identifier_> Yield "yield"
303
304// Woah?!
305%token <identifier_> Each "each"
306
307@begin E4X
308// E4X Conditional
309%token <identifier_> Namespace "namespace"
310%token <identifier_> XML "xml"
311@end
312
313%token <identifier_> Identifier_
314%token <number_> NumericLiteral
315%token <string_> StringLiteral
316%token <literal_> RegularExpressionLiteral
317
318%type <expression_> AdditiveExpression
319%type <expression_> AdditiveExpressionNoBF
320%type <argument_> ArgumentList
321%type <argument_> ArgumentList_
322%type <argument_> ArgumentListOpt
323%type <argument_> Arguments
324%type <literal_> ArrayLiteral
325%type <expression_> AssigneeExpression
326%type <expression_> AssigneeExpressionNoBF
327%type <expression_> AssignmentExpression
328%type <assignment_> AssignmentExpression_
329%type <expression_> AssignmentExpressionNoBF
330%type <expression_> AssignmentExpressionNoIn
331%type <expression_> BitwiseANDExpression
332%type <expression_> BitwiseANDExpressionNoBF
333%type <expression_> BitwiseANDExpressionNoIn
334%type <statement_> Block
335%type <statement_> Block_
336%type <boolean_> BooleanLiteral
337%type <expression_> BitwiseORExpression
338%type <expression_> BitwiseORExpressionNoBF
339%type <expression_> BitwiseORExpressionNoIn
340%type <expression_> BitwiseXORExpression
341%type <expression_> BitwiseXORExpressionNoBF
342%type <expression_> BitwiseXORExpressionNoIn
343%type <statement_> BreakStatement
344%type <expression_> CallExpression
345%type <expression_> CallExpressionNoBF
346%type <clause_> CaseBlock
347%type <clause_> CaseClause
348%type <clause_> CaseClausesOpt
349%type <catch_> CatchOpt
350%type <comprehension_> ComprehensionList
351%type <comprehension_> ComprehensionListOpt
352%type <expression_> ConditionalExpression
353%type <expression_> ConditionalExpressionNoBF
354%type <expression_> ConditionalExpressionNoIn
355%type <statement_> ContinueStatement
356%type <clause_> DefaultClause
357%type <statement_> DoWhileStatement
358%type <expression_> Element
359%type <expression_> ElementOpt
360%type <element_> ElementList
361%type <element_> ElementListOpt
362%type <statement_> ElseStatementOpt
363%type <statement_> EmptyStatement
364%type <expression_> EqualityExpression
365%type <expression_> EqualityExpressionNoBF
366%type <expression_> EqualityExpressionNoIn
367%type <expression_> Expression
368%type <expression_> ExpressionOpt
369%type <compound_> Expression_
370%type <expression_> ExpressionNoBF
371%type <expression_> ExpressionNoIn
372%type <compound_> ExpressionNoIn_
373%type <expression_> ExpressionNoInOpt
374%type <statement_> ExpressionStatement
375%type <finally_> FinallyOpt
376%type <comprehension_> ForComprehension
377%type <statement_> ForStatement
378%type <for_> ForStatementInitialiser
379%type <statement_> ForInStatement
380%type <forin_> ForInStatementInitialiser
381%type <functionParameter_> FormalParameterList
382%type <functionParameter_> FormalParameterList_
383%type <statement_> FunctionBody
384%type <statement_> FunctionDeclaration
385%type <expression_> FunctionExpression
386%type <identifier_> Identifier
387%type <identifier_> IdentifierOpt
388%type <comprehension_> IfComprehension
389%type <statement_> IfStatement
390%type <expression_> Initialiser
391%type <expression_> InitialiserOpt
392%type <expression_> InitialiserNoIn
393%type <expression_> InitialiserNoInOpt
394%type <statement_> IterationStatement
395%type <statement_> LabelledStatement
396%type <expression_> LeftHandSideExpression
397%type <expression_> LeftHandSideExpressionNoBF
398//%type <statement_> LetStatement
399%type <literal_> Literal
400%type <literal_> LiteralNoRE
401%type <literal_> LiteralRE
402%type <expression_> LogicalANDExpression
403%type <expression_> LogicalANDExpressionNoBF
404%type <expression_> LogicalANDExpressionNoIn
405%type <expression_> LogicalORExpression
406%type <expression_> LogicalORExpressionNoBF
407%type <expression_> LogicalORExpressionNoIn
408%type <member_> MemberAccess
409%type <expression_> MemberExpression
410%type <expression_> MemberExpression_
411%type <expression_> MemberExpressionNoBF
412%type <expression_> MultiplicativeExpression
413%type <expression_> MultiplicativeExpressionNoBF
414%type <expression_> NewExpression
415%type <expression_> NewExpression_
416%type <expression_> NewExpressionNoBF
417%type <null_> NullLiteral
418%type <literal_> ObjectLiteral
419%type <expression_> PostfixExpression
420%type <expression_> PostfixExpressionNoBF
421%type <expression_> PrimaryExpression
422%type <expression_> PrimaryExpressionNo
423%type <expression_> PrimaryExpressionNoBF
424%type <expression_> PrimaryExpressionNoRE
425%type <expression_> PrimaryExpressionBF
426%type <statement_> Program
427%type <propertyName_> PropertyName
428%type <propertyName_> PropertyName_
429%type <property_> PropertyNameAndValueList
430%type <property_> PropertyNameAndValueList_
431%type <property_> PropertyNameAndValueListOpt
432%type <expression_> RelationalExpression
433%type <infix_> RelationalExpression_
434%type <expression_> RelationalExpressionNoBF
435%type <expression_> RelationalExpressionNoIn
436%type <infix_> RelationalExpressionNoIn_
437%type <statement_> ReturnStatement
438%type <expression_> ShiftExpression
439%type <expression_> ShiftExpressionNoBF
440%type <statement_> SourceElement
441%type <statement_> SourceElement_
442%type <statement_> SourceElements
443%type <statement_> Statement
444%type <statement_> Statement_
445%type <statement_> StatementList
446%type <statement_> StatementListOpt
447%type <statement_> SwitchStatement
448%type <statement_> ThrowStatement
449%type <statement_> TryStatement
450%type <expression_> UnaryExpression
451%type <expression_> UnaryExpression_
452%type <expression_> UnaryExpressionNoBF
453%type <declaration_> VariableDeclaration
454%type <declaration_> VariableDeclarationNoIn
455%type <declarations_> VariableDeclarationList
456%type <declarations_> VariableDeclarationList_
457%type <declarations_> VariableDeclarationListNoIn
458%type <declarations_> VariableDeclarationListNoIn_
459%type <statement_> VariableStatement
460%type <statement_> WhileStatement
461%type <statement_> WithStatement
462
463@begin C
464%type <expression_> AssigneeExpressionNoRE
465%type <expression_> CallExpressionNoRE
466%type <expression_> LeftHandSideExpressionNoRE
467%type <expression_> MemberExpressionNoRE
468%type <expression_> NewExpressionNoRE
469%type <expression_> PostfixExpressionNoRE
470%type <expression_> UnaryAssigneeExpression
471%type <expression_> UnaryExpressionNoRE
472@end
473
474@begin ObjectiveC
475%type <statement_> CategoryStatement
476%type <expression_> ClassExpression
477%type <statement_> ClassStatement
478%type <expression_> ClassSuperOpt
479%type <field_> ClassFieldList
480%type <message_> ClassMessageDeclaration
481%type <message_> ClassMessageDeclarationListOpt
482%type <className_> ClassName
483%type <className_> ClassNameOpt
484%type <expression_> MessageExpression
485%type <messageParameter_> MessageParameter
486%type <messageParameter_> MessageParameters
487%type <messageParameter_> MessageParameterList
488%type <messageParameter_> MessageParameterListOpt
489%type <bool_> MessageScope
490%type <argument_> SelectorCall
491%type <argument_> SelectorCall_
492%type <selector_> SelectorExpression
493%type <selector_> SelectorExpression_
494%type <selector_> SelectorExpressionOpt
495%type <argument_> SelectorList
496%type <expression_> TypeOpt
497%type <argument_> VariadicCall
498%type <word_> Word
499%type <word_> WordOpt
500@end
501
502@begin E4X
503%type <propertyIdentifier_> PropertyIdentifier_
504%type <selector_> PropertySelector
505%type <selector_> PropertySelector_
506%type <identifier_> QualifiedIdentifier
507%type <identifier_> QualifiedIdentifier_
508%type <identifier_> WildcardIdentifier
509%type <identifier_> XMLComment
510%type <identifier_> XMLCDATA
511%type <identifier_> XMLElement
512%type <identifier_> XMLElementContent
513%type <identifier_> XMLMarkup
514%type <identifier_> XMLPI
515
516%type <attribute_> AttributeIdentifier
517/* XXX: %type <statement_> DefaultXMLNamespaceStatement */
518%type <expression_> PropertyIdentifier
519%type <expression_> XMLListInitialiser
520%type <expression_> XMLInitialiser
521@end
522
523%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"
524
525%nonassoc "if"
526%nonassoc "else"
527
528%nonassoc "++" "--"
529%nonassoc "(" "["
530
531%left "*" "/" "%"
532%left "+" "-"
533%left "<<" ">>" ">>>"
534%left "<" ">" "<=" ">=" "instanceof" "in"
535%left "==" "!=" "===" "!=="
536%left "&"
537%left "^"
538%left "|"
539%left "&&"
540%left "||"
541
542%right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
543
544%start Program
545
546%%
547
548/* Lexer State {{{ */
549LexSetRegExp
550 : { driver.SetCondition(CYDriver::RegExpCondition); }
551 ;
552/* }}} */
553
554StrictSemi
555 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
556 ;
557
558Terminator_
559 : ";"
560 | "\n" StrictSemi
561 ;
562
563TerminatorOpt
564 : Terminator_
565 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
566 ;
567
568Terminator
569 : Terminator_
570 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
571 ;
572
573/*CommaOpt
574 : ","
575 |
576 ;*/
577
578@begin ObjectiveC
579NewLineOpt
580 : "\n"
581 |
582 ;
583
584WordOpt
585 : Word { $$ = $1; }
586 | { $$ = NULL; }
587 ;
588
589Word
590 : Identifier { $$ = $1; }
591 | "break" NewLineOpt { $$ = $1; }
592 | "case" { $$ = $1; }
593 | "catch" { $$ = $1; }
594 | "class" { $$ = $1; }
595 | "const" { $$ = $1; }
596 | "continue" NewLineOpt { $$ = $1; }
597 | "debugger" { $$ = $1; }
598 | "default" { $$ = $1; }
599 | "delete" { $$ = $1; }
600 | "do" { $$ = $1; }
601 | "else" { $$ = $1; }
602 | "enum" { $$ = $1; }
603 | "export" { $$ = $1; }
604 | "extends" { $$ = $1; }
605 | "false" { $$ = $1; }
606 | "finally" { $$ = $1; }
607 /* XXX: | "for" { $$ = $1; } */
608 | "function" { $$ = $1; }
609 | "if" { $$ = $1; }
610 | "import" { $$ = $1; }
611 /* XXX: | "in" { $$ = $1; } */
612 /* XXX: | "instanceof" { $$ = $1; } */
613 | "new" { $$ = $1; }
614 | "null" { $$ = $1; }
615 | "return" NewLineOpt { $$ = $1; }
616 | "super" { $$ = $1; }
617 | "switch" { $$ = $1; }
618 | "this" { $$ = $1; }
619 | "throw" NewLineOpt { $$ = $1; }
620 | "true" { $$ = $1; }
621 | "try" { $$ = $1; }
622 | "typeof" { $$ = $1; }
623 | "var" { $$ = $1; }
624 | "void" { $$ = $1; }
625 | "while" { $$ = $1; }
626 | "with" { $$ = $1; }
627 ;
628@end
629
630Identifier
631 : Identifier_ { $$ = $1; }
632
633 | "implements" { $$ = $1; }
634 | "interface" { $$ = $1; }
635 | "package" { $$ = $1; }
636 | "private" { $$ = $1; }
637 | "protected" { $$ = $1; }
638 | "public" { $$ = $1; }
639 | "static" { $$ = $1; }
640
641 | "abstract" { $$ = $1; }
642 | "boolean" { $$ = $1; }
643 | "byte" { $$ = $1; }
644 | "char" { $$ = $1; }
645 | "double" { $$ = $1; }
646 | "final" { $$ = $1; }
647 | "float" { $$ = $1; }
648 | "goto" { $$ = $1; }
649 | "int" { $$ = $1; }
650 | "long" { $$ = $1; }
651 | "native" { $$ = $1; }
652 | "short" { $$ = $1; }
653 | "synchronized" { $$ = $1; }
654 | "throws" { $$ = $1; }
655 | "transient" { $$ = $1; }
656 | "volatile" { $$ = $1; }
657
658 | "let" { $$ = $1; }
659 | "yield" { $$ = $1; }
660
661 | "each" { $$ = $1; }
662 ;
663
664IdentifierOpt
665 : Identifier { $$ = $1; }
666 | { $$ = NULL; }
667 ;
668
669LiteralNoRE
670 : NullLiteral { $$ = $1; }
671 | BooleanLiteral { $$ = $1; }
672 | NumericLiteral { $$ = $1; }
673 | StringLiteral { $$ = $1; }
674 | "@" StringLiteral { $$ = $2; }
675 ;
676
677LiteralRE
678 : RegularExpressionLiteral { $$ = $1; }
679 ;
680
681Literal
682 : LiteralNoRE { $$ = $1; }
683 | LiteralRE { $$ = $1; }
684 ;
685
686NullLiteral
687 : "null" { $$ = $1; }
688 ;
689
690BooleanLiteral
691 : "true" { $$ = $1; }
692 | "false" { $$ = $1; }
693 ;
694
695/* 11.1 Primary Expressions {{{ */
696PrimaryExpression
697 : LexSetRegExp PrimaryExpressionNoRE { $$ = $2; }
698 ;
699
700PrimaryExpressionNoBF
701 : PrimaryExpressionNo { $$ = $1; }
702 ;
703
704PrimaryExpressionNoRE
705 : PrimaryExpressionBF { $$ = $1; }
706 | PrimaryExpressionNo { $$ = $1; }
707 ;
708
709PrimaryExpressionNo
710 : "this" { $$ = $1; }
711 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
712 | Literal { $$ = $1; }
713 | ArrayLiteral { $$ = $1; }
714 | "(" Expression ")" { $$ = $2; }
715 ;
716
717PrimaryExpressionBF
718 : ObjectLiteral { $$ = $1; }
719 ;
720/* }}} */
721/* 11.1.4 Array Initialiser {{{ */
722ArrayLiteral
723 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
724 ;
725
726Element
727 : AssignmentExpression { $$ = $1; }
728 ;
729
730ElementOpt
731 : Element { $$ = $1; }
732 | LexSetRegExp { $$ = NULL; }
733 ;
734
735ElementListOpt
736 : ElementList { $$ = $1; }
737 | LexSetRegExp { $$ = NULL; }
738 ;
739
740ElementList
741 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
742 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
743 ;
744/* }}} */
745/* 11.1.5 Object Initialiser {{{ */
746ObjectLiteral
747 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
748 ;
749
750PropertyNameAndValueList_
751 : "," PropertyNameAndValueList { $$ = $2; }
752 | { $$ = NULL; }
753 ;
754
755PropertyNameAndValueListOpt
756 : PropertyNameAndValueList { $$ = $1; }
757 | { $$ = NULL; }
758 ;
759
760PropertyNameAndValueList
761 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
762 ;
763
764PropertyName_
765 : Identifier { $$ = $1; }
766 | StringLiteral { $$ = $1; }
767 | NumericLiteral { $$ = $1; }
768 ;
769
770PropertyName
771 : LexSetRegExp PropertyName_ { $$ = $2; }
772 ;
773/* }}} */
774
775/* 11.2 Left-Hand-Side Expressions {{{ */
776MemberExpression_
777 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
778 ;
779
780MemberAccess
781 : "[" Expression "]" { $$ = new(driver.pool_) CYDirectMember(NULL, $2); }
782 | "." Identifier { $$ = new(driver.pool_) CYDirectMember(NULL, new(driver.pool_) CYString($2)); }
783 ;
784
785MemberExpression
786 : PrimaryExpression { $$ = $1; }
787 | LexSetRegExp FunctionExpression { $$ = $2; }
788 | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
789 | LexSetRegExp MemberExpression_ { $$ = $2; }
790 ;
791
792MemberExpressionNoBF
793 : PrimaryExpressionNoBF { $$ = $1; }
794 | MemberExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
795 | MemberExpression_ { $$ = $1; }
796 ;
797
798@begin C
799MemberExpressionNoRE
800 : PrimaryExpressionNoRE { $$ = $1; }
801 | FunctionExpression { $$ = $1; }
802 | MemberExpressionNoRE MemberAccess { $2->SetLeft($1); $$ = $2; }
803 | MemberExpression_ { $$ = $1; }
804 ;
805@end
806
807NewExpression_
808 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
809 ;
810
811NewExpression
812 : MemberExpression { $$ = $1; }
813 | LexSetRegExp NewExpression_ { $$ = $2; }
814 ;
815
816NewExpressionNoBF
817 : MemberExpressionNoBF { $$ = $1; }
818 | NewExpression_ { $$ = $1; }
819 ;
820
821@begin C
822NewExpressionNoRE
823 : MemberExpressionNoRE { $$ = $1; }
824 | NewExpression_ { $$ = $1; }
825 ;
826@end
827
828CallExpression
829 : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
830 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
831 | CallExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
832 ;
833
834CallExpressionNoBF
835 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
836 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
837 | CallExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
838 ;
839
840@begin C
841CallExpressionNoRE
842 : MemberExpressionNoRE Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
843 | CallExpressionNoRE Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
844 | CallExpressionNoRE MemberAccess { $2->SetLeft($1); $$ = $2; }
845 ;
846@end
847
848ArgumentList_
849 : "," ArgumentList { $$ = $2; }
850 | { $$ = NULL; }
851 ;
852
853ArgumentListOpt
854 : ArgumentList { $$ = $1; }
855 | LexSetRegExp { $$ = NULL; }
856 ;
857
858ArgumentList
859 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
860 ;
861
862Arguments
863 : "(" ArgumentListOpt ")" { $$ = $2; }
864 ;
865
866LeftHandSideExpression
867 : NewExpression { $$ = $1; }
868 | CallExpression { $$ = $1; }
869 ;
870
871LeftHandSideExpressionNoBF
872 : NewExpressionNoBF { $$ = $1; }
873 | CallExpressionNoBF { $$ = $1; }
874 ;
875
876@begin C
877LeftHandSideExpressionNoRE
878 : NewExpressionNoRE { $$ = $1; }
879 | CallExpressionNoRE { $$ = $1; }
880 ;
881@end
882/* }}} */
883/* 11.3 Postfix Expressions {{{ */
884PostfixExpression
885 : AssigneeExpression { $$ = $1; }
886 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
887 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
888 ;
889
890PostfixExpressionNoBF
891 : AssigneeExpressionNoBF { $$ = $1; }
892 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
893 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
894 ;
895
896@begin C
897PostfixExpressionNoRE
898 : AssigneeExpressionNoRE { $$ = $1; }
899 | LeftHandSideExpressionNoRE "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
900 | LeftHandSideExpressionNoRE "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
901 ;
902@end
903/* }}} */
904/* 11.4 Unary Operators {{{ */
905UnaryExpression_
906 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
907 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
908 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
909 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
910 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
911 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
912 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
913 | "+" UnaryExpression { $$ = new(driver.pool_) CYAffirm($2); }
914 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
915 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
916 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
917 ;
918
919UnaryExpression
920 : PostfixExpression { $$ = $1; }
921 | LexSetRegExp UnaryExpression_ { $$ = $2; }
922 ;
923
924UnaryExpressionNoBF
925 : PostfixExpressionNoBF { $$ = $1; }
926 | UnaryExpression_ { $$ = $1; }
927 ;
928
929@begin C
930UnaryExpressionNoRE
931 : PostfixExpressionNoRE { $$ = $1; }
932 | UnaryExpression_ { $$ = $1; }
933 ;
934@end
935/* }}} */
936/* 11.5 Multiplicative Operators {{{ */
937MultiplicativeExpression
938 : UnaryExpression { $$ = $1; }
939 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
940 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
941 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
942 ;
943
944MultiplicativeExpressionNoBF
945 : UnaryExpressionNoBF { $$ = $1; }
946 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
947 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
948 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
949 ;
950/* }}} */
951/* 11.6 Additive Operators {{{ */
952AdditiveExpression
953 : MultiplicativeExpression { $$ = $1; }
954 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
955 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
956 ;
957
958AdditiveExpressionNoBF
959 : MultiplicativeExpressionNoBF { $$ = $1; }
960 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
961 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
962 ;
963/* }}} */
964/* 11.7 Bitwise Shift Operators {{{ */
965ShiftExpression
966 : AdditiveExpression { $$ = $1; }
967 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
968 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
969 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
970 ;
971
972ShiftExpressionNoBF
973 : AdditiveExpressionNoBF { $$ = $1; }
974 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
975 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
976 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
977 ;
978/* }}} */
979/* 11.8 Relational Operators {{{ */
980RelationalExpressionNoIn_
981 : "<" ShiftExpression { $$ = new(driver.pool_) CYLess(NULL, $2); }
982 | ">" ShiftExpression { $$ = new(driver.pool_) CYGreater(NULL, $2); }
983 | "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual(NULL, $2); }
984 | ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual(NULL, $2); }
985 | "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf(NULL, $2); }
986 ;
987
988RelationalExpression_
989 : RelationalExpressionNoIn_ { $$ = $1; }
990 | "in" ShiftExpression { $$ = new(driver.pool_) CYIn(NULL, $2); }
991 ;
992
993RelationalExpression
994 : ShiftExpression { $$ = $1; }
995 | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
996 ;
997
998RelationalExpressionNoIn
999 : ShiftExpression { $$ = $1; }
1000 | RelationalExpressionNoIn RelationalExpressionNoIn_ { $2->SetLeft($1); $$ = $2; }
1001 ;
1002
1003RelationalExpressionNoBF
1004 : ShiftExpressionNoBF { $$ = $1; }
1005 | RelationalExpressionNoBF RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
1006 ;
1007/* }}} */
1008/* 11.9 Equality Operators {{{ */
1009EqualityExpression
1010 : RelationalExpression { $$ = $1; }
1011 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
1012 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
1013 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
1014 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
1015 ;
1016
1017EqualityExpressionNoIn
1018 : RelationalExpressionNoIn { $$ = $1; }
1019 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
1020 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
1021 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
1022 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
1023 ;
1024
1025EqualityExpressionNoBF
1026 : RelationalExpressionNoBF { $$ = $1; }
1027 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
1028 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
1029 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
1030 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
1031 ;
1032/* }}} */
1033/* 11.10 Binary Bitwise Operators {{{ */
1034BitwiseANDExpression
1035 : EqualityExpression { $$ = $1; }
1036 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
1037 ;
1038
1039BitwiseANDExpressionNoIn
1040 : EqualityExpressionNoIn { $$ = $1; }
1041 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
1042 ;
1043
1044BitwiseANDExpressionNoBF
1045 : EqualityExpressionNoBF { $$ = $1; }
1046 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
1047 ;
1048
1049BitwiseXORExpression
1050 : BitwiseANDExpression { $$ = $1; }
1051 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
1052 ;
1053
1054BitwiseXORExpressionNoIn
1055 : BitwiseANDExpressionNoIn { $$ = $1; }
1056 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
1057 ;
1058
1059BitwiseXORExpressionNoBF
1060 : BitwiseANDExpressionNoBF { $$ = $1; }
1061 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
1062 ;
1063
1064BitwiseORExpression
1065 : BitwiseXORExpression { $$ = $1; }
1066 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
1067 ;
1068
1069BitwiseORExpressionNoIn
1070 : BitwiseXORExpressionNoIn { $$ = $1; }
1071 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
1072 ;
1073
1074BitwiseORExpressionNoBF
1075 : BitwiseXORExpressionNoBF { $$ = $1; }
1076 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
1077 ;
1078/* }}} */
1079/* 11.11 Binary Logical Operators {{{ */
1080LogicalANDExpression
1081 : BitwiseORExpression { $$ = $1; }
1082 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
1083 ;
1084
1085LogicalANDExpressionNoIn
1086 : BitwiseORExpressionNoIn { $$ = $1; }
1087 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
1088 ;
1089
1090LogicalANDExpressionNoBF
1091 : BitwiseORExpressionNoBF { $$ = $1; }
1092 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
1093 ;
1094
1095LogicalORExpression
1096 : LogicalANDExpression { $$ = $1; }
1097 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
1098 ;
1099
1100LogicalORExpressionNoIn
1101 : LogicalANDExpressionNoIn { $$ = $1; }
1102 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
1103 ;
1104
1105LogicalORExpressionNoBF
1106 : LogicalANDExpressionNoBF { $$ = $1; }
1107 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
1108 ;
1109/* }}} */
1110/* 11.12 Conditional Operator ( ? : ) {{{ */
1111ConditionalExpression
1112 : LogicalORExpression { $$ = $1; }
1113 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
1114 ;
1115
1116ConditionalExpressionNoIn
1117 : LogicalORExpressionNoIn { $$ = $1; }
1118 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
1119 ;
1120
1121ConditionalExpressionNoBF
1122 : LogicalORExpressionNoBF { $$ = $1; }
1123 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
1124 ;
1125/* }}} */
1126/* 11.13 Assignment Operators {{{ */
1127AssignmentExpression_
1128 : "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign(NULL, $2); }
1129 | "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign(NULL, $2); }
1130 | "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign(NULL, $2); }
1131 | "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign(NULL, $2); }
1132 | "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign(NULL, $2); }
1133 | "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign(NULL, $2); }
1134 | "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign(NULL, $2); }
1135 | ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign(NULL, $2); }
1136 | ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign(NULL, $2); }
1137 | "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign(NULL, $2); }
1138 | "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign(NULL, $2); }
1139 | "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign(NULL, $2); }
1140 ;
1141
1142AssigneeExpression
1143 : LeftHandSideExpression { $$ = $1; }
1144@begin C
1145 | LexSetRegExp UnaryAssigneeExpression { $$ = $2; }
1146@end
1147 ;
1148
1149AssigneeExpressionNoBF
1150 : LeftHandSideExpressionNoBF { $$ = $1; }
1151@begin C
1152 | UnaryAssigneeExpression { $$ = $1; }
1153@end
1154 ;
1155
1156@begin C
1157AssigneeExpressionNoRE
1158 : LeftHandSideExpressionNoRE { $$ = $1; }
1159 | UnaryAssigneeExpression { $$ = $1; }
1160 ;
1161@end
1162
1163AssignmentExpression
1164 : ConditionalExpression { $$ = $1; }
1165 | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1166 ;
1167
1168AssignmentExpressionNoIn
1169 : ConditionalExpressionNoIn { $$ = $1; }
1170 | AssigneeExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
1171 | AssigneeExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
1172 | AssigneeExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
1173 | AssigneeExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
1174 | AssigneeExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
1175 | AssigneeExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
1176 | AssigneeExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
1177 | AssigneeExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
1178 | AssigneeExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
1179 | AssigneeExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
1180 | AssigneeExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
1181 | AssigneeExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
1182 ;
1183
1184AssignmentExpressionNoBF
1185 : ConditionalExpressionNoBF { $$ = $1; }
1186 | AssigneeExpressionNoBF AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
1187 ;
1188/* }}} */
1189/* 11.14 Comma Operator {{{ */
1190Expression_
1191 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
1192 | { $$ = NULL; }
1193 ;
1194
1195ExpressionNoIn_
1196 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
1197 | { $$ = NULL; }
1198 ;
1199
1200ExpressionOpt
1201 : Expression { $$ = $1; }
1202 | LexSetRegExp { $$ = NULL; }
1203 ;
1204
1205ExpressionNoInOpt
1206 : ExpressionNoIn { $$ = $1; }
1207 | LexSetRegExp { $$ = NULL; }
1208 ;
1209
1210Expression
1211 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1212 ;
1213
1214ExpressionNoIn
1215 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1216 ;
1217
1218ExpressionNoBF
1219 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1220 ;
1221/* }}} */
1222
1223/* 12 Statements {{{ */
1224Statement_
1225 : Block { $$ = $1; }
1226 | VariableStatement { $$ = $1; }
1227 | EmptyStatement { $$ = $1; }
1228 | ExpressionStatement { $$ = $1; }
1229 | IfStatement { $$ = $1; }
1230 | IterationStatement { $$ = $1; }
1231 | ContinueStatement { $$ = $1; }
1232 | BreakStatement { $$ = $1; }
1233 | ReturnStatement { $$ = $1; }
1234 | WithStatement { $$ = $1; }
1235 | LabelledStatement { $$ = $1; }
1236 | SwitchStatement { $$ = $1; }
1237 | ThrowStatement { $$ = $1; }
1238 | TryStatement { $$ = $1; }
1239 ;
1240
1241Statement
1242 : LexSetRegExp Statement_ { $$ = $2; }
1243 ;
1244/* }}} */
1245/* 12.1 Block {{{ */
1246Block_
1247 : "{" StatementListOpt "}" { $$ = $2; }
1248 ;
1249
1250Block
1251 : Block_ { if ($1) $$ = new(driver.pool_) CYBlock($1); else $$ = new(driver.pool_) CYEmpty(); }
1252 ;
1253
1254StatementList
1255 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
1256 ;
1257
1258StatementListOpt
1259 : StatementList { $$ = $1; }
1260 | LexSetRegExp { $$ = NULL; }
1261 ;
1262/* }}} */
1263/* 12.2 Variable Statement {{{ */
1264VariableStatement
1265 : "var" VariableDeclarationList Terminator { $$ = new(driver.pool_) CYVar($2); }
1266 ;
1267
1268VariableDeclarationList_
1269 : "," VariableDeclarationList { $$ = $2; }
1270 | { $$ = NULL; }
1271 ;
1272
1273VariableDeclarationListNoIn_
1274 : "," VariableDeclarationListNoIn { $$ = $2; }
1275 | { $$ = NULL; }
1276 ;
1277
1278VariableDeclarationList
1279 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1280 ;
1281
1282VariableDeclarationListNoIn
1283 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1284 ;
1285
1286VariableDeclaration
1287 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1288 ;
1289
1290VariableDeclarationNoIn
1291 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1292 ;
1293
1294InitialiserOpt
1295 : Initialiser { $$ = $1; }
1296 | { $$ = NULL; }
1297 ;
1298
1299InitialiserNoInOpt
1300 : InitialiserNoIn { $$ = $1; }
1301 | { $$ = NULL; }
1302 ;
1303
1304Initialiser
1305 : "=" AssignmentExpression { $$ = $2; }
1306 ;
1307
1308InitialiserNoIn
1309 : "=" AssignmentExpressionNoIn { $$ = $2; }
1310 ;
1311/* }}} */
1312/* 12.3 Empty Statement {{{ */
1313EmptyStatement
1314 : ";" { $$ = new(driver.pool_) CYEmpty(); }
1315 ;
1316/* }}} */
1317/* 12.4 Expression Statement {{{ */
1318ExpressionStatement
1319 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
1320 ;
1321/* }}} */
1322/* 12.5 The if Statement {{{ */
1323ElseStatementOpt
1324 : "else" Statement { $$ = $2; }
1325 | %prec "if" { $$ = NULL; }
1326 ;
1327
1328IfStatement
1329 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1330 ;
1331/* }}} */
1332
1333/* 12.6 Iteration Statements {{{ */
1334IterationStatement
1335 : DoWhileStatement { $$ = $1; }
1336 | WhileStatement { $$ = $1; }
1337 | ForStatement { $$ = $1; }
1338 | ForInStatement { $$ = $1; }
1339 ;
1340/* }}} */
1341/* 12.6.1 The do-while Statement {{{ */
1342DoWhileStatement
1343 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1344 ;
1345/* }}} */
1346/* 12.6.2 The while Statement {{{ */
1347WhileStatement
1348 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1349 ;
1350/* }}} */
1351/* 12.6.3 The for Statement {{{ */
1352ForStatement
1353 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1354 ;
1355
1356ForStatementInitialiser
1357 : ExpressionNoInOpt { $$ = $1; }
1358 | LexSetRegExp "var" VariableDeclarationListNoIn { $$ = $3; }
1359 ;
1360/* }}} */
1361/* 12.6.4 The for-in Statement {{{ */
1362ForInStatement
1363 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1364 ;
1365
1366ForInStatementInitialiser
1367 : LeftHandSideExpression { $$ = $1; }
1368 | LexSetRegExp "var" VariableDeclarationNoIn { $$ = $3; }
1369 ;
1370/* }}} */
1371
1372/* 12.7 The continue Statement {{{ */
1373ContinueStatement
1374 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1375 ;
1376/* }}} */
1377/* 12.8 The break Statement {{{ */
1378BreakStatement
1379 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1380 ;
1381/* }}} */
1382/* 12.9 The return Statement {{{ */
1383ReturnStatement
1384 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1385 ;
1386/* }}} */
1387/* 12.10 The with Statement {{{ */
1388WithStatement
1389 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1390 ;
1391/* }}} */
1392
1393/* 12.11 The switch Statement {{{ */
1394SwitchStatement
1395 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1396 ;
1397
1398CaseBlock
1399 : "{" CaseClausesOpt "}" { $$ = $2; }
1400 ;
1401
1402CaseClausesOpt
1403 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1404 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1405 | { $$ = NULL; }
1406 ;
1407
1408CaseClause
1409 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1410 ;
1411
1412DefaultClause
1413 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1414 ;
1415/* }}} */
1416/* 12.12 Labelled Statements {{{ */
1417LabelledStatement
1418 : Identifier ":" Statement { $$ = new(driver.pool_) CYLabel($1, $3); }
1419 ;
1420/* }}} */
1421/* 12.13 The throw Statement {{{ */
1422ThrowStatement
1423 : "throw" Expression Terminator { $$ = new(driver.pool_) cy::Syntax::Throw($2); }
1424 ;
1425/* }}} */
1426/* 12.14 The try Statement {{{ */
1427TryStatement
1428 : "try" Block_ CatchOpt FinallyOpt { $$ = new(driver.pool_) cy::Syntax::Try($2, $3, $4); }
1429 ;
1430
1431CatchOpt
1432 : "catch" "(" Identifier ")" Block_ { $$ = new(driver.pool_) cy::Syntax::Catch($3, $5); }
1433 | { $$ = NULL; }
1434 ;
1435
1436FinallyOpt
1437 : "finally" Block_ { $$ = new(driver.pool_) CYFinally($2); }
1438 | { $$ = NULL; }
1439 ;
1440/* }}} */
1441
1442/* 13 Function Definition {{{ */
1443FunctionDeclaration
1444 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionStatement($2, $4, $7); }
1445 ;
1446
1447FunctionExpression
1448 : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($2, $4, $7); }
1449 ;
1450
1451FormalParameterList_
1452 : "," FormalParameterList { $$ = $2; }
1453 | { $$ = NULL; }
1454 ;
1455
1456FormalParameterList
1457 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYFunctionParameter($1, $2); }
1458 | { $$ = NULL; }
1459 ;
1460
1461FunctionBody
1462 : SourceElements { $$ = $1; }
1463 ;
1464/* }}} */
1465/* 14 Program {{{ */
1466Program
1467 : SourceElements { driver.program_ = new(driver.pool_) CYProgram($1); }
1468 ;
1469
1470SourceElements
1471 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
1472 | LexSetRegExp { $$ = NULL; }
1473 ;
1474
1475SourceElement_
1476 : Statement_ { $$ = $1; }
1477 | FunctionDeclaration { $$ = $1; }
1478 ;
1479
1480SourceElement
1481 : LexSetRegExp SourceElement_ { $$ = $2; }
1482 ;
1483/* }}} */
1484
1485@begin ObjectiveC
1486/* Cycript (Objective-C): @class Declaration {{{ */
1487ClassSuperOpt
1488 /* XXX: why the hell did I choose MemberExpressionNoBF? */
1489 : ":" LexSetRegExp MemberExpressionNoBF { $$ = $3; }
1490 | { $$ = NULL; }
1491 ;
1492
1493ClassFieldList
1494 : "{" "}" { $$ = NULL; }
1495 ;
1496
1497MessageScope
1498 : "+" { $$ = false; }
1499 | "-" { $$ = true; }
1500 ;
1501
1502TypeOpt
1503 : "(" Expression ")" { $$ = $2; }
1504 | { $$ = NULL; }
1505 ;
1506
1507MessageParameter
1508 : Word ":" TypeOpt Identifier { $$ = new(driver.pool_) CYMessageParameter($1, $3, $4); }
1509 ;
1510
1511MessageParameterListOpt
1512 : MessageParameterList { $$ = $1; }
1513 | { $$ = NULL; }
1514 ;
1515
1516MessageParameterList
1517 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1518 ;
1519
1520MessageParameters
1521 : MessageParameterList { $$ = $1; }
1522 | Word { $$ = new(driver.pool_) CYMessageParameter($1, NULL, NULL); }
1523 ;
1524
1525ClassMessageDeclaration
1526 : MessageScope TypeOpt MessageParameters "{" FunctionBody "}" { $$ = new(driver.pool_) CYMessage($1, $2, $3, $5); }
1527 ;
1528
1529ClassMessageDeclarationListOpt
1530 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1531 | { $$ = NULL; }
1532 ;
1533
1534ClassName
1535 : Identifier { $$ = $1; }
1536 | "(" AssignmentExpression ")" { $$ = $2; }
1537 ;
1538
1539ClassNameOpt
1540 : ClassName { $$ = $1; }
1541 | { $$ = NULL; }
1542 ;
1543
1544ClassExpression
1545 : "@class" ClassNameOpt ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5); }
1546 ;
1547
1548ClassStatement
1549 : "@class" ClassName ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5); }
1550 ;
1551
1552CategoryStatement
1553 : "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $3); }
1554 ;
1555
1556PrimaryExpressionBF
1557 : ClassExpression { $$ = $1; }
1558 ;
1559
1560Statement_
1561 : ClassStatement { $$ = $1; }
1562 | CategoryStatement { $$ = $1; }
1563 ;
1564/* }}} */
1565/* Cycript (Objective-C): Send Message {{{ */
1566VariadicCall
1567 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1568 | { $$ = NULL; }
1569 ;
1570
1571SelectorCall_
1572 : SelectorCall { $$ = $1; }
1573 | VariadicCall { $$ = $1; }
1574 ;
1575
1576SelectorCall
1577 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1578 ;
1579
1580SelectorList
1581 : SelectorCall { $$ = $1; }
1582 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1583 ;
1584
1585MessageExpression
1586 : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYSendDirect($2, $3); }
1587 | "[" LexSetRegExp "super" SelectorList "]" { $$ = new(driver.pool_) CYSendSuper($4); }
1588 ;
1589
1590SelectorExpressionOpt
1591 : SelectorExpression_ { $$ = $1; }
1592 | { $$ = NULL; }
1593 ;
1594
1595SelectorExpression_
1596 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
1597 ;
1598
1599SelectorExpression
1600 : SelectorExpression_ { $$ = $1; }
1601 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
1602 ;
1603
1604PrimaryExpressionNo
1605 : MessageExpression { $$ = $1; }
1606 | "@selector" "(" SelectorExpression ")" { $$ = new(driver.pool_) CYSelector($3); }
1607 ;
1608/* }}} */
1609@end
1610
1611@begin C
1612/* Cycript (C): Pointer Indirection/Addressing {{{ */
1613UnaryAssigneeExpression
1614 : "*" UnaryExpressionNoRE { $$ = new(driver.pool_) CYIndirect($2); }
1615 ;
1616
1617UnaryExpression_
1618 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }
1619 ;
1620
1621MemberAccess
1622 : "->" "[" Expression "]" { $$ = new(driver.pool_) CYIndirectMember(NULL, $3); }
1623 | "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
1624 ;
1625/* }}} */
1626@end
1627
1628/* YUI: Documentation Comments {{{ */
1629Statement_
1630 : Comment { $$ = $1; }
1631 ;
1632/* }}} */
1633
1634@begin E4X
1635/* Lexer State {{{ */
1636LexPushRegExp
1637 : { driver.PushCondition(CYDriver::RegExpCondition); }
1638 ;
1639
1640LexPushXMLContent
1641 : { driver.PushCondition(CYDriver::XMLContentCondition); }
1642 ;
1643
1644LexPushXMLTag
1645 : { driver.PushCondition(CYDriver::XMLTagCondition); }
1646 ;
1647
1648LexPop
1649 : { driver.PopCondition(); }
1650 ;
1651
1652LexSetXMLContent
1653 : { driver.SetCondition(CYDriver::XMLContentCondition); }
1654 ;
1655
1656LexSetXMLTag
1657 : { driver.SetCondition(CYDriver::XMLTagCondition); }
1658 ;
1659/* }}} */
1660
1661XMLWhitespaceOpt
1662 : XMLWhitespace
1663 |
1664 ;
1665
1666/* 8.1 Context Keywords {{{ */
1667Identifier
1668 : "namespace" { $$ = $1; }
1669 | "xml" { $$ = $1; }
1670 ;
1671/* }}} */
1672/* 8.3 XML Initialiser Input Elements {{{ */
1673XMLMarkup
1674 : XMLComment { $$ = $1; }
1675 | XMLCDATA { $$ = $1; }
1676 | XMLPI { $$ = $1; }
1677 ;
1678/* }}} */
1679/* 11.1 Primary Expressions {{{ */
1680PrimaryExpressionNo
1681 : PropertyIdentifier { $$ = new(driver.pool_) CYPropertyVariable($1); }
1682 | XMLInitialiser { $$ = $1; }
1683 | XMLListInitialiser { $$ = $1; }
1684 ;
1685
1686PropertyIdentifier
1687 : AttributeIdentifier { $$ = $1; }
1688 | QualifiedIdentifier { $$ = $1; }
1689 | WildcardIdentifier { $$ = $1; }
1690 ;
1691/* }}} */
1692/* 11.1.1 Attribute Identifiers {{{ */
1693AttributeIdentifier
1694 : "@" QualifiedIdentifier_ { $$ = new(driver.pool_) CYAttribute($2); }
1695 ;
1696
1697PropertySelector_
1698 : PropertySelector { $$ = $1; }
1699 | "[" Expression "]" { $$ = new(driver.pool_) CYSelector($2); }
1700 ;
1701
1702PropertySelector
1703 : Identifier { $$ = new(driver.pool_) CYSelector($1); }
1704 | WildcardIdentifier { $$ = $1; }
1705 ;
1706/* }}} */
1707/* 11.1.2 Qualified Identifiers {{{ */
1708QualifiedIdentifier_
1709 : PropertySelector_ { $$ = new(driver.pool_) CYQualified(NULL, $1); }
1710 | QualifiedIdentifier { $$ = $1; }
1711 ;
1712
1713QualifiedIdentifier
1714 : PropertySelector "::" PropertySelector_ { $$ = new(driver.pool_) CYQualified($1, $3); }
1715 ;
1716/* }}} */
1717/* 11.1.3 Wildcard Identifiers {{{ */
1718WildcardIdentifier
1719 : "*" { $$ = new(driver.pool_) CYWildcard(); }
1720 ;
1721/* }}} */
1722/* 11.1.4 XML Initialiser {{{ */
1723XMLInitialiser
1724 : XMLMarkup { $$ = $1; }
1725 | XMLElement { $$ = $1; }
1726 ;
1727
1728XMLElement
1729 : "<" XMLTagContent "/>" LexPop
1730 | "<" XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt ">" LexPop
1731 ;
1732
1733XMLTagContent
1734 : LexPushXMLTag XMLTagName XMLAttributes
1735 ;
1736
1737XMLExpression
1738 : "{" LexPushRegExp Expression "}" LexPop
1739 ;
1740
1741XMLTagName
1742 : XMLExpression
1743 | XMLName
1744 ;
1745
1746XMLAttributes_
1747 : XMLAttributes_ XMLAttribute
1748 |
1749 ;
1750
1751XMLAttributes
1752 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
1753 | XMLAttributes_ XMLWhitespaceOpt
1754 ;
1755
1756XMLAttributeValue_
1757 : XMLExpression
1758 | XMLAttributeValue
1759 ;
1760
1761XMLAttribute
1762 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
1763 ;
1764
1765XMLElementContent
1766 : XMLExpression XMLElementContentOpt
1767 | XMLMarkup XMLElementContentOpt
1768 | XMLText XMLElementContentOpt
1769 | XMLElement XMLElementContentOpt
1770 ;
1771
1772XMLElementContentOpt
1773 : XMLElementContent
1774 |
1775 ;
1776/* }}} */
1777/* 11.1.5 XMLList Initialiser {{{ */
1778XMLListInitialiser
1779 : "<>" LexPushXMLContent XMLElementContent "</>" LexPop { $$ = new(driver.pool_) CYXMLList($3); }
1780 ;
1781/* }}} */
1782/* 11.2 Left-Hand-Side Expressions {{{ */
1783PropertyIdentifier_
1784 : Identifier { $$ = $1; }
1785 | PropertyIdentifier { $$ = $1; }
1786 ;
1787
1788MemberAccess
1789 : "." PropertyIdentifier { $$ = new(driver.pool_) CYPropertyMember(NULL, $2); }
1790 | ".." PropertyIdentifier_ { $$ = new(driver.pool_) CYDescendantMember(NULL, $2); }
1791 | "." "(" Expression ")" { $$ = new(driver.pool_) CYFilteringPredicate(NULL, $3); }
1792 ;
1793/* }}} */
1794/* 12.1 The default xml namespace Statement {{{ */
1795/* XXX: DefaultXMLNamespaceStatement
1796 : "default" "xml" "namespace" "=" Expression Terminator { $$ = new(driver.pool_) CYDefaultXMLNamespace($5); }
1797 ;
1798
1799Statement_
1800 : DefaultXMLNamespaceStatement { $$ = $1; }
1801 ; */
1802/* }}} */
1803@end
1804
1805/* ECMAScript5: Object Literal Trailing Comma {{{ */
1806PropertyNameAndValueList_
1807 : "," { $$ = NULL; }
1808 ;
1809/* }}} */
1810/* JavaScript 1.7: Array Comprehensions {{{ */
1811IfComprehension
1812 : "if" "(" Expression ")" { $$ = new(driver.pool_) CYIfComprehension($3); }
1813 ;
1814
1815ForComprehension
1816 : "for" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForInComprehension($3, $5); }
1817 | "for" "each" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForEachInComprehension($4, $6); }
1818 ;
1819
1820ComprehensionListOpt
1821 : ComprehensionList { $$ = $1; }
1822 | IfComprehension { $$ = $1; }
1823 | { $$ = NULL; }
1824 ;
1825
1826ComprehensionList
1827 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1828 ;
1829
1830PrimaryExpressionNo
1831 : "[" AssignmentExpression ComprehensionList "]" { $$ = new(driver.pool_) CYArrayComprehension($2, $3); }
1832 ;
1833/* }}} */
1834/* JavaScript 1.7: for each {{{ */
1835ForInStatement
1836 : "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForEachIn($4, $6, $8); }
1837 ;
1838/* }}} */
1839/* JavaScript 1.7: let Statements {{{ *//*
1840LetStatement
1841 : "let" "(" VariableDeclarationList ")" Block_ { $$ = new(driver.pool_) CYLet($3, $5); }
1842 ;
1843
1844Statement_
1845 : LetStatement
1846 ;
1847*//* }}} */
1848/* JavaScript FTW: Function Statements {{{ */
1849Statement
1850 : LexSetRegExp FunctionDeclaration { driver.Warning(yylloc, "warning, FunctionDeclaration is a SourceElement, not a Statement"); } { $$ = $2; }
1851 ;
1852/* }}} */
1853
1854%%