pub enum Error {
Parse(ParseError),
Preprocess(PreprocessError),
InvalidGrammar(String),
AstBuild(BuilderError),
FeaturesDisabled(Vec<FeatureGateError>),
DepthLimit {
limit: usize,
span: Span,
},
AnnotationLimit {
limit: usize,
span: Span,
},
}Expand description
High-level error of the top-level parser.
Unifies lexer, recognition and builder errors under one type, so that consumers only have to handle one error variant.
Variants§
Parse(ParseError)
Lexer or recognition error. Contains the existing
ParseError variant for token/EOF diagnostics.
Preprocess(PreprocessError)
Preprocessor error (#include, #define, #error, …). Only produced by the
bundled parse_source function.
InvalidGrammar(String)
Grammar construction error. Occurs only on a corrupt build of the
grammar constant — should never happen for IDL_42.
AstBuild(BuilderError)
AST builder error. Indicates a bug in the builder or grammar drift.
FeaturesDisabled(Vec<FeatureGateError>)
A used construct requires a feature that is off in
ParserConfig::features. List of all violations.
DepthLimit
{/} nesting exceeds MAX_NESTING_DEPTH.
Protection against stack overflow in the recursive CST builder
(TS-1 finding 1).
AnnotationLimit
Consecutive @ annotations exceed
MAX_CONSECUTIVE_ANNOTATIONS. Protection against quadratic
behavior in the left-recursive annotation-sequence CST build
(TS-1 finding 2).
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()