package wax-lib
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=cc19989d0db930d9300d7356c8f127309424a82767dd3c91ffd19a0bfd20e3a6
sha512=14ff9219dc6c4e8855c3cb895bd1af6fd81d1c521afefe1e7f69208a2e37abc7ec0946f188198a26780aa405fd43a526b938158334a019f7a5d991d8efc437c3
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 : Trivia.locations;collect : Trivia.locations option;
}val create :
printer:Printer.t ->
theme:Colors.theme ->
?collect:Trivia.locations ->
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.