]> git.saurik.com Git - cycript.git/blobdiff - Cycript.yy.in
Split CYLast into CYSetLast (eol) and CYGetLast.
[cycript.git] / Cycript.yy.in
index 6eb6e10cf1598234a53a45c28adc0165ba178139..e7355979673938406fcd81e96f1cfcbb6a86b202 100644 (file)
@@ -333,6 +333,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
 %type <expression_> ArrowFunction
 %type <functionParameter_> ArrowParameters
 %type <expression_> AssignmentExpression
+%type <identifier_> Binding
 %type <identifier_> BindingIdentifier
 %type <expression_> BitwiseANDExpression
 %type <statement_> Block_
@@ -349,6 +350,8 @@ int cylex(YYSTYPE *, cy::location *, void *);
 %type <clause_> CaseClause
 %type <clause_> CaseClausesOpt
 %type <catch_> CatchOpt
+%type <comprehension_> ComprehensionForList
+%type <comprehension_> ComprehensionForListOpt
 %type <comprehension_> ComprehensionList
 %type <comprehension_> ComprehensionListOpt
 %type <expression_> ConditionalExpression
@@ -739,6 +742,22 @@ ElementListOpt
     | 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); }
@@ -1043,6 +1062,10 @@ BindingIdentifier
     : Identifier { $$ = $1; }
     ;
 
+Binding
+    : BindingIdentifier
+    ;
+
 // XXX: BindingPattern
 /* }}} */
 /* 12.2.1 Let and Const Declarations {{{ */