nextTokens method
TODO merge doc comment
Compute the set of valid tokens that can occur starting in state s
.
If ctx
is null, the set of tokens will not include what can follow
the rule surrounding s
. In other words, the set will be
restricted to tokens reachable staying within s
's rule.
Compute the set of valid tokens that can occur starting in s
and
staying in same rule. {@link Token#EPSILON} is in set if we reach end of
rule.
Implementation
IntervalSet nextTokens(ATNState s, [RuleContext? ctx]) {
if (ctx != null) {
return LL1Analyzer(this).LOOK(s, ctx);
}
if (s.nextTokenWithinRule != null) return s.nextTokenWithinRule!;
s.nextTokenWithinRule = LL1Analyzer(this).LOOK(s, null);
s.nextTokenWithinRule!.setReadonly(true);
return s.nextTokenWithinRule!;
}