From a2f5c28a802ae99f2045ab96585fade2c65b2037 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 26 Apr 2013 10:08:29 -0300 Subject: new operation '//' (integer division) --- lparser.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lparser.c') diff --git a/lparser.c b/lparser.c index c6605762..2cc226d4 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.131 2013/04/16 18:46:28 roberto Exp roberto $ +** $Id: lparser.c,v 2.132 2013/04/25 19:35:19 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -1005,6 +1005,7 @@ static BinOpr getbinopr (int op) { case '-': return OPR_SUB; case '*': return OPR_MUL; case '/': return OPR_DIV; + case TK_IDIV: return OPR_IDIV; case '%': return OPR_MOD; case '^': return OPR_POW; case TK_CONCAT: return OPR_CONCAT; @@ -1025,7 +1026,8 @@ static const struct { lu_byte left; /* left priority for each binary operator */ lu_byte right; /* right priority */ } priority[] = { /* ORDER OPR */ - {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `*' `/' `%' */ + {6, 6}, {6, 6}, /* '+' '-' */ + {7, 7}, {7, 7}, {7, 7}, {7, 7}, /* '*' '/' '//' '%' */ {10, 9}, {5, 4}, /* ^, .. (right associative) */ {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ -- cgit v1.2.3-55-g6feb