Type Alias Regex

Source
pub type Regex<S> = Regex<Default<S>>;
Expand description

Regular expressions over symbols of the given alphabet.

Aliased Type§

pub enum Regex<S> {
    EmptySet,
    EmptyString,
    Symbol(<ApproximatelySimilarCanonical<S> as Builder>::Symbol),
    Concat(Box<Regex<ApproximatelySimilarCanonical<S>>>, Box<Regex<ApproximatelySimilarCanonical<S>>>),
    Closure(Box<Regex<ApproximatelySimilarCanonical<S>>>),
    Or(Box<Regex<ApproximatelySimilarCanonical<S>>>, Box<Regex<ApproximatelySimilarCanonical<S>>>),
    And(Box<Regex<ApproximatelySimilarCanonical<S>>>, Box<Regex<ApproximatelySimilarCanonical<S>>>),
    Complement(Box<Regex<ApproximatelySimilarCanonical<S>>>),
}

Variants§

§

EmptySet

The empty set

§

EmptyString

The empty string ε

§

Symbol(<ApproximatelySimilarCanonical<S> as Builder>::Symbol)

A symbol s

§

Concat(Box<Regex<ApproximatelySimilarCanonical<S>>>, Box<Regex<ApproximatelySimilarCanonical<S>>>)

Concatenation R S

§

Closure(Box<Regex<ApproximatelySimilarCanonical<S>>>)

Closure R*

§

Or(Box<Regex<ApproximatelySimilarCanonical<S>>>, Box<Regex<ApproximatelySimilarCanonical<S>>>)

Disjunction R | S

§

And(Box<Regex<ApproximatelySimilarCanonical<S>>>, Box<Regex<ApproximatelySimilarCanonical<S>>>)

Conjunction R & R

§

Complement(Box<Regex<ApproximatelySimilarCanonical<S>>>)

Complement ¬R

Implementations

Source§

impl<S: Alphabet> Regex<ApproximatelySimilarCanonical<S>>

Source

pub fn to_automaton(&self) -> FiniteAutomaton<S>

Returns a finite automaton for this regular expression.

Source§

impl<B: Builder> Regex<B>

Source

pub fn rebuild<X: Builder<Symbol = B::Symbol>>(&self) -> Regex<X>

Rebuild this regular expression using a different builder over the same symbol type.

Source§

impl<B: Builder> Regex<B>

Source

pub fn empty_set() -> Self

Source

pub fn empty_string() -> Self

Source

pub fn symbol(value: B::Symbol) -> Self

Source

pub fn closure(inner: Self) -> Self

Source

pub fn concat(left: Self, right: Self) -> Self

Source

pub fn or(left: Self, right: Self) -> Self

Source

pub fn and(left: Self, right: Self) -> Self

Source

pub fn complement(inner: Self) -> Self

Source§

impl<B: Builder> Regex<B>

Source

pub fn derive_iter<I>(&self, symbols: impl IntoIterator<Item = I>) -> Regex<B>
where I: Borrow<B::Symbol>,

Returns the derivative of this regular expression w.r.t. the given symbols.

Source

pub fn derive(&self, symbol: &B::Symbol) -> Regex<B>

Returns the derivative of this regular expression w.r.t. to the given symbol.

Source

pub fn matches<I>(&self, symbols: impl IntoIterator<Item = I>) -> bool
where I: Borrow<B::Symbol>,

Returns whether the string of symbols is in the language of this regular expression.

Source§

impl<B: Builder> Regex<B>

Source

pub fn is_nullable(&self) -> bool

Returns whether the empty string is in the language of this regular expression.

Source

pub fn nullable(&self) -> Regex<B>

Returns empty string if this regular expression is nullable, otherwise returns empty set.

Trait Implementations

Source§

impl<B: Builder> Add for Regex<B>

Source§

type Output = Regex<B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<B: Builder> BitAnd for Regex<B>

Source§

type Output = Regex<B>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl<B: Builder> BitOr for Regex<B>

Source§

type Output = Regex<B>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<B: Builder> Clone for Regex<B>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Debug + Builder> Debug for Regex<B>
where B::Symbol: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: Builder> Display for Regex<B>
where B::Symbol: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: Hash + Builder> Hash for Regex<B>
where B::Symbol: Hash,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<B: Builder> Not for Regex<B>

Source§

type Output = Regex<B>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<B: PartialEq + Builder> PartialEq for Regex<B>
where B::Symbol: PartialEq,

Source§

fn eq(&self, other: &Regex<B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<B: Eq + Builder> Eq for Regex<B>
where B::Symbol: Eq,

Source§

impl<B: Builder> StructuralPartialEq for Regex<B>