diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-09-09 11:11:11 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-09-09 11:11:11 -0300 |
commit | f0cc2d55067d32c1232d9483721254360d4c3bae (patch) | |
tree | 3aff379cd171fdf2b4406cdd9bce1b466661f395 /lex.c | |
parent | d289ac81d3629f8dc494a11929d16f03accd1007 (diff) | |
download | lua-f0cc2d55067d32c1232d9483721254360d4c3bae.tar.gz lua-f0cc2d55067d32c1232d9483721254360d4c3bae.tar.bz2 lua-f0cc2d55067d32c1232d9483721254360d4c3bae.zip |
BUG: a program ending in a comment without EOL made lex loops forever.
Diffstat (limited to 'lex.c')
-rw-r--r-- | lex.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -1,4 +1,4 @@ | |||
1 | char *rcs_lex = "$Id: lex.c,v 2.33 1996/05/28 21:07:32 roberto Exp roberto $"; | 1 | char *rcs_lex = "$Id: lex.c,v 2.34 1996/05/30 14:04:07 roberto Exp roberto $"; |
2 | 2 | ||
3 | 3 | ||
4 | #include <ctype.h> | 4 | #include <ctype.h> |
@@ -82,7 +82,6 @@ static int read_long_string (char *yytext, int buffsize) | |||
82 | yytext = luaI_buffer(buffsize *= 2); | 82 | yytext = luaI_buffer(buffsize *= 2); |
83 | switch (current) | 83 | switch (current) |
84 | { | 84 | { |
85 | case EOF: | ||
86 | case 0: | 85 | case 0: |
87 | save(0); | 86 | save(0); |
88 | return WRONGTOKEN; | 87 | return WRONGTOKEN; |
@@ -132,10 +131,6 @@ int luaY_lex (void) | |||
132 | int tokensize = 0; | 131 | int tokensize = 0; |
133 | switch (current) | 132 | switch (current) |
134 | { | 133 | { |
135 | case EOF: | ||
136 | case 0: | ||
137 | save(0); | ||
138 | return 0; | ||
139 | case '\n': linelasttoken = ++lua_linenumber; | 134 | case '\n': linelasttoken = ++lua_linenumber; |
140 | case ' ': | 135 | case ' ': |
141 | case '\r': /* CR: to avoid problems with DOS/Windows */ | 136 | case '\r': /* CR: to avoid problems with DOS/Windows */ |
@@ -206,7 +201,6 @@ int luaY_lex (void) | |||
206 | yytext = luaI_buffer(buffsize *= 2); | 201 | yytext = luaI_buffer(buffsize *= 2); |
207 | switch (current) | 202 | switch (current) |
208 | { | 203 | { |
209 | case EOF: | ||
210 | case 0: | 204 | case 0: |
211 | case '\n': | 205 | case '\n': |
212 | save(0); | 206 | save(0); |
@@ -316,7 +310,7 @@ int luaY_lex (void) | |||
316 | return NUMBER; | 310 | return NUMBER; |
317 | } | 311 | } |
318 | 312 | ||
319 | default: /* also end of file */ | 313 | default: /* also end of program (0) */ |
320 | { | 314 | { |
321 | save_and_next(); | 315 | save_and_next(); |
322 | return yytext[0]; | 316 | return yytext[0]; |