[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: parse hex numerals [PATCH]
- From: Mike Pall <mikelu-0602@...>
- Date: Thu, 9 Feb 2006 12:06:48 +0100
Hi,
LEGO wrote:
> the following patch against lua-5.1-rc3 allows the lexer to recognize
> hexadecimal numerals in the form 0xa1234
Umm ... have you checked whether plain Lua already supports
this? :-)
$ lua51rc3 -e 'print(0xff)'
255
See:
http://lua-users.org/lists/lua-l/2006-01/msg00464.html
for an explanation and a (IMHO) better/simpler patch which makes
hex numbers work with non-C99 libraries, too (MSVC for Windows).
PS: Reread the CPP docs, too. '#if foo == bar' is always true.
CPP has no idea of C types and doesn't do string compares.
Unknown tokens evaluate to 0.
Bye,
Mike