Switching to generics.

This commit is contained in:
Tom Alexander 2022-11-26 19:46:59 -05:00
parent 0fb523e0fe
commit c1778a4f12
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 12 additions and 10 deletions

View File

@ -32,21 +32,23 @@ use nom::multi::many1;
use nom::multi::many_till;
use nom::sequence::tuple;
use nom::IResult;
use nom::InputLength;
use nom::Parser;
use tracing::instrument;
use tracing::trace;
fn context_many_till<
'r,
M: for<'s> FnMut(&'s str) -> IResult<&'s str, TextElement<'s>, VerboseError<&'s str>>,
T: for<'s> FnMut(&'s str) -> IResult<&'s str, &'s str, VerboseError<&'s str>>,
>(
fn context_many_till<'r, I, O, E, F, M, T>(
context: &'r OrgModeContextNode<'r>,
mut many_matcher: M,
mut till_matcher: T,
) -> impl for<'s> FnMut(
&'s str,
) -> IResult<&'s str, (Vec<TextElement<'s>>, &'s str), VerboseError<&'s str>> {
|i| {
) -> impl FnMut(I) -> IResult<I, (Vec<O>, F), E>
where
I: Clone + InputLength,
M: Parser<I, O, E>,
T: Parser<I, F, E>,
E: ParseError<I>,
{
move |mut i: I| {
// todo
todo!()
}
@ -68,7 +70,7 @@ pub fn paragraph<'s, 'r>(
let paragraph_context = context.with_additional_fail_matcher(&paragraph_end);
let text_element_parser = parser_with_context!(flat_text_element)(&paragraph_context);
let ret = context_many_till(&paragraph_context, text_element_parser, paragraph_end)(i);
// let ret = many_till(text_element_parser, paragraph_end)(i);
let ret = many_till(text_element_parser, paragraph_end)(i);
ret
}