Package gnu.expr
Class ExpVisitor<R,D>
java.lang.Object
gnu.expr.ExpVisitor<R,D>
- All Implemented Interfaces:
SourceLocator
,SourceLocator
,Locator
- Direct Known Subclasses:
ExpExpVisitor
,PushApply
Class for doing a tree-visit over an Expression tree.
-
Nested Class Summary
Nested classes/interfaces inherited from interface gnu.text.SourceLocator
SourceLocator.Simple
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LambdaExp
protected Object
If exitValue is set to non-null, the visit stops.protected SourceMessages
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected R
defaultValue
(Expression r, D d) void
final int
Return current column number.Get the Compilation associated with this visitor.final LambdaExp
final int
Column (one-origin) of end of range; unknown/unspecified is -1.final int
Line number (one-origin) of end of range; unknown/unspecified is -1.final String
Normally same as getSystemId.final int
Return current line number.final int
Column (one-origin) of start of range; unknown/unspecified is -1.final int
Line number (one-origin) of start of range; unknown/unspecified is -1.boolean
Normally same as getSystemId.void
setColumn
(int column) void
setContext
(Compilation comp) void
void
setLine
(int line) void
protected Expression
update
(Expression exp, R r) visit
(Expression exp, D d) Call the visit method of argument Expression.static <R,
D> R visit
(ExpVisitor<R, D> visitor, Expression exp, D d) visitAndUpdate
(Expression exp, D d) protected R
visitApplyExp
(ApplyExp exp, D d) protected R
visitBeginExp
(BeginExp exp, D d) protected R
visitBlockExp
(BlockExp exp, D d) protected R
visitCaseExp
(CaseExp exp, D d) protected R
visitClassExp
(ClassExp exp, D d) protected void
protected final void
void
visitDefaultArgs
(LambdaExp exp, D d) protected R
visitExitExp
(ExitExp exp, D d) protected R
visitExpression
(Expression exp, D d) visitExps
(Expression[] exps, int n, D d) Call visit on the Expressions in an array.visitExps
(Expression[] exps, D d) protected R
visitFluidLetExp
(FluidLetExp exp, D d) protected R
visitIfExp
(IfExp exp, D d) protected R
visitLambdaExp
(LambdaExp exp, D d) protected R
visitLangExp
(LangExp exp, D d) protected R
visitLetExp
(LetExp exp, D d) protected R
visitModuleExp
(ModuleExp exp, D d) protected R
visitObjectExp
(ObjectExp exp, D d) protected R
visitQuoteExp
(QuoteExp exp, D d) protected R
visitReferenceExp
(ReferenceExp exp, D d) protected R
visitScopeExp
(ScopeExp exp, D d) protected R
visitSetExp
(SetExp exp, D d) protected R
visitSynchronizedExp
(SynchronizedExp exp, D d) protected R
visitThisExp
(ThisExp exp, D d) protected R
visitTryExp
(TryExp exp, D d)
-
Field Details
-
messages
-
currentLambda
-
exitValue
If exitValue is set to non-null, the visit stops.
-
-
Constructor Details
-
ExpVisitor
public ExpVisitor()
-
-
Method Details
-
getCompilation
Get the Compilation associated with this visitor. -
getLanguage
-
getMessages
-
defaultValue
-
visitExpression
-
setContext
-
visit
Call the visit method of argument Expression. Could call Expression's visit 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 visitExps. -
visit
-
update
-
visitApplyExp
-
visitIfExp
-
visitCaseExp
-
visitDeclarationType
-
visitDeclarationTypes
-
visitScopeExp
-
visitLetExp
-
visitLambdaExp
-
visitClassExp
-
visitObjectExp
-
visitModuleExp
-
visitSetExp
-
visitTryExp
-
visitBeginExp
-
visitQuoteExp
-
visitReferenceExp
-
visitThisExp
-
visitSynchronizedExp
-
visitBlockExp
-
visitExitExp
-
visitFluidLetExp
-
visitLangExp
-
getExitValue
-
getCurrentLambda
-
visitAndUpdate
-
visitExps
-
visitExps
Call visit on the Expressions in an array. However, the visit method is inlined for speed. -
visitDefaultArgs
-
error
-
noteError
-
getFileName
Description copied from interface:SourceLocator
Normally same as getSystemId.- Specified by:
getFileName
in interfaceSourceLocator
-
getLineNumber
public final int getLineNumber()Description copied from interface:SourceLocator
Return current line number. Normally the same asgetStartLine()
. The "first" line is line 1; unknown is -1.- Specified by:
getLineNumber
in interfaceLocator
- Specified by:
getLineNumber
in interfaceSourceLocator
- Specified by:
getLineNumber
in interfaceSourceLocator
-
getColumnNumber
public final int getColumnNumber()Description copied from interface:SourceLocator
Return current column number. Normally the same asgetStartColumn()
. The "first" column is column 1; unknown is -1.- Specified by:
getColumnNumber
in interfaceLocator
- Specified by:
getColumnNumber
in interfaceSourceLocator
- Specified by:
getColumnNumber
in interfaceSourceLocator
-
getStartLine
public final int getStartLine()Description copied from interface:SourceLocator
Line number (one-origin) of start of range; unknown/unspecified is -1.- Specified by:
getStartLine
in interfaceSourceLocator
-
getStartColumn
public final int getStartColumn()Description copied from interface:SourceLocator
Column (one-origin) of start of range; unknown/unspecified is -1.- Specified by:
getStartColumn
in interfaceSourceLocator
-
getEndLine
public final int getEndLine()Description copied from interface:SourceLocator
Line number (one-origin) of end of range; unknown/unspecified is -1.- Specified by:
getEndLine
in interfaceSourceLocator
-
getEndColumn
public final int getEndColumn()Description copied from interface:SourceLocator
Column (one-origin) of end of range; unknown/unspecified is -1.- Specified by:
getEndColumn
in interfaceSourceLocator
-
getPublicId
- Specified by:
getPublicId
in interfaceLocator
- Specified by:
getPublicId
in interfaceSourceLocator
- Specified by:
getPublicId
in interfaceSourceLocator
-
getSystemId
- Specified by:
getSystemId
in interfaceLocator
- Specified by:
getSystemId
in interfaceSourceLocator
- Specified by:
getSystemId
in interfaceSourceLocator
-
isStableSourceLocation
public boolean isStableSourceLocation()Normally same as getSystemId.- Specified by:
isStableSourceLocation
in interfaceSourceLocator
-
setFile
-
setLine
public void setLine(int line) -
setColumn
public void setColumn(int column) -
setLine
-