Class: Sexpir::Body

Inherits:
Ast
  • Object
show all
Defined in:
lib/sexpir/ast.rb,
lib/sexpir/ast_sexp.rb

Overview

statements

Instance Attribute Summary collapse

Attributes inherited from Ast

#node

Instance Method Summary collapse

Methods inherited from Ast

#accept

Constructor Details

#initializeBody

Returns a new instance of Body.



44
45
46
# File 'lib/sexpir/ast.rb', line 44

def initialize
  @stmts=[]
end

Instance Attribute Details

#stmtsObject

Returns the value of attribute stmts.



43
44
45
# File 'lib/sexpir/ast.rb', line 43

def stmts
  @stmts
end

Instance Method Details

#<<(e) ⇒ Object



48
49
50
# File 'lib/sexpir/ast.rb', line 48

def << e
  @stmts << e
end

#sexpObject



72
73
74
75
76
# File 'lib/sexpir/ast_sexp.rb', line 72

def sexp
  code=Code.new
  stmts.each{|stmt| code << stmt.sexp}
  code
end