diff --git a/llex.c b/llex.c index c921b1b4..6ca4ef75 100644 --- a/llex.c +++ b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 1.86 2001/06/13 14:25:49 roberto Exp roberto $ +** $Id: llex.c,v 1.87 2001/06/15 20:36:57 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -28,10 +28,11 @@ /* ORDER RESERVED */ static const l_char *const token2string [] = { l_s("and"), l_s("break"), l_s("do"), l_s("else"), l_s("elseif"), - l_s("end"), l_s("for"), l_s("function"), l_s("if"), l_s("local"), - l_s("nil"), l_s("not"), l_s("or"), l_s("repeat"), l_s("return"), - l_s("then"), l_s("until"), l_s("while"), l_s(""), l_s(".."), l_s("..."), - l_s("=="), l_s(">="), l_s("<="), l_s("~="), l_s(""), l_s(""), l_s("") + l_s("end"), l_s("for"), l_s("function"), l_s("global"), l_s("if"), + l_s("in"), l_s("local"), l_s("nil"), l_s("not"), l_s("or"), l_s("repeat"), + l_s("return"), l_s("then"), l_s("until"), l_s("while"), l_s(""), + l_s(".."), l_s("..."), l_s("=="), l_s(">="), l_s("<="), l_s("~="), + l_s(""), l_s(""), l_s("") }; diff --git a/llex.h b/llex.h index 4a4370f7..6d0cba47 100644 --- a/llex.h +++ b/llex.h @@ -1,5 +1,5 @@ /* -** $Id: llex.h,v 1.34 2001/02/23 17:17:25 roberto Exp roberto $ +** $Id: llex.h,v 1.35 2001/03/06 14:46:54 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -24,8 +24,9 @@ enum RESERVED { /* terminal symbols denoted by reserved words */ TK_AND = FIRST_RESERVED, TK_BREAK, - TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FOR, TK_FUNCTION, TK_IF, TK_LOCAL, - TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, TK_UNTIL, TK_WHILE, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FOR, TK_FUNCTION, TK_GLOBAL, TK_IF, + TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, + TK_UNTIL, TK_WHILE, /* other terminal symbols */ TK_NAME, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, TK_STRING, TK_EOS diff --git a/lparser.c b/lparser.c index fa6ada93..28f0c4b8 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 1.148 2001/06/11 14:56:42 roberto Exp roberto $ +** $Id: lparser.c,v 1.149 2001/06/12 14:36:48 roberto Exp roberto $ ** LL(1) Parser and code generator for Lua ** See Copyright Notice in lua.h */ @@ -960,12 +960,7 @@ static void forlist (LexState *ls, TString *indexname) { TString *valname; check(ls, l_c(',')); valname = str_checkname(ls); - /* next test is dirty, but avoids `in' being a reserved word */ - check_condition(ls, - (ls->t.token == TK_NAME && - ls->t.seminfo.ts == luaS_newliteral(ls->L, l_s("in"))), - l_s("`in' expected")); - next(ls); /* skip `in' */ + check(ls, TK_IN); exp1(ls); /* table */ new_localvarstr(ls, l_s("(table)"), 0); new_localvarstr(ls, l_s("(index)"), 1);