Top Fields Constructors Methods
org.antlr.v4.runtime.dfa

public Class DFA

extends Object
Class Inheritance
Imports
org.antlr.v4.runtime.Parser, .Vocabulary, .VocabularyImpl, org.antlr.v4.runtime.atn.ATNConfigSet, .DecisionState, .StarLoopEntryState, java.util.ArrayList, .Arrays, .Collections, .Comparator, .HashMap, .List, .Map, .Set

Field Summary

Modifier and TypeField and Description
public final DecisionState
atnStartState

From which ATN state did we create this DFA?

public final int
private final boolean
precedenceDfa

true if this DFA is for a precedence decision; otherwise, false.

public volatile DFAState
public final Map<DFAState, DFAState>
states

A set of all DFA states.

Constructor Summary

AccessConstructor and Description
public
DFA(DecisionState atnStartState)

public
DFA(DecisionState atnStartState, int decision)

Method Summary

Modifier and TypeMethod and Description
public final DFAState

Returns:

The start state corresponding to the specified precedence, or null if no start state exists for the specified precedence.
getPrecedenceStartState
(int
The current precedence.
precedence
)

Get the start state for a specific precedence value.

public List<DFAState>
getStates()

Return a list of all states in this DFA, ordered by state number.

public final boolean

Returns:

true if this is a precedence DFA; otherwise, false.
isPrecedenceDfa
()

Gets whether this DFA is a precedence DFA.

public final void
setPrecedenceDfa(boolean
true if this is a precedence DFA; otherwise, false
precedenceDfa
)

Deprecated This method no longer performs any action.
Sets whether this is a precedence DFA.
public final void
setPrecedenceStartState(int
The current precedence.
precedence
,
DFAState
The start state corresponding to the specified precedence.
startState
)

Set the start state for a specific precedence value.

public String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public String
toString(String[] tokenNames)

Deprecated Use toString(Vocabulary) instead.
public String
toString(Vocabulary vocabulary)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

atnStartStateback to summary
public final DecisionState atnStartState

From which ATN state did we create this DFA?

decisionback to summary
public final int decision
precedenceDfaback to summary
private final boolean precedenceDfa

true if this DFA is for a precedence decision; otherwise, false. This is the backing field for isPrecedenceDfa.

s0back to summary
public volatile DFAState s0
statesback to summary
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).

Constructor Detail

DFAback to summary
public DFA(DecisionState atnStartState)
DFAback to summary
public DFA(DecisionState atnStartState, int decision)

Method Detail

getPrecedenceStartStateback to summary
public final DFAState getPrecedenceStartState(int precedence)

Get the start state for a specific precedence value.

Parameters
precedence:int

The current precedence.

Returns:DFAState

The start state corresponding to the specified precedence, or null if no start state exists for the specified precedence.

Annotations
@SuppressWarnings:null
Exceptions
IllegalStateException:
if this is not a precedence DFA.
See Also
isPrecedenceDfa()
getStatesback to summary
public List<DFAState> getStates()

Return a list of all states in this DFA, ordered by state number.

isPrecedenceDfaback to summary
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:boolean

true if this is a precedence DFA; otherwise, false.

See Also
Parser#getPrecedence()
setPrecedenceDfaback to summary
public final void setPrecedenceDfa(boolean precedenceDfa)

Deprecated

This method no longer performs any action.

Sets whether this is a precedence DFA.

Parameters
precedenceDfa:boolean

true if this is a precedence DFA; otherwise, false

Annotations
@Deprecated
Exceptions
UnsupportedOperationException:
if precedenceDfa does not match the value of isPrecedenceDfa for the current DFA.
setPrecedenceStartStateback to summary
public final void setPrecedenceStartState(int precedence, DFAState startState)

Set the start state for a specific precedence value.

Parameters
precedence:int

The current precedence.

startState:DFAState

The start state corresponding to the specified precedence.

Annotations
@SuppressWarnings:SynchronizeOnNonFinalField, null
Exceptions
IllegalStateException:
if this is not a precedence DFA.
See Also
isPrecedenceDfa()
toLexerStringback to summary
public String toLexerString()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
toStringback to summary
public String toString(String[] tokenNames)

Deprecated

Use toString(Vocabulary) instead.

Annotations
@Deprecated
toStringback to summary
public String toString(Vocabulary vocabulary)