module Pprintf:Definitions for pprintf statement.sig
..end
This module contains types and functions for the "pprintf" statement
added by the syntax extension "pa_pprintf.cmo".
type
pr_context = {
|
ind : |
|
bef : |
|
aft : |
|
dang : |
val empty_pc : pr_context
{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 "@
".