First implementation moving over to the new exit matcher class system.
This commit is contained in:
@@ -14,6 +14,7 @@ use nom::multi::many_till;
|
||||
use nom::sequence::tuple;
|
||||
|
||||
use crate::parser::element::element;
|
||||
use crate::parser::exiting::ExitClass;
|
||||
use crate::parser::object::standard_set_object;
|
||||
use crate::parser::parser_context::ChainBehavior;
|
||||
use crate::parser::parser_context::ContextElement;
|
||||
@@ -114,7 +115,8 @@ fn section<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Sec
|
||||
.with_additional_node(ContextElement::ConsumeTrailingWhitespace(true))
|
||||
.with_additional_node(ContextElement::Context("section"))
|
||||
.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode {
|
||||
exit_matcher: ChainBehavior::AndParent(Some(§ion_end)),
|
||||
class: ExitClass::Document,
|
||||
exit_matcher: §ion_end,
|
||||
}));
|
||||
let element_matcher = parser_with_context!(element)(&parser_context);
|
||||
let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context);
|
||||
@@ -123,7 +125,8 @@ fn section<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Sec
|
||||
|(children, _exit_contents)| !children.is_empty(),
|
||||
)(input)?;
|
||||
|
||||
let (remaining, _trailing_ws) = maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let (remaining, _trailing_ws) =
|
||||
maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((remaining, Section { source, children }))
|
||||
@@ -167,7 +170,8 @@ fn headline<'r, 's>(
|
||||
) -> Res<&'s str, (usize, &'s str, Vec<Object<'s>>, &'s str)> {
|
||||
let parser_context =
|
||||
context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode {
|
||||
exit_matcher: ChainBehavior::AndParent(Some(&headline_end)),
|
||||
class: ExitClass::Document,
|
||||
exit_matcher: &headline_end,
|
||||
}));
|
||||
let standard_set_object_matcher = parser_with_context!(standard_set_object)(&parser_context);
|
||||
let start_of_line_matcher = parser_with_context!(start_of_line)(&parser_context);
|
||||
|
||||
Reference in New Issue
Block a user