aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lparser.c b/lparser.c
index c23b2dde..fce6a04b 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 2.135 2013/08/30 16:01:37 roberto Exp roberto $ 2** $Id: lparser.c,v 2.136 2013/12/16 19:06:52 roberto Exp roberto $
3** Lua Parser 3** Lua Parser
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -994,6 +994,9 @@ static BinOpr getbinopr (int op) {
994 case '^': return OPR_POW; 994 case '^': return OPR_POW;
995 case '/': return OPR_DIV; 995 case '/': return OPR_DIV;
996 case TK_IDIV: return OPR_IDIV; 996 case TK_IDIV: return OPR_IDIV;
997 case '&': return OPR_BAND;
998 case '|': return OPR_BOR;
999 case '~': return OPR_BXOR;
997 case TK_CONCAT: return OPR_CONCAT; 1000 case TK_CONCAT: return OPR_CONCAT;
998 case TK_NE: return OPR_NE; 1001 case TK_NE: return OPR_NE;
999 case TK_EQ: return OPR_EQ; 1002 case TK_EQ: return OPR_EQ;
@@ -1012,17 +1015,18 @@ static const struct {
1012 lu_byte left; /* left priority for each binary operator */ 1015 lu_byte left; /* left priority for each binary operator */
1013 lu_byte right; /* right priority */ 1016 lu_byte right; /* right priority */
1014} priority[] = { /* ORDER OPR */ 1017} priority[] = { /* ORDER OPR */
1015 {6, 6}, {6, 6}, /* '+' '-' */ 1018 {8, 8}, {8, 8}, /* '+' '-' */
1016 {7, 7}, {7, 7}, /* '*' '%' */ 1019 {9, 9}, {9, 9}, /* '*' '%' */
1017 {10, 9}, /* '^' (right associative) */ 1020 {12, 11}, /* '^' (right associative) */
1018 {7, 7}, {7, 7}, /* '/' '//' */ 1021 {9, 9}, {9, 9}, /* '/' '//' */
1019 {5, 4}, /* '..' (right associative) */ 1022 {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */
1023 {7, 6}, /* '..' (right associative) */
1020 {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ 1024 {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */
1021 {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ 1025 {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */
1022 {2, 2}, {1, 1} /* and, or */ 1026 {2, 2}, {1, 1} /* and, or */
1023}; 1027};
1024 1028
1025#define UNARY_PRIORITY 8 /* priority for unary operators */ 1029#define UNARY_PRIORITY 10 /* priority for unary operators */
1026 1030
1027 1031
1028/* 1032/*