From 05f3f381d0066b2e6116470f4e6251ae191aaefe Mon Sep 17 00:00:00 2001 From: Jonas Maier Date: Fri, 5 Jun 2026 21:22:44 +0200 Subject: regex compiler compiles --- src/parse/regex/enfa.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/parse/regex/enfa.rs') 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 for ENFA { EState::terminal(), ], }, + Pattern::CharacterClass(_) => { + return Err(EnfaTranslationError::CharacterClassNotSupported); + } Pattern::Alt(alts) => { let nfas: Vec = alts .into_iter() @@ -683,13 +687,13 @@ impl TryFrom for ENFA { .collect::>()?; 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); -- cgit v1.2.3