Class LL1Analyzer
java.lang.Object
org.graalvm.shadowed.org.antlr.v4.runtime.atn.LL1Analyzer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 followsin the ATN in the specifiedctx.Calculates the SLL(1) expected lookahead set for each outgoing transition of anATNState.LOOK(ATNState s, ATNState stopState, RuleContext ctx) Compute set of tokens that can followsin the ATN in the specifiedctx.LOOK(ATNState s, RuleContext ctx) Compute set of tokens that can followsin the ATN in the specifiedctx.
-
Field Details
-
HIT_PRED
public static final int HIT_PREDSpecial value added to the lookahead sets to indicate that we hit a predicate during analysis ifseeThruPreds==false.- See Also:
-
atn
-
-
Constructor Details
-
LL1Analyzer
-
-
Method Details
-
getDecisionLookahead
Calculates the SLL(1) expected lookahead set for each outgoing transition of anATNState. The returned array has one element for each outgoing transition ins. If the closure from transition i leads to a semantic predicate before matching a symbol, the element at index i of the result will benull.- Parameters:
s- the ATN state- Returns:
- the expected symbols for each outgoing transition of
s.
-
LOOK
Compute set of tokens that can followsin the ATN in the specifiedctx.If
ctxisnulland the end of the rule containingsis reached,Token.EPSILONis added to the result set. Ifctxis notnulland the end of the outermost rule is reached,Token.EOFis added to the result set.- Parameters:
s- the ATN statectx- the complete parser context, ornullif the context should be ignored- Returns:
- The set of tokens that can follow
sin the ATN in the specifiedctx.
-
LOOK
Compute set of tokens that can followsin the ATN in the specifiedctx.If
ctxisnulland the end of the rule containingsis reached,Token.EPSILONis added to the result set. Ifctxis notnulland the end of the outermost rule is reached,Token.EOFis added to the result set.- Parameters:
s- the ATN statestopState- the ATN state to stop at. This can be aBlockEndStateto detect epsilon paths through a closure.ctx- the complete parser context, ornullif the context should be ignored- Returns:
- The set of tokens that can follow
sin the ATN in the specifiedctx.
-
_LOOK
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 followsin the ATN in the specifiedctx.If
ctxisnullandstopStateor the end of the rule containingsis reached,Token.EPSILONis added to the result set. Ifctxis notnullandaddEOFistrueandstopStateor the end of the outermost rule is reached,Token.EOFis added to the result set.- Parameters:
s- the ATN state.stopState- the ATN state to stop at. This can be aBlockEndStateto detect epsilon paths through a closure.ctx- The outer context, ornullif 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 passnew HashSet<ATNConfig>for this argument.calledRuleStack- A set used for preventing left recursion in the ATN from causing a stack overflow. Outside code should passnew BitSet()for this argument.seeThruPreds-trueto true semantic predicates as implicitlytrueand "see through them", otherwisefalseto treat semantic predicates as opaque and addHIT_PREDto the result if one is encountered.addEOF- AddToken.EOFto the result if the end of the outermost context is reached. This parameter has no effect ifctxisnull.
-