class Antlr4::Runtime::RuleContext
Attributes
invoking_state[RW]
parent[RW]
Public Class Methods
new(parent = nil, invoking_state = nil)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 7 def initialize(parent = nil, invoking_state = nil) @invoking_state = -1 @parent = parent @invoking_state = invoking_state end
Public Instance Methods
accept(visitor)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 73 def accept(visitor) visitor.visit_children(self) end
alt_number()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 61 def alt_number ATN::INVALID_ALT_NUMBER end
child(_i)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 65 def child(_i) nil end
child_count()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 69 def child_count 0 end
depth()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 13 def depth n = 0 p = self until p.nil? p = p.parent n += 1 end n end
empty?()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 23 def empty? @invoking_state == -1 end
payload()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 37 def payload self end
rule_context()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 33 def rule_context self end
rule_index()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 57 def rule_index -1 end
set_alt_number(_num)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 41 def set_alt_number(_num) end
source_interval()
click to toggle source
satisfy the ParseTree
/ SyntaxTree interface
# File lib/antlr4/runtime/rule_context.rb, line 29 def source_interval Interval.invalid end
text()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 44 def text return '' if child_count == 0 builder = '' i = 0 while i < child_count builder << child_at(i).text i += 1 end builder.to_s end
to_s()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 89 def to_s to_s_recog_ctx(nil, nil) end
to_s_list(rule_names)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 97 def to_s_list(rule_names) to_s_list_ctx(rule_names, nil) end
to_s_list_ctx(rule_names, stop)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 107 def to_s_list_ctx(rule_names, stop) buf = '' p = self buf << '[' while !p.nil? && p != stop if rule_names.nil? buf << p.invoking_state unless p.empty? else rule_index = p.rule_index rule_name = rule_index >= 0 && rule_index < rule_names.size ? rule_names[rule_index] : rule_index buf << rule_name.to_s end buf << ' ' if !p.parent.nil? && (!rule_names.nil? || !p.parent.empty?) p = p.parent end buf << ']' buf end
to_s_recog(recog)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 93 def to_s_recog(recog) to_s_recog_ctx(recog, ParserRuleContext::EMPTY) end
to_s_recog_ctx(recog, stop)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 101 def to_s_recog_ctx(recog, stop) rule_names = !recog.nil? ? recog.rule_names : nil rule_names_list = !rule_names.nil? ? rule_names : nil to_s_list_ctx(rule_names_list, stop) end
to_string_tree()
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 85 def to_string_tree to_string_tree_rulenames(nil) end
to_string_tree_recog(recog)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 77 def to_string_tree_recog(recog) Trees.to_sTree(self, recog) end
to_string_tree_rulenames(rule_names)
click to toggle source
# File lib/antlr4/runtime/rule_context.rb, line 81 def to_string_tree_rulenames(rule_names) Trees.to_sTree(self, rule_names) end