Class PatternParser30

  • All Implemented Interfaces:
    PatternParser

    public class PatternParser30
    extends XPathParser
    implements PatternParser
    Parser for XSLT patterns. This is created by overriding selected parts of the standard ExpressionParser.
    • Constructor Detail

      • PatternParser30

        public PatternParser30()
    • Method Detail

      • parsePattern

        public Pattern parsePattern​(java.lang.String pattern,
                                    StaticContext env)
                             throws XPathException
        Parse a string representing an XSLT pattern
        Specified by:
        parsePattern in interface PatternParser
        Parameters:
        pattern - the pattern expressed as a String
        env - 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

        protected void customizeTokenizer​(Tokenizer t)
        Callback to tailor the tokenizer
        Overrides:
        customizeTokenizer in class XPathParser
        Parameters:
        t - the Tokenizer to be customized
      • parseBasicStep

        protected Expression parseBasicStep​(boolean firstInPattern)
                                     throws XPathException
        Parse a basic step expression (without the predicates)
        Overrides:
        parseBasicStep in class XPathParser
        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
      • parsePredicate

        protected Expression parsePredicate()
                                     throws XPathException
        Parse an expression appearing within a predicate. This enables full XPath parsing, without the normal rules that apply within an XSLT pattern
        Overrides:
        parsePredicate in class XPathParser
        Returns:
        the parsed expression that appears within the predicate
        Throws:
        XPathException
      • parseFunctionCall

        public Expression parseFunctionCall​(Expression prefixArgument)
                                     throws XPathException
        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:
        parseFunctionCall in class XPathParser
        Parameters:
        prefixArgument -
        Returns:
        the expression that results from the parsing (usually a FunctionCall)
        Throws:
        XPathException
      • parseFunctionArgument

        public Expression parseFunctionArgument()
                                         throws XPathException
        Description copied from class: XPathParser
        Parse 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:
        parseFunctionArgument in class XPathParser
        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

        public Expression makeTracer​(Expression exp,
                                     StructuredQName qName)
        Description copied from class: XPathParser
        If tracing, wrap an expression in a trace instruction
        Overrides:
        makeTracer in class XPathParser
        Parameters:
        exp - the expression to be wrapped
        qName - the name of the construct (if applicable)
        Returns:
        the expression that does the tracing