diff --git a/llex.c b/llex.c index 4bbe6cfb..adb3527c 100644 --- a/llex.c +++ b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.23 2006/09/18 16:06:41 roberto Exp roberto $ +** $Id: llex.c,v 2.24 2007/02/07 17:49:18 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -442,8 +442,9 @@ void luaX_next (LexState *ls) { } -void luaX_lookahead (LexState *ls) { +int luaX_lookahead (LexState *ls) { lua_assert(ls->lookahead.token == TK_EOS); ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); + return ls->lookahead.token; } diff --git a/llex.h b/llex.h index fedcbc9e..0148a17f 100644 --- a/llex.h +++ b/llex.h @@ -1,5 +1,5 @@ /* -** $Id: llex.h,v 1.58 2006/03/23 18:23:32 roberto Exp roberto $ +** $Id: llex.h,v 1.59 2007/02/07 17:49:18 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -68,7 +68,7 @@ LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source); LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); LUAI_FUNC void luaX_next (LexState *ls); -LUAI_FUNC void luaX_lookahead (LexState *ls); +LUAI_FUNC int luaX_lookahead (LexState *ls); LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); diff --git a/lparser.c b/lparser.c index dce3db5c..8468ab0e 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.51 2007/02/07 17:49:18 roberto Exp roberto $ +** $Id: lparser.c,v 2.52 2007/03/27 14:11:38 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -522,8 +522,7 @@ static void constructor (LexState *ls, expdesc *t) { closelistfield(fs, &cc); switch(ls->t.token) { case TK_NAME: { /* may be listfields or recfields */ - luaX_lookahead(ls); - if (ls->lookahead.token != '=') /* expression? */ + if (luaX_lookahead(ls) != '=') /* expression? */ listfield(ls, &cc); else recfield(ls, &cc);