vmf_parser_nom
A parser for the Valve map format written in Rust. Also a provided convience macro for iterating over subblocks using the traversal crate.
Vmf Format
Read more about the vmf format on Valve Developer Community
// This is a comment.
ClassName_1
{
"Property_1" "Value_1"
"Property_2" "Value_2"
ClassName_2
{
"Property_1" "Value_1"
}
ClassName_3
{
}
}
Example
use ;
use parse;
use ;
let input = "ClassName_1
{
\t\"Property_1\" \"Value_1\"
\t\"Property_2\" \"Value_2\"
\tClassName_2
\t{
\t\t\"Property_1\" \"Value_1\"
\t}
\tClassName_3
\t{
\t}
}";
// parse the input to a vmf, borrowing from input
let vmf = .unwrap;
let string = vmf.to_string;
println!
assert_eq!;
// parse to owned strings instead
let vmf_owned = .unwrap;
// All valid error types
let invalid_input = "block{\"property_with_no_value\"}";
let err_verbose = .unwrap_err;
let err_simple = .unwrap_err;
let err_tuple = .unwrap_err;
let err_unit = .unwrap_err;
println!;
println!;
println!;
println!;
// implements Deref
let block: & = &vmf_owned;
assert_eq!;
// inner value is simply a block with no properties
assert_eq!;
assert_eq!;
assert!;