Skip to main content

Crate muon

Crate muon 

Source
Expand description

Muon — the Mu object notation.

A no_std scannerless parser that turns Muon text into a Muon tree, following docs/muon-spec.md. Nesting is driven by an explicit heap stack (see parse.rs), so depth is bounded only by memory. Leaves borrow from the input (&'a str, zero-copy); structure is allocated. Symbols are lexed by maximal munch, so the whitespace-merge rules of the spec fall out naturally (a run of symchars is one <sym>).

let seq = muon::parse("a b, c").unwrap();
assert_eq!(
    seq.to_json(),
    r#"{"seq":[{"chain":[{"sym":"a"},{"sym":"b"}]},{"chain":[{"sym":"c"}]}]}"#,
);

Structs§

Chain
A chain: one or more juxtaposed items (<chain>). Never empty.
ParseError
A parse failure, with the byte offset into the input where it was detected.
Seq
A sequence: zero or more chains delimited by separators (<seq>).

Enums§

ErrorKind
Item
A single visually-atomic entity in a chain (<item> in the spec).

Functions§

parse
Parse a whole Muon file: a top-level <seq> up to end of input.