boolangery / py-lua-parser

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

ast.to_lua_source doesn't add parenthesis to expressions #34

Closed fabi321 closed 1 year ago

fabi321 commented 1 year ago

Dependless of the input expression, ast.to_lua_source doesn't add any parenthesis. Example:

>>> ast.to_lua_source(ast.parse("a=(1*2)+3"))
'a = 1 * 2 + 3'
>>> ast.to_lua_source(ast.parse("a=1*(2+3)"))
'a = 1 * 2 + 3'

While it is possible for the first expression to be written without parenthesis, the second one needs a pair in order to preserve the meaning.

IAMSPYS commented 1 year ago

Hi, I just made a pull request to fix this issue. All we have to do is just wait for it to be approved. Glad I'm not the only one who got this problem.