Package net.sf.saxon.expr.parser
Class ParserExtension
- java.lang.Object
-
- net.sf.saxon.expr.parser.ParserExtension
-
- Direct Known Subclasses:
SaxonSyntaxExtension
public class ParserExtension extends java.lang.ObjectDummy Parser extension for syntax in XPath that is accepted only in particular product variants. Originally, this meant XPath 3.0 syntax associated with higher-order functions. It now covers Saxon syntax extensions and XQuery Update.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParserExtension.TemporaryXSLTVariableBinding
-
Constructor Summary
Constructors Constructor Description ParserExtension()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressionbindNumericParameterReference(XPathParser p)ExpressioncreateDynamicCurriedFunction(XPathParser p, Expression functionItem, java.util.ArrayList<Expression> args, IntSet placeMarkers)static ExpressioncurryFunction(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)voidhandleExternalFunctionDeclaration(XQueryParser p, XQueryFunction func)ExpressionmakeCurriedFunction(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)ExpressionparseDotFunction(XPathParser p)protected ExpressionparseExtendedExprSingle(XPathParser p)ItemTypeparseExtendedItemType(XPathParser p)Parse an ItemType within a SequenceTypeprotected ExpressionparseForMemberExpression(XPathParser p)Parse a for-member expression (Saxon extension): for member $x in expr return exprItemTypeparseFunctionItemType(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 readExpressionparseNamedFunctionReference(XPathParser p)Parse a literal function item (function#arity).voidparseRevalidationDeclaration(XQueryParser p)Parse the "declare revalidation" declaration.voidparseTypeAliasDeclaration(XQueryParser p)Parse a type alias declaration.ExpressionparseTypePattern(XPathParser p)Parse an extended XSLT pattern in the form ~itemType (predicate)*ExpressionparseUnderscoreFunction(XPathParser p)voidparseUpdatingFunctionDeclaration(XQueryParser p)Parse an updating function declaration (allowed in XQuery Update only)
-
-
-
Method Detail
-
parseNamedFunctionReference
public Expression parseNamedFunctionReference(XPathParser p) throws XPathException
Parse a literal function item (function#arity). On entry, the function name and the '#' token have already been read- Parameters:
p- the parser- Returns:
- an expression representing the function value
- Throws:
XPathException- in the event of a syntax error
-
parseFunctionItemType
public ItemType parseFunctionItemType(XPathParser p, AnnotationList annotations) throws XPathException
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- Parameters:
p- the XPath parserannotations- the list of annotation assertions for this function item type- Returns:
- the ItemType after parsing
- Throws:
XPathException- if a static error is found
-
parseExtendedItemType
public ItemType parseExtendedItemType(XPathParser p) throws XPathException
Parse an ItemType within a SequenceType- Parameters:
p- the XPath parser- Returns:
- the ItemType after parsing
- Throws:
XPathException- if a static error is found
-
parseTypePattern
public Expression parseTypePattern(XPathParser p) throws XPathException
Parse an extended XSLT pattern in the form ~itemType (predicate)*- Parameters:
p- the XPath parser- Returns:
- the equivalent expression in the form .[. instance of type] (predicate)*
- Throws:
XPathException- if a static error is found
-
parseDotFunction
public Expression parseDotFunction(XPathParser p) throws XPathException
- Throws:
XPathException
-
parseUnderscoreFunction
public Expression parseUnderscoreFunction(XPathParser p) throws XPathException
- Throws:
XPathException
-
bindNumericParameterReference
public Expression bindNumericParameterReference(XPathParser p) throws XPathException
- Throws:
XPathException
-
makeCurriedFunction
public Expression makeCurriedFunction(XPathParser parser, int offset, StructuredQName name, Expression[] args, IntSet placeMarkers) throws XPathException
Process a function call in which one or more of the argument positions are represented as "?" placemarkers (indicating partial application or currying)- Parameters:
parser- the XPath parseroffset- 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 function- Returns:
- the curried function
- Throws:
XPathException- if a dynamic error occurs
-
curryFunction
public 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)- Parameters:
functionExp- an expression that returns the function to be curriedargs- the arguments (with EmptySequence in the placemarker positions)placeMarkers- the positions of the placemarkers- Returns:
- the curried function
-
createDynamicCurriedFunction
public Expression createDynamicCurriedFunction(XPathParser p, Expression functionItem, java.util.ArrayList<Expression> args, IntSet placeMarkers)
-
handleExternalFunctionDeclaration
public void handleExternalFunctionDeclaration(XQueryParser p, XQueryFunction func) throws XPathException
- Throws:
XPathException
-
parseTypeAliasDeclaration
public void parseTypeAliasDeclaration(XQueryParser p) throws XPathException
Parse a type alias declaration. Allowed only in Saxon-PE and higher- Parameters:
p- the XPath parser- Throws:
XPathException- if parsing fails
-
parseRevalidationDeclaration
public void parseRevalidationDeclaration(XQueryParser p) throws XPathException
Parse the "declare revalidation" declaration. Syntax: not allowed unless XQuery update is in use- Parameters:
p- the XPath parser- Throws:
XPathException- if the syntax is incorrect, or is not allowed in this XQuery processor
-
parseUpdatingFunctionDeclaration
public void parseUpdatingFunctionDeclaration(XQueryParser p) throws XPathException
Parse an updating function declaration (allowed in XQuery Update only)- Parameters:
p- the XPath parser- Throws:
XPathException- if parsing fails PathMapor if updating functions are not allowed
-
parseExtendedExprSingle
protected Expression parseExtendedExprSingle(XPathParser p) throws XPathException
- Throws:
XPathException
-
parseForMemberExpression
protected Expression parseForMemberExpression(XPathParser p) throws XPathException
Parse a for-member expression (Saxon extension): for member $x in expr return expr- Parameters:
p- the XPath parser- Returns:
- the resulting subexpression
- Throws:
XPathException- if any error is encountered
-
-