diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-10-20 10:24:34 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-10-20 10:24:34 -0200 |
| commit | 8502331f69a3a13bce0b2afca36dd3f607eb3696 (patch) | |
| tree | 8a73d020917eb3fd8ecfa6a135d649d84be7853b | |
| parent | 9914e1bcddfb7ba0e5b4597a0540df8ec3111b3f (diff) | |
| download | lua-8502331f69a3a13bce0b2afca36dd3f607eb3696.tar.gz lua-8502331f69a3a13bce0b2afca36dd3f607eb3696.tar.bz2 lua-8502331f69a3a13bce0b2afca36dd3f607eb3696.zip | |
`luaX_errorline' was used only in one place
| -rw-r--r-- | llex.c | 22 | ||||
| -rw-r--r-- | llex.h | 3 |
2 files changed, 7 insertions, 18 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.c,v 1.126 2003/10/03 16:05:34 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 1.127 2003/10/03 16:07:44 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 | */ |
| @@ -69,20 +69,6 @@ void luaX_checklimit (LexState *ls, int val, int limit, const char *msg) { | |||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | void luaX_errorline (LexState *ls, const char *s, const char *token, int line) { | ||
| 73 | lua_State *L = ls->L; | ||
| 74 | char buff[MAXSRC]; | ||
| 75 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); | ||
| 76 | luaO_pushfstring(L, "%s:%d: %s near `%s'", buff, line, s, token); | ||
| 77 | luaD_throw(L, LUA_ERRSYNTAX); | ||
| 78 | } | ||
| 79 | |||
| 80 | |||
| 81 | static void luaX_error (LexState *ls, const char *s, const char *token) { | ||
| 82 | luaX_errorline(ls, s, token, ls->linenumber); | ||
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | const char *luaX_token2str (LexState *ls, int token) { | 72 | const char *luaX_token2str (LexState *ls, int token) { |
| 87 | if (token < FIRST_RESERVED) { | 73 | if (token < FIRST_RESERVED) { |
| 88 | lua_assert(token == (unsigned char)token); | 74 | lua_assert(token == (unsigned char)token); |
| @@ -108,7 +94,11 @@ static const char *txtToken (LexState *ls, int token) { | |||
| 108 | 94 | ||
| 109 | 95 | ||
| 110 | static void luaX_lexerror (LexState *ls, const char *msg, int token) { | 96 | static void luaX_lexerror (LexState *ls, const char *msg, int token) { |
| 111 | luaX_error(ls, msg, txtToken(ls, token)); | 97 | char buff[MAXSRC]; |
| 98 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); | ||
| 99 | luaO_pushfstring(ls->L, "%s:%d: %s near `%s'", | ||
| 100 | buff, ls->linenumber, msg, txtToken(ls, token)); | ||
| 101 | luaD_throw(ls->L, LUA_ERRSYNTAX); | ||
| 112 | } | 102 | } |
| 113 | 103 | ||
| 114 | 104 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.h,v 1.47 2003/02/28 17:19:47 roberto Exp roberto $ | 2 | ** $Id: llex.h,v 1.48 2003/08/27 21:01:44 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 | */ |
| @@ -69,7 +69,6 @@ TString *luaX_newstring (LexState *LS, const char *str, size_t l); | |||
| 69 | int luaX_lex (LexState *LS, SemInfo *seminfo); | 69 | int luaX_lex (LexState *LS, SemInfo *seminfo); |
| 70 | void luaX_checklimit (LexState *ls, int val, int limit, const char *msg); | 70 | void luaX_checklimit (LexState *ls, int val, int limit, const char *msg); |
| 71 | void luaX_syntaxerror (LexState *ls, const char *s); | 71 | void luaX_syntaxerror (LexState *ls, const char *s); |
| 72 | void luaX_errorline (LexState *ls, const char *s, const char *token, int line); | ||
| 73 | const char *luaX_token2str (LexState *ls, int token); | 72 | const char *luaX_token2str (LexState *ls, int token); |
| 74 | 73 | ||
| 75 | 74 | ||
