3 releases (breaking)

new 0.3.0 Oct 16, 2020
0.2.0 May 13, 2019
0.1.0 May 8, 2019

#215 in Parser implementations

ISC license

270 lines

Build Status Downloads Version Documentation License


BML Markup Language

BML is a simplified XML used by the SNES Preservation Project, see the BML grammar using PEG as input for the pest parser.

In contrast to its C++ reference implementation, this Rust implementation parses indents by pushing them on a stack to compare them instead of counting characters (stack-based-indent) and it allows tabulators between attributes (tabular-attributes) and between colons and multi-line data (tabular-colon-data) supporting tabulator-based along with space-based alignments.

Syntax highlighting is trivial, see vim-bml.


This crate works on Rust stable channel by adding it to Cargo.toml:

bml = "0.3"


use bml::BmlNode;
use std::convert::TryFrom;

let root = BmlNode::try_from(concat!(
	"  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",
	"  proxy host=\"proxy.example.com\" port=\"8080\"\n",
	"    authentication: plain\n",

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

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


Licensed under ISC.


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.


~65K SLoC