Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden channel tokens at the start of the parsed string are not ignored #66

Open
dmitrii-ubskii opened this issue Oct 28, 2022 · 1 comment · May be fixed by #73
Open

Hidden channel tokens at the start of the parsed string are not ignored #66

dmitrii-ubskii opened this issue Oct 28, 2022 · 1 comment · May be fixed by #73

Comments

@dmitrii-ubskii
Copy link

Consider the following grammar:

grammar hidden_test;

list: VAR_ ( ',' VAR_ )* ;
VAR_: '$' [a-zA-Z0-9][a-zA-Z0-9_-]* ;

WS : [ \t\r\n]+ -> channel(HIDDEN) ;

Parsing " $abc, $def" in Java or on http://lab.antlr.org/ produces the expected parse tree. But trying to parse this string in Rust via parser.list() produces the following error instead:

line 1:0 extraneous input ' ' expecting VAR_
@newca12
Copy link
Contributor

newca12 commented Nov 4, 2022

An issue indeed. I guesss the culprit is here : https://github.com/rrevenantt/antlr4rust/blob/master/src/common_token_stream.rs#L23
The first token is consumed there before next_token_on_channel function can filter it on the channel criteria.

@JamesHutch JamesHutch linked a pull request Jan 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants