package mopsa
Install
Dune Dependency
Authors
Maintainers
Sources
md5=fdee20e988343751de440b4f6b67c0f4
sha512=f5cbf1328785d3f5ce40155dada2d95e5de5cce4f084ea30cfb04d1ab10cc9403a26cfb3fa55d0f9da72244482130fdb89c286a9aed0d640bba46b7c00e09500
doc/core/Core/Print/index.html
Module Core.Print
Source
Print - structured pretty-printing
Print objects
Symbols for printing maps, lists and sets
Structured print objects
type print_object =
| Empty
| Bool of bool
| Int of Z.t
| Float of float
| String of string
| Var of Ast.Var.var
| Map of (print_object, print_object) map * symbols
| List of print_object list * symbols
| Set of print_object set * symbols
Printers
Printers encapsulate the structured objects to print along the history of printed expression
Get the structured print object of a printer
Get the expressions that were already printed
Mark an expression as printed
Check whether an expression was already printed
Print paths
Selectors of print objects
Path of a print object
find_print_object path obj
returns the object placed at path
in obj
match_print_object_keys re obj
slices obj
to paths containing keys that match re
Generic print functions
pprint ~path:p printer o
prints object o
at path p
in printer
.
pbox f x
returns a boxed object created by f
when applied to x
. It is equivalent to
let printer = empty_printer () in
f printer x;
get_printed_object printer
fbox fmt
returns a string object of a formatted value
sprint f x
returns the string representing the boxed object pbox f x
fkey fmt
returns a key selector with a formatted string
pkey f x
returns a key selector with a printed string
Typed print functions
Print a string object
Print a boolean object
Print an integer object
Print an integer object
Print a float object
Print a variable
val pp_list :
?path:print_path ->
?lopen:string ->
?lsep:string ->
?lclose:string ->
(printer -> 'a -> unit) ->
printer ->
'a list ->
unit
pp_list ~path:p f printer l
prints a list l
at path p
by boxing f
on every element of l
val pp_obj_list :
?path:print_path ->
?lopen:string ->
?lsep:string ->
?lclose:string ->
printer ->
print_object list ->
unit
pp_obj_list ~path:p printer l
prints a list of objects at path p
. Useful for printing heterogenous lists.
val pp_map :
?path:print_path ->
?mopen:string ->
?msep:string ->
?mclose:string ->
?mbind:string ->
(printer -> 'k -> unit) ->
(printer -> 'v -> unit) ->
printer ->
('k * 'v) list ->
unit
pp_smap ~path:p fk fv printer l
prints a map from a list l
of pairs of keys and values. Keys are boxed with function fk
and values with function fv
.
val pp_mapi :
?path:print_path ->
?mopen:string ->
?msep:string ->
?mclose:string ->
?mbind:string ->
(printer -> 'k -> unit) ->
(printer -> ('k * 'v) -> unit) ->
printer ->
('k * 'v) list ->
unit
val pp_obj_map :
?path:print_path ->
?mopen:string ->
?msep:string ->
?mclose:string ->
?mbind:string ->
printer ->
(print_object * print_object) list ->
unit
pp_obj_smap ~path:p printer l
prints a map from a list of pairs of print objects
val pp_obj_set :
?path:print_path ->
?sopen:string ->
?ssep:string ->
?sclose:string ->
printer ->
print_object set ->
unit
pp_obj_set ~path:p printer l
prints a set of objects at path p
. Useful for printing heterogenous sets.
val pp_set :
?path:print_path ->
?sopen:string ->
?ssep:string ->
?sclose:string ->
(printer -> 'a -> unit) ->
printer ->
'a set ->
unit
pp_set ~path:p f printer l
prints a set from a list l
at path p
by boxing f
on every element of l
Format
Pretty-print a printer objct
Pretty-print the printer output in a format string
Convert a printer function into a format function
val unformat :
?path:print_path ->
(Stdlib.Format.formatter -> 'a -> unit) ->
printer ->
'a ->
unit
Convert a format function into a printer
JSON
Convert a printer object to JSON
Convert JSON to a printer object