pub enum ParseError<K: TokenKind, R: RuleId = ()> {
UnexpectedToken {
kind: K,
span: Span,
rule_context: Option<R>,
context_stack: Vec<ErrorContext<R>>,
},
Expected {
expected: Expected<K>,
found: Option<K>,
span: Span,
rule_context: Option<R>,
context_stack: Vec<ErrorContext<R>>,
},
NoRule {
kind: K,
span: Span,
rule_context: Option<R>,
context_stack: Vec<ErrorContext<R>>,
},
NonAssociative {
kind: K,
span: Span,
rule_context: Option<R>,
context_stack: Vec<ErrorContext<R>>,
},
InvalidContext {
rule: &'static str,
span: Span,
rule_context: Option<R>,
context_stack: Vec<ErrorContext<R>>,
},
UnexpectedEof {
span: Span,
rule_context: Option<R>,
context_stack: Vec<ErrorContext<R>>,
},
RangeError {
min: usize,
max: usize,
found: usize,
span: Span,
rule_context: Option<R>,
context_stack: Vec<ErrorContext<R>>,
},
MultipleAlternatives {
alternatives: Vec<ParseError<K, R>>,
span: Span,
rule_context: Option<R>,
context_stack: Vec<ErrorContext<R>>,
},
}Expand description
Parse error emitted by the grammar and Pratt parser.
Variants§
UnexpectedToken
Unexpected token encountered.
Expected
Specific token kind was expected.
Fields
§
context_stack: Vec<ErrorContext<R>>NoRule
Tried to look up a Pratt rule that does not exist.
NonAssociative
Operator declared as non-associative but used twice in a row.
InvalidContext
Conditional rule evaluated to false.
UnexpectedEof
Ran out of tokens while parsing.
RangeError
Repetition exceeded its declared bounds.
Fields
§
context_stack: Vec<ErrorContext<R>>MultipleAlternatives
Multiple alternatives failed in a choice rule.
Trait Implementations§
Auto Trait Implementations§
impl<K, R> Freeze for ParseError<K, R>
impl<K, R> RefUnwindSafe for ParseError<K, R>where
K: RefUnwindSafe,
R: RefUnwindSafe,
impl<K, R> Send for ParseError<K, R>
impl<K, R> Sync for ParseError<K, R>
impl<K, R> Unpin for ParseError<K, R>
impl<K, R> UnwindSafe for ParseError<K, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more