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

#297 in Configuration

Download history 6059/week @ 2023-12-13 4088/week @ 2023-12-20 3520/week @ 2023-12-27 7647/week @ 2024-01-03 6418/week @ 2024-01-10 7202/week @ 2024-01-17 6956/week @ 2024-01-24 7063/week @ 2024-01-31 5634/week @ 2024-02-07 5892/week @ 2024-02-14 6601/week @ 2024-02-21 6908/week @ 2024-02-28 8043/week @ 2024-03-06 5556/week @ 2024-03-13 6663/week @ 2024-03-20 6278/week @ 2024-03-27

28,150 downloads per month
Used in 13 crates (2 directly)

MIT/Apache

8KB
143 lines

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


lib.rs:

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))?;

Dependencies

~3.5MB
~56K SLoC