Class: IV::Phonic::AST::Program

Inherits:
Node
  • Object
show all
Defined in:
lib/iv/phonic/ast.rb

Instance Method Summary collapse

Methods inherited from Node

#begin_position, #end_position

Constructor Details

#initialize(array, source) ⇒ Program

Returns a new instance of Program.



46
47
48
49
# File 'lib/iv/phonic/ast.rb', line 46

def initialize array, source
  @source = source
  @body = array.map{|stmt| Statement.as self, stmt }
end

Instance Method Details

#programObject



51
52
53
# File 'lib/iv/phonic/ast.rb', line 51

def program
  self
end

#sourceObject



55
56
# File 'lib/iv/phonic/ast.rb', line 55

def source
end

#to_source(lv = 0) ⇒ Object



58
59
60
61
62
# File 'lib/iv/phonic/ast.rb', line 58

def to_source lv=0
  @body.map {|stmt|
    stmt.to_source lv
  }.join('\n').indent(lv)
end