16 releases (5 breaking)

0.6.1 Sep 9, 2023
0.6.0 Sep 8, 2023
0.5.2 Jun 9, 2023
0.4.0 May 20, 2023
0.1.1 Apr 1, 2023

#2698 in Parser implementations

Download history 3/week @ 2024-07-29 27/week @ 2024-09-23

62 downloads per month

Apache-2.0

59KB
1.5K SLoC

PML - Philipp's Modern Language

Just another format to specify your configs in
Currently under development, so don't expect full functionality until version 1.0.0

Code example

*.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,
        ]
    }
]

No runtime deps