diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-15 19:33:12 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-15 19:33:12 -0700 |
commit | 67653e3e713a76eeb866e99543060cf5d65471a9 (patch) | |
tree | a5f4eb4b35f260bf152ecf24a094819bff210a6b /parser.y | |
parent | fc7a6a883b663ea58edf8b190d210f11e91d4552 (diff) | |
download | txr-67653e3e713a76eeb866e99543060cf5d65471a9.tar.gz txr-67653e3e713a76eeb866e99543060cf5d65471a9.tar.bz2 txr-67653e3e713a76eeb866e99543060cf5d65471a9.zip |
parser: show starting line of unterminated form.
* parser.y (parse): Note the line number before parsing.
If the error seems to be bad termination, issue an extra
message indicating the starting line number of the form.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1887,6 +1887,7 @@ int parse_once(val stream, val name, parser_t *parser) int parse(parser_t *parser, val name, enum prime_parser prim) { int res = 0; + cnum start_line = parser->lineno; parser->errors = 0; parser->eof = 0; @@ -1916,5 +1917,9 @@ int parse(parser_t *parser, val name, enum prime_parser prim) uw_catch_end; + if (parser->errors && parser->syntax_tree == nil && start_line != 1) + yyerrorf(parser->scanner, lit("while parsing form starting at line ~a"), + num(start_line), nao); + return res; } |