gnu.expr

Class ExpWalker

public class ExpWalker extends Object implements SourceLocator

Class for doing a tree-walk over an Expression tree.
Field Summary
protected LambdaExpcurrentLambda
protected SourceMessagesmessages
Method Summary
voiderror(char kind, String message)
intgetColumnNumber()
CompilationgetCompilation()
Get the Compilation associated with this walker.
LambdaExpgetCurrentLambda()
StringgetFileName()
intgetLineNumber()
SourceMessagesgetMessages()
StringgetPublicId()
StringgetSystemId()
booleanisStableSourceLocation()
Normally same as getSystemId.
ExpressionnoteError(String message)
voidsetColumn(int column)
voidsetContext(Compilation comp)
voidsetFile(String filename)
voidsetLine(int line)
voidsetLine(String filename, int line, int column)
Expressionwalk(Expression exp)
Call the walk method of argument Expression.
protected ExpressionwalkApplyExp(ApplyExp exp)
protected ExpressionwalkBeginExp(BeginExp exp)
protected ExpressionwalkBlockExp(BlockExp exp)
protected ExpressionwalkClassExp(ClassExp exp)
protected voidwalkDeclarationType(Declaration decl)
protected voidwalkDeclarationTypes(ScopeExp exp)
voidwalkDefaultArgs(LambdaExp exp)
protected ExpressionwalkExitExp(ExitExp exp)
protected ExpressionwalkExpression(Expression exp)
Expression[]walkExps(Expression[] exps)
Expression[]walkExps(Expression[] exps, int n)
Call walk on the Expressions in an array.
protected ExpressionwalkFluidLetExp(FluidLetExp exp)
protected ExpressionwalkIfExp(IfExp exp)
protected ExpressionwalkLambdaExp(LambdaExp exp)
protected ExpressionwalkLangExp(LangExp exp)
protected ExpressionwalkLetExp(LetExp exp)
protected ExpressionwalkModuleExp(ModuleExp exp)
protected ExpressionwalkObjectExp(ObjectExp exp)
protected ExpressionwalkQuoteExp(QuoteExp exp)
protected ExpressionwalkReferenceExp(ReferenceExp exp)
protected ExpressionwalkScopeExp(ScopeExp exp)
protected ExpressionwalkSetExp(SetExp exp)
protected ExpressionwalkSynchronizedExp(SynchronizedExp exp)
protected ExpressionwalkThisExp(ThisExp exp)
protected ExpressionwalkTryExp(TryExp exp)

Field Detail

currentLambda

protected LambdaExp currentLambda

messages

protected SourceMessages messages

Method Detail

error

public void error(char kind, String message)

getColumnNumber

public final int getColumnNumber()

getCompilation

public Compilation getCompilation()
Get the Compilation associated with this walker.

getCurrentLambda

public final LambdaExp getCurrentLambda()

getFileName

public final String getFileName()

getLineNumber

public final int getLineNumber()

getMessages

public SourceMessages getMessages()

getPublicId

public String getPublicId()

getSystemId

public String getSystemId()

isStableSourceLocation

public boolean isStableSourceLocation()
Normally same as getSystemId.

noteError

public Expression noteError(String message)

setColumn

public void setColumn(int column)

setContext

public void setContext(Compilation comp)

setFile

public void setFile(String filename)

setLine

public void setLine(int line)

setLine

public void setLine(String filename, int line, int column)

walk

public Expression walk(Expression exp)
Call the walk method of argument Expression. Could call Expression's walk directly, but this allows us to interpose a method call on each Expression. We use it to note the Expression's line number. Should not need to be overridden; if you do, you may also want to override walkExps.

walkApplyExp

protected Expression walkApplyExp(ApplyExp exp)

walkBeginExp

protected Expression walkBeginExp(BeginExp exp)

walkBlockExp

protected Expression walkBlockExp(BlockExp exp)

walkClassExp

protected Expression walkClassExp(ClassExp exp)

walkDeclarationType

protected final void walkDeclarationType(Declaration decl)

walkDeclarationTypes

protected final void walkDeclarationTypes(ScopeExp exp)

walkDefaultArgs

public void walkDefaultArgs(LambdaExp exp)

walkExitExp

protected Expression walkExitExp(ExitExp exp)

walkExpression

protected Expression walkExpression(Expression exp)

walkExps

public Expression[] walkExps(Expression[] exps)

walkExps

public Expression[] walkExps(Expression[] exps, int n)
Call walk on the Expressions in an array. However, the walk method is inlined for speed.

walkFluidLetExp

protected Expression walkFluidLetExp(FluidLetExp exp)

walkIfExp

protected Expression walkIfExp(IfExp exp)

walkLambdaExp

protected Expression walkLambdaExp(LambdaExp exp)

walkLangExp

protected Expression walkLangExp(LangExp exp)

walkLetExp

protected Expression walkLetExp(LetExp exp)

walkModuleExp

protected Expression walkModuleExp(ModuleExp exp)

walkObjectExp

protected Expression walkObjectExp(ObjectExp exp)

walkQuoteExp

protected Expression walkQuoteExp(QuoteExp exp)

walkReferenceExp

protected Expression walkReferenceExp(ReferenceExp exp)

walkScopeExp

protected Expression walkScopeExp(ScopeExp exp)

walkSetExp

protected Expression walkSetExp(SetExp exp)

walkSynchronizedExp

protected Expression walkSynchronizedExp(SynchronizedExp exp)

walkThisExp

protected Expression walkThisExp(ThisExp exp)

walkTryExp

protected Expression walkTryExp(TryExp exp)