pub enum Expr {
Show 20 variants
Literal(Literal),
VarRef(QName),
ContextItem,
FunctionCall {
name: QName,
args: Vec<Expr>,
},
Sequence(Vec<Expr>),
Filter {
base: Box<Expr>,
predicates: Vec<Expr>,
},
Path(PathExpr),
Negate(Box<Expr>),
Cast {
operand: Box<Expr>,
target: SingleType,
},
Castable {
operand: Box<Expr>,
target: SingleType,
},
InstanceOf {
operand: Box<Expr>,
target: SequenceType,
},
Union(Box<Expr>, Box<Expr>),
Arithmetic {
op: ArithmeticOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Range(Box<Expr>, Box<Expr>),
Comparison {
op: ComparisonOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
},
And(Box<Expr>, Box<Expr>),
Or(Box<Expr>, Box<Expr>),
If {
condition: Box<Expr>,
then: Box<Expr>,
otherwise: Box<Expr>,
},
For {
bindings: Vec<Binding>,
body: Box<Expr>,
},
Quantified {
quantifier: Quantifier,
bindings: Vec<Binding>,
satisfies: Box<Expr>,
},
}Expand description
An XPath expression (XPath 2.0 production [2] Expr and below).
Variants§
Literal(Literal)
A string or numeric literal ([42] Literal).
VarRef(QName)
$name ([44] VarRef). Unprefixed variable names are in no namespace.
ContextItem
. ([47] ContextItemExpr).
FunctionCall
name(args) ([48] FunctionCall). Unprefixed function names are in the
FN_NAMESPACE; which function the name and arity designate
is decided when the expression is compiled, not by the parser.
Sequence(Vec<Expr>)
The comma operator ([2] Expr) with two or more operands, or () ([46]
ParenthesizedExpr with no content) with none. A single parenthesized expression is
that expression itself.
Filter
A primary expression followed by one or more predicates ([38] FilterExpr).
Fields
Path(PathExpr)
A path expression with at least one / or //, or a single axis step ([25]
PathExpr). A single filter expression without slash is not a path.
Negate(Box<Expr>)
Unary minus ([20] UnaryExpr); --x is two nested negations.
Cast
operand cast as T? ([19] CastExpr).
Castable
operand castable as T? ([18] CastableExpr).
InstanceOf
operand instance of T ([16] InstanceofExpr).
Union(Box<Expr>, Box<Expr>)
lhs | rhs ([14] UnionExpr), left associative.
Arithmetic
+ - * div idiv mod ([12] AdditiveExpr, [13] MultiplicativeExpr), left
associative.
Range(Box<Expr>, Box<Expr>)
lhs to rhs ([11] RangeExpr), not associative.
Comparison
A general or value comparison ([10] ComparisonExpr), not associative.
And(Box<Expr>, Box<Expr>)
lhs and rhs ([9] AndExpr), left associative.
Or(Box<Expr>, Box<Expr>)
lhs or rhs ([8] OrExpr), left associative.
If
if (condition) then a else b ([7] IfExpr).
Fields
For
for $v in e, ... return body ([4] ForExpr).
Fields
Quantified
some|every $v in e, ... satisfies test ([6] QuantifiedExpr).