2018-07-19 13:46:51 +02:00
|
|
|
module Ruby
|
|
|
|
class Statements < Statement
|
|
|
|
attr_reader :statements
|
|
|
|
def initialize(statements)
|
|
|
|
@statements = statements
|
|
|
|
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
|
2019-08-15 20:30:36 +02:00
|
|
|
def shift
|
|
|
|
@statements.shift
|
|
|
|
end
|
2019-08-17 22:27:55 +02:00
|
|
|
def pop
|
|
|
|
@statements.pop
|
|
|
|
end
|
2018-07-19 13:46:51 +02:00
|
|
|
def [](i)
|
|
|
|
@statements[i]
|
|
|
|
end
|
|
|
|
def <<(o)
|
|
|
|
@statements << o
|
|
|
|
self
|
2019-08-15 20:30:36 +02:00
|
|
|
end
|
2018-07-19 20:44:48 +02:00
|
|
|
def to_vool
|
2019-08-19 10:33:12 +02:00
|
|
|
return first.to_vool if( single? )
|
|
|
|
brother = vool_brother.new(nil)
|
|
|
|
@statements.each do |s|
|
|
|
|
brother << s.to_vool
|
2018-07-19 13:46:51 +02:00
|
|
|
end
|
2019-08-19 10:33:12 +02:00
|
|
|
brother
|
2018-07-19 13:46:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_s(depth = 0)
|
|
|
|
at_depth(depth , *@statements.collect{|st| st.to_s(depth)})
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class ScopeStatement < Statements
|
|
|
|
end
|
|
|
|
end
|