1 USING: accessors arrays combinators definitions generalizations
2 help help.markup help.topics kernel sequences sorting vocabs
7 : comment-word ( base -- word ) "!" prepend "annotations" lookup ;
8 : comment-usage-word ( base -- word ) "s" append "annotations" lookup ;
9 : comment-usage.-word ( base -- word ) "s." append "annotations" lookup ;
12 : $annotation ( element -- )
14 [ "!" " your comment here" surround 1array $syntax ]
15 [ [ "Treats the rest of the line after the exclamation point as a code annotation that can be looked up with the " \ $link ] dip comment-usage.-word 2array " word." 3array $description ]
16 [ ": foo ( x y z -- w )\n !" " --w-ó()ò-w-- kilroy was here\n + * ;" surround 1array $unchecked-example ]
19 : $annotation-usage. ( element -- )
21 [ "Displays a list of words, help articles, and vocabularies that contain " \ $link ] dip comment-word 2array " annotations." 3array $description ;
23 : $annotation-usage ( element -- )
25 { "usages" sequence } $values
26 [ "Returns a list of words, help articles, and vocabularies that contain " \ $link ] dip [ comment-word 2array " annotations. For a more user-friendly display, use the " \ $link ] [ comment-usage.-word 2array " word." 6 narray ] bi 1array $description ;
30 "The " { $vocab-link "annotations" } " vocabulary provides syntax for comment-like annotations that can be looked up with Factor's " { $link usage } " mechanism."
32 annotation-tags natural-sort
34 [ \ $subsection swap comment-word 2array ] map append
35 "To look up annotations:" suffix
37 [ \ $subsection swap comment-usage.-word 2array ] map append
39 <article> "annotations" add-article
41 "annotations" vocab "annotations" >>help drop
45 [ [ \ $annotation swap 2array 1array ] [ comment-word set-word-help ] bi ]
46 [ [ \ $annotation-usage swap 2array 1array ] [ comment-usage-word set-word-help ] bi ]
47 [ [ \ $annotation-usage. swap 2array 1array ] [ comment-usage.-word set-word-help ] bi ]
48 [ [ comment-word ] [ comment-usage-word ] [ comment-usage.-word ] tri 3array related-words ]