summaryrefslogtreecommitdiff
path: root/chain/src/atom
diff options
context:
space:
mode:
Diffstat (limited to 'chain/src/atom')
-rw-r--r--chain/src/atom/default.rs7
-rw-r--r--chain/src/atom/mod.rs3
2 files changed, 10 insertions, 0 deletions
diff --git a/chain/src/atom/default.rs b/chain/src/atom/default.rs
index 6883907..317090e 100644
--- a/chain/src/atom/default.rs
+++ b/chain/src/atom/default.rs
@@ -507,6 +507,9 @@ impl DefaultAtom {
DError::InvalidClone(_) => {
unreachable!("we are not cloning")
}
+ DError::CannotClose(_, _, _, _) => {
+ unreachable!("we are not closing virtual nodes")
+ }
DError::Invalid => {
panic!("a label is wrongly planted?")
}
@@ -713,4 +716,8 @@ impl Atom for DefaultAtom {
.get(&trace)
.map(|set| set.iter().copied())
}
+
+ fn accepting_len(&self) -> usize {
+ self.accepting_vec.len()
+ }
}
diff --git a/chain/src/atom/mod.rs b/chain/src/atom/mod.rs
index c9dadb2..4b3bfce 100644
--- a/chain/src/atom/mod.rs
+++ b/chain/src/atom/mod.rs
@@ -32,6 +32,9 @@ pub trait Atom: Nfa<LabelType<TNT>> + Deref<Target = Grammar> {
/// Tell whether a node is accepting.
fn is_accepting(&self, node_id: usize) -> Result<bool, GrammarError>;
+
+ /// Return the bound for `is_accepting`.
+ fn accepting_len(&self) -> usize;
}
pub mod default;