Class: Transition
Overview
An ATN transition between any two ATN states. Subclasses define
atom, set, epsilon, action, predicate, rule transitions.
<p>This is a one way link. It emanates from a state (usually via a list of
transitions) and has a target state.</p>
<p>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.</p>
Direct Known Subclasses
AbstractPredicateTransition, ActionTransition, AtomTransition, EpsilonTransition, RangeTransition, RuleTransition, SetTransition, WildcardTransition
Constant Summary collapse
- EPSILON =
constants for serialization
1
- RANGE =
2
- RULE =
3
- PREDICATE =
e.g., Transition.isType(inputisType(input.LT(1))?
4
- ATOM =
5
- ACTION =
6
- SET =
~(A|B) or ~atom, wildcard, which convert to next 2
7
- NOT_SET =
8
- WILDCARD =
9
- PRECEDENCE =
10
- @@serializationNames =
[ "INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE" ]
- @@serializationTypes =
nil
Instance Attribute Summary collapse
-
#isEpsilon ⇒ Object
Returns the value of attribute isEpsilon.
-
#ruleIndex ⇒ Object
Returns the value of attribute ruleIndex.
-
#serializationType ⇒ Object
Returns the value of attribute serializationType.
-
#target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(target) ⇒ Transition
constructor
A new instance of Transition.
- #label ⇒ Object
Constructor Details
#initialize(target) ⇒ Transition
Returns a new instance of Transition.
52 53 54 55 56 57 58 59 |
# File 'lib/antlr4/atn/Transition.rb', line 52 def initialize(target) # The target of this transition. raise Exception.new("target cannot be null.") if target.nil? self.target = target # Are we epsilon, action, sempred? self.isEpsilon = false @ruleIndex = 0 end |
Instance Attribute Details
#isEpsilon ⇒ Object
Returns the value of attribute isEpsilon.
51 52 53 |
# File 'lib/antlr4/atn/Transition.rb', line 51 def isEpsilon @isEpsilon end |
#ruleIndex ⇒ Object
Returns the value of attribute ruleIndex.
51 52 53 |
# File 'lib/antlr4/atn/Transition.rb', line 51 def ruleIndex @ruleIndex end |
#serializationType ⇒ Object
Returns the value of attribute serializationType.
51 52 53 |
# File 'lib/antlr4/atn/Transition.rb', line 51 def serializationType @serializationType end |
#target ⇒ Object
Returns the value of attribute target.
51 52 53 |
# File 'lib/antlr4/atn/Transition.rb', line 51 def target @target end |
Class Method Details
.serializationNames ⇒ Object
39 40 41 |
# File 'lib/antlr4/atn/Transition.rb', line 39 def self.serializationNames @@serializationNames end |
.serializationTypes ⇒ Object
44 45 46 |
# File 'lib/antlr4/atn/Transition.rb', line 44 def self.serializationTypes @@serializationTypes end |
.serializationTypes=(newhash) ⇒ Object
47 48 49 |
# File 'lib/antlr4/atn/Transition.rb', line 47 def self.serializationTypes=(newhash) @@serializationTypes = newhash end |
Instance Method Details
#label ⇒ Object
60 61 62 |
# File 'lib/antlr4/atn/Transition.rb', line 60 def label nil end |