Identified the problem.

The issue is plain text is eating the line break so paragraph is failing since it expects a line break at the end.
This commit is contained in:
Tom Alexander
2023-03-27 18:08:17 -04:00
parent e1fbe36297
commit 028946ec90
8 changed files with 31 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ use super::error::MyError;
use super::error::Res;
use super::list::List;
use super::list::Node;
use super::util::always_fail;
use super::Context;
type Matcher = dyn for<'r, 's> Fn(Context<'r, 's>, &'s str) -> Res<&'s str, &'s str>;
@@ -64,20 +65,25 @@ impl<'r, 's> ContextTree<'r, 's> {
return at_end_of_file;
}
let blocked_context =
self.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode {
exit_matcher: ChainBehavior::IgnoreParent(Some(&always_fail)),
}));
for current_node in self.iter() {
let context_element = current_node.get_data();
match context_element {
ContextElement::ExitMatcherNode(exit_matcher) => {
match exit_matcher.exit_matcher {
ChainBehavior::AndParent(Some(matcher)) => {
let local_result = matcher(self, i);
let local_result = matcher(&blocked_context, i);
if local_result.is_ok() {
return local_result;
}
}
ChainBehavior::AndParent(None) => {}
ChainBehavior::IgnoreParent(Some(matcher)) => {
let local_result = matcher(self, i);
let local_result = matcher(&blocked_context, i);
if local_result.is_ok() {
return local_result;
}