| 
									
										
										
										
											2009-02-11 19:35:08 -05:00
										 |  |  | ! (c)2009 Joe Groff, Doug Coleman. see BSD license | 
					
						
							|  |  |  | USING: accessors combinators.short-circuit definitions functors | 
					
						
							| 
									
										
										
										
											2009-03-07 02:22:21 -05:00
										 |  |  | kernel lexer namespaces parser prettyprint tools.crossref | 
					
						
							|  |  |  | sequences words ;
 | 
					
						
							| 
									
										
										
										
											2009-02-11 19:35:08 -05:00
										 |  |  | IN: annotations | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | << | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : (parse-annotation) ( accum -- accum )
 | 
					
						
							|  |  |  |     lexer get [ line-text>> parsed ] [ next-line ] bi ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : (non-annotation-usage) ( word -- usages )
 | 
					
						
							|  |  |  |     smart-usage | 
					
						
							| 
									
										
										
										
											2009-02-11 19:58:42 -05:00
										 |  |  |     [ { [ word? ] [ vocabulary>> "annotations" = ] } 1&& not ] | 
					
						
							| 
									
										
										
										
											2009-02-11 19:35:08 -05:00
										 |  |  |     filter ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | FUNCTOR: define-annotation ( NAME -- )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | (NAME) DEFINES (${NAME}) | 
					
						
							|  |  |  | !NAME  DEFINES !${NAME} | 
					
						
							|  |  |  | NAMEs  DEFINES ${NAME}s | 
					
						
							|  |  |  | NAMEs. DEFINES ${NAME}s. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WHERE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : (NAME) ( str -- ) drop ; inline
 | 
					
						
							| 
									
										
										
										
											2009-03-21 02:27:50 -04:00
										 |  |  | SYNTAX: !NAME (parse-annotation) \ (NAME) parsed ;
 | 
					
						
							| 
									
										
										
										
											2009-02-11 19:35:08 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : NAMEs ( -- usages )
 | 
					
						
							|  |  |  |     \ (NAME) (non-annotation-usage) ;
 | 
					
						
							|  |  |  | : NAMEs. ( -- )
 | 
					
						
							|  |  |  |     NAMEs sorted-definitions. ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ;FUNCTOR | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-11 20:58:28 -05:00
										 |  |  | CONSTANT: annotation-tags { | 
					
						
							| 
									
										
										
										
											2009-02-11 19:35:08 -05:00
										 |  |  |     "XXX" "TODO" "FIXME" "BUG" "REVIEW" "LICENSE" | 
					
						
							|  |  |  |     "AUTHOR" "BROKEN" "HACK" "LOL" "NOTE" | 
					
						
							| 
									
										
										
										
											2009-02-11 20:58:28 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | annotation-tags [ define-annotation ] each
 | 
					
						
							| 
									
										
										
										
											2009-02-11 19:35:08 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | >> | 
					
						
							|  |  |  | 
 |