summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-25 09:38:36 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-25 09:38:36 -0700
commit72ddfec598ee0d591b8d953555894d20906d61fb (patch)
tree59a48c137f81e4b1805ef74ae976f70e642f3946
parent8e4a0206b97df82a9c7419b158d9858da95168ab (diff)
downloadtxr-72ddfec598ee0d591b8d953555894d20906d61fb.tar.gz
txr-72ddfec598ee0d591b8d953555894d20906d61fb.tar.bz2
txr-72ddfec598ee0d591b8d953555894d20906d61fb.zip
tags: option for qualified identifier tags.
* tags.tl (tags-opts): New q/qual option. (slot-tag make-qual-tag): New method. (toplevel): If qualified tags requested, then augment the list of tags with qualified tags.
-rwxr-xr-xtags.tl17
1 files changed, 15 insertions, 2 deletions
diff --git a/tags.tl b/tags.tl
index 95e4b50a..bae1840e 100755
--- a/tags.tl
+++ b/tags.tl
@@ -16,7 +16,8 @@
(m merge :bool "Merge with existing tags file, sorting combined content.")
(nil exclude (cumul :text) "Skip paths matching glob pattern given \ \
in TEXT. Multiple patterns can be specified.")
- (e emacs :bool "Write the tags file in Emacs's etags format."))
+ (e emacs :bool "Write the tags file in Emacs's etags format.")
+ (q qual :bool "Also generate struct:slot tags for each slot."))
(defstruct tag ()
ident
@@ -69,7 +70,12 @@
(:method text (me)
`@{me.ident}\t@{me.path}\t/^@{me.pattern}$/ \
@(if me.expattern `;/@(escape me.ident)/`);"\t \
- @{me.type}\tstruct:@{me.parent}`))
+ @{me.type}\tstruct:@{me.parent}`)
+ (:method make-qual-tag (me)
+ (if me.parent
+ (let ((qt (copy me)))
+ (set qt.ident `@{me.parent}:@{me.ident}`)
+ qt))))
(defstruct orig-tag tag
line
@@ -338,6 +344,13 @@
ftw-skip-subtree)))
(t ftw-continue)))
(logior ftw-phys ftw-actionretval)))))
+ (if o.qual
+ (set tags (build
+ (pend tags)
+ (each ((tg tags))
+ (if (typep tg 'slot-tag)
+ (iflet ((qt tg.(make-qual-tag)))
+ (add qt)))))))
(if o.emacs
(write-etagfile (flow tags
(remove-if (op equal @1.type "F"))