newick 0.12.0

A library to parse, manipulate and generate trees in the Newick format
Documentation
WHITESPACE = _{ " " | "\t" | NEWLINE }

Trees      = { SOI ~ Tree* ~ EOI }
Tree       = { Node ~ ";" }
Node       = _{ (Leaf | Clade)? }
Leaf       = { name ~ Attributes? }
Clade      = { "(" ~ Node? ~ ("," ~ Node?)* ~ ")" ~ name? ~ Attributes? }
Attributes = { (":" ~ Length)? ~ Nhx? }
Nhx        = _{ "[&&NHX" ~ NhxEntry+ ~ "]" }
NhxEntry   = { ":" ~ nhx_key ~ "=" ~ nhx_value? }
Length     = _{ float }

nhx_safe   = _{ !( ":" | "," | ";" | "(" | ")" | "[" | "]" | "=" | WHITESPACE ) ~ ANY }
nhx_key    = { nhx_safe+ }
nhx_value  = { nhx_safe+ }
name_safe  = _{ !( ":" | "," | ";" | "(" | ")" | "[" | "]" | WHITESPACE ) ~ ANY }
name       = { name_safe+ }
float      = @{
                  "-"?
                  ~ ("0" | ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*)
                  ~ ("." ~ ASCII_DIGIT*)?
                  ~ (^"e" ~ ("+" | "-")? ~ ASCII_DIGIT+)?
              }