From: Jay Freeman (saurik) Date: Fri, 18 Dec 2015 13:44:32 +0000 (-0800) Subject: Parse array binding patterns (I skipped these :/). X-Git-Tag: v0.9.590~186 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/93d4b2d7eeb217c3369c548e2477bdc61aa16e80?ds=sidebyside Parse array binding patterns (I skipped these :/). --- diff --git a/Parser.ypp.in b/Parser.ypp.in index 5780173..aeafb35 100644 --- a/Parser.ypp.in +++ b/Parser.ypp.in @@ -1435,7 +1435,7 @@ ObjectBindingPattern ; ArrayBindingPattern - : "let [" { CYNOT(@$); } + : "let [" BindingElementListOpt "]" ; BindingPropertyList_ @@ -1452,6 +1452,17 @@ BindingPropertyListOpt | LexOf ; +BindingElementList + : BindingElementOpt[element] "," BindingElementListOpt[next] + | BindingRestElement[element] + | BindingElement[element] + ; + +BindingElementListOpt + : BindingElementList[pass] + | LexBind LexOf + ; + BindingProperty : SingleNameBinding | LexOf PropertyName ":" BindingElement @@ -1462,12 +1473,17 @@ BindingElement | LexBind LexOf BindingPattern InitializerOpt[initializer] { CYNOT(@$); } ; +BindingElementOpt + : BindingElement[pass] + | LexBind LexOf + ; + SingleNameBinding : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); } ; BindingRestElement - : "..." BindingIdentifier + : LexBind LexOf "..." BindingIdentifier ; /* }}} */ /* 13.4 Empty Statement {{{ */ @@ -1643,7 +1659,7 @@ FormalParameterList_ ; FormalParameterList - : LexBind LexOf FunctionRestParameter { CYNOT(@$); } + : FunctionRestParameter { CYNOT(@$); } | FormalParameter[binding] FormalParameterList_[next] { $$ = CYNew CYFunctionParameter($binding, $next); } ;