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 | |
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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | parser.c | 10 |
2 files changed, 14 insertions, 3 deletions
@@ -1,5 +1,12 @@ 2015-07-10 Kaz Kylheku <kaz@kylheku.com> + 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. + +2015-07-10 Kaz Kylheku <kaz@kylheku.com> + Remove unused "primer" member from parser_t. * parser.c (parser_mark, parser_common_init): Remove reference to primer. @@ -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)); + } } } |