[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Case-insensitive patch
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 27 Apr 2009 21:11:09 -0300
> This patch makes Lua symbols and table keys case-insensitive.
It seems to me that the easiest way to make keywords and identifiers
case-insensitive is to change the default case in the main switch
in llex as follows:
default: {
...
else if (isalpha(ls->current) || ls->current == '_') {
/* identifier or reserved word */
TString *ts;
do {
save_and_next(ls);
} while (isalnum(ls->current) || ls->current == '_');
>>> convert luaZ_buffer(ls->buff) to lower case here
ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
luaZ_bufflen(ls->buff));
...
}
This still leaves the problem of table indexing, which you have already done,
but perhaps this simplifies it a bit. I didn't try but I'd like to know...
--lhf