public class XPathParserPE extends XPathParser
This contains code duplicated with the XQuery3.0 parser. This is handled by putting the common code into static methods of this class, which are invoked from both the EnterpriseXPathParser and the EnterpriseXQueryParser.
| Modifier and Type | Class and Description |
|---|---|
static class |
XPathParserPE.InlineFunctionDetails |
static class |
XPathParserPE.TemporaryXSLTVariableBinding |
XPathParser.TemporaryContainerallowXPath30Syntax, catchDepth, charChecker, codeInjector, defaultContainer, env, language, rangeVariables, scanOnly, SEQUENCE_TYPE, t, XPATH, XQUERY, XSLT_PATTERN| Constructor and Description |
|---|
XPathParserPE() |
| Modifier and Type | Method and Description |
|---|---|
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,
Stack<XPathParserPE.InlineFunctionDetails> inlineFunctionStack,
StaticContext env) |
protected LocalBinding |
findRangeVariable(StructuredQName qName)
Locate a range variable with a given name.
|
protected Expression |
makeCurriedFunction(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 |
makeCurriedFunction(XPathParser parser,
StaticContext env,
int offset,
StructuredQName name,
Expression[] args,
IntSet placeMarkers) |
protected Expression |
parseDynamicFunctionCall(Expression functionItem)
Parse a dynamic function call
|
static Expression |
parseDynamicFunctionCall(Expression functionItem,
XPathParser p) |
Expression |
parseFunctionArgument()
Parse a function argument.
|
ItemType |
parseFunctionItemType()
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
|
static ItemType |
parseFunctionItemType(XPathParser p) |
protected Expression |
parseInlineFunction(Map<StructuredQName,Annotation> annotations)
Parse an inline function
"function" "(" ParamList? ")" ("as" SequenceType)? EnclosedExpr
On entry, "function (" has already been read
|
static Expression |
parseInlineFunction(XPathParser p,
Stack<XPathParserPE.InlineFunctionDetails> inlineFunctionStack,
Map<StructuredQName,Annotation> annotations) |
protected Expression |
parseLiteralFunctionItem()
Parse a literal function item (introduced in XQuery 3.0 and XPath 3.0)
Syntax: QName # integer
The QName and # have already been read
|
static Expression |
parseLiteralFunctionItem(XPathParser p)
Parse a literal function item (function#arity).
|
protected Expression |
parseMapExpression()
Parse a map expression.
|
protected static Expression |
parseMapExpression(XPathParser parser) |
ItemType |
parseMapItemType()
Parse the item type used for maps (XSLT extension to XPath 3.0)
Syntax:
map '(' '*' ') |
map '(' ItemType ',' SeqType ')' 'as' SeqType
The "map(" has already been read
|
static ItemType |
parseMapItemType(XPathParser p) |
atStartOfRelativePath, currentTokenDisplay, customizeTokenizer, declareRangeVariable, disallowedAtStartOfRelativePath, expect, getCodeInjector, getDefaultContainer, getLanguage, getMissingFunctionExplanation, getRangeVariables, getStaticContext, getTokenizer, grumble, grumble, grumble, grumble, isKeyword, isNamespaceTestAllowed, isReservedInQuery, makeLocalNameTest, makeNameCode, makeNamespaceTest, makeNameTest, makeNodeName, makeStringLiteral, makeStructuredQName, makeStructuredQNameSilently, makeTracer, nextToken, normalizeEQName, parse, parseAnnotations, parseBasicStep, parseBinaryExpression, parseConstructor, parseExpression, parseExprSingle, parseExtensionExpression, parseFLWORExpression, parseFunctionCall, parseItemType, parseNodeTest, parseNumericLiteral, parsePathExpression, parsePredicate, parseRelativePath, parseRemainingPath, parseSequenceType, parseSequenceType, parseSimpleMappingExpression, parseStepExpression, parseStringLiteral, parseSwitchExpression, parseTryCatchExpression, parseTypeswitchExpression, parseValidateExpression, parseVariableReference, reportMissingFunction, resolveFunctionName, setCodeInjector, setDefaultContainer, setLanguage, setLocation, setLocation, setLocation, setRangeVariables, setRangeVariableStack, setScanOnly, testPermittedAxis, undeclareRangeVariable, warningprotected Expression parseLiteralFunctionItem() throws XPathException
parseLiteralFunctionItem in class XPathParserXPathException - if a static error is encounteredpublic static Expression parseLiteralFunctionItem(XPathParser p) throws XPathException
p - the parserXPathException - in the event of a syntax errorpublic ItemType parseFunctionItemType() throws XPathException
parseFunctionItemType in class XPathParserXPathException - if a static error occurs (including the case
where XPath 3.0 syntax is not enabled)public static ItemType parseFunctionItemType(XPathParser p) throws XPathException
XPathExceptionpublic Expression parseFunctionArgument() throws XPathException
parseFunctionArgument in class XPathParserXPathException - if the argument expression does not parse correctlypublic ItemType parseMapItemType() throws XPathException
parseMapItemType in class XPathParserXPathException - if a parsing error occurs or if the map syntax
is not availablepublic static ItemType parseMapItemType(XPathParser p) throws XPathException
XPathExceptionprotected Expression parseDynamicFunctionCall(Expression functionItem) throws XPathException
parseDynamicFunctionCall in class XPathParserfunctionItem - the expression that determines the function to be calledXPathException - if a static error is foundpublic static Expression parseDynamicFunctionCall(Expression functionItem, XPathParser p) throws XPathException
XPathExceptionprotected Expression parseInlineFunction(Map<StructuredQName,Annotation> annotations) throws XPathException
parseInlineFunction in class XPathParserannotations - the function annotations, which have already been read, or null if there are noneXPathException - if a syntax error is foundpublic static Expression parseInlineFunction(XPathParser p, Stack<XPathParserPE.InlineFunctionDetails> inlineFunctionStack, Map<StructuredQName,Annotation> annotations) throws XPathException
XPathExceptionprotected Expression makeCurriedFunction(int offset, StructuredQName name, Expression[] args, IntSet placeMarkers) throws XPathException
makeCurriedFunction in class XPathParseroffset - 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 functionXPathExceptionpublic static Expression makeCurriedFunction(XPathParser parser, StaticContext env, int offset, StructuredQName name, Expression[] args, IntSet placeMarkers) throws XPathException
XPathExceptionpublic 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 placemarkersprotected Expression parseMapExpression() throws XPathException
parseMapExpression in class XPathParserXPathExceptionprotected static Expression parseMapExpression(XPathParser parser) throws XPathException
XPathExceptionprotected LocalBinding findRangeVariable(StructuredQName qName)
findRangeVariable in class XPathParserqName - identifies the name of the range variablepublic static LocalBinding findOuterRangeVariable(StructuredQName qName, Stack<XPathParserPE.InlineFunctionDetails> inlineFunctionStack, StaticContext env)
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.