aboutsummaryrefslogtreecommitdiffstats
path: root/src/run
diff options
context:
space:
mode:
Diffstat (limited to 'src/run')
-rw-r--r--src/run/builtin.rs33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/run/builtin.rs b/src/run/builtin.rs
index 45d33e2..2d19348 100644
--- a/src/run/builtin.rs
+++ b/src/run/builtin.rs
@@ -1039,7 +1039,7 @@ impl Builtin for pish_theme {
#[cfg(debug_assertions)]
mod dbg {
- use crate::regex::{dfa::DFA, enfa::ENFA};
+ use crate::regex::{AllEngines, RegexEngine};
use super::*;
@@ -1123,17 +1123,30 @@ mod dbg {
}
};
- let nfa = match ENFA::try_from(regex) {
- Ok(nfa) => nfa,
- Err(err) => {
- writeln!(stdout, "nfa error: {err:?}")?;
- return Err(Error::Exit(2));
- }
+ let Ok(compiled) = AllEngines::compile(regex) else {
+ writeln!(stdout, "failed to compile.")?;
+ return Err(Error::Exit(2));
};
- writeln!(stdout, "{nfa:?}")?;
- let dfa = DFA::from(nfa);
- writeln!(stdout, "{dfa:?}")?;
+ if let Some(dfa) = compiled.dfa.as_ref() {
+ writeln!(stdout, "{dfa:?}")?;
+ }
+
+ if let Some(bc) = compiled.bc.as_ref() {
+ writeln!(stdout, "{bc:?}")?;
+ }
+
+ if compiled.any.is_some() {
+ writeln!(stdout, "any")?;
+ }
+
+ if compiled.nothing.is_some() {
+ writeln!(stdout, "nothing")?;
+ }
+
+ if let Some(exact) = compiled.exact.as_ref() {
+ writeln!(stdout, "exact({})", exact.bytes.escape_ascii())?;
+ }
Ok(())
}