Skip to main content

format_parse_error

Function format_parse_error 

Source
pub fn format_parse_error(
    error: &ParseError,
    source: &str,
    file_name: &str,
    renderer: &Renderer,
) -> String
Expand description

Formats the convenience parser’s owning diagnostic, retaining the caller’s file name.

Legacy lexical failures without owning labels use the parser’s original formatter. This adapter borrows the error and preserves every concrete source cause.

  • Complexity: O(h + n + l) cause depth h, source bytes n and label bytes l.

§Examples

let error = adam_lang::AdamParser::new(adam_lang::TypeRegistry::new(),
    cel_parser::OpLookup::new()).parse_str("sheet {}").unwrap_err();
let text = adam_web_ui::format_parse_error(&error, "sheet {}", "file.adm2",
    &adam_web_ui::Renderer::plain());
assert!(!text.is_empty());