Struct sqparse::ParseErrorContext
source · pub struct ParseErrorContext {
pub token_range: Range<usize>,
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
^ error
So 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.
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 copy 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 more