new reserved words in' and global'

This commit is contained in:
Roberto Ierusalimschy
2001-06-20 18:07:57 -03:00
parent b940f09984
commit fccadba4b5
3 changed files with 12 additions and 15 deletions

View File

@@ -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);