factor/library/prettyprint/backend.facts

54 lines
2.6 KiB
Plaintext

USING: help io kernel prettyprint prettyprint-internals words ;
HELP: pprint*
{ $values { "obj" "an object" } }
{ $contract "Adds sections to the current block corresponding to the prettyprinted representation of the object." }
$prettyprinting-note
{ $see-also text newline <inset block> } ;
HELP: pprint-word
{ $values { "word" "a word" } }
{ $description "Adds a text section for the word. Unlike the " { $link word } " method of " { $link pprint* } ", this does not add a " { $link POSTPONE: POSTPONE: } " prefix to parsing words." }
$prettyprinting-note ;
HELP: ch>ascii-escape
{ $values { "ch" "a character" } { "str" "a string" } }
{ $description "Converts a character to an escape code." } ;
HELP: ch>unicode-escape
{ $values { "ch" "a character" } { "str" "a string" } }
{ $description "Converts a character to a Unicode escape code (" { $snippet "\\u1234"} ")." } ;
HELP: unparse-ch
{ $values { "ch" "a character" } }
{ $description "Adds the character to the sequence being constructed (see " { $link "namespaces-make" } "). If the character can appear in a string literal, it is added directly, otherwise an escape code is added." } ;
HELP: do-string-limit
{ $values { "str" "a string" } { "trimmed" "a possibly trimmed string" } }
{ $description "If " { $link string-limit } " is on, trims the string such that it does not exceed the margin, appending \"...\" if trimming took place." } ;
HELP: pprint-string
{ $values { "str" "a string" } { "prefix" "a prefix string" } }
{ $description "Outputs a text section consisting of the prefix, the string, and a final quote (\")." }
$prettyprinting-note ;
HELP: nesting-limit?
{ $values { "?" "a boolean" } }
{ $description "Tests if the " { $link nesting-limit } " has been reached." }
$prettyprinting-note ;
HELP: check-recursion
{ $values { "obj" "an object" } { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }
{ $description "If the object is already being printed, that is, if the prettyprinter has encountered a cycle in the object graph, or if the maximum nesting depth has been reached, outputs a dummy string. Otherwise applies the quotation to the object." }
$prettyprinting-note ;
HELP: length-limit?
{ $values { "seq" "a sequence" } { "trimmed" "a trimmed sequence" } { "?" "a boolean indicating if trimming took place" } }
{ $description "If the " { $link length-limit } " is set, trims the sequence if necessary, and outputs a boolean indicating if \"...\" should be output." }
$prettyprinting-note ;
HELP: pprint-elements
{ $values { "seq" "a sequence" } }
{ $description "Prettyprints the elements of a sequence, trimming the sequence to " { $link length-limit } " if necessary." }
$prettyprinting-note ;