From a90a808d2a2889062fc6dd2c20771243f234cdbb Mon Sep 17 00:00:00 2001 From: James Hutchinson Date: Wed, 18 Jan 2023 09:38:36 +0000 Subject: [PATCH] Fix CommonTokenStream when first token is hidden --- src/common_token_stream.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common_token_stream.rs b/src/common_token_stream.rs index a56ddc7..3baf2b0 100644 --- a/src/common_token_stream.rs +++ b/src/common_token_stream.rs @@ -106,7 +106,8 @@ impl<'input, T: TokenSource<'input>> CommonTokenStream<'input, T> { base: UnbufferedTokenStream::new_buffered(lexer), channel, }; - r.sync(0); + let i = r.next_token_on_channel(0, channel, 1); + r.base.seek(i); r }