py-lua-parser
py-lua-parser copied to clipboard
Failure to reject incorrect inputs: missing function call arguments
Hi,
The parser doesn't reject incorrect function calls.
As a short example, consider the following Lua input:
var = function(...)
(4)
end
The parser parses and labels function call (4)
as a valid statement, without raising an error!
Here is the output:
{
"Chunk": {
"body": {
"Block": {
"body": [
{
"Assign": {
"targets": [
{
"Name": {
"id": "var",
"start_char": 0,
"stop_char": 2,
"line": 1
}
}
],
"values": [
{
"AnonymousFunction": {
"args": [
{
"Varargs": {
"start_char": null,
"stop_char": null,
"line": null
}
}
],
"body": {
"Block": {
"body": [
{
"Number": {
"n": 4,
"start_char": 25,
"stop_char": 25,
"line": 2
}
}
],
"start_char": 24,
"stop_char": 30,
"line": 2
}
},
"start_char": 6,
"stop_char": 30,
"line": 1
}
}
],
"start_char": 0,
"stop_char": 30,
"line": 1
}
}
],
"start_char": 0,
"stop_char": 30,
"line": 1
}
},
"start_char": 0,
"stop_char": 30,
"line": 1
}
}
In comparison to the official Lua grammar, and official Lua implementation, the input is invalid. This is because a function call should be followed by one or more arguments.
So my question is : is this behaviour intended? Or is it a parsing error?
Thank you.