Move the structs into the token module.

This commit is contained in:
Tom Alexander
2022-12-18 03:24:35 -05:00
parent 8211e1043f
commit 2def475337
6 changed files with 70 additions and 69 deletions

View File

@@ -1,6 +1,3 @@
use super::text::Paragraph;
use super::text::TextElement;
#[derive(Debug)]
pub enum Token<'a> {
TextElement(TextElement<'a>),
@@ -18,3 +15,59 @@ impl<'a> Into<Token<'a>> for Paragraph<'a> {
Token::Paragraph(self)
}
}
#[derive(Debug)]
pub enum TextElement<'a> {
Span(Span<'a>),
Space(Space<'a>),
LineBreak(LineBreak<'a>),
Symbol(Symbol<'a>),
Bold(Bold<'a>),
Link(Link<'a>),
}
#[derive(Debug)]
pub struct Span<'a> {
pub contents: &'a str,
}
#[derive(Debug)]
pub struct Space<'a> {
pub contents: &'a str,
}
#[derive(Debug)]
pub struct LineBreak<'a> {
pub contents: &'a str,
}
#[derive(Debug)]
pub struct Symbol<'a> {
pub contents: &'a str,
}
#[derive(Debug)]
pub struct BlankLine<'a> {
pub contents: &'a str,
}
#[derive(Debug)]
pub struct Sequence<'a> {
pub contents: &'a str,
}
#[derive(Debug)]
pub struct Bold<'a> {
pub contents: &'a str,
}
#[derive(Debug)]
pub struct Link<'a> {
pub contents: &'a str,
}
#[derive(Debug)]
pub struct Paragraph<'a> {
pub contents: Vec<TextElement<'a>>,
pub paragraph_end: &'a str,
}