Skip to main content

Module print

Module print 

Source
Expand description

TLC’s value printing.

to_tlc_string ports the toString methods of tlc2.value.impl (tlaplus 94d0c50), including which lazy sets TLC expands when printing:

  • SUBSET S when |S| < 7;
  • [S -> T], [a : S] and S \X T when they have fewer than 2000 elements (TLCGlobals.enumBound);
  • filters and maps always;
  • intervals never (1..3, or {} when empty).

print_value adds TLC’s pretty-printer (ppr, a port of tlc2.pprint), as Print, PrintT, error messages and counterexample states use it.

Constants§

WIDTH
TLC’s default width (tlc2.value.Values.width, 80).

Functions§

escape_string
StringValue.PrintVersion: escapes ", \, tab, newline, form feed and carriage return.
format_state
A state as TLC prints it in a counterexample (TLCStateMut.toString): one /\ x = value line per variable, or x = value when there is a single variable. Each value is pretty-printed on its own, at width 80.
ppr
Values.ppr(String): pretty-prints a value’s toString form at width WIDTH.
ppr_width
PrettyPrint.mypp(value, width): returns value unchanged when it does not parse.
print_error_value
Fallible Values.ppr(v.toString()) for an argument diagnostic.
print_value
What Print/PrintT print for a value: Values.ppr(v.toStringUnchecked()).
to_tlc_string
Value.toStringUnchecked(): the single-line form, with errors raised while deciding how to print a lazy set propagated (as in Print and ToString).
to_tlc_string_lenient
Value.toString(): like to_tlc_string, but errors raised while deciding whether to expand a lazy set are swallowed (the set is printed in its lazy form), as TLC does when building error messages. Never fails; an unprintable value prints as a placeholder naming its kind.