grammars-v4
grammars-v4 copied to clipboard
Lua Grammar seems off, does not parse Pound / # / Length operator properly?
Hey, I'm relatively new to Antlr so sorry if this is intended to be fixed downstream by implementers of the parser. Running the Lua grammar i hit a undefined token
http://lab.antlr.org/
https://github.com/antlr/grammars-v4/blob/master/lua/LuaLexer.g4 https://github.com/antlr/grammars-v4/blob/master/lua/LuaParser.g4
start rule: start_
Sample:
local a, b
a = "test"
b = #a
return b
Error message
5:0 extraneous input 'return' expecting {'function', 'nil', 'false', 'true', '~', '-', '#', '(', 'not', '{', '...', NAME, NORMALSTRING, CHARSTRING, LONGSTRING, INT, HEX, FLOAT, HEX_FLOAT}
The python lua parser has fixed it in the builder for example: https://github.com/boolangery/py-lua-parser/blob/master/luaparser/builder.py#L393