Skip to content
/ mcl Public

A toy configuration language I made for practicing rust

License

Notifications You must be signed in to change notification settings

jmmaa/mcl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mark's Configuration Language (MCL)

Its an easy to use config toy language written in rust. I implemented this solely for practicing rust lifetimes.

Note: Still in development

Introduction

Generally, you can think of this config language as json, except without commas and colons.

This mcl object


mcl {
    repository "https://github.com/jmmaa/mcl"
    stars 0
}

is equivalent to json object below

"mcl": {
    "repository": "https://github.com/jmmaa/mcl",
    "stars": 0
}

Unlike json, you can use template string literals in here by enclosing the string with backticks

mcl {
    template_string `MY TEMPLATE STRING`
    normal_string   "hello I am simple string"
}

TODO

How to use

use mcl;

fn main() {

    let output = mcl::from_str(
        r#"
        
        foo {
    
            bar "baz"
        }
        
        "#,
    )
    .unwrap();

    // getting value of "bar"
    let val = &output["foo"]["bar"].as_str();

    assert!(val == &Some("baz"));
}

About

A toy configuration language I made for practicing rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages