Class: Antlr4ruby::SemanticContext::Predicate

Inherits:
Antlr4ruby::SemanticContext show all
Defined in:
lib/antlr4ruby/atn/context/semantic_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Antlr4ruby::SemanticContext

and, #eval_precedence, or

Constructor Details

#initialize(rule_index, pred_index, is_ctx_dependent) ⇒ Predicate

Returns a new instance of Predicate.



21
22
23
# File 'lib/antlr4ruby/atn/context/semantic_context.rb', line 21

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

Instance Attribute Details

#is_ctx_dependentObject (readonly)

Returns the value of attribute is_ctx_dependent.



19
20
21
# File 'lib/antlr4ruby/atn/context/semantic_context.rb', line 19

def is_ctx_dependent
  @is_ctx_dependent
end

#pred_indexObject (readonly)

Returns the value of attribute pred_index.



19
20
21
# File 'lib/antlr4ruby/atn/context/semantic_context.rb', line 19

def pred_index
  @pred_index
end

#rule_indexObject (readonly)

Returns the value of attribute rule_index.



19
20
21
# File 'lib/antlr4ruby/atn/context/semantic_context.rb', line 19

def rule_index
  @rule_index
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/antlr4ruby/atn/context/semantic_context.rb', line 34

def eql?(other)
  # todo
end

#eval(parser, parser_call_stack) ⇒ Object



25
26
27
28
# File 'lib/antlr4ruby/atn/context/semantic_context.rb', line 25

def eval(parser, parser_call_stack)
  local_ctx = is_ctx_dependent ? parser_call_stack : nil
  parser.sempred(local_ctx, rule_index, pred_index)
end

#hashObject



30
31
32
# File 'lib/antlr4ruby/atn/context/semantic_context.rb', line 30

def hash
  # todo
end

#to_sObject



38
39
40
# File 'lib/antlr4ruby/atn/context/semantic_context.rb', line 38

def to_s
  "{#{rule_index}:#{pred_index}}?"
end