When parsing the input, we would like to collect all the variables into a list. I.e,, when parsing the string "get $abc, $def", we expect to parse that into ["$abc", "$def"].
Using ctx.VAR__all() (where ctx is the &ListContext argument of visit_list()) results in the following output: "get", "$abc", ",", "$def"
Note that, at the same time, ctx.VAR_(i) produces the expected result:
I encountered this issue while implementing
grammarVisitorCompat
using antlr-rust v0.3.0-beta.Consider the following grammar:
When parsing the input, we would like to collect all the variables into a list. I.e,, when parsing the string
"get $abc, $def"
, we expect to parse that into["$abc", "$def"]
.Using
ctx.VAR__all()
(wherectx
is the&ListContext
argument ofvisit_list()
) results in the following output:"get", "$abc", ",", "$def"
Note that, at the same time,
ctx.VAR_(i)
produces the expected result:The entire MRE can be found at https://github.com/dmitrii-ubskii/antlr-rust-all-issue