diff options
author | JSDurand <mmemmew@gmail.com> | 2023-07-21 11:45:16 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-07-21 11:45:16 +0800 |
commit | aac64480aa68dadb87cf9649c04571bf39cff29c (patch) | |
tree | fadff76fc5f30a41ff9edfb88c62b4224155f6c1 /chain/src | |
parent | 081e3d2ed8d3f9b4e4d6fd864283a4230e09b25a (diff) |
bump version
This bumping of version is insignificant. I just find it notable that
I seem to finally obtain a version without trivial bugs. Hooray!
Diffstat (limited to 'chain/src')
-rw-r--r-- | chain/src/archive.txt | 103 | ||||
-rw-r--r-- | chain/src/item/default/mod.rs | 2 |
2 files changed, 104 insertions, 1 deletions
diff --git a/chain/src/archive.txt b/chain/src/archive.txt index 79fe6d8..c93b4fe 100644 --- a/chain/src/archive.txt +++ b/chain/src/archive.txt @@ -638,3 +638,106 @@ // } // Ok(()) + +// let parents: Vec<_> = { +// if old_label.clone_index().is_some() { +// let mut parents = self.parents_of(node)?; +// assert_eq!(parents.len(), 1); +// node = parents.next().unwrap().node(); +// } + +// let parents: Vec<_> = self.parents_of(node)?.collect(); + +// let mut result: Vec<(Parent, usize)> = Vec::with_capacity( +// parents +// .iter() +// .map(|parent| { +// self.parents_of(parent.node()) +// .map(|iter| iter.len()) +// .unwrap_or(0) +// }) +// .sum(), +// ); + +// for parent in parents { +// let mut parent_label = self +// .vertex_label(parent.node())? +// .ok_or_else(|| Error::NodeNoLabel(parent.node()))? +// .label(); + +// assert!(get_rule_label(parent_label).is_some()); + +// if self.degree(parent.node())? != 1 { +// dbg!(parent); +// self.print_viz("dbg forest.gv").unwrap(); + +// panic!("assumption fails"); +// } + +// parent_label.set_end_option(end); + +// let parent_label = ForestLabel::from(parent_label); + +// let mut builder = PLGBuilderMut::from_graph_mut(&mut self.graph); + +// let new_parent = builder.add_vertex(parent_label); + +// if let Some(packed) = new_packed { +// builder.add_edge(new_parent, packed, new_label)?; +// } else { +// builder.add_edge(new_parent, new_node, new_label)?; +// } + +// result.extend( +// self.parents_of(parent.node())? +// .map(|parent_parent| (parent_parent, new_parent)), +// ); +// } + +// result +// }; + +// for (parent, new_child) in parents { +// if !completingp { +// if self.has_same_children_until( +// parent.node(), +// parent.node(), +// parent.edge(), +// new_child, +// )? { +// continue; +// } + +// // we don't add a child to parent.edge() here. +// let cloned = self.clone_node(parent.node(), parent.edge(), false)?; + +// let mut builder = PLGBuilderMut::from_graph_mut(&mut self.graph); + +// builder.add_edge(cloned, new_child, new_label)?; +// } else { +// if self.has_same_children_except( +// parent.node(), +// parent.node(), +// parent.edge(), +// new_child, +// )? { +// continue; +// } + +// // we don't add a child to parent.edge() here. +// let cloned = self.clone_node(parent.node(), parent.edge(), false)?; + +// let mut builder = PLGBuilderMut::from_graph_mut(&mut self.graph); + +// builder.add_edge(cloned, new_child, new_label)?; + +// let children_to_add: Vec<_> = builder +// .children_of(parent.node())? +// .skip(parent.edge() + 1) +// .collect(); + +// for child in children_to_add { +// builder.add_edge(cloned, child, new_label)?; +// } +// } +// } diff --git a/chain/src/item/default/mod.rs b/chain/src/item/default/mod.rs index e0e2296..0dc613b 100644 --- a/chain/src/item/default/mod.rs +++ b/chain/src/item/default/mod.rs @@ -1596,7 +1596,7 @@ mod item_test { let atom = DefaultAtom::from_grammar(grammar)?; - // atom.print_nullables(); + atom.print_nullables(); let mut forest: DefaultForest<ForestLabel<GrammarLabel>> = DefaultForest::new_leaf_raw( ForestLabel::new(GrammarLabel::new(TNT::Non(0), 0), ForestLabelType::Plain), |