123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Visitor

Relationships & Source Files
Inherits: Object
Defined in: lib/rbs/ast/visitor.rb

Overview

The Visitor class implements the Visitor pattern for traversing the ::RBS Abstract Syntax Tree (AST).

It provides methods to visit each type of node in the ::RBS::AST, allowing for custom processing of each node type.

This class is designed to be subclassed, with specific visit methods overridden to implement custom behavior for different node types.

Example usage:

~~~rb class MyVisitor < Visitor

def visit_declaration_class(node)
  puts "Visiting class: #{node.name}"

  super # call {super} to run the default visiting behavior
end

end

visitor = MyVisitor.new visitor.visit(ast_node) ~~~

Instance Method Summary

Instance Method Details

#visit(node)

[ GitHub ]

#visit_all(nodes)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 70

def visit_all(nodes)
  nodes.each do |node|
    visit(node)
  end
end

#visit_declaration_class(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 79

def visit_declaration_class(node)
  visit_all(node.members)
end

#visit_declaration_constant(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 87

def visit_declaration_constant(node)
end

#visit_declaration_global(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 76

def visit_declaration_global(node)
end

#visit_declaration_interface(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 93

def visit_declaration_interface(node)
  visit_all(node.members)
end

#visit_declaration_module(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 83

def visit_declaration_module(node)
  visit_all(node.members)
end

#visit_declaration_type_alias(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 90

def visit_declaration_type_alias(node)
end

#visit_member_alias(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 97

def visit_member_alias(node)
end

#visit_member_attr_accessor(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 124

def visit_member_attr_accessor(node)
end

#visit_member_attr_reader(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 118

def visit_member_attr_reader(node)
end

#visit_member_attr_writer(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 121

def visit_member_attr_writer(node)
end

#visit_member_class_instance_variable(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 100

def visit_member_class_instance_variable(node)
end

#visit_member_class_variable(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 103

def visit_member_class_variable(node)
end

#visit_member_extend(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 133

def visit_member_extend(node)
end

#visit_member_include(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 127

def visit_member_include(node)
end

#visit_member_instance_variable(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 106

def visit_member_instance_variable(node)
end

#visit_member_method_definition(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 115

def visit_member_method_definition(node)
end

#visit_member_prepend(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 130

def visit_member_prepend(node)
end

#visit_member_private(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 109

def visit_member_private(node)
end

#visit_member_public(node)

[ GitHub ]

  
# File 'lib/rbs/ast/visitor.rb', line 112

def visit_member_public(node)
end