14 releases (9 breaking)

new 0.10.0 Feb 22, 2021
0.9.0 Mar 21, 2020
0.8.0 Mar 21, 2020
0.6.1 Dec 31, 2019
0.2.0 Jul 1, 2019

#95 in Parser implementations

Download history 256/week @ 2020-11-07 613/week @ 2020-11-14 742/week @ 2020-11-21 383/week @ 2020-11-28 213/week @ 2020-12-05 210/week @ 2020-12-12 161/week @ 2020-12-19 93/week @ 2020-12-26 189/week @ 2021-01-02 121/week @ 2021-01-09 245/week @ 2021-01-16 188/week @ 2021-01-23 247/week @ 2021-01-30 270/week @ 2021-02-06 389/week @ 2021-02-13 274/week @ 2021-02-20

963 downloads per month
Used in 6 crates (via abnf_to_pest)

AGPL-3.0

41KB
850 lines

ABNF

A parser for ABNF based on nom 5.

Example

use abnf::rulelist;

match rulelist("a = b / c\nc = *(d e)\n") {
    Ok(rules) => println!("{:#?}", rules),
    Err(error) => eprintln!("{}", error),
}

Output

[
    Rule {
        name: "a",
        node: Alternation(
            [
                Rulename(
                    "b",
                ),
                Rulename(
                    "c",
                ),
            ],
        ),
        kind: Basic,
    },
    Rule {
        name: "c",
        node: Repetition(
            Repetition {
                repeat: Repeat {
                    min: None,
                    max: None,
                },
                node: Group(
                    Concatenation(
                        [
                            Rulename(
                                "d",
                            ),
                            Rulename(
                                "e",
                            ),
                        ],
                    ),
                ),
            },
        ),
        kind: Basic,
    },
]

License

This crate is dual-licensed under Apache 2.0 and MIT terms.

Dependencies

~2MB
~34K SLoC