From 67653e3e713a76eeb866e99543060cf5d65471a9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 15 Apr 2018 19:33:12 -0700 Subject: 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. --- parser.y | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parser.y b/parser.y index 29814d79..139ba052 100644 --- a/parser.y +++ b/parser.y @@ -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; } -- cgit v1.2.3