diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-04-21 04:15:01 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-04-21 04:15:01 -0700 |
commit | 4f2f300bb835af37b86b8a1239bec6fb469b289f (patch) | |
tree | 6f29d6524e747a70a596d11aa5511d8353b7222c /eval.c | |
parent | 2e36e0feae8d1dd75c8410b365d7dc33b30ce66b (diff) | |
download | txr-4f2f300bb835af37b86b8a1239bec6fb469b289f.tar.gz txr-4f2f300bb835af37b86b8a1239bec6fb469b289f.tar.bz2 txr-4f2f300bb835af37b86b8a1239bec6fb469b289f.zip |
bugfix: source lineno off by one under hash bang.
* eval.c (load): When we read and discard a hash bang line,
we must set the parser line number to two.
* parser.c (parser_set_lineno): New function.
* parser.h (parser_set_lineno): Declared.
* txr.c (check_hash_bang): New argument, occurs.
(txr_main): Track whether hash bang has occurred in a new
local variable hb_occurs. Then, before parsing, if hash bang
has occurred, set the line number to two.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -4341,7 +4341,9 @@ val load(val target) open_txr_file(path, &txr_lisp_p, &name, &stream); - if (!match_str(or2(get_line(stream), lit("")), lit("#!"), nil)) + if (match_str(or2(get_line(stream), lit("")), lit("#!"), nil)) + parser_set_lineno(self, stream, two); + else seek_stream(stream, zero, from_start_k); uw_simple_catch_begin; |