aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-11-08 10:49:35 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-11-08 10:49:35 -0200
commita0e9bfbb48fdfae8188333710c2ce86051477a96 (patch)
tree1677b5297337621305f794dd690d1d720ad2df00
parent2f19e0ba164d38989dea4a3389753ed75858e5a1 (diff)
downloadlua-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.h4
-rw-r--r--lua.stx10
2 files changed, 4 insertions, 10 deletions
diff --git a/lex.h b/lex.h
index 0c6b14d9..d6789827 100644
--- a/lex.h
+++ b/lex.h
@@ -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 @@
11typedef int (*Input) (void); 11typedef int (*Input) (void);
12 12
13void lua_setinput (Input fn); 13void lua_setinput (Input fn);
14char *lua_lasttext (void); 14void luaI_syntaxerror (char *s);
15int luaY_lex (void); 15int luaY_lex (void);
16void luaI_addReserved (void); 16void luaI_addReserved (void);
17 17
diff --git a/lua.stx b/lua.stx
index 1e00f88a..a90f5690 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2 2
3char *rcs_luastx = "$Id: lua.stx,v 3.39 1996/09/24 17:29:50 roberto Exp roberto $"; 3char *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
60static void yyerror (char *s) 60static 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
71static void check_space (int i) 65static void check_space (int i)