diff options
author | Nadrieril | 2019-03-02 12:35:07 +0100 |
---|---|---|
committer | Nadrieril | 2019-03-02 12:35:07 +0100 |
commit | 92b2aa7b84ec8211a1078c75c39806d1e79cf78c (patch) | |
tree | fe2c57d548359e44188bac8924c6475db2d0becf | |
parent | e5d9aee00b0c775df1d8e2d8819aeb80dffa73c2 (diff) |
Tweak pest generation
-rw-r--r-- | abnf_to_pest/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/abnf_to_pest/src/lib.rs b/abnf_to_pest/src/lib.rs index cb7ba99..7381113 100644 --- a/abnf_to_pest/src/lib.rs +++ b/abnf_to_pest/src/lib.rs @@ -44,14 +44,14 @@ pub fn abnf_to_pest(data: &Vec<u8>, rule_settings: &HashMap<String, PestRuleSett } fn format_alternation(x: Alternation) -> Doc<'static, BoxDoc<'static, ()>> { Doc::intersperse( - x.concatenations.into_iter().map(format_concatenation), + x.concatenations.into_iter().map(|x| format_concatenation(x).nest(2).group()), Doc::space().append(Doc::text("| ")) ) } fn format_concatenation(x: Concatenation) -> Doc<'static, BoxDoc<'static, ()>> { Doc::intersperse( x.repetitions.into_iter().map(format_repetition), - Doc::text(" ~ ") + Doc::space().append(Doc::text("~ ")) ) } fn format_repetition(x: Repetition) -> Doc<'static, BoxDoc<'static, ()>> { |