The minimal base formatting combinators and show interface.The environment monad with some pre-defined fields for combinator formatting.
Run the combinators args, accumulating the output to
out, which is either an output port or a boolean, with
#t indicating current-output-port and
#f to collect the output as a string.
Temporarily bind the parameters in the body x.
The noop formatter. Generates no output and leaves the state unmodified.
Formats a displayed version of x - if a string or char, outputs the raw characters (as with `display'), if x is already a formatter defers to that, otherwise outputs a written version of x.
Formats a written version of x, as with `write'. The formatting
can be updated with the 'writer field.
Takes a single list of formatters, combined in sequence with
each.
Combines each of the formatters in a sequence using
displayed, so that strings and chars will be output
directly and other objects will be written.
Raw output - displays str to the formatter output port and updates row and col.
Captures the output of producer and formats the result with
consumer.
Outputs the string str, escaping any quote or escape characters. If esc-ch, which defaults to #
#f, escapes only the quote-ch, which defaults to #, by doubling it, as in SQL strings and CSV values. If renamer is provided, it should be a procedure of one character which maps that character to its escape value, e.g. #newline => #n, or #f if there is no escape value.
Only escape if there are special characters, in which case also wrap in quotes. For writing symbols in |...| escapes, or CSV fields, etc. The predicate indicates which characters cause slashification - this is in addition to automatic slashifying when either the quote or escape char is present.