Module: Vinter::ASTPrinter

Defined in:
lib/vinter/ast_printer.rb

Class Method Summary collapse

Class Method Details



3
4
5
6
7
8
9
10
11
12
# File 'lib/vinter/ast_printer.rb', line 3

def self.print(ast, indent=0)
  spaces = " " * indent * 2
  ast[:body].each do |node|
    puts "#{spaces}(#{node[:type]}|#{node[:value]})"
    if node[:type] == :export_statement
      puts "(#{node[:export][:type]})"
      print(node[:export], indent=1)
    end
  end
end