boolangery / py-lua-parser

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

Refusing to parse chained conditions without parentheses, eg "if a == b == c then" #48

Open Wha-The opened 10 months ago

Wha-The commented 10 months ago

If you try to parse

if a == b == c then end

it raises a syntax error

luaparser.builder.SyntaxException: Error: Expecting one of 'and', 'not', 'or', 'then', '+', '-', '*', '/', '//', '%', '^', '#', '&', '|', '~', '>>', '<<', '(', '{', '[', ':', '..', '.', STRING at line 1, column 13

However if you parse the equivelent

if (a == b) == c then end

then it works just fine.

found this bug whilst trying to parse this

if aJ == aK == (aI.A ~= 0) then