summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--abnf_to_pest/src/lib.rs4
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, ()>> {