Skip to main content

parse_error_to_miette

Function parse_error_to_miette 

Source
pub fn parse_error_to_miette(
    e: &ParseError,
    source: &str,
    filename: &str,
) -> Option<Report>
Expand description

Convert a parse error into a miette::Report with source snippet and resolved literals.

Uses the program grammar’s literal and rule-name tables so that expected tokens and rules show as readable text (e.g. "var", statement). Returns None for ParseError::BadGraph.

Use when the error came from parse. For parse_expression or parse_tokens, use the corresponding graph literals via sipha directly if you need miette reports.