Don't increment Rc counters when checking exit matchers.
This commit is contained in:
parent
4af09a69a1
commit
c6f75e1736
@ -47,12 +47,8 @@ impl<'r, 's> ContextTree<'r, 's> {
|
||||
&'r self,
|
||||
i: &'s str,
|
||||
) -> IResult<&'s str, &'s str, VerboseError<&'s str>> {
|
||||
// TODO: Can I do this without incrementing reference counters? Perhaps via implementing an iterator over the list?
|
||||
let mut current_node = self.tree.clone();
|
||||
while !current_node.is_empty() {
|
||||
let context_element = current_node
|
||||
.get_data()
|
||||
.expect("While looop proves its Some()");
|
||||
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 {
|
||||
@ -80,10 +76,7 @@ impl<'r, 's> ContextTree<'r, 's> {
|
||||
ContextElement::PreviousElementNode(_) => {}
|
||||
ContextElement::StartOfParagraph => {}
|
||||
};
|
||||
|
||||
current_node = current_node.without_front();
|
||||
}
|
||||
|
||||
// TODO: Make this a custom error
|
||||
not(take(0usize))(i)?;
|
||||
unreachable!()
|
||||
|
Loading…
x
Reference in New Issue
Block a user