use super::types::*;
use std::borrow::Cow;
#[derive(Debug, Clone, PartialEq)]
pub enum MathNode<'a> {
Text(Cow<'a, str>),
Number(Cow<'a, str>),
Operator(Operator),
Symbol(Symbol<'a>),
PredefinedSymbol(PredefinedSymbol),
Frac {
numerator: Vec<MathNode<'a>>,
denominator: Vec<MathNode<'a>>,
line_thickness: Option<f32>,
frac_type: Option<FractionType>,
},
Root {
base: Vec<MathNode<'a>>,
index: Option<Vec<MathNode<'a>>>,
},
Power {
base: Vec<MathNode<'a>>,
exponent: Vec<MathNode<'a>>,
},
Sub {
base: Vec<MathNode<'a>>,
subscript: Vec<MathNode<'a>>,
},
SubSup {
base: Vec<MathNode<'a>>,
subscript: Vec<MathNode<'a>>,
superscript: Vec<MathNode<'a>>,
},
PreSub {
base: Vec<MathNode<'a>>,
pre_subscript: Vec<MathNode<'a>>,
},
PreSup {
base: Vec<MathNode<'a>>,
pre_superscript: Vec<MathNode<'a>>,
},
PreSubSup {
base: Vec<MathNode<'a>>,
pre_subscript: Vec<MathNode<'a>>,
pre_superscript: Vec<MathNode<'a>>,
},
Under {
base: Vec<MathNode<'a>>,
under: Vec<MathNode<'a>>,
position: Option<Position>,
},
Over {
base: Vec<MathNode<'a>>,
over: Vec<MathNode<'a>>,
position: Option<Position>,
},
UnderOver {
base: Vec<MathNode<'a>>,
under: Vec<MathNode<'a>>,
over: Vec<MathNode<'a>>,
position: Option<Position>,
},
Fenced {
open: Fence,
content: Vec<MathNode<'a>>,
close: Fence,
separator: Option<Cow<'a, str>>,
},
LargeOp {
operator: LargeOperator,
lower_limit: Option<Vec<MathNode<'a>>>,
upper_limit: Option<Vec<MathNode<'a>>>,
integrand: Option<Vec<MathNode<'a>>>,
hide_lower: bool,
hide_upper: bool,
},
Function {
name: Cow<'a, str>,
argument: Vec<MathNode<'a>>,
},
PredefinedFunction {
function: FunctionName,
argument: Vec<MathNode<'a>>,
},
Matrix {
rows: Vec<Vec<Vec<MathNode<'a>>>>,
fence_type: MatrixFence,
properties: Option<MatrixProperties>,
},
EqArray {
rows: Vec<Vec<MathNode<'a>>>,
properties: Option<EqArrayProperties>,
},
Accent {
base: Box<Vec<MathNode<'a>>>,
accent: AccentType,
position: Option<Position>,
},
Bar {
base: Box<Vec<MathNode<'a>>>,
position: Option<Position>,
},
BorderBox {
content: Box<Vec<MathNode<'a>>>,
style: Option<BorderBoxStyle>,
},
GroupChar {
base: Box<Vec<MathNode<'a>>>,
character: Option<Cow<'a, str>>,
position: Option<Position>,
vertical_alignment: Option<VerticalAlignment>,
},
Space(SpaceType),
LineBreak,
Style {
style: StyleType,
content: Vec<MathNode<'a>>,
},
Run {
content: Vec<MathNode<'a>>,
literal: Option<bool>,
style: Option<StyleType>,
font: Option<Cow<'a, str>>,
color: Option<Cow<'a, str>>,
underline: Option<LineStyle>,
overline: Option<LineStyle>,
strike_through: Option<StrikeStyle>,
double_strike_through: Option<bool>,
},
Row(Vec<MathNode<'a>>),
Phantom(Box<Vec<MathNode<'a>>>),
Limit {
content: Box<Vec<MathNode<'a>>>,
limit_type: LimitType,
},
Degree(Box<Vec<MathNode<'a>>>),
Base(Box<Vec<MathNode<'a>>>),
Argument(Box<Vec<MathNode<'a>>>),
Numerator(Box<Vec<MathNode<'a>>>),
Denominator(Box<Vec<MathNode<'a>>>),
Integrand(Box<Vec<MathNode<'a>>>),
LowerLimit(Box<Vec<MathNode<'a>>>),
UpperLimit(Box<Vec<MathNode<'a>>>),
Error(Cow<'a, str>),
}