summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-03-05 21:13:43 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-03-05 21:13:43 -0800
commitd78a9fc8069a3ac2198f9b2d2f69386cc5873e60 (patch)
tree5edf3d3b16371d669c5c88803ebfeb0a9c21dcda
parent1394e3140ed808ce5061c3ec4dd77b8ac89bfa29 (diff)
downloadtxr-d78a9fc8069a3ac2198f9b2d2f69386cc5873e60.tar.gz
txr-d78a9fc8069a3ac2198f9b2d2f69386cc5873e60.tar.bz2
txr-d78a9fc8069a3ac2198f9b2d2f69386cc5873e60.zip
tags: fix off-by-one line numbers for hash bang.
* tags.tl (collect-tags): For hash-bang files, pop the dummy blank line that we inserted at the head of the line list to obtain 1-based numbering. If the parser starts working ater the #! line, it means the second line is 1, which is the same as zero-based numbering, so we can lose the dummy entry and all is well.
-rwxr-xr-xtags.tl3
1 files changed, 2 insertions, 1 deletions
diff --git a/tags.tl b/tags.tl
index 93ffa965..bb32ee44 100755
--- a/tags.tl
+++ b/tags.tl
@@ -65,7 +65,8 @@
(stream (make-strlist-input-stream lines))
(*rec-source-loc* t))
(with-stream (stream (open-file path))
- (unless (starts-with "#!" (get-line stream))
+ (if (starts-with "#!" (get-line stream))
+ (pop lines)
(seek-stream stream 0 :from-start))
(build
(add (new file-tag