aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lparser.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lparser.c b/lparser.c
index b13ee9d5..e39f77b0 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 1.62 2000/03/03 14:58:26 roberto Exp roberto $ 2** $Id: lparser.c,v 1.63 2000/03/03 18:53:17 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*/
@@ -717,14 +717,14 @@ static int get_priority (int op, int *rp) {
717 case '>': case '<': case LE: case GE: 717 case '>': case '<': case LE: case GE:
718 *rp = 2; return 2; 718 *rp = 2; return 2;
719 case CONC: 719 case CONC:
720 *rp = 3; return 3; 720 *rp = 4; return 4; /* left associative (?) */
721 case '+': case '-': 721 case '+': case '-':
722 *rp = 4; return 4;
723 case '*': case '/':
724 *rp = 5; return 5; 722 *rp = 5; return 5;
725 /* priority 6 is for unary operators */ 723 case '*': case '/':
724 *rp = 6; return 6;
725#define UNARY_PRIORITY 7
726 case '^': 726 case '^':
727 *rp = 7; return 8; /* right associative */ 727 *rp = 8; return 9; /* right associative */
728 default: 728 default:
729 *rp = -1; return -1; 729 *rp = -1; return -1;
730 } 730 }
@@ -740,7 +740,7 @@ static void operator_expr (LexState *ls, expdesc *v, int limit) {
740 if (ls->token == '-' || ls->token == NOT) { 740 if (ls->token == '-' || ls->token == NOT) {
741 int op = ls->token; /* operator */ 741 int op = ls->token; /* operator */
742 next(ls); 742 next(ls);
743 operator_expr(ls, v, 6); /* 6 == priority of NOT and unary `-' */ 743 operator_expr(ls, v, UNARY_PRIORITY);
744 luaK_prefix(ls, op, v); 744 luaK_prefix(ls, op, v);
745 } 745 }
746 else simpleexp(ls, v); 746 else simpleexp(ls, v);