Rename character type handling from lj_ctype* to lj_char*.

This commit is contained in:
Mike Pall
2010-11-09 12:09:54 +01:00
parent fe21a42a92
commit ad29c1f39f
10 changed files with 99 additions and 100 deletions

View File

@@ -15,7 +15,7 @@
#include "lj_str.h"
#include "lj_lex.h"
#include "lj_parse.h"
#include "lj_ctype.h"
#include "lj_char.h"
/* Lua lexer token names. */
static const char *const tokennames[] = {
@@ -80,11 +80,11 @@ static void inclinenumber(LexState *ls)
static void read_numeral(LexState *ls, TValue *tv)
{
int c;
lua_assert(lj_ctype_isdigit(ls->current));
lua_assert(lj_char_isdigit(ls->current));
do {
c = ls->current;
save_and_next(ls);
} while (lj_ctype_isident(ls->current) || ls->current == '.' ||
} while (lj_char_isident(ls->current) || ls->current == '.' ||
((ls->current == '-' || ls->current == '+') &&
((c & ~0x20) == 'E' || (c & ~0x20) == 'P')));
save(ls, '\0');
@@ -166,7 +166,7 @@ static void read_string(LexState *ls, int delim, TValue *tv)
case '\n': case '\r': save(ls, '\n'); inclinenumber(ls); continue;
case END_OF_STREAM: continue; /* will raise an error next loop */
default:
if (!lj_ctype_isdigit(ls->current)) {
if (!lj_char_isdigit(ls->current)) {
save_and_next(ls); /* handles \\, \", \', and \? */
} else { /* \xxx */
int i = 0;
@@ -174,7 +174,7 @@ static void read_string(LexState *ls, int delim, TValue *tv)
do {
c = 10*c + (ls->current-'0');
next(ls);
} while (++i<3 && lj_ctype_isdigit(ls->current));
} while (++i<3 && lj_char_isdigit(ls->current));
if (c > 255)
lj_lex_error(ls, TK_string, LJ_ERR_XESC);
save(ls, c);
@@ -200,16 +200,16 @@ static int llex(LexState *ls, TValue *tv)
{
lj_str_resetbuf(&ls->sb);
for (;;) {
if (lj_ctype_isident(ls->current)) {
if (lj_char_isident(ls->current)) {
GCstr *s;
if (lj_ctype_isdigit(ls->current)) { /* Numeric literal. */
if (lj_char_isdigit(ls->current)) { /* Numeric literal. */
read_numeral(ls, tv);
return TK_number;
}
/* Identifier or reserved word. */
do {
save_and_next(ls);
} while (lj_ctype_isident(ls->current));
} while (lj_char_isident(ls->current));
s = lj_parse_keepstr(ls, ls->sb.buf, ls->sb.n);
if (s->reserved > 0) /* Reserved word? */
return TK_OFS + s->reserved;
@@ -282,7 +282,7 @@ static int llex(LexState *ls, TValue *tv)
return TK_dots; /* ... */
}
return TK_concat; /* .. */
} else if (!lj_ctype_isdigit(ls->current)) {
} else if (!lj_char_isdigit(ls->current)) {
return '.';
} else {
read_numeral(ls, tv);
@@ -369,7 +369,7 @@ const char *lj_lex_token2str(LexState *ls, LexToken token)
{
if (token > TK_OFS)
return tokennames[token-TK_OFS-1];
else if (!lj_ctype_iscntrl(token))
else if (!lj_char_iscntrl(token))
return lj_str_pushf(ls->L, "%c", token);
else
return lj_str_pushf(ls->L, "char(%d)", token);