Skip to main content

Language

Struct Language 

Source
pub struct Language { /* private fields */ }
Expand description

A pattern compiled to a term and a lazily built automaton.

Implementations§

Source§

impl Language

Source

pub fn compile( p: &Pattern, alphabet: Option<Alphabet>, mode: Mode, limits: &Limits, ) -> Result<Language, RexactError>

Compile a parsed pattern. alphabet defaults per dialect.

Source

pub fn from_parts( store: TermStore, root: TermId, alphabet: Alphabet, limits: &Limits, ) -> Result<Language, RexactError>

Wrap an existing term (used by the analyses and by tests).

Source

pub fn alphabet(&self) -> Alphabet

The alphabet mode, reported with every result.

Source

pub fn root(&self) -> TermId

The root term.

Source

pub fn store(&self) -> &TermStore

The term store (read-only).

Source

pub fn matches(&mut self, input: &str) -> Result<bool, RexactError>

Full-match test on text, encoded per the alphabet mode.

Source

pub fn matches_units(&mut self, input: &[u32]) -> Result<bool, RexactError>

Full-match test on symbols.

Source

pub fn minimal(&mut self) -> Result<MinDfa, RexactError>

Minimal complete automaton in canonical form.

Source

pub fn fingerprint(&mut self) -> Result<String, RexactError>

Language fingerprint: equal for equal languages in the same alphabet.

Source

pub fn stats(&self) -> (usize, usize)

(states built so far, symbol classes).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.