summaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-04-26 10:08:29 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-04-26 10:08:29 -0300
commita2f5c28a802ae99f2045ab96585fade2c65b2037 (patch)
treeeb2ab3d1fc8dc2084505ed4286502ed75b6721ba /lparser.c
parenta80a2b5e561b50c1f64e96c3692614611a325aba (diff)
downloadlua-github-a2f5c28a802ae99f2045ab96585fade2c65b2037.tar.gz
new operation '//' (integer division)
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c6
1 files changed, 4 insertions, 2 deletions
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}, /* ~=, >, >= */