3637383940414243444546
} public Program visit(Program program) throws CompilerException { System.out.println(this + " visit #1 to " + program); new TraversalVisitor(new FooTraversal(this)).visit(program); System.out.println(this + " visit #2 to " + program); return program; }
4647484950515253545556
} public Expression visit(FunctionLiteral literal) throws CompilerException { System.out.println(this + " visit #1 to " + literal); new TraversalVisitor(new FooTraversal(this)).visit(literal); System.out.println(this + " visit #2 to " + literal); return literal; }
212223242526272829
* @author Andy Hayward */ public class PostfixVisitor extends SequenceVisitor { public PostfixVisitor(Visitor visitor) { visitors = new Visitor[] { new TraversalVisitor(this), visitor }; }
808182838485868788
final PrintVisitor visitor = new PrintVisitor(); visitors = new Visitor[] { visitor, new IncrementVisitor(visitor), new TraversalVisitor(this), new DecrementVisitor(visitor), }; }
2223242526272829
*/ public class PrefixVisitor extends SequenceVisitor { public PrefixVisitor(Visitor visitor) { visitors = new Visitor[] { visitor, new TraversalVisitor(this) }; }