Dfa

Struct Dfa 

Source
pub struct Dfa<T> { /* private fields */ }

Implementations§

Source§

impl<T> Dfa<T>

Source

pub fn with_log(log: BufLog) -> Self

Source

pub fn get_state_graph(&self) -> &BTreeMap<StateId, BTreeMap<Segments, StateId>>

Source

pub fn get_initial_state(&self) -> &Option<StateId>

Source

pub fn get_end_states(&self) -> &BTreeMap<StateId, Terminal>

Source

pub fn get_first_end_state(&self) -> &Option<StateId>

Source

pub fn is_normalized(&self) -> bool

Checks if the DFA is normalized: incremental state numbers, starting at 0, with all the accepting states at the end.

Source

pub fn normalize(self) -> Dfa<Normalized>

Normalizes the DFA: incremental state number0, starting at 0, with all the accepting states at the end.

Source

pub fn optimize(self) -> Dfa<Normalized>

Optimizes the number of states from self.state_graph. Returns a map to convert old state ids to new state ids.

Source§

impl Dfa<General>

Source

pub fn new() -> Dfa<General>

Source§

impl Dfa<Normalized>

Source

pub fn gen_tables_source_code(&self, indent: usize) -> String

Source§

impl<T> Dfa<T>

Source

pub fn print(&self, indent: usize)

Debug function to display the content of a Dfa.

Trait Implementations§

Source§

impl BuildFrom<Dfa<Normalized>> for LexerGen

Source§

fn build_from(dfa: Dfa<Normalized>) -> Self

Converts to this type from the input type.
Source§

impl BuildFrom<DfaBuilder> for Dfa<General>

Source§

fn build_from(dfa_builder: DfaBuilder) -> Self

Builds a Dfa::<General> from a DfaBuilder.

If an error is encountered or was already encountered before, an empty shell object is built with the log detailing the error(s).

Source§

impl BuildFrom<DfaBundle> for Dfa<General>

Source§

fn build_from(bundle: DfaBundle) -> Self

Builds a Dfa::<General> from multiple DFAs, each related to one mode.

If an error is encountered or was already encountered before, an empty shell object is built with the log detailing the error(s).

Source§

impl BuildFrom<DfaTables> for Dfa<Normalized>

Source§

fn build_from(source: DfaTables) -> Self

Converts to this type from the input type.
Source§

impl<T> HasBuildErrorSource for Dfa<T>

Source§

impl<T> LogReader for Dfa<T>

Source§

type Item = BufLog

Source§

fn get_log(&self) -> &Self::Item

Source§

fn give_log(self) -> Self::Item

Auto Trait Implementations§

§

impl<T> Freeze for Dfa<T>

§

impl<T> RefUnwindSafe for Dfa<T>
where T: RefUnwindSafe,

§

impl<T> Send for Dfa<T>
where T: Send,

§

impl<T> Sync for Dfa<T>
where T: Sync,

§

impl<T> Unpin for Dfa<T>
where T: Unpin,

§

impl<T> UnwindSafe for Dfa<T>
where T: UnwindSafe,

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<S> BuildFrom<S> for S

Source§

fn build_from(source: S) -> S

Converts to this type from the input type.
Source§

impl<S, T> BuildInto<T> for S
where T: BuildFrom<S>,

Source§

fn build_into(self) -> T

Calls T::from(self) to convert a [S] into a [T].

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<S, T> TryBuildFrom<S> for T

Source§

type Error = BuildError

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

fn try_build_from(source: S) -> Result<T, <T as TryBuildFrom<S>>::Error>

Performs the conversion.
Source§

impl<S, T> TryBuildInto<T> for S
where T: TryBuildFrom<S>,

Source§

type Error = <T as TryBuildFrom<S>>::Error

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

fn try_build_into(self) -> Result<T, <T as TryBuildFrom<S>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.