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

@ -289,7 +289,7 @@ LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \
lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o
LJLIB_C= $(LJLIB_O:.o=.c)
LJCORE_O= lj_gc.o lj_err.o lj_ctype.o lj_bc.o lj_obj.o \
LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o \
lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o \
lj_state.o lj_dispatch.o lj_vmevent.o lj_api.o \
lj_lex.o lj_parse.o \

View File

@ -15,7 +15,7 @@ lib_aux.o: lib_aux.c lua.h luaconf.h lauxlib.h lj_obj.h lj_def.h \
lib_base.o: lib_base.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h \
lj_meta.h lj_state.h lj_bc.h lj_ff.h lj_ffdef.h lj_dispatch.h lj_jit.h \
lj_ir.h lj_ctype.h lj_lib.h lj_libdef.h
lj_ir.h lj_char.h lj_lib.h lj_libdef.h
lib_bit.o: lib_bit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_lib.h lj_libdef.h
lib_debug.o: lib_debug.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
@ -37,7 +37,7 @@ lib_package.o: lib_package.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
lj_def.h lj_arch.h lj_err.h lj_errmsg.h lj_lib.h
lib_string.o: lib_string.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h \
lj_state.h lj_ff.h lj_ffdef.h lj_ctype.h lj_lib.h lj_libdef.h
lj_state.h lj_ff.h lj_ffdef.h lj_char.h lj_lib.h lj_libdef.h
lib_table.o: lib_table.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_tab.h lj_lib.h \
lj_libdef.h
@ -52,7 +52,7 @@ lj_asm.o: lj_asm.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_vm.h lj_target.h lj_target_*.h
lj_bc.o: lj_bc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_bc.h \
lj_bcdef.h
lj_ctype.o: lj_ctype.c lj_ctype.h lj_def.h lua.h luaconf.h
lj_char.o: lj_char.c lj_char.h lj_def.h lua.h luaconf.h
lj_dispatch.o: lj_dispatch.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_err.h lj_errmsg.h lj_state.h lj_frame.h lj_bc.h lj_ff.h lj_ffdef.h \
lj_jit.h lj_ir.h lj_trace.h lj_dispatch.h lj_traceerr.h lj_vm.h luajit.h
@ -73,7 +73,7 @@ lj_ir.o: lj_ir.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \
lj_bc.h lj_traceerr.h lj_lib.h
lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_err.h lj_errmsg.h lj_str.h lj_lex.h lj_parse.h lj_ctype.h
lj_err.h lj_errmsg.h lj_str.h lj_lex.h lj_parse.h lj_char.h
lj_lib.o: lj_lib.c lauxlib.h lua.h luaconf.h lj_obj.h lj_def.h lj_arch.h \
lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h lj_bc.h \
lj_dispatch.h lj_jit.h lj_ir.h lj_vm.h lj_lib.h
@ -112,7 +112,7 @@ lj_state.o: lj_state.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_state.h lj_frame.h lj_bc.h lj_mcode.h lj_jit.h lj_ir.h lj_trace.h \
lj_dispatch.h lj_traceerr.h lj_vm.h lj_lex.h lj_alloc.h
lj_str.o: lj_str.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_err.h lj_errmsg.h lj_str.h lj_state.h lj_ctype.h
lj_err.h lj_errmsg.h lj_str.h lj_state.h lj_char.h
lj_tab.o: lj_tab.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_err.h lj_errmsg.h lj_tab.h
lj_trace.o: lj_trace.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
@ -128,15 +128,15 @@ lj_vmevent.o: lj_vmevent.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
ljamalg.o: ljamalg.c lua.h luaconf.h lauxlib.h lj_gc.c lj_obj.h lj_def.h \
lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h \
lj_udata.h lj_meta.h lj_state.h lj_frame.h lj_bc.h lj_trace.h lj_jit.h \
lj_ir.h lj_dispatch.h lj_traceerr.h lj_vm.h lj_err.c lj_ctype.c \
lj_ctype.h lj_bc.c lj_bcdef.h lj_obj.c lj_str.c lj_tab.c lj_func.c \
lj_udata.c lj_meta.c lj_state.c lj_mcode.h lj_lex.h lj_alloc.h \
lj_dispatch.c lj_ff.h lj_ffdef.h luajit.h lj_vmevent.c lj_vmevent.h \
lj_api.c lj_parse.h lj_lex.c lj_parse.c lj_lib.c lj_lib.h lj_ir.c \
lj_iropt.h lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c \
lj_opt_dce.c lj_opt_loop.c lj_snap.h lj_mcode.c lj_snap.c lj_target.h \
lj_target_*.h lj_record.c lj_record.h lj_asm.h lj_recdef.h lj_asm.c \
lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c lib_aux.c lib_base.c \
lualib.h lj_libdef.h lib_math.c lib_string.c lib_table.c lib_io.c \
lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c lib_init.c
lj_ir.h lj_dispatch.h lj_traceerr.h lj_vm.h lj_err.c lj_char.c lj_char.h \
lj_bc.c lj_bcdef.h lj_obj.c lj_str.c lj_tab.c lj_func.c lj_udata.c \
lj_meta.c lj_state.c lj_mcode.h lj_lex.h lj_alloc.h lj_dispatch.c \
lj_ff.h lj_ffdef.h luajit.h lj_vmevent.c lj_vmevent.h lj_api.c \
lj_parse.h lj_lex.c lj_parse.c lj_lib.c lj_lib.h lj_ir.c lj_iropt.h \
lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c lj_opt_dce.c \
lj_opt_loop.c lj_snap.h lj_mcode.c lj_snap.c lj_target.h lj_target_*.h \
lj_record.c lj_record.h lj_asm.h lj_recdef.h lj_asm.c lj_trace.c \
lj_gdbjit.h lj_gdbjit.c lj_alloc.c lib_aux.c lib_base.c lualib.h \
lj_libdef.h lib_math.c lib_string.c lib_table.c lib_io.c lib_os.c \
lib_package.c lib_debug.c lib_bit.c lib_jit.c lib_init.c
luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h

