|
|
@ -1,5 +1,5 @@ |
|
|
|
/*
|
|
|
|
** $Id: lparser.c,v 2.134 2013/08/16 18:55:49 roberto Exp roberto $ |
|
|
|
** $Id: lparser.c,v 2.135 2013/08/30 16:01:37 roberto Exp roberto $ |
|
|
|
** Lua Parser |
|
|
|
** See Copyright Notice in lua.h |
|
|
|
*/ |
|
|
@ -990,10 +990,10 @@ static BinOpr getbinopr (int op) { |
|
|
|
case '+': return OPR_ADD; |
|
|
|
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 '/': return OPR_DIV; |
|
|
|
case TK_IDIV: return OPR_IDIV; |
|
|
|
case TK_CONCAT: return OPR_CONCAT; |
|
|
|
case TK_NE: return OPR_NE; |
|
|
|
case TK_EQ: return OPR_EQ; |
|
|
@ -1012,12 +1012,14 @@ 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}, {7, 7}, /* '*' '/' '//' '%' */ |
|
|
|
{10, 9}, {5, 4}, /* ^, .. (right associative) */ |
|
|
|
{3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ |
|
|
|
{3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ |
|
|
|
{2, 2}, {1, 1} /* and, or */ |
|
|
|
{6, 6}, {6, 6}, /* '+' '-' */ |
|
|
|
{7, 7}, {7, 7}, /* '*' '%' */ |
|
|
|
{10, 9}, /* '^' (right associative) */ |
|
|
|
{7, 7}, {7, 7}, /* '/' '//' */ |
|
|
|
{5, 4}, /* '..' (right associative) */ |
|
|
|
{3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ |
|
|
|
{3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ |
|
|
|
{2, 2}, {1, 1} /* and, or */ |
|
|
|
}; |
|
|
|
|
|
|
|
#define UNARY_PRIORITY 8 /* priority for unary operators */ |
|
|
|