Top Description Fields Constructors Methods
org.antlr.v4.runtime.atn

public Class DecisionInfo

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List

This class contains profiling gathered for a particular decision.

Parsing performance in ANTLR 4 is heavily influenced by both static factors (e.g. the form of the rules in the grammar) and dynamic factors (e.g. the choice of input and the state of the DFA cache at the time profiling operations are started). For best results, gather and use aggregate statistics from a large sample of inputs representing the inputs expected in production before using the results to make changes in the grammar.

Since
4.3

Field Summary

Modifier and TypeField and Description
public final List<AmbiguityInfo>
ambiguities

A collection of AmbiguityInfo instances describing the ambiguities encountered during LL prediction for this decision.

public final List<ContextSensitivityInfo>
contextSensitivities

A collection of ContextSensitivityInfo instances describing the context sensitivities encountered during LL prediction for this decision.

public final int
decision

The decision number, which is an index into ATN#decisionToState.

public final List<ErrorInfo>
errors

A collection of ErrorInfo instances describing the parse errors identified during calls to ParserATNSimulator#adaptivePredict for this decision.

public long
invocations

The total number of times ParserATNSimulator#adaptivePredict was invoked for this decision.

public long
LL_ATNTransitions

The total number of ATN transitions required during LL prediction for this decision.

public long
LL_DFATransitions

The total number of DFA transitions required during LL prediction for this decision.

public long
LL_Fallback

Gets the total number of times SLL prediction completed in a conflict state, resulting in fallback to LL prediction.

public long
LL_MaxLook

Gets the maximum lookahead required for any single LL prediction to complete for this decision.

public LookaheadEventInfo
LL_MaxLookEvent

Gets the LookaheadEventInfo associated with the event where the LL_MaxLook value was set.

public long
LL_MinLook

Gets the minimum lookahead required for any single LL prediction to complete for this decision.

public long
LL_TotalLook

The sum of the lookahead required for LL prediction for this decision.

public final List<PredicateEvalInfo>
predicateEvals

A collection of PredicateEvalInfo instances describing the results of evaluating individual predicates during prediction for this decision.

public long
SLL_ATNTransitions

The total number of ATN transitions required during SLL prediction for this decision.

public long
SLL_DFATransitions

The total number of DFA transitions required during SLL prediction for this decision.

public long
SLL_MaxLook

Gets the maximum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.

public LookaheadEventInfo
SLL_MaxLookEvent

Gets the LookaheadEventInfo associated with the event where the SLL_MaxLook value was set.

public long
SLL_MinLook

Gets the minimum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.

public long
SLL_TotalLook

The sum of the lookahead required for SLL prediction for this decision.

public long
timeInPrediction

The total time spent in ParserATNSimulator#adaptivePredict for this decision, in nanoseconds.

Constructor Summary

AccessConstructor and Description
public
DecisionInfo(int
The decision number
decision
)

Constructs a new instance of the DecisionInfo class to contain statistics for a particular decision.

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

ambiguitiesback to summary
public final List<AmbiguityInfo> ambiguities

A collection of AmbiguityInfo instances describing the ambiguities encountered during LL prediction for this decision.

See Also
AmbiguityInfo
contextSensitivitiesback to summary
public final List<ContextSensitivityInfo> contextSensitivities

A collection of ContextSensitivityInfo instances describing the context sensitivities encountered during LL prediction for this decision.

See Also
ContextSensitivityInfo
decisionback to summary
public final int decision

The decision number, which is an index into ATN#decisionToState.

errorsback to summary
public final List<ErrorInfo> errors

A collection of ErrorInfo instances describing the parse errors identified during calls to ParserATNSimulator#adaptivePredict for this decision.

See Also
ErrorInfo
invocationsback to summary
public long invocations

The total number of times ParserATNSimulator#adaptivePredict was invoked for this decision.

LL_ATNTransitionsback to summary
public long LL_ATNTransitions

The total number of ATN transitions required during LL prediction for this decision. An ATN transition is determined by the number of times the DFA does not contain an edge that is required for prediction, resulting in on-the-fly computation of that edge.

If DFA caching of LL transitions is employed by the implementation, ATN computation may cache the computed edge for efficient lookup during future parsing of this decision. Otherwise, the LL parsing algorithm will use ATN transitions exclusively.

See Also
LL_DFATransitions, ParserATNSimulator#computeTargetState, LexerATNSimulator#computeTargetState
LL_DFATransitionsback to summary
public long LL_DFATransitions

