Sha256: 8426ca7baf76ed7d45fc0f2270bd4967e4861dd96eec567c4cbd583f64f05204
Contents?: true
Size: 748 Bytes
Versions: 13
Compression:
Stored size: 748 Bytes
Contents
# coding: utf-8 require 'astrolabe/node' require 'parser' module Astrolabe # `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) class Builder < Parser::Builders::Default # Generates {Node} from the given information. # # @return [Node] the generated node def n(type, children, source_map) Node.new(type, children, location: source_map) end end end
Version data entries
13 entries across 13 versions & 2 rubygems