bml 0.3.1

BML Markup Language
Documentation
// Language:   BML v1.0
// Revision:   0.04
// Features:   stack-based-indent, tabular-attributes, tabular-colon-data
// Maintainer: Rouven Spreckels <rs@qu1x.dev>
// License:    ISC

root = _{ SOI ~ (node | tail)* ~ EOI }

node = { PUSH(indent*) ~ name ~ data? ~ attr* ~ tail
  ~ (line | tail)*
  ~ (elem | tail)* ~ DROP }
line = _{ PEEK_ALL ~ PUSH(indent+) ~ (&":" ~ data ~ NEWLINE) ~ DROP }
elem = _{ PEEK_ALL ~ PUSH(indent+) ~ node ~ DROP }
attr = { indent+ ~ name ~ data? }

name = { (ASCII_ALPHANUMERIC | '-'..'.')+ }
data = { quote_data | space_data | colon_data }

quote_data = _{ "=\"" ~ quote_data_inner ~ "\"" }
quote_data_inner = { (!("\"" | NEWLINE) ~ ANY)* }

space_data = _{ "=" ~ space_data_inner ~ &(indent | NEWLINE) }
space_data_inner = { (!("\"" | indent | NEWLINE) ~ ANY)* }

colon_data = _{ ":" ~ indent? ~ colon_data_inner ~ &NEWLINE }
colon_data_inner = { (!NEWLINE ~ ANY)* }

tail = _{ indent* ~ (comment | NEWLINE) }

comment = _{ "//" ~ indent? ~ comment_inner ~ NEWLINE }
comment_inner = _{ (!NEWLINE ~ ANY)* }

indent = _{ " " | "\t" }