From 35d60c10ba676c8d6881ce66efee29d913f1d462 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 23 Mar 2023 17:26:07 -0400 Subject: [PATCH] Define greater and lesser elements. --- src/parser/element.rs | 7 +++++++ src/parser/greater_element.rs | 4 ++++ src/parser/lesser_element.rs | 4 ++++ src/parser/mod.rs | 3 +++ src/parser/object.rs | 4 ++++ 5 files changed, 22 insertions(+) create mode 100644 src/parser/element.rs create mode 100644 src/parser/greater_element.rs create mode 100644 src/parser/lesser_element.rs diff --git a/src/parser/element.rs b/src/parser/element.rs new file mode 100644 index 0000000..4fcc587 --- /dev/null +++ b/src/parser/element.rs @@ -0,0 +1,7 @@ +use super::greater_element::PlainList; +use super::lesser_element::Paragraph; + +pub enum Element<'s> { + Paragraph(Paragraph<'s>), + PlainList(PlainList<'s>), +} diff --git a/src/parser/greater_element.rs b/src/parser/greater_element.rs new file mode 100644 index 0000000..38d2a7a --- /dev/null +++ b/src/parser/greater_element.rs @@ -0,0 +1,4 @@ +#[derive(Debug)] +pub struct PlainList<'s> { + pub source: &'s str, +} diff --git a/src/parser/lesser_element.rs b/src/parser/lesser_element.rs new file mode 100644 index 0000000..83fd38b --- /dev/null +++ b/src/parser/lesser_element.rs @@ -0,0 +1,4 @@ +#[derive(Debug)] +pub struct Paragraph<'s> { + pub source: &'s str, +} diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 8190bd8..e3d5420 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -1,7 +1,10 @@ mod bold; mod combinator; mod document; +mod element; mod error; +mod greater_element; +mod lesser_element; mod link; mod list; mod object; diff --git a/src/parser/object.rs b/src/parser/object.rs index 95f68c7..d4d4b5e 100644 --- a/src/parser/object.rs +++ b/src/parser/object.rs @@ -2,20 +2,24 @@ pub trait Source<'s> { fn get_source(&'s self) -> &'s str; } +#[derive(Debug)] pub enum Object<'s> { TextMarkup(TextMarkup<'s>), PlainText(PlainText<'s>), RegularLink(RegularLink<'s>), } +#[derive(Debug)] pub struct TextMarkup<'s> { pub source: &'s str, } +#[derive(Debug)] pub struct PlainText<'s> { pub source: &'s str, } +#[derive(Debug)] pub struct RegularLink<'s> { pub source: &'s str, }