Class: Antlr4::Runtime::PredicateTransition

Inherits:
AbstractPredicateTransition show all
Defined in:
lib/antlr4/runtime/predicate_transition.rb

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

#label

Constructor Details

#initialize(target, rule_index, pred_index, is_ctx_dependent) ⇒ PredicateTransition

Returns a new instance of PredicateTransition



8
9
10
11
12
13
# File 'lib/antlr4/runtime/predicate_transition.rb', line 8

def initialize(target, rule_index, pred_index, is_ctx_dependent)
  super(target)
  @rule_index = rule_index
  @pred_index = pred_index
  @is_ctx_dependent = is_ctx_dependent
end

Instance Attribute Details

#is_ctx_dependentObject (readonly)

e.g., $i ref in pred



6
7
8
# File 'lib/antlr4/runtime/predicate_transition.rb', line 6

def is_ctx_dependent
  @is_ctx_dependent
end

#pred_indexObject (readonly)

Returns the value of attribute pred_index



5
6
7
# File 'lib/antlr4/runtime/predicate_transition.rb', line 5

def pred_index
  @pred_index
end

#rule_indexObject (readonly)

Returns the value of attribute rule_index



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

def rule_index
  @rule_index
end

Instance Method Details

#epsilon?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/antlr4/runtime/predicate_transition.rb', line 19

def epsilon?
  true
end

#matches(_symbol, _min_vocab_symbol, _max_vocab_symbol) ⇒ Object



23
24
25
# File 'lib/antlr4/runtime/predicate_transition.rb', line 23

def matches(_symbol, _min_vocab_symbol, _max_vocab_symbol)
  false
end

#predicateObject



27
28
29
# File 'lib/antlr4/runtime/predicate_transition.rb', line 27

def predicate
  SemanticContext::Predicate.new(@rule_index, @pred_index, @is_ctx_dependent)
end

#serialization_typeObject



15
16
17
# File 'lib/antlr4/runtime/predicate_transition.rb', line 15

def serialization_type
  PREDICATE
end

#to_sObject



31
32
33
# File 'lib/antlr4/runtime/predicate_transition.rb', line 31

def to_s
  'pred_' + @rule_index + ':' + @pred_index
end