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 |
---|---|
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 |
parseArrowPostfix(Expression lhs)
Parse an XPath 3.1 arrow operator ("=>")
|
static Expression |
parseArrowPostfix(Expression lhs,
XPathParser p) |
protected Expression |
parseDynamicFunctionCall(Expression functionItem)
Parse a dynamic function call
|
static Expression |
parseDynamicFunctionCall(Expression functionItem,
Expression prefixArgument,
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 |
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, checkAnnotations, checkLanguageVersion30, checkLanguageVersion31, currentTokenDisplay, customizeTokenizer, declareRangeVariable, disallowedAtStartOfRelativePath, expect, getCodeInjector, getLanguage, getMissingFunctionExplanation, getQNameParser, getRangeVariables, getStaticContext, getTokenizer, grumble, grumble, grumble, grumble, isAllowAbsentExpression, isAllowXPath31Syntax, isKeyword, isNamespaceTestAllowed, isReservedFunctionName30, isReservedFunctionName31, isReservedInQuery, makeLocalNameTest, makeLocation, makeNameCode, makeNamespaceTest, makeNameTest, makeNodeName, makeStringLiteral, makeStructuredQName, makeStructuredQNameSilently, makeTracer, nextToken, normalizeEQName, parse, parseAnnotations, parseAnnotationsList, parseArrayCurlyConstructor, parseArrayItemType, parseArraySquareConstructor, parseBasicStep, parseBinaryExpression, parseConstructor, 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 parseArrowPostfix(Expression lhs) throws XPathException
parseArrowPostfix
in class XPathParser
XPathException
public static Expression parseArrowPostfix(Expression lhs, XPathParser p) throws XPathException
XPathException
protected Expression parseDynamicFunctionCall(Expression functionItem) throws XPathException
parseDynamicFunctionCall
in class XPathParser
functionItem
- the expression that determines the function to be calledXPathException
- if a static error is foundpublic static Expression parseDynamicFunctionCall(Expression functionItem, Expression prefixArgument, XPathParser p) throws XPathException
XPathException
protected Expression parseInlineFunction(Map<StructuredQName,Annotation> annotations) throws XPathException
parseInlineFunction
in class XPathParser
annotations
- 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
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)
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.