mirror of https://github.com/lua/lua
syntax error function is in "lex.c" (it has the token)
This commit is contained in:
parent
2f19e0ba16
commit
a0e9bfbb48
4
lex.h
4
lex.h
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
** lex.h
|
||||
** TecCGraf - PUC-Rio
|
||||
** $Id: lex.h,v 1.1 1996/02/13 17:30:39 roberto Exp roberto $
|
||||
** $Id: lex.h,v 1.2 1996/02/14 13:35:51 roberto Exp roberto $
|
||||
*/
|
||||
|
||||
#ifndef lex_h
|
||||
|
@ -11,7 +11,7 @@
|
|||
typedef int (*Input) (void);
|
||||
|
||||
void lua_setinput (Input fn);
|
||||
char *lua_lasttext (void);
|
||||
void luaI_syntaxerror (char *s);
|
||||
int luaY_lex (void);
|
||||
void luaI_addReserved (void);
|
||||
|
||||
|
|
10
lua.stx
10
lua.stx
|
@ -1,6 +1,6 @@
|
|||
%{
|
||||
|
||||
char *rcs_luastx = "$Id: lua.stx,v 3.39 1996/09/24 17:29:50 roberto Exp roberto $";
|
||||
char *rcs_luastx = "$Id: lua.stx,v 3.40 1996/09/25 21:52:00 roberto Exp roberto $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -59,13 +59,7 @@ int lua_debug = 0;
|
|||
|
||||
static void yyerror (char *s)
|
||||
{
|
||||
char msg[256];
|
||||
char *token = lua_lasttext();
|
||||
if (token[0] == 0)
|
||||
token = "<eof>";
|
||||
sprintf (msg,"%s; last token read: \"%s\" at line %d in file `%s'",
|
||||
s, token, lua_linenumber, lua_parsedfile);
|
||||
lua_error (msg);
|
||||
luaI_syntaxerror(s);
|
||||
}
|
||||
|
||||
static void check_space (int i)
|
||||
|
|
Loading…
Reference in New Issue