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.NestedLocation
allowXPath30Syntax, allowXPath31Syntax, catchDepth, charChecker, codeInjector, env, EXTENDED_ITEM_TYPE, language, languageVersion, qNameParser, rangeVariables, scanOnly, SEQUENCE_TYPE, t, XPATH, XQUERY, XSLT_PATTERN
Constructor and Description |
---|
XPathParserPE() |
Modifier and Type | Method and Description |
---|---|
protected Expression |
createDynamicCurriedFunction(Expression functionItem,
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,
Stack<XPathParserPE.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.
|
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) |
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(List<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,
List<Annotation> annotations) |
protected Expression |
parseNamedFunctionReference()
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 |
parseNamedFunctionReference(XPathParser p)
Parse a literal function item (function#arity).
|
atStartOfRelativePath, checkHofFeature, checkLanguageVersion30, checkLanguageVersion31, currentTokenDisplay, customizeTokenizer, declareRangeVariable, disallowedAtStartOfRelativePath, expect, generateApplyCall, getCodeInjector, getLanguage, getMissingFunctionExplanation, getQNameParser, getRangeVariables, getStaticContext, getTokenizer, grumble, grumble, grumble, grumble, isAllowAbsentExpression, isAllowXPath31Syntax, isKeyword, isNamespaceTestAllowed, isReservedFunctionName30, isReservedFunctionName31, isReservedInQuery, makeLocalNameTest, makeLocation, makeNameCode, makeNamespaceTest, makeNameTest, makeNestedLocation, makeNodeName, makeStringLiteral, makeStructuredQName, makeStructuredQNameSilently, makeTracer, nextToken, normalizeEQName, parse, parseAnnotationsList, parseArrayCurlyConstructor, parseArrayItemType, parseArraySquareConstructor, parseArrowPostfix, parseBasicStep, parseBinaryExpression, parseConstructor, parseDynamicFunctionCall, parseExpression, parseExprSingle, parseExtendedItemType, parseExtendedSequenceType, parseExtensionExpression, parseFLWORExpression, parseFunctionCall, parseItemType, parseLookup, parseMapExpression, parseMapItemType, parseNodeTest, parseNumericLiteral, parseParenthesizedExpression, parsePathExpression, parsePredicate, parseRelativePath, parseRemainingPath, parseSequenceType, parseSequenceType, parseSimpleMappingExpression, parseStepExpression, parseStringLiteral, parseStringTemplate, parseSwitchExpression, parseTryCatchExpression, parseTypeswitchExpression, parseValidateExpression, parseVariableReference, reportMissingFunction, resolveFunctionName, setAllowAbsentExpression, setCatchDepth, setCodeInjector, setLanguage, setLocation, setLocation, setLocation, setQNameParser, setRangeVariables, setRangeVariableStack, setScanOnly, testPermittedAxis, undeclareRangeVariable, unescape, warning, whyDisallowedType
protected Expression parseNamedFunctionReference() throws XPathException
parseNamedFunctionReference
in class XPathParser
XPathException
- if a static error is encounteredpublic static Expression parseNamedFunctionReference(XPathParser p) throws XPathException
p
- the parserXPathException
- in the event of a syntax errorpublic ItemType parseFunctionItemType() throws XPathException
parseFunctionItemType
in class XPathParser
XPathException
- if a static error occurs (including the case
where XPath 3.0 syntax is not enabled)public static ItemType parseFunctionItemType(XPathParser p) throws XPathException
XPathException
public Expression parseFunctionArgument() throws XPathException
parseFunctionArgument
in class XPathParser
XPathException
- if the argument expression does not parse correctlyprotected Expression parseInlineFunction(List<Annotation> annotations) throws XPathException
parseInlineFunction
in class XPathParser
annotations
- XPathException
- if a syntax error is foundpublic static Expression parseInlineFunction(XPathParser p, Stack<XPathParserPE.InlineFunctionDetails> inlineFunctionStack, List<Annotation> annotations) throws XPathException
XPathException
protected Expression makeCurriedFunction(int offset, StructuredQName name, Expression[] args, IntSet placeMarkers) throws XPathException
makeCurriedFunction
in class XPathParser
offset
- 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
public static Expression makeCurriedFunction(XPathParser parser, StaticContext env, int offset, StructuredQName name, Expression[] args, IntSet placeMarkers) throws XPathException
XPathException
public 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 LocalBinding findRangeVariable(StructuredQName qName)
findRangeVariable
in class XPathParser
qName
- identifies the name of the range variablepublic static LocalBinding findOuterRangeVariable(StructuredQName qName, Stack<XPathParserPE.InlineFunctionDetails> inlineFunctionStack, StaticContext env)
qName
- the name of the variableinlineFunctionStack
- the stack of inline functions that we are withinenv
- the static contextprotected Expression createDynamicCurriedFunction(Expression functionItem, ArrayList<Expression> args, IntSet placeMarkers)
createDynamicCurriedFunction
in class XPathParser
Copyright (c) 2004-2017 Saxonica Limited. All rights reserved.