From 2050561915bbfeecca1fe2e3eeaeb3ac680444ef Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Fri, 18 Sep 2009 15:11:01 -0500 Subject: [PATCH] document number-base prettyprinter variable. add more docs about hex float syntax --- basis/prettyprint/config/config-docs.factor | 3 +++ basis/prettyprint/prettyprint-docs.factor | 5 +++-- core/math/parser/parser-docs.factor | 6 +++--- core/syntax/syntax-docs.factor | 11 +++++++---- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/basis/prettyprint/config/config-docs.factor b/basis/prettyprint/config/config-docs.factor index 1dcb1b5617..ccc63c61cb 100644 --- a/basis/prettyprint/config/config-docs.factor +++ b/basis/prettyprint/config/config-docs.factor @@ -19,6 +19,9 @@ HELP: length-limit HELP: line-limit { $var-description "The maximum number of lines output by the prettyprinter before output is truncated with \"...\". The default is " { $link f } ", denoting unlimited line count." } ; +HELP: number-base +{ $var-description "The number base in which the prettyprinter will output numeric literals. A value of " { $snippet "2" } " will print integers and ratios in binary with " { $link POSTPONE: BIN: } ", and " { $snippet "8" } " will print them in octal with " { $link POSTPONE: OCT: } ". A value of " { $snippet "16" } " will print all integers, ratios, and floating-point values in hexadecimal with " { $link POSTPONE: HEX: } ". Other values of " { $snippet "number-base" } " will print numbers in decimal, which is the default." } ; + HELP: string-limit? { $var-description "Toggles whether printed strings are truncated to the margin." } ; diff --git a/basis/prettyprint/prettyprint-docs.factor b/basis/prettyprint/prettyprint-docs.factor index 7c114f2e22..1560b208ab 100644 --- a/basis/prettyprint/prettyprint-docs.factor +++ b/basis/prettyprint/prettyprint-docs.factor @@ -28,6 +28,7 @@ ARTICLE: "prettyprint-variables" "Prettyprint control variables" { $subsection nesting-limit } { $subsection length-limit } { $subsection line-limit } +{ $subsection number-base } { $subsection string-limit? } { $subsection boa-tuples? } { $subsection c-object-pointers? } @@ -202,8 +203,8 @@ HELP: .o { $description "Outputs an integer in octal." } ; HELP: .h -{ $values { "n" "an integer" } } -{ $description "Outputs an integer in hexadecimal." } ; +{ $values { "n" "an integer or floating-point value" } } +{ $description "Outputs an integer or floating-point value in hexadecimal." } ; HELP: stack. { $values { "seq" "a sequence" } } diff --git a/core/math/parser/parser-docs.factor b/core/math/parser/parser-docs.factor index ebb9c8aa5e..c3ee350099 100644 --- a/core/math/parser/parser-docs.factor +++ b/core/math/parser/parser-docs.factor @@ -61,7 +61,7 @@ HELP: bin> $nl "Outputs " { $link f } " if the string does not represent a number." } ; -{ bin> POSTPONE: BIN: bin> .b } related-words +{ >bin POSTPONE: BIN: bin> .b } related-words HELP: oct> { $values { "str" string } { "n/f" "a real number or " { $link f } } } @@ -69,7 +69,7 @@ HELP: oct> $nl "Outputs " { $link f } " if the string does not represent a number." } ; -{ oct> POSTPONE: OCT: oct> .o } related-words +{ >oct POSTPONE: OCT: oct> .o } related-words HELP: hex> { $values { "str" string } { "n/f" "a real number or " { $link f } } } @@ -77,7 +77,7 @@ HELP: hex> $nl "Outputs " { $link f } " if the string does not represent a number." } ; -{ hex> POSTPONE: HEX: hex> .h } related-words +{ >hex POSTPONE: HEX: hex> .h } related-words HELP: >base { $values { "n" real } { "radix" "an integer between 2 and 36" } { "str" string } } diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index e34fb0957f..394ae3f67c 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -593,10 +593,13 @@ HELP: #! { $description "Discards all input until the end of the line." } ; HELP: HEX: -{ $syntax "HEX: integer" } -{ $values { "integer" "hexadecimal digits (0-9, a-f, A-F)" } } -{ $description "Adds an integer read from a hexadecimal literal to the parse tree." } -{ $examples { $example "USE: prettyprint" "HEX: ff ." "255" } } ; +{ $syntax "HEX: NNN" "HEX: NNN.NNNpEEE" } +{ $values { "N" "hexadecimal digit (0-9, a-f, A-F)" } { "pEEE" "decimal exponent value" } } +{ $description "Adds an integer or floating-point value read from a hexadecimal literal to the parse tree." } +{ $examples + { $example "USE: prettyprint" "HEX: ff ." "255" } + { $example "USE: prettyprint" "HEX: 1.8p5 ." "48.0" } +} ; HELP: OCT: { $syntax "OCT: integer" }