Type issue with returning the elements.

This commit is contained in:
Tom Alexander 2022-12-10 22:20:29 -05:00
parent 2a595e2b6c
commit a88117f731
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 21 additions and 3 deletions

View File

@ -27,6 +27,11 @@ impl<'r> ContextTree<'r> {
ContextTree { tree: new_list }
}
pub fn pop_front(&mut self) -> (Option<ContextElement<'r>>, ContextTree<'r>) {
// todo
todo!()
}
pub fn check_fail_matcher<'s>(
&'r self,
i: &'s str,

View File

@ -63,10 +63,23 @@ where
Ok((remaining, finish)) => {
let mut ret = Vec::new();
while !current_context.ptr_eq(context) {
// todo
todo!()
let (context_element, next_context) = current_context.pop_front();
let context_element = context_element.expect("We only pop off context elements created in this function, so they are all Some()");
current_context = next_context;
match context_element {
ContextElement::FailMatcherNode(_) => {}
ContextElement::PreviousElementNode(PreviousElementNode {
element: token,
}) => {
match token {
Token::TextElement(text_element) => {
ret.push(text_element);
}
};
}
};
}
// while current_context.tr
// TODO build a vec of the elements by popping off the newest elements of the context
return Ok((remaining, (ret, finish)));
}