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
38,275 downloads per month
Used in 16 crates
(2 directly)
8KB
143 lines
abnf_to_pest
A tiny crate that helps convert ABNF grammars to pest.
License
Licensed under either of
- Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (http://opensource.org/licenses/MIT)
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