#language #parser #config #🚀 #fs #hash-map #ckt

cktrs

A rust(🚀) parser for the CKT(🚀) config language

1 unstable release

0.1.0 Oct 13, 2022

#96 in #fs

Custom license

15KB
314 lines

cktrs

A rust(🚀) parser for the CKT(🚀) config language.

usage

use cktrs::parse;
use std::fs;

fn main() {
    let unparsed_file = fs::read_to_string("test.ckt").expect("cannot read file");

    let file = parse(&unparsed_file)
        .expect("unsuccessful parse");

    for (key, value) in file.into_iter() {
        println!("{}: {:?}", key, value);
    }
}

cktrs::parse() returns a result containing a hashmap of all the tokens in the config. Each token is part of the cktrs::Tokens enum.

numerical table keys are indexed in the hashmap as a String


lib.rs:

A rust(🚀) parser for the CKT(🚀) config language.

Dependencies

~2.2–3MB
~54K SLoC