grippo 0.3.1

Grok, regex, CEL and scrubbing on typed primitives. Up to 9 times faster than the stock Rust regex.
Documentation
// Project:   grippo
// File:      src/dialect.rs
// Purpose:   The regex language a pattern is written in
// Language:  Rust
//
// License:   Apache-2.0
// Copyright: (c) 2026 HYPERI PTY LIMITED

//! The regex language a pattern is written in, so a pattern taken from
//! another language reads as it does there or is refused by name.

/// The regex language a pattern is written in. Rust's regex syntax is the
/// default.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Dialect {
    /// Rust's regex syntax, as written.
    #[default]
    Rust,
    /// Java's `java.util.regex`: `\d`, `\w`, `\s` and `\b` are ASCII, `$`
    /// holds before a final line terminator, `.` stops at every Java line
    /// terminator, an empty match may follow a match, and Java's own syntax
    /// reads as Java reads it. strmatch reads it, and grok doesn't yet.
    Java,
    /// Oniguruma, as Oniguruma-based grok engines run it: `^` and `$` match
    /// at lines, `(?m)` lets `.` cross a newline, `\<` and `\>` are the
    /// brackets themselves, `\R` is one line break (`\r\n`, or one of LF, VT,
    /// FF, CR, NEL, LS and PS), `\d`, `\w` and `\s` are ASCII while `\b` and
    /// the POSIX brackets such as `[[:alpha:]]` are Unicode, and a final `$`
    /// allows one line terminator. grok reads it, and strmatch doesn't yet.
    Oniguruma,
    /// JavaScript's `RegExp`: `\d` and `\w` are ASCII, `\s` is JavaScript's own
    /// set, `.` stops at `\n`, `\r`, U+2028 and U+2029, `$` holds at the end
    /// alone, an empty match may follow a match, and JavaScript's own syntax
    /// reads as JavaScript reads it. strmatch reads it, and grok doesn't yet.
    JavaScript,
    /// Python's `re` on a `str`: Unicode `\d`, `\w`, `\s` and `\b` unless
    /// the a flag is set, case folding as `re` does, `$` before a final `\n`,
    /// an empty match that may follow a match, and Python's own syntax reads
    /// as Python reads it. strmatch reads it, and grok doesn't yet.
    Python,
    /// PCRE, for a pattern written for a PCRE engine. grok reads it
    /// leniently: `\<` and `\>` are the brackets themselves, a `{` that opens
    /// no interval is the brace, and a `[` inside a class is the bracket
    /// unless it opens `[:name:]`. A branch-reset group `(?|` is a plain
    /// group, since fields go by name. A possessive repeat of one class, such
    /// as `[^"]*+`, builds where what follows can never use a character it
    /// gave back, which makes it the greedy repeat. Library definitions stay
    /// as written. strmatch reads PCRE2 strictly, as pcre2test reads it in
    /// UTF mode: ASCII `\d`, `\w`, `\s` and `\b`, `$` before a final `\n`, an
    /// empty match that may follow a match, and PCRE2's own syntax, or a
    /// refusal by name.
    Pcre,
}