aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-03-08 15:00:16 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-03-08 15:00:16 -0300
commit7d57ea70bc975922485d589c8a6d8dedaa0fba02 (patch)
treed7f7da1492de151749a69042cd2bf63320638020 /lparser.c
parent2d5b923759a77d8f5f7bfa62906ea37f46b9281d (diff)
downloadlua-7d57ea70bc975922485d589c8a6d8dedaa0fba02.tar.gz
lua-7d57ea70bc975922485d589c8a6d8dedaa0fba02.tar.bz2
lua-7d57ea70bc975922485d589c8a6d8dedaa0fba02.zip
new `mod' (`%') operator
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lparser.c b/lparser.c
index 518bfd50..f1a6ae90 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 2.13 2005/01/05 18:20:51 roberto Exp roberto $ 2** $Id: lparser.c,v 2.14 2005/03/07 16:58:27 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*/
@@ -799,6 +799,7 @@ static BinOpr getbinopr (int op) {
799 case '-': return OPR_SUB; 799 case '-': return OPR_SUB;
800 case '*': return OPR_MULT; 800 case '*': return OPR_MULT;
801 case '/': return OPR_DIV; 801 case '/': return OPR_DIV;
802 case '%': return OPR_MOD;
802 case '^': return OPR_POW; 803 case '^': return OPR_POW;
803 case TK_CONCAT: return OPR_CONCAT; 804 case TK_CONCAT: return OPR_CONCAT;
804 case TK_NE: return OPR_NE; 805 case TK_NE: return OPR_NE;
@@ -818,9 +819,9 @@ static const struct {
818 lu_byte left; /* left priority for each binary operator */ 819 lu_byte left; /* left priority for each binary operator */
819 lu_byte right; /* right priority */ 820 lu_byte right; /* right priority */
820} priority[] = { /* ORDER OPR */ 821} priority[] = { /* ORDER OPR */
821 {6, 6}, {6, 6}, {7, 7}, {7, 7}, /* arithmetic */ 822 {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */
822 {10, 9}, {5, 4}, /* power and concat (right associative) */ 823 {10, 9}, {5, 4}, /* power and concat (right associative) */
823 {3, 3}, {3, 3}, /* equality */ 824 {3, 3}, {3, 3}, /* equality and inequality */
824 {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ 825 {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */
825 {2, 2}, {1, 1} /* logical (and/or) */ 826 {2, 2}, {1, 1} /* logical (and/or) */
826}; 827};