-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
Milestone
Description
I created CommonTokenStream
from list of tokens by the following way:
List<? extends Token> preprocessorTokens = (List<Token>)lexer.getAllTokens();
ListTokenSource codeTokenSource = new ListTokenSource(tokens);
CommonTokenStream tokensStream = new CommonTokenStream(codeTokenSource);
After it I tried to call method getText(context)
for RuleContext but it returned a wrong result:
tokensStream.getText(context); // returns incorrect text, only text of first token
tokensStream.getText(); // returns correct text of all tokens
If fill()
method was called before getText
methods, these methods return a correct text:
tokensStream.fill();
tokensStream.getText(context); // returns correct text of tokens from context
tokensStream.getText(); // returns correct text of all tokens