| Crates.io | nomap |
| lib.rs | nomap |
| version | 0.2.1 |
| created_at | 2020-04-06 20:07:59.071008+00 |
| updated_at | 2021-06-29 14:10:26.113557+00 |
| description | A parser for the `.map` file format used by Quake 1 & 2 as well as Half-Life 1, implemented using the nom parsing framework. |
| homepage | https://github.com/reslario/nomap |
| repository | https://github.com/reslario/nomap |
| max_upload_size | |
| id | 227057 |
| size | 50,031 |
A parser for the .map file format used by Quake 1 & 2 as well as Half-Life 1,
implemented using the nom parsing framework. It can
easily be integrated with other nom parsers.
nomap is whitespace agnostic and ignores comments.
It also optionally provides Display implementations for all its types (through
the "display" feature), so you can serialise a parsed map back into a string.
// parse the example map with the standard format
let map = nomap::parse::<nomap::formats::Standard>(include_str!("../examples/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" }
)
}