public class LL1Analyzer extends Object
| Modifier and Type | Field and Description |
|---|---|
ATN |
atn |
static int |
HIT_PRED
Special value added to the lookahead sets to indicate that we hit
a predicate during analysis if
seeThruPreds==false. |
| Constructor and Description |
|---|
LL1Analyzer(ATN atn) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_LOOK(ATNState s,
ATNState stopState,
PredictionContext ctx,
IntervalSet look,
Set<ATNConfig> lookBusy,
BitSet calledRuleStack,
boolean seeThruPreds,
boolean addEOF)
Compute set of tokens that can follow
s in the ATN in the
specified ctx. |
IntervalSet[] |
getDecisionLookahead(ATNState s)
Calculates the SLL(1) expected lookahead set for each outgoing transition
of an
ATNState. |
IntervalSet |
LOOK(ATNState s,
ATNState stopState,
RuleContext ctx)
Compute set of tokens that can follow
s in the ATN in the
specified ctx. |
IntervalSet |
LOOK(ATNState s,
RuleContext ctx)
Compute set of tokens that can follow
s in the ATN in the
specified ctx. |
public static final int HIT_PRED
seeThruPreds==false.@Nullable public IntervalSet[] getDecisionLookahead(@Nullable ATNState s)
ATNState. The returned array has one element for each
outgoing transition in s. If the closure from transition
i leads to a semantic predicate before matching a symbol, the
element at index i of the result will be null.s - the ATN states.@NotNull public IntervalSet LOOK(@NotNull ATNState s, @Nullable RuleContext ctx)
s in the ATN in the
specified ctx.
If ctx is null and the end of the rule containing
s is reached, Token.EPSILON is added to the result set.
If ctx is not null and the end of the outermost rule is
reached, Token.EOF is added to the result set.s - the ATN statectx - the complete parser context, or null if the context
should be ignoreds in the ATN in the
specified ctx.@NotNull public IntervalSet LOOK(@NotNull ATNState s, @Nullable ATNState stopState, @Nullable RuleContext ctx)
s in the ATN in the
specified ctx.
If ctx is null and the end of the rule containing
s is reached, Token.EPSILON is added to the result set.
If ctx is not null and the end of the outermost rule is
reached, Token.EOF is added to the result set.s - the ATN statestopState - the ATN state to stop at. This can be a
BlockEndState to detect epsilon paths through a closure.ctx - the complete parser context, or null if the context
should be ignoreds in the ATN in the
specified ctx.protected void _LOOK(@NotNull ATNState s, @Nullable ATNState stopState, @Nullable PredictionContext ctx, @NotNull IntervalSet look, @NotNull Set<ATNConfig> lookBusy, @NotNull BitSet calledRuleStack, boolean seeThruPreds, boolean addEOF)
s in the ATN in the
specified ctx.
If ctx is null and stopState or the end of the
rule containing s is reached, Token.EPSILON is added to
the result set. If ctx is not null and addEOF is
true and stopState or the end of the outermost rule is
reached, Token.EOF is added to the result set.s - the ATN state.stopState - the ATN state to stop at. This can be a
BlockEndState to detect epsilon paths through a closure.ctx - The outer context, or null if the outer context should
not be used.look - The result lookahead set.lookBusy - A set used for preventing epsilon closures in the ATN
from causing a stack overflow. Outside code should pass
new HashSet<ATNConfig> for this argument.calledRuleStack - A set used for preventing left recursion in the
ATN from causing a stack overflow. Outside code should pass
new BitSet() for this argument.seeThruPreds - true to true semantic predicates as
implicitly true and "see through them", otherwise false
to treat semantic predicates as opaque and add HIT_PRED to the
result if one is encountered.addEOF - Add Token.EOF to the result if the end of the
outermost context is reached. This parameter has no effect if ctx
is null.Copyright © 1992-2013 ANTLR. All Rights Reserved.