org.teatrove.tea.parsetree
Class TreeMutator
java.lang.Object
org.teatrove.tea.parsetree.TreeMutator
- All Implemented Interfaces:
- NodeVisitor
public abstract class TreeMutator
- extends Object
- implements NodeVisitor
TreeMutator is similar to TreeWalker in that it
traverses a parse tree in canonocal order, and only a few visit methods
should be overridden. The key difference is that visit methods must
return a node of the same type as the one passed in. By returning a node
which isn't the same as the one passed in, a node can be replaced.
- Author:
- Brian S O'Neill
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TreeMutator
public TreeMutator()
visit
public Object visit(Template node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(Name node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(TypeName node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(Variable node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ExpressionList node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(Statement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ImportDirective node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(StatementList node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(Block node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(AssignmentStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(BreakStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ContinueStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ForeachStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(IfStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(SubstitutionStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ExpressionStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ReturnStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ExceptionGuardStatement node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(Expression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ParenExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(NewArrayExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(FunctionCallExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(TemplateCallExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(VariableRef node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(Lookup node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ArrayLookup node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(NegateExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(NotExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ConcatenateExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(ArithmeticExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(RelationalExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(AndExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(OrExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(TernaryExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(CompareExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(NoOpExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(SpreadExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(TypeExpression node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(NullLiteral node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(BooleanLiteral node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(StringLiteral node)
- Specified by:
visit in interface NodeVisitor
visit
public Object visit(NumberLiteral node)
- Specified by:
visit in interface NodeVisitor
visitExpression
protected Expression visitExpression(Expression expr)
- All expressions pass through this method to ensure the expression's
type is preserved.
visitBlock
protected Block visitBlock(Block block)
- Visit a Block to ensure that new Statement is a Block.
Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.