package ocaml-protoc

  1. Overview
  2. Docs

Formatting utilities for code generation

types

type scope

A scope is a formatting container which can contains line of text as well as other nested scopes

In other word a scope define an indentation section.

Creation

val empty_scope : unit -> scope

empty_scope () returns a brand new scope

val line : scope -> string -> unit

line scope s adds s to scope

val linep : scope -> ('a, unit, string, unit) format4 -> 'a
val empty_line : scope -> unit

empty_line scope adds an empty line to scope

val sub_scope : scope -> (scope -> unit) -> unit

sub_scope scope f adds a sub scope and apply f to it.

Printing

val to_string : scope -> string

print scope returns the formatted scops with a 2 character indentation for each scope.

val output : out_channel -> scope -> unit

Write to output

OCaml

Innovation. Community. Security.