diff options
Diffstat (limited to 'llex.c')
-rw-r--r-- | llex.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 1.116 2002/10/23 19:08:13 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 1.117 2002/12/04 17:38:31 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 | */ |
@@ -59,15 +59,20 @@ void luaX_checklimit (LexState *ls, int val, int limit, const char *msg) { | |||
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | static void luaX_error (LexState *ls, const char *s, const char *token) { | 62 | void luaX_errorline (LexState *ls, const char *s, const char *token, int line) { |
63 | lua_State *L = ls->L; | 63 | lua_State *L = ls->L; |
64 | char buff[MAXSRC]; | 64 | char buff[MAXSRC]; |
65 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); | 65 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); |
66 | luaO_pushfstring(L, "%s:%d: %s near `%s'", buff, ls->linenumber, s, token); | 66 | luaO_pushfstring(L, "%s:%d: %s near `%s'", buff, line, s, token); |
67 | luaD_throw(L, LUA_ERRSYNTAX); | 67 | luaD_throw(L, LUA_ERRSYNTAX); |
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | static void luaX_error (LexState *ls, const char *s, const char *token) { | ||
72 | luaX_errorline(ls, s, token, ls->linenumber); | ||
73 | } | ||
74 | |||
75 | |||
71 | void luaX_syntaxerror (LexState *ls, const char *msg) { | 76 | void luaX_syntaxerror (LexState *ls, const char *msg) { |
72 | const char *lasttoken; | 77 | const char *lasttoken; |
73 | switch (ls->t.token) { | 78 | switch (ls->t.token) { |