diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-07 10:13:11 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-07 10:13:11 -0300 |
commit | 031978798cc404c2c6757c564675d43a7da129ee (patch) | |
tree | 993e59994258f1a9176d7d260214b132d0b2baa9 /lparser.c | |
parent | 14251c5a5640f73f8f98d2445900a3c3a8d472fb (diff) | |
download | lua-031978798cc404c2c6757c564675d43a7da129ee.tar.gz lua-031978798cc404c2c6757c564675d43a7da129ee.tar.bz2 lua-031978798cc404c2c6757c564675d43a7da129ee.zip |
more optimizations
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.76 2000/04/05 17:51:58 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.77 2000/04/06 17:36:52 roberto Exp roberto $ |
3 | ** LL(1) Parser and code generator for Lua | 3 | ** LL(1) Parser and code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -751,7 +751,7 @@ static int get_priority (int op, int *rp) { | |||
751 | 751 | ||
752 | case '+': case '-': *rp = 5; return 5; | 752 | case '+': case '-': *rp = 5; return 5; |
753 | 753 | ||
754 | case TK_CONC: *rp = 3; return 4; /* right associative (?) */ | 754 | case TK_CONCAT: *rp = 3; return 4; /* right associative (?) */ |
755 | 755 | ||
756 | case TK_EQ: case TK_NE: case '>': case '<': case TK_LE: case TK_GE: | 756 | case TK_EQ: case TK_NE: case '>': case '<': case TK_LE: case TK_GE: |
757 | *rp = 2; return 2; | 757 | *rp = 2; return 2; |
@@ -832,13 +832,11 @@ static int assignment (LexState *ls, expdesc *v, int nvars) { | |||
832 | nexps = explist1(ls); | 832 | nexps = explist1(ls); |
833 | adjust_mult_assign(ls, nvars, nexps); | 833 | adjust_mult_assign(ls, nvars, nexps); |
834 | } | 834 | } |
835 | if (v->k != VINDEXED || left+(nvars-1) == 0) { | 835 | if (v->k != VINDEXED) |
836 | /* global/local var or indexed var without values in between */ | ||
837 | luaK_storevar(ls, v); | 836 | luaK_storevar(ls, v); |
838 | } | 837 | else { /* there may be garbage between table-index and value */ |
839 | else { /* indexed var with values in between*/ | 838 | luaK_AB(ls->fs, OP_SETTABLE, left+nvars+2, 1, -1); |
840 | luaK_U(ls->fs, OP_SETTABLE, left+(nvars-1), -1); | 839 | left += 2; |
841 | left += 2; /* table&index are not popped, because they aren't on top */ | ||
842 | } | 840 | } |
843 | return left; | 841 | return left; |
844 | } | 842 | } |