Package org.antlr.v4.runtime.dfa
Class DFA
- java.lang.Object
-
- org.antlr.v4.runtime.dfa.DFA
-
public class DFA extends Object
-
-
Field Summary
Fields Modifier and Type Field Description DecisionState
atnStartState
From which ATN state did we create this DFA?int
decision
DFAState
s0
Map<DFAState,DFAState>
states
A set of all DFA states.
-
Constructor Summary
Constructors Constructor Description DFA(DecisionState atnStartState)
DFA(DecisionState atnStartState, int decision)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DFAState
getPrecedenceStartState(int precedence)
Get the start state for a specific precedence value.List<DFAState>
getStates()
Return a list of all states in this DFA, ordered by state number.boolean
isPrecedenceDfa()
Gets whether this DFA is a precedence DFA.void
setPrecedenceDfa(boolean precedenceDfa)
Deprecated.This method no longer performs any action.void
setPrecedenceStartState(int precedence, DFAState startState)
Set the start state for a specific precedence value.String
toLexerString()
String
toString()
String
toString(String[] tokenNames)
Deprecated.UsetoString(Vocabulary)
instead.String
toString(Vocabulary vocabulary)
-
-
-
Field Detail
-
s0
public volatile DFAState s0
-
decision
public final int decision
-
atnStartState
public final DecisionState atnStartState
From which ATN state did we create this DFA?
-
-
Constructor Detail
-
DFA
public DFA(DecisionState atnStartState)
-
DFA
public DFA(DecisionState atnStartState, int decision)
-
-
Method Detail
-
isPrecedenceDfa
public final boolean isPrecedenceDfa()
Gets whether this DFA is a precedence DFA. Precedence DFAs use a special start states0
which is not stored instates
. TheDFAState.edges
array for this start state contains outgoing edges supplying individual start states corresponding to specific precedence values.- Returns:
true
if this is a precedence DFA; otherwise,false
.- See Also:
Parser.getPrecedence()
-
getPrecedenceStartState
public final DFAState getPrecedenceStartState(int precedence)
Get the start state for a specific precedence value.- Parameters:
precedence
- The current precedence.- Returns:
- The start state corresponding to the specified precedence, or
null
if no start state exists for the specified precedence. - Throws:
IllegalStateException
- if this is not a precedence DFA.- See Also:
isPrecedenceDfa()
-
setPrecedenceStartState
public final void setPrecedenceStartState(int precedence, DFAState startState)
Set the start state for a specific precedence value.- Parameters:
precedence
- The current precedence.startState
- The start state corresponding to the specified precedence.- Throws:
IllegalStateException
- if this is not a precedence DFA.- See Also:
isPrecedenceDfa()
-
setPrecedenceDfa
@Deprecated public final void setPrecedenceDfa(boolean precedenceDfa)
Deprecated.This method no longer performs any action.Sets whether this is a precedence DFA.- Parameters:
precedenceDfa
-true
if this is a precedence DFA; otherwise,false
- Throws:
UnsupportedOperationException
- ifprecedenceDfa
does not match the value ofisPrecedenceDfa()
for the current DFA.
-
getStates
public List<DFAState> getStates()
Return a list of all states in this DFA, ordered by state number.
-
toString
@Deprecated public String toString(String[] tokenNames)
Deprecated.UsetoString(Vocabulary)
instead.
-
toString
public String toString(Vocabulary vocabulary)
-
toLexerString
public String toLexerString()
-
-