Skip to main content

Module parser

Module parser 

Source
Expand description

XPath 1.0 Expression Parser (§25).

Parses token streams from the lexer into the AST defined in ast.rs. Implements the full XPath 1.0 grammar.

§UPSTREAM-PARITY

Grammar (from XPath 1.0 spec §3.7):

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)?
LocationPath ::= AbsoluteLocationPath | RelativeLocationPath
AbsoluteLocationPath ::= '/' RelativeLocationPath? | '//' RelativeLocationPath
RelativeLocationPath ::= Step (('/' | '//') Step)*
Step        ::= AxisSpecifier NodeTest Predicate*
             |  AbbreviatedStep
AxisSpecifier ::= AxisName '::' | '@'?
AbbreviatedStep ::= '.' | '..'
Predicate   ::= '[' Expr ']'
FilterExpr  ::= PrimaryExpr Predicate*
PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall

§Courts

XPATH-PARSER-*

Structs§

ParseError
Errors that can occur during parsing.
Parser

Functions§

parse_xpath
Parse an XPath expression string into an AST.