From 93d4b2d7eeb217c3369c548e2477bdc61aa16e80 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 18 Dec 2015 05:44:32 -0800 Subject: [PATCH] Parse array binding patterns (I skipped these :/). --- Parser.ypp.in | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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); } ; -- 2.50.0