public class DFAState extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DFAState.PredPrediction
Map a predicate to a predicted alternative.
|
Modifier and Type | Field and Description |
---|---|
ATNConfigSet |
configs |
DFAState[] |
edges
edges[symbol] points to target of symbol. |
boolean |
isAcceptState |
int |
lexerActionIndex |
int |
lexerRuleIndex |
DFAState.PredPrediction[] |
predicates
During SLL parsing, this is a list of predicates associated with the
ATN configurations of the DFA state.
|
int |
prediction
if accept state, what ttype do we match or alt do we predict?
This is set to
ATN.INVALID_ALT_NUMBER when predicates !=null or
requiresFullContext . |
boolean |
requiresFullContext
Indicates that this state was created during SLL prediction that
discovered a conflict between the configurations in the state.
|
int |
stateNumber |
Constructor and Description |
---|
DFAState() |
DFAState(ATNConfigSet configs) |
DFAState(int stateNumber) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Two
DFAState instances are equal if their ATN configuration sets
are the same. |
Set<Integer> |
getAltSet()
Get the set of all alts mentioned by all ATN configurations in this
DFA state.
|
int |
hashCode() |
String |
toString() |
public int stateNumber
@NotNull public ATNConfigSet configs
public boolean isAcceptState
public int prediction
ATN.INVALID_ALT_NUMBER
when predicates
!=null
or
requiresFullContext
.public int lexerRuleIndex
public int lexerActionIndex
public boolean requiresFullContext
ParserATNSimulator.execDFA(org.antlr.v4.runtime.dfa.DFA, org.antlr.v4.runtime.dfa.DFAState, org.antlr.v4.runtime.TokenStream, int, org.antlr.v4.runtime.ParserRuleContext)
invocations immediately jumped doing
full context prediction if this field is true.@Nullable public DFAState.PredPrediction[] predicates
requiresFullContext
is false
since full context prediction evaluates predicates
on-the-fly. If this is not null, then prediction
is
ATN.INVALID_ALT_NUMBER
.
We only use these for non-requiresFullContext
but conflicting states. That
means we know from the context (it's $ or we don't dip into outer
context) that it's an ambiguity not a conflict.
This list is computed by ParserATNSimulator.predicateDFAState(org.antlr.v4.runtime.dfa.DFAState, org.antlr.v4.runtime.atn.DecisionState)
.public DFAState()
public DFAState(int stateNumber)
public DFAState(@NotNull ATNConfigSet configs)
public Set<Integer> getAltSet()
public boolean equals(Object o)
DFAState
instances are equal if their ATN configuration sets
are the same. This method is used to see if a state already exists.
Because the number of alternatives and number of ATN configurations are
finite, there is a finite number of DFA states that can be processed.
This is necessary to show that the algorithm terminates.
Cannot test the DFA state numbers here because in
ParserATNSimulator.addDFAState(org.antlr.v4.runtime.dfa.DFA, org.antlr.v4.runtime.dfa.DFAState)
we need to know if any other state
exists that has this exact set of ATN configurations. The
stateNumber
is irrelevant.Copyright © 1992-2013 ANTLR. All Rights Reserved.