boolangery / py-lua-parser

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

ULengthOp not correctly parsed #54

Open hmdxr opened 7 months ago

hmdxr commented 7 months ago

function definition:

function test_olength() setting_name = "12345678" if #setting >10 and setting_name == "user" then return 100 end end

{ "test_olength": { "Chunk": { "body": { "Block": { "body": [ { "Function": { "name": { "Name": { "id": "test_olength", "line": 1 } }, "args": [ { "Name": { "id": "setting_name", "line": 1 } } ], "body": { "Block": { "body": [ { "Assign": { "targets": [ { "Name": { "id": "setting_name", "line": 2 } } ], "values": [ { "String": { "s": "12345678", "delimiter": {}, "line": 2 } } ], "line": 2 } }, { "If": { "test": { "ULengthOp": { "operand": { "LAndOp": { "left": { "RGtOp": { "left": { "Name": { "id": "setting", "line": 3 } }, "right": { "Number": { "n": 10, "line": 3 } }, "line": null } }, "right": { "REqOp": { "left": { "Name": { "id": "setting_name", "line": 3 } }, "right": { "String": { "s": "user", "delimiter": {}, "line": 3 } }, "line": null } }, "line": null } }, "line": 3 } }, "body": { "Block": { "body": [ { "Return": { "values": [ { "Number": { "n": 100, "line": 3 } } ], "line": 3 } } ], "line": 3 } }, "line": null } } ], "line": 2 } }, "line": 1 } } ], "line": 1 } }, "line": 1 } } }

as you see, the ULengthOp is the 1st depth operator which is wrong, it should be "LAndOp"