luasrcdiet icon indicating copy to clipboard operation
luasrcdiet copied to clipboard

Error when process the jit/dump.lua in luajit.

Open watsonsong opened this issue 6 years ago • 0 comments

The luasrcdiet report error when I use it to process the dump.lua file, with this error:

lua.exe: .\luasrcdiet\llex.lua:93: [string]:323: malformed number

The command line I use is: bin/luasrcdiet --maximum %sourceFile% -o %output%

The lua dump file is from: https://github.com/LuaJIT/LuaJIT/blob/master/src/jit/dump.lua

It seems the error occur when process the following code: s = format(0 < k and k < 0x1p-1026 and "%+a" or "%+.14g", k)

the 0x1p-1026 is not parse correctly, blew the code: local v = sub(z, p, q) -- string equivalent if not tonumber(v) then -- handles hex test also errorline("malformed number") end The v send to tonumber is 0x1p, but not '0x1p-1026', which make this error happen. The regex can not handle the '0x' prefix and ‘p’ character.

BTW, the tonumber() in normal lua can not process this type of number, but the luajit do. I think this tool could consider support the luajit.

watsonsong avatar Jul 09 '18 05:07 watsonsong