aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbarras2003-10-16 15:52:35 +0000
committerbarras2003-10-16 15:52:35 +0000
commitea3ed5f666080d072ae3f1ec4811531b54bc4c9e (patch)
tree60d4b8d0ba516835857283a92d2e2b16d86d1dba
parent8b5f6f835be01b2b0510cdbea939050d2c2583c6 (diff)
translator avoids printing a . followed by a ( by inserting a space
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@4655 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--toplevel/vernac.ml22
1 files changed, 18 insertions, 4 deletions
diff --git a/toplevel/vernac.ml b/toplevel/vernac.ml
index 00020a85a6..1308b7c701 100644
--- a/toplevel/vernac.ml
+++ b/toplevel/vernac.ml
@@ -99,12 +99,26 @@ let parse_phrase (po, verbch) =
let just_parsing = ref false
let chan_translate = ref stdout
+let last_char = ref '\000'
+
+let set_formatter_translator() =
+ let ch = !chan_translate in
+ let out s b e =
+ let n = e-b in
+ if n > 0 then begin
+ (match !last with
+ '.' -> if s.[b] = '(' then output ch " " 0 1
+ | _ -> ());
+ last := s.[e-1]
+ end;
+ output ch s b e
+ in
+ Format.set_formatter_output_functions out (fun () -> flush ch);
+ Format.set_max_boxes max_int
+
let pr_new_syntax loc ocom =
- if !translate_file then begin
- Format.set_formatter_out_channel !chan_translate;
- Format.set_max_boxes max_int;
- end;
+ if !translate_file then set_formatter_translator();
let fs = States.freeze () in
let com = match ocom with
| Some (VernacV7only _) ->