module ANTLR3::Debug::TreeAdaptor

Adds debugging event hooks to TreeAdaptor objects

Attributes

debug_listener[RW]

Public Class Methods

wrap( adaptor, debug_listener = nil ) click to toggle source
# File lib/antlr3/tree/debug.rb, line 13
def self.wrap( adaptor, debug_listener = nil )
  adaptor.extend( self )
  adaptor.debug_listener = debug_listener
  return( adaptor )
end

Public Instance Methods

add_child( tree, child ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 72
def add_child( tree, child )
  case child
  when Token
    node = create_with_payload( child )
    add_child( tree, node )
  else
    tree.nil? || child.nil? and return
    super( tree, child )
    @debug_listener.add_child( tree, child )
  end
end
become_root( new_root, old_root ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 84
def become_root( new_root, old_root )
  case new_root
  when Token
    n = create_with_payload( new_root )
    super( n, old_root )
  else
    n = super( new_root, old_root )
  end
  @debug_listener.become_root( new_root, old_root )
  return n
end
copy_node( tree_node ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 60
def copy_node( tree_node )
  duplicate = super
  @debug_listener.create_node duplicate
  return duplicate
end
copy_tree( tree ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 45
def copy_tree( tree )
  t = super
  simulate_tree_construction( t )
  return t
end
create_error_node( input, start, stop, exc ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 39
def create_error_node( input, start, stop, exc )
  node = super
  node.nil? or @debug_listener.error_node( node )
  return node
end
create_flat_list() click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 66
def create_flat_list
  node = super
  @debug_listener.flat_node( node )
  return node
end
create_from_token( token_type, from_token, text = nil ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 27
def create_from_token( token_type, from_token, text = nil )
  node = super
  @debug_listener.create_node( node )
  return node
end
create_from_type( token_type, text ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 33
def create_from_type( token_type, text )
  node = super
  @debug_listener.create_node( node )
  return node
end
create_with_payload( payload ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 21
def create_with_payload( payload )
  node = super
  @debug_listener.create_node( node, payload )
  return node
end
set_token_boundaries( tree, start_token, stop_token ) click to toggle source
Calls superclass method
# File lib/antlr3/tree/debug.rb, line 96
def set_token_boundaries( tree, start_token, stop_token )
  super( tree, start_token, stop_token )
  return unless tree && start_token && stop_token
  @debug_listener.set_token_boundaries( tree,
    start_token.token_index, stop_token.token_index )
end
simulate_tree_construction( tree ) click to toggle source
# File lib/antlr3/tree/debug.rb, line 51
def simulate_tree_construction( tree )
  @debug_listener.create_node( tree )
  child_count( tree ).times do |i|
    child = self.child_of( tree, i )
    simulate_tree_construction( child )
    @debug_listener.add_child( tree, child )
  end
end