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 Details

  • Constructor Details

    • Transition

      protected Transition(ATNState target)
  • Method Details

    • 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)