ReFreezed / DumbLuaParser

Lua parsing library capable of optimizing and minifying code.
http://refreezed.com/luaparser/
MIT License
33 stars 3 forks source link

Cannot parse "^" expression, when a negative number is on the right side #5

Open toxamin opened 1 year ago

toxamin commented 1 year ago

Currently, due to this line: https://github.com/ReFreezed/DumbLuaParser/blob/a14fbbefb47e28c7e29a4721be236e25f4c686f4/dumbParser.lua#L2051

the following code fails to parse correctly: local _ = 6 ^ -4

Proposed solution: Change the line to include a check for "^" (not sure if this breaks anything) and ((OPERATOR_PRECEDENCE.unary > lastPrecedence) or lastPrecedence == 11)