File: pprintf.mli

package info (click to toggle)
camlp5 6.11%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,556 kB
  • ctags: 17,290
  • sloc: ml: 78,361; sh: 1,430; makefile: 1,217
file content (63 lines) | stat: -rw-r--r-- 3,039 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(* camlp5r *)
(* File generated by program: edit only if it does not compile. *)
(* Copyright (c) INRIA 2007-2012 *)

(** Definitions for pprintf statement.

    This module contains types and functions for the "pprintf" statement
    added by the syntax extension "pa_pprintf.cmo". *)

type pr_context = { ind : int; bef : string; aft : string; dang : string };;
   (** Printing context.
    - "ind" : the current indendation
    - "bef" : what should be printed before, in the same line
    - "aft" : what should be printed after, in the same line
    - "dang" : the dangling token to know whether parentheses are necessary *)

type 'a pr_fun = pr_context -> 'a -> string;;

val empty_pc : pr_context;;
   (** Empty printer context, equal to:
       [{ind = 0; bef = ""; aft = ""; dang = ""}] *)

val sprint_break :
  int -> int -> pr_context -> (pr_context -> string) ->
    (pr_context -> string) -> string;;
   (** [sprint_break nspaces offset pc f g] concat the two strings returned
       by [f] and [g], either in one line, if it holds without overflowing
       (see module [Pretty]), with [nspaces] spaces betwen them, or in two
       lines with [offset] spaces added in the indentation for the second
       line.
         This function don't need to be called directly. It is generated by
       the [pprintf] statement according to its parameters when the format
       contains breaks, like [@;] and [@ ]. *)

val sprint_break_all :
  bool -> pr_context -> (pr_context -> string) ->
    (int * int * (pr_context -> string)) list -> string;;
   (** [sprint_break_all force_newlines pc f fl] concat all strings returned
       by the list with separators [f]-[fl], the separators being the number
       of spaces and the offset like in the function [sprint_break]. The
       function works as "all or nothing", i.e. if the resulting string
       does not hold on the line, all strings are printed in different
       lines (even if sub-parts could hold in single lines). If the parameter
       [force_newline] is [True], all strings are printed in different
       lines, no horizontal printing is tested.
         This function don't need to be called directly. It is generated by
       the [pprintf] statement according to its parameters when the format
       contains parenthesized parts with "break all" like "@[<a>" and "@]",
       or "@[<b>" and "@]". *)

(* #load "pa_macro.cmo" *)

val with_ind : pr_context -> int -> pr_context;;
val with_ind_bef : pr_context -> int -> string -> pr_context;;
val with_ind_bef_aft : pr_context -> int -> string -> string -> pr_context;;
val with_bef : pr_context -> string -> pr_context;;
val with_bef_aft : pr_context -> string -> string -> pr_context;;
val with_bef_aft_dang :
  pr_context -> string -> string -> string -> pr_context;;
val with_bef_dang : pr_context -> string -> string -> pr_context;;
val with_aft : pr_context -> string -> pr_context;;
val with_aft_dang : pr_context -> string -> string -> pr_context;;
val with_dang : pr_context -> string -> pr_context;;