soml-parser/lib/ast/block_expression.rb
2015-05-01 18:13:33 +03:00

27 lines
605 B
Ruby

module Ast
class BlockExpression < Expression
attr_reader :call_exp, :args , :body_exp
def initialize call_exp, args , body_exp
@call_exp = call_exp.to_sym
@args = args
@body_exp = body_exp
end
def attributes
[:call_exp, :args , :body_exp]
end
def inspect
self.class.call_exp + ".new(" + call_exp.inspect + ", ["+
args.collect{|m| m.inspect }.join( ",") + "] ," + body_exp.inspect + ")"
end
def to_s
"#{call_exp}(" + args.join(",") + ")"
end
def attributes
[:call_exp , :args , :body_exp]
end
end
end