grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

Lua grammar handles method calls incorrectly

Open Martmists-GH opened this issue 1 year ago • 1 comments

Sample snippet: local _addr = tostring(_obj).sub(8) image

Martmists-GH avatar Dec 12 '23 09:12 Martmists-GH

This input is ambiguous. (trperf -i 'local _addr = tostring(_obj).sub(8)' | column -t and look at the column named "Ambiguiities".)

Lua allows two statements without a semi-colon separator. print(1) print(2). So, for local _addr = tostring(_obj).sub(8), we have two statements, local _addr = tostring and (_obj).sub(8).

But, clearly the intent of the input is for it to be one statement.

I haven't looked at the source code for the interpreter yet, but I suspect there are missing disambiguation rules for the parse.

Reordering rule alts is insufficient to fix this problem!

kaby76 avatar Dec 12 '23 13:12 kaby76