Expand description
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))?;Structs§
- Pesty
Rule - Allow control over some of the pest properties of the outputted rule
Functions§
- escape_
rulename - Escape the rule name to be a valid Rust identifier.
- parse_
abnf - Parse an abnf file. Returns a map of rules.
- render_
rules_ to_ pest