#[derive(Debug, Clone, PartialEq)]
pub enum XPathExpr {
LocationPath(LocationPath),
StringLiteral(String),
NumberLiteral(f64),
FunctionCall(String, Vec<XPathExpr>),
BinaryOp(Box<XPathExpr>, BinaryOp, Box<XPathExpr>),
UnaryMinus(Box<XPathExpr>),
Union(Vec<XPathExpr>),
FilterPath(Box<XPathExpr>, Vec<Step>),
GlobalFilter(Box<XPathExpr>, Vec<XPathExpr>),
}
#[derive(Debug, Clone, PartialEq)]
pub struct LocationPath {
pub absolute: bool,
pub steps: Vec<Step>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Step {
pub axis: Axis,
pub node_test: NodeTest,
pub predicates: Vec<XPathExpr>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Axis {
Child,
Descendant,
Parent,
Ancestor,
FollowingSibling,
PrecedingSibling,
Following,
Preceding,
SelfAxis,
DescendantOrSelf,
AncestorOrSelf,
Attribute,
Namespace,
}
#[derive(Debug, Clone, PartialEq)]
pub enum NodeTest {
Name(String),
Wildcard,
Text,
Node,
Comment,
PI,
PIName(String),
NamespacedName(String, String),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BinaryOp {
Or,
And,
Eq,
Neq,
Lt,
Gt,
Lte,
Gte,
Add,
Sub,
Mul,
Div,
Mod,
}