aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c22
1 files changed, 6 insertions, 16 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