%type <expression_> ArrowFunction
%type <functionParameter_> ArrowParameters
%type <expression_> AssignmentExpression
+%type <identifier_> Binding
%type <identifier_> BindingIdentifier
%type <expression_> BitwiseANDExpression
%type <statement_> Block_
%type <clause_> CaseClause
%type <clause_> CaseClausesOpt
%type <catch_> CatchOpt
+%type <comprehension_> ComprehensionForList
+%type <comprehension_> ComprehensionForListOpt
%type <comprehension_> ComprehensionList
%type <comprehension_> ComprehensionListOpt
%type <expression_> ConditionalExpression
| LexSetRegExp { $$ = NULL; }
;
/* }}} */
+/* 11.1.4.2 Array Comprehension {{{ */
+PrimaryExpression
+ : "[" LexPushInOff AssignmentExpression ComprehensionForList LexPopIn "]" { $$ = CYNew CYArrayComprehension($3, $4); }
+ ;
+
+ComprehensionForList
+ : "for" Binding "in" Expression ComprehensionForListOpt { $$ = CYNew CYForInComprehension($2, $4, $5); }
+ | "for" Binding "of" Expression ComprehensionForListOpt { $$ = CYNew CYForOfComprehension($2, $4, $5); }
+ ;
+
+ComprehensionForListOpt
+ : ComprehensionForList { $$ = $1; }
+ | "if" Expression { $$ = CYNew CYIfComprehension($2); }
+ | { $$ = NULL; }
+ ;
+/* }}} */
/* 11.1.5 Object Initialiser {{{ */
ObjectLiteral
: BRACE LexPushInOff PropertyDefinitionListOpt LexPopIn "}" { $$ = CYNew CYObject($3); }
: Identifier { $$ = $1; }
;
+Binding
+ : BindingIdentifier
+ ;
+
// XXX: BindingPattern
/* }}} */
/* 12.2.1 Let and Const Declarations {{{ */
CYNext<CYComprehension>,
CYThing
{
+ CYComprehension(CYComprehension *next = NULL) :
+ CYNext<CYComprehension>(next)
+ {
+ }
+
virtual const char *Name() const = 0;
virtual CYFunctionParameter *Parameter(CYContext &context) const = 0;
CYIdentifier *name_;
CYExpression *set_;
- CYForInComprehension(CYIdentifier *name, CYExpression *set) :
+ CYForInComprehension(CYIdentifier *name, CYExpression *set, CYComprehension *next = NULL) :
+ CYComprehension(next),
name_(name),
set_(set)
{
CYIdentifier *name_;
CYExpression *set_;
- CYForOfComprehension(CYIdentifier *name, CYExpression *set) :
+ CYForOfComprehension(CYIdentifier *name, CYExpression *set, CYComprehension *next = NULL) :
+ CYComprehension(next),
name_(name),
set_(set)
{