Add the code structure for planning.

This commit is contained in:
Tom Alexander
2023-04-21 21:33:23 -04:00
parent 591d9c5e1f
commit 2ec1d4f855
5 changed files with 49 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ use super::lesser_element::DiarySexp;
use super::lesser_element::ExampleBlock;
use super::lesser_element::ExportBlock;
use super::lesser_element::Paragraph;
use super::lesser_element::Planning;
use super::lesser_element::SrcBlock;
use super::lesser_element::VerseBlock;
use super::source::Source;
@@ -34,6 +35,7 @@ pub enum Element<'s> {
SrcBlock(SrcBlock<'s>),
Clock(Clock<'s>),
DiarySexp(DiarySexp<'s>),
Planning(Planning<'s>),
}
impl<'s> Source<'s> for Element<'s> {
@@ -55,6 +57,7 @@ impl<'s> Source<'s> for Element<'s> {
Element::SrcBlock(obj) => obj.source,
Element::Clock(obj) => obj.source,
Element::DiarySexp(obj) => obj.source,
Element::Planning(obj) => obj.source,
}
}
}

View File

@@ -69,6 +69,11 @@ pub struct DiarySexp<'s> {
pub source: &'s str,
}
#[derive(Debug)]
pub struct Planning<'s> {
pub source: &'s str,
}
impl<'s> Paragraph<'s> {
pub fn of_text(input: &'s str) -> Self {
let mut objects = Vec::with_capacity(1);
@@ -135,3 +140,9 @@ impl<'s> Source<'s> for DiarySexp<'s> {
self.source
}
}
impl<'s> Source<'s> for Planning<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}

View File

@@ -20,6 +20,7 @@ mod parser_context;
mod parser_with_context;
mod plain_list;
mod plain_text;
mod planning;
mod property_drawer;
pub mod sexp;
mod source;
@@ -47,6 +48,7 @@ pub use lesser_element::DiarySexp;
pub use lesser_element::ExampleBlock;
pub use lesser_element::ExportBlock;
pub use lesser_element::Paragraph;
pub use lesser_element::Planning;
pub use lesser_element::SrcBlock;
pub use lesser_element::TableCell;
pub use lesser_element::VerseBlock;

8
src/parser/planning.rs Normal file
View File

@@ -0,0 +1,8 @@
use super::Context;
use crate::error::Res;
use crate::parser::lesser_element::Planning;
#[tracing::instrument(ret, level = "debug")]
pub fn planning<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Planning<'s>> {
todo!()
}