Class: Antlr4::Runtime::Parser::TraceListener

Inherits:
Antlr4::Runtime::ParseTreeListener show all
Defined in:
lib/antlr4/runtime/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(parser, input) ⇒ TraceListener

Returns a new instance of TraceListener


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

def initialize(parser, input)
  @parser = parser
  @_input = input
end

Instance Method Details

#enter_every_rule(ctx) ⇒ Object


10
11
12
# File 'lib/antlr4/runtime/parser.rb', line 10

def enter_every_rule(ctx)
  puts('enter   ' << @parser.rule_names[ctx.rule_index] << ', lt(1)=' << @_input.lt(1).text)
end

#exit_every_rule(ctx) ⇒ Object


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

def exit_every_rule(ctx)
  puts('exit    ' << @parser.rule_names[ctx.rule_index] << ', lt(1)=' << @_input.lt(1).text)
end

#visit_error_node(_node) ⇒ Object


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

def visit_error_node(_node)
end

#visit_terminal(node, ctx) ⇒ Object


14
15
16
# File 'lib/antlr4/runtime/parser.rb', line 14

def visit_terminal(node, ctx)
  puts('consume ' << node.symbol.to_s << ' rule ' << @parser.rule_names[ctx.rule_index].to_s)
end