#[derive(Debug, Clone, PartialEq)]
pub enum MathNode {
Ident {
text: String,
upright: bool,
},
Number(String),
Operator {
text: String,
height_em: Option<f32>,
},
Text(String),
Space(f32),
Row(Vec<MathNode>),
Frac {
num: Box<MathNode>,
den: Box<MathNode>,
},
Sqrt(Box<MathNode>),
Root {
base: Box<MathNode>,
index: Box<MathNode>,
},
Scripts {
base: Box<MathNode>,
sub: Option<Box<MathNode>>,
sup: Option<Box<MathNode>>,
},
UnderOver {
base: Box<MathNode>,
under: Option<Box<MathNode>>,
over: Option<Box<MathNode>>,
accent: bool,
},
Table {
rows: Vec<Vec<MathNode>>,
align: Vec<&'static str>,
},
}
impl MathNode {
pub fn row(mut nodes: Vec<MathNode>) -> MathNode {
if nodes.len() == 1 {
nodes.remove(0)
} else {
MathNode::Row(nodes)
}
}
}