rubyx/lib/ruby/statements.rb
Torsten Rüger d1f8733623 Rename Vool to Sol
Simple is really the descriptive name for the layer
Sure, it is "virtual" but that is not as important as the fact that it is simple (or simplified)
Also objct (based really) is better, since orientated implies it is a little like that, but only orientated, not really it. Sol only has objects, nothing else
Just cause i was renaming anyway
2019-10-04 00:38:47 +03:00

56 lines
1.0 KiB
Ruby

module Ruby
class Statements < Statement
attr_reader :statements
def initialize(statements)
@statements = []
statements.each{|st| self << st}
end
def empty?
@statements.empty?
end
def single?
@statements.length == 1
end
def first
@statements.first
end
def last
@statements.last
end
def length
@statements.length
end
def shift
@statements.shift
end
def pop
@statements.pop
end
def [](i)
@statements[i]
end
def <<(o)
raise "Not Statement #{o.class}=#{o.to_s[0..100]}" unless o.is_a?(Statement)
@statements << o
self
end
def to_sol
return first.to_sol if( single? )
brother = sol_brother.new(nil)
@statements.each do |s|
brother << s.to_sol
end
brother
end
def to_s(depth = 0)
at_depth(depth , @statements.collect{|st| st.to_s(depth)}.join("\n"))
end
end
class ScopeStatement < Statements
end
end