diff options
Diffstat (limited to 'lex.c')
-rw-r--r-- | lex.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -1,4 +1,4 @@ | |||
1 | char *rcs_lex = "$Id: lex.c,v 2.39 1996/11/08 19:08:30 roberto Exp roberto $"; | 1 | char *rcs_lex = "$Id: lex.c,v 2.40 1996/11/21 14:44:04 roberto Exp roberto $"; |
2 | 2 | ||
3 | 3 | ||
4 | #include <ctype.h> | 4 | #include <ctype.h> |
@@ -85,7 +85,7 @@ static int inclinenumber (int pragma_allowed) | |||
85 | char *buff = luaI_buffer(MINBUFF+1); | 85 | char *buff = luaI_buffer(MINBUFF+1); |
86 | int i = 0; | 86 | int i = 0; |
87 | next(); /* skip $ */ | 87 | next(); /* skip $ */ |
88 | while (isalnum(current)) { | 88 | while (isalnum((unsigned char)current)) { |
89 | if (i >= MINBUFF) luaI_syntaxerror("pragma too long"); | 89 | if (i >= MINBUFF) luaI_syntaxerror("pragma too long"); |
90 | buff[i++] = current; | 90 | buff[i++] = current; |
91 | next(); | 91 | next(); |
@@ -259,7 +259,9 @@ int luaY_lex (void) | |||
259 | case '_': | 259 | case '_': |
260 | { | 260 | { |
261 | TaggedString *ts; | 261 | TaggedString *ts; |
262 | do { save_and_next(); } while (isalnum(current) || current == '_'); | 262 | do { |
263 | save_and_next(); | ||
264 | } while (isalnum((unsigned char)current) || current == '_'); | ||
263 | save(0); | 265 | save(0); |
264 | ts = lua_createstring(yytext); | 266 | ts = lua_createstring(yytext); |
265 | if (ts->marked > 2) | 267 | if (ts->marked > 2) |
@@ -281,7 +283,7 @@ int luaY_lex (void) | |||
281 | } | 283 | } |
282 | else return CONC; /* .. */ | 284 | else return CONC; /* .. */ |
283 | } | 285 | } |
284 | else if (!isdigit(current)) return '.'; | 286 | else if (!isdigit((unsigned char)current)) return '.'; |
285 | /* current is a digit: goes through to number */ | 287 | /* current is a digit: goes through to number */ |
286 | a=0.0; | 288 | a=0.0; |
287 | goto fraction; | 289 | goto fraction; |
@@ -292,7 +294,7 @@ int luaY_lex (void) | |||
292 | do { | 294 | do { |
293 | a=10.0*a+(current-'0'); | 295 | a=10.0*a+(current-'0'); |
294 | save_and_next(); | 296 | save_and_next(); |
295 | } while (isdigit(current)); | 297 | } while (isdigit((unsigned char)current)); |
296 | if (current == '.') { | 298 | if (current == '.') { |
297 | save_and_next(); | 299 | save_and_next(); |
298 | if (current == '.') | 300 | if (current == '.') |
@@ -301,7 +303,7 @@ int luaY_lex (void) | |||
301 | } | 303 | } |
302 | fraction: | 304 | fraction: |
303 | { double da=0.1; | 305 | { double da=0.1; |
304 | while (isdigit(current)) | 306 | while (isdigit((unsigned char)current)) |
305 | { | 307 | { |
306 | a+=(current-'0')*da; | 308 | a+=(current-'0')*da; |
307 | da/=10.0; | 309 | da/=10.0; |
@@ -315,11 +317,12 @@ int luaY_lex (void) | |||
315 | save_and_next(); | 317 | save_and_next(); |
316 | neg=(current=='-'); | 318 | neg=(current=='-'); |
317 | if (current == '+' || current == '-') save_and_next(); | 319 | if (current == '+' || current == '-') save_and_next(); |
318 | if (!isdigit(current)) { save(0); return WRONGTOKEN; } | 320 | if (!isdigit((unsigned char)current)) { |
321 | save(0); return WRONGTOKEN; } | ||
319 | do { | 322 | do { |
320 | e=10.0*e+(current-'0'); | 323 | e=10.0*e+(current-'0'); |
321 | save_and_next(); | 324 | save_and_next(); |
322 | } while (isdigit(current)); | 325 | } while (isdigit((unsigned char)current)); |
323 | for (ea=neg?0.1:10.0; e>0; e>>=1) | 326 | for (ea=neg?0.1:10.0; e>0; e>>=1) |
324 | { | 327 | { |
325 | if (e & 1) a*=ea; | 328 | if (e & 1) a*=ea; |