package wax-lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=41b580846af8d41bdf6c3f005f62e38feda3e60fe2e9e4aa440db34ce515a153
sha512=4b3a181fcc7d743194a8647260870fb5190770066a197bcc48104c2b77fd40c643228b795c2bcd6b29a120820e969eb42a37a9bcec98b3f608d13f152d9f6579
doc/wax-lib.utils/Wax_utils/Styled_printer/index.html
Module Wax_utils.Styled_printerSource
A pretty-printing context pairing a layout Printer.t with a colour Colors.theme and the Trivia (comments, blank lines) to weave back into the output. The styling and trivia plumbing is shared by the Wax and the WebAssembly printers, which wrap this context with their own format-specific state.
type t = {printer : Printer.t;theme : Colors.theme;mutable style_override : Colors.style option;(*When set, every styled atom is rendered in this style instead of its own; used to colour an expression printed inside an attribute. Left
*)Noneby printers that do not need it.trivia : Trivia.t;seen : (Ast.location, unit) Hashtbl.t;collect : (Ast.location, unit) Hashtbl.t option;
}val create :
printer:Printer.t ->
theme:Colors.theme ->
?collect:(Ast.location, unit) Hashtbl.t ->
trivia:Trivia.t ->
unit ->
tBuild a context with a fresh seen table and no style_override.
Emit text wrapped in the theme's escape sequence for the given style — or for the style_override, when one is in effect. len overrides the text's display width.
Emit a list of trivia entries (comments and blank lines).
Look up (and mark as seen) the trivia associated with a location.
Emit a node's before trivia, run the body, then its within/after trivia.
Run the body with style_override set to the given style; a no-op on the override if one is already in effect.