diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-11-08 17:08:30 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-11-08 17:08:30 -0200 |
commit | a103455dda85bb8a2e852e83a4748aa20d485180 (patch) | |
tree | 9eb9e4b55d5d86c0e1e4270c020e10c9d95cec00 | |
parent | 60242e1930e5999a5fcc5491cd597cc2a5bd97fb (diff) | |
download | lua-github-a103455dda85bb8a2e852e83a4748aa20d485180.tar.gz |
better format for error messages.
-rw-r--r-- | lex.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,4 +1,4 @@ -char *rcs_lex = "$Id: lex.c,v 2.38 1996/11/08 12:20:34 roberto Exp roberto $"; +char *rcs_lex = "$Id: lex.c,v 2.38 1996/11/08 12:49:35 roberto Exp roberto $"; #include <ctype.h> @@ -36,7 +36,7 @@ void luaI_syntaxerror (char *s) char *token = luaI_buffer(1); if (token[0] == 0) token = "<eof>"; - sprintf (msg,"%s; last token read: \"%s\" at line %d in file `%s'", + sprintf (msg,"%s;\n> last token read: \"%s\" at line %d in file %s", s, token, lua_linenumber, lua_parsedfile); lua_error (msg); } @@ -80,6 +80,7 @@ void luaI_addReserved (void) static int inclinenumber (int pragma_allowed) { + ++lua_linenumber; if (pragma_allowed && current == '$') { /* is a pragma? */ char *buff = luaI_buffer(MINBUFF+1); int i = 0; @@ -96,7 +97,7 @@ static int inclinenumber (int pragma_allowed) lua_debug = 0; else luaI_syntaxerror("invalid pragma"); } - return ++lua_linenumber; + return lua_linenumber; } static int read_long_string (char *yytext, int buffsize) |