Trait chumsky::error::Error[][src]

pub trait Error<I>: Sized {
    type Span: Span;
    type Label;
    fn expected_input_found<Iter: IntoIterator<Item = I>>(
        span: Self::Span,
        expected: Iter,
        found: Option<I>
    ) -> Self;
fn with_label(self, label: Self::Label) -> Self;
fn merge(self, other: Self) -> Self; fn unclosed_delimiter(
        start_span: Self::Span,
        start: I,
        span: Self::Span,
        expected: I,
        found: Option<I>
    ) -> Self { ... } }
Expand description

A trait that describes parser error types.

Associated Types

The type of spans to be used in the error.

The label used to describe a syntatic structure currently being parsed.

This can be used to generate errors that tell the user what syntactic structure was currently being parsed when the error occured.

Required methods

Create a new error describing a conflict between expected inputs and that which was actually found.

Using a None as found indicates that the end of input was reached, but was not expected.

Indicate that the error occured while parsing a particular syntactic structure.

How the error handles this information is up to it. It can append it to a list of structures to get a sort of ‘parse backtrace’, or it can just keep only the most recent label. If the latter, this method should have no effect when the error already has a label.

Merge two errors that point to the same input together, combining their information.

Provided methods

Create a new error describing a delimiter that was not correctly closed.

Provided to this function is the span of the unclosed delimiter, the delimiter itself, the span of the input that was found in its place, the closing delimiter that was expected but not found, and the input that was found in its place.

Implementors