class DrgDSL::AstBuilder
Public Class Methods
broken_ast?(ast)
click to toggle source
Did we manage to build a correct AST?
@return [Boolean]
# File lib/drgdsl/ast_builder.rb, line 51 def self.broken_ast?(ast) !ast.is_a?(Ast::Node) end
build(cst)
click to toggle source
@param cst [Hash] CST-ish hash obtained from DrgParser. @return [Node] AST @raise [UnknownCstError] when CST could not be converted to a correct
AST.
# File lib/drgdsl/ast_builder.rb, line 42 def self.build(cst) ast = new.apply(cst) raise UnknownCstError.new(cst, ast) if broken_ast?(ast) ast end