nomap 0.2.1

A parser for the `.map` file format used by Quake 1 & 2 as well as Half-Life 1, implemented using the nom parsing framework.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fn main() {
    // parse the example map with the standard format
    let map = nomap::parse::<nomap::formats::Standard>(include_str!("example.map")).unwrap();

    // report our findings
    for ent in map.entities.iter() {
        println!(
            "Found entity of class `{}` with {} brush{}",
            // every entity should have this, so we optimistically index here
            ent.fields["classname"],
            ent.brushes.len(),
            // some fanciness
            if ent.brushes.len() == 1 { "" } else { "es" }
        )
    }
}