Rust parser for KDL
Go to file
Nicolas Sauzede d52e101ff9
docs: Fix Implementations link (#22)
2021-10-11 18:26:32 -07:00
.github add GH Action config 2020-12-14 00:05:51 -08:00
examples fix nuget example 2020-12-18 22:31:36 -08:00
src docs: fix license in readme 2021-09-22 10:39:31 -07:00
tests fix(numbers): Fix parsing of non-integer and non-decimal numbers (#13) 2021-05-08 14:40:37 -07:00
.gitignore initial commit 2020-12-10 18:42:50 -08:00
CHANGELOG.md doc: update changelog 2021-09-16 01:31:50 -07:00
CODE_OF_CONDUCT.md add coc 2020-12-14 20:30:58 -08:00
Cargo.toml (cargo-release) start next development iteration 3.0.1-alpha.0 2021-09-16 01:32:27 -07:00
LICENSE feat(license): change license to Apache-2.0 2021-09-15 23:59:34 -07:00
Makefile.toml meta: add publishing bits 2021-09-15 23:59:15 -07:00
README.md docs: Fix Implementations link (#22) 2021-10-11 18:26:32 -07:00
cliff.toml meta: fix changelog gen 2021-09-16 00:01:34 -07:00

README.md

KDL - The KDL Document Language

KDL is a document language with xml-like semantics that looks like you're invoking a bunch of CLI commands!

It's meant to be used both as a serialization format and a configuration language, and is relatively light on syntax compared to XML.

There's a living specification, as well as various implementations. The language is based on SDLang, with a number of modifications and clarifications on its syntax and behavior.

This repository is the official/reference implementation in Rust, and corresponds to the kdl crate

Design and Discussion

KDL is still extremely new, and discussion about the format should happen over on the spec repo's discussions page. Feel free to jump in and give us your 2 cents!

Example KDL File

author "Alex Monad" email="alex@example.com" active=true

contents {
  section "First section" {
    paragraph "This is the first paragraph"
    paragraph "This is the second paragraph"
  }
}

// unicode! comments!
π 3.14159

Basic Library Example

use kdl::{KdlNode, KdlValue};
use std::collections::HashMap;

assert_eq!(
    kdl::parse_document("node 1 key=true").unwrap(),
    vec![
        KdlNode {
            name: String::from("node"),
            values: vec![KdlValue::Int(1)],
            properties: {
                let mut temp = HashMap::new();
                temp.insert(String::from("key"), KdlValue::Boolean(true));
                temp
            },
            children: vec![],
        }
    ]
)

License

The code in this repository is covered by the Apache-2.0 License.