py-lua-parser
py-lua-parser copied to clipboard
A Lua parser and AST builder written in Python.
Hi, The parser doesn't reject some of the incorrect and incomplete Lua inputs. As a short example, consider the following Lua string: ``` var_name ``` The parser parses and labels...
If you try to parse ```lua if a == b == c then end ``` it raises a syntax error ``` luaparser.builder.SyntaxException: Error: Expecting one of 'and', 'not', 'or', 'then',...
I intend to comment out some specific IF statements in the release version before compiling, similar to a simple macro. However, I noticed that the first_token and last_token attributes are...
when I parse the string `'\0\n\ta', the escape sequences are not being parsed. ```python tree = ast.parse("a='\\0\\n\\ta'") ``` leads to the string node: ``` String: {} 3 keys s: '\\0\\n\\ta'...
` #tab+1 ` is parsed to ` LengthOp(AddOp(tab,1)) ` It should be ` AddOp(LengthOp(tab), 1) `
-- test.lua local table3 = {} table3[#table3 + 1] = 100 run luaparser ./test.lua output ``` { ... "ULengthOp": { "operand": { "AddOp": { "left": { "Name": { "id": "table3",...
Hello, I'm being stubborn and trying to do things outside my experience level, so I apologize if this is a dumb noob error. I haven't even tried to debug it...
Dear maintainers, When using the parser, I find that sometimes comments with Chinese characters are silently discarded. Below is Lua code which can be used to reproduce the error: function...
Looking at [parser/Lua.g4](https://github.com/boolangery/py-lua-parser/blob/master/luaparser/parser/Lua.g4#L160), it seems that the assumed bitwise priority is above multiplication, while it is in fact below concat [reference on operator precedence](https://www.lua.org/manual/5.4/manual.html#3.4.8). This is also the case in...
Code: ```python from luaparser import ast source = """ result = (a + b) / (c + d) """ tree = ast.parse(source) print(ast.to_lua_source(tree)) ``` Output: ```lua result = a +...