Class: LIT::Parser::ASTBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/lit/parser/ast_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(raw_ast) ⇒ ASTBuilder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ASTBuilder.

Since:

  • 0.1.0



8
9
10
# File 'lib/lit/parser/ast_builder.rb', line 8

def initialize(raw_ast)
  @raw_ast = raw_ast
end

Instance Method Details

#buildObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



12
13
14
15
# File 'lib/lit/parser/ast_builder.rb', line 12

def build
  statements = @raw_ast.fetch("statements").map { |raw_stmt| build_statement(raw_stmt) }
  AST::Program.new(statements)
end