annotations: Use SAME-FUNCTOR: to put in the annotations vocab.
parent
43e0ce4977
commit
78eea5071b
|
@ -3,6 +3,7 @@ help help.markup help.topics kernel sequences sorting vocabs
|
||||||
words combinators.smart tools.crossref ;
|
words combinators.smart tools.crossref ;
|
||||||
IN: annotations
|
IN: annotations
|
||||||
|
|
||||||
|
![=[
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
: comment-word ( base -- word ) "!" prepend "annotations" lookup-word ;
|
: comment-word ( base -- word ) "!" prepend "annotations" lookup-word ;
|
||||||
: comment-usage-word ( base -- word ) "s" append "annotations" lookup-word ;
|
: comment-usage-word ( base -- word ) "s" append "annotations" lookup-word ;
|
||||||
|
@ -66,3 +67,5 @@ annotation-tags [
|
||||||
[ [ comment-word ] [ comment-usage-word ] [ comment-usage.-word ] tri 3array related-words ]
|
[ [ comment-word ] [ comment-usage-word ] [ comment-usage.-word ] tri 3array related-words ]
|
||||||
} cleave
|
} cleave
|
||||||
] each
|
] each
|
||||||
|
|
||||||
|
]=]
|
|
@ -1,7 +1,7 @@
|
||||||
! (c)2009 Joe Groff, Doug Coleman. see BSD license
|
! (c)2009 Joe Groff, Doug Coleman. see BSD license
|
||||||
USING: accessors combinators.short-circuit definitions functors
|
USING: accessors combinators.short-circuit kernel lexer
|
||||||
kernel lexer namespaces parser prettyprint tools.crossref
|
namespaces sequences tools.crossref words ;
|
||||||
sequences words ;
|
FROM: functors2 => new-word SAME-FUNCTOR: ;
|
||||||
IN: annotations
|
IN: annotations
|
||||||
|
|
||||||
<<
|
<<
|
||||||
|
@ -14,30 +14,31 @@ IN: annotations
|
||||||
[ { [ word? ] [ vocabulary>> "annotations" = ] } 1&& not ]
|
[ { [ word? ] [ vocabulary>> "annotations" = ] } 1&& not ]
|
||||||
filter ;
|
filter ;
|
||||||
|
|
||||||
<FUNCTOR: define-annotation ( NAME -- )
|
SAME-FUNCTOR: annotation ( NAME: new-word -- ) [[
|
||||||
|
|
||||||
(NAME) DEFINES (${NAME})
|
USING: annotations kernel sequences tools.crossref ;
|
||||||
!NAME DEFINES !${NAME}
|
|
||||||
NAMEs DEFINES ${NAME}s
|
|
||||||
NAMEs. DEFINES ${NAME}s.
|
|
||||||
|
|
||||||
WHERE
|
: (${NAME}) ( str -- ) drop ; inline
|
||||||
|
|
||||||
: (NAME) ( str -- ) drop ; inline
|
SYNTAX: !${NAME} (parse-annotation) \ (${NAME}) suffix! ;
|
||||||
SYNTAX: !NAME (parse-annotation) \ (NAME) suffix! ;
|
|
||||||
|
|
||||||
: NAMEs ( -- usages )
|
: ${NAME}s ( -- usages )
|
||||||
\ (NAME) (non-annotation-usage) ;
|
\ (${NAME}) (non-annotation-usage) ;
|
||||||
: NAMEs. ( -- )
|
|
||||||
NAMEs sorted-definitions. ;
|
|
||||||
|
|
||||||
;FUNCTOR>
|
: ${NAME}s. ( -- )
|
||||||
|
${NAME}s sorted-definitions. ;
|
||||||
|
|
||||||
CONSTANT: annotation-tags {
|
]]
|
||||||
"XXX" "TODO" "FIXME" "BUG" "REVIEW" "LICENSE"
|
|
||||||
"AUTHOR" "BROKEN" "HACK" "LOL" "NOTE"
|
|
||||||
}
|
|
||||||
|
|
||||||
annotation-tags [ define-annotation ] each
|
|
||||||
|
|
||||||
|
SYNTAX: \ANNOTATIONS: ";" [ define-annotation ] each-token ;
|
||||||
>>
|
>>
|
||||||
|
|
||||||
|
! SYMBOLS: XXX TODO FIXME BUG REVIEW LICENSE
|
||||||
|
! AUTHOR BROKEN HACK LOL NOTE ;
|
||||||
|
|
||||||
|
! CONSTANT: annotation-tags {
|
||||||
|
! XXX TODO FIXME BUG REVIEW LICENSE
|
||||||
|
! AUTHOR BROKEN HACK LOL NOTE
|
||||||
|
! }
|
||||||
|
|
||||||
|
ANNOTATIONS: XXX TODO FIXME BUG REVIEW LICENSE AUTHOR BROKEN HACK LOL NOTE ;
|
||||||
|
|
Loading…
Reference in New Issue