summaryrefslogtreecommitdiff
path: root/src/lj_lex.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-11-09 12:09:54 +0100
committerMike Pall <mike>2010-11-09 12:09:54 +0100
commitad29c1f39feb55d4d443b9352448a12a1be8ee23 (patch)
tree685adbbcad3f65cacf636dda30bf1785191d9c6e /src/lj_lex.c
parentfe21a42a92546416cc235511c4e1949d850c0139 (diff)
downloadluajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.tar.gz
luajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.tar.bz2
luajit-ad29c1f39feb55d4d443b9352448a12a1be8ee23.zip
Rename character type handling from lj_ctype* to lj_char*.
Diffstat (limited to 'src/lj_lex.c')
-rw-r--r--src/lj_lex.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lj_lex.c b/src/lj_lex.c
index d02ae849..d3544e8e 100644
--- a/src/lj_lex.c
+++ b/src/lj_lex.c
@@ -15,7 +15,7 @@
15#include "lj_str.h" 15#include "lj_str.h"
16#include "lj_lex.h" 16#include "lj_lex.h"
17#include "lj_parse.h" 17#include "lj_parse.h"
18#include "lj_ctype.h" 18#include "lj_char.h"
19 19
20/* Lua lexer token names. */ 20/* Lua lexer token names. */
21static const char *const tokennames[] = { 21static const char *const tokennames[] = {
@@ -80,11 +80,11 @@ static void inclinenumber(LexState *ls)
80static void read_numeral(LexState *ls, TValue *tv) 80static void read_numeral(LexState *ls, TValue *tv)
81{ 81{
82 int c; 82 int c;
83 lua_assert(lj_ctype_isdigit(ls->current)); 83 lua_assert(lj_char_isdigit(ls->current));
84 do { 84 do {
85 c = ls->current; 85 c = ls->current;
86 save_and_next(ls); 86 save_and_next(ls);
87 } while (lj_ctype_isident(ls->current) || ls->current == '.' || 87 } while (lj_char_isident(ls->current) || ls->current == '.' ||
88 ((ls->current == '-' || ls->current == '+') && 88 ((ls->current == '-' || ls->current == '+') &&
89 ((c & ~0x20) == 'E' || (c & ~0x20) == 'P'))); 89 ((c & ~0x20) == 'E' || (c & ~0x20) == 'P')));
90 save(ls, '\0'); 90 save(ls, '\0');
@@ -166,7 +166,7 @@ static void read_string(LexState *ls, int delim, TValue *tv)
166 case '\n': case '\r': save(ls, '\n'); inclinenumber(ls); continue; 166 case '\n': case '\r': save(ls, '\n'); inclinenumber(ls); continue;
167 case END_OF_STREAM: continue; /* will raise an error next loop */ 167 case END_OF_STREAM: continue; /* will raise an error next loop */
168 default: 168 default:
169 if (!lj_ctype_isdigit(ls->current)) { 169 if (!lj_char_isdigit(ls->current)) {
170 save_and_next(ls); /* handles \\, \", \', and \? */ 170 save_and_next(ls); /* handles \\, \", \', and \? */
171 } else { /* \xxx */ 171 } else { /* \xxx */
172 int i = 0; 172 int i = 0;
@@ -174,7 +174,7 @@ static void read_string(LexState *ls, int delim, TValue *tv)
174 do { 174 do {
175 c = 10*c + (ls->current-'0'); 175 c = 10*c + (ls->current-'0');
176 next(ls); 176 next(ls);
177 } while (++i<3 && lj_ctype_isdigit(ls->current)); 177 } while (++i<3 && lj_char_isdigit(ls->current));
178 if (c > 255) 178 if (c > 255)
179 lj_lex_error(ls, TK_string, LJ_ERR_XESC); 179 lj_lex_error(ls, TK_string, LJ_ERR_XESC);
180 save(ls, c); 180 save(ls, c);
@@ -200,16 +200,16 @@ static int llex(LexState *ls, TValue *tv)
200{ 200{
201 lj_str_resetbuf(&ls->sb); 201 lj_str_resetbuf(&ls->sb);
202 for (;;) { 202 for (;;) {
203 if (lj_ctype_isident(ls->current)) { 203 if (lj_char_isident(ls->current)) {
204 GCstr *s; 204 GCstr *s;
205 if (lj_ctype_isdigit(ls->current)) { /* Numeric literal. */ 205 if (lj_char_isdigit(ls->current)) { /* Numeric literal. */
206 read_numeral(ls, tv); 206 read_numeral(ls, tv);
207 return TK_number; 207 return TK_number;
208 } 208 }
209 /* Identifier or reserved word. */ 209 /* Identifier or reserved word. */
210 do { 210 do {
211 save_and_next(ls); 211 save_and_next(ls);
212 } while (lj_ctype_isident(ls->current)); 212 } while (lj_char_isident(ls->current));
213 s = lj_parse_keepstr(ls, ls->sb.buf, ls->sb.n); 213 s = lj_parse_keepstr(ls, ls->sb.buf, ls->sb.n);
214 if (s->reserved > 0) /* Reserved word? */ 214 if (s->reserved > 0) /* Reserved word? */
215 return TK_OFS + s->reserved; 215 return TK_OFS + s->reserved;
@@ -282,7 +282,7 @@ static int llex(LexState *ls, TValue *tv)
282 return TK_dots; /* ... */ 282 return TK_dots; /* ... */
283 } 283 }
284 return TK_concat; /* .. */ 284 return TK_concat; /* .. */
285 } else if (!lj_ctype_isdigit(ls->current)) { 285 } else if (!lj_char_isdigit(ls->current)) {
286 return '.'; 286 return '.';
287 } else { 287 } else {
288 read_numeral(ls, tv); 288 read_numeral(ls, tv);
@@ -369,7 +369,7 @@ const char *lj_lex_token2str(LexState *ls, LexToken token)
369{ 369{
370 if (token > TK_OFS) 370 if (token > TK_OFS)
371 return tokennames[token-TK_OFS-1]; 371 return tokennames[token-TK_OFS-1];
372 else if (!lj_ctype_iscntrl(token)) 372 else if (!lj_char_iscntrl(token))
373 return lj_str_pushf(ls->L, "%c", token); 373 return lj_str_pushf(ls->L, "%c", token);
374 else 374 else
375 return lj_str_pushf(ls->L, "char(%d)", token); 375 return lj_str_pushf(ls->L, "char(%d)", token);