diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-03 06:42:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-03 06:42:53 -0700 |
commit | 3ed21c522b7914a7eed0cf4dffff66e009406213 (patch) | |
tree | 2a73857694190ec02d7f6049bc9bd1ec7fec8a1c | |
parent | 4eea106b17da71b27b69f0856a3cb4e0c2d93132 (diff) | |
download | txr-3ed21c522b7914a7eed0cf4dffff66e009406213.tar.gz txr-3ed21c522b7914a7eed0cf4dffff66e009406213.tar.bz2 txr-3ed21c522b7914a7eed0cf4dffff66e009406213.zip |
tags: grok Lisp definitions inside @(do ...).
* tags.tl (unexpand): New function.
(process-clause): Walk the forms enclosed in a @(do ...)
directive that appears at the top level. Because all Lisp is
macro-expanded right inside the TXR parser, we need to
"unexpand" the forms by chasing their macro-ancestor
chain, gaining access to the original forms like defun
and defstruct. We can then turn these forms into tags using
the process-form function.
-rwxr-xr-x | tags.tl | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -124,6 +124,11 @@ (name (add (ntag slot-tag name struct-name struct-obj)))))))))))) +(defun unexpand (form) + (whilet ((anc (macro-ancestor form))) + (set form anc)) + form) + (defun process-clause (path lines clause) (when (consp clause) (let ((elem (car clause))) @@ -137,7 +142,10 @@ (add (ntag fun-tag (car args))))) (bind (let ((syms (flatten (cadr elem)))) (each ((sym syms)) - (add (ntag fun-tag sym)))))))))))) + (add (ntag fun-tag sym))))) + (do (let ((forms [mapcar unexpand (cdr elem)])) + (each ((form forms)) + (pend (process-form path lines form)))))))))))) (defun collect-tags-tl (path) (let* ((text (file-get-string path)) |