Update flat_bold to context_many_till.
This commit is contained in:
parent
972ffa6345
commit
88bf1b3d8b
@ -118,6 +118,10 @@ pub fn context_paragraph_end<'s, 'r>(
|
||||
paragraph_end(input)
|
||||
}
|
||||
|
||||
pub fn context_bold_end<'s, 'r>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
||||
recognize(bold_end)(input)
|
||||
}
|
||||
|
||||
pub fn paragraph<'s, 'r>(
|
||||
context: Context<'r, 's>,
|
||||
i: &'s str,
|
||||
@ -170,11 +174,9 @@ fn flat_bold<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Bold<
|
||||
context.with_additional_node(ContextElement::FailMatcherNode(FailMatcherNode {
|
||||
fail_matcher: ChainBehavior::AndParent(Some(&recognize_bold_end)),
|
||||
}));
|
||||
// let nom_context = context.with_additional_fail_matcher(&recognize_bold_end);
|
||||
let text_element_parser = parser_with_context!(flat_text_element)(nom_context);
|
||||
let (remaining, captured) = recognize(tuple((
|
||||
bold_start,
|
||||
many_till(text_element_parser, bold_end),
|
||||
|i| context_many_till(&nom_context, flat_text_element, context_bold_end)(i),
|
||||
)))(i)?;
|
||||
let ret = Bold { contents: captured };
|
||||
Ok((remaining, ret))
|
||||
|
Loading…
x
Reference in New Issue
Block a user