lib/rley/parse_forest_visitor.rb in rley-0.7.07 vs lib/rley/parse_forest_visitor.rb in rley-0.7.08
- old
+ new
@@ -13,12 +13,12 @@
# an unique prime number (called a signature).
def add_edge_signatures(prime_enumerator)
@signatures = subnodes.map { |_| prime_enumerator.next }
end
- def signature_exist?()
- @signatures.nil? ? false : true
+ def signature_exist?
+ !@signatures.nil?
end
end # class
end # module
# A visitor class dedicated in the visit of a parse forest.
@@ -67,11 +67,11 @@
def unsubscribe(aSubscriber)
subscribers.delete_if { |entry| entry == aSubscriber }
end
# The signal to begin the visit of the parse forest.
- def start()
+ def start
pforest.accept(self)
end
# Visit event. The visitor is about to visit the pforest.
# @param aParseForest [ParseForest] the pforest to visit.
@@ -167,11 +167,11 @@
# @param msg [Symbol] event to notify
# @param args [Array] arguments of the notification.
def broadcast(msg, *args)
subscribers.each do |subscr|
next unless subscr.respond_to?(msg) || subscr.respond_to?(:accept_all)
-
+
subscr.send(msg, *args)
end
end
def push_node(aCompositeNode, anEdgeSignature)
@@ -188,10 +188,10 @@
end
end
def pop_node
return if legs.empty?
-
+
legs.pop
end
end # class
end # module
# End of file