In addition to these values, ATNConfig stores several properties
about paths taken to get to the location which were added over time to help
with performance, correctness, and/or debugging.
getReachesIntoOuterContext(): Used to ensure semantic predicates
are not evaluated in the wrong context.hasPassedThroughNonGreedyDecision(): Used for enabling
first-match-wins instead of longest-match-wins after crossing a non-greedy
decision.getLexerActionExecutor(): Used for tracking the lexer action(s)
to execute should this instance be selected during lexing.isPrecedenceFilterSuppressed(): A state variable for one of the
dynamic disambiguation strategies employed by
ParserATNSimulator#applyPrecedenceFilter.Due to the use of a graph-structured stack, a single ATNConfig is
capable of representing many individual ATN configurations which reached the
same location in an ATN by following different paths.
PERF: To conserve memory, ATNConfig is split into several
different concrete types. ATNConfig itself stores the minimum amount
of information typically used to define an ATNConfig instance.
Various derived types provide additional storage space for cases where a
non-default value is used for some of the object properties. The
ATNConfig#create and ATNConfig#transform methods
automatically select the smallest concrete type capable of representing the
unique information for any given ATNConfig.
| Modifier and Type | Class and Description |
|---|---|
| private static class | ATNConfig.ActionATNConfig
This class was derived from |
| private static class | ATNConfig.ActionSemanticContextATNConfig
This class was derived from |
| private static class | ATNConfig.SemanticContextATNConfig
This class was derived from |
| Modifier and Type | Field and Description |
|---|---|
| private int | altAndOuterContextDepth
This is a bit-field currently containing the following values. |
| private PredictionContext | context
The stack of invoking states leading to the rule/states associated with this config. |
| private final ATNState | state
The ATN state associated with this configuration |
| private static final int | SUPPRESS_PRECEDENCE_FILTER
This field stores the bit mask for implementing the
|
| Access | Constructor and Description |
|---|---|
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public ATNConfig | |
| public ATNConfig | |
| private static boolean | |
| public final ATNConfig | |
| public boolean | |
| public static ATNConfig | |
| public static ATNConfig | |
| public static ATNConfig | create(ATNState state, int alt, PredictionContext context, SemanticContext semanticContext, LexerActionExecutor lexerActionExecutor)
|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public boolean | |
| public final int | |
| public final PredictionContext | |
| public LexerActionExecutor | |
| public final int | getOuterContextDepth()
We cannot execute predicates dependent upon local context unless we know for sure we are in the correct context. |
| public final boolean | |
| public SemanticContext | |
| public final ATNState | |
| public int | |
| public boolean | |
| public final boolean | |
| public void | |
| public void | |
| public final void | |
| public String | Returns: A Graphviz graph representing the currentATNConfig.Returns a graphical representation of the current |
| public String | |
| public String | |
| public String | |
| public final ATNConfig | |
| public final ATNConfig | |
| public final ATNConfig | |
| public final ATNConfig | |
| private ATNConfig | transform(ATNState state, PredictionContext context, SemanticContext semanticContext, boolean checkNonGreedy, LexerActionExecutor lexerActionExecutor)
|
| altAndOuterContextDepth | back to summary |
|---|---|
| private int altAndOuterContextDepth This is a bit-field currently containing the following values.
| |
| context | back to summary |
|---|---|
| private PredictionContext context The stack of invoking states leading to the rule/states associated with this config. We track only those contexts pushed during execution of the ATN simulator. | |
| state | back to summary |
|---|---|
| private final ATNState state The ATN state associated with this configuration | |
| SUPPRESS_PRECEDENCE_FILTER | back to summary |
|---|---|
| private static final int SUPPRESS_PRECEDENCE_FILTER This field stores the bit mask for implementing the
| |
| ATNConfig | back to summary |
|---|---|
| protected ATNConfig(ATNState state, int alt, PredictionContext context) | |
| ATNConfig | back to summary |
|---|---|
| protected ATNConfig(ATNConfig c, ATNState state, PredictionContext context) | |
| appendContext | back to summary |
|---|---|
| public ATNConfig appendContext(int context, PredictionContextCache contextCache) | |
| appendContext | back to summary |
|---|---|
| public ATNConfig appendContext(PredictionContext context, PredictionContextCache contextCache) | |
| checkNonGreedyDecision | back to summary |
|---|---|
| private static boolean checkNonGreedyDecision(ATNConfig source, ATNState target) | |
| clone | back to summary |
|---|---|
| public final ATNConfig clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by | |
| contains | back to summary |
|---|---|
| public boolean contains(ATNConfig subconfig) Determines if this An ATN configuration represents a position (including context) in an
ATN during parsing. Since An
This method implements a conservative approximation of containment. As
a result, when this method returns {code true} it is known that parsing
from
| |
| create | back to summary |
|---|---|
| public static ATNConfig create(ATNState state, int alt, PredictionContext context) | |
| create | back to summary |
|---|---|
| public static ATNConfig create(ATNState state, int alt, PredictionContext context, SemanticContext semanticContext) | |
| create | back to summary |
|---|---|
| public static ATNConfig create(ATNState state, int alt, PredictionContext context, SemanticContext semanticContext, LexerActionExecutor lexerActionExecutor) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. An ATN configuration is equal to another if both have the same state, they predict the same alternative, and syntactic/semantic contexts are the same.
| |
| equals | back to summary |
|---|---|
| public boolean equals(ATNConfig other) | |
| getAlt | back to summary |
|---|---|
| public final int getAlt() What alt (or lexer rule) is predicted by this configuration | |
| getContext | back to summary |
|---|---|
public final PredictionContext getContext()
| |
| getLexerActionExecutor | back to summary |
|---|---|
public LexerActionExecutor getLexerActionExecutor()
| |
| getOuterContextDepth | back to summary |
|---|---|
| public final int getOuterContextDepth() We cannot execute predicates dependent upon local context unless we know for sure we are in the correct context. Because there is no way to do this efficiently, we simply cannot evaluate dependent predicates unless we are in the rule that initially invokes the ATN simulator. closure() tracks the depth of how far we dip into the outer context: depth > 0. Note that it may not be totally accurate depth since I don't ever decrement. TODO: make it a boolean then | |
| getReachesIntoOuterContext | back to summary |
|---|---|
| public final boolean getReachesIntoOuterContext() | |
| getSemanticContext | back to summary |
|---|---|
public SemanticContext getSemanticContext()
| |
| getState | back to summary |
|---|---|
| public final ATNState getState() Gets the ATN state associated with this configuration
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| hasPassedThroughNonGreedyDecision | back to summary |
|---|---|
| public boolean hasPassedThroughNonGreedyDecision() | |
| isPrecedenceFilterSuppressed | back to summary |
|---|---|
| public final boolean isPrecedenceFilterSuppressed() | |
| setContext | back to summary |
|---|---|
| public void setContext(PredictionContext context) | |
| setOuterContextDepth | back to summary |
|---|---|
| public void setOuterContextDepth(int outerContextDepth) | |
| setPrecedenceFilterSuppressed | back to summary |
|---|---|
| public final void setPrecedenceFilterSuppressed(boolean value) | |
| toDotString | back to summary |
|---|---|
| public String toDotString() Returns a graphical representation of the current
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| toString | back to summary |
|---|---|
| public String toString(Recognizer<?, ?> recog, boolean showAlt) | |
| toString | back to summary |
|---|---|
| public String toString(Recognizer<?, ?> recog, boolean showAlt, boolean showContext) | |
| transform | back to summary |
|---|---|
| public final ATNConfig transform(ATNState state, boolean checkNonGreedy) | |
| transform | back to summary |
|---|---|
| public final ATNConfig transform(ATNState state, SemanticContext semanticContext, boolean checkNonGreedy) | |
| transform | back to summary |
|---|---|
| public final ATNConfig transform(ATNState state, PredictionContext context, boolean checkNonGreedy) | |
| transform | back to summary |
|---|---|
| public final ATNConfig transform(ATNState state, LexerActionExecutor lexerActionExecutor, boolean checkNonGreedy) | |
| transform | back to summary |
|---|---|
| private ATNConfig transform(ATNState state, PredictionContext context, SemanticContext semanticContext, boolean checkNonGreedy, LexerActionExecutor lexerActionExecutor) | |
ATNConfig purely as a memory
optimization. It allows for the creation of an ATNConfig with a
lexer action.
See the ATNConfig documentation for more information about
conserving memory through the use of several concrete types.
| Modifier and Type | Field and Description |
|---|---|
| private final LexerActionExecutor | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | ActionATNConfig(LexerActionExecutor lexerActionExecutor, ATNState state, int alt, PredictionContext context, boolean passedThroughNonGreedyDecision)
|
| protected | ActionATNConfig(LexerActionExecutor lexerActionExecutor, ATNConfig c, ATNState state, PredictionContext context, boolean passedThroughNonGreedyDecision)
|
| Modifier and Type | Method and Description |
|---|---|
| public LexerActionExecutor | |
| public boolean |
| lexerActionExecutor | back to summary |
|---|---|
| private final LexerActionExecutor lexerActionExecutor | |
| passedThroughNonGreedyDecision | back to summary |
|---|---|
| private final boolean passedThroughNonGreedyDecision | |
| ActionATNConfig | back to summary |
|---|---|
| public ActionATNConfig(LexerActionExecutor lexerActionExecutor, ATNState state, int alt, PredictionContext context, boolean passedThroughNonGreedyDecision) | |
| ActionATNConfig | back to summary |
|---|---|
| protected ActionATNConfig(LexerActionExecutor lexerActionExecutor, ATNConfig c, ATNState state, PredictionContext context, boolean passedThroughNonGreedyDecision) | |
| getLexerActionExecutor | back to summary |
|---|---|
| public LexerActionExecutor getLexerActionExecutor() Overrides org.
| |
| hasPassedThroughNonGreedyDecision | back to summary |
|---|---|
| public boolean hasPassedThroughNonGreedyDecision() Overrides org.
| |
SemanticContextATNConfig purely as a memory
optimization. It allows for the creation of an ATNConfig with
both a lexer action and a non-default semantic context.
See the ATNConfig documentation for more information about
conserving memory through the use of several concrete types.
| Modifier and Type | Field and Description |
|---|---|
| private final LexerActionExecutor | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | ActionSemanticContextATNConfig(LexerActionExecutor lexerActionExecutor, SemanticContext semanticContext, ATNState state, int alt, PredictionContext context, boolean passedThroughNonGreedyDecision)
|
| public | ActionSemanticContextATNConfig(LexerActionExecutor lexerActionExecutor, SemanticContext semanticContext, ATNConfig c, ATNState state, PredictionContext context, boolean passedThroughNonGreedyDecision)
|
| Modifier and Type | Method and Description |
|---|---|
| public LexerActionExecutor | |
| public boolean |
| lexerActionExecutor | back to summary |
|---|---|
| private final LexerActionExecutor lexerActionExecutor | |
| passedThroughNonGreedyDecision | back to summary |
|---|---|
| private final boolean passedThroughNonGreedyDecision | |
| ActionSemanticContextATNConfig | back to summary |
|---|---|
| public ActionSemanticContextATNConfig(LexerActionExecutor lexerActionExecutor, SemanticContext semanticContext, ATNState state, int alt, PredictionContext context, boolean passedThroughNonGreedyDecision) | |
| ActionSemanticContextATNConfig | back to summary |
|---|---|
| public ActionSemanticContextATNConfig(LexerActionExecutor lexerActionExecutor, SemanticContext semanticContext, ATNConfig c, ATNState state, PredictionContext context, boolean passedThroughNonGreedyDecision) | |
| getLexerActionExecutor | back to summary |
|---|---|
| public LexerActionExecutor getLexerActionExecutor() Overrides org.
| |
| hasPassedThroughNonGreedyDecision | back to summary |
|---|---|
| public boolean hasPassedThroughNonGreedyDecision() Overrides org.
| |
ATNConfig purely as a memory
optimization. It allows for the creation of an ATNConfig with a
non-default semantic context.
See the ATNConfig documentation for more information about
conserving memory through the use of several concrete types.
| Modifier and Type | Field and Description |
|---|---|
| private final SemanticContext |
| Access | Constructor and Description |
|---|---|
| public | SemanticContextATNConfig(SemanticContext semanticContext, ATNState state, int alt, PredictionContext context)
|
| public | SemanticContextATNConfig(SemanticContext semanticContext, ATNConfig c, ATNState state, PredictionContext context)
|
| Modifier and Type | Method and Description |
|---|---|
| public SemanticContext |
| semanticContext | back to summary |
|---|---|
| private final SemanticContext semanticContext
| |
| SemanticContextATNConfig | back to summary |
|---|---|
| public SemanticContextATNConfig(SemanticContext semanticContext, ATNState state, int alt, PredictionContext context) | |
| SemanticContextATNConfig | back to summary |
|---|---|
| public SemanticContextATNConfig(SemanticContext semanticContext, ATNConfig c, ATNState state, PredictionContext context) | |
| getSemanticContext | back to summary |
|---|---|
| public SemanticContext getSemanticContext() Overrides org.
| |