class AST::Node

def to_sexp(indent=0)

Returns:
  • (String) -

Parameters:
  • indent (Integer) -- Base indentation level.
def to_sexp(indent=0)
  indented = "  " * indent
  sexp = "#{indented}(#{fancy_type}"
  children.each do |child|
    if child.is_a?(Node)
      sexp += "\n#{child.to_sexp(indent + 1)}"
    else
      sexp += " #{child.inspect}"
    end
  end
  sexp += ")"
  sexp
end