Simple version of the headline parser done.

This commit is contained in:
Tom Alexander 2023-03-23 20:03:45 -04:00
parent 4f10f2abec
commit 3502a31b28
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -18,6 +18,7 @@ use crate::parser::parser_context::ExitMatcherNode;
use super::element::Element; use super::element::Element;
use super::error::Res; use super::error::Res;
use super::object::Object;
use super::parser_with_context::parser_with_context; use super::parser_with_context::parser_with_context;
use super::source::Source; use super::source::Source;
use super::Context; use super::Context;
@ -89,7 +90,10 @@ fn heading<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Hea
todo!() todo!()
} }
fn headline<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> { fn headline<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, (usize, &'s str, Vec<Object<'s>>, &'s str)> {
let document_root = context.get_document_root().unwrap(); let document_root = context.get_document_root().unwrap();
let preceding_character = get_one_before(document_root, input) let preceding_character = get_one_before(document_root, input)
.map(|slice| slice.chars().next()) .map(|slice| slice.chars().next())
@ -112,14 +116,13 @@ fn headline<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'
})); }));
let standard_set_object_matcher = parser_with_context!(standard_set_object)(&parser_context); let standard_set_object_matcher = parser_with_context!(standard_set_object)(&parser_context);
let foo = tuple(( let ret = tuple((
many1_count(tag("*")), many1_count(tag("*")),
space1, space1,
many1(standard_set_object_matcher), many1(standard_set_object_matcher),
alt((line_ending, eof)), alt((line_ending, eof)),
))(input)?; ))(input);
ret
todo!()
} }
fn headline_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> { fn headline_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {