com.saxonica.xslt3

## Class PatternParser30

- java.lang.Object
- - net.sf.saxon.expr.parser.ExpressionParser
  - - com.saxonica.expr.XPath30Parser
    - - com.saxonica.xslt3.PatternParser30

- All Implemented Interfaces:
    PatternParser

      public class PatternParser30
      extends XPath30Parser
      implements 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 com.saxonica.expr.XPath30Parser

      `XPath30Parser.InlineFunctionDetails, XPath30Parser.TemporaryXSLTVariableBinding`

    - ### Nested classes/interfaces inherited from class net.sf.saxon.expr.parser.ExpressionParser

      `ExpressionParser.TemporaryContainer`

  - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.expr.parser.ExpressionParser

      `allowXPath30Syntax, catchDepth, codeInjector, defaultContainer, env, language, nameChecker, rangeVariables, scanOnly, SEQUENCE_TYPE, t, XPATH, XQUERY, XSLT_PATTERN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PatternParser30()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `customizeTokenizer(Tokenizer t)` Callback to tailor the tokenizer
    `Expression` | `makeTracer(int startOffset, Expression exp, int construct, StructuredQName qName)` If tracing, wrap an expression in a trace instruction
    `protected Expression` | `parseBasicStep(boolean firstInPattern)` Parse a basic step expression (without the predicates)
    `Expression` | `parseExpression()` Override the parsing of top-level expressions
    `Expression` | `parseFunctionArgument()` Parse a function argument.
    `protected Expression` | `parseFunctionCall()` Parse a function call appearing within a pattern.
    `Pattern` | `parsePattern(String pattern, StaticContext env)` Parse a string representing an XSLT pattern
    `protected Expression` | `parsePredicate()` Parse an expression appearing within a predicate.
    `protected Expression` | `parseTypePattern()` Parse a type pattern of the form "~ ItemType" (introduced in XSLT 3.0)
    `protected void` | `testPermittedAxis(byte axis)`

    - ### Methods inherited from class com.saxonica.expr.XPath30Parser

      `curryFunction, findOuterRangeVariable, findRangeVariable, isNamespaceTestAllowed, makeCurriedFunction, makeCurriedFunction, parseDynamicFunctionCall, parseDynamicFunctionCall, parseFunctionItemType, parseFunctionItemType, parseInlineFunction, parseInlineFunction, parseLiteralFunctionItem, parseLiteralFunctionItem, parseMapExpression, parseMapExpression, parseMapItemType, parseMapItemType, parseParenthesizedItemType`

    - ### Methods inherited from class net.sf.saxon.expr.parser.ExpressionParser

      `atStartOfRelativePath, currentTokenDisplay, declareRangeVariable, disallowedAtStartOfRelativePath, expect, getCodeInjector, getDefaultContainer, getLanguage, getNameChecker, getRangeVariables, getStaticContext, getTokenizer, grumble, grumble, grumble, grumble, isKeyword, isReservedInQuery, makeLocalNameTest, makeNameCode, makeNamespaceTest, makeNameTest, makeNodeName, makeStringLiteral, makeStructuredQName, makeStructuredQNameSilently, nextToken, normalizeEQName, parse, parseAnnotations, parseBinaryExpression, parseConstructor, parseExprSingle, parseExtensionExpression, parseFLWORExpression, parseItemType, parseNodeTest, parseNumericLiteral, parsePathExpression, parseRelativePath, parseRemainingPath, parseSequenceType, parseSequenceType, parseSimpleMappingExpression, parseStepExpression, parseStringLiteral, parseSwitchExpression, parseTryCatchExpression, parseTypeswitchExpression, parseValidateExpression, parseVariableReference, reportMissingFunction, resolveFunctionName, setCodeInjector, setDefaultContainer, setLanguage, setLocation, setLocation, setLocation, setRangeVariables, setRangeVariableStack, setScanOnly, undeclareRangeVariable, warning`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PatternParser30

          public PatternParser30()

  - ### Method Detail

    - #### parsePattern

          public Pattern parsePattern(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 `ExpressionParser`
      Parameters:
        `t` - the Tokenizer to be customized

    - #### parseExpression

          public Expression parseExpression()
                                     throws XPathException

      Override the parsing of top-level expressions
      Overrides:
        `parseExpression` in class `ExpressionParser`
      Returns:
        the parsed expression
      Throws:
        `XPathException`

    - #### parseBasicStep

          protected Expression parseBasicStep(boolean firstInPattern)
                                       throws XPathException

      Parse a basic step expression (without the predicates)
      Overrides:
        `parseBasicStep` in class `ExpressionParser`
      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

          protected void testPermittedAxis(byte axis)
                                    throws XPathException

      Overrides:
        `testPermittedAxis` in class `ExpressionParser`
      Throws:
        `XPathException`

    - #### parseTypePattern

          protected Expression parseTypePattern()
                                         throws XPathException

      Parse a type pattern of the form "~ ItemType" (introduced in XSLT 3.0)
      Overrides:
        `parseTypePattern` in class `ExpressionParser`
      Returns:
        the type pattern, wrapped in a PatternSponsor to satisfy the parsing interface
      Throws:
        `XPathException` - if any error is found, for example if XSLT 3.0 is not enabled

    - #### 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 `ExpressionParser`
      Returns:
        the parsed expression that appears within the predicate
      Throws:
        `XPathException`

    - #### parseFunctionCall

          protected Expression parseFunctionCall()
                                          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 `ExpressionParser`
      Returns:
        the expression that results from the parsing (usually a FunctionCall)
      Throws:
        `XPathException`

    - #### parseFunctionArgument

          public Expression parseFunctionArgument()
                                           throws XPathException

      Description copied from class: `XPath30Parser`
      Parse a function argument. The special marker "?" is allowed and causes "null" to be returned
      Overrides:
        `parseFunctionArgument` in class `XPath30Parser`
      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(int startOffset,
                              Expression exp,
                              int construct,
                              StructuredQName qName)

      Description copied from class: `ExpressionParser`
      If tracing, wrap an expression in a trace instruction
      Overrides:
        `makeTracer` in class `ExpressionParser`
      Parameters:
        `startOffset` - the position of the expression in the soruce
        `exp` - the expression to be wrapped
        `construct` - integer constant identifying the kind of construct
        `qName` - the name of the construct (if applicable)
      Returns:
        the expression that does the tracing

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.