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 LambdaExpprotected ObjectIf exitValue is set to non-null, the visit stops.protected SourceMessages -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RdefaultValue(Expression r, D d) voidfinal intReturn current column number.Get the Compilation associated with this visitor.final LambdaExpfinal intColumn (one-origin) of end of range; unknown/unspecified is -1.final intLine number (one-origin) of end of range; unknown/unspecified is -1.final StringNormally same as getSystemId.final intReturn current line number.final intColumn (one-origin) of start of range; unknown/unspecified is -1.final intLine number (one-origin) of start of range; unknown/unspecified is -1.booleanNormally same as getSystemId.voidsetColumn(int column) voidsetContext(Compilation comp) voidvoidsetLine(int line) voidprotected Expressionupdate(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 RvisitApplyExp(ApplyExp exp, D d) protected RvisitBeginExp(BeginExp exp, D d) protected RvisitBlockExp(BlockExp exp, D d) protected RvisitCaseExp(CaseExp exp, D d) protected RvisitClassExp(ClassExp exp, D d) protected voidprotected final voidvoidvisitDefaultArgs(LambdaExp exp, D d) protected RvisitExitExp(ExitExp exp, D d) protected RvisitExpression(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 RvisitFluidLetExp(FluidLetExp exp, D d) protected RvisitIfExp(IfExp exp, D d) protected RvisitLambdaExp(LambdaExp exp, D d) protected RvisitLangExp(LangExp exp, D d) protected RvisitLetExp(LetExp exp, D d) protected RvisitModuleExp(ModuleExp exp, D d) protected RvisitObjectExp(ObjectExp exp, D d) protected RvisitQuoteExp(QuoteExp exp, D d) protected RvisitReferenceExp(ReferenceExp exp, D d) protected RvisitScopeExp(ScopeExp exp, D d) protected RvisitSetExp(SetExp exp, D d) protected RvisitSynchronizedExp(SynchronizedExp exp, D d) protected RvisitThisExp(ThisExp exp, D d) protected RvisitTryExp(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:SourceLocatorNormally same as getSystemId.- Specified by:
getFileNamein interfaceSourceLocator
-
getLineNumber
public final int getLineNumber()Description copied from interface:SourceLocatorReturn current line number. Normally the same asgetStartLine(). The "first" line is line 1; unknown is -1.- Specified by:
getLineNumberin interfaceLocator- Specified by:
getLineNumberin interfaceSourceLocator- Specified by:
getLineNumberin interfaceSourceLocator
-
getColumnNumber
public final int getColumnNumber()Description copied from interface:SourceLocatorReturn current column number. Normally the same asgetStartColumn(). The "first" column is column 1; unknown is -1.- Specified by:
getColumnNumberin interfaceLocator- Specified by:
getColumnNumberin interfaceSourceLocator- Specified by:
getColumnNumberin interfaceSourceLocator
-
getStartLine
public final int getStartLine()Description copied from interface:SourceLocatorLine number (one-origin) of start of range; unknown/unspecified is -1.- Specified by:
getStartLinein interfaceSourceLocator
-
getStartColumn
public final int getStartColumn()Description copied from interface:SourceLocatorColumn (one-origin) of start of range; unknown/unspecified is -1.- Specified by:
getStartColumnin interfaceSourceLocator
-
getEndLine
public final int getEndLine()Description copied from interface:SourceLocatorLine number (one-origin) of end of range; unknown/unspecified is -1.- Specified by:
getEndLinein interfaceSourceLocator
-
getEndColumn
public final int getEndColumn()Description copied from interface:SourceLocatorColumn (one-origin) of end of range; unknown/unspecified is -1.- Specified by:
getEndColumnin interfaceSourceLocator
-
getPublicId
- Specified by:
getPublicIdin interfaceLocator- Specified by:
getPublicIdin interfaceSourceLocator- Specified by:
getPublicIdin interfaceSourceLocator
-
getSystemId
- Specified by:
getSystemIdin interfaceLocator- Specified by:
getSystemIdin interfaceSourceLocator- Specified by:
getSystemIdin interfaceSourceLocator
-
isStableSourceLocation
public boolean isStableSourceLocation()Normally same as getSystemId.- Specified by:
isStableSourceLocationin interfaceSourceLocator
-
setFile
-
setLine
public void setLine(int line) -
setColumn
public void setColumn(int column) -
setLine
-