#abnf #pest #pest-parser #configuration-language

abnf_to_pest

A tiny crate that helps convert ABNF grammars to pest

6 releases

0.5.1 Aug 15, 2022
0.5.0 Apr 5, 2020
0.2.0 Dec 24, 2019
0.1.2 Dec 21, 2019
0.1.1 Apr 15, 2019

#2 in #abnf

Download history 9046/week @ 2024-12-15 2846/week @ 2024-12-22 4538/week @ 2024-12-29 6030/week @ 2025-01-05 6874/week @ 2025-01-12 6306/week @ 2025-01-19 7376/week @ 2025-01-26 9687/week @ 2025-02-02 8476/week @ 2025-02-09 6619/week @ 2025-02-16 7698/week @ 2025-02-23 7278/week @ 2025-03-02 6668/week @ 2025-03-09 7519/week @ 2025-03-16 7907/week @ 2025-03-23 8128/week @ 2025-03-30

30,671 downloads per month
Used in 19 crates (2 directly)

MIT/Apache

8KB
143 lines

A tiny crate that helps convert ABNF grammars to pest.

Example usage:

let abnf_path = "src/grammar.abnf";
let pest_path = "src/grammar.pest";

let mut file = File::open(abnf_path)?;
let mut data = Vec::new();
file.read_to_end(&mut data)?;
data.push('\n' as u8);

let mut rules = abnf_to_pest::parse_abnf(&data)?;
rules.remove("some_inconvenient_rule");

let mut file = File::create(pest_path)?;
writeln!(&mut file, "{}", render_rules_to_pest(rules).pretty(80))?;

abnf_to_pest

A tiny crate that helps convert ABNF grammars to pest.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions

Dependencies

~3MB
~55K SLoC