Class: KoiReferenceCompiler::Compiler
- Inherits:
-
Object
- Object
- KoiReferenceCompiler::Compiler
- Defined in:
- lib/koi-reference-compiler/koi-reference-compiler.rb
Class Method Summary collapse
Class Method Details
.compile(ast_hash) ⇒ Object
5 6 7 8 9 |
# File 'lib/koi-reference-compiler/koi-reference-compiler.rb', line 5 def self.compile(ast_hash) tree = self.load_ast_hash(ast_hash) bytecode = tree.compile return bytecode end |
.load_ast_hash(hash) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/koi-reference-compiler/koi-reference-compiler.rb', line 11 def self.load_ast_hash(hash) unless(hash[:elements].nil?) elements = hash[:elements].map {|x| self.load_ast_hash(x) } else elements = nil end tree = Kernel.const_get("KoiReferenceCompiler").const_get(hash[:name]).new(hash[:text_value], hash[:offset], elements) return tree end |