diff options
Diffstat (limited to 'llex.c')
-rw-r--r-- | llex.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 1.29 1999/02/25 15:17:01 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 1.30 1999/02/25 19:13:56 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 | */ |
@@ -32,8 +32,7 @@ char *reserved [] = {"and", "do", "else", "elseif", "end", "function", | |||
32 | "until", "while"}; | 32 | "until", "while"}; |
33 | 33 | ||
34 | 34 | ||
35 | void luaX_init (void) | 35 | void luaX_init (void) { |
36 | { | ||
37 | int i; | 36 | int i; |
38 | for (i=0; i<(sizeof(reserved)/sizeof(reserved[0])); i++) { | 37 | for (i=0; i<(sizeof(reserved)/sizeof(reserved[0])); i++) { |
39 | TaggedString *ts = luaS_new(reserved[i]); | 38 | TaggedString *ts = luaS_new(reserved[i]); |
@@ -42,11 +41,16 @@ void luaX_init (void) | |||
42 | } | 41 | } |
43 | 42 | ||
44 | 43 | ||
44 | #define MAXSRC 40 | ||
45 | |||
45 | void luaX_syntaxerror (LexState *ls, char *s, char *token) { | 46 | void luaX_syntaxerror (LexState *ls, char *s, char *token) { |
47 | char buff[MAXSRC]; | ||
48 | luaL_chunkid(buff, zname(ls->lex_z), MAXSRC); | ||
46 | if (token[0] == '\0') | 49 | if (token[0] == '\0') |
47 | token = "<eof>"; | 50 | token = "<eof>"; |
48 | luaL_verror("%.100s;\n last token read: `%.50s' at line %d in chunk `%.50s'", | 51 | luaL_verror("%.100s;\n last token read: `%.50s' " |
49 | s, token, ls->linenumber, zname(ls->lex_z)); | 52 | "at line %d from %.50s", |
53 | s, token, ls->linenumber, buff); | ||
50 | } | 54 | } |
51 | 55 | ||
52 | 56 | ||