From 5a8bb00df443dfdb5708689f32c64e90f2557bf8 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 4 Mar 1999 18:23:39 -0300 Subject: storing chunk "sources" instead of "filenames". --- llex.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'llex.c') diff --git a/llex.c b/llex.c index 88a57d97..0addaf47 100644 --- a/llex.c +++ b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 1.29 1999/02/25 15:17:01 roberto Exp roberto $ +** $Id: llex.c,v 1.30 1999/02/25 19:13:56 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -32,8 +32,7 @@ char *reserved [] = {"and", "do", "else", "elseif", "end", "function", "until", "while"}; -void luaX_init (void) -{ +void luaX_init (void) { int i; for (i=0; i<(sizeof(reserved)/sizeof(reserved[0])); i++) { TaggedString *ts = luaS_new(reserved[i]); @@ -42,11 +41,16 @@ void luaX_init (void) } +#define MAXSRC 40 + void luaX_syntaxerror (LexState *ls, char *s, char *token) { + char buff[MAXSRC]; + luaL_chunkid(buff, zname(ls->lex_z), MAXSRC); if (token[0] == '\0') token = ""; - luaL_verror("%.100s;\n last token read: `%.50s' at line %d in chunk `%.50s'", - s, token, ls->linenumber, zname(ls->lex_z)); + luaL_verror("%.100s;\n last token read: `%.50s' " + "at line %d from %.50s", + s, token, ls->linenumber, buff); } -- cgit v1.2.3-55-g6feb