Check the exit matcher in more places.

This commit is contained in:
Tom Alexander 2023-03-23 20:12:42 -04:00
parent 3502a31b28
commit ceb7788cfa
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@ use nom::bytes::complete::tag;
use nom::character::complete::line_ending;
use nom::character::complete::space1;
use nom::combinator::eof;
use nom::combinator::not;
use nom::combinator::recognize;
use nom::multi::many1;
use nom::multi::many1_count;
@ -63,6 +64,7 @@ impl<'s> Source<'s> for DocumentElement<'s> {
}
}
#[allow(dead_code)]
pub fn document(input: &str) -> Res<&str, Document> {
let initial_context: ContextTree<'_, '_> = ContextTree::new();
let document_context =
@ -78,6 +80,7 @@ fn section<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Sec
exit_matcher: ChainBehavior::AndParent(Some(&section_end)),
}))
.with_additional_node(ContextElement::Context("section"));
not(|i| parser_context.check_exit_matcher(i))(input)?;
todo!()
}
@ -87,6 +90,8 @@ fn section_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str,
}
fn heading<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Heading<'s>> {
not(|i| context.check_exit_matcher(i))(input)?;
let (remaining, (star_count, _ws, title, _ws2)) = headline(context, input)?;
todo!()
}

View File

@ -1,3 +1,5 @@
use nom::combinator::not;
use super::error::Res;
use super::source::Source;
use super::Context;
@ -38,5 +40,6 @@ pub fn standard_set_object<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {
not(|i| context.check_exit_matcher(i))(input)?;
todo!()
}