factor: support -- in { } V{ } H{ } and $doc{ }

locals-and-roots
Doug Coleman 2016-06-23 22:46:12 -07:00
parent f3674c3468
commit 6c3632d43e
4 changed files with 15 additions and 12 deletions

View File

@ -12,7 +12,7 @@ HELP: WIN-EXCEPTION-HANDLER
$description{ "This special object is an " $link{ alien } " containing a pointer to the processes global exception handler. Only applicable on " $link{ windows } "." } ; $description{ "This special object is an " $link{ alien } " containing a pointer to the processes global exception handler. Only applicable on " $link{ windows } "." } ;
HELP: eq? HELP: eq?
$values{ { "obj1" object } { "obj2" object } { "?" boolean } } $values{ "obj1" object -- "obj2" object -- "?" boolean }
$description{ "Tests if two references point at the same object." } ; $description{ "Tests if two references point at the same object." } ;
HELP: drop $shuffle ; HELP: drop $shuffle ;
@ -76,7 +76,7 @@ HELP: leaf-signal-handler
$description{ "A word called by the VM when a VM error occurs." } ; $description{ "A word called by the VM when a VM error occurs." } ;
HELP: hashcode* HELP: hashcode*
$values{ { "depth" integer } { "obj" object } { "code" fixnum } } $values{ "depth" integer -- "obj" object -- "code" fixnum }
$contract{ "Outputs the hashcode of an object. The hashcode operation must satisfy the following properties:" $contract{ "Outputs the hashcode of an object. The hashcode operation must satisfy the following properties:"
$list{ $list{
{ "If two objects are equal under " $link{ = } ", they must have equal hashcodes." } { "If two objects are equal under " $link{ = } ", they must have equal hashcodes." }
@ -97,7 +97,7 @@ $description{ "Outputs the identity hashcode of an object. The identity hashcode
{ hashcode hashcode* identity-hashcode } related-words { hashcode hashcode* identity-hashcode } related-words
HELP: = HELP: =
$values{ { "obj1" object } { "obj2" object } { "?" boolean } } $values{ "obj1" object -- "obj2" object -- "?" boolean }
$description{ $description{
"Tests if two objects are equal. If " $snippet{ "obj1" } " and " $snippet{ "obj2" } " point to the same object, outputs " $link{ t } ". Otherwise, calls the " $link{ equal? } " generic word." "Tests if two objects are equal. If " $snippet{ "obj1" } " and " $snippet{ "obj2" } " point to the same object, outputs " $link{ t } ". Otherwise, calls the " $link{ equal? } " generic word."
} }
@ -141,11 +141,11 @@ $examples{
} ; } ;
HELP: clone HELP: clone
$values{ { "obj" object } { "cloned" "a new object" } } $values{ "obj" object -- "cloned" "a new object" }
$contract{ "Outputs a new object equal to the given object. This is not guaranteed to actually copy the object; it does nothing with immutable objects, and does not copy words either. However, sequences and tuples can be cloned to obtain a shallow copy of the original." } ; $contract{ "Outputs a new object equal to the given object. This is not guaranteed to actually copy the object; it does nothing with immutable objects, and does not copy words either. However, sequences and tuples can be cloned to obtain a shallow copy of the original." } ;
HELP: ? HELP: ?
$values{ { "?" "a generalized boolean" } { "true" object } { "false" object } { "true/false" { $snippet{ "true" } " or " $snippet{ "false" } } } } $values{ "?" "a generalized boolean" -- "true" object -- "false" object -- "true/false" { $snippet{ "true" } " or " $snippet{ "false" } } }
$description{ "Chooses between two values depending on the boolean value of " $snippet{ "cond" } "." } ; $description{ "Chooses between two values depending on the boolean value of " $snippet{ "cond" } "." } ;
HELP: boolean HELP: boolean

View File

@ -99,7 +99,10 @@ PRIVATE>
[ member? ] curry split-when ; inline [ member? ] curry split-when ; inline
: ?split ( seq separators -- pieces/seq ) : ?split ( seq separators -- pieces/seq )
split dup length 1 = [ first ] when ; inline split dup length 1 = [ first ] [ [ >array ] map ] if ; inline
: split-dashes ( seq -- seq/seq' )
{ -- } ?split ; inline
: split-slice ( seq separators -- pieces ) : split-slice ( seq separators -- pieces )
[ member? ] curry split-when-slice ; inline [ member? ] curry split-when-slice ; inline

View File

@ -56,7 +56,7 @@ IN: bootstrap.syntax
{ "]" "}" ";" ">>" "COMPILE>" } [ define-delimiter ] each { "]" "}" ";" ">>" "COMPILE>" } [ define-delimiter ] each
"--" [ "--" [
"--" define-symbol "--" "syntax" lookup-word suffix!
] define-core-syntax ] define-core-syntax
{ "_" "@" } define-fry-specifiers { "_" "@" } define-fry-specifiers
@ -181,14 +181,14 @@ IN: bootstrap.syntax
] define-core-syntax ] define-core-syntax
"[" [ parse-quotation suffix! ] define-core-syntax "[" [ parse-quotation suffix! ] define-core-syntax
"{" [ \ } [ >array ] parse-literal ] define-core-syntax "{" [ \ } [ split-dashes >array ] parse-literal ] define-core-syntax
"V{" [ \ } [ >vector ] parse-literal ] define-core-syntax "V{" [ \ } [ split-dashes >vector ] parse-literal ] define-core-syntax
"B{" [ \ } [ >byte-array ] parse-literal ] define-core-syntax "B{" [ \ } [ >byte-array ] parse-literal ] define-core-syntax
"BV{" [ \ } [ >byte-vector ] parse-literal ] define-core-syntax "BV{" [ \ } [ >byte-vector ] parse-literal ] define-core-syntax
"H{" [ \ } [ parse-hashtable ] parse-literal ] define-core-syntax "H{" [ \ } [ split-dashes parse-hashtable ] parse-literal ] define-core-syntax
"T{" [ parse-tuple-literal suffix! ] define-core-syntax "T{" [ parse-tuple-literal suffix! ] define-core-syntax
"W{" [ \ } [ first <wrapper> ] parse-literal ] define-core-syntax "W{" [ \ } [ first <wrapper> ] parse-literal ] define-core-syntax
"HS{" [ \ } [ >hash-set ] parse-literal ] define-core-syntax "HS{" [ \ } [ split-dashes >hash-set ] parse-literal ] define-core-syntax
"postpone\\" [ scan-word suffix! ] define-core-syntax "postpone\\" [ scan-word suffix! ] define-core-syntax
"\\" [ scan-word <wrapper> suffix! ] define-core-syntax "\\" [ scan-word <wrapper> suffix! ] define-core-syntax

View File

@ -27,7 +27,7 @@ SYNTAX: \ ABOUT:
COMPILE< COMPILE<
SYNTAX: \ HELP-SYNTAX: SYNTAX: \ HELP-SYNTAX:
scan-new-escaped scan-word ";" expect scan-new-escaped scan-word ";" expect
'[ \ } parse-until >array _ prefix suffix! ] define-syntax ; '[ \ } parse-until split-dashes >array _ prefix suffix! ] define-syntax ;
COMPILE> COMPILE>
HELP-SYNTAX: \ $breadcrumbs{ $breadcrumbs ; HELP-SYNTAX: \ $breadcrumbs{ $breadcrumbs ;