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