diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-11-08 10:49:35 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-11-08 10:49:35 -0200 |
commit | a0e9bfbb48fdfae8188333710c2ce86051477a96 (patch) | |
tree | 1677b5297337621305f794dd690d1d720ad2df00 | |
parent | 2f19e0ba164d38989dea4a3389753ed75858e5a1 (diff) | |
download | lua-a0e9bfbb48fdfae8188333710c2ce86051477a96.tar.gz lua-a0e9bfbb48fdfae8188333710c2ce86051477a96.tar.bz2 lua-a0e9bfbb48fdfae8188333710c2ce86051477a96.zip |
syntax error function is in "lex.c" (it has the token)
-rw-r--r-- | lex.h | 4 | ||||
-rw-r--r-- | lua.stx | 10 |
2 files changed, 4 insertions, 10 deletions
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | ** lex.h | 2 | ** lex.h |
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | ** $Id: lex.h,v 1.1 1996/02/13 17:30:39 roberto Exp roberto $ | 4 | ** $Id: lex.h,v 1.2 1996/02/14 13:35:51 roberto Exp roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef lex_h | 7 | #ifndef lex_h |
@@ -11,7 +11,7 @@ | |||
11 | typedef int (*Input) (void); | 11 | typedef int (*Input) (void); |
12 | 12 | ||
13 | void lua_setinput (Input fn); | 13 | void lua_setinput (Input fn); |
14 | char *lua_lasttext (void); | 14 | void luaI_syntaxerror (char *s); |
15 | int luaY_lex (void); | 15 | int luaY_lex (void); |
16 | void luaI_addReserved (void); | 16 | void luaI_addReserved (void); |
17 | 17 | ||
@@ -1,6 +1,6 @@ | |||
1 | %{ | 1 | %{ |
2 | 2 | ||
3 | char *rcs_luastx = "$Id: lua.stx,v 3.39 1996/09/24 17:29:50 roberto Exp roberto $"; | 3 | char *rcs_luastx = "$Id: lua.stx,v 3.40 1996/09/25 21:52:00 roberto Exp roberto $"; |
4 | 4 | ||
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
@@ -59,13 +59,7 @@ int lua_debug = 0; | |||
59 | 59 | ||
60 | static void yyerror (char *s) | 60 | static void yyerror (char *s) |
61 | { | 61 | { |
62 | char msg[256]; | 62 | luaI_syntaxerror(s); |
63 | char *token = lua_lasttext(); | ||
64 | if (token[0] == 0) | ||
65 | token = "<eof>"; | ||
66 | sprintf (msg,"%s; last token read: \"%s\" at line %d in file `%s'", | ||
67 | s, token, lua_linenumber, lua_parsedfile); | ||
68 | lua_error (msg); | ||
69 | } | 63 | } |
70 | 64 | ||
71 | static void check_space (int i) | 65 | static void check_space (int i) |