diff --git a/src/parser/text_element_parser.rs b/src/parser/text_element_parser.rs index 3979482e..50b80bb1 100644 --- a/src/parser/text_element_parser.rs +++ b/src/parser/text_element_parser.rs @@ -89,8 +89,8 @@ pub fn document(input: &str) -> Res<&str, Vec<(Vec, &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>, &'s str)> where @@ -101,15 +101,19 @@ where let paragraph_context = context.with_additional_node(FailMatcherNode { fail_matcher: ChainBehavior::AndParent(Some(¶graph_end)), }); + let ret = { + let text_element_parser = parser_with_context!(flat_text_element)(¶graph_context); + many_till(text_element_parser, paragraph_end)(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 = context_many_till(¶graph_context, text_element_parser, paragraph_end)(i); + // 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 = 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, {