From 92b2aa7b84ec8211a1078c75c39806d1e79cf78c Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 2 Mar 2019 12:35:07 +0100 Subject: Tweak pest generation --- abnf_to_pest/src/lib.rs | 4 ++-- 1 file 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, rule_settings: &HashMap 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, ()>> { -- cgit v1.2.3