franko / luajit-lang-toolkit

A Lua bytecode compiler written in Lua itself for didactic purposes or for new language implementations
Other
654 stars 91 forks source link

Broken lexing of 64-bit hex numbers #4

Closed q66 closed 10 years ago

q66 commented 10 years ago

In your build_64int, there's a few things you need to do.

1) check for leading 0x and skip it. 2) Instead of checking "str[i] <= ASCII_9", you need to check if str[i] is a hex digit and possibly a period and if it's a period, return nil (so that floating point numbers with 64 bit suffixes are disallowed). 3) if leading 0x is present, multiply by 16 instead of 10.

I'm not providing a patch as my codebase is heavily changed (working on a language) and uses a different lexer/parser, but this is what I came up to while messing around with lj-lang-toolkit, and it should be trivial for you to do.

franko commented 10 years ago

Hi Daniel,

I've fixed the problem in the master branch, thank you for the bug report.

q66 commented 10 years ago

great, closing then.