Crates.io | yscl |
lib.rs | yscl |
version | 1.2.0 |
source | src |
created_at | 2023-01-04 14:20:47.296924 |
updated_at | 2023-01-05 02:24:19.76032 |
description | A YSCL parser. |
homepage | https://github.com/kylejlin/yscl |
repository | https://github.com/kylejlin/yscl/tree/main/yscl-rs |
max_upload_size | |
id | 750849 |
size | 63,825 |
An efficient, minimal parser for YSCL.
use yscl::prelude::*;
let map = parse_doc(r#"
kantu_version = "1.0.0"
name = "fibonacci"
license = [
"MIT"
"Apache-2.0"
]
dependencies = {
yscl = "1.0.0"
json = "1.0.0"
}
author = "xeklan (黒🐑)"
"#).unwrap();
let expected = Map {
entries: vec![
MapEntry {
key: Identifier::new("kantu_version".to_owned()).unwrap(),
value: Node::Atom(
Atom {
value: "1.0.0".to_owned(),
},
),
},
MapEntry {
key: Identifier::new("name".to_owned()).unwrap(),
value: Node::Atom(
Atom {
value: "fibonacci".to_owned(),
},
),
},
MapEntry {
key: Identifier::new("license".to_owned()).unwrap(),
value: Node::List(
List {
elements: vec![
Node::Atom(
Atom {
value: "MIT".to_owned(),
},
),
Node::Atom(
Atom {
value: "Apache-2.0".to_owned(),
},
),
],
},
),
},
MapEntry {
key: Identifier::new("dependencies".to_owned()).unwrap(),
value: Node::Map(
Map {
entries: vec![
MapEntry {
key: Identifier::new("yscl".to_owned()).unwrap(),
value: Node::Atom(
Atom {
value: "1.0.0".to_owned(),
},
),
},
MapEntry {
key: Identifier::new("json".to_owned()).unwrap(),
value: Node::Atom(
Atom {
value: "1.0.0".to_owned(),
},
),
},
],
},
),
},
MapEntry {
key: Identifier::new("author".to_owned()).unwrap(),
value: Node::Atom(
Atom {
value: "xeklan (黒🐑)".to_owned(),
},
),
},
],
};
assert_eq!(expected, map);
https://docs.rs/yscl/latest/yscl/
yscl-rs is distributed under both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.