]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/annotations/annotations.factor
factor: trim using lists
[factor.git] / extra / annotations / annotations.factor
index 5102a36a71708fc7b8df7f8192182c88907ae70d..2aa7174720a96767d7085edb9153e0bdf92eb1c3 100644 (file)
@@ -1,19 +1,19 @@
 ! (c)2009 Joe Groff, Doug Coleman. see BSD license
-USING: accessors combinators.short-circuit definitions functors
-kernel lexer namespaces parser prettyprint sequences words ;
+USING: accessors combinators.short-circuit functors kernel lexer
+namespaces sequences tools.crossref words ;
 IN: annotations
 
 <<
 
 : (parse-annotation) ( accum -- accum )
-    lexer get [ line-text>> parsed ] [ next-line ] bi ;
+    lexer get [ line-text>> suffix! ] [ next-line ] bi ;
 
 : (non-annotation-usage) ( word -- usages )
     smart-usage
-    [ { [ word? ] [ vocabulary>> "annotations" = not ] } 1&& ]
+    [ { [ word? ] [ vocabulary>> "annotations" = ] } 1&& not ]
     filter ;
 
-FUNCTOR: define-annotation ( NAME -- )
+<FUNCTOR: define-annotation ( NAME -- )
 
 (NAME) DEFINES (${NAME})
 !NAME  DEFINES !${NAME}
@@ -23,19 +23,20 @@ NAMEs. DEFINES ${NAME}s.
 WHERE
 
 : (NAME) ( str -- ) drop ; inline
-: !NAME (parse-annotation) \ (NAME) parsed ; parsing
+SYNTAX: !NAME (parse-annotation) \ (NAME) suffix! ;
 
 : NAMEs ( -- usages )
     \ (NAME) (non-annotation-usage) ;
 : NAMEs. ( -- )
     NAMEs sorted-definitions. ;
 
-;FUNCTOR
+;FUNCTOR>
 
-{
+CONSTANT: annotation-tags {
     "XXX" "TODO" "FIXME" "BUG" "REVIEW" "LICENSE"
     "AUTHOR" "BROKEN" "HACK" "LOL" "NOTE"
-} [ define-annotation ] each
+}
 
->>
+annotation-tags [ define-annotation ] each
 
+>>