pub struct ParseErrorContext {
pub token_range: Range<usize>,
pub end_affinity: TokenAffinity,
pub ty: ContextType,
}Expand description
Context attached to a ParseError.
This is generally attached to an error when the parser knows the context of what it is parsing with confidence.
§Example
In this code, the parser knows that it is parsing the RHS of an expression when the error occurs.
1 + function
^ errorSo it will attach a context to the error with an Expression context.
Fields§
§token_range: Range<usize>The range of tokens that this context applies.
For example, if the context is a FunctionDefinitionStatement, the range will include
the entire function.
In some cases this will end at the token where the error is encountered, however in many
cases the parser can match delimiters like { and } to provide more context.
end_affinity: TokenAffinityAffinity of the last token in the range.
ty: ContextTypeThe type of context.
Trait Implementations§
Source§impl Clone for ParseErrorContext
impl Clone for ParseErrorContext
Source§fn clone(&self) -> ParseErrorContext
fn clone(&self) -> ParseErrorContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ParseErrorContext
impl RefUnwindSafe for ParseErrorContext
impl Send for ParseErrorContext
impl Sync for ParseErrorContext
impl Unpin for ParseErrorContext
impl UnwindSafe for ParseErrorContext
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