boolangery / py-lua-parser

A Lua parser and AST builder written in Python.
MIT License
124 stars 39 forks source link

Can't parse call expressions in LocalAssign #27

Closed uniquadev closed 1 year ago

uniquadev commented 2 years ago

Given the following code:

local d, p, one, floor, mul, idx;
if d * d > p then
    local lo = floor(one * (2^-56 / 3) * mul / p)
end

Running luaparser: py -m luaparser <path>

Expected result: <successfully parsed chunk>

Error: Expecting one of 'break', 'do', 'else', 'elseif', 'end', 'function', '::', 'return', ';' at line 3, column 21

Additional Info: builder.py

Seem like parse_expr_list inside parse_local has no actual way of handling functions call expression, and the floor call is resolved to a Name expression

alkino commented 1 year ago

There is an error, what is not parse is

2^-56

because of the -