diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-07-10 08:24:25 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-07-10 08:24:25 -0700 |
commit | ba7e2f2fa7ebe01d8eb733aff53b01b217ebabac (patch) | |
tree | 300f90db3a1f8a66122d1fc2da023f1f15179623 /parser.c | |
parent | c15319c711c8f91cd2d44db7065169c8081b94aa (diff) | |
download | txr-ba7e2f2fa7ebe01d8eb733aff53b01b217ebabac.tar.gz txr-ba7e2f2fa7ebe01d8eb733aff53b01b217ebabac.tar.bz2 txr-ba7e2f2fa7ebe01d8eb733aff53b01b217ebabac.zip |
Fix off by one error line numbers for .tl files.
* parser.c (read_eval_stream): Add terminating newline to
the first line that was examined for hash bang.
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -281,9 +281,13 @@ val read_eval_stream(val stream, val error_stream, val hash_bang_support) if (hash_bang_support) { val firstline = get_line(stream); - if (!match_str(firstline, lit("#!"), nil)) { - val string_stream = make_string_byte_input_stream(firstline); - stream = make_catenated_stream(list(string_stream, stream, nao)); + if (firstline) { + val flwnl = cat_str(list(firstline, lit("\n"), nao), nil); + + if (!match_str(flwnl, lit("#!"), nil)) { + val string_stream = make_string_byte_input_stream(flwnl); + stream = make_catenated_stream(list(string_stream, stream, nao)); + } } } |