source: Deliverables/D2.2/8051/src/utilities/printPottier.mli @ 486

Last change on this file since 486 was 486, checked in by ayache, 8 years ago

Deliverable D2.2

File size: 2.0 KB
Line 
1(* Pasted from Pottier's PP compiler *)
2
3(** This module provides printing utilities. *)
4
5type punctuation =
6    unit -> string
7
8type 'a printer =
9    unit -> 'a -> string
10
11(* [nl] prints a newline character and a certain amount of
12   whitespace that reflects the current indentation level. *)
13
14val nl: punctuation
15
16(* [indent ofs] transforms a printer into another printer
17   that indents material [ofs] characters to the right. *)
18
19val indent: int -> 'a printer -> 'a printer
20
21(* [list] prints a list without any delimiters. *)
22
23val list: 'a printer -> 'a list printer
24
25(* [preclist] prints a list where a delimiter precedes every
26   element. *)
27
28val preclist: punctuation -> 'a printer -> 'a list printer
29
30(* [termlist] prints a list where a delimiter terminates every
31   element. *)
32
33val termlist: punctuation -> 'a printer -> 'a list printer
34
35(* [seplist] prints a list where a separator separates every two
36   consecutive elements. *)
37
38val seplist: punctuation -> 'a printer -> 'a list printer
39
40(* [annlist] prints nothing if its list argument is empty, and prints
41   an announcement followed by the list if the list is nonempty. *)
42
43val annlist: punctuation -> 'a list printer -> 'a list printer
44
45(* Punctuation. *)
46
47val space: punctuation
48val comma: punctuation
49val semicolon: punctuation
50val var: punctuation
51val seminl: punctuation
52val nlspace: int -> punctuation
53val nlnl: punctuation
54
55(* [atmost n delimiter stop] normally prints a [delimiter], except that,
56   every [n] calls, it prints a [stop] in addition. *)
57
58val atmost: int -> punctuation -> punctuation -> punctuation
59
60(* [catenate] turns a list of columns into a single column, adding
61   padding (whitespace) to enforce alignment. *)
62
63val catenate: string list list -> string list
64
65(* [transposerev] turns a reversed list of lines into a list of columns. *)
66
67val transposerev: string list list -> string list list
68
69(* [showif flag printer x] displays [x] on standard output using
70   [printer] when [flag] is set. It returns [x]. *)
71
72val showif: bool -> 'a printer -> 'a -> 'a
73
Note: See TracBrowser for help on using the repository browser.