]> gitweb.factorcode.org Git - factor.git/blob - core/prettyprint/backend.facts
3689ac9f245b502631879430b6fa0ecb7318dc8b
[factor.git] / core / prettyprint / backend.facts
1 USING: help io kernel prettyprint prettyprint-internals words ;
2
3 HELP: pprint*
4 { $values { "obj" "an object" } }
5 { $contract "Adds sections to the current block corresponding to the prettyprinted representation of the object." }
6 $prettyprinting-note
7 { $see-also text newline <inset block> } ;
8
9 HELP: pprint-word
10 { $values { "word" "a word" } }
11 { $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." }
12 $prettyprinting-note ;
13
14 HELP: ch>ascii-escape
15 { $values { "ch" "a character" } { "str" "a string" } }
16 { $description "Converts a character to an escape code." } ;
17
18 HELP: ch>unicode-escape
19 { $values { "ch" "a character" } { "str" "a string" } }
20 { $description "Converts a character to a Unicode escape code (" { $snippet "\\u1234"} ")." } ;
21
22 HELP: unparse-ch
23 { $values { "ch" "a character" } }
24 { $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." } ;
25
26 HELP: do-string-limit
27 { $values { "str" "a string" } { "trimmed" "a possibly trimmed string" } }
28 { $description "If " { $link string-limit } " is on, trims the string such that it does not exceed the margin, appending \"...\" if trimming took place." } ;
29
30 HELP: pprint-string
31 { $values { "str" "a string" } { "prefix" "a prefix string" } }
32 { $description "Outputs a text section consisting of the prefix, the string, and a final quote (\")." }
33 $prettyprinting-note ;
34
35 HELP: nesting-limit?
36 { $values { "?" "a boolean" } }
37 { $description "Tests if the " { $link nesting-limit } " has been reached." }
38 $prettyprinting-note ;
39
40 HELP: check-recursion
41 { $values { "obj" "an object" } { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }
42 { $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." }
43 $prettyprinting-note ;
44
45 HELP: length-limit?
46 { $values { "seq" "a sequence" } { "trimmed" "a trimmed sequence" } { "?" "a boolean indicating if trimming took place" } }
47 { $description "If the " { $link length-limit } " is set, trims the sequence if necessary, and outputs a boolean indicating if \"...\" should be output." }
48 $prettyprinting-note ;
49
50 HELP: pprint-elements
51 { $values { "seq" "a sequence" } }
52 { $description "Prettyprints the elements of a sequence, trimming the sequence to " { $link length-limit } " if necessary." }
53 $prettyprinting-note ;