Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.expr
Class XPath30Parser

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

    public class XPath30Parser

extends ExpressionParser

Parser extension for new syntax in XPath 3.0.

This contains code duplicated with the XQuery1.1 parser. This is handled by putting the common code into static methods of this class, which are invoked from both the XPath30Parser and the XQuery11Parser.

Nested Class Summary
`static class` | `XPath30Parser.InlineFunctionDetails`
`static class` | `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, defaultContainer, env, language, nameChecker, rangeVariables, scanOnly, SEQUENCE_TYPE, t, XPATH, XQUERY, XSLT_PATTERN`

Constructor Summary
`XPath30Parser()`

Method Summary
`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 Binding` | `findOuterRangeVariable(StructuredQName qName, Stack<XPath30Parser.InlineFunctionDetails> inlineFunctionStack, StaticContext env)`
`protected Binding` | `findRangeVariable(StructuredQName qName)` Locate a range variable with a given name.
`int` | `getPermittedFunctions()` Get the permitted set of standard functions in this environment
`protected boolean` | `isNamespaceTestAllowed()` Ask whether the syntax namespace-node() is allowed in a node kind test.
`static Expression` | `makeCurriedFunction(ExpressionParser parser, StaticContext env, Container container, int offset, StructuredQName name, Expression[] args, IntSet placeMarkers)`
`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)
`protected Expression` | `parseDynamicFunctionCall(Expression functionItem)` Parse a dynamic function call
`static Expression` | `parseDynamicFunctionCall(Expression functionItem, ExpressionParser p)`
`Expression` | `parseFunctionArgument()` Parse a function argument.
`ItemType` | `parseFunctionItemType()` Parse the item type used for function items (XQuery 1.1 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 TODO: remove support for the old syntax The "function(" has already been read
`static ItemType` | `parseFunctionItemType(ExpressionParser p)`
`protected Expression` | `parseInlineFunction()` Parse an inline function "function" "(" ParamList? ")" ("as" SequenceType)? EnclosedExpr On entry, "function (" has already been read
`static Expression` | `parseInlineFunction(ExpressionParser p, Stack<XPath30Parser.InlineFunctionDetails> inlineFunctionStack)`
`protected Expression` | `parseLiteralFunctionItem()` 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` | `parseLiteralFunctionItem(ExpressionParser p)`
`protected Expression` | `parseMapExpression()` Parse a map expression.
`protected static Expression` | `parseMapExpression(ExpressionParser parser)`
`ItemType` | `parseMapItemType()` Parse the item type used for function items (XPath 3.0) Syntax: map '(' '*' ') | map '(' ItemType ',' 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` | `parseMapItemType(ExpressionParser p)`
`protected ItemType` | `parseParenthesizedItemType()` Parse a parenthesized item type (allowed in XQuery 3.0 and XPath 3.0 only)

Methods inherited from class net.sf.saxon.expr.parser.ExpressionParser
`atStartOfRelativePath, currentTokenDisplay, customizeTokenizer, declareRangeVariable, disallowedAtStartOfRelativePath, expect, getCodeInjector, getDefaultContainer, getLanguage, getNameChecker, getRangeVariables, getStaticContext, getTokenizer, grumble, grumble, grumble, grumble, grumble, isKeyword, makeLocalNameTest, makeNameCode, makeNameCodeSilently, makeNamespaceTest, makeNameTest, makeNodeName, makeStringLiteral, makeStructuredQName, makeTracer, nextToken, normalizeEQName, parse, parseBasicStep, parseBinaryExpression, parseConstructor, parseExpression, parseExprSingle, parseExtensionExpression, parseFLWORExpression, parseFunctionCall, parseItemType, parseNodeTest, parseNumericLiteral, parsePathExpression, parsePredicate, parseRelativePath, parseRemainingPath, parseSequenceType, parseSequenceType, parseStepExpression, parseStringLiteral, parseSwitchExpression, parseTryCatchExpression, parseTypePattern, parseTypeswitchExpression, parseValidateExpression, parseVariableReference, reportMissingFunction, resolveFunctionName, setCodeInjector, setDefaultContainer, setLanguage, 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

### XPath30Parser

    public XPath30Parser()

Method Detail

### getPermittedFunctions

    public int getPermittedFunctions()

  Get the permitted set of standard functions in this environment

### parseLiteralFunctionItem

    protected Expression parseLiteralFunctionItem()
                                           throws XPathException

  Parse a literal function item (introduced in XQuery 3.0 and XPath 3.0) Syntax: QName # integer The QName and # have already been read

  Overrides:
    `parseLiteralFunctionItem` in class `ExpressionParser`
  Returns:
    an ExternalObject representing the function item
  Throws:
    `XPathException` - if a static error is encountered

### parseLiteralFunctionItem

    public static Expression parseLiteralFunctionItem(ExpressionParser p)
                                               throws XPathException

  Throws:
    `XPathException`

### parseFunctionItemType

    public ItemType parseFunctionItemType()
                                   throws XPathException

  Parse the item type used for function items (XQuery 1.1 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 TODO: remove support for the old syntax The "function(" has already been read

  Overrides:
    `parseFunctionItemType` in class `ExpressionParser`
  Returns:
    the item type representing a function item
  Throws:
    `XPathException` - if a static error occurs (including the case where XPath 3.0 syntax is not enabled)

### parseFunctionItemType

    public static ItemType parseFunctionItemType(ExpressionParser p)
                                          throws XPathException

  Throws:
    `XPathException`

### parseFunctionArgument

    public Expression parseFunctionArgument()
                                     throws XPathException

  Parse a function argument. The special marker "?" is allowed and causes "null" to be returned

  Overrides:
    `parseFunctionArgument` in class `ExpressionParser`
  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

### parseMapItemType

    public ItemType parseMapItemType()
                              throws XPathException

  Parse the item type used for function items (XPath 3.0) Syntax: map '(' '*' ') | map '(' ItemType ',' 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

  Overrides:
    `parseMapItemType` in class `ExpressionParser`
  Returns:
    the item type of the map
  Throws:
    `XPathException` - if a parsing error occurs or if the map syntax is not available

### parseMapItemType

    public static ItemType parseMapItemType(ExpressionParser p)
                                     throws XPathException

  Throws:
    `XPathException`

### parseParenthesizedItemType

    protected ItemType parseParenthesizedItemType()
                                           throws XPathException

  Parse a parenthesized item type (allowed in XQuery 3.0 and XPath 3.0 only)

  Overrides:
    `parseParenthesizedItemType` in class `ExpressionParser`
  Returns:
    the item type
  Throws:
    `XPathException` - if a syntax error is found

### parseDynamicFunctionCall

    protected Expression parseDynamicFunctionCall(Expression functionItem)
                                           throws XPathException

  Parse a dynamic function call

  Overrides:
    `parseDynamicFunctionCall` in class `ExpressionParser`
  Parameters:
    `functionItem` - the expression that determines the function to be called
  Returns:
    the expression that results from the parsing
  Throws:
    `XPathException` - if a static error is found

### parseDynamicFunctionCall

    public static Expression parseDynamicFunctionCall(Expression functionItem,
                                                      ExpressionParser p)
                                               throws XPathException

  Throws:
    `XPathException`

### parseInlineFunction

    protected Expression parseInlineFunction()
                                      throws XPathException

  Parse an inline function "function" "(" ParamList? ")" ("as" SequenceType)? EnclosedExpr On entry, "function (" has already been read

  Overrides:
    `parseInlineFunction` in class `ExpressionParser`
  Returns:
    the parsed inline function
  Throws:
    `XPathException` - if a syntax error is found

### parseInlineFunction

    public static Expression parseInlineFunction(ExpressionParser p,
                                                 Stack<XPath30Parser.InlineFunctionDetails> inlineFunctionStack)
                                          throws XPathException

  Throws:
    `XPathException`

### makeCurriedFunction

    protected Expression makeCurriedFunction(int offset,
                                             StructuredQName name,
                                             Expression[] args,
                                             IntSet placeMarkers)
                                      throws XPathException

  Process a function call in which one or more of the argument positions are represented as "?" placemarkers (indicating partial application or currying)

  Overrides:
    `makeCurriedFunction` in class `ExpressionParser`
  Parameters:
    `offset` - offset in the query source of the start of the expression
    `name` - 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 function
  Returns:
    the curried function
  Throws:
    `XPathException`

### makeCurriedFunction

    public static Expression makeCurriedFunction(ExpressionParser parser,
                                                 StaticContext env,
                                                 Container container,
                                                 int offset,
                                                 StructuredQName name,
                                                 Expression[] args,
                                                 IntSet placeMarkers)
                                          throws XPathException

  Throws:
    `XPathException`

### curryFunction

    public 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)

  Parameters:
    `functionExp` - an expression that returns the function to be curried
    `args` - the arguments (with EmptySequence in the placemarker positions)
    `placeMarkers` - the positions of the placemarkers
  Returns:
    the curried function

### parseMapExpression

    protected Expression parseMapExpression()
                                     throws XPathException

  Parse a map expression. Requires XPath/XQuery 3.0 Provisional syntax map { expr := expr (, expr := expr )*} }

  Overrides:
    `parseMapExpression` in class `ExpressionParser`
  Returns:
    the map expression
  Throws:
    `XPathException`

### parseMapExpression

    protected static Expression parseMapExpression(ExpressionParser parser)
                                            throws XPathException

  Throws:
    `XPathException`

### findRangeVariable

    protected Binding findRangeVariable(StructuredQName qName)

  Locate a range variable with a given name. (By "range variable", we mean a variable declared within the expression where it is used.)

  Overrides:
    `findRangeVariable` in class `ExpressionParser`
  Parameters:
    `qName` - identifies the name of the range variable
  Returns:
    null if not found (this means the variable is probably a context variable); otherwise the relevant RangeVariable

### findOuterRangeVariable

    public static Binding findOuterRangeVariable(StructuredQName qName,
                                                 Stack<XPath30Parser.InlineFunctionDetails> inlineFunctionStack,
                                                 StaticContext env)

### isNamespaceTestAllowed

    protected boolean isNamespaceTestAllowed()

  Ask whether the syntax namespace-node() is allowed in a node kind test.

  Overrides:
    `isNamespaceTestAllowed` in class `ExpressionParser`
  Returns:
    true (currently allowed only in XQuery 3.0 and XPath 3.0)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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