aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-10-20 10:24:34 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-10-20 10:24:34 -0200
commit8502331f69a3a13bce0b2afca36dd3f607eb3696 (patch)
tree8a73d020917eb3fd8ecfa6a135d649d84be7853b
parent9914e1bcddfb7ba0e5b4597a0540df8ec3111b3f (diff)
downloadlua-8502331f69a3a13bce0b2afca36dd3f607eb3696.tar.gz
lua-8502331f69a3a13bce0b2afca36dd3f607eb3696.tar.bz2
lua-8502331f69a3a13bce0b2afca36dd3f607eb3696.zip
`luaX_errorline' was used only in one place
-rw-r--r--llex.c22
-rw-r--r--llex.h3
2 files changed, 7 insertions, 18 deletions
diff --git a/llex.c b/llex.c
index c7a28d52..e4b2d74f 100644
--- a/llex.c
+++ b/llex.c
@@ -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
72void 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
81static void luaX_error (LexState *ls, const char *s, const char *token) {
82 luaX_errorline(ls, s, token, ls->linenumber);
83}
84
85
86const char *luaX_token2str (LexState *ls, int token) { 72const 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
110static void luaX_lexerror (LexState *ls, const char *msg, int token) { 96static 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
diff --git a/llex.h b/llex.h
index a97def0a..e37c6f54 100644
--- a/llex.h
+++ b/llex.h
@@ -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);
69int luaX_lex (LexState *LS, SemInfo *seminfo); 69int luaX_lex (LexState *LS, SemInfo *seminfo);
70void luaX_checklimit (LexState *ls, int val, int limit, const char *msg); 70void luaX_checklimit (LexState *ls, int val, int limit, const char *msg);
71void luaX_syntaxerror (LexState *ls, const char *s); 71void luaX_syntaxerror (LexState *ls, const char *s);
72void luaX_errorline (LexState *ls, const char *s, const char *token, int line);
73const char *luaX_token2str (LexState *ls, int token); 72const char *luaX_token2str (LexState *ls, int token);
74 73
75 74