Create structure for subscript and superscript.

This commit is contained in:
Tom Alexander
2023-07-24 14:19:19 -04:00
parent 7d73ac4bf6
commit 993c73dc9f
6 changed files with 118 additions and 1 deletions

View File

@@ -26,6 +26,8 @@ pub enum Object<'s> {
LineBreak(LineBreak<'s>),
Target(Target<'s>),
StatisticsCookie(StatisticsCookie<'s>),
Subscript(Subscript<'s>),
Superscript(Superscript<'s>),
}
#[derive(Debug, PartialEq)]
@@ -167,6 +169,16 @@ pub struct StatisticsCookie<'s> {
pub source: &'s str,
}
#[derive(Debug, PartialEq)]
pub struct Subscript<'s> {
pub source: &'s str,
}
#[derive(Debug, PartialEq)]
pub struct Superscript<'s> {
pub source: &'s str,
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
@@ -194,6 +206,8 @@ impl<'s> Source<'s> for Object<'s> {
Object::LineBreak(obj) => obj.source,
Object::Target(obj) => obj.source,
Object::StatisticsCookie(obj) => obj.source,
Object::Subscript(obj) => obj.source,
Object::Superscript(obj) => obj.source,
}
}
}
@@ -335,3 +349,15 @@ impl<'s> Source<'s> for StatisticsCookie<'s> {
self.source
}
}
impl<'s> Source<'s> for Subscript<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for Superscript<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}