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

#2164 in Parser implementations

Download history 7405/week @ 2024-07-27 8143/week @ 2024-08-03 8381/week @ 2024-08-10 8274/week @ 2024-08-17 8270/week @ 2024-08-24 6471/week @ 2024-08-31 7424/week @ 2024-09-07 6131/week @ 2024-09-14 6566/week @ 2024-09-21 8697/week @ 2024-09-28 6994/week @ 2024-10-05 7442/week @ 2024-10-12 8751/week @ 2024-10-19 9780/week @ 2024-10-26 9134/week @ 2024-11-02 9082/week @ 2024-11-09

38,275 downloads per month
Used in 16 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

~3MB
~55K SLoC