organic/src/parser/lesser_element.rs

193 lines
3.5 KiB
Rust
Raw Normal View History

2023-04-20 02:09:53 +00:00
use super::object::Object;
use super::source::Source;
2023-04-22 23:34:13 +00:00
use super::PlainText;
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,
}
2023-04-22 02:04:22 +00:00
#[derive(Debug)]
pub struct FixedWidthArea<'s> {
pub source: &'s str,
}
2023-04-22 02:23:59 +00:00
#[derive(Debug)]
pub struct HorizontalRule<'s> {
pub source: &'s str,
}
2023-04-22 02:33:10 +00:00
#[derive(Debug)]
pub struct Keyword<'s> {
pub source: &'s str,
}
2023-04-22 20:56:36 +00:00
#[derive(Debug)]
pub struct LatexEnvironment<'s> {
pub source: &'s str,
}
impl<'s> Paragraph<'s> {
pub fn of_text(input: &'s str) -> Self {
let mut objects = Vec::with_capacity(1);
2023-04-22 23:34:13 +00:00
objects.push(Object::PlainText(PlainText { 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
}
}
2023-04-22 02:04:22 +00:00
impl<'s> Source<'s> for FixedWidthArea<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
2023-04-22 02:23:59 +00:00
impl<'s> Source<'s> for HorizontalRule<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
2023-04-22 02:33:10 +00:00
impl<'s> Source<'s> for Keyword<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
2023-04-22 20:56:36 +00:00
impl<'s> Source<'s> for LatexEnvironment<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}