aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-11-08 17:08:30 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-11-08 17:08:30 -0200
commita103455dda85bb8a2e852e83a4748aa20d485180 (patch)
tree9eb9e4b55d5d86c0e1e4270c020e10c9d95cec00
parent60242e1930e5999a5fcc5491cd597cc2a5bd97fb (diff)
downloadlua-a103455dda85bb8a2e852e83a4748aa20d485180.tar.gz
lua-a103455dda85bb8a2e852e83a4748aa20d485180.tar.bz2
lua-a103455dda85bb8a2e852e83a4748aa20d485180.zip
better format for error messages.
-rw-r--r--lex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lex.c b/lex.c
index ce0b4dac..b4513919 100644
--- a/lex.c
+++ b/lex.c
@@ -1,4 +1,4 @@
1char *rcs_lex = "$Id: lex.c,v 2.38 1996/11/08 12:20:34 roberto Exp roberto $"; 1char *rcs_lex = "$Id: lex.c,v 2.38 1996/11/08 12:49:35 roberto Exp roberto $";
2 2
3 3
4#include <ctype.h> 4#include <ctype.h>
@@ -36,7 +36,7 @@ void luaI_syntaxerror (char *s)
36 char *token = luaI_buffer(1); 36 char *token = luaI_buffer(1);
37 if (token[0] == 0) 37 if (token[0] == 0)
38 token = "<eof>"; 38 token = "<eof>";
39 sprintf (msg,"%s; last token read: \"%s\" at line %d in file `%s'", 39 sprintf (msg,"%s;\n> last token read: \"%s\" at line %d in file %s",
40 s, token, lua_linenumber, lua_parsedfile); 40 s, token, lua_linenumber, lua_parsedfile);
41 lua_error (msg); 41 lua_error (msg);
42} 42}
@@ -80,6 +80,7 @@ void luaI_addReserved (void)
80 80
81static int inclinenumber (int pragma_allowed) 81static int inclinenumber (int pragma_allowed)
82{ 82{
83 ++lua_linenumber;
83 if (pragma_allowed && current == '$') { /* is a pragma? */ 84 if (pragma_allowed && current == '$') { /* is a pragma? */
84 char *buff = luaI_buffer(MINBUFF+1); 85 char *buff = luaI_buffer(MINBUFF+1);
85 int i = 0; 86 int i = 0;
@@ -96,7 +97,7 @@ static int inclinenumber (int pragma_allowed)
96 lua_debug = 0; 97 lua_debug = 0;
97 else luaI_syntaxerror("invalid pragma"); 98 else luaI_syntaxerror("invalid pragma");
98 } 99 }
99 return ++lua_linenumber; 100 return lua_linenumber;
100} 101}
101 102
102static int read_long_string (char *yytext, int buffsize) 103static int read_long_string (char *yytext, int buffsize)