summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-03-04 23:18:11 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-03-04 23:18:11 -0800
commite0c7defe68c41bff783753d2e6f89bd030190935 (patch)
tree1ec541e6edca83ec3fc1bba28a56627f4c2d4765
parent553bbe22d0a8007717851f4c669c140279a557fe (diff)
downloadtxr-e0c7defe68c41bff783753d2e6f89bd030190935.tar.gz
txr-e0c7defe68c41bff783753d2e6f89bd030190935.tar.bz2
txr-e0c7defe68c41bff783753d2e6f89bd030190935.zip
tags: eliminate duplicated text methods.
* tags.tl (tag): New slot, type; new method, text. (fun-tag, var-tag, struct-tag, type-tag): Override type slot with appropriate value ("f", "v", "s", "t"), and remove text method. (slot-tag): Override type; keep text method, and interpolate typee instead of hard-coded "m".
-rwxr-xr-xtags.tl23
1 files changed, 13 insertions, 10 deletions
diff --git a/tags.tl b/tags.tl
index 52960096..8ad51107 100755
--- a/tags.tl
+++ b/tags.tl
@@ -4,8 +4,13 @@
ident
path
pattern
+ (type "?")
+
(:postinit (me)
- (upd me.ident tostringp)))
+ (upd me.ident tostringp))
+
+ (:method text (me)
+ `@{me.ident}\t@{me.path}\t/^@{me.pattern}$/;"\t@{me.type}`))
(defun escape (str)
(mappend (do caseql @1
@@ -20,27 +25,25 @@
`@{me.ident}\t@{me.path}\t;"\tF`))
(defstruct fun-tag tag
- (:method text (me)
- `@{me.ident}\t@{me.path}\t/^@{me.pattern}$/;"\tf`))
+ (type "f"))
(defstruct var-tag tag
- (:method text (me)
- `@{me.ident}\t@{me.path}\t/^@{me.pattern}$/;"\tv`))
+ (type "v"))
(defstruct struct-tag tag
- (:method text (me)
- `@{me.ident}\t@{me.path}\t/^@{me.pattern}$/;"\ts`))
+ (type "s"))
(defstruct type-tag tag
- (:method text (me)
- `@{me.ident}\t@{me.path}\t/^@{me.pattern}$/;"\tt`))
+ (type "t"))
(defstruct slot-tag tag
+ (type "m")
parent
expattern
(:method text (me)
`@{me.ident}\t@{me.path}\t/^@{me.pattern}$/ \
- @(if me.expattern `;/@(escape me.ident)/`);"\tm\tstruct:@{me.parent}`))
+ @(if me.expattern `;/@(escape me.ident)/`);"\t \
+ @{me.type}\tstruct:@{me.parent}`))
(defvarl err-ret (gensym))