organic/src/parser/lesser_element.rs

149 lines
2.8 KiB
Rust
Raw Normal View History

2023-04-20 02:09:53 +00:00
use super::object::Object;
use super::object::TextMarkup;
use super::source::Source;
2023-03-25 15:22:59 +00:00
2023-03-23 21:26:07 +00:00
#[derive(Debug)]
pub struct Paragraph<'s> {
pub source: &'s str,
2023-03-25 15:22:59 +00:00
pub children: Vec<Object<'s>>,
2023-03-23 21:26:07 +00:00
}
#[derive(Debug)]
pub struct Comment<'s> {
pub source: &'s str,
}
2023-04-20 02:09:53 +00:00
#[derive(Debug)]
pub struct TableCell<'s> {
pub source: &'s str,
pub children: Vec<Object<'s>>,
}
#[derive(Debug)]
pub struct VerseBlock<'s> {
pub source: &'s str,
pub name: &'s str,
pub data: Option<&'s str>,
pub children: Vec<Object<'s>>,
}
#[derive(Debug)]
pub struct CommentBlock<'s> {
pub source: &'s str,
pub name: &'s str,
pub data: Option<&'s str>,
pub contents: &'s str,
}
#[derive(Debug)]
pub struct ExampleBlock<'s> {
pub source: &'s str,
pub name: &'s str,
pub data: Option<&'s str>,
pub contents: &'s str,
}
#[derive(Debug)]
pub struct ExportBlock<'s> {
pub source: &'s str,
pub name: &'s str,
pub data: Option<&'s str>,
pub contents: &'s str,
}
#[derive(Debug)]
pub struct SrcBlock<'s> {
pub source: &'s str,
pub name: &'s str,
pub data: Option<&'s str>,
pub contents: &'s str,
}
#[derive(Debug)]
pub struct Clock<'s> {
pub source: &'s str,
}
2023-04-22 00:22:31 +00:00
#[derive(Debug)]
pub struct DiarySexp<'s> {
pub source: &'s str,
}
2023-04-22 01:33:23 +00:00
#[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);
objects.push(Object::TextMarkup(TextMarkup { source: input }));
Paragraph {
source: input,
children: objects,
}
}
}
impl<'s> Source<'s> for Paragraph<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for TableCell<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for Comment<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for VerseBlock<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for CommentBlock<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for ExampleBlock<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for ExportBlock<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for SrcBlock<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for Clock<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
2023-04-22 00:22:31 +00:00
impl<'s> Source<'s> for DiarySexp<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
2023-04-22 01:33:23 +00:00
impl<'s> Source<'s> for Planning<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}