summaryrefslogtreecommitdiff
path: root/nfa
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-02-27 12:36:41 +0800
committerJSDurand <mmemmew@gmail.com>2023-02-27 12:36:41 +0800
commitfbaa420ed550e9c3e7cdc09d4a8ec22bfbd782a6 (patch)
treefad9722825bb3fa796dd52c3fd4a8bf46b958cf9 /nfa
parentafad02bdff111ecccb0077b9c989e869723c231c (diff)
before a major refactor
I decide to adopt a new approach of recording and updating item derivation forests. Since this affects a lot of things, I decide to commit before the refactor, so that I can create a branch for that refactor.
Diffstat (limited to 'nfa')
-rw-r--r--nfa/Cargo.toml3
-rw-r--r--nfa/src/default/regex.rs3
-rw-r--r--nfa/src/lib.rs24
3 files changed, 4 insertions, 26 deletions
diff --git a/nfa/Cargo.toml b/nfa/Cargo.toml
index 7f48760..9eac932 100644
--- a/nfa/Cargo.toml
+++ b/nfa/Cargo.toml
@@ -7,8 +7,9 @@ edition = "2021"
[dependencies]
graph = { path = "../graph", optional = true }
-receme = { path = "../receme" }
+receme = { path = "../receme", optional = true }
[features]
default = ["default-graph"]
default-graph = ["dep:graph"]
+recursion = ["dep:receme"]
diff --git a/nfa/src/default/regex.rs b/nfa/src/default/regex.rs
index 5e0d53b..1c22687 100644
--- a/nfa/src/default/regex.rs
+++ b/nfa/src/default/regex.rs
@@ -4,6 +4,7 @@ use graph::{error::Error as GError, ALGraph, ExtGraph, Graph, GraphLabel};
use crate::{desrec::DesRec, error::Error, Regex};
+#[cfg(feature = "recursion")]
use receme::{algebra::Algebra, catana::Cata};
use std::{
@@ -193,7 +194,7 @@ impl<T: GraphLabel> DefaultRegex<T> {
}
}
-// REVIEW: This may not be needed.
+#[cfg(feature = "recursion")]
impl<S: GraphLabel, T, A> Cata<T, Vec<T>, A> for &DefaultRegex<S>
where
A: Algebra<T, Vec<T>>,
diff --git a/nfa/src/lib.rs b/nfa/src/lib.rs
index 07bbd5a..de71f25 100644
--- a/nfa/src/lib.rs
+++ b/nfa/src/lib.rs
@@ -210,17 +210,6 @@ pub trait Nfa<T: GraphLabel>: LabelExtGraph<T> {
/// different type for the result type.
type FromRegex<S: GraphLabel + Display + Default>;
- // FIXME: This should not be needed.
- /// Remove all empty transitions from the nondeterministic finite
- /// automaton.
- #[inline]
- fn remove_epsilon<F>(&mut self, _f: F) -> Result<(), Error>
- where
- F: FnMut(T) -> bool,
- {
- unimplemented!("deprecated")
- }
-
/// Return a state-minimal NFA equivalent with the original one.
///
/// This is not required. It is just to allow me to experiment
@@ -299,19 +288,6 @@ pub trait Nfa<T: GraphLabel>: LabelExtGraph<T> {
/// edges. We can call this "a poor man's removal of nodes".
fn remove_dead(&mut self, reserve: impl FnMut(usize) -> bool) -> Result<(), Error>;
- // FIXME: This should not be needed.
- /// For each edge from A to B whose edge is considered nullable by
- /// a function `f`, and for every edge from B to C, add an edge
- /// from A to C.
- ///
- /// This is needed specifically by the algorithm to produce a set
- /// of atomic languages that represent "null-closed" derived
- /// languages.
- #[inline]
- fn nulling(&mut self, _f: impl FnMut(T) -> bool) -> Result<(), Error> {
- unimplemented!("deprecated")
- }
-
/// Return the *closure* of the nondeterministic finite automaton.
///
/// # Definition