The total number of DFA transitions required during LL prediction for this decision.

If the ATN simulator implementation does not use DFA caching for LL transitions, this value will be 0.

See Also
ParserATNSimulator#getExistingTargetState, LexerATNSimulator#getExistingTargetState
LL_Fallbackback to summary
public long LL_Fallback

Gets the total number of times SLL prediction completed in a conflict state, resulting in fallback to LL prediction.

Note that this value is not related to whether or not PredictionMode#SLL may be used successfully with a particular grammar. If the ambiguity resolution algorithm applied to the SLL conflicts for this decision produce the same result as LL prediction for this decision, PredictionMode#SLL would produce the same overall parsing result as PredictionMode#LL.

LL_MaxLookback to summary
public long LL_MaxLook

Gets the maximum lookahead required for any single LL prediction to complete for this decision. An LL prediction completes when the algorithm reaches a unique prediction, a conflict state (for PredictionMode#LL, an ambiguity state (for PredictionMode#LL_EXACT_AMBIG_DETECTION, or a syntax error.

LL_MaxLookEventback to summary
public LookaheadEventInfo LL_MaxLookEvent

Gets the LookaheadEventInfo associated with the event where the LL_MaxLook value was set.

LL_MinLookback to summary
public long LL_MinLook

Gets the minimum lookahead required for any single LL prediction to complete for this decision. An LL prediction completes when the algorithm reaches a unique prediction, a conflict state (for PredictionMode#LL, an ambiguity state (for PredictionMode#LL_EXACT_AMBIG_DETECTION, or a syntax error.

LL_TotalLookback to summary
public long LL_TotalLook

The sum of the lookahead required for LL prediction for this decision. Note that LL prediction is only used when SLL prediction reaches a conflict state.

predicateEvalsback to summary
public final List<PredicateEvalInfo> predicateEvals

A collection of PredicateEvalInfo instances describing the results of evaluating individual predicates during prediction for this decision.

See Also
PredicateEvalInfo
SLL_ATNTransitionsback to summary
public long SLL_ATNTransitions

The total number of ATN transitions required during SLL prediction for this decision. An ATN transition is determined by the number of times the DFA does not contain an edge that is required for prediction, resulting in on-the-fly computation of that edge.

If DFA caching of SLL transitions is employed by the implementation, ATN computation may cache the computed edge for efficient lookup during future parsing of this decision. Otherwise, the SLL parsing algorithm will use ATN transitions exclusively.

See Also
SLL_ATNTransitions, ParserATNSimulator#computeTargetState, LexerATNSimulator#computeTargetState
SLL_DFATransitionsback to summary
public long SLL_DFATransitions

The total number of DFA transitions required during SLL prediction for this decision.

If the ATN simulator implementation does not use DFA caching for SLL transitions, this value will be 0.

See Also
ParserATNSimulator#getExistingTargetState, LexerATNSimulator#getExistingTargetState
SLL_MaxLookback to summary
public long SLL_MaxLook

Gets the maximum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.

SLL_MaxLookEventback to summary
public LookaheadEventInfo SLL_MaxLookEvent

Gets the LookaheadEventInfo associated with the event where the SLL_MaxLook value was set.

SLL_MinLookback to summary
public long SLL_MinLook

Gets the minimum lookahead required for any single SLL prediction to complete for this decision, by reaching a unique prediction, reaching an SLL conflict state, or encountering a syntax error.

SLL_TotalLookback to summary
public long SLL_TotalLook

The sum of the lookahead required for SLL prediction for this decision. Note that SLL prediction is used before LL prediction for performance reasons even when PredictionMode#LL or PredictionMode#LL_EXACT_AMBIG_DETECTION is used.

timeInPredictionback to summary
public long timeInPrediction

The total time spent in ParserATNSimulator#adaptivePredict for this decision, in nanoseconds.

The value of this field contains the sum of differential results obtained by System#nanoTime(), and is not adjusted to compensate for JIT and/or garbage collection overhead. For best accuracy, use a modern JVM implementation that provides precise results from System#nanoTime(), and perform profiling in a separate process which is warmed up by parsing the input prior to profiling. If desired, call ATNSimulator#clearDFA to reset the DFA cache to its initial state before starting the profiling measurement pass.

Constructor Detail

DecisionInfoback to summary
public DecisionInfo(int decision)

Constructs a new instance of the DecisionInfo class to contain statistics for a particular decision.

Parameters
decision:int

The decision number

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override