boolangery/py-lua-parser

ULengthOp not correctly parsed

hmdxr opened this issue · 0 comments

hmdxr commented

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"