Created
June 5, 2014 00:34
-
-
Save alexcrichton/42ee2050a7e5c3a06403 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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