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

Method run

crates/csskit/src/commands/dbg_parse.rs:17–37  ·  view source on GitHub ↗
(&self, _config: GlobalConfig)

Source from the content-addressed store, hash-verified

15
16impl DbgParse {
17 pub fn run(&self, _config: GlobalConfig) -> CliResult {
18 let DbgParse { content } = self;
19 let bump = Bump::default();
20 for (file_name, mut source) in content.sources()? {
21 let mut source_string = String::new();
22 source.read_to_string(&mut source_string)?;
23 let source_text = source_string.as_str();
24 let lexer = Lexer::new(&CssAtomSet::ATOMS, source_text);
25 let mut parser = Parser::new(&bump, source_text, lexer);
26 let result = parser.parse_entirely::<StyleSheet>();
27 if let Some(stylesheet) = &result.output {
28 println!("{stylesheet:#?}");
29 } else {
30 for compact_err in result.errors {
31 let report = crate::commands::format_diagnostic_error(&compact_err, &source_string, file_name);
32 println!("{report}");
33 }
34 }
35 }
36 Ok(())
37 }
38}

Callers

nothing calls this directly

Calls 3

format_diagnostic_errorFunction · 0.85
sourcesMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected