Class: Jaina::Parser::AST::TreeBuilder Private
- Inherits:
-
Object
- Object
- Jaina::Parser::AST::TreeBuilder
- Extended by:
- Forwardable
- Defined in:
- lib/jaina/parser/ast/tree_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.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Jaina::Parser::AST:Tree private
- #initialize(program) ⇒ void constructor private
Constructor Details
#initialize(program) ⇒ void
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.
32 33 34 35 36 |
# File 'lib/jaina/parser/ast/tree_builder.rb', line 32 def initialize(program) @program = program.dup.tap(&:freeze) @prefix_form = Jaina::Parser::CodeConverter.to_prefix_form(@program) @tokens = Jaina::Parser::Tokenizer.tokenize(@prefix_form) end |
Class Method Details
.build(program) ⇒ Jaina::Parser::AST::Tree
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.
15 16 17 |
# File 'lib/jaina/parser/ast/tree_builder.rb', line 15 def build(program) new(program).build end |
Instance Method Details
#build ⇒ Jaina::Parser::AST:Tree
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.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/jaina/parser/ast/tree_builder.rb', line 42 def build token_series = tokens.map(&:dup) expression_tree = build_expression_tree(token_series) Jaina::Parser::AST::Tree.new( initial_program: program, ast_oriented_program: prefix_form, expression: expression_tree ) end |