diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-05-11 14:28:56 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-05-11 14:28:56 -0300 |
| commit | aa003eba8e64046ebb5631eb9d94c2b556e2bab8 (patch) | |
| tree | ff826a34eefbfeab932441707ca70d3e21a4211a | |
| parent | becf19feeffeb0bf2297e163da4ccc7b4b5e6b5c (diff) | |
| download | lua-aa003eba8e64046ebb5631eb9d94c2b556e2bab8.tar.gz lua-aa003eba8e64046ebb5631eb9d94c2b556e2bab8.tar.bz2 lua-aa003eba8e64046ebb5631eb9d94c2b556e2bab8.zip | |
details
| -rw-r--r-- | llex.c | 5 | ||||
| -rw-r--r-- | llex.h | 4 | ||||
| -rw-r--r-- | lparser.c | 5 |
3 files changed, 7 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.c,v 2.23 2006/09/18 16:06:41 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.24 2007/02/07 17:49:18 roberto Exp roberto $ |
| 3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -442,8 +442,9 @@ void luaX_next (LexState *ls) { | |||
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | 444 | ||
| 445 | void luaX_lookahead (LexState *ls) { | 445 | int luaX_lookahead (LexState *ls) { |
| 446 | lua_assert(ls->lookahead.token == TK_EOS); | 446 | lua_assert(ls->lookahead.token == TK_EOS); |
| 447 | ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); | 447 | ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); |
| 448 | return ls->lookahead.token; | ||
| 448 | } | 449 | } |
| 449 | 450 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.h,v 1.58 2006/03/23 18:23:32 roberto Exp roberto $ | 2 | ** $Id: llex.h,v 1.59 2007/02/07 17:49:18 roberto Exp roberto $ |
| 3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -68,7 +68,7 @@ LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, | |||
| 68 | TString *source); | 68 | TString *source); |
| 69 | LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); | 69 | LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); |
| 70 | LUAI_FUNC void luaX_next (LexState *ls); | 70 | LUAI_FUNC void luaX_next (LexState *ls); |
| 71 | LUAI_FUNC void luaX_lookahead (LexState *ls); | 71 | LUAI_FUNC int luaX_lookahead (LexState *ls); |
| 72 | LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); | 72 | LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); |
| 73 | LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); | 73 | LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); |
| 74 | LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); | 74 | LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.51 2007/02/07 17:49:18 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.52 2007/03/27 14:11:38 roberto Exp roberto $ |
| 3 | ** Lua Parser | 3 | ** Lua Parser |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -522,8 +522,7 @@ static void constructor (LexState *ls, expdesc *t) { | |||
| 522 | closelistfield(fs, &cc); | 522 | closelistfield(fs, &cc); |
| 523 | switch(ls->t.token) { | 523 | switch(ls->t.token) { |
| 524 | case TK_NAME: { /* may be listfields or recfields */ | 524 | case TK_NAME: { /* may be listfields or recfields */ |
| 525 | luaX_lookahead(ls); | 525 | if (luaX_lookahead(ls) != '=') /* expression? */ |
| 526 | if (ls->lookahead.token != '=') /* expression? */ | ||
| 527 | listfield(ls, &cc); | 526 | listfield(ls, &cc); |
| 528 | else | 527 | else |
| 529 | recfield(ls, &cc); | 528 | recfield(ls, &cc); |
