]> git.saurik.com Git - cycript.git/blame - Cycript.y
Made drastic changes to the serializer in order to support correctly serializing...
[cycript.git] / Cycript.y
CommitLineData
b4aa79af
JF
1/* Cycript - Remove Execution Server and Disassembler
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
1dbba6cc 40%code top {
63b4c5a8 41#include "Cycript.tab.hh"
5999c315 42#define scanner driver.scanner_
693d501b 43#define YYSTACKEXPANDABLE 1
1dbba6cc
JF
44}
45
63b4c5a8
JF
46%code requires {
47#include "Parser.hpp"
63b4c5a8 48
c3c20102
JF
49typedef struct {
50 bool newline_;
51
52 union {
b09da87b
JF
53 bool bool_;
54
63cd45c9
JF
55 CYDriver::Condition condition_;
56
c3c20102 57 CYArgument *argument_;
0ff9f149 58 CYAssignment *assignment_;
c3c20102
JF
59 CYBoolean *boolean_;
60 CYClause *clause_;
61 CYCatch *catch_;
e5bc40db 62 CYClassName *className_;
75b0a457 63 CYComprehension *comprehension_;
d35a3b07 64 CYCompound *compound_;
c3c20102
JF
65 CYDeclaration *declaration_;
66 CYDeclarations *declarations_;
67 CYElement *element_;
68 CYExpression *expression_;
69 CYFalse *false_;
b09da87b 70 CYField *field_;
b10bd496 71 CYFinally *finally_;
c3c20102
JF
72 CYForInitialiser *for_;
73 CYForInInitialiser *forin_;
b09da87b 74 CYFunctionParameter *functionParameter_;
c3c20102 75 CYIdentifier *identifier_;
0ff9f149 76 CYInfix *infix_;
c3c20102 77 CYLiteral *literal_;
9b5527f0 78 CYMember *member_;
b09da87b
JF
79 CYMessage *message_;
80 CYMessageParameter *messageParameter_;
c3c20102
JF
81 CYNull *null_;
82 CYNumber *number_;
c3c20102 83 CYProperty *property_;
e5bc40db 84 CYPropertyName *propertyName_;
62014ea9 85 CYSelectorPart *selector_;
c3c20102
JF
86 CYStatement *statement_;
87 CYString *string_;
88 CYThis *this_;
89 CYTrue *true_;
90 CYWord *word_;
91 };
92} YYSTYPE;
93
63b4c5a8
JF
94}
95
693d501b
JF
96%code provides {
97int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner);
98}
99
1dbba6cc 100%name-prefix "cy"
e5332278 101
63b4c5a8 102%language "C++"
e5332278 103%locations
1dbba6cc 104
5999c315
JF
105%initial-action {
106 @$.begin.filename = @$.end.filename = &driver.filename_;
107};
108
e5332278 109%defines
1dbba6cc 110
534fb6da
JF
111//%glr-parser
112//%expect 1
cac61857 113
e5332278
JF
114%error-verbose
115
5999c315 116%parse-param { CYDriver &driver }
924f67b2 117%lex-param { void *scanner }
e5332278 118
63b4c5a8
JF
119%token Ampersand "&"
120%token AmpersandAmpersand "&&"
121%token AmpersandEqual "&="
122%token Carrot "^"
123%token CarrotEqual "^="
124%token Equal "="
125%token EqualEqual "=="
126%token EqualEqualEqual "==="
127%token Exclamation "!"
128%token ExclamationEqual "!="
129%token ExclamationEqualEqual "!=="
130%token Hyphen "-"
131%token HyphenEqual "-="
132%token HyphenHyphen "--"
c3c20102 133%token HyphenHyphen_ "\n--"
63b4c5a8
JF
134%token HyphenRight "->"
135%token Left "<"
136%token LeftEqual "<="
137%token LeftLeft "<<"
138%token LeftLeftEqual "<<="
139%token Percent "%"
140%token PercentEqual "%="
141%token Period "."
142%token Pipe "|"
143%token PipeEqual "|="
144%token PipePipe "||"
145%token Plus "+"
146%token PlusEqual "+="
147%token PlusPlus "++"
c3c20102 148%token PlusPlus_ "\n++"
63b4c5a8
JF
149%token Right ">"
150%token RightEqual ">="
151%token RightRight ">>"
152%token RightRightEqual ">>="
153%token RightRightRight ">>>"
154%token RightRightRightEqual ">>>="
155%token Slash "/"
156%token SlashEqual "/="
157%token Star "*"
158%token StarEqual "*="
159%token Tilde "~"
160
161%token Colon ":"
162%token Comma ","
163%token Question "?"
164%token SemiColon ";"
c3c20102 165%token NewLine "\n"
63b4c5a8
JF
166
167%token OpenParen "("
168%token CloseParen ")"
924f67b2 169
63b4c5a8
JF
170%token OpenBrace "{"
171%token CloseBrace "}"
924f67b2 172
63b4c5a8
JF
173%token OpenBracket "["
174%token CloseBracket "]"
175
b09da87b 176%token AtClass "@class"
e7ed5354 177%token AtSelector "@selector"
d35a3b07 178%token AtEnd "@end"
e7ed5354 179
534fb6da
JF
180%token <false_> False "false"
181%token <null_> Null "null"
182%token <true_> True "true"
183
184// ES3/ES5/WIE/JSC Reserved
cf7d4c69
JF
185%token <word_> Break "break"
186%token <word_> Case "case"
187%token <word_> Catch "catch"
188%token <word_> Continue "continue"
189%token <word_> Default "default"
190%token <word_> Delete "delete"
191%token <word_> Do "do"
192%token <word_> Else "else"
cf7d4c69
JF
193%token <word_> Finally "finally"
194%token <word_> For "for"
195%token <word_> Function "function"
196%token <word_> If "if"
197%token <word_> In "in"
198%token <word_> InstanceOf "instanceof"
199%token <word_> New "new"
cf7d4c69
JF
200%token <word_> Return "return"
201%token <word_> Switch "switch"
202%token <this_> This "this"
203%token <word_> Throw "throw"
cf7d4c69
JF
204%token <word_> Try "try"
205%token <word_> TypeOf "typeof"
206%token <word_> Var "var"
207%token <word_> Void "void"
208%token <word_> While "while"
209%token <word_> With "with"
63b4c5a8 210
534fb6da 211// ES3/IE6 Future, ES5/JSC Reserved
d35a3b07 212%token <word_> Debugger "debugger"
534fb6da
JF
213
214// ES3/ES5/IE6 Future, JSC Reserved
215%token <word_> Const "const"
216
217// ES3/ES5/IE6/JSC Future
218%token <word_> Class "class"
d35a3b07
JF
219%token <word_> Enum "enum"
220%token <word_> Export "export"
221%token <word_> Extends "extends"
d35a3b07 222%token <word_> Import "import"
d35a3b07 223%token <word_> Super "super"
d35a3b07 224
534fb6da
JF
225// ES3 Future, ES5 Strict Future
226%token <identifier_> Implements "implements"
227%token <identifier_> Interface "interface"
228%token <identifier_> Package "package"
229%token <identifier_> Private "private"
230%token <identifier_> Protected "protected"
231%token <identifier_> Public "public"
232%token <identifier_> Static "static"
233
234// ES3 Future
235%token <identifier_> Abstract "abstract"
236%token <identifier_> Boolean "boolean"
237%token <identifier_> Byte "byte"
238%token <identifier_> Char "char"
239%token <identifier_> Double "double"
240%token <identifier_> Final "final"
241%token <identifier_> Float "float"
242%token <identifier_> Goto "goto"
243%token <identifier_> Int "int"
244%token <identifier_> Long "long"
245%token <identifier_> Native "native"
246%token <identifier_> Short "short"
247%token <identifier_> Synchronized "synchronized"
248%token <identifier_> Throws "throws"
249%token <identifier_> Transient "transient"
250%token <identifier_> Volatile "volatile"
251
252// ES5 Strict
cac61857 253%token <identifier_> Let "let"
534fb6da
JF
254%token <identifier_> Yield "yield"
255
256// Woah?!
257%token <identifier_> Each "each"
75b0a457
JF
258
259%token <identifier_> Identifier_
63b4c5a8
JF
260%token <number_> NumericLiteral
261%token <string_> StringLiteral
63cd45c9 262%token <literal_> RegularExpressionLiteral
1dbba6cc 263
cf7d4c69 264%type <expression_> AdditiveExpression
693d501b 265%type <expression_> AdditiveExpressionNoBF
cf7d4c69
JF
266%type <argument_> ArgumentList
267%type <argument_> ArgumentList_
268%type <argument_> ArgumentListOpt
269%type <argument_> Arguments
270%type <literal_> ArrayLiteral
9b5527f0
JF
271%type <expression_> AssigneeExpression
272%type <expression_> AssigneeExpression_
273%type <expression_> AssigneeExpressionNoBF
cf7d4c69 274%type <expression_> AssignmentExpression
0ff9f149 275%type <assignment_> AssignmentExpression_
693d501b
JF
276%type <expression_> AssignmentExpressionNoBF
277%type <expression_> AssignmentExpressionNoIn
cf7d4c69 278%type <expression_> BitwiseANDExpression
693d501b
JF
279%type <expression_> BitwiseANDExpressionNoBF
280%type <expression_> BitwiseANDExpressionNoIn
cf7d4c69 281%type <statement_> Block
cac61857 282%type <statement_> Block_
cf7d4c69
JF
283%type <boolean_> BooleanLiteral
284%type <expression_> BitwiseORExpression
693d501b
JF
285%type <expression_> BitwiseORExpressionNoBF
286%type <expression_> BitwiseORExpressionNoIn
cf7d4c69 287%type <expression_> BitwiseXORExpression
693d501b
JF
288%type <expression_> BitwiseXORExpressionNoBF
289%type <expression_> BitwiseXORExpressionNoIn
cf7d4c69
JF
290%type <statement_> BreakStatement
291%type <expression_> CallExpression
693d501b 292%type <expression_> CallExpressionNoBF
cf7d4c69
JF
293%type <clause_> CaseBlock
294%type <clause_> CaseClause
295%type <clause_> CaseClausesOpt
296%type <catch_> CatchOpt
367eebb1 297%type <statement_> CategoryStatement
fb98ac0c 298%type <expression_> ClassExpression
b09da87b
JF
299%type <message_> ClassMessageDeclaration
300%type <message_> ClassMessageDeclarationListOpt
e5bc40db 301%type <className_> ClassName
367eebb1 302%type <className_> ClassNameOpt
fb98ac0c 303%type <statement_> ClassStatement
b09da87b
JF
304%type <expression_> ClassSuperOpt
305%type <field_> ClassFieldList
75b0a457
JF
306%type <comprehension_> ComprehensionList
307%type <comprehension_> ComprehensionListOpt
cf7d4c69 308%type <expression_> ConditionalExpression
693d501b
JF
309%type <expression_> ConditionalExpressionNoBF
310%type <expression_> ConditionalExpressionNoIn
cf7d4c69
JF
311%type <statement_> ContinueStatement
312%type <clause_> DefaultClause
313%type <statement_> DoWhileStatement
314%type <expression_> Element
5befe15e 315%type <expression_> ElementOpt
cf7d4c69 316%type <element_> ElementList
5befe15e 317%type <element_> ElementListOpt
cf7d4c69
JF
318%type <statement_> ElseStatementOpt
319%type <statement_> EmptyStatement
320%type <expression_> EqualityExpression
693d501b
JF
321%type <expression_> EqualityExpressionNoBF
322%type <expression_> EqualityExpressionNoIn
cf7d4c69 323%type <expression_> Expression
cf7d4c69 324%type <expression_> ExpressionOpt
d35a3b07 325%type <compound_> Expression_
693d501b
JF
326%type <expression_> ExpressionNoBF
327%type <expression_> ExpressionNoIn
d35a3b07 328%type <compound_> ExpressionNoIn_
693d501b 329%type <expression_> ExpressionNoInOpt
cf7d4c69 330%type <statement_> ExpressionStatement
b10bd496 331%type <finally_> FinallyOpt
75b0a457 332%type <comprehension_> ForComprehension
cf7d4c69
JF
333%type <statement_> ForStatement
334%type <for_> ForStatementInitialiser
335%type <statement_> ForInStatement
336%type <forin_> ForInStatementInitialiser
b09da87b
JF
337%type <functionParameter_> FormalParameterList
338%type <functionParameter_> FormalParameterList_
b10bd496
JF
339%type <statement_> FunctionBody
340%type <statement_> FunctionDeclaration
cf7d4c69 341%type <expression_> FunctionExpression
75b0a457 342%type <identifier_> Identifier
cf7d4c69 343%type <identifier_> IdentifierOpt
75b0a457 344%type <comprehension_> IfComprehension
cf7d4c69
JF
345%type <statement_> IfStatement
346%type <expression_> Initialiser
347%type <expression_> InitialiserOpt
693d501b
JF
348%type <expression_> InitialiserNoIn
349%type <expression_> InitialiserNoInOpt
cf7d4c69
JF
350%type <statement_> IterationStatement
351%type <statement_> LabelledStatement
352%type <expression_> LeftHandSideExpression
693d501b 353%type <expression_> LeftHandSideExpressionNoBF
534fb6da 354//%type <statement_> LetStatement
cf7d4c69
JF
355%type <literal_> Literal
356%type <expression_> LogicalANDExpression
693d501b
JF
357%type <expression_> LogicalANDExpressionNoBF
358%type <expression_> LogicalANDExpressionNoIn
cf7d4c69 359%type <expression_> LogicalORExpression
693d501b
JF
360%type <expression_> LogicalORExpressionNoBF
361%type <expression_> LogicalORExpressionNoIn
9b5527f0 362%type <member_> MemberAccess
cf7d4c69 363%type <expression_> MemberExpression
693d501b
JF
364%type <expression_> MemberExpression_
365%type <expression_> MemberExpressionNoBF
b09da87b
JF
366%type <messageParameter_> MessageParameter
367%type <messageParameter_> MessageParameters
368%type <messageParameter_> MessageParameterList
369%type <messageParameter_> MessageParameterListOpt
370%type <bool_> MessageScope
cf7d4c69 371%type <expression_> MultiplicativeExpression
693d501b 372%type <expression_> MultiplicativeExpressionNoBF
cf7d4c69 373%type <expression_> NewExpression
693d501b
JF
374%type <expression_> NewExpression_
375%type <expression_> NewExpressionNoBF
cf7d4c69
JF
376%type <null_> NullLiteral
377%type <literal_> ObjectLiteral
cf7d4c69 378%type <expression_> PostfixExpression
693d501b 379%type <expression_> PostfixExpressionNoBF
cf7d4c69 380%type <expression_> PrimaryExpression
693d501b
JF
381%type <expression_> PrimaryExpression_
382%type <expression_> PrimaryExpressionNoBF
b10bd496 383%type <statement_> Program
e5bc40db 384%type <propertyName_> PropertyName
cf7d4c69
JF
385%type <property_> PropertyNameAndValueList
386%type <property_> PropertyNameAndValueList_
387%type <property_> PropertyNameAndValueListOpt
63cd45c9
JF
388%type <literal_> RegularExpressionLiteral_
389%type <condition_> RegularExpressionToken
cf7d4c69 390%type <expression_> RelationalExpression
0ff9f149 391%type <infix_> RelationalExpression_
693d501b
JF
392%type <expression_> RelationalExpressionNoBF
393%type <expression_> RelationalExpressionNoIn
0ff9f149 394%type <infix_> RelationalExpressionNoIn_
cf7d4c69 395%type <statement_> ReturnStatement
e7ed5354
JF
396%type <selector_> SelectorExpression
397%type <selector_> SelectorExpression_
398%type <selector_> SelectorExpressionOpt
cf7d4c69 399%type <expression_> ShiftExpression
693d501b 400%type <expression_> ShiftExpressionNoBF
b10bd496
JF
401%type <statement_> SourceElement
402%type <statement_> SourceElements
cf7d4c69 403%type <statement_> Statement
b10bd496 404%type <statement_> Statement_
693d501b 405%type <statement_> StatementList
cf7d4c69
JF
406%type <statement_> StatementListOpt
407%type <statement_> SwitchStatement
408%type <statement_> ThrowStatement
409%type <statement_> TryStatement
b09da87b 410%type <expression_> TypeOpt
cf7d4c69 411%type <expression_> UnaryExpression
693d501b
JF
412%type <expression_> UnaryExpression_
413%type <expression_> UnaryExpressionNoBF
cf7d4c69 414%type <declaration_> VariableDeclaration
693d501b 415%type <declaration_> VariableDeclarationNoIn
cf7d4c69
JF
416%type <declarations_> VariableDeclarationList
417%type <declarations_> VariableDeclarationList_
693d501b
JF
418%type <declarations_> VariableDeclarationListNoIn
419%type <declarations_> VariableDeclarationListNoIn_
cf7d4c69 420%type <statement_> VariableStatement
cf7d4c69
JF
421%type <statement_> WhileStatement
422%type <statement_> WithStatement
423%type <word_> Word
424%type <word_> WordOpt
425
693d501b
JF
426%type <expression_> MessageExpression
427%type <argument_> SelectorCall
428%type <argument_> SelectorCall_
429%type <argument_> SelectorList
430%type <argument_> VariadicCall
431
cde525f7
JF
432%left "*" "/" "%"
433%left "+" "-"
434%left "<<" ">>" ">>>"
435%left "<" ">" "<=" ">=" "instanceof" "in"
436%left "==" "!=" "===" "!=="
437%left "&"
438%left "^"
439%left "|"
440%left "&&"
441%left "||"
442
443%right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
444
c3c20102
JF
445%nonassoc "if"
446%nonassoc "else"
447
693d501b 448%start Program
e5332278 449
693d501b 450%%
c3c20102 451
b10bd496
JF
452StrictSemi
453 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
454 ;
455
456Terminator_
c3c20102 457 : ";"
b10bd496
JF
458 | "\n" StrictSemi
459 ;
460
461TerminatorOpt
462 : Terminator_
463 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
c3c20102
JF
464 ;
465
466Terminator
b10bd496
JF
467 : Terminator_
468 | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
c3c20102
JF
469 ;
470
cac61857 471/*CommaOpt
693d501b
JF
472 : ","
473 |
cac61857 474 ;*/
693d501b 475
c3c20102 476NewLineOpt
693d501b 477 : "\n"
c3c20102
JF
478 |
479 ;
1dbba6cc 480
36cd3cb9 481WordOpt
cf7d4c69
JF
482 : Word { $$ = $1; }
483 | { $$ = NULL; }
2bf24581
JF
484 ;
485
36cd3cb9 486Word
cf7d4c69 487 : Identifier { $$ = $1; }
c3c20102 488 | "break" NewLineOpt { $$ = $1; }
cf7d4c69
JF
489 | "case" { $$ = $1; }
490 | "catch" { $$ = $1; }
d35a3b07
JF
491 | "class" { $$ = $1; }
492 | "const" { $$ = $1; }
c3c20102 493 | "continue" NewLineOpt { $$ = $1; }
d35a3b07 494 | "debugger" { $$ = $1; }
cf7d4c69
JF
495 | "default" { $$ = $1; }
496 | "delete" { $$ = $1; }
497 | "do" { $$ = $1; }
498 | "else" { $$ = $1; }
d35a3b07
JF
499 | "enum" { $$ = $1; }
500 | "export" { $$ = $1; }
501 | "extends" { $$ = $1; }
cf7d4c69
JF
502 | "false" { $$ = $1; }
503 | "finally" { $$ = $1; }
504 | "for" { $$ = $1; }
505 | "function" { $$ = $1; }
506 | "if" { $$ = $1; }
d35a3b07 507 | "import" { $$ = $1; }
693d501b
JF
508 /* XXX: | "in" { $$ = $1; } */
509 /* XXX: | "instanceof" { $$ = $1; } */
cf7d4c69
JF
510 | "new" { $$ = $1; }
511 | "null" { $$ = $1; }
c3c20102 512 | "return" NewLineOpt { $$ = $1; }
d35a3b07 513 | "super" { $$ = $1; }
cf7d4c69
JF
514 | "switch" { $$ = $1; }
515 | "this" { $$ = $1; }
c3c20102 516 | "throw" NewLineOpt { $$ = $1; }
cf7d4c69
JF
517 | "true" { $$ = $1; }
518 | "try" { $$ = $1; }
519 | "typeof" { $$ = $1; }
520 | "var" { $$ = $1; }
521 | "void" { $$ = $1; }
522 | "while" { $$ = $1; }
523 | "with" { $$ = $1; }
2bf24581
JF
524 ;
525
75b0a457
JF
526Identifier
527 : Identifier_ { $$ = $1; }
534fb6da
JF
528
529 | "implements" { $$ = $1; }
530 | "interface" { $$ = $1; }
531 | "package" { $$ = $1; }
532 | "private" { $$ = $1; }
533 | "protected" { $$ = $1; }
534 | "public" { $$ = $1; }
535 | "static" { $$ = $1; }
536
537 | "abstract" { $$ = $1; }
538 | "boolean" { $$ = $1; }
539 | "byte" { $$ = $1; }
540 | "char" { $$ = $1; }
541 | "double" { $$ = $1; }
542 | "final" { $$ = $1; }
543 | "float" { $$ = $1; }
544 | "goto" { $$ = $1; }
545 | "int" { $$ = $1; }
546 | "long" { $$ = $1; }
547 | "native" { $$ = $1; }
548 | "short" { $$ = $1; }
549 | "synchronized" { $$ = $1; }
550 | "throws" { $$ = $1; }
551 | "transient" { $$ = $1; }
552 | "volatile" { $$ = $1; }
553
cac61857 554 | "let" { $$ = $1; }
534fb6da
JF
555 | "yield" { $$ = $1; }
556
557 | "each" { $$ = $1; }
75b0a457
JF
558 ;
559
36cd3cb9 560IdentifierOpt
cf7d4c69
JF
561 : Identifier { $$ = $1; }
562 | { $$ = NULL; }
1dbba6cc
JF
563 ;
564
63cd45c9
JF
565RegularExpressionToken
566 : "/" { $$ = CYDriver::RegExStart; }
567 | "/=" { $$ = CYDriver::RegExRest; }
568 ;
569
570RegularExpressionLiteral_
571 : RegularExpressionToken { driver.SetCondition($1); } RegularExpressionLiteral { $$ = $3; }
572 ;
573
36cd3cb9 574Literal
cf7d4c69
JF
575 : NullLiteral { $$ = $1; }
576 | BooleanLiteral { $$ = $1; }
577 | NumericLiteral { $$ = $1; }
578 | StringLiteral { $$ = $1; }
63cd45c9 579 | RegularExpressionLiteral_ { $$ = $1; }
1dbba6cc
JF
580 ;
581
36cd3cb9 582NullLiteral
cf7d4c69 583 : "null" { $$ = $1; }
1dbba6cc
JF
584 ;
585
36cd3cb9 586BooleanLiteral
cf7d4c69
JF
587 : "true" { $$ = $1; }
588 | "false" { $$ = $1; }
1dbba6cc
JF
589 ;
590
1dbba6cc 591/* 11.1 Primary Expressions {{{ */
693d501b 592PrimaryExpression_
cf7d4c69 593 : "this" { $$ = $1; }
b1ff2d78 594 | Identifier { $$ = new(driver.pool_) CYVariable($1); }
cf7d4c69
JF
595 | Literal { $$ = $1; }
596 | ArrayLiteral { $$ = $1; }
36cd3cb9 597 | "(" Expression ")" { $$ = $2; }
693d501b
JF
598 ;
599
600PrimaryExpression
601 : ObjectLiteral { $$ = $1; }
602 | PrimaryExpression_ { $$ = $1; }
603 ;
604
605PrimaryExpressionNoBF
606 : PrimaryExpression_ { $$ = $1; }
1dbba6cc
JF
607 ;
608/* }}} */
609/* 11.1.4 Array Initialiser {{{ */
36cd3cb9 610ArrayLiteral
d35a3b07 611 : "[" ElementListOpt "]" { $$ = new(driver.pool_) CYArray($2); }
1dbba6cc
JF
612 ;
613
36cd3cb9 614Element
cf7d4c69 615 : AssignmentExpression { $$ = $1; }
5befe15e
JF
616 ;
617
618ElementOpt
619 : Element { $$ = $1; }
cf7d4c69 620 | { $$ = NULL; }
1dbba6cc
JF
621 ;
622
5befe15e
JF
623ElementListOpt
624 : ElementList { $$ = $1; }
cf7d4c69 625 | { $$ = NULL; }
1dbba6cc
JF
626 ;
627
36cd3cb9 628ElementList
5befe15e
JF
629 : ElementOpt "," ElementListOpt { $$ = new(driver.pool_) CYElement($1, $3); }
630 | Element { $$ = new(driver.pool_) CYElement($1, NULL); }
1dbba6cc
JF
631 ;
632/* }}} */
633/* 11.1.5 Object Initialiser {{{ */
36cd3cb9 634ObjectLiteral
5befe15e 635 : "{" PropertyNameAndValueListOpt "}" { $$ = new(driver.pool_) CYObject($2); }
1dbba6cc
JF
636 ;
637
36cd3cb9 638PropertyNameAndValueList_
cf7d4c69 639 : "," PropertyNameAndValueList { $$ = $2; }
cac61857 640 | { $$ = NULL; }
1dbba6cc
JF
641 ;
642
36cd3cb9 643PropertyNameAndValueListOpt
cf7d4c69 644 : PropertyNameAndValueList { $$ = $1; }
36cd3cb9 645 | { $$ = NULL; }
1dbba6cc
JF
646 ;
647
36cd3cb9
JF
648PropertyNameAndValueList
649 : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); }
1dbba6cc
JF
650 ;
651
652PropertyName
36cd3cb9
JF
653 : Identifier { $$ = $1; }
654 | StringLiteral { $$ = $1; }
655 | NumericLiteral { $$ = $1; }
1dbba6cc
JF
656 ;
657/* }}} */
658
63cd45c9 659/* 11.2 Left-Hand-Side Expressions {{{ */
693d501b
JF
660MemberExpression_
661 : "new" MemberExpression Arguments { $$ = new(driver.pool_) CYNew($2, $3); }
662 ;
663
9b5527f0
JF
664MemberAccess
665 : "[" Expression "]" { $$ = new(driver.pool_) CYDirectMember(NULL, $2); }
666 | "." Identifier { $$ = new(driver.pool_) CYDirectMember(NULL, new(driver.pool_) CYString($2)); }
667 ;
668
36cd3cb9 669MemberExpression
cf7d4c69
JF
670 : PrimaryExpression { $$ = $1; }
671 | FunctionExpression { $$ = $1; }
9b5527f0 672 | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
693d501b
JF
673 | MemberExpression_ { $$ = $1; }
674 ;
675
676MemberExpressionNoBF
677 : PrimaryExpressionNoBF { $$ = $1; }
9b5527f0 678 | MemberExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
693d501b
JF
679 | MemberExpression_ { $$ = $1; }
680 ;
681
682NewExpression_
683 : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); }
1dbba6cc
JF
684 ;
685
36cd3cb9 686NewExpression
cf7d4c69 687 : MemberExpression { $$ = $1; }
693d501b
JF
688 | NewExpression_ { $$ = $1; }
689 ;
690
691NewExpressionNoBF
692 : MemberExpressionNoBF { $$ = $1; }
693 | NewExpression_ { $$ = $1; }
1dbba6cc
JF
694 ;
695
36cd3cb9 696CallExpression
b1ff2d78
JF
697 : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
698 | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
9b5527f0 699 | CallExpression MemberAccess { $2->SetLeft($1); $$ = $2; }
1dbba6cc
JF
700 ;
701
693d501b
JF
702CallExpressionNoBF
703 : MemberExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
704 | CallExpressionNoBF Arguments { $$ = new(driver.pool_) CYCall($1, $2); }
9b5527f0 705 | CallExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; }
693d501b
JF
706 ;
707
36cd3cb9 708ArgumentList_
cf7d4c69
JF
709 : "," ArgumentList { $$ = $2; }
710 | { $$ = NULL; }
1dbba6cc
JF
711 ;
712
36cd3cb9 713ArgumentListOpt
cf7d4c69 714 : ArgumentList { $$ = $1; }
36cd3cb9 715 | { $$ = NULL; }
1dbba6cc
JF
716 ;
717
36cd3cb9
JF
718ArgumentList
719 : AssignmentExpression ArgumentList_ { $$ = new(driver.pool_) CYArgument(NULL, $1, $2); }
1dbba6cc
JF
720 ;
721
722Arguments
36cd3cb9 723 : "(" ArgumentListOpt ")" { $$ = $2; }
1dbba6cc
JF
724 ;
725
36cd3cb9 726LeftHandSideExpression
cf7d4c69
JF
727 : NewExpression { $$ = $1; }
728 | CallExpression { $$ = $1; }
693d501b
JF
729 ;
730
731LeftHandSideExpressionNoBF
732 : NewExpressionNoBF { $$ = $1; }
733 | CallExpressionNoBF { $$ = $1; }
1dbba6cc 734 ;
63cd45c9
JF
735/* }}} */
736/* 11.3 Postfix Expressions {{{ */
36cd3cb9 737PostfixExpression
9b5527f0 738 : AssigneeExpression { $$ = $1; }
b1ff2d78
JF
739 | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
740 | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
1dbba6cc
JF
741 ;
742
693d501b 743PostfixExpressionNoBF
9b5527f0 744 : AssigneeExpressionNoBF { $$ = $1; }
693d501b
JF
745 | LeftHandSideExpressionNoBF "++" { $$ = new(driver.pool_) CYPostIncrement($1); }
746 | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); }
747 ;
63cd45c9
JF
748/* }}} */
749/* 11.4 Unary Operators {{{ */
693d501b
JF
750UnaryExpression_
751 : "delete" UnaryExpression { $$ = new(driver.pool_) CYDelete($2); }
36cd3cb9
JF
752 | "void" UnaryExpression { $$ = new(driver.pool_) CYVoid($2); }
753 | "typeof" UnaryExpression { $$ = new(driver.pool_) CYTypeOf($2); }
754 | "++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
755 | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
756 | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
757 | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
758 | "+" UnaryExpression { $$ = $2; }
759 | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
760 | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
761 | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
693d501b
JF
762 ;
763
764UnaryExpression
765 : PostfixExpression { $$ = $1; }
766 | UnaryExpression_ { $$ = $1; }
767 ;
768
769UnaryExpressionNoBF
770 : PostfixExpressionNoBF { $$ = $1; }
771 | UnaryExpression_ { $$ = $1; }
1dbba6cc 772 ;
63cd45c9
JF
773/* }}} */
774/* 11.5 Multiplicative Operators {{{ */
36cd3cb9 775MultiplicativeExpression
cf7d4c69 776 : UnaryExpression { $$ = $1; }
36cd3cb9
JF
777 | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
778 | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
779 | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
1dbba6cc
JF
780 ;
781
693d501b
JF
782MultiplicativeExpressionNoBF
783 : UnaryExpressionNoBF { $$ = $1; }
784 | MultiplicativeExpressionNoBF "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); }
785 | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); }
786 | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); }
787 ;
63cd45c9
JF
788/* }}} */
789/* 11.6 Additive Operators {{{ */
36cd3cb9 790AdditiveExpression
cf7d4c69 791 : MultiplicativeExpression { $$ = $1; }
36cd3cb9
JF
792 | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
793 | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
1dbba6cc
JF
794 ;
795
693d501b
JF
796AdditiveExpressionNoBF
797 : MultiplicativeExpressionNoBF { $$ = $1; }
798 | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); }
799 | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); }
800 ;
63cd45c9
JF
801/* }}} */
802/* 11.7 Bitwise Shift Operators {{{ */
36cd3cb9 803ShiftExpression
cf7d4c69 804 : AdditiveExpression { $$ = $1; }
36cd3cb9
JF
805 | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
806 | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
807 | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
1dbba6cc
JF
808 ;
809
693d501b
JF
810ShiftExpressionNoBF
811 : AdditiveExpressionNoBF { $$ = $1; }
812 | ShiftExpressionNoBF "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); }
813 | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); }
814 | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); }
815 ;
63cd45c9
JF
816/* }}} */
817/* 11.8 Relational Operators {{{ */
0ff9f149
JF
818RelationalExpressionNoIn_
819 : "<" ShiftExpression { $$ = new(driver.pool_) CYLess(NULL, $2); }
820 | ">" ShiftExpression { $$ = new(driver.pool_) CYGreater(NULL, $2); }
821 | "<=" ShiftExpression { $$ = new(driver.pool_) CYLessOrEqual(NULL, $2); }
822 | ">=" ShiftExpression { $$ = new(driver.pool_) CYGreaterOrEqual(NULL, $2); }
823 | "instanceof" ShiftExpression { $$ = new(driver.pool_) CYInstanceOf(NULL, $2); }
824 ;
825
826RelationalExpression_
827 : RelationalExpressionNoIn_ { $$ = $1; }
828 | "in" ShiftExpression { $$ = new(driver.pool_) CYIn(NULL, $2); }
829 ;
830
36cd3cb9 831RelationalExpression
cf7d4c69 832 : ShiftExpression { $$ = $1; }
0ff9f149 833 | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
1dbba6cc
JF
834 ;
835
693d501b
JF
836RelationalExpressionNoIn
837 : ShiftExpression { $$ = $1; }
0ff9f149 838 | RelationalExpressionNoIn RelationalExpressionNoIn_ { $2->SetLeft($1); $$ = $2; }
693d501b
JF
839 ;
840
841RelationalExpressionNoBF
842 : ShiftExpressionNoBF { $$ = $1; }
0ff9f149 843 | RelationalExpressionNoBF RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
693d501b 844 ;
63cd45c9
JF
845/* }}} */
846/* 11.9 Equality Operators {{{ */
36cd3cb9 847EqualityExpression
cf7d4c69 848 : RelationalExpression { $$ = $1; }
36cd3cb9
JF
849 | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
850 | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
851 | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
852 | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
1dbba6cc
JF
853 ;
854
693d501b
JF
855EqualityExpressionNoIn
856 : RelationalExpressionNoIn { $$ = $1; }
857 | EqualityExpressionNoIn "==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYEqual($1, $3); }
858 | EqualityExpressionNoIn "!=" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotEqual($1, $3); }
859 | EqualityExpressionNoIn "===" RelationalExpressionNoIn { $$ = new(driver.pool_) CYIdentical($1, $3); }
860 | EqualityExpressionNoIn "!==" RelationalExpressionNoIn { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
861 ;
862
863EqualityExpressionNoBF
864 : RelationalExpressionNoBF { $$ = $1; }
865 | EqualityExpressionNoBF "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); }
866 | EqualityExpressionNoBF "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); }
867 | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); }
868 | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); }
869 ;
63cd45c9
JF
870/* }}} */
871/* 11.10 Binary Bitwise Operators {{{ */
36cd3cb9 872BitwiseANDExpression
cf7d4c69 873 : EqualityExpression { $$ = $1; }
36cd3cb9 874 | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
1dbba6cc
JF
875 ;
876
693d501b
JF
877BitwiseANDExpressionNoIn
878 : EqualityExpressionNoIn { $$ = $1; }
879 | BitwiseANDExpressionNoIn "&" EqualityExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
880 ;
881
882BitwiseANDExpressionNoBF
883 : EqualityExpressionNoBF { $$ = $1; }
884 | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); }
885 ;
886
36cd3cb9 887BitwiseXORExpression
cf7d4c69 888 : BitwiseANDExpression { $$ = $1; }
36cd3cb9 889 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
1dbba6cc
JF
890 ;
891
693d501b
JF
892BitwiseXORExpressionNoIn
893 : BitwiseANDExpressionNoIn { $$ = $1; }
894 | BitwiseXORExpressionNoIn "^" BitwiseANDExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
895 ;
896
897BitwiseXORExpressionNoBF
898 : BitwiseANDExpressionNoBF { $$ = $1; }
899 | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); }
900 ;
901
36cd3cb9 902BitwiseORExpression
cf7d4c69 903 : BitwiseXORExpression { $$ = $1; }
36cd3cb9 904 | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
1dbba6cc
JF
905 ;
906
693d501b
JF
907BitwiseORExpressionNoIn
908 : BitwiseXORExpressionNoIn { $$ = $1; }
909 | BitwiseORExpressionNoIn "|" BitwiseXORExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
910 ;
911
912BitwiseORExpressionNoBF
913 : BitwiseXORExpressionNoBF { $$ = $1; }
914 | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); }
915 ;
63cd45c9
JF
916/* }}} */
917/* 11.11 Binary Logical Operators {{{ */
36cd3cb9 918LogicalANDExpression
cf7d4c69 919 : BitwiseORExpression { $$ = $1; }
36cd3cb9 920 | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
1dbba6cc
JF
921 ;
922
693d501b
JF
923LogicalANDExpressionNoIn
924 : BitwiseORExpressionNoIn { $$ = $1; }
925 | LogicalANDExpressionNoIn "&&" BitwiseORExpressionNoIn { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
926 ;
927
928LogicalANDExpressionNoBF
929 : BitwiseORExpressionNoBF { $$ = $1; }
930 | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); }
931 ;
932
36cd3cb9 933LogicalORExpression
cf7d4c69 934 : LogicalANDExpression { $$ = $1; }
36cd3cb9 935 | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
1dbba6cc
JF
936 ;
937
693d501b
JF
938LogicalORExpressionNoIn
939 : LogicalANDExpressionNoIn { $$ = $1; }
940 | LogicalORExpressionNoIn "||" LogicalANDExpressionNoIn { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
941 ;
942
943LogicalORExpressionNoBF
944 : LogicalANDExpressionNoBF { $$ = $1; }
945 | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); }
946 ;
63cd45c9
JF
947/* }}} */
948/* 11.12 Conditional Operator ( ? : ) {{{ */
36cd3cb9 949ConditionalExpression
cf7d4c69 950 : LogicalORExpression { $$ = $1; }
36cd3cb9 951 | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
1dbba6cc
JF
952 ;
953
693d501b
JF
954ConditionalExpressionNoIn
955 : LogicalORExpressionNoIn { $$ = $1; }
956 | LogicalORExpressionNoIn "?" AssignmentExpression ":" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
957 ;
958
959ConditionalExpressionNoBF
960 : LogicalORExpressionNoBF { $$ = $1; }
961 | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); }
962 ;
63cd45c9
JF
963/* }}} */
964/* 11.13 Assignment Operators {{{ */
0ff9f149
JF
965AssignmentExpression_
966 : "=" AssignmentExpression { $$ = new(driver.pool_) CYAssign(NULL, $2); }
967 | "*=" AssignmentExpression { $$ = new(driver.pool_) CYMultiplyAssign(NULL, $2); }
968 | "/=" AssignmentExpression { $$ = new(driver.pool_) CYDivideAssign(NULL, $2); }
969 | "%=" AssignmentExpression { $$ = new(driver.pool_) CYModulusAssign(NULL, $2); }
970 | "+=" AssignmentExpression { $$ = new(driver.pool_) CYAddAssign(NULL, $2); }
971 | "-=" AssignmentExpression { $$ = new(driver.pool_) CYSubtractAssign(NULL, $2); }
972 | "<<=" AssignmentExpression { $$ = new(driver.pool_) CYShiftLeftAssign(NULL, $2); }
973 | ">>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightSignedAssign(NULL, $2); }
974 | ">>>=" AssignmentExpression { $$ = new(driver.pool_) CYShiftRightUnsignedAssign(NULL, $2); }
975 | "&=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseAndAssign(NULL, $2); }
976 | "^=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseXOrAssign(NULL, $2); }
977 | "|=" AssignmentExpression { $$ = new(driver.pool_) CYBitwiseOrAssign(NULL, $2); }
978 ;
979
9b5527f0
JF
980AssigneeExpression
981 : LeftHandSideExpression { $$ = $1; }
982 | AssigneeExpression_ { $$ = $1; }
983 ;
984
985AssigneeExpressionNoBF
986 : LeftHandSideExpressionNoBF { $$ = $1; }
987 | AssigneeExpression_ { $$ = $1; }
988 ;
989
36cd3cb9 990AssignmentExpression
cf7d4c69 991 : ConditionalExpression { $$ = $1; }
9b5527f0 992 | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
36cd3cb9
JF
993 ;
994
693d501b
JF
995AssignmentExpressionNoIn
996 : ConditionalExpressionNoIn { $$ = $1; }
9b5527f0
JF
997 | AssigneeExpression "=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAssign($1, $3); }
998 | AssigneeExpression "*=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYMultiplyAssign($1, $3); }
999 | AssigneeExpression "/=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYDivideAssign($1, $3); }
1000 | AssigneeExpression "%=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYModulusAssign($1, $3); }
1001 | AssigneeExpression "+=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYAddAssign($1, $3); }
1002 | AssigneeExpression "-=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYSubtractAssign($1, $3); }
1003 | AssigneeExpression "<<=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftLeftAssign($1, $3); }
1004 | AssigneeExpression ">>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightSignedAssign($1, $3); }
1005 | AssigneeExpression ">>>=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYShiftRightUnsignedAssign($1, $3); }
1006 | AssigneeExpression "&=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseAndAssign($1, $3); }
1007 | AssigneeExpression "^=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseXOrAssign($1, $3); }
1008 | AssigneeExpression "|=" AssignmentExpressionNoIn { $$ = new(driver.pool_) CYBitwiseOrAssign($1, $3); }
693d501b
JF
1009 ;
1010
1011AssignmentExpressionNoBF
1012 : ConditionalExpressionNoBF { $$ = $1; }
9b5527f0 1013 | AssigneeExpressionNoBF AssignmentExpression_ { $2->SetLeft($1); $$ = $2; }
693d501b 1014 ;
63cd45c9
JF
1015/* }}} */
1016/* 11.14 Comma Operator {{{ */
36cd3cb9 1017Expression_
d35a3b07 1018 : "," Expression { $$ = new(driver.pool_) CYCompound($2); }
cf7d4c69 1019 | { $$ = NULL; }
1dbba6cc
JF
1020 ;
1021
693d501b 1022ExpressionNoIn_
d35a3b07 1023 : "," ExpressionNoIn { $$ = new(driver.pool_) CYCompound($2); }
693d501b
JF
1024 | { $$ = NULL; }
1025 ;
1026
36cd3cb9 1027ExpressionOpt
cf7d4c69 1028 : Expression { $$ = $1; }
36cd3cb9 1029 | { $$ = NULL; }
1dbba6cc
JF
1030 ;
1031
693d501b
JF
1032ExpressionNoInOpt
1033 : ExpressionNoIn { $$ = $1; }
1034 | { $$ = NULL; }
1035 ;
1036
36cd3cb9 1037Expression
d35a3b07 1038 : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
1dbba6cc
JF
1039 ;
1040
693d501b 1041ExpressionNoIn
d35a3b07 1042 : AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
693d501b
JF
1043 ;
1044
1045ExpressionNoBF
d35a3b07 1046 : AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
693d501b 1047 ;
63cd45c9 1048/* }}} */
693d501b 1049
63cd45c9 1050/* 12 Statements {{{ */
b10bd496 1051Statement_
36cd3cb9
JF
1052 : Block { $$ = $1; }
1053 | VariableStatement { $$ = $1; }
1054 | EmptyStatement { $$ = $1; }
1055 | ExpressionStatement { $$ = $1; }
cf7d4c69
JF
1056 | IfStatement { $$ = $1; }
1057 | IterationStatement { $$ = $1; }
36cd3cb9
JF
1058 | ContinueStatement { $$ = $1; }
1059 | BreakStatement { $$ = $1; }
1060 | ReturnStatement { $$ = $1; }
cf7d4c69
JF
1061 | WithStatement { $$ = $1; }
1062 | LabelledStatement { $$ = $1; }
36cd3cb9
JF
1063 | SwitchStatement { $$ = $1; }
1064 | ThrowStatement { $$ = $1; }
1065 | TryStatement { $$ = $1; }
1dbba6cc 1066 ;
b10bd496
JF
1067
1068Statement
1069 : Statement_ { $$ = $1; }
1070 ;
63cd45c9
JF
1071/* }}} */
1072/* 12.1 Block {{{ */
cac61857
JF
1073Block_
1074 : "{" StatementListOpt "}" { $$ = $2; }
1075 ;
1076
36cd3cb9 1077Block
cac61857 1078 : Block_ { if ($1) $$ = new(driver.pool_) CYBlock($1); else $$ = new(driver.pool_) CYEmpty(); }
1dbba6cc
JF
1079 ;
1080
693d501b 1081StatementList
cf7d4c69 1082 : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
693d501b
JF
1083 ;
1084
1085StatementListOpt
1086 : StatementList { $$ = $1; }
cf7d4c69 1087 | { $$ = NULL; }
1dbba6cc 1088 ;
63cd45c9
JF
1089/* }}} */
1090/* 12.2 Variable Statement {{{ */
36cd3cb9 1091VariableStatement
cac61857 1092 : "var" VariableDeclarationList Terminator { $$ = new(driver.pool_) CYVar($2); }
1dbba6cc
JF
1093 ;
1094
36cd3cb9 1095VariableDeclarationList_
cf7d4c69
JF
1096 : "," VariableDeclarationList { $$ = $2; }
1097 | { $$ = NULL; }
1dbba6cc
JF
1098 ;
1099
693d501b
JF
1100VariableDeclarationListNoIn_
1101 : "," VariableDeclarationListNoIn { $$ = $2; }
1102 | { $$ = NULL; }
1103 ;
1104
36cd3cb9 1105VariableDeclarationList
b1ff2d78 1106 : VariableDeclaration VariableDeclarationList_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1dbba6cc
JF
1107 ;
1108
693d501b
JF
1109VariableDeclarationListNoIn
1110 : VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = new(driver.pool_) CYDeclarations($1, $2); }
1111 ;
1112
36cd3cb9
JF
1113VariableDeclaration
1114 : Identifier InitialiserOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1dbba6cc
JF
1115 ;
1116
693d501b
JF
1117VariableDeclarationNoIn
1118 : Identifier InitialiserNoInOpt { $$ = new(driver.pool_) CYDeclaration($1, $2); }
1119 ;
1120
36cd3cb9 1121InitialiserOpt
cf7d4c69 1122 : Initialiser { $$ = $1; }
36cd3cb9 1123 | { $$ = NULL; }
1dbba6cc
JF
1124 ;
1125
693d501b
JF
1126InitialiserNoInOpt
1127 : InitialiserNoIn { $$ = $1; }
1128 | { $$ = NULL; }
1129 ;
1130
36cd3cb9
JF
1131Initialiser
1132 : "=" AssignmentExpression { $$ = $2; }
1dbba6cc
JF
1133 ;
1134
693d501b
JF
1135InitialiserNoIn
1136 : "=" AssignmentExpressionNoIn { $$ = $2; }
1137 ;
63cd45c9
JF
1138/* }}} */
1139/* 12.3 Empty Statement {{{ */
36cd3cb9 1140EmptyStatement
b1ff2d78 1141 : ";" { $$ = new(driver.pool_) CYEmpty(); }
1dbba6cc 1142 ;
63cd45c9
JF
1143/* }}} */
1144/* 12.4 Expression Statement {{{ */
36cd3cb9 1145ExpressionStatement
693d501b 1146 : ExpressionNoBF Terminator { $$ = new(driver.pool_) CYExpress($1); }
1dbba6cc 1147 ;
63cd45c9
JF
1148/* }}} */
1149/* 12.5 The if Statement {{{ */
36cd3cb9
JF
1150ElseStatementOpt
1151 : "else" Statement { $$ = $2; }
c3c20102 1152 | %prec "if" { $$ = NULL; }
1dbba6cc
JF
1153 ;
1154
36cd3cb9
JF
1155IfStatement
1156 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = new(driver.pool_) CYIf($3, $5, $6); }
1dbba6cc 1157 ;
63cd45c9 1158/* }}} */
1dbba6cc 1159
63cd45c9 1160/* 12.6 Iteration Statements {{{ */
36cd3cb9
JF
1161IterationStatement
1162 : DoWhileStatement { $$ = $1; }
cf7d4c69
JF
1163 | WhileStatement { $$ = $1; }
1164 | ForStatement { $$ = $1; }
1165 | ForInStatement { $$ = $1; }
1dbba6cc 1166 ;
63cd45c9
JF
1167/* }}} */
1168/* 12.6.1 The do-while Statement {{{ */
36cd3cb9
JF
1169DoWhileStatement
1170 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = new(driver.pool_) CYDoWhile($5, $2); }
1dbba6cc 1171 ;
63cd45c9
JF
1172/* }}} */
1173/* 12.6.2 The while Statement {{{ */
36cd3cb9
JF
1174WhileStatement
1175 : "while" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWhile($3, $5); }
1dbba6cc 1176 ;
63cd45c9
JF
1177/* }}} */
1178/* 12.6.3 The for Statement {{{ */
36cd3cb9
JF
1179ForStatement
1180 : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = new(driver.pool_) CYFor($3, $5, $7, $9); }
1dbba6cc
JF
1181 ;
1182
36cd3cb9 1183ForStatementInitialiser
693d501b
JF
1184 : ExpressionNoInOpt { $$ = $1; }
1185 | "var" VariableDeclarationListNoIn { $$ = $2; }
1dbba6cc 1186 ;
63cd45c9
JF
1187/* }}} */
1188/* 12.6.4 The for-in Statement {{{ */
36cd3cb9
JF
1189ForInStatement
1190 : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForIn($3, $5, $7); }
1dbba6cc
JF
1191 ;
1192
36cd3cb9
JF
1193ForInStatementInitialiser
1194 : LeftHandSideExpression { $$ = $1; }
693d501b 1195 | "var" VariableDeclarationNoIn { $$ = $2; }
1dbba6cc 1196 ;
63cd45c9 1197/* }}} */
1dbba6cc 1198
63cd45c9 1199/* 12.7 The continue Statement {{{ */
36cd3cb9
JF
1200ContinueStatement
1201 : "continue" IdentifierOpt Terminator { $$ = new(driver.pool_) CYContinue($2); }
1dbba6cc 1202 ;
63cd45c9
JF
1203/* }}} */
1204/* 12.8 The break Statement {{{ */
36cd3cb9
JF
1205BreakStatement
1206 : "break" IdentifierOpt Terminator { $$ = new(driver.pool_) CYBreak($2); }
1dbba6cc 1207 ;
63cd45c9
JF
1208/* }}} */
1209/* 12.9 The return Statement {{{ */
36cd3cb9 1210ReturnStatement
c3c20102 1211 : "return" ExpressionOpt Terminator { $$ = new(driver.pool_) CYReturn($2); }
1dbba6cc 1212 ;
63cd45c9
JF
1213/* }}} */
1214/* 12.10 The with Statement {{{ */
36cd3cb9
JF
1215WithStatement
1216 : "with" "(" Expression ")" Statement { $$ = new(driver.pool_) CYWith($3, $5); }
1dbba6cc 1217 ;
63cd45c9 1218/* }}} */
1dbba6cc 1219
63cd45c9 1220/* 12.11 The switch Statement {{{ */
36cd3cb9
JF
1221SwitchStatement
1222 : "switch" "(" Expression ")" CaseBlock { $$ = new(driver.pool_) CYSwitch($3, $5); }
1dbba6cc
JF
1223 ;
1224
1225CaseBlock
36cd3cb9 1226 : "{" CaseClausesOpt "}" { $$ = $2; }
1dbba6cc
JF
1227 ;
1228
36cd3cb9 1229CaseClausesOpt
cf7d4c69
JF
1230 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1231 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1232 | { $$ = NULL; }
1dbba6cc
JF
1233 ;
1234
36cd3cb9
JF
1235CaseClause
1236 : "case" Expression ":" StatementListOpt { $$ = new(driver.pool_) CYClause($2, $4); }
1dbba6cc
JF
1237 ;
1238
36cd3cb9
JF
1239DefaultClause
1240 : "default" ":" StatementListOpt { $$ = new(driver.pool_) CYClause(NULL, $3); }
1dbba6cc 1241 ;
63cd45c9
JF
1242/* }}} */
1243/* 12.12 Labelled Statements {{{ */
36cd3cb9
JF
1244LabelledStatement
1245 : Identifier ":" Statement { $3->AddLabel($1); $$ = $3; }
1dbba6cc 1246 ;
63cd45c9
JF
1247/* }}} */
1248/* 12.13 The throw Statement {{{ */
36cd3cb9 1249ThrowStatement
c3c20102 1250 : "throw" Expression Terminator { $$ = new(driver.pool_) CYThrow($2); }
1dbba6cc 1251 ;
63cd45c9
JF
1252/* }}} */
1253/* 12.14 The try Statement {{{ */
36cd3cb9 1254TryStatement
cac61857 1255 : "try" Block_ CatchOpt FinallyOpt { $$ = new(driver.pool_) CYTry($2, $3, $4); }
1dbba6cc
JF
1256 ;
1257
1258CatchOpt
cac61857 1259 : "catch" "(" Identifier ")" Block_ { $$ = new(driver.pool_) CYCatch($3, $5); }
cf7d4c69 1260 | { $$ = NULL; }
1dbba6cc
JF
1261 ;
1262
1263FinallyOpt
b10bd496 1264 : "finally" Block_ { $$ = new(driver.pool_) CYFinally($2); }
cf7d4c69 1265 | { $$ = NULL; }
1dbba6cc 1266 ;
63cd45c9 1267/* }}} */
1dbba6cc 1268
63cd45c9 1269/* 13 Function Definition {{{ */
36cd3cb9 1270FunctionDeclaration
fb98ac0c 1271 : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionStatement($2, $4, $7); }
1dbba6cc
JF
1272 ;
1273
36cd3cb9 1274FunctionExpression
fb98ac0c 1275 : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($2, $4, $7); }
1dbba6cc
JF
1276 ;
1277
1278FormalParameterList_
36cd3cb9 1279 : "," FormalParameterList { $$ = $2; }
cf7d4c69 1280 | { $$ = NULL; }
1dbba6cc
JF
1281 ;
1282
1283FormalParameterList
b09da87b 1284 : Identifier FormalParameterList_ { $$ = new(driver.pool_) CYFunctionParameter($1, $2); }
cf7d4c69 1285 | { $$ = NULL; }
1dbba6cc
JF
1286 ;
1287
36cd3cb9
JF
1288FunctionBody
1289 : SourceElements { $$ = $1; }
1dbba6cc 1290 ;
63cd45c9
JF
1291/* }}} */
1292/* 14 Program {{{ */
1dbba6cc 1293Program
b10bd496 1294 : SourceElements { driver.program_ = $1; }
1dbba6cc
JF
1295 ;
1296
36cd3cb9
JF
1297SourceElements
1298 : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
cf7d4c69 1299 | { $$ = NULL; }
1dbba6cc
JF
1300 ;
1301
36cd3cb9 1302SourceElement
b10bd496 1303 : Statement_ { $$ = $1; }
36cd3cb9 1304 | FunctionDeclaration { $$ = $1; }
1dbba6cc 1305 ;
63cd45c9 1306/* }}} */
e5332278 1307
cac61857 1308/* Cycript: @class Declaration {{{ */
b09da87b
JF
1309ClassSuperOpt
1310 : ":" MemberExpressionNoBF { $$ = $2; }
1311 | { $$ = NULL; }
1312 ;
1313
1314ClassFieldList
1315 : "{" "}" { $$ = NULL; }
1316 ;
1317
1318MessageScope
1319 : "+" { $$ = false; }
1320 | "-" { $$ = true; }
1321 ;
1322
1323TypeOpt
1324 : "(" Expression ")" { $$ = $2; }
1325 | { $$ = NULL; }
1326 ;
1327
1328MessageParameter
75b0a457 1329 : Word ":" TypeOpt Identifier { $$ = new(driver.pool_) CYMessageParameter($1, $3, $4); }
b09da87b
JF
1330 ;
1331
1332MessageParameterListOpt
1333 : MessageParameterList { $$ = $1; }
1334 | { $$ = NULL; }
1335 ;
1336
1337MessageParameterList
1338 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1339 ;
1340
1341MessageParameters
1342 : MessageParameterList { $$ = $1; }
75b0a457 1343 | Word { $$ = new(driver.pool_) CYMessageParameter($1, NULL, NULL); }
b09da87b
JF
1344 ;
1345
1346ClassMessageDeclaration
75b0a457 1347 : MessageScope TypeOpt MessageParameters "{" FunctionBody "}" { $$ = new(driver.pool_) CYMessage($1, $2, $3, $5); }
b09da87b
JF
1348 ;
1349
1350ClassMessageDeclarationListOpt
4e8c99fb 1351 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
b09da87b
JF
1352 | { $$ = NULL; }
1353 ;
1354
e5bc40db
JF
1355ClassName
1356 : Identifier { $$ = $1; }
1357 | "(" AssignmentExpression ")" { $$ = $2; }
1358 ;
1359
367eebb1
JF
1360ClassNameOpt
1361 : ClassName { $$ = $1; }
1362 | { $$ = NULL; }
b09da87b
JF
1363 ;
1364
fb98ac0c
JF
1365ClassExpression
1366 : "@class" ClassNameOpt ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5); }
1367 ;
1368
1369ClassStatement
1370 : "@class" ClassName ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5); }
367eebb1
JF
1371 ;
1372
1373CategoryStatement
75b0a457 1374 : "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $3); }
367eebb1
JF
1375 ;
1376
365abb0a 1377PrimaryExpression
fb98ac0c 1378 : ClassExpression { $$ = $1; }
367eebb1
JF
1379 ;
1380
b10bd496 1381Statement_
fb98ac0c 1382 : ClassStatement { $$ = $1; }
365abb0a 1383 | CategoryStatement { $$ = $1; }
b09da87b 1384 ;
cac61857
JF
1385/* }}} */
1386/* Cycript: Send Message {{{ */
693d501b
JF
1387VariadicCall
1388 : "," AssignmentExpression VariadicCall { $$ = new(driver.pool_) CYArgument(NULL, $2, $3); }
1389 | { $$ = NULL; }
1390 ;
1391
1392SelectorCall_
1393 : SelectorCall { $$ = $1; }
1394 | VariadicCall { $$ = $1; }
1395 ;
1396
1397SelectorCall
1398 : WordOpt ":" AssignmentExpression SelectorCall_ { $$ = new(driver.pool_) CYArgument($1 ?: new(driver.pool_) CYBlank(), $3, $4); }
1399 ;
1400
1401SelectorList
1402 : SelectorCall { $$ = $1; }
1403 | Word { $$ = new(driver.pool_) CYArgument($1, NULL); }
1404 ;
1405
1406MessageExpression
b09da87b 1407 : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYSend($2, $3); }
693d501b
JF
1408 ;
1409
e7ed5354
JF
1410SelectorExpressionOpt
1411 : SelectorExpression_ { $$ = $1; }
1412 | { $$ = NULL; }
1413 ;
1414
1415SelectorExpression_
62014ea9 1416 : WordOpt ":" SelectorExpressionOpt { $$ = new(driver.pool_) CYSelectorPart($1, true, $3); }
e7ed5354
JF
1417 ;
1418
1419SelectorExpression
1420 : SelectorExpression_ { $$ = $1; }
62014ea9 1421 | Word { $$ = new(driver.pool_) CYSelectorPart($1, false, NULL); }
e7ed5354
JF
1422 ;
1423
457afcc9 1424PrimaryExpression_
693d501b 1425 : MessageExpression { $$ = $1; }
75b0a457 1426 | "@selector" "(" SelectorExpression ")" { $$ = new(driver.pool_) CYSelector($3); }
693d501b
JF
1427 ;
1428/* }}} */
cac61857 1429/* Cycript: Pointer Indirection/Addressing {{{ */
9b5527f0
JF
1430AssigneeExpression_
1431 : "*" UnaryExpression { $$ = new(driver.pool_) CYIndirect($2); }
693d501b
JF
1432 ;
1433
1434UnaryExpression_
1435 : "&" UnaryExpression { $$ = new(driver.pool_) CYAddressOf($2); }
1436 ;
1437
9b5527f0
JF
1438MemberAccess
1439 : "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
1440 ;
cac61857
JF
1441/* }}} */
1442/* ECMAScript5: Object Literal Trailing Comma {{{ */
1443PropertyNameAndValueList_
1444 : "," { $$ = NULL; }
1445 ;
1446/* }}} */
1447/* JavaScript 1.7: Array Comprehensions {{{ */
367eebb1 1448IfComprehension
75b0a457 1449 : "if" "(" Expression ")" { $$ = new(driver.pool_) CYIfComprehension($3); }
367eebb1
JF
1450 ;
1451
1452ForComprehension
75b0a457
JF
1453 : "for" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForInComprehension($3, $5); }
1454 | "for" "each" "(" Identifier "in" Expression ")" { $$ = new(driver.pool_) CYForEachInComprehension($4, $6); }
367eebb1
JF
1455 ;
1456
1457ComprehensionListOpt
75b0a457
JF
1458 : ComprehensionList { $$ = $1; }
1459 | IfComprehension { $$ = $1; }
1460 | { $$ = NULL; }
367eebb1
JF
1461 ;
1462
1463ComprehensionList
75b0a457 1464 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
367eebb1
JF
1465 ;
1466
1467PrimaryExpression_
75b0a457 1468 : "[" AssignmentExpression ComprehensionList "]" { $$ = new(driver.pool_) CYArrayComprehension($2, $3); }
367eebb1 1469 ;
cac61857
JF
1470/* }}} */
1471/* JavaScript 1.7: for each {{{ */
1472ForInStatement
1473 : "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForEachIn($4, $6, $8); }
1474 ;
1475/* }}} */
b10bd496 1476/* JavaScript 1.7: let Statements {{{ *//*
cac61857
JF
1477LetStatement
1478 : "let" "(" VariableDeclarationList ")" Block_ { $$ = new(driver.pool_) CYLet($3, $5); }
1479 ;
1480
1481Statement
1482 : LetStatement
1483 ;
534fb6da 1484*//* }}} */
b10bd496
JF
1485/* JavaScript FTW: Function Statements {{{ */
1486Statement
1487 : FunctionDeclaration { driver.Warning(yylloc, "warning, FunctionDeclaration is a SourceElement, not a Statement"); } { $$ = $1; }
1488 ;
1489/* }}} */
367eebb1 1490
e5332278 1491%%