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 DecisionStateatnStartStateFrom which ATN state did we create this DFA?intdecisionDFAStates0Map<DFAState,DFAState>statesA 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 DFAStategetPrecedenceStartState(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.booleanisPrecedenceDfa()Gets whether this DFA is a precedence DFA.voidsetPrecedenceDfa(boolean precedenceDfa)Deprecated.This method no longer performs any action.voidsetPrecedenceStartState(int precedence, DFAState startState)Set the start state for a specific precedence value.StringtoLexerString()StringtoString()StringtoString(String[] tokenNames)Deprecated.UsetoString(Vocabulary)instead.StringtoString(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 states0which is not stored instates. TheDFAState.edgesarray for this start state contains outgoing edges supplying individual start states corresponding to specific precedence values.- Returns:
trueif 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
nullif 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-trueif this is a precedence DFA; otherwise,false- Throws:
UnsupportedOperationException- ifprecedenceDfadoes 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()
-
-