[][src]Enum fungui_syntax::Error

pub enum Error<T, R> {
    Unexpected(Info<T, R>),
    Expected(Info<T, R>),
    Message(Info<T, R>),
    Other(Box<dyn Error + 'static + Send + Sync>),
}

Enum used to store information about an error that has occurred during parsing.

Variants

Unexpected(Info<T, R>)

Error indicating an unexpected token has been encountered in the stream

Expected(Info<T, R>)

Error indicating that the parser expected something else

Message(Info<T, R>)

Generic message

Other(Box<dyn Error + 'static + Send + Sync>)

Variant for containing other types of errors

Methods

impl<T, R> Error<T, R>[src]

pub fn map_token<F, U>(self, f: F) -> Error<U, R> where
    F: FnOnce(T) -> U, 
[src]

pub fn map_range<F, S>(self, f: F) -> Error<T, S> where
    F: FnOnce(R) -> S, 
[src]

impl<T, R> Error<T, R>[src]

pub fn end_of_input() -> Error<T, R>[src]

Returns the end_of_input error.

pub fn fmt_errors(
    errors: &[Error<T, R>],
    f: &mut Formatter
) -> Result<(), Error> where
    R: Display,
    T: Display
[src]

Formats a slice of errors in a human readable way.


let input = r"
  ,123
";
let result = spaces().silent().with(char('.').or(char('a')).or(digit()))
    .easy_parse(State::new(input));
let m = format!("{}", result.unwrap_err());
let expected = r"Parse error at line: 2, column: 3
Unexpected `,`
Expected `.`, `a` or `digit`
";
assert_eq!(m, expected);

Trait Implementations

impl<T, R> Display for Error<T, R> where
    R: Display,
    T: Display
[src]

impl<Item, Range, Position> ParseError<Item, Range, Position> for Error<Item, Range> where
    Item: PartialEq<Item>,
    Position: Default,
    Range: PartialEq<Range>, 
[src]

type StreamError = Error<Item, Range>

fn merge(self, other: Self) -> Self[src]

Merges two errors. If they exist at the same position the errors of other are added to self (using the semantics of add). If they are not at the same position the error furthest ahead are returned, ignoring the other ParseError. Read more

fn add_expected(&mut self, info: Info<Item, Range>)[src]

fn add_unexpected(&mut self, info: Info<Item, Range>)[src]

fn add_message(&mut self, info: Info<Item, Range>)[src]

fn clear_expected(&mut self)[src]

Removes any expected errors currently in self

impl<T, R, E> From<E> for Error<T, R> where
    E: Error + 'static + Send + Sync
[src]

impl<T, R> PartialEq<Error<T, R>> for Error<T, R> where
    R: PartialEq<R>,
    T: PartialEq<T>, 
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<T, R> Debug for Error<T, R> where
    R: Debug,
    T: Debug
[src]

impl<Item, Range> StreamError<Item, Range> for Error<Item, Range> where
    Item: PartialEq<Item>,
    Range: PartialEq<Range>, 
[src]

fn unexpected(info: Info<Item, Range>) -> Self[src]

fn expected(info: Info<Item, Range>) -> Self[src]

fn message(info: Info<Item, Range>) -> Self[src]

fn end_of_input() -> Self[src]

Auto Trait Implementations

impl<T, R> Send for Error<T, R> where
    R: Send,
    T: Send

impl<T, R> Sync for Error<T, R> where
    R: Sync,
    T: Sync

Blanket Implementations

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

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.