use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Axis {
Child,
Descendant,
DescendantOrSelf,
Parent,
Ancestor,
AncestorOrSelf,
SelfAxis,
Attribute,
FollowingSibling,
PrecedingSibling,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum NodeTest {
Wildcard,
Name(String),
Text,
Comment,
Any,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Step {
pub axis: Axis,
pub test: NodeTest,
pub predicates: Vec<Expr>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum Expr {
Path {
absolute: bool,
steps: Vec<Step>,
},
Literal(String),
Number(f64),
Binary {
op: BinaryOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Function {
name: String,
args: Vec<Expr>,
},
Negate(Box<Expr>),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BinaryOp {
Eq,
Ne,
Lt,
Le,
Gt,
Ge,
And,
Or,
Add,
Sub,
Mul,
Div,
Mod,
Union,
}