From 920acb8428be640aad792f5d968ee9a2b1fab830 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Tue, 14 Oct 2008 21:35:34 +0200 Subject: [PATCH] MultipleAssignment selectors B.W. --- Patch: +MultipleAssignment-selector.patch --- MultipleAssignment-selector.patch | 71 +++++++++++++++++++++++++++++++++++++++ series | 1 + 2 files changed, 72 insertions(+) create mode 100644 MultipleAssignment-selector.patch diff --git a/MultipleAssignment-selector.patch b/MultipleAssignment-selector.patch new file mode 100644 index 0000000..270495d --- /dev/null +++ b/MultipleAssignment-selector.patch @@ -0,0 +1,71 @@ +--- + + source/parse.y | 43 +++++++++++++++++++++++++++++++++++-------- + 1 file changed, 35 insertions(+), 8 deletions(-) + +diff --quilt old/source/parse.y new/source/parse.y +--- old/source/parse.y ++++ new/source/parse.y +@@ -421,27 +421,54 @@ lvlistexpr: '(' mark lvlist mark ')' bla + ** the lvalue, so that the result is ontop od the stack. + ** lventry's value will give us the start of this code. + */ +-lvlist: lventry { +- Inst *this = GetPC(); ++lvlist: blank { ++ /* start case and skip this index */ ++ $$ = 1; ++ } ++ | lventry mark { + /* start case */ + $$ = 1; + /* add code to push the rvalue expression value */ + ADD_OP(OP_PUSH_IMMED); ADD_IMMED($$); + ADD_OP(OP_ARRAY_REF); ADD_IMMED(1); + /* swap this code in front of the lvalue assignment code */ +- SwapCode($1, this, GetPC()); ++ SwapCode($1, $2, GetPC()); ++ } ++ | lventry mark lvselector { ++ /* don't advance index */ ++ $$ = 0; ++ /* swap this code in front of the lvalue assignment code */ ++ SwapCode($1, $2, GetPC()); + } +- | lvlist ',' blank lventry { +- Inst *this = GetPC(); ++ | lvlist ',' blank { ++ /* skip this index */ ++ $$ = $1 + 1; ++ } ++ | lvlist ',' blank lventry mark { + /* the index for this entry into the rvalue array */ + $$ = $1 + 1; + /* add code to push the rvalue expression value */ + ADD_OP(OP_PUSH_IMMED); ADD_IMMED($$); + ADD_OP(OP_ARRAY_REF); ADD_IMMED(1); + /* swap this code in front of the lvalue assignment code */ +- SwapCode($4, this, GetPC()); +- } +- ; ++ SwapCode($4, $5, GetPC()); ++ } ++ | lvlist ',' blank lventry mark lvselector { ++ /* don't advance index */ ++ $$ = $1 + 0; ++ /* swap this code in front of the lvalue assignment code */ ++ SwapCode($4, $5, GetPC()); ++ } ++ ; ++lvselector: blank '=' blank '[' arglist ']' { ++ /* add code to push the rvalue expression value */ ++ ADD_OP(OP_ARRAY_REF); ADD_IMMED($5); ++ } ++ | blank '=' blank dot field { ++ /* add code to push the rvalue expression value */ ++ ADD_OP(OP_ARRAY_REF); ADD_IMMED(1); ++ } ++ ; + /* lventry's value is the start of the assignment code */ + lventry: SYMBOL { + /* the rvalue is right on top, just dup it */ diff --git a/series b/series index d90334d..4e5aa3e 100644 --- a/series +++ b/series @@ -126,3 +126,4 @@ drop-SUBR_TAG.patch aryiter-on-stack.patch symbol-lookup.patch MultipleAssignment-redux.patch +MultipleAssignment-selector.patch -- 2.11.4.GIT