Switching to generics.
This commit is contained in:
parent
0fb523e0fe
commit
c1778a4f12
@ -32,21 +32,23 @@ use nom::multi::many1;
|
|||||||
use nom::multi::many_till;
|
use nom::multi::many_till;
|
||||||
use nom::sequence::tuple;
|
use nom::sequence::tuple;
|
||||||
use nom::IResult;
|
use nom::IResult;
|
||||||
|
use nom::InputLength;
|
||||||
|
use nom::Parser;
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
|
|
||||||
fn context_many_till<
|
fn context_many_till<'r, I, O, E, F, M, T>(
|
||||||
'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>>,
|
|
||||||
>(
|
|
||||||
context: &'r OrgModeContextNode<'r>,
|
context: &'r OrgModeContextNode<'r>,
|
||||||
mut many_matcher: M,
|
mut many_matcher: M,
|
||||||
mut till_matcher: T,
|
mut till_matcher: T,
|
||||||
) -> impl for<'s> FnMut(
|
) -> impl FnMut(I) -> IResult<I, (Vec<O>, F), E>
|
||||||
&'s str,
|
where
|
||||||
) -> IResult<&'s str, (Vec<TextElement<'s>>, &'s str), VerboseError<&'s str>> {
|
I: Clone + InputLength,
|
||||||
|i| {
|
M: Parser<I, O, E>,
|
||||||
|
T: Parser<I, F, E>,
|
||||||
|
E: ParseError<I>,
|
||||||
|
{
|
||||||
|
move |mut i: I| {
|
||||||
// todo
|
// todo
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
@ -68,7 +70,7 @@ pub fn paragraph<'s, 'r>(
|
|||||||
let paragraph_context = context.with_additional_fail_matcher(¶graph_end);
|
let paragraph_context = context.with_additional_fail_matcher(¶graph_end);
|
||||||
let text_element_parser = parser_with_context!(flat_text_element)(¶graph_context);
|
let text_element_parser = parser_with_context!(flat_text_element)(¶graph_context);
|
||||||
let ret = context_many_till(¶graph_context, 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);
|
let ret = many_till(text_element_parser, paragraph_end)(i);
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user