pub struct Recovered<S: SourceStore = Arc<str>, X: Extension = NoExt> { /* private fields */ }Expand description
The result of a recovering parse: the partial AST plus every collected error.
Composes the owned Parsed root — the sole holder of the source and
resolver that give the recovered statements meaning — with the out-of-band
diagnostics for the statements that failed to parse. A fully well-formed script
yields the same statements as parse_with and an empty
errors; a broken statement is absent from the tree and present
in errors (no error nodes).
Implementations§
Source§impl<S: SourceStore, X: Extension> Recovered<S, X>
impl<S: SourceStore, X: Extension> Recovered<S, X>
Sourcepub fn parsed(&self) -> &Parsed<S, X>
pub fn parsed(&self) -> &Parsed<S, X>
The owned Parsed root of the well-formed statements, with the source and
resolver they were parsed against. Use it exactly like a parse_with
result — render, resolve symbols, query line/column.
Sourcepub fn statements(&self) -> &[Statement<X>]
pub fn statements(&self) -> &[Statement<X>]
The recovered statements, in source order — shorthand for
parsed().statements().
Sourcepub fn errors(&self) -> &[ParseError]
pub fn errors(&self) -> &[ParseError]
Every collected parse error, in source order — one per statement that failed.
Each carries its byte Span, so a diagnostic can resolve
line/column through the parsed root’s
span_line_col. Empty when the whole script parsed.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Whether any statement failed to parse.
Sourcepub fn into_parts(self) -> (Parsed<S, X>, Vec<ParseError>)
pub fn into_parts(self) -> (Parsed<S, X>, Vec<ParseError>)
Split into the owned Parsed root and the collected errors.