openmetrics 0.2.1

A Rust native parser for the OpenMetrics standard
Documentation
WHITESPACE = _{ " " }
metricName = @{ (ASCII_ALPHANUMERIC | ":" | "_")+ }

helpText = { (ASCII_ALPHANUMERIC | PUNCTUATION)+ }
helpLine = { "# HELP" ~  metricName ~ helpText ~ NEWLINE }

typeText = { ("counter"|"gauge"|"histogram"|"summary") }
typeLine = { "# TYPE" ~ metricName ~  typeText ~ NEWLINE }

labelKey = { (ASCII_ALPHA|"_")+ }
labelValue = { (ASCII_ALPHANUMERIC|"_"|".")+ }
label = { labelKey ~ "=" ~ "\"" ~ labelValue ~ "\"" }
labels = { "{" ~ label ~ ("," ~ label)* ~ "}" }

metricContext = @{ metricName ~ labels* }
metricValue = { (ASCII_DIGIT|"."|"e+"|"NaN")+ }
metricLine = { metricContext ~ metricValue ~ NEWLINE*}

metric = { (helpLine)* ~ (typeLine)* ~ (metricLine)+ }

metrics = {
  SOI ~
  metric* ~
  EOI
}