From fbaa420ed550e9c3e7cdc09d4a8ec22bfbd782a6 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Mon, 27 Feb 2023 12:36:41 +0800 Subject: 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. --- nfa/Cargo.toml | 3 ++- nfa/src/default/regex.rs | 3 ++- nfa/src/lib.rs | 24 ------------------------ 3 files changed, 4 insertions(+), 26 deletions(-) (limited to 'nfa') 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 DefaultRegex { } } -// REVIEW: This may not be needed. +#[cfg(feature = "recursion")] impl Cata, A> for &DefaultRegex where A: Algebra>, 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: LabelExtGraph { /// different type for the result type. type FromRegex; - // FIXME: This should not be needed. - /// Remove all empty transitions from the nondeterministic finite - /// automaton. - #[inline] - fn remove_epsilon(&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: LabelExtGraph { /// 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 -- cgit v1.2.3-18-g5258