[−][src]Enum fungui_syntax::Error
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]
F: FnOnce(T) -> U,
pub fn map_range<F, S>(self, f: F) -> Error<T, S> where
F: FnOnce(R) -> S,
[src]
F: FnOnce(R) -> S,
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]
errors: &[Error<T, R>],
f: &mut Formatter
) -> Result<(), Error> where
R: Display,
T: Display,
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<Item, Range, Position> ParseError<Item, Range, Position> for Error<Item, Range> where
Item: PartialEq<Item>,
Position: Default,
Range: PartialEq<Range>,
[src]
Item: PartialEq<Item>,
Position: Default,
Range: PartialEq<Range>,
type StreamError = Error<Item, Range>
fn empty(Position) -> Error<Item, Range>
[src]
fn from_error(
Position,
err: <Error<Item, Range> as ParseError<Item, Range, Position>>::StreamError
) -> Error<Item, Range>
[src]
Position,
err: <Error<Item, Range> as ParseError<Item, Range, Position>>::StreamError
) -> Error<Item, Range>
fn set_position(&mut self, _position: Position)
[src]
fn add(
&mut self,
err: <Error<Item, Range> as ParseError<Item, Range, Position>>::StreamError
)
[src]
&mut self,
err: <Error<Item, Range> as ParseError<Item, Range, Position>>::StreamError
)
fn set_expected<F>(
self_: &mut Tracked<Error<Item, Range>>,
info: <Error<Item, Range> as ParseError<Item, Range, Position>>::StreamError,
f: F
) where
F: FnOnce(&mut Tracked<Error<Item, Range>>),
[src]
self_: &mut Tracked<Error<Item, Range>>,
info: <Error<Item, Range> as ParseError<Item, Range, Position>>::StreamError,
f: F
) where
F: FnOnce(&mut Tracked<Error<Item, Range>>),
fn is_unexpected_end_of_input(&self) -> bool
[src]
fn into_other<T>(self) -> T where
T: ParseError<Item, Range, Position>,
[src]
T: ParseError<Item, Range, Position>,
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]
E: Error + 'static + Send + Sync,
impl<T, R> PartialEq<Error<T, R>> for Error<T, R> where
R: PartialEq<R>,
T: PartialEq<T>,
[src]
R: PartialEq<R>,
T: PartialEq<T>,
fn eq(&self, other: &Error<T, R>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T, R> Display for Error<T, R> where
R: Display,
T: Display,
[src]
R: Display,
T: Display,
impl<Item, Range> StreamError<Item, Range> for Error<Item, Range> where
Item: PartialEq<Item>,
Range: PartialEq<Range>,
[src]
Item: PartialEq<Item>,
Range: PartialEq<Range>,
fn unexpected_token(token: Item) -> Error<Item, Range>
[src]
fn unexpected_range(token: Range) -> Error<Item, Range>
[src]
fn unexpected_message<T>(msg: T) -> Error<Item, Range> where
T: Display,
[src]
T: Display,
fn unexpected_static_message(msg: &'static str) -> Error<Item, Range>
[src]
fn expected_token(token: Item) -> Error<Item, Range>
[src]
fn expected_range(token: Range) -> Error<Item, Range>
[src]
fn expected_message<T>(msg: T) -> Error<Item, Range> where
T: Display,
[src]
T: Display,
fn expected_static_message(msg: &'static str) -> Error<Item, Range>
[src]
fn message_message<T>(msg: T) -> Error<Item, Range> where
T: Display,
[src]
T: Display,
fn message_static_message(msg: &'static str) -> Error<Item, Range>
[src]
fn message_token(token: Item) -> Error<Item, Range>
[src]
fn message_range(token: Range) -> Error<Item, Range>
[src]
fn other<E>(err: E) -> Error<Item, Range> where
E: Error + Send + Sync + 'static,
[src]
E: Error + Send + Sync + 'static,
fn into_other<T>(self) -> T where
T: StreamError<Item, Range>,
[src]
T: StreamError<Item, Range>,
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]
impl<T, R> Debug for Error<T, R> where
R: Debug,
T: Debug,
[src]
R: Debug,
T: Debug,
Auto Trait Implementations
impl<T, R> Send for Error<T, R> where
R: Send,
T: Send,
R: Send,
T: Send,
impl<T, R> Sync for Error<T, R> where
R: Sync,
T: Sync,
R: Sync,
T: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,