summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chain/src/atom/default.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/chain/src/atom/default.rs b/chain/src/atom/default.rs
index 85d652f..e156178 100644
--- a/chain/src/atom/default.rs
+++ b/chain/src/atom/default.rs
@@ -131,25 +131,24 @@ impl DefaultAtom {
println!();
}
+ /// Print virtual nodes.
+ pub fn print_virtual(&self) {
+ println!("printing virtual nodes of the atom:");
+
+ for (vn, node) in self.virtual_nodes.iter() {
+ println!("[{}]^{{({})}}: {}", vn.s, vn.t, node);
+ }
+
+ println!();
+ }
+
/// Print the underlying NFA.
pub fn print_nfa<S: AsRef<str>>(&self, filename: S) -> Result<(), std::io::Error> {
self.nfa.print_viz(filename.as_ref())?;
- let nullables: Vec<_> = self
- .accepting_vec
- .iter()
- .enumerate()
- .filter_map(|(index, pred)| if *pred { Some(index) } else { None })
- .collect();
-
- if !nullables.is_empty() {
- println!("nullables: {nullables:?}");
- }
+ self.print_nullables();
- println!("printing virtual nodes:");
- for (vn, node) in self.virtual_nodes.iter() {
- println!("[{}]^{{({})}}: {}", vn.s, vn.t, node);
- }
+ self.print_virtual();
Ok(())
}