diff --git a/src/parser/text_element_parser.rs b/src/parser/text_element_parser.rs index 12ba53aa..075e7f30 100644 --- a/src/parser/text_element_parser.rs +++ b/src/parser/text_element_parser.rs @@ -35,13 +35,23 @@ use nom::IResult; use tracing::instrument; use tracing::trace; -fn context_many_till() { - todo!() +fn context_many_till<'r, M, T>( + context: &'r OrgModeContextNode<'r>, + many_matcher: M, + till_matcher: T, +) -> impl for<'s> FnMut( + &'s str, +) -> IResult<&'s str, (Vec>, &'s str), VerboseError<&'s str>> { + |i| { + // todo + todo!() + } } pub fn document(input: &str) -> Res<&str, Vec<(Vec, &str)>> { let initial_context = ContextTree::new(); - let ret = many1(parser_with_context!(paragraph)(&initial_context))(input); + let paragraph_parser = parser_with_context!(paragraph); + let ret = many1(paragraph_parser(&initial_context))(input); ret } @@ -53,7 +63,8 @@ pub fn paragraph<'s, 'r>( not(eof)(i)?; let paragraph_context = context.with_additional_fail_matcher(¶graph_end); let text_element_parser = parser_with_context!(flat_text_element)(¶graph_context); - let ret = many_till(text_element_parser, paragraph_end)(i); + let ret = context_many_till(¶graph_context, text_element_parser, paragraph_end)(i); + // let ret = many_till(text_element_parser, paragraph_end)(i); ret }