diff options
| author | Emilio Jesus Gallego Arias | 2016-12-05 17:56:22 +0100 |
|---|---|---|
| committer | Emilio Jesus Gallego Arias | 2017-03-21 15:51:39 +0100 |
| commit | 3fc02bb2034a648c9c27b76a9e7b4e02a78e55b9 (patch) | |
| tree | cf3856edc9b24a75d30f465e6e29a42962329a4a /toplevel | |
| parent | a8ec2dc5c330ded1ba400ef202c57e68d2533312 (diff) | |
[pp] Move terminal-specific tagging to the toplevel.
Previously, tags were associated to terminal styles, which doesn't make
sense on terminal-free pretty printing scenarios.
This commit moves tag interpretation to the toplevel terminal handling
module `Topfmt`.
Diffstat (limited to 'toplevel')
| -rw-r--r-- | toplevel/coqloop.ml | 2 | ||||
| -rw-r--r-- | toplevel/coqtop.ml | 17 |
2 files changed, 8 insertions, 11 deletions
diff --git a/toplevel/coqloop.ml b/toplevel/coqloop.ml index 43807c1ca6..0cc6ca3177 100644 --- a/toplevel/coqloop.ml +++ b/toplevel/coqloop.ml @@ -252,7 +252,7 @@ let print_toplevel_error (e, info) = else mt () else print_location_in_file loc in - let hdr msg = hov 0 (tag Ppstyle.error_tag (str "Error:") ++ spc () ++ msg) in + let hdr msg = hov 0 (Topfmt.err_hdr ++ msg) in locmsg ++ hdr (CErrors.iprint (e, info)) (* Read the input stream until a dot is encountered *) diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml index 268d40c91d..c4d8dfec9f 100644 --- a/toplevel/coqtop.ml +++ b/toplevel/coqtop.ml @@ -67,8 +67,8 @@ let init_color () = () | Some s -> (** Overwrite all colors *) - Ppstyle.clear_styles (); - Ppstyle.parse_config s; + Topfmt.clear_styles (); + Topfmt.parse_color_config s; Topfmt.init_color_output () end @@ -308,19 +308,16 @@ let usage () = let print_style_tags () = let () = init_color () in - let tags = Ppstyle.dump () in + let tags = Topfmt.dump_tags () in let iter (t, st) = - let st = match st with Some st -> st | None -> Terminal.make () in - let opt = Terminal.eval st ^ t ^ Terminal.reset ^ "\n" in + let opt = Terminal.eval st ^ t ^ Terminal.reset ^ "\n" in print_string opt in - let make (t, st) = match st with - | None -> None - | Some st -> + let make (t, st) = let tags = List.map string_of_int (Terminal.repr st) in - Some (t ^ "=" ^ String.concat ";" tags) + (t ^ "=" ^ String.concat ";" tags) in - let repr = List.map_filter make tags in + let repr = List.map make tags in let () = Printf.printf "COQ_COLORS=\"%s\"\n" (String.concat ":" repr) in let () = List.iter iter tags in flush_all () |
