class RubyVM::AbstractSyntaxTree::Node

Public Instance Methods

==(other) click to toggle source
# File lib/solargraph/parser/rubyvm.rb, line 18
def == other
  return false unless other.is_a?(self.class)
  here = Solargraph::Range.from_node(self)
  there = Solargraph::Range.from_node(other)
  here == there && to_sexp == other.to_sexp
end
to_sexp() click to toggle source
# File lib/solargraph/parser/rubyvm.rb, line 14
def to_sexp
  sexp self
end

Private Instance Methods

sexp(node, depth = 0) click to toggle source
# File lib/solargraph/parser/rubyvm.rb, line 27
def sexp node, depth = 0
  result = ''
  if node.is_a?(RubyVM::AbstractSyntaxTree::Node)
    result += "#{'  ' * depth}(:#{node.type}"
    node.children.each do |child|
      result += "\n" + sexp(child, depth + 1)
    end
    result += ")"
  else
    result += "#{'  ' * depth}#{node.inspect}"
  end
  result
end