Implement ptr_eq on the context types.
This commit is contained in:
parent
7ba863118f
commit
2a595e2b6c
@ -64,4 +64,12 @@ impl<T: Debug> List<T> {
|
|||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.head.is_none()
|
self.head.is_none()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn ptr_eq(&self, other: &List<T>) -> bool {
|
||||||
|
match (self.head.as_ref(), other.head.as_ref()) {
|
||||||
|
(None, None) => true,
|
||||||
|
(None, Some(_)) | (Some(_), None) => false,
|
||||||
|
(Some(me), Some(them)) => Rc::ptr_eq(me, them),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,10 @@ impl<'r> ContextTree<'r> {
|
|||||||
ContextTree { tree: List::new() }
|
ContextTree { tree: List::new() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn ptr_eq<'x>(&self, other: &ContextTree<'x>) -> bool {
|
||||||
|
self.tree.ptr_eq(&other.tree)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn with_additional_node(&self, data: ContextElement<'r>) -> ContextTree<'r> {
|
pub fn with_additional_node(&self, data: ContextElement<'r>) -> ContextTree<'r> {
|
||||||
let new_list = self.tree.push_front(data);
|
let new_list = self.tree.push_front(data);
|
||||||
ContextTree { tree: new_list }
|
ContextTree { tree: new_list }
|
||||||
|
@ -62,6 +62,11 @@ where
|
|||||||
match till_matcher(¤t_context, i.clone()) {
|
match till_matcher(¤t_context, i.clone()) {
|
||||||
Ok((remaining, finish)) => {
|
Ok((remaining, finish)) => {
|
||||||
let mut ret = Vec::new();
|
let mut ret = Vec::new();
|
||||||
|
while !current_context.ptr_eq(context) {
|
||||||
|
// todo
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
// while current_context.tr
|
||||||
// TODO build a vec of the elements by popping off the newest elements of the context
|
// TODO build a vec of the elements by popping off the newest elements of the context
|
||||||
return Ok((remaining, (ret, finish)));
|
return Ok((remaining, (ret, finish)));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user