public class HofParserExtension extends ParserExtension
| Modifier and Type | Class and Description |
|---|---|
static class |
HofParserExtension.InlineFunctionDetails |
static class |
HofParserExtension.TemporaryXSLTVariableBinding |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Stack<HofParserExtension.InlineFunctionDetails> |
inlineFunctionStack |
| Constructor and Description |
|---|
HofParserExtension() |
| Modifier and Type | Method and Description |
|---|---|
Expression |
createDynamicCurriedFunction(XPathParser p,
Expression functionItem,
java.util.ArrayList<Expression> args,
IntSet placeMarkers) |
static Expression |
curryFunction(Expression functionExp,
Expression[] args,
IntSet placeMarkers)
Process a function expression in which one or more of the argument positions are
represented as "?" placemarkers (indicating partial application or currying)
|
static LocalBinding |
findOuterRangeVariable(StructuredQName qName,
java.util.Stack<HofParserExtension.InlineFunctionDetails> inlineFunctionStack,
StaticContext env)
When a variable reference occurs within an inline function, it might be a reference to a variable declared
outside the inline function (which needs to become part of the closure).
|
LocalBinding |
findOuterRangeVariable(XPathParser p,
StructuredQName qName)
Locate a range variable with a given name.
|
void |
handleExternalFunctionDeclaration(XQueryParser p,
XQueryFunction func) |
Expression |
makeArgumentPlaceMarker(XPathParser p)
Parse a function argument.
|
Expression |
makeCurriedFunction(XPathParser parser,
int offset,
StructuredQName name,
Expression[] args,
IntSet placeMarkers)
Process a function call in which one or more of the argument positions are
represented as "?" placemarkers (indicating partial application or currying)
|
static Expression |
makeInlineFunctionValue(XPathParser p,
AnnotationList annotations,
HofParserExtension.InlineFunctionDetails details,
java.util.List<UserFunctionParameter> params,
SequenceType resultType,
Expression body) |
ItemType |
parseExtendedItemType(XPathParser p)
Parse an ItemType within a SequenceType
|
ItemType |
parseFunctionItemType(XPathParser p,
AnnotationList annotations)
Parse the item type used for function items (XQuery 3.0 higher order functions)
Syntax (changed by WG decision on 2009-09-22):
function '(' '*' ') |
function '(' (SeqType (',' SeqType)*)? ')' 'as' SeqType
For backwards compatibility with Saxon 9.2 we allow the "*" to be omitted for the time being
The "function(" has already been read
|
protected Expression |
parseInlineFunction(XPathParser p,
AnnotationList annotations)
Parse an inline function
"function" "(" ParamList? ")" ("as" SequenceType)? EnclosedExpr
On entry, "function (" has already been read
|
Expression |
parseNamedFunctionReference(XPathParser p)
Parse a literal function item (function#arity).
|
Expression |
parseSimpleInlineFunction(XPathParser p) |
Expression |
parseTildePattern(XPathParser p)
Parse an extended XSLT pattern in the form ~type-alias (predicate)* (but excluding the
predicates)
|
ItemType |
parseUnionType(XPathParser p)
Parse a union type (Saxon 9.8 extension).
|
parseExtendedExprSingle, parseRevalidationDeclaration, parseTypeAliasDeclaration, parseUpdatingFunctionDeclarationprotected java.util.Stack<HofParserExtension.InlineFunctionDetails> inlineFunctionStack
public Expression parseNamedFunctionReference(XPathParser p) throws XPathException
parseNamedFunctionReference in class ParserExtensionp - the parserXPathException - in the event of a syntax errorpublic ItemType parseFunctionItemType(XPathParser p, AnnotationList annotations) throws XPathException
parseFunctionItemType in class ParserExtensionannotations - the list of annotation assertions for this function item typeXPathExceptionpublic ItemType parseExtendedItemType(XPathParser p) throws XPathException
parseExtendedItemType in class ParserExtensionXPathException - if a static error is foundpublic Expression parseTildePattern(XPathParser p) throws XPathException
parseTildePattern in class ParserExtensionXPathExceptionpublic ItemType parseUnionType(XPathParser p) throws XPathException
XPathExceptionpublic Expression makeArgumentPlaceMarker(XPathParser p)
makeArgumentPlaceMarker in class ParserExtensionprotected Expression parseInlineFunction(XPathParser p, AnnotationList annotations) throws XPathException
ParserExtensionparseInlineFunction in class ParserExtensionXPathException - if a syntax error is foundpublic static Expression makeInlineFunctionValue(XPathParser p, AnnotationList annotations, HofParserExtension.InlineFunctionDetails details, java.util.List<UserFunctionParameter> params, SequenceType resultType, Expression body)
public Expression parseSimpleInlineFunction(XPathParser p) throws XPathException
parseSimpleInlineFunction in class ParserExtensionXPathExceptionpublic Expression makeCurriedFunction(XPathParser parser, int offset, StructuredQName name, Expression[] args, IntSet placeMarkers) throws XPathException
makeCurriedFunction in class ParserExtensionoffset - offset in the query source of the start of the expressionname - the function call (as if there were no currying)args - the arguments (with EmptySequence in the placemarker positions)placeMarkers - the positions of the placemarkers @return the curried functionXPathException - if a dynamic error occurspublic static Expression curryFunction(Expression functionExp, Expression[] args, IntSet placeMarkers)
functionExp - an expression that returns the function to be curriedargs - the arguments (with EmptySequence in the placemarker positions)placeMarkers - the positions of the placemarkerspublic LocalBinding findOuterRangeVariable(XPathParser p, StructuredQName qName)
findOuterRangeVariable in class ParserExtensionqName - identifies the name of the range variablepublic static LocalBinding findOuterRangeVariable(StructuredQName qName, java.util.Stack<HofParserExtension.InlineFunctionDetails> inlineFunctionStack, StaticContext env)
qName - the name of the variableinlineFunctionStack - the stack of inline functions that we are withinenv - the static contextpublic Expression createDynamicCurriedFunction(XPathParser p, Expression functionItem, java.util.ArrayList<Expression> args, IntSet placeMarkers)
createDynamicCurriedFunction in class ParserExtensionpublic void handleExternalFunctionDeclaration(XQueryParser p, XQueryFunction func) throws XPathException
handleExternalFunctionDeclaration in class ParserExtensionXPathExceptionCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.