use crate::alloc_prelude::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Axis {
Root,
Child,
Descendant,
Parent,
Ancestor,
FollowingSibling,
PrecedingSibling,
Following,
Preceding,
Attribute,
Namespace,
SelfAxis,
DescendantOrSelf,
AncestorOrSelf,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum NodeTest {
Wildcard,
Node,
Text,
Comment,
Name(String),
AttributeWildcard,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum XPathOperator {
Or,
And,
Eq,
NotEq,
Lt,
LtEq,
Gt,
GtEq,
Plus,
Minus,
Multiply,
Div,
Mod,
Union,
}
#[derive(Debug, Clone, PartialEq)]
pub enum XPathExpr {
LiteralString(String),
LiteralNumber(f64),
Step {
axis: Axis,
test: NodeTest,
predicates: Vec<XPathExpr>,
},
Path(Vec<XPathExpr>),
BinaryOp {
op: XPathOperator,
left: Box<XPathExpr>,
right: Box<XPathExpr>,
},
FunctionCall { name: String, args: Vec<XPathExpr> },
VariableRef(String),
}