Class: DrgDSL::AstBuilder
- Inherits:
-
Parslet::Transform
- Object
- Parslet::Transform
- DrgDSL::AstBuilder
- Defined in:
- lib/drgdsl/ast_builder.rb
Class Method Summary collapse
-
.broken_ast?(ast) ⇒ Boolean
Did we manage to build a correct AST?.
-
.build(cst) ⇒ Node
AST.
Class Method Details
.broken_ast?(ast) ⇒ Boolean
Did we manage to build a correct AST?
51 52 53 |
# File 'lib/drgdsl/ast_builder.rb', line 51 def self.broken_ast?(ast) !ast.is_a?(Ast::Node) end |
.build(cst) ⇒ Node
Returns AST.
42 43 44 45 46 |
# 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 |