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 fce6a04b..86582565 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 2.136 2013/12/16 19:06:52 roberto Exp roberto $ 2** $Id: lparser.c,v 2.137 2013/12/18 14:12:03 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*/
@@ -979,6 +979,7 @@ static UnOpr getunopr (int op) {
979 switch (op) { 979 switch (op) {
980 case TK_NOT: return OPR_NOT; 980 case TK_NOT: return OPR_NOT;
981 case '-': return OPR_MINUS; 981 case '-': return OPR_MINUS;
982 case '~': return OPR_BNOT;
982 case '#': return OPR_LEN; 983 case '#': return OPR_LEN;
983 default: return OPR_NOUNOPR; 984 default: return OPR_NOUNOPR;
984 } 985 }
@@ -997,6 +998,8 @@ static BinOpr getbinopr (int op) {
997 case '&': return OPR_BAND; 998 case '&': return OPR_BAND;
998 case '|': return OPR_BOR; 999 case '|': return OPR_BOR;
999 case '~': return OPR_BXOR; 1000 case '~': return OPR_BXOR;
1001 case TK_SHL: return OPR_SHL;
1002 case TK_SHR: return OPR_SHR;
1000 case TK_CONCAT: return OPR_CONCAT; 1003 case TK_CONCAT: return OPR_CONCAT;
1001 case TK_NE: return OPR_NE; 1004 case TK_NE: return OPR_NE;
1002 case TK_EQ: return OPR_EQ; 1005 case TK_EQ: return OPR_EQ;
@@ -1015,18 +1018,19 @@ static const struct {
1015 lu_byte left; /* left priority for each binary operator */ 1018 lu_byte left; /* left priority for each binary operator */
1016 lu_byte right; /* right priority */ 1019 lu_byte right; /* right priority */
1017} priority[] = { /* ORDER OPR */ 1020} priority[] = { /* ORDER OPR */
1018 {8, 8}, {8, 8}, /* '+' '-' */ 1021 {10, 10}, {10, 10}, /* '+' '-' */
1019 {9, 9}, {9, 9}, /* '*' '%' */ 1022 {11, 11}, {11, 11}, /* '*' '%' */
1020 {12, 11}, /* '^' (right associative) */ 1023 {14, 13}, /* '^' (right associative) */
1021 {9, 9}, {9, 9}, /* '/' '//' */ 1024 {11, 11}, {11, 11}, /* '/' '//' */
1022 {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */ 1025 {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */
1023 {7, 6}, /* '..' (right associative) */ 1026 {7, 7}, {7, 7}, /* '<<' '>>' */
1027 {9, 8}, /* '..' (right associative) */
1024 {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ 1028 {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */
1025 {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ 1029 {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */
1026 {2, 2}, {1, 1} /* and, or */ 1030 {2, 2}, {1, 1} /* and, or */
1027}; 1031};
1028 1032
1029#define UNARY_PRIORITY 10 /* priority for unary operators */ 1033#define UNARY_PRIORITY 12 /* priority for unary operators */
1030 1034
1031 1035
1032/* 1036/*