View File

@ -25,7 +25,7 @@
#include "lj_bc.h"
#include "lj_ff.h"
#include "lj_dispatch.h"
#include "lj_ctype.h"
#include "lj_char.h"
#include "lj_lib.h"
/* -- Base library: checks ------------------------------------------------ */
@ -197,7 +197,7 @@ LJLIB_ASM(tonumber) LJLIB_REC(.)
lj_err_arg(L, 2, LJ_ERR_BASERNG);
ul = strtoul(p, &ep, base);
if (p != ep) {
while (lj_ctype_isspace((unsigned char)(*ep))) ep++;
while (lj_char_isspace((unsigned char)(*ep))) ep++;
if (*ep == '\0') {
setnumV(L->base-1, cast_num(ul));
return FFH_RES(1);

View File

@ -22,7 +22,7 @@
#include "lj_tab.h"
#include "lj_state.h"
#include "lj_ff.h"
#include "lj_ctype.h"
#include "lj_char.h"
#include "lj_lib.h"
/* ------------------------------------------------------------------------ */
@ -181,9 +181,9 @@ static const char *classend(MatchState *ms, const char *p)
}
static const unsigned char match_class_map[32] = {
0, LJ_CTYPE_ALPHA, 0, LJ_CTYPE_CNTRL, LJ_CTYPE_DIGIT, 0,0,0,0,0,0,0,
LJ_CTYPE_LOWER, 0,0,0, LJ_CTYPE_PUNCT, 0,0, LJ_CTYPE_SPACE, 0,
LJ_CTYPE_UPPER, 0, LJ_CTYPE_ALNUM, LJ_CTYPE_XDIGIT, 0,0,0,0,0,0,0
0, LJ_CHAR_ALPHA, 0, LJ_CHAR_CNTRL, LJ_CHAR_DIGIT, 0,0,0,0,0,0,0,
LJ_CHAR_LOWER, 0,0,0, LJ_CHAR_PUNCT, 0,0, LJ_CHAR_SPACE, 0,
LJ_CHAR_UPPER, 0, LJ_CHAR_ALNUM, LJ_CHAR_XDIGIT, 0,0,0,0,0,0,0
};
static int match_class(int c, int cl)
@ -191,7 +191,7 @@ static int match_class(int c, int cl)
if ((cl & 0xc0) == 0x40) {
int t = match_class_map[(cl&0x1f)];
if (t) {
t = lj_ctype_isa(c, t);
t = lj_char_isa(c, t);
return (cl & 0x20) ? t : !t;
}
if (cl == 'z') return c == 0;
@ -353,7 +353,7 @@ static const char *match(MatchState *ms, const char *s, const char *p)
goto init; /* else return match(ms, s, ep); */
}
default:
if (lj_ctype_isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */
if (lj_char_isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */
s = match_capture(ms, s, uchar(*(p+1)));
if (s == NULL) return NULL;
p+=2;
@ -549,7 +549,7 @@ static void add_s(MatchState *ms, luaL_Buffer *b, const char *s, const char *e)
luaL_addchar(b, news[i]);
} else {
i++; /* skip ESC */
if (!lj_ctype_isdigit(uchar(news[i]))) {
if (!lj_char_isdigit(uchar(news[i]))) {
luaL_addchar(b, news[i]);
} else if (news[i] == '0') {
luaL_addlstring(b, s, (size_t)(e - s));
@ -679,14 +679,14 @@ static const char *scanformat(lua_State *L, const char *strfrmt, char *form)
while (*p != '\0' && strchr(FMT_FLAGS, *p) != NULL) p++; /* skip flags */
if ((size_t)(p - strfrmt) >= sizeof(FMT_FLAGS))
lj_err_caller(L, LJ_ERR_STRFMTR);
if (lj_ctype_isdigit(uchar(*p))) p++; /* skip width */
if (lj_ctype_isdigit(uchar(*p))) p++; /* (2 digits at most) */
if (lj_char_isdigit(uchar(*p))) p++; /* skip width */
if (lj_char_isdigit(uchar(*p))) p++; /* (2 digits at most) */
if (*p == '.') {
p++;
if (lj_ctype_isdigit(uchar(*p))) p++; /* skip precision */
if (lj_ctype_isdigit(uchar(*p))) p++; /* (2 digits at most) */
if (lj_char_isdigit(uchar(*p))) p++; /* skip precision */
if (lj_char_isdigit(uchar(*p))) p++; /* (2 digits at most) */
}
if (lj_ctype_isdigit(uchar(*p)))
if (lj_char_isdigit(uchar(*p)))
lj_err_caller(L, LJ_ERR_STRFMTW);
*(form++) = '%';
strncpy(form, strfrmt, (size_t)(p - strfrmt + 1));

View File

@ -1,5 +1,5 @@
/*
** Internal CTYPE replacement.
** Character types.
** Donated to the public domain.
**
** This is intended to replace the problematic libc single-byte NLS functions.
@ -7,22 +7,21 @@
** on POSIX systems. It never worked too well on Windows systems since hardly
** anyone bothered to call setlocale().
**
** Instead this table is hardcoded for ASCII, except for identifiers. These
** include the characters 128-255, too. This allows for the use of all
** non-ASCII chars as identifiers in the lexer. This is a broad definition,
** but works well in practice for both UTF-8 locales and most single-byte
** locales (such as ISO-8859-*).
** This table is hardcoded for ASCII. Identifiers include the characters
** 128-255, too. This allows for the use of all non-ASCII chars as identifiers
** in the lexer. This is a broad definition, but works well in practice
** for both UTF-8 locales and most single-byte locales (such as ISO-8859-*).
**
** If you really need proper ctypes for UTF-8 strings, please use an add-on
** library such as slnunicode: http://luaforge.net/projects/sln/
** If you really need proper character types for UTF-8 strings, please use
** an add-on library such as slnunicode: http://luaforge.net/projects/sln/
*/
#define lj_ctype_c
#define lj_char_c
#define LUA_CORE
#include "lj_ctype.h"
#include "lj_char.h"
LJ_DATADEF const uint8_t lj_ctype_bits[257] = {
LJ_DATADEF const uint8_t lj_char_bits[257] = {
0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,

40
src/lj_char.h Normal file
View File

@ -0,0 +1,40 @@
/*
** Character types.
** Donated to the public domain.
*/
#ifndef _LJ_CHAR_H
#define _LJ_CHAR_H
#include "lj_def.h"
#define LJ_CHAR_CNTRL 0x01
#define LJ_CHAR_SPACE 0x02
#define LJ_CHAR_PUNCT 0x04
#define LJ_CHAR_DIGIT 0x08
#define LJ_CHAR_XDIGIT 0x10
#define LJ_CHAR_UPPER 0x20
#define LJ_CHAR_LOWER 0x40
#define LJ_CHAR_IDENT 0x80
#define LJ_CHAR_ALPHA (LJ_CHAR_LOWER|LJ_CHAR_UPPER)
#define LJ_CHAR_ALNUM (LJ_CHAR_ALPHA|LJ_CHAR_DIGIT)
/* Only pass -1 or 0..255 to these macros. Never pass a signed char! */
#define lj_char_isa(c, t) (lj_char_bits[(c)+1] & t)
#define lj_char_iscntrl(c) lj_char_isa((c), LJ_CHAR_CNTRL)
#define lj_char_isspace(c) lj_char_isa((c), LJ_CHAR_SPACE)
#define lj_char_ispunct(c) lj_char_isa((c), LJ_CHAR_PUNCT)
#define lj_char_isdigit(c) lj_char_isa((c), LJ_CHAR_DIGIT)
#define lj_char_isxdigit(c) lj_char_isa((c), LJ_CHAR_XDIGIT)
#define lj_char_isupper(c) lj_char_isa((c), LJ_CHAR_UPPER)
#define lj_char_islower(c) lj_char_isa((c), LJ_CHAR_LOWER)
#define lj_char_isident(c) lj_char_isa((c), LJ_CHAR_IDENT)
#define lj_char_isalpha(c) lj_char_isa((c), LJ_CHAR_ALPHA)
#define lj_char_isalnum(c) lj_char_isa((c), LJ_CHAR_ALNUM)
#define lj_char_toupper(c) ((c) - (lj_char_islower(c) >> 1))
#define lj_char_tolower(c) ((c) + lj_char_isupper(c))
LJ_DATA const uint8_t lj_char_bits[257];
#endif

View File

@ -1,40 +0,0 @@
/*
** Internal CTYPE replacement.
** Donated to the public domain.
*/
#ifndef _LJ_CTYPE_H
#define _LJ_CTYPE_H
#include "lj_def.h"
#define LJ_CTYPE_CNTRL 0x01
#define LJ_CTYPE_SPACE 0x02
#define LJ_CTYPE_PUNCT 0x04
#define LJ_CTYPE_DIGIT 0x08
#define LJ_CTYPE_XDIGIT 0x10
#define LJ_CTYPE_UPPER 0x20
#define LJ_CTYPE_LOWER 0x40
#define LJ_CTYPE_IDENT 0x80
#define LJ_CTYPE_ALPHA (LJ_CTYPE_LOWER|LJ_CTYPE_UPPER)
#define LJ_CTYPE_ALNUM (LJ_CTYPE_ALPHA|LJ_CTYPE_DIGIT)
/* Only pass -1 or 0..255 to these macros. Never pass a signed char! */
#define lj_ctype_isa(c, t) (lj_ctype_bits[(c)+1] & t)
#define lj_ctype_iscntrl(c) lj_ctype_isa((c), LJ_CTYPE_CNTRL)
#define lj_ctype_isspace(c) lj_ctype_isa((c), LJ_CTYPE_SPACE)
#define lj_ctype_ispunct(c) lj_ctype_isa((c), LJ_CTYPE_PUNCT)
#define lj_ctype_isdigit(c) lj_ctype_isa((c), LJ_CTYPE_DIGIT)
#define lj_ctype_isxdigit(c) lj_ctype_isa((c), LJ_CTYPE_XDIGIT)
#define lj_ctype_isupper(c) lj_ctype_isa((c), LJ_CTYPE_UPPER)
#define lj_ctype_islower(c) lj_ctype_isa((c), LJ_CTYPE_LOWER)
#define lj_ctype_isident(c) lj_ctype_isa((c), LJ_CTYPE_IDENT)
#define lj_ctype_isalpha(c) lj_ctype_isa((c), LJ_CTYPE_ALPHA)
#define lj_ctype_isalnum(c) lj_ctype_isa((c), LJ_CTYPE_ALNUM)
#define lj_ctype_toupper(c) ((c) - (lj_ctype_islower(c) >> 1))
#define lj_ctype_tolower(c) ((c) + lj_ctype_isupper(c))
LJ_DATA const uint8_t lj_ctype_bits[257];
#endif

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);

View File

@ -16,7 +16,7 @@
#include "lj_err.h"
#include "lj_str.h"
#include "lj_state.h"
#include "lj_ctype.h"
#include "lj_char.h"
/* -- String interning ---------------------------------------------------- */
@ -180,27 +180,27 @@ int LJ_FASTCALL lj_str_numconv(const char *s, TValue *n)
{
lua_Number sign = 1;
const uint8_t *p = (const uint8_t *)s;
while (lj_ctype_isspace(*p)) p++;
while (lj_char_isspace(*p)) p++;
if (*p == '-') { p++; sign = -1; } else if (*p == '+') { p++; }
if ((uint32_t)(*p - '0') < 10) {
uint32_t k = (uint32_t)(*p++ - '0');
if (k == 0 && ((*p & ~0x20) == 'X')) {
p++;
if (!lj_ctype_isxdigit(*p))
if (!lj_char_isxdigit(*p))
return 0; /* Don't accept '0x' without hex digits. */
do {
if (k >= 0x10000000) goto parsedbl;
k = (k << 4) + (*p & 15u);
if (!lj_ctype_isdigit(*p)) k += 9;
if (!lj_char_isdigit(*p)) k += 9;
p++;
} while (lj_ctype_isxdigit(*p));
} while (lj_char_isxdigit(*p));
} else {
while ((uint32_t)(*p - '0') < 10) {
if (k >= 0x19999999) goto parsedbl;
k = k * 10u + (uint32_t)(*p++ - '0');
}
}
while (LJ_UNLIKELY(lj_ctype_isspace(*p))) p++;
while (LJ_UNLIKELY(lj_char_isspace(*p))) p++;
if (LJ_LIKELY(*p == '\0')) {
setnumV(n, sign * cast_num(k));
return 1;
@ -213,7 +213,7 @@ parsedbl:
setnumV(&tv, lua_str2number(s, &endptr));
if (endptr == s) return 0; /* Conversion failed. */
if (LJ_UNLIKELY(*endptr != '\0')) {
while (lj_ctype_isspace((uint8_t)*endptr)) endptr++;
while (lj_char_isspace((uint8_t)*endptr)) endptr++;
if (*endptr != '\0') return 0; /* Invalid trailing characters? */
}
if (LJ_LIKELY(!tvisnan(&tv)))

View File

@ -26,7 +26,7 @@
#include "lj_gc.c"
#include "lj_err.c"
#include "lj_ctype.c"
#include "lj_char.c"
#include "lj_bc.c"
#include "lj_obj.c"
#include "lj_str.c"