Package net.sf.saxon.pattern
Class PatternParser30
java.lang.Object
net.sf.saxon.expr.parser.XPathParser
net.sf.saxon.pattern.PatternParser30
- All Implemented Interfaces:
PatternParser
Parser for XSLT patterns. This is created by overriding selected parts of the standard ExpressionParser.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.saxon.expr.parser.XPathParser
XPathParser.Accelerator, XPathParser.NestedLocation, XPathParser.ParsedLanguage -
Field Summary
FieldsFields inherited from class net.sf.saxon.expr.parser.XPathParser
allowSaxonExtensions, allowXPath30Syntax, allowXPath30XSLTExtensions, allowXPath31Syntax, catchDepth, charChecker, codeInjector, env, language, languageVersion, parserExtension, qNameParser, rangeVariables, scanOnly, t -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCallback to tailor the tokenizermakeTracer(Expression exp, StructuredQName qName) If tracing, wrap an expression in a trace instructionprotected ExpressionparseBasicStep(boolean firstInPattern) Parse a basic step expression (without the predicates)Override the parsing of top-level expressionsParse an argument to a function call.parseFunctionCall(Expression prefixArgument) Parse a function call appearing within a pattern.parsePattern(String pattern, StaticContext env) Parse a string representing an XSLT patternprotected ExpressionParse an expression appearing within a predicate.protected voidtestPermittedAxis(int axis, String errorCode) Methods inherited from class net.sf.saxon.expr.parser.XPathParser
atStartOfRelativePath, checkLanguageVersion30, checkLanguageVersion31, checkMapExtensions, checkSyntaxExtensions, currentTokenDisplay, declareRangeVariable, disallowedAtStartOfRelativePath, expect, findRangeVariable, generateApplyCall, getCodeInjector, getLanguage, getMissingFunctionExplanation, getPlainType, getQNameParser, getRangeVariables, getStaticContext, getTokenizer, grumble, grumble, grumble, grumble, isAllowAbsentExpression, isAllowXPath31Syntax, isKeyword, isNamespaceTestAllowed, isReservedFunctionName30, isReservedFunctionName31, isReservedInQuery, makeCurriedFunction, makeFingerprint, makeLocalNameTest, makeLocation, makeLocation, makeNamespaceTest, makeNameTest, makeNestedLocation, makeNodeName, makeQNameTest, makeStringLiteral, makeStructuredQName, makeStructuredQNameSilently, nextToken, operatorPrecedence, parse, parseAnnotationsList, parseArrayCurlyConstructor, parseArrayItemType, parseArraySquareConstructor, parseArrowPostfix, parseBackTickedStringLiteral, parseBinaryExpression, parseConstructor, parseDynamicFunctionCall, parseExprSingle, parseExtendedItemType, parseExtendedSequenceType, parseExtensionExpression, parseFLWORExpression, parseFunctionItemType, parseInlineFunction, parseItemType, parseLookup, parseMapExpression, parseMapItemType, parseNamedFunctionReference, parseNodeTest, parseNumericLiteral, parseParenthesizedExpression, parsePathExpression, parsePredicate, parseRelativePath, parseRemainingPath, parseSequenceType, parseSequenceType, parseSimpleMappingExpression, parseStepExpression, parseStringConstructor, parseStringLiteral, parseSwitchExpression, parseTryCatchExpression, parseTypeswitchExpression, parseValidateExpression, parseVariableReference, reportMissingFunction, resolveFunctionName, setAccelerator, setAllowAbsentExpression, setCatchDepth, setCodeInjector, setLanguage, setLocation, setLocation, setLocation, setParserExtension, setQNameParser, setRangeVariables, setRangeVariableStack, setScanOnly, undeclareRangeVariable, unescape, warning, whyDisallowedType
-
Field Details
-
inPredicate
int inPredicate
-
-
Constructor Details
-
PatternParser30
public PatternParser30()
-
-
Method Details
-
parsePattern
Parse a string representing an XSLT pattern- Specified by:
parsePatternin interfacePatternParser- Parameters:
pattern- the pattern expressed as a Stringenv- the static context for the pattern- Returns:
- a Pattern object representing the result of parsing
- Throws:
XPathException- if the pattern contains a syntax error
-
customizeTokenizer
Callback to tailor the tokenizer- Overrides:
customizeTokenizerin classXPathParser- Parameters:
t- the Tokenizer to be customized
-
parseExpression
Override the parsing of top-level expressions- Overrides:
parseExpressionin classXPathParser- Returns:
- the parsed expression
- Throws:
XPathException
-
parseBasicStep
Parse a basic step expression (without the predicates)- Overrides:
parseBasicStepin classXPathParser- Parameters:
firstInPattern- true only if we are parsing the first step in a RelativePathPattern in the XSLT Pattern syntax- Returns:
- the resulting subexpression
- Throws:
XPathException- if any error is encountered
-
testPermittedAxis
- Overrides:
testPermittedAxisin classXPathParser- Throws:
XPathException
-
parsePredicate
Parse an expression appearing within a predicate. This enables full XPath parsing, without the normal rules that apply within an XSLT pattern- Overrides:
parsePredicatein classXPathParser- Returns:
- the parsed expression that appears within the predicate
- Throws:
XPathException
-
parseFunctionCall
Parse a function call appearing within a pattern. Unless within a predicate, this imposes the constraints on which function calls are allowed to appear in a pattern- Overrides:
parseFunctionCallin classXPathParser- Parameters:
prefixArgument-- Returns:
- the expression that results from the parsing (usually a FunctionCall)
- Throws:
XPathException
-
parseFunctionArgument
Description copied from class:XPathParserParse an argument to a function call. Separate method so it can be overridden. With higher-order-function syntax in XPath 3.0/XQuery 3.0, this returns null if the pseudo-argument "?" is found.- Overrides:
parseFunctionArgumentin classXPathParser- Returns:
- the Expression used as the argument, or null if the argument is the place-holder "?"
- Throws:
XPathException- if the argument expression does not parse correctly
-
makeTracer
Description copied from class:XPathParserIf tracing, wrap an expression in a trace instruction- Overrides:
makeTracerin classXPathParser- Parameters:
exp- the expression to be wrappedqName- the name of the construct (if applicable)- Returns:
- the expression that does the tracing
-