lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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