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