奥斯陆君王
2018-10-15 15:55:52 UTC
Luajit does support this feature.
and for utf-8,all we need is just changing the follow in llex.c(line 558-571
)
if (lislalpha(ls->current)) { /* identifier or reserved word? */
TString *ts;
do {
save_and_next(ls);
} while (lislalnum(ls->current));
ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
luaZ_bufflen(ls->buff));
seminfo->ts = ts;
if (isreserved(ts)) /* reserved word? */
return ts->extra - 1 + FIRST_RESERVED;
else {
return TK_NAME;
}
}
to
if (lislalpha(ls->current)|| ls->current &0x80) { /* identifier or
reserved word? */
TString *ts;
do {
save_and_next(ls);
} while (lislalnum(ls->current)|| ls->current & 0x80);
ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
luaZ_bufflen(ls->buff));
seminfo->ts = ts;
if (isreserved(ts)) /* reserved word? */
return ts->extra - 1 + FIRST_RESERVED;
else {
return TK_NAME;
}
}
It's very easy.Will lua 5.4 support it?
and for utf-8,all we need is just changing the follow in llex.c(line 558-571
)
if (lislalpha(ls->current)) { /* identifier or reserved word? */
TString *ts;
do {
save_and_next(ls);
} while (lislalnum(ls->current));
ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
luaZ_bufflen(ls->buff));
seminfo->ts = ts;
if (isreserved(ts)) /* reserved word? */
return ts->extra - 1 + FIRST_RESERVED;
else {
return TK_NAME;
}
}
to
if (lislalpha(ls->current)|| ls->current &0x80) { /* identifier or
reserved word? */
TString *ts;
do {
save_and_next(ls);
} while (lislalnum(ls->current)|| ls->current & 0x80);
ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
luaZ_bufflen(ls->buff));
seminfo->ts = ts;
if (isreserved(ts)) /* reserved word? */
return ts->extra - 1 + FIRST_RESERVED;
else {
return TK_NAME;
}
}
It's very easy.Will lua 5.4 support it?