aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-02-28 14:19:47 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-02-28 14:19:47 -0300
commit6b6bc532a4f5e335540e6f19914cfe8435d064ed (patch)
treea7d456a86bf86ef6d6e1333d7372f17ad9562773 /llex.c
parentea16ee41a8b0e6fe2c8f77e901a7d99173065beb (diff)
downloadlua-6b6bc532a4f5e335540e6f19914cfe8435d064ed.tar.gz
lua-6b6bc532a4f5e335540e6f19914cfe8435d064ed.tar.bz2
lua-6b6bc532a4f5e335540e6f19914cfe8435d064ed.zip
better error message for (deprecated) "%global"
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/llex.c b/llex.c
index 4b67b2d1..c1df127e 100644
--- a/llex.c
+++ b/llex.c
@@ -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
62static void luaX_error (LexState *ls, const char *s, const char *token) { 62void 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
71static void luaX_error (LexState *ls, const char *s, const char *token) {
72 luaX_errorline(ls, s, token, ls->linenumber);
73}
74
75
71void luaX_syntaxerror (LexState *ls, const char *msg) { 76void 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) {