Module Ext_pp

type t

A simple pretty printer

Advantage compared with Format, P.newline does not screw the layout, have better control when do a newline (sicne JS has ASI) Easy to tweak

  • be a little smarter
  • buffer the last line, so that we can do a smart newline, when it's really safe to do so
val indent_length : int
val string : t -> string -> unit
val space : t -> unit
val nspace : t -> int -> unit
val group : t -> int -> (unit -> 'a) -> 'a

group will record current indentation and indent futher

val vgroup : t -> int -> (unit -> 'a) -> 'a
val paren : t -> (unit -> 'a) -> 'a
val brace : t -> (unit -> 'a) -> 'a
val paren_group : t -> int -> (unit -> 'a) -> 'a
val cond_paren_group : t -> bool -> int -> (unit -> 'a) -> 'a
val paren_vgroup : t -> int -> (unit -> 'a) -> 'a
val brace_group : t -> int -> (unit -> 'a) -> 'a
val brace_vgroup : t -> int -> (unit -> 'a) -> 'a
val bracket_group : t -> int -> (unit -> 'a) -> 'a
val bracket_vgroup : t -> int -> (unit -> 'a) -> 'a
val newline : t -> unit
val at_least_two_lines : t -> unit
val from_channel : Stdlib.out_channel -> t
val from_buffer : Stdlib.Buffer.t -> t
val flush : t -> unit -> unit
val current_line : t -> int
val current_column : t -> int