misc/liblua/lparser.c
changeset 10017 de822cd3df3a
parent 2812 0a24853de796
equal deleted inserted replaced
10015:4feced261c68 10017:de822cd3df3a
    25 #include "lstring.h"
    25 #include "lstring.h"
    26 #include "ltable.h"
    26 #include "ltable.h"
    27 
    27 
    28 
    28 
    29 
    29 
    30 #define hasmultret(k)		((k) == VCALL || (k) == VVARARG)
    30 #define hasmultret(k)       ((k) == VCALL || (k) == VVARARG)
    31 
    31 
    32 #define getlocvar(fs, i)	((fs)->f->locvars[(fs)->actvar[i]])
    32 #define getlocvar(fs, i)    ((fs)->f->locvars[(fs)->actvar[i]])
    33 
    33 
    34 #define luaY_checklimit(fs,v,l,m)	if ((v)>(l)) errorlimit(fs,l,m)
    34 #define luaY_checklimit(fs,v,l,m)   if ((v)>(l)) errorlimit(fs,l,m)
    35 
    35 
    36 
    36 
    37 /*
    37 /*
    38 ** nodes for block list (list of active blocks)
    38 ** nodes for block list (list of active blocks)
    39 */
    39 */
    95   check(ls, c);
    95   check(ls, c);
    96   luaX_next(ls);
    96   luaX_next(ls);
    97 }
    97 }
    98 
    98 
    99 
    99 
   100 #define check_condition(ls,c,msg)	{ if (!(c)) luaX_syntaxerror(ls, msg); }
   100 #define check_condition(ls,c,msg)   { if (!(c)) luaX_syntaxerror(ls, msg); }
   101 
   101 
   102 
   102 
   103 
   103 
   104 static void check_match (LexState *ls, int what, int who, int where) {
   104 static void check_match (LexState *ls, int what, int who, int where) {
   105   if (!testnext(ls, what)) {
   105   if (!testnext(ls, what)) {
   273 }
   273 }
   274 
   274 
   275 
   275 
   276 static void enterlevel (LexState *ls) {
   276 static void enterlevel (LexState *ls) {
   277   if (++ls->L->nCcalls > LUAI_MAXCCALLS)
   277   if (++ls->L->nCcalls > LUAI_MAXCCALLS)
   278 	luaX_lexerror(ls, "chunk has too many syntax levels", 0);
   278     luaX_lexerror(ls, "chunk has too many syntax levels", 0);
   279 }
   279 }
   280 
   280 
   281 
   281 
   282 #define leavelevel(ls)	((ls)->L->nCcalls--)
   282 #define leavelevel(ls)  ((ls)->L->nCcalls--)
   283 
   283 
   284 
   284 
   285 static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {
   285 static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {
   286   bl->breaklist = NO_JUMP;
   286   bl->breaklist = NO_JUMP;
   287   bl->isbreakable = isbreakable;
   287   bl->isbreakable = isbreakable;
   816    {3, 3}, {3, 3},                  /* equality and inequality */
   816    {3, 3}, {3, 3},                  /* equality and inequality */
   817    {3, 3}, {3, 3}, {3, 3}, {3, 3},  /* order */
   817    {3, 3}, {3, 3}, {3, 3}, {3, 3},  /* order */
   818    {2, 2}, {1, 1}                   /* logical (and/or) */
   818    {2, 2}, {1, 1}                   /* logical (and/or) */
   819 };
   819 };
   820 
   820 
   821 #define UNARY_PRIORITY	8  /* priority for unary operators */
   821 #define UNARY_PRIORITY  8  /* priority for unary operators */
   822 
   822 
   823 
   823 
   824 /*
   824 /*
   825 ** subexpr -> (simpleexp | unop subexpr) { binop subexpr }
   825 ** subexpr -> (simpleexp | unop subexpr) { binop subexpr }
   826 ** where `binop' is any binary operator with a priority higher than `limit'
   826 ** where `binop' is any binary operator with a priority higher than `limit'