Join the plain list item tag end matchers again.

This commit is contained in:
Tom Alexander
2023-09-11 10:13:22 -04:00
parent 8440a3b256
commit 1f11bfa2ec
3 changed files with 14 additions and 27 deletions

View File

@@ -301,18 +301,11 @@ fn item_tag<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Vec<Object<'s>>> {
let contexts = [
ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Gamma,
exit_matcher: &item_tag_line_ending_end,
}),
ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Delta,
exit_matcher: &item_tag_end,
}),
];
let parser_context = context.with_additional_node(&contexts[0]);
let parser_context = parser_context.with_additional_node(&contexts[1]);
let parser_context = ContextElement::ExitMatcherNode(ExitMatcherNode {
class: ExitClass::Gamma,
exit_matcher: &item_tag_end,
});
let parser_context = context.with_additional_node(&parser_context);
let (remaining, (children, _exit_contents)) = verify(
many_till(
// TODO: Should this be using a different set like the minimal set?
@@ -330,19 +323,14 @@ fn item_tag_end<'b, 'g, 'r, 's>(
_context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(tuple((
one_of(" \t"),
tag("::"),
alt((recognize(one_of(" \t")), line_ending, eof)),
)))(input)
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn item_tag_line_ending_end<'b, 'g, 'r, 's>(
_context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
line_ending(input)
alt((
recognize(tuple((
one_of(" \t"),
tag("::"),
alt((recognize(one_of(" \t")), line_ending, eof)),
))),
line_ending,
))(input)
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]