summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lctype.c4
-rw-r--r--lctype.h8
-rw-r--r--llex.c8
3 files changed, 11 insertions, 9 deletions
diff --git a/lctype.c b/lctype.c
index df7d23a9..3cd79885 100644
--- a/lctype.c
+++ b/lctype.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lctype.c,v 1.2 2009/02/20 13:11:15 roberto Exp roberto $ 2** $Id: lctype.c,v 1.3 2009/03/10 17:42:33 roberto Exp roberto $
3** 'ctype' functions for Lua 3** 'ctype' functions for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -20,7 +20,7 @@ const char luai_ctype_[UCHAR_MAX + 1] = {
20 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, 20 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05,
21 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 21 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
22 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 22 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
23 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 23 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05,
24 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, 24 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05,
25 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 25 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
26 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 26 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
diff --git a/lctype.h b/lctype.h
index 13e3d88d..db233b87 100644
--- a/lctype.h
+++ b/lctype.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lctype.h,v 1.2 2009/02/20 13:11:15 roberto Exp roberto $ 2** $Id: lctype.h,v 1.3 2009/03/10 17:42:33 roberto Exp roberto $
3** 'ctype' functions for Lua 3** 'ctype' functions for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -23,8 +23,10 @@
23#define MASK(B) (1 << (B)) 23#define MASK(B) (1 << (B))
24 24
25 25
26#define lisalpha(x) (luai_ctype_[x] & MASK(ALPHABIT)) 26/* 'lalpha' (Lua alphabetic) includes '_' */
27#define lisalnum(x) (luai_ctype_[x] & (MASK(ALPHABIT) | MASK(DIGITBIT))) 27#define lislalpha(x) (luai_ctype_[x] & MASK(ALPHABIT))
28/* ditto */
29#define lislalnum(x) (luai_ctype_[x] & (MASK(ALPHABIT) | MASK(DIGITBIT)))
28#define lisdigit(x) (luai_ctype_[x] & MASK(DIGITBIT)) 30#define lisdigit(x) (luai_ctype_[x] & MASK(DIGITBIT))
29#define lisspace(x) (luai_ctype_[x] & MASK(SPACEBIT)) 31#define lisspace(x) (luai_ctype_[x] & MASK(SPACEBIT))
30#define lisprint(x) (luai_ctype_[x] & MASK(PRINTBIT)) 32#define lisprint(x) (luai_ctype_[x] & MASK(PRINTBIT))
diff --git a/llex.c b/llex.c
index 19a8950c..9273260c 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 2.30 2009/02/11 18:25:20 roberto Exp roberto $ 2** $Id: llex.c,v 2.31 2009/02/19 17:18:25 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*/
@@ -206,7 +206,7 @@ static void read_numeral (LexState *ls, SemInfo *seminfo) {
206 } while (lisdigit(ls->current) || ls->current == '.'); 206 } while (lisdigit(ls->current) || ls->current == '.');
207 if (check_next(ls, "Ee")) /* `E'? */ 207 if (check_next(ls, "Ee")) /* `E'? */
208 check_next(ls, "+-"); /* optional exponent sign */ 208 check_next(ls, "+-"); /* optional exponent sign */
209 while (lisalnum(ls->current) || ls->current == '_') 209 while (lislalnum(ls->current))
210 save_and_next(ls); 210 save_and_next(ls);
211 save(ls, '\0'); 211 save(ls, '\0');
212 buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ 212 buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
@@ -408,12 +408,12 @@ static int llex (LexState *ls, SemInfo *seminfo) {
408 read_numeral(ls, seminfo); 408 read_numeral(ls, seminfo);
409 return TK_NUMBER; 409 return TK_NUMBER;
410 } 410 }
411 else if (lisalpha(ls->current) || ls->current == '_') { 411 else if (lislalpha(ls->current)) {
412 /* identifier or reserved word */ 412 /* identifier or reserved word */
413 TString *ts; 413 TString *ts;
414 do { 414 do {
415 save_and_next(ls); 415 save_and_next(ls);
416 } while (lisalnum(ls->current) || ls->current == '_'); 416 } while (lislalnum(ls->current));
417 ts = luaX_newstring(ls, luaZ_buffer(ls->buff), 417 ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
418 luaZ_bufflen(ls->buff)); 418 luaZ_bufflen(ls->buff));
419 if (ts->tsv.reserved > 0) /* reserved word? */ 419 if (ts->tsv.reserved > 0) /* reserved word? */