Skip to main content

parse_unit_with_recovery

Function parse_unit_with_recovery 

Source
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.