Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Print.ml
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 64 65 66 67 68 69 70 71 72 73 74 75 76
(******************************************************************************) (* *) (* Monolith *) (* *) (* François Pottier *) (* *) (* Copyright Inria. All rights reserved. This file is distributed under the *) (* terms of the GNU Lesser General Public License as published by the Free *) (* Software Foundation, either version 3 of the License, or (at your *) (* option) any later version, as described in the file LICENSE. *) (* *) (******************************************************************************) include PPrint type 'a printer = 'a -> document let block doc = nest 2 (break 0 ^^ doc) ^^ break 0 let parens doc = lparen ^^ block doc ^^ rparen let raw_apply docs = group (flow (break 1) docs) let apply doc docs = raw_apply (doc :: docs) let toplevel_let pat body = group ( utf8string "let " ^^ pat ^^ utf8string " =" ^^ nest 2 (break 1 ^^ body) ^^ utf8string ";;" ) let output doc = ToChannel.pretty 0.9 78 stdout (group doc) let unit = string "()" let bool = OCaml.bool let char = OCaml.char let int i = utf8format (if i < 0 then "(%d)" else "%d") i let option f = function | None -> string "None" | Some x -> parens (string "Some " ^^ f x) let pair f1 f2 (x1, x2) = OCaml.tuple [ f1 x1; f2 x2 ] let list = OCaml.flowing_list let array = OCaml.flowing_array let candidate_finds doc = group ( break 1 ^^ string "(* candidate finds " ^^ doc ^^ string " *)" ) let assert_ doc = apply (string "assert") [ parens doc ]