1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-08 18:46:15 +02:00

Add a comment explaining the state machine.

This commit is contained in:
Andrew Walbran 2023-04-03 14:43:44 +01:00
parent 04c36de355
commit 5f5cf9dc7f

View File

@ -56,6 +56,10 @@ fn main() -> anyhow::Result<()> {
.with_context(|| format!("Failed to open {:?}", input_filename))?;
let parser = Parser::new(&input_contents);
// Find a specially-formatted comment followed by a code block, and then call `write_output`
// with the contents of the code block, to write to a file named by the comment. Code blocks
// without matching comments will be ignored, as will comments which are not followed by a code
// block.
let mut next_filename: Option<String> = None;
let mut current_file: Option<File> = None;
for event in parser {