pub fn parse_unit_with_recovery(
tokens: &[Token],
source: &str,
) -> (Option<SourceUnit>, Vec<CompileError>)Expand description
Parse a token slice into a SourceUnit with error recovery, returning a
best-effort partial AST plus the full list of parse errors and warnings.
Used by the LSP: item-level recovery skips past a malformed declaration to
the next top-level item, so multiple errors are reported per compilation
rather than just the first. Compared to parse_unit, this never bails;
if no SourceUnit could be parsed at all (e.g. the file is empty or the
header itself fails) the returned Option is None.
Keeps only the first unit — v0.113 allows more than one top-level unit
per file (an atomic commons + suite, DECISION S), and every existing
caller here is keyed on the primary declaration. parse_units_with_recovery
is the same recovery parse without that narrowing, for the one caller
(finding #29/#30) that needs every unit a file declares.