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
Required methods
fn expected_input_found<Iter: IntoIterator<Item = I>>(
span: Self::Span,
expected: Iter,
found: Option<I>
) -> Self
fn expected_input_found<Iter: IntoIterator<Item = I>>(
span: Self::Span,
expected: Iter,
found: Option<I>
) -> Self
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.
fn with_label(self, label: Self::Label) -> Self
fn with_label(self, label: Self::Label) -> Self
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.
Provided methods
fn unclosed_delimiter(
start_span: Self::Span,
start: I,
span: Self::Span,
expected: I,
found: Option<I>
) -> Self
fn unclosed_delimiter(
start_span: Self::Span,
start: I,
span: Self::Span,
expected: I,
found: Option<I>
) -> Self
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.