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
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 14 additions and 27 deletions

View File

@ -108,7 +108,7 @@ impl<'g, 'r, 's> Context<'g, 'r, 's> {
&'r self, &'r self,
i: OrgSource<'s>, i: OrgSource<'s>,
) -> IResult<OrgSource<'s>, OrgSource<'s>, CustomError<OrgSource<'s>>> { ) -> IResult<OrgSource<'s>, OrgSource<'s>, CustomError<OrgSource<'s>>> {
let mut current_class_filter = ExitClass::Delta; let mut current_class_filter = ExitClass::Gamma;
for current_node in self.iter_context() { for current_node in self.iter_context() {
let context_element = current_node.get_data(); let context_element = current_node.get_data();
match context_element { match context_element {

View File

@ -4,7 +4,6 @@ pub enum ExitClass {
Alpha = 2, Alpha = 2,
Beta = 3, Beta = 3,
Gamma = 4, Gamma = 4,
Delta = 5,
} }
impl std::fmt::Display for ExitClass { impl std::fmt::Display for ExitClass {

View File

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