class Astrolabe::Builder

`Astrolabe::Builder` is an AST builder that is utilized to let `Parser` generate AST with {Astrolabe::Node}.

@example

require 'astrolabe/builder'
require 'parser/current'

buffer = Parser::Source::Buffer.new('(string)')
buffer.source = 'puts :foo'

builder = Astrolabe::Builder.new
parser = Parser::CurrentRuby.new(builder)
root_node = parser.parse(buffer)

Public Instance Methods

n(type, children, source_map) click to toggle source

Generates {Node} from the given information.

@return [Node] the generated node

# File lib/astrolabe/builder.rb, line 23
def n(type, children, source_map)
  Node.new(type, children, location: source_map)
end