#[derive(Debug, Clone, PartialEq)]
pub struct Template {
pub(crate) nodes: Vec<Node>,
}
#[derive(Debug, Clone, PartialEq)]
pub(crate) enum Node {
Literal(String),
Var(Expr),
If {
branches: Vec<(Expr, Vec<Node>)>,
otherwise: Vec<Node>,
},
For {
expr: Expr,
bind: Option<String>,
body: Vec<Node>,
sep: Vec<Node>,
},
Partial {
name: String,
map_over: Option<Expr>,
sep: Option<String>,
},
}
#[derive(Debug, Clone, PartialEq)]
pub(crate) struct Expr {
pub(crate) path: Vec<String>,
pub(crate) pipes: Vec<Pipe>,
}
#[derive(Debug, Clone, PartialEq)]
pub(crate) enum Pipe {
Uppercase,
Lowercase,
Length,
Reverse,
First,
Last,
Rest,
AllButLast,
Pairs,
Alpha,
Roman,
Chomp,
Nowrap,
Block {
align: Align,
width: usize,
left: String,
right: String,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum Align {
Left,
Right,
Center,
}