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