3 ;;;; This software was originally part of the SBCL software system.
4 ;;;; SBCL is in the public domain and is provided with absolutely no warranty.
5 ;;;; See the COPYING file for more information.
7 ;;;; Written by Rudi Schlatte <rudi@constantly.at>, mangled
8 ;;;; by Nikodemus Siivola, Luis Oliveira, David Lichteblau, and others.
10 (in-package :parse-docstrings
)
13 ;;;; Fetching annotations that were stored using ANNOTATION-DOCUMENTATION:
15 (defun raw-annotations (name doc-type
)
16 (let ((key :documentation-annotations
))
17 (when (and (consp name
) (eq (car name
) 'setf
))
18 (setf name
(second name
))
19 (setf key
:setf-documentation-annotations
))
20 (getf (get name key
) doc-type
)))
22 (defun destructure-raw-annotation (x)
26 (with-output-to-string (s)
35 (warn "ignoring unrecognized sub-annotation: ~A" y
)))))))
36 (values kind sym docstring
)))
38 (defun parse-raw-annotations (annotations)
39 (let ((d-a (make-instance 'documentation-annotations
)))
40 (with-slots (arguments
48 (with-output-to-string (s)
49 (dolist (x annotations
)
55 (multiple-value-bind (kind sym docstring
)
56 (destructure-raw-annotation x
)
59 (push (make-instance 'parameter-like-annotation
64 (push (make-instance 'parameter-like-annotation
69 (push (make-instance 'cross-reference-annotation
74 (push (make-instance 'cross-reference-annotation
79 (push (make-instance 'cross-reference-annotation
84 (push (make-instance 'cross-reference-annotation
89 (push (make-instance 'cross-reference-annotation
94 (push (make-instance 'cross-reference-annotation
99 (warn "ignoring unrecognized annotation: ~A" x
)))))))
100 (setf arguments
(nreverse arguments
))
101 (setf return-values
(nreverse return-values
))
102 (setf conditions
(nreverse conditions
))
103 (setf slot-accessors
(nreverse slot-accessors
))
104 (setf constructors
(nreverse constructors
))
105 (setf see-also-list
(nreverse see-also-list
))
106 (values docstring d-a
)))))
108 (defun annotations (name doc-type
)
109 (parse-raw-annotations (raw-annotations name doc-type
)))