diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-05-22 14:45:56 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-05-22 14:45:56 -0300 |
commit | 6142e663e4d3180d2afaea50bd0978a040f518a4 (patch) | |
tree | 55d789eb4fa54dba3bf936b7f9ea5751ad4742fa /llex.c | |
parent | 6dc20ff293239efd59ec8be7d14a31af084e28d5 (diff) | |
download | lua-6142e663e4d3180d2afaea50bd0978a040f518a4.tar.gz lua-6142e663e4d3180d2afaea50bd0978a040f518a4.tar.bz2 lua-6142e663e4d3180d2afaea50bd0978a040f518a4.zip |
reuse of 'addinfo' by lexical errors
Diffstat (limited to 'llex.c')
-rw-r--r-- | llex.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 2.91 2015/03/28 19:14:47 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.92 2015/04/03 18:41:57 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 | */ |
@@ -16,6 +16,7 @@ | |||
16 | #include "lua.h" | 16 | #include "lua.h" |
17 | 17 | ||
18 | #include "lctype.h" | 18 | #include "lctype.h" |
19 | #include "ldebug.h" | ||
19 | #include "ldo.h" | 20 | #include "ldo.h" |
20 | #include "lgc.h" | 21 | #include "lgc.h" |
21 | #include "llex.h" | 22 | #include "llex.h" |
@@ -106,9 +107,7 @@ static const char *txtToken (LexState *ls, int token) { | |||
106 | 107 | ||
107 | 108 | ||
108 | static l_noret lexerror (LexState *ls, const char *msg, int token) { | 109 | static l_noret lexerror (LexState *ls, const char *msg, int token) { |
109 | char buff[LUA_IDSIZE]; | 110 | msg = luaG_addinfo(ls->L, msg, ls->source, ls->linenumber); |
110 | luaO_chunkid(buff, getstr(ls->source), LUA_IDSIZE); | ||
111 | msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); | ||
112 | if (token) | 111 | if (token) |
113 | luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token)); | 112 | luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token)); |
114 | luaD_throw(ls->L, LUA_ERRSYNTAX); | 113 | luaD_throw(ls->L, LUA_ERRSYNTAX); |