# Visitor infrastructure on Logo programs # # See Part 3. # # This module provide an abstract `Visitor` class and # instrument the `Logo` class and its subclasses. module visitor import logo # Abstract visitor on a logo program. abstract class Visitor # Main visit method to redefine. # # By default is just call `visit_all`. fun visit(logo: Logo) do logo.visit_all(self) end end redef class Logo # Call visit on all children # # Do nothing if there is no children. fun visit_all(visitor: Visitor) do end end redef class LogoProg redef fun visit_all(visitor) do # TODO end end redef class LogoRepeat redef fun visit_all(visitor) do # TODO end end