Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created June 5, 2014 00:34
Show Gist options
  • Save alexcrichton/42ee2050a7e5c3a06403 to your computer and use it in GitHub Desktop.
Save alexcrichton/42ee2050a7e5c3a06403 to your computer and use it in GitHub Desktop.
use std::io;
fn main() {
println!("digraph \\{");
let mut input = io::stdin();
let mut lines = input.lines();
loop {
match lines.next() {
Some(line) => {
let line = line.unwrap();
let line = line.as_slice();
if !line.starts_with("DEPS_") { continue }
let mut parts = line.as_slice().words();
let name = parts.next().unwrap();
let name = name.slice_from(5);
let _ign = parts.next();
for dep in parts {
if dep.starts_with("native:") { continue }
if dep == "\\" {
let newline = lines.next().unwrap().unwrap();
for word in newline.as_slice().words() {
if word.starts_with("native:") { continue }
println!(" {} -> {};", name, word);
}
} else {
println!(" {} -> {};", name, dep);
}
}
}
None => break
}
}
println!("\\}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment