[][src]Enum liblet::derivation::DerivationError

pub enum DerivationError {
    WrongProductionIndex(usize),
    WrongIndex(Vec<Symbol>, usize),
    ImpossibleStep(ProductionVec<Symbol>, DerivationStep),
    NoNSymbol(Vec<Symbol>),
}

Variants

WrongProductionIndex(usize)

Error for when the derivation tries to apply a production whose index is not in the valid ones for the grammar.

Examples

If you have a grammar with 3 productions, then the indexes of those productions will be [0..2]. If you specify 3 or more as production index, you'll get this error.

WrongIndex(Vec<Symbol>, usize)

Error for when the derivation tries to apply a production to the indexed symbol in the current sentential form but the latter doesn't have enough symbols to reach the indexed one.

Examples

If you have a sentential form like this A B C (which has 3 symbols, so the indexes of those symbols in the sentential form are 0 for the A, 1 for the B and 2 for the C) and try to apply a production rule to an index >= 3, then you'll get this error.

ImpossibleStep(ProductionVec<Symbol>, DerivationStep)

Error for when the derivation tries to apply a production on part of the sentential form, but the production can't be applied due to the left hand side not matching the part of the sentential form the production is being applied to.

Examples

If you have a derivation step which target the production A -> B and the index 0 of the sentential form, which contains C A B, the left hand side of the production (A) doesn't match the sentential form starting from 0 (C), so the derivation step can't be applied and you'll get this error.

NoNSymbol(Vec<Symbol>)

Error for when the derivation tries to apply a leftmost_n or rightmost_n derivation to a sentential form which doesn't have a non terminal symbol, so the derivation step can't be applied, because there's no sentential form index to derive from.

Examples

If you have the derivation step which target the production A -> B and the current sentential form is a (it doesn't have any non terminal symbols), you'll get this error.

Trait Implementations

impl Clone for DerivationError[src]

impl Debug for DerivationError[src]

impl Display for DerivationError[src]

impl Eq for DerivationError[src]

impl Error for DerivationError[src]

impl Hash for DerivationError[src]

impl PartialEq<DerivationError> for DerivationError[src]

impl StructuralEq for DerivationError[src]

impl StructuralPartialEq for DerivationError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.