From 2fdbbc75ac46920e075570cea3cb77608aacba4b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 13 Nov 2014 21:35:18 +0100 Subject: check that the parsing stack is empty when the end of a file has been reached MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/parse-error.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/mds-kbdc/parse-error.c') diff --git a/src/mds-kbdc/parse-error.c b/src/mds-kbdc/parse-error.c index c16b9f4..1ad5ae1 100644 --- a/src/mds-kbdc/parse-error.c +++ b/src/mds-kbdc/parse-error.c @@ -93,10 +93,15 @@ void mds_kbdc_parse_error_print(const mds_kbdc_parse_error_t* restrict this, FIL abort(); break; } - fprintf(output, "%s\n %s\n \033[01;32m", desc, code); - i = 0; - for (n = start; i < n; i++) fputc(' ', output); - for (n = end; i < n; i++) fputc('^', output); + if (this->error_is_in_file) + { + fprintf(output, "%s\n %s\n \033[01;32m", desc, code); + i = 0; + for (n = start; i < n; i++) fputc(' ', output); + for (n = end; i < n; i++) fputc('^', output); + } + else + fprintf(output, "%s\n", desc); fprintf(output, "\033[00m\n"); } -- cgit v1.2.3-70-g09d2