diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-07-22 07:25:44 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-07-22 07:25:44 -0700 |
commit | 31741b4cf50f75993faf20555343ca0a59d0ff9f (patch) | |
tree | 2f468023a89e5823d11a59a262121395cdfa4b31 /parser.h | |
parent | 4c1341f2d2be88f36e5799aac9275c88233e1abe (diff) | |
download | txr-31741b4cf50f75993faf20555343ca0a59d0ff9f.tar.gz txr-31741b4cf50f75993faf20555343ca0a59d0ff9f.tar.bz2 txr-31741b4cf50f75993faf20555343ca0a59d0ff9f.zip |
txr: regression: lack of file name in error messages.
This was broken on April 21, 2019 in commit
2e36e0feae8d1dd75c8410b365d7dc33b30ce66b (April 21, 2019)
which changed parse_once in such a way that the name
being passed down was no longer stored in the parser.
The ensure_parser function being relied upon doesn't take on
the responsibility of propagating the name from the stream
to the parser, so the parser ends up with a nil name.
Let's just smooth this over by having ensure_parser take
a name parameter. If ensure_parser creates a new parser, it
puts in the name. If the name is nil, then it is
taken from the stream.
* eval.c (load): Pass name to ensure_parser.
* match.c (v_load): Likewise.
* parser.c (parser): Take name parameter, and plant into newly
constructed parser.
(ensure_parser): Take name parameter. When creating a parser,
give it that name, or if name is specified as nil, then
give it the name taken from the stream.
(parser_set_lineno): Pass nil name to ensure_parser.
(lisp_parse_impl, read_file_common): Pass name to
ensure_parser.
* parser.h (parser, ensure_parser): Declarations updated.
* parser.y (parse_once): Pass name to ensure_parser.
* txr.c (txr_main): Pass spec_file_str to ensure_parser.
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -128,10 +128,10 @@ val repl(val bindings, val in_stream, val out_stream, val env); #endif void parser_common_init(parser_t *); void parser_cleanup(parser_t *); -val parser(val stream, val lineno); +val parser(val stream, val name, val lineno); parser_t *parser_get_impl(val self, val parser); val get_parser(val stream); -val ensure_parser(val stream); +val ensure_parser(val stream, val name); val parser_set_lineno(val self, val stream, val lineno); val parser_errors(val parser); val parser_eof(val parser); |