com.go.tea.parsetree
Interface NodeVisitor

All Known Implementing Classes:
TreeMutator, TreeWalker

public interface NodeVisitor

A NodeVisitor enables operations to be performed on a parse tree. The Visitor design pattern is discussed in detail in Design Patterns (ISBN 0-201-63361-2) by Gamma, Helm, Johnson and Vlissides.

The traditional operations performed on parse trees are type checking and code generation. The Visitor allows those operations to all be encapsulated into one place instead of having that functionality spread out into every Node subclass. It also makes it easy to target multiple languages by allowing any kind of code generation Visitor to be designed.

When using a Visitor to traverse a parse tree, the code responsible for moving the traversal into children nodes can either be placed in the nodes or in the Visitor implementation. The NodeVisitor places that responsibility onto NodeVisitor implementations because it is much more flexible. As a result, all Nodes have the same simple implementation for their "accept" method, but do not inherit it.

Every visit method in this interface returns an Object. The definition of that returned Object is left up to the specific implementation of the NodeVisitor. Most NodeVisitors can simply return null, but those that are modifying a parse tree or are using one to create another can use the returned Object to pass around newly created Nodes.

Version:
30 , 5/31/01
Author:
Brian S O'Neill
See Also:
Node.accept(NodeVisitor)

Method Summary
 java.lang.Object visit(AndExpression node)
           
 java.lang.Object visit(ArithmeticExpression node)
           
 java.lang.Object visit(ArrayLookup node)
           
 java.lang.Object visit(AssignmentStatement node)
           
 java.lang.Object visit(Block node)
           
 java.lang.Object visit(BooleanLiteral node)
           
 java.lang.Object visit(BreakStatement node)
           
 java.lang.Object visit(ConcatenateExpression node)
           
 java.lang.Object visit(ExceptionGuardStatement node)
           
 java.lang.Object visit(Expression node)
           
 java.lang.Object visit(ExpressionList node)
           
 java.lang.Object visit(ExpressionStatement node)
           
 java.lang.Object visit(ForeachStatement node)
           
 java.lang.Object visit(FunctionCallExpression node)
           
 java.lang.Object visit(IfStatement node)
           
 java.lang.Object visit(Lookup node)
           
 java.lang.Object visit(Name node)
           
 java.lang.Object visit(NegateExpression node)
           
 java.lang.Object visit(NewArrayExpression node)
           
 java.lang.Object visit(NotExpression node)
           
 java.lang.Object visit(NullLiteral node)
           
 java.lang.Object visit(NumberLiteral node)
           
 java.lang.Object visit(OrExpression node)
           
 java.lang.Object visit(ParenExpression node)
           
 java.lang.Object visit(RelationalExpression node)
           
 java.lang.Object visit(ReturnStatement node)
           
 java.lang.Object visit(Statement node)
           
 java.lang.Object visit(StatementList node)
           
 java.lang.Object visit(StringLiteral node)
           
 java.lang.Object visit(SubstitutionStatement node)
           
 java.lang.Object visit(Template node)
           
 java.lang.Object visit(TemplateCallExpression node)
           
 java.lang.Object visit(TypeName node)
           
 java.lang.Object visit(Variable node)
           
 java.lang.Object visit(VariableRef node)
           
 

Method Detail

visit

public java.lang.Object visit(Template node)

visit

public java.lang.Object visit(Name node)

visit

public java.lang.Object visit(TypeName node)

visit

public java.lang.Object visit(Variable node)

visit

public java.lang.Object visit(ExpressionList node)

visit

public java.lang.Object visit(Statement node)

visit

public java.lang.Object visit(StatementList node)

visit

public java.lang.Object visit(Block node)

visit

public java.lang.Object visit(AssignmentStatement node)

visit

public java.lang.Object visit(ForeachStatement node)

visit

public java.lang.Object visit(IfStatement node)

visit

public java.lang.Object visit(SubstitutionStatement node)

visit

public java.lang.Object visit(ExpressionStatement node)

visit

public java.lang.Object visit(ReturnStatement node)

visit

public java.lang.Object visit(ExceptionGuardStatement node)

visit

public java.lang.Object visit(BreakStatement node)

visit

public java.lang.Object visit(Expression node)

visit

public java.lang.Object visit(ParenExpression node)

visit

public java.lang.Object visit(NewArrayExpression node)

visit

public java.lang.Object visit(FunctionCallExpression node)

visit

public java.lang.Object visit(TemplateCallExpression node)

visit

public java.lang.Object visit(VariableRef node)

visit

public java.lang.Object visit(Lookup node)

visit

public java.lang.Object visit(ArrayLookup node)

visit

public java.lang.Object visit(NegateExpression node)

visit

public java.lang.Object visit(NotExpression node)

visit

public java.lang.Object visit(ConcatenateExpression node)

visit

public java.lang.Object visit(ArithmeticExpression node)

visit

public java.lang.Object visit(RelationalExpression node)

visit

public java.lang.Object visit(AndExpression node)

visit

public java.lang.Object visit(OrExpression node)

visit

public java.lang.Object visit(NullLiteral node)

visit

public java.lang.Object visit(BooleanLiteral node)

visit

public java.lang.Object visit(StringLiteral node)

visit

public java.lang.Object visit(NumberLiteral node)