lib/ravensat/ast/node.rb in ravensat-0.2.2 vs lib/ravensat/ast/node.rb in ravensat-0.3.0

- old
+ new

@@ -12,9 +12,23 @@ @children.each do |child| child.each {|c| yield(c)} end end + def each_with_clause + case self + when AndNode, OrNode + @children.first.each_with_clause{|c| yield(c)} + yield(self) + @children.last.each_with_clause{|c| yield(c)} + when NotNode + yield(self) + @children.first.each_with_clause{|c| yield(c)} + when VarNode + yield(self) + end + end + def &(object) AndNode.new(self, object) end def |(object)