aboutsummaryrefslogtreecommitdiff
path: root/forest/src/archive_default.txt
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2026-10-16 14:01:01 +0800
committerJSDurand <mmemmew@gmail.com>2026-10-16 14:02:10 +0800
commitfba9a90cfc6aca2a26cce72f55fb261789139781 (patch)
treeb4b121791ad639e745df689c0d5a8ed7a9e5dcc4 /forest/src/archive_default.txt
parent3ae0cf9898485a2ec35df7d23cd274e7dea5796d (diff)
new startHEADmaster
Now I tested and discussed with claude, and had a working version of this project. The rest is to port the claude version to my own writings. So this serves as the starting point before that attempt. In the new attempt the design is better, and a number of bugs were found and supposedly fixed, so let us see how this goes at the end.
Diffstat (limited to 'forest/src/archive_default.txt')
-rw-r--r--forest/src/archive_default.txt81
1 files changed, 81 insertions, 0 deletions
diff --git a/forest/src/archive_default.txt b/forest/src/archive_default.txt
index 5572ecc..d6e4e2e 100644
--- a/forest/src/archive_default.txt
+++ b/forest/src/archive_default.txt
@@ -523,3 +523,84 @@ mod forest_test {
Ok(())
}
}
+
+// #[derive(Debug, Clone, Copy)]
+// enum Item<T: Copy + Clone + std::fmt::Debug> {
+// Seen(T),
+// Unseen(T),
+// }
+
+// use Item::*;
+
+// impl<T: Copy + Clone + std::fmt::Debug> Item<T> {
+// fn is_seen(self) -> bool {
+// matches!(self, Self::Seen(_))
+// }
+
+// fn value(&self) -> T {
+// match self {
+// Seen(v) => *v,
+// Unseen(v) => *v,
+// }
+// }
+// }
+
+// let query_len = self.query.nodes_len();
+
+// let forest_len = forest.nodes_len();
+
+// let mut stack: Vec<(SkipState, usize)> = Vec::with_capacity(forest_len);
+
+// stack.push((SkipState::Any, root));
+
+// let mut query_stack: Vec<usize> = Vec::with_capacity(query_len);
+
+// query_stack.push(query_root);
+
+// let mut match_result = false;
+
+// 'search: while let Some(item) = stack.pop() {
+// // if item.is_seen() {
+// // if match_result {
+// // continue;
+// // }
+
+// // // fallback
+// // }
+
+// let (state, top) = item;
+
+// let qtop = if let Some(qtop) = query_stack.last() {
+// *qtop
+// } else {
+// panic!("Query stack becomes empty");
+// };
+
+// let top_label = forest.vertex_label(top)?.ok_or(QRError::NodeNoLabel(top))?;
+
+// // let top_status = top_label.status();
+
+// if top_label.is_packed() {
+// self.packs.push((top, 0));
+
+// stack.try_reserve(forest.degree(top)?)?;
+
+// stack.extend(forest.children_of(top)?.map(|child| (state, child)));
+
+// continue 'search;
+// }
+
+// let query_label = self.query.label_of_vertex(qtop)?;
+
+// if query_label.matches(top_label.label(), top_label.status()) {
+// // Success branch
+
+// match_result = true;
+
+// // TODO: Deal with captures later
+// } else {
+// // Failure branch
+
+// match_result = false;
+// }
+// }