Debian Codegraph @

ide/rocqide/protocol/richpp.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (** This module offers semi-structured pretty-printing. *)
12
13 (** Each annotation of the semi-structured document refers to the
14 substring it annotates. *)
15 type 'annotation located = {
16 annotation : 'annotation option;
17 startpos : int;
18 endpos : int
19 }
20
21 (* XXX: The width parameter should be moved to a `formatter_property`
22 record shared with Topfmt *)
23
24 (** [rich_pp width ppcmds] returns the interpretation
25 of [ppcmds] as a semi-structured document
26 that represents (located) annotations of this string.
27 The [get_annotations] function is used to convert tags into the desired
28 annotation. [width] sets the printing width of the formatter. *)
29 val rich_pp : width:int -> ?depth:int -> Pp.t -> Pp.pp_tag located Xml_datatype.gxml
30
31 (** [annotations_positions ssdoc] returns a list associating each
32 annotations with its position in the string from which [ssdoc] is
33 built. *)
34 val annotations_positions :
35 'annotation located Xml_datatype.gxml ->
36 ('annotation * (int * int)) list
37
38 (** [xml_of_rich_pp ssdoc] returns an XML representation of the
39 semi-structured document [ssdoc]. *)
40 val xml_of_rich_pp :
41 ('annotation -> string) ->
42 ('annotation -> (string * string) list) ->
43 'annotation located Xml_datatype.gxml ->
44 Xml_datatype.xml
45
46 (** {5 Enriched text} *)
47
48 type richpp = Xml_datatype.xml
49
50 (** Type of text with style annotations *)
51
52 val richpp_of_pp : width:int -> ?depth:int -> Pp.t -> richpp
53 (** Extract style information from formatted text *)