summaryrefslogtreecommitdiff
path: root/chain/src/item
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-08-04 10:12:04 +0800
committerJSDurand <mmemmew@gmail.com>2023-08-04 10:12:04 +0800
commit7033187abaf42772097377c0a1ffc2cd4cefdada (patch)
tree4fe0801fd07d965d009570f984c88af363a5bc7e /chain/src/item
parent228b51fe7941e2b180ee3ea99dfea4bfcbd6770b (diff)
minor adjustments
Not bug deals but adjustments of details.
Diffstat (limited to 'chain/src/item')
-rw-r--r--chain/src/item/default/extract.rs4
-rw-r--r--chain/src/item/genins.rs21
-rw-r--r--chain/src/item/reduction.rs5
3 files changed, 23 insertions, 7 deletions
diff --git a/chain/src/item/default/extract.rs b/chain/src/item/default/extract.rs
index b99c541..c34f1da 100644
--- a/chain/src/item/default/extract.rs
+++ b/chain/src/item/default/extract.rs
@@ -82,7 +82,7 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
}
}
- dbg!(&validity_array);
+ // dbg!(&validity_array);
// A stack for propagating the falsehood to parents and
// children of incomplete nodes, like a plague. The only
@@ -141,7 +141,7 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
};
}
- dbg!(&validity_array);
+ // dbg!(&validity_array);
if validity_array.iter().all(|validity| !*validity) {
// every element is false
diff --git a/chain/src/item/genins.rs b/chain/src/item/genins.rs
index d5fb678..262728f 100644
--- a/chain/src/item/genins.rs
+++ b/chain/src/item/genins.rs
@@ -212,6 +212,7 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
// Whether or not to print detailed graphs of each step of
// operation for debugging purposes.
let mut to_print = false;
+ // let mut to_print = (8..=10).contains(&pos);
if std::fs::metadata("output/").is_err() {
to_print = false;
@@ -418,6 +419,10 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
.collect();
}
+ // if pos == 9 {
+ // dbg!(&parents);
+ // }
+
let mut non_empty = false;
for atom_child in atom_child_iter {
@@ -431,6 +436,10 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
let mut stack = parents.clone();
let mut second_stack = Vec::new();
+ // if pos == 9 {
+ // dbg!(&reduction_info);
+ // }
+
// locate the nodes
for reduction_nt in reduction_info.iter().copied().flatten().rev() {
while let Some(mut node) = stack.pop() {
@@ -438,6 +447,10 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
.vertex_label(node.node())?
.ok_or_else(|| Error::NodeNoLabel(node.node()))?;
+ // if pos == 9 {
+ // dbg!(node);
+ // }
+
if matches!(
node_label
.label()
@@ -537,6 +550,10 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
return Err(Error::CannotPlant);
}
+ // if pos == 9 {
+ // dbg!(&stack);
+ // }
+
for parent in stack {
let splanted = self.splant(parent.node(), parent.edge(), fragment, non_empty)?;
@@ -650,6 +667,10 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
PaVi::Virtual(nt, t, nth_child)
};
+ // let dbg_string = format!("pos {pos} - {num} {tnt_string} result {result}");
+
+ // dbg!(dbg_string);
+
Ok(result)
}
diff --git a/chain/src/item/reduction.rs b/chain/src/item/reduction.rs
index 512862a..8f7471c 100644
--- a/chain/src/item/reduction.rs
+++ b/chain/src/item/reduction.rs
@@ -412,11 +412,6 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
// NOTE: We must fix the order from top to bottom: this is the
// reverse order of `order_of_correct_ends` .
- // if node == 15 && pos == 2 {
- // dbg!(&order_of_correct_ends);
- // let _ = self.print_viz("pos before splone.gv");
- // }
-
for node in order_of_correct_ends.into_iter().rev() {
let label = self.vertex_label(node)?.ok_or(Error::NodeNoLabel(node))?;
let degree = self.degree(node)?;