diff options
| author | Jonas Maier <jonas@x77.dev> | 2026-06-05 21:22:44 +0200 |
|---|---|---|
| committer | Jonas Maier <jonas@x77.dev> | 2026-06-05 21:22:44 +0200 |
| commit | 05f3f381d0066b2e6116470f4e6251ae191aaefe (patch) | |
| tree | 063d31bdc10e25a9e97d15cdaddb625a9fcd199f /src/parse/regex/enfa.rs | |
| parent | 65013cb7441dcd56d362613e1ebc469756613b24 (diff) | |
| download | pish-05f3f381d0066b2e6116470f4e6251ae191aaefe.tar.gz | |
regex compiler compiles
Diffstat (limited to 'src/parse/regex/enfa.rs')
| -rw-r--r-- | src/parse/regex/enfa.rs | 8 |
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); |
