You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LuaJIT extends the Lua syntax with some extra stuff:
Extensions to the Lua Parser
The parser for Lua source code treats numeric literals with the suffixes LL or ULL as signed or unsigned 64 bit integers. Case doesn't matter, but uppercase is recommended for readability. It handles both decimal (42LL) and hexadecimal (0x2aLL) literals.
The imaginary part of complex numbers can be specified by suffixing number literals with i or I, e.g. 12.5i. Caveat: you'll need to use 1i to get an imaginary part with the value one, since i itself still refers to a variable named i.
These don't get parsed correctly by luaparse, even with luaVersion set to 'LuaJIT':
varparser=require('luaparse');varast=parser.parse('local x = 1234ULL',{luaVersion: 'LuaJIT'});console.log(JSON.stringify(ast));
D:\dev\node_modules\luaparse\luaparse.js:614
throw error;
^
SyntaxError: [1:17] '=' expected near '<eof>'
at raise (D:\dev\node_modules\luaparse\luaparse.js:609:26)
at expect (D:\dev\node_modules\luaparse\luaparse.js:1298:10)
at parseAssignmentOrCallStatement (D:\dev\node_modules\luaparse\luaparse.js:2119:5)
at parseStatement (D:\dev\node_modules\luaparse\luaparse.js:1763:12)
at parseBlock (D:\dev\node_modules\luaparse\luaparse.js:1700:19)
at parseChunk (D:\dev\node_modules\luaparse\luaparse.js:1675:16)
at end (D:\dev\node_modules\luaparse\luaparse.js:2658:17)
at Object.parse (D:\dev\node_modules\luaparse\luaparse.js:2629:31)
at Object.<anonymous> (D:\dev\test.js:2:18)
at Module._compile (internal/modules/cjs/loader.js:956:30)
The text was updated successfully, but these errors were encountered:
fstirlitz
added
duplicate
An issue already exists covering the same or substantially overlapping problem
and removed
duplicate
An issue already exists covering the same or substantially overlapping problem
labels
Jun 23, 2022
LuaJIT extends the Lua syntax with some extra stuff:
See https://luajit.org/ext_ffi_api.html#literals:~:text=Extensions%20to%20the%20Lua%20Parser
These don't get parsed correctly by luaparse, even with
luaVersion
set to'LuaJIT'
:The text was updated successfully, but these errors were encountered: