@designliquido/xpath
    Preparing search index...

    Class XPath30Parser

    Recursive descent parser shared by XPath 1.0+ implementations.

    Grammar (simplified): Expr ::= OrExpr OrExpr ::= AndExpr ('or' AndExpr)* AndExpr ::= EqualityExpr ('and' EqualityExpr)* EqualityExpr ::= RelationalExpr (('=' | '!=') RelationalExpr)* RelationalExpr ::= AdditiveExpr (('<' | '>' | '<=' | '>=') AdditiveExpr)* AdditiveExpr ::= MultiplicativeExpr (('+' | '-') MultiplicativeExpr)* MultiplicativeExpr ::= UnaryExpr (('' | 'div' | 'mod') UnaryExpr) UnaryExpr ::= '-'* UnionExpr UnionExpr ::= PathExpr ('|' PathExpr)* PathExpr ::= LocationPath | FilterExpr (('/' | '//') RelativeLocationPath)? FilterExpr ::= PrimaryExpr Predicate* PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall LocationPath ::= RelativeLocationPath | AbsoluteLocationPath Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep Predicate ::= '[' Expr ']'

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    tokens: XPathToken[] = []
    current: number = 0
    extensions?: XSLTExtensions
    staticContext: XPathStaticContext
    warningCollector: WarningCollector

    Methods

    • Override parseExpr to handle:

      1. Let expressions: let $x := expr return expr
      2. Sequence construction: expr, expr, expr (comma operator)

      Returns XPathExpression

    • Parse a single expression (not comma-separated).

      Returns XPathExpression

    • Override parseFunctionCall to use parseExprSingle for arguments.

      In XPath 3.0, function arguments are ExprSingle, not Expr. This means commas in arguments don't create sequences at the function level. For example: concat("Hello ", $name) should parse as two arguments, not one argument that is a sequence of two items.

      Returns XPathExpression

    • Override parsePrimaryExpr to handle:

      • Variable references with any name (including function names like 'name')
      • Named function references (fn:name#arity)
      • Inline functions (function($x) { expr })
      • String templates (Hello {$name}!)

      Returns XPathExpression

    • Override parseFilterExpr to handle dynamic function calls. In XPath 3.0, any primary expression followed by '(' is a dynamic function call. Syntax: $func(args), (inline-function)(args), etc.

      Returns XPathExpression

    • Parse a string template from its lexeme and create a StringTemplateExpression. The template string contains the raw content between backticks.

      Parameters

      • template: string

      Returns XPathExpression