aboutsummaryrefslogtreecommitdiff
path: root/lex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1995-10-25 11:05:51 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1995-10-25 11:05:51 -0200
commit9efc257d9d774501af4538a289729f3e8e5e3d7e (patch)
treec4113f56f9bdcf6e1e66ac11f2cf5483387f3bc8 /lex.c
parentfa71304e54f304ceceddef3a4b97b38228822e94 (diff)
downloadlua-9efc257d9d774501af4538a289729f3e8e5e3d7e.tar.gz
lua-9efc257d9d774501af4538a289729f3e8e5e3d7e.tar.bz2
lua-9efc257d9d774501af4538a289729f3e8e5e3d7e.zip
new method to keep debug line information: current line is stored on the
Lua stack, just below (new) base, with tag LUA_T_LINE. SETLINE opcodes are generated by lex.
Diffstat (limited to 'lex.c')
-rw-r--r--lex.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lex.c b/lex.c
index 3b24857d..6c1f2ac5 100644
--- a/lex.c
+++ b/lex.c
@@ -1,4 +1,4 @@
1char *rcs_lex = "$Id: lex.c,v 2.18 1995/10/06 13:10:53 roberto Exp roberto $"; 1char *rcs_lex = "$Id: lex.c,v 2.19 1995/10/13 15:16:25 roberto Exp roberto $";
2 2
3 3
4#include <ctype.h> 4#include <ctype.h>
@@ -148,6 +148,10 @@ static int read_long_string (void)
148int yylex (void) 148int yylex (void)
149{ 149{
150 float a; 150 float a;
151 static int linelasttoken = 0;
152 if (lua_debug)
153 luaI_codedebugline(linelasttoken);
154 linelasttoken = lua_linenumber;
151 while (1) 155 while (1)
152 { 156 {
153 yytextLast = yytext; 157 yytextLast = yytext;
@@ -159,7 +163,7 @@ int yylex (void)
159 case EOF: 163 case EOF:
160 case 0: 164 case 0:
161 return 0; 165 return 0;
162 case '\n': lua_linenumber++; 166 case '\n': linelasttoken = ++lua_linenumber;
163 case ' ': 167 case ' ':
164 case '\r': /* CR: to avoid problems with DOS/Windows */ 168 case '\r': /* CR: to avoid problems with DOS/Windows */
165 case '\t': 169 case '\t':