Create structure for targets.

This commit is contained in:
Tom Alexander
2023-07-22 01:15:04 -04:00
parent 537fc00fd3
commit d60cad07e0
4 changed files with 41 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ pub enum Object<'s> {
InlineBabelCall(InlineBabelCall<'s>),
InlineSourceBlock(InlineSourceBlock<'s>),
LineBreak(LineBreak<'s>),
Target(Target<'s>),
}
#[derive(Debug, PartialEq)]
@@ -155,6 +156,11 @@ pub struct LineBreak<'s> {
pub source: &'s str,
}
#[derive(Debug, PartialEq)]
pub struct Target<'s> {
pub source: &'s str,
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
@@ -180,6 +186,7 @@ impl<'s> Source<'s> for Object<'s> {
Object::InlineBabelCall(obj) => obj.source,
Object::InlineSourceBlock(obj) => obj.source,
Object::LineBreak(obj) => obj.source,
Object::Target(obj) => obj.source,
}
}
}
@@ -309,3 +316,9 @@ impl<'s> Source<'s> for LineBreak<'s> {
self.source
}
}
impl<'s> Source<'s> for Target<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}