Starting an unbound matcher type to allow unbound matchers as parameters to context_many_till.

This commit is contained in:
Tom Alexander 2022-12-03 22:44:53 -05:00
parent 6cfc39ca45
commit 05b3ac1725
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -39,6 +39,9 @@ use nom::Parser;
use tracing::instrument;
use tracing::trace;
type UnboundMatcher<'r> =
dyn for<'s> Fn(Context<'r>, &'s str) -> IResult<&'s str, &'s str, VerboseError<&'s str>>;
fn context_many_till<'r, I, O, E, F, M, T>(
context: Context<'r>,
mut many_matcher: M,
@ -101,12 +104,8 @@ pub fn paragraph<'s, 'r>(
}));
let ret = {
let text_element_parser = parser_with_context!(flat_text_element)(paragraph_context);
many_till(text_element_parser, paragraph_end)(i)
context_many_till(&paragraph_context, text_element_parser, paragraph_end)(i)
};
// 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);
ret
}