aboutsummaryrefslogtreecommitdiff
path: root/printing/richprinter.ml
diff options
context:
space:
mode:
authorYann Régis-Gianas2014-11-05 22:52:09 +0100
committerYann Régis-Gianas2014-11-05 22:52:24 +0100
commit6b69fc07f9f17e4d61dbb244c69f6c9de326e00f (patch)
treefde7d3a055c7c8366504ea18913a816fb6dc325e /printing/richprinter.ml
parent3d2b9f1329557dd54720718bf064010d9538ea03 (diff)
lib/RichPp: Rename into Richpp.
printing/RichPrinter: Rename into Richprinter. printing/{ppvernac, ppconstr, pptactic}: Rename RichPp into Richpp. printing/Richprinter: Cosmetics.
Diffstat (limited to 'printing/richprinter.ml')
-rw-r--r--printing/richprinter.ml26
1 files changed, 26 insertions, 0 deletions
diff --git a/printing/richprinter.ml b/printing/richprinter.ml
new file mode 100644
index 0000000000..d27b7c3736
--- /dev/null
+++ b/printing/richprinter.ml
@@ -0,0 +1,26 @@
+open Richpp
+
+module Indexer = Indexer (struct type t = Ppannotation.t end)
+
+module RichppConstr = Ppconstr.Richpp (Indexer)
+module RichppVernac = Ppvernac.Richpp (Indexer)
+module RichppTactic = Pptactic.Richpp (Indexer)
+
+type rich_pp =
+ string
+ * Ppannotation.t Richpp.located Xml_datatype.gxml
+ * Xml_datatype.xml
+
+let make_richpp pr ast =
+ let raw_pp, rich_pp =
+ rich_pp Indexer.get_annotations (fun () -> pr ast)
+ in
+ let xml = Ppannotation.(
+ xml_of_rich_pp tag_of_annotation attributes_of_annotation rich_pp
+ )
+ in
+ (raw_pp, rich_pp, xml)
+
+let richpp_vernac = make_richpp RichppVernac.pr_vernac
+let richpp_constr = make_richpp RichppConstr.pr_constr_expr
+let richpp_tactic env = make_richpp (RichppTactic.pr_tactic env)