use std::fmt::Display;
#[derive(Copy,Clone,PartialEq)]
pub enum TeXMode {
Vertical,
InternalVertical,
Horizontal,
RestrictedHorizontal,
Math,
Displaymath
}
impl TeXMode {
pub fn is_vertical(&self) -> bool {
use TeXMode::*;
match self {
Vertical | InternalVertical => true,
_ => false
}
}
}
impl Display for TeXMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use TeXMode::*;
match self {
Vertical => write!(f, "vertical"),
InternalVertical => write!(f, "internal vertical"),
Horizontal => write!(f, "horizontal"),
RestrictedHorizontal => write!(f, "restricted horizontal"),
Math => write!(f, "math"),
Displaymath => write!(f, "display math")
}
}
}
pub trait GroupType:Clone+PartialEq+Default {
fn from_catcode_token() -> Self;
fn from_begingroup_cs() -> Self;
}
#[derive(Copy,Clone,PartialEq)]
pub enum TeXGroupType {
Top,
Token,
CS,
Box(BoxMode),
}
impl Default for TeXGroupType {
fn default() -> Self { TeXGroupType::Top }
}
impl GroupType for TeXGroupType {
fn from_begingroup_cs() -> Self { TeXGroupType::CS }
fn from_catcode_token() -> Self { TeXGroupType::Token }
}
#[derive(Copy,Clone,PartialEq)]
pub enum BoxMode {
H,
V,
M,
DM,
LeftRight,
Void
}