new mod' (%') operator

This commit is contained in:
Roberto Ierusalimschy
2005-03-08 15:00:16 -03:00
parent 2d5b923759
commit 7d57ea70bc
8 changed files with 48 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lparser.c,v 2.13 2005/01/05 18:20:51 roberto Exp roberto $
** $Id: lparser.c,v 2.14 2005/03/07 16:58:27 roberto Exp roberto $
** Lua Parser
** See Copyright Notice in lua.h
*/
@@ -799,6 +799,7 @@ static BinOpr getbinopr (int op) {
case '-': return OPR_SUB;
case '*': return OPR_MULT;
case '/': return OPR_DIV;
case '%': return OPR_MOD;
case '^': return OPR_POW;
case TK_CONCAT: return OPR_CONCAT;
case TK_NE: return OPR_NE;
@@ -818,9 +819,9 @@ 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}, /* arithmetic */
{6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */
{10, 9}, {5, 4}, /* power and concat (right associative) */
{3, 3}, {3, 3}, /* equality */
{3, 3}, {3, 3}, /* equality and inequality */
{3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */
{2, 2}, {1, 1} /* logical (and/or) */
};