diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-11-30 16:50:47 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-11-30 16:50:47 -0200 |
commit | 01b00cc29261579600ce414b470c339510ac49d5 (patch) | |
tree | d485971f691e6914b92d52a4ba6976f6f3357a23 /lparser.c | |
parent | fc7b167ae0a0d65f0050299101e7d177550d7120 (diff) | |
download | lua-01b00cc29261579600ce414b470c339510ac49d5.tar.gz lua-01b00cc29261579600ce414b470c339510ac49d5.tar.bz2 lua-01b00cc29261579600ce414b470c339510ac49d5.zip |
better control over extensions of char/short to int
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.116 2000/10/27 11:39:52 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.117 2000/11/29 11:57:42 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 | */ |
@@ -690,8 +690,8 @@ static BinOpr getbinopr (int op) { | |||
690 | 690 | ||
691 | 691 | ||
692 | static const struct { | 692 | static const struct { |
693 | char left; /* left priority for each binary operator */ | 693 | unsigned char left; /* left priority for each binary operator */ |
694 | char right; /* right priority */ | 694 | unsigned char right; /* right priority */ |
695 | } priority[] = { /* ORDER OPR */ | 695 | } priority[] = { /* ORDER OPR */ |
696 | {5, 5}, {5, 5}, {6, 6}, {6, 6}, /* arithmetic */ | 696 | {5, 5}, {5, 5}, {6, 6}, {6, 6}, /* arithmetic */ |
697 | {9, 8}, {4, 3}, /* power and concat (right associative) */ | 697 | {9, 8}, {4, 3}, /* power and concat (right associative) */ |
@@ -718,13 +718,13 @@ static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { | |||
718 | else simpleexp(ls, v); | 718 | else simpleexp(ls, v); |
719 | /* expand while operators have priorities higher than `limit' */ | 719 | /* expand while operators have priorities higher than `limit' */ |
720 | op = getbinopr(ls->t.token); | 720 | op = getbinopr(ls->t.token); |
721 | while (op != OPR_NOBINOPR && priority[op].left > limit) { | 721 | while (op != OPR_NOBINOPR && (int)priority[op].left > limit) { |
722 | expdesc v2; | 722 | expdesc v2; |
723 | BinOpr nextop; | 723 | BinOpr nextop; |
724 | next(ls); | 724 | next(ls); |
725 | luaK_infix(ls, op, v); | 725 | luaK_infix(ls, op, v); |
726 | /* read sub-expression with higher priority */ | 726 | /* read sub-expression with higher priority */ |
727 | nextop = subexpr(ls, &v2, priority[op].right); | 727 | nextop = subexpr(ls, &v2, (int)priority[op].right); |
728 | luaK_posfix(ls, op, v, &v2); | 728 | luaK_posfix(ls, op, v, &v2); |
729 | op = nextop; | 729 | op = nextop; |
730 | } | 730 | } |