This commit is contained in:
Tom Alexander 2022-12-03 19:38:04 -05:00
parent 8608136124
commit b9034147a6
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 18 additions and 8 deletions

View File

@ -89,8 +89,8 @@ pub fn document(input: &str) -> Res<&str, Vec<(Vec<TextElement>, &str)>> {
ret
}
pub fn paragraph<'s, 'r, C>(
context: &'r ContextTree<'r, C>,
pub fn paragraph<'s, 'x: 'r, 'r, C>(
context: &'x ContextTree<'r, C>,
i: &'s str,
) -> Res<&'s str, (Vec<TextElement<'s>>, &'s str)>
where
@ -101,15 +101,19 @@ where
let paragraph_context = context.with_additional_node(FailMatcherNode {
fail_matcher: ChainBehavior::AndParent(Some(&paragraph_end)),
});
let ret = {
let text_element_parser = parser_with_context!(flat_text_element)(&paragraph_context);
many_till(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 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
}
fn flat_text_element<'s, 'r, C>(
context: &'r ContextTree<'r, C>,
fn flat_text_element<'s, 'x: 'r, 'r, C>(
context: &'x ContextTree<'r, C>,
i: &'s str,
) -> Res<&'s str, TextElement<'s>>
where
@ -136,7 +140,10 @@ fn recognize_bold_end(input: &str) -> Res<&str, &str> {
recognize(bold_end)(input)
}
fn flat_bold<'s, 'r, C>(context: &'r ContextTree<'r, C>, i: &'s str) -> Res<&'s str, Bold<'s>>
fn flat_bold<'s, 'x: 'r, 'r, C>(
context: &'x ContextTree<'r, C>,
i: &'s str,
) -> Res<&'s str, Bold<'s>>
where
C: ContextElement,
{
@ -157,7 +164,10 @@ fn recognize_link_end(input: &str) -> Res<&str, &str> {
recognize(link_end)(input)
}
fn flat_link<'s, 'r, C>(context: &'r ContextTree<'r, C>, i: &'s str) -> Res<&'s str, Link<'s>>
fn flat_link<'s, 'x: 'r, 'r, C>(
context: &'x ContextTree<'r, C>,
i: &'s str,
) -> Res<&'s str, Link<'s>>
where
C: ContextElement,
{