Wax_utils.Styled_printerSourceA 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 None by 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.