Skip to main content

parse_error_to_diagnostics

Function parse_error_to_diagnostics 

Source
pub fn parse_error_to_diagnostics(
    parse_err: &ParseError,
    source: &str,
) -> Vec<SemanticDiagnostic>
Expand description

Convert a parse error into semantic diagnostics for LSP or other tooling.

Returns a single-element vec for ParseError::NoMatch (with message from the program grammar’s literals/rule names) or ParseError::BadGraph. Use when the main program failed to parse so that diagnostics include the parse error without duplicating conversion logic in the LSP.