PredictionMode

This enumeration defines the prediction modes available in ANTLR 4 along with utility methods for analyzing configuration sets for conflicts and/or ambiguities.

Members

Static functions

allConfigsInRuleStopStates
bool allConfigsInRuleStopStates(ATNConfigSet configs)

Checks if all configurations in {@code configs} are in a {@link RuleStopState}. Configurations meeting this condition have reached the end of the decision rule (local context) or end of start rule (full context).

allSubsetsConflict
bool allSubsetsConflict(BitSet[] altsets)

Determines if every alternative subset in {@code altsets} contains more than one alternative.

allSubsetsEqual
bool allSubsetsEqual(BitSet[] altsets)

Determines if every alternative subset in {@code altsets} is equivalent.

getAlts
BitSet getAlts(BitSet[] altsets)

Gets the complete set of represented alternatives for a collection of alternative subsets. This method returns the union of each {@link BitSet} in {@code altsets}.

getAlts
BitSet getAlts(ATNConfigSet configs)
Undocumented in source. Be warned that the author may not have intended to support it.
getConflictingAltSubsets
BitSet[] getConflictingAltSubsets(ATNConfigSet configs)

This function gets the conflicting alt subsets from a configuration set. For each configuration {@code c} in {@code configs}:

getSingleViableAlt
int getSingleViableAlt(BitSet[] altsets)
Undocumented in source. Be warned that the author may not have intended to support it.
getStateToAltMap
BitSet[ATNState] getStateToAltMap(ATNConfigSet configs)

Get a map from state to alt subset from a configuration set. For each configuration {@code c} in {@code configs}:

getUniqueAlt
int getUniqueAlt(BitSet[] altsets)

Returns the unique alternative predicted by all alternative subsets in {@code altsets}. If no such alternative exists, this method returns {@link ATN#INVALID_ALT_NUMBER}.

hasConfigInRuleStopState
bool hasConfigInRuleStopState(ATNConfigSet configs)

Checks if any configuration in {@code configs} is in a {@link RuleStopState}. Configurations meeting this condition have reached the end of the decision rule (local context) or end of start rule (full context).

hasConflictingAltSet
bool hasConflictingAltSet(BitSet[] altsets)

Determines if any single alternative subset in {@code altsets} contains more than one alternative.

hasNonConflictingAltSet
bool hasNonConflictingAltSet(BitSet[] altsets)

Determines if any single alternative subset in {@code altsets} contains exactly one alternative.

hasSLLConflictTerminatingPrediction
bool hasSLLConflictTerminatingPrediction(PredictionModeConst mode, ATNConfigSet configs)

Computes the SLL prediction termination condition.

hasStateAssociatedWithOneAlt
bool hasStateAssociatedWithOneAlt(ATNConfigSet configs)
Undocumented in source. Be warned that the author may not have intended to support it.
resolvesToJustOneViableAlt
int resolvesToJustOneViableAlt(BitSet[] altsets)

Full LL prediction termination.

Meta