bml

Crates.iobml
lib.rsbml
version0.3.1
sourcesrc
created_at2019-05-08 16:20:48.029057
updated_at2023-02-23 10:10:13.021878
descriptionBML Markup Language
homepage
repositoryhttps://github.com/qu1x/bml
max_upload_size
id132844
size14,764
Rouven Spreckels (n3vu0r)

documentation

https://docs.rs/bml

README

bml

BML Markup Language

Build Documentation Downloads Version Rust License

BML is a simplified XML used as static database, see the 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.

Examples

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

Licensed under ISC.

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.

Commit count: 36

cargo fmt