Class: Antlr4::Runtime::SetTransition

Inherits:
Transition
  • Object
show all
Defined in:
lib/antlr4/runtime/set_transition.rb

Direct Known Subclasses

NotSetTransition

Constant Summary

Constants inherited from Transition

Transition::ACTION, Transition::ATOM, Transition::EPSILON, Transition::NOT_SET, Transition::PRECEDENCE, Transition::PREDICATE, Transition::RANGE, Transition::RULE, Transition::SET, Transition::WILDCARD

Instance Attribute Summary collapse

Attributes inherited from Transition

#target

Instance Method Summary collapse

Methods inherited from Transition

#epsilon?

Constructor Details

#initialize(target, set) ⇒ SetTransition



6
7
8
9
10
11
# File 'lib/antlr4/runtime/set_transition.rb', line 6

def initialize(target, set)
  super(target)
  set = IntervalSet.of(Token::INVALID_TYPE) if set.nil?

  @set = set
end

Instance Attribute Details

#setObject (readonly)

Returns the value of attribute set



4
5
6
# File 'lib/antlr4/runtime/set_transition.rb', line 4

def set
  @set
end

Instance Method Details

#labelObject



17
18
19
# File 'lib/antlr4/runtime/set_transition.rb', line 17

def label
  @set
end

#matches(symbol, _min_vocab_symbol, _max_vocab_symbol) ⇒ Object



21
22
23
# File 'lib/antlr4/runtime/set_transition.rb', line 21

def matches(symbol, _min_vocab_symbol, _max_vocab_symbol)
  @set.contains(symbol)
end

#serialization_typeObject



13
14
15
# File 'lib/antlr4/runtime/set_transition.rb', line 13

def serialization_type
  SET
end

#to_sObject



25
26
27
# File 'lib/antlr4/runtime/set_transition.rb', line 25

def to_s
  @set.to_s
end