diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-07-01 16:32:41 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-07-01 16:32:41 -0300 |
commit | 7820a47184c0079677c5c430125f0541af05c8b6 (patch) | |
tree | 10ffcef30c0fa0a172056529b90176133220159d /lex.c | |
parent | 88b185ada15b76d6bfe8bb5e2d38935cf32e618a (diff) | |
download | lua-7820a47184c0079677c5c430125f0541af05c8b6.tar.gz lua-7820a47184c0079677c5c430125f0541af05c8b6.tar.bz2 lua-7820a47184c0079677c5c430125f0541af05c8b6.zip |
LOCALE support
Diffstat (limited to 'lex.c')
-rw-r--r-- | lex.c | 54 |
1 files changed, 20 insertions, 34 deletions
@@ -1,4 +1,4 @@ | |||
1 | char *rcs_lex = "$Id: lex.c,v 3.4 1997/06/11 18:56:02 roberto Exp roberto $"; | 1 | char *rcs_lex = "$Id: lex.c,v 3.5 1997/06/16 16:50:22 roberto Exp roberto $"; |
2 | 2 | ||
3 | 3 | ||
4 | #include <ctype.h> | 4 | #include <ctype.h> |
@@ -278,11 +278,9 @@ int luaY_lex (void) | |||
278 | if (lua_debug) | 278 | if (lua_debug) |
279 | luaI_codedebugline(linelasttoken); | 279 | luaI_codedebugline(linelasttoken); |
280 | linelasttoken = lua_linenumber; | 280 | linelasttoken = lua_linenumber; |
281 | while (1) | 281 | while (1) { |
282 | { | ||
283 | int tokensize = 0; | 282 | int tokensize = 0; |
284 | switch (current) | 283 | switch (current) { |
285 | { | ||
286 | case '\n': | 284 | case '\n': |
287 | inclinenumber(); | 285 | inclinenumber(); |
288 | linelasttoken = lua_linenumber; | 286 | linelasttoken = lua_linenumber; |
@@ -365,33 +363,6 @@ int luaY_lex (void) | |||
365 | return STRING; | 363 | return STRING; |
366 | } | 364 | } |
367 | 365 | ||
368 | case 'a': case 'b': case 'c': case 'd': case 'e': | ||
369 | case 'f': case 'g': case 'h': case 'i': case 'j': | ||
370 | case 'k': case 'l': case 'm': case 'n': case 'o': | ||
371 | case 'p': case 'q': case 'r': case 's': case 't': | ||
372 | case 'u': case 'v': case 'w': case 'x': case 'y': | ||
373 | case 'z': | ||
374 | case 'A': case 'B': case 'C': case 'D': case 'E': | ||
375 | case 'F': case 'G': case 'H': case 'I': case 'J': | ||
376 | case 'K': case 'L': case 'M': case 'N': case 'O': | ||
377 | case 'P': case 'Q': case 'R': case 'S': case 'T': | ||
378 | case 'U': case 'V': case 'W': case 'X': case 'Y': | ||
379 | case 'Z': | ||
380 | case '_': | ||
381 | { | ||
382 | TaggedString *ts; | ||
383 | do { | ||
384 | save_and_next(); | ||
385 | } while (isalnum((unsigned char)current) || current == '_'); | ||
386 | save(0); | ||
387 | ts = lua_createstring(yytext); | ||
388 | if (ts->marked > 2) | ||
389 | return ts->marked; /* reserved word */ | ||
390 | luaY_lval.pTStr = ts; | ||
391 | ts->marked = 2; /* avoid GC */ | ||
392 | return NAME; | ||
393 | } | ||
394 | |||
395 | case '.': | 366 | case '.': |
396 | save_and_next(); | 367 | save_and_next(); |
397 | if (current == '.') | 368 | if (current == '.') |
@@ -462,8 +433,23 @@ int luaY_lex (void) | |||
462 | return 0; | 433 | return 0; |
463 | 434 | ||
464 | default: | 435 | default: |
465 | save_and_next(); | 436 | if (current != '_' && !isalpha((unsigned char)current)) { |
466 | return yytext[0]; | 437 | save_and_next(); |
438 | return yytext[0]; | ||
439 | } | ||
440 | else { /* identifier or reserved word */ | ||
441 | TaggedString *ts; | ||
442 | do { | ||
443 | save_and_next(); | ||
444 | } while (isalnum((unsigned char)current) || current == '_'); | ||
445 | save(0); | ||
446 | ts = lua_createstring(yytext); | ||
447 | if (ts->marked > 2) | ||
448 | return ts->marked; /* reserved word */ | ||
449 | luaY_lval.pTStr = ts; | ||
450 | ts->marked = 2; /* avoid GC */ | ||
451 | return NAME; | ||
452 | } | ||
467 | } | 453 | } |
468 | } | 454 | } |
469 | } | 455 | } |