diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-03 17:12:21 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-03 17:12:21 -0300 |
commit | c398a02110d72422f2c2e1168376d751ec1269db (patch) | |
tree | 10224e1ed29d89bfe2c6392e88d0684eea07fab6 | |
parent | ad7103ea3aed7f40a5cf7055af253b34320134bc (diff) | |
download | lua-c398a02110d72422f2c2e1168376d751ec1269db.tar.gz lua-c398a02110d72422f2c2e1168376d751ec1269db.tar.bz2 lua-c398a02110d72422f2c2e1168376d751ec1269db.zip |
uses `isspace' to recognize space characters
-rw-r--r-- | llex.c | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 1.102 2002/05/16 18:39:46 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 1.103 2002/06/03 14:09:57 roberto Exp roberto $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -306,15 +306,11 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) { | |||
306 | for (;;) { | 306 | for (;;) { |
307 | switch (LS->current) { | 307 | switch (LS->current) { |
308 | 308 | ||
309 | case ' ': case '\t': case '\r': /* `\r' to avoid problems with DOS */ | 309 | case '\n': { |
310 | next(LS); | ||
311 | continue; | ||
312 | |||
313 | case '\n': | ||
314 | inclinenumber(LS); | 310 | inclinenumber(LS); |
315 | continue; | 311 | continue; |
316 | 312 | } | |
317 | case '-': | 313 | case '-': { |
318 | next(LS); | 314 | next(LS); |
319 | if (LS->current != '-') return '-'; | 315 | if (LS->current != '-') return '-'; |
320 | /* else is a comment */ | 316 | /* else is a comment */ |
@@ -325,41 +321,41 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) { | |||
325 | while (LS->current != '\n' && LS->current != EOZ) | 321 | while (LS->current != '\n' && LS->current != EOZ) |
326 | next(LS); | 322 | next(LS); |
327 | continue; | 323 | continue; |
328 | 324 | } | |
329 | case '[': | 325 | case '[': { |
330 | next(LS); | 326 | next(LS); |
331 | if (LS->current != '[') return '['; | 327 | if (LS->current != '[') return '['; |
332 | else { | 328 | else { |
333 | read_long_string(LS, seminfo); | 329 | read_long_string(LS, seminfo); |
334 | return TK_STRING; | 330 | return TK_STRING; |
335 | } | 331 | } |
336 | 332 | } | |
337 | case '=': | 333 | case '=': { |
338 | next(LS); | 334 | next(LS); |
339 | if (LS->current != '=') return '='; | 335 | if (LS->current != '=') return '='; |
340 | else { next(LS); return TK_EQ; } | 336 | else { next(LS); return TK_EQ; } |
341 | 337 | } | |
342 | case '<': | 338 | case '<': { |
343 | next(LS); | 339 | next(LS); |
344 | if (LS->current != '=') return '<'; | 340 | if (LS->current != '=') return '<'; |
345 | else { next(LS); return TK_LE; } | 341 | else { next(LS); return TK_LE; } |
346 | 342 | } | |
347 | case '>': | 343 | case '>': { |
348 | next(LS); | 344 | next(LS); |
349 | if (LS->current != '=') return '>'; | 345 | if (LS->current != '=') return '>'; |
350 | else { next(LS); return TK_GE; } | 346 | else { next(LS); return TK_GE; } |
351 | 347 | } | |
352 | case '~': | 348 | case '~': { |
353 | next(LS); | 349 | next(LS); |
354 | if (LS->current != '=') return '~'; | 350 | if (LS->current != '=') return '~'; |
355 | else { next(LS); return TK_NE; } | 351 | else { next(LS); return TK_NE; } |
356 | 352 | } | |
357 | case '"': | 353 | case '"': |
358 | case '\'': | 354 | case '\'': { |
359 | read_string(LS, LS->current, seminfo); | 355 | read_string(LS, LS->current, seminfo); |
360 | return TK_STRING; | 356 | return TK_STRING; |
361 | 357 | } | |
362 | case '.': | 358 | case '.': { |
363 | next(LS); | 359 | next(LS); |
364 | if (LS->current == '.') { | 360 | if (LS->current == '.') { |
365 | next(LS); | 361 | next(LS); |
@@ -374,12 +370,16 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) { | |||
374 | read_number(LS, 1, seminfo); | 370 | read_number(LS, 1, seminfo); |
375 | return TK_NUMBER; | 371 | return TK_NUMBER; |
376 | } | 372 | } |
377 | 373 | } | |
378 | case EOZ: | 374 | case EOZ: { |
379 | return TK_EOS; | 375 | return TK_EOS; |
380 | 376 | } | |
381 | default: { | 377 | default: { |
382 | if (isdigit(LS->current)) { | 378 | if (isspace(LS->current)) { |
379 | next(LS); | ||
380 | continue; | ||
381 | } | ||
382 | else if (isdigit(LS->current)) { | ||
383 | read_number(LS, 0, seminfo); | 383 | read_number(LS, 0, seminfo); |
384 | return TK_NUMBER; | 384 | return TK_NUMBER; |
385 | } | 385 | } |