MCPcopy Create free account
hub / github.com/csskit/csskit / parse_error_report

Function parse_error_report

crates/csskit_wasm/src/lib.rs:133–143  ·  view source on GitHub ↗
(source_text: String)

Source from the content-addressed store, hash-verified

131
132#[wasm_bindgen]
133pub fn parse_error_report(source_text: String) -> String {
134 let allocator = Bump::default();
135 let lexer = Lexer::new(&CssAtomSet::ATOMS, source_text.as_str());
136 let result = Parser::new(&allocator, source_text.as_str(), lexer).parse_entirely::<StyleSheet>();
137 let mut report = String::new();
138 for err in result.errors {
139 build_error(&err, &source_text, &mut report);
140 report += "\n";
141 }
142 report
143}
144
145fn build_error(err: &Diagnostic, source: &str, w: &mut impl Write) {
146 #[cfg(feature = "miette")]

Callers 1

handleEventMethod · 0.85

Calls 2

build_errorFunction · 0.85
as_strMethod · 0.45

Tested by

no test coverage detected