-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
I encountered this issue while implementing grammarVisitorCompat using antlr-rust v0.3.0-beta.
Consider the following grammar:
grammar all_test;
list: GET VAR_ ( ',' VAR_ )* ;
GET: 'get';
VAR_: '$' [a-zA-Z0-9][a-zA-Z0-9_-]* ;
WS : [ \t\r\n]+ -> channel(HIDDEN) ;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:
ctx.VAR_(0) == Some($abc);
ctx.VAR_(1) == Some($def);
ctx.VAR_(2) == None;
The entire MRE can be found at https://github.com/dmitrii-ubskii/antlr-rust-all-issue
Metadata
Metadata
Assignees
Labels
No labels