16个版本 (5个重大更新)
0.6.1 | 2023年9月9日 |
---|---|
0.6.0 | 2023年9月8日 |
0.5.2 | 2023年6月9日 |
0.4.0 | 2023年5月20日 |
0.1.1 | 2023年4月1日 |
#1873 在 解析器实现
59KB
1.5K SLoC
PML - Philipp的现代化语言
只是用于指定配置的另一种格式
目前正在开发中,所以不要期待1.0.0版本之前的完整功能
代码示例
*.rs
use pml::parse::file as pml_parse;
fn main() {
let pml_result = pml_parse("testFile.pml");
match pml_result {
Err(e) => println("{e:#?}"),
Ok(result) => {
if(result.get::<bool>("stayAnonymous").is_some()) {
println!("I won't tell you anything about me.");
}
else {
println!("Hi, my name is {} and I am {} years old.", result.get::<String>("name").unwrap(), result.get::<&u64>("age").unwrap());
}
}
}
}
testFile.pml
age= <u32> 420;
first_name = "Max";
"name and age" = |first_name, last_name| " "|age|;
last_name = "Mustermann";
stayAnonymous = true;
friends = [
{
name= "Person";
past_ages= <u8> [
0,1,2,
3 , 4,5
]
}
{
name= |..first_name|;
past_ages = <u8> [
0,1,2,3,4,
]
}
]