aboutsummaryrefslogtreecommitdiffstats
path: root/src/parse/regex/enfa.rs
diff options
context:
space:
mode:
authorJonas Maier <jonas@x77.dev>2026-06-05 21:22:44 +0200
committerJonas Maier <jonas@x77.dev>2026-06-05 21:22:44 +0200
commit05f3f381d0066b2e6116470f4e6251ae191aaefe (patch)
tree063d31bdc10e25a9e97d15cdaddb625a9fcd199f /src/parse/regex/enfa.rs
parent65013cb7441dcd56d362613e1ebc469756613b24 (diff)
downloadpish-05f3f381d0066b2e6116470f4e6251ae191aaefe.tar.gz
regex compiler compiles
Diffstat (limited to 'src/parse/regex/enfa.rs')
-rw-r--r--src/parse/regex/enfa.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/parse/regex/enfa.rs b/src/parse/regex/enfa.rs
index 272c709..dd3839f 100644
--- a/src/parse/regex/enfa.rs
+++ b/src/parse/regex/enfa.rs
@@ -637,6 +637,7 @@ impl EState {
#[derive(Debug)]
pub enum EnfaTranslationError {
+ CharacterClassNotSupported,
AssertionsNotSupported,
}
@@ -656,6 +657,9 @@ impl TryFrom<Pattern> for ENFA {
EState::terminal(),
],
},
+ Pattern::CharacterClass(_) => {
+ return Err(EnfaTranslationError::CharacterClassNotSupported);
+ }
Pattern::Alt(alts) => {
let nfas: Vec<ENFA> = alts
.into_iter()
@@ -683,13 +687,13 @@ impl TryFrom<Pattern> for ENFA {
.collect::<Result<_, _>>()?;
Self::concat(nfas)
}
- Pattern::Rep(regex, min, None) => {
+ Pattern::Rep(regex, min, None, _) => {
let nfa = ENFA::try_from(*regex)?;
let base = nfa.clone().repeat(min as usize);
let tail = nfa.looping();
Self::concat(vec![base, tail])
}
- Pattern::Rep(regex, min, Some(max)) => {
+ Pattern::Rep(regex, min, Some(max), _) => {
assert!(min < max);
let nfa = Self::try_from(*regex)?;
let base = nfa.clone().repeat(min as usize);