bml 0.2.0

BML Markup Language
Documentation

bml

BML Markup Language

Build Status Downloads Version Documentation License

Based on PEG, see the interactive parser implementation at pest.rs.

BML is used by the icarus database of higan/bsnes.

Contents

Usage

This crate works on Rust stable channel. It is on crates.io and can be used by adding bml to the dependencies in your project's Cargo.toml:

[dependencies]
bml = "0.2"

Use ordered-multimap feature on Rust nightly channel:

[dependencies]
bml = { version = "0.2", features = ["ordered-multimap"] }

Examples

use std::convert::TryFrom;

use bml::BmlNode;

let root = BmlNode::try_from(concat!(
	"server\n",
	"  path: /core/www/\n",
	"  host: example.com\n",
	"  port: 80\n",
	"  service: true\n",
	"  proxy\n",
	"    host: proxy.example.com\n",
	"    port: 8080\n",
	"    authentication: plain\n",
	"  description\n",
	"    :Primary web-facing server\n",
	"    :Provides commerce-related functionality\n",
	"\n",
	"server\n",
	"  // ...\n",
	"  proxy host=\"proxy.example.com\" port=\"8080\"\n",
	"    authentication: plain\n",
)).unwrap();

let (name, node) = root.nodes().next().unwrap();

assert_eq!(name, "server");
assert_eq!(node.named("port").next().unwrap().value(), "80");

License

Copyright (c) 2019 Rouven Spreckels n3vu0r@qu1x.org

Usage of the works is permitted provided that this instrument is retained with the works, so that any entity that uses the works is notified of this instrument.

DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the works by you shall be licensed as above, without any additional terms or conditions.