]> gitweb.factorcode.org Git - factor.git/commitdiff
annotations docs
authorJoe Groff <arcata@gmail.com>
Thu, 12 Feb 2009 01:58:28 +0000 (19:58 -0600)
committerJoe Groff <arcata@gmail.com>
Thu, 12 Feb 2009 01:58:28 +0000 (19:58 -0600)
extra/annotations/annotations-docs.factor [new file with mode: 0644]
extra/annotations/annotations.factor

diff --git a/extra/annotations/annotations-docs.factor b/extra/annotations/annotations-docs.factor
new file mode 100644 (file)
index 0000000..c340554
--- /dev/null
@@ -0,0 +1,42 @@
+USING: accessors arrays combinators definitions generalizations
+help help.markup help.topics kernel sequences sorting vocabs
+words ;
+IN: annotations
+
+<PRIVATE
+: comment-word ( base -- word ) "!" prepend "annotations" lookup ; 
+: comment-usage-word ( base -- word ) "s" append "annotations" lookup ; 
+: comment-usage.-word ( base -- word ) "s." append "annotations" lookup ; 
+PRIVATE>
+
+"Code annotations"
+{
+    "The " { $vocab-link "annotations" } " vocabulary provides syntax for comment-like annotations that can be looked up with Factor's " { $link usage } " mechanism."
+}
+annotation-tags natural-sort
+[
+    [ \ $subsection swap comment-word 2array ] map append
+    "To look up annotations:" suffix
+] [
+    [ \ $subsection swap comment-usage.-word 2array ] map append
+] bi
+<article> "annotations" add-article
+
+"annotations" vocab "annotations" >>help drop
+
+annotation-tags [
+    {
+        [ [ \ $syntax ] dip "!" " your comment here" surround 2array ]
+        [ [ \ $description "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." 4array ]
+        [ [ \ $unchecked-example ] dip ": foo ( x y z -- w )\n    !" " --w-ó()ò-w-- kilroy was here\n    + * ;" surround 2array 3array ]
+        [ comment-word set-word-help ]
+
+        [ [ \ $description "Displays a list of words, help articles, and vocabularies that contain " \ $link ] dip comment-word 2array " annotations." 4array 1array ]
+        [ comment-usage.-word set-word-help ]
+
+        [ [ { $values { "usages" sequence } } \ $description "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 2array ] bi ]
+        [ comment-usage-word set-word-help ]
+
+        [ [ comment-word ] [ comment-usage-word ] [ comment-usage.-word ] tri 3array related-words ]
+    } cleave
+] each
index c61250b89d44deb261870b16dccbe7f545dbc3ab..6685e4e03658c92c7a344a276be1c022598ba420 100644 (file)
@@ -32,10 +32,12 @@ WHERE
 
 ;FUNCTOR
 
-{
+CONSTANT: annotation-tags {
     "XXX" "TODO" "FIXME" "BUG" "REVIEW" "LICENSE"
     "AUTHOR" "BROKEN" "HACK" "LOL" "NOTE"
-} [ define-annotation ] each
+}
+
+annotation-tags [ define-annotation ] each
 
 >>