Commit 2ea43a7f authored by POTTIER Francois's avatar POTTIER Francois

A small simplification in [UnparameterizedPrinter].

parent e06bc4c2
......@@ -169,12 +169,11 @@ let print_rules mode f g =
let rules = List.sort compare_rules (StringMap.bindings g.rules) in
List.iter (fun (nt, r) ->
fprintf f "\n%s:\n" (Misc.normalize nt);
let first = ref true in
(* Menhir accepts a leading "|", but bison does not. Let's not print it.
So, we print a bar-separated list. *)
let sep = Misc.once (" ") ("| ") in
List.iter (fun br ->
(* Menhir accepts a leading "|", but bison does not. Let's not print it. *)
let sep = if !first then " " else "| " in
first := false;
fprintf f "%s" sep;
fprintf f "%s" (sep());
print_branch mode f br
) r.branches
) rules
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment