Class DFA

java.lang.Object
org.antlr.v4.runtime.dfa.DFA

public class DFA extends Object
  • Field Details

    • states

      public final Map<DFAState,DFAState> states
      A set of all DFA states. Use Map so we can get old state back (Set only allows you to see if it's there).
    • s0

      public volatile DFAState s0
    • decision

      public final int decision
    • atnStartState

      public final DecisionState atnStartState
      From which ATN state did we create this DFA?
    • precedenceDfa

      private final boolean precedenceDfa
      true if this DFA is for a precedence decision; otherwise, false. This is the backing field for isPrecedenceDfa().
  • Constructor Details

  • Method Details

    • isPrecedenceDfa

      public final boolean isPrecedenceDfa()
      Gets whether this DFA is a precedence DFA. Precedence DFAs use a special start state s0 which is not stored in states. The DFAState.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:
    • 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:
    • 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:
    • 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 - if precedenceDfa does not match the value of isPrecedenceDfa() for the current DFA.
    • getStates

      public List<DFAState> getStates()
      Return a list of all states in this DFA, ordered by state number.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      @Deprecated public String toString(String[] tokenNames)
      Deprecated.
    • toString

      public String toString(Vocabulary vocabulary)
    • toLexerString

      public String toLexerString()