Package net.sf.saxon.expr.parser
Class ExpressionVisitor
java.lang.Object
net.sf.saxon.expr.parser.ExpressionVisitor
The ExpressionVisitor supports the various phases of processing of an expression tree which require
a recursive walk of the tree structure visiting each node in turn. In maintains a stack holding the
ancestor nodes of the node currently being visited.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Decrement depthGet the ConfigurationGet the static context for the expressions being visited.Get the target environment for which we are optimizingboolean
Increment and test depthboolean
boolean
Ask whether the visitor is to optimize expressions for evaluation as an XSLT match patternboolean
Ask whether the visitor is to optimize expressions for evaluation in a streaming environmentvoid
issueWarning
(String message, String errorCode, Location locator) Issue a warning messageboolean
Ask if warnings have been suppressed.static ExpressionVisitor
make
(StaticContext env) Factory method: make an expression visitorCreate a dynamic context suitable for early evaluation of constant subexpressionsObtain an optimizer.void
setInliningFunctions
(boolean inliningFunctions) void
setOptimizeForPatternMatching
(boolean option) Tell the visitor to optimize expressions for evaluation as an XSLT match patternvoid
setOptimizeForStreaming
(boolean option) Tell the visitor to optimize expressions for evaluation in a streaming environmentvoid
setStaticContext
(StaticContext staticContext) Set the static context for the expressions being visited.void
setSuppressWarnings
(boolean suppressWarnings) Say whether warnings should be suppressed.
-
Constructor Details
-
ExpressionVisitor
Create an ExpressionVisitor- Parameters:
config
- the Saxon configuration
-
-
Method Details
-
getConfiguration
Get the Configuration- Returns:
- the configuration
-
getStaticContext
Get the static context for the expressions being visited. Note: this may not reflect all changes in static context (e.g. namespace context, base URI) applying to nested expressions- Returns:
- the static context
-
setStaticContext
Set the static context for the expressions being visited. Note: this may not reflect all changes in static context (e.g. namespace context, base URI) applying to nested expressions- Parameters:
staticContext
- the static context
-
make
Factory method: make an expression visitor- Parameters:
env
- the static context- Returns:
- the new expression visitor
-
issueWarning
Issue a warning message- Parameters:
message
- the messageerrorCode
- the error code associated with the messagelocator
- the query/stylesheet location associated with the message
-
makeDynamicContext
Create a dynamic context suitable for early evaluation of constant subexpressions- Returns:
- a dynamic evaluation context
-
obtainOptimizer
Obtain an optimizer. The optimizer is created on the first call of this method and is retained for use in subsequent calls.- Returns:
- a suitable optimizer, taking into account the optimization options defined by the Configuration and by the static context
-
setOptimizeForStreaming
public void setOptimizeForStreaming(boolean option) Tell the visitor to optimize expressions for evaluation in a streaming environment- Parameters:
option
- true if optimizing for streaming
-
isOptimizeForStreaming
public boolean isOptimizeForStreaming()Ask whether the visitor is to optimize expressions for evaluation in a streaming environment- Returns:
- true if optimizing for streaming
-
setOptimizeForPatternMatching
public void setOptimizeForPatternMatching(boolean option) Tell the visitor to optimize expressions for evaluation as an XSLT match pattern- Parameters:
option
- true if optimizing for pattern matching
-
isOptimizeForPatternMatching
public boolean isOptimizeForPatternMatching()Ask whether the visitor is to optimize expressions for evaluation as an XSLT match pattern- Returns:
- true if optimizing for pattern matching
-
getTargetEdition
Get the target environment for which we are optimizing- Returns:
- the target environment (for example "EE" or "JS"). Defaults to the edition of the current configuration
-
incrementAndTestDepth
public boolean incrementAndTestDepth()Increment and test depth- Returns:
- true if the current depth is less than a maximum limit; and increment the current depth
-
decrementDepth
public void decrementDepth()Decrement depth -
isSuppressWarnings
public boolean isSuppressWarnings()Ask if warnings have been suppressed. This typically happens when processing code that has been copied, to prevent multiple warnings for the same code- Returns:
- true if warnings are suppressed
-
setSuppressWarnings
public void setSuppressWarnings(boolean suppressWarnings) Say whether warnings should be suppressed. This is typically done when processing code that has been copied, to prevent multiple warnings for the same code- Parameters:
suppressWarnings
- set to true to suppress warnings
-
isInliningFunctions
public boolean isInliningFunctions() -
setInliningFunctions
public void setInliningFunctions(boolean inliningFunctions)
-