Package org.antlr.v4.runtime.atn
Class Transition
- java.lang.Object
-
- org.antlr.v4.runtime.atn.Transition
-
- Direct Known Subclasses:
AbstractPredicateTransition
,ActionTransition
,AtomTransition
,EpsilonTransition
,RangeTransition
,RuleTransition
,SetTransition
,WildcardTransition
public abstract class Transition extends Object
An ATN transition between any two ATN states. Subclasses define atom, set, epsilon, action, predicate, rule transitions.This is a one way link. It emanates from a state (usually via a list of transitions) and has a target state.
Since we never have to change the ATN transitions once we construct it, we can fix these transitions as specific classes. The DFA transitions on the other hand need to update the labels as it adds transitions to the states. We'll use the term Edge for the DFA to distinguish them from ATN transitions.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ACTION
static int
ATOM
static int
EPSILON
static int
NOT_SET
static int
PRECEDENCE
static int
PREDICATE
static int
RANGE
static int
RULE
static List<String>
serializationNames
static Map<Class<? extends Transition>,Integer>
serializationTypes
static int
SET
ATNState
target
The target of this transition.static int
WILDCARD
-
Constructor Summary
Constructors Modifier Constructor Description protected
Transition(ATNState target)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
getSerializationType()
boolean
isEpsilon()
Determines if the transition is an "epsilon" transition.IntervalSet
label()
abstract boolean
matches(int symbol, int minVocabSymbol, int maxVocabSymbol)
-
-
-
Field Detail
-
EPSILON
public static final int EPSILON
- See Also:
- Constant Field Values
-
RANGE
public static final int RANGE
- See Also:
- Constant Field Values
-
RULE
public static final int RULE
- See Also:
- Constant Field Values
-
PREDICATE
public static final int PREDICATE
- See Also:
- Constant Field Values
-
ATOM
public static final int ATOM
- See Also:
- Constant Field Values
-
ACTION
public static final int ACTION
- See Also:
- Constant Field Values
-
SET
public static final int SET
- See Also:
- Constant Field Values
-
NOT_SET
public static final int NOT_SET
- See Also:
- Constant Field Values
-
WILDCARD
public static final int WILDCARD
- See Also:
- Constant Field Values
-
PRECEDENCE
public static final int PRECEDENCE
- See Also:
- Constant Field Values
-
serializationTypes
public static final Map<Class<? extends Transition>,Integer> serializationTypes
-
target
public ATNState target
The target of this transition.
-
-
Constructor Detail
-
Transition
protected Transition(ATNState target)
-
-
Method Detail
-
getSerializationType
public abstract int getSerializationType()
-
isEpsilon
public boolean isEpsilon()
Determines if the transition is an "epsilon" transition.The default implementation returns
false
.- Returns:
true
if traversing this transition in the ATN does not consume an input symbol; otherwise,false
if traversing this transition consumes (matches) an input symbol.
-
label
public IntervalSet label()
-
matches
public abstract boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol)
-
-