Add start of paragraph context.
This commit is contained in:
parent
b2742f89e2
commit
972ffa6345
@ -67,6 +67,7 @@ impl<'r, 's> ContextTree<'r, 's> {
|
||||
};
|
||||
}
|
||||
ContextElement::PreviousElementNode(_) => {}
|
||||
ContextElement::StartOfParagraph => {}
|
||||
};
|
||||
|
||||
current_node = current_node.without_front();
|
||||
@ -82,6 +83,7 @@ impl<'r, 's> ContextTree<'r, 's> {
|
||||
pub enum ContextElement<'r, 's> {
|
||||
FailMatcherNode(FailMatcherNode<'r>),
|
||||
PreviousElementNode(PreviousElementNode<'s>),
|
||||
StartOfParagraph,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -63,6 +63,7 @@ where
|
||||
current_context = next_context;
|
||||
match context_element {
|
||||
ContextElement::FailMatcherNode(_) => {}
|
||||
ContextElement::StartOfParagraph => {}
|
||||
ContextElement::PreviousElementNode(PreviousElementNode {
|
||||
element: token,
|
||||
}) => {
|
||||
@ -123,8 +124,9 @@ pub fn paragraph<'s, 'r>(
|
||||
) -> Res<&'s str, (Vec<TextElement<'s>>, &'s str)> {
|
||||
// Add a not(eof) check because many_till cannot match a zero-length string
|
||||
not(eof)(i)?;
|
||||
let paragraph_context =
|
||||
context.with_additional_node(ContextElement::FailMatcherNode(FailMatcherNode {
|
||||
let paragraph_context = context
|
||||
.with_additional_node(ContextElement::StartOfParagraph)
|
||||
.with_additional_node(ContextElement::FailMatcherNode(FailMatcherNode {
|
||||
fail_matcher: ChainBehavior::AndParent(Some(¶graph_end)),
|
||||
}));
|
||||
let (remaining, (many, till)) =
|
||||
|
Loading…
x
Reference in New Issue
Block a user