aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc/parse-error.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-11-13 21:35:18 +0100
committerMattias Andrée <maandree@operamail.com>2014-11-13 21:35:21 +0100
commit2fdbbc75ac46920e075570cea3cb77608aacba4b (patch)
treeeada80c40412ca806df5074295a165aaa2365c07 /src/mds-kbdc/parse-error.c
parentparse let statement, however not arrays yet (diff)
downloadmds-2fdbbc75ac46920e075570cea3cb77608aacba4b.tar.gz
mds-2fdbbc75ac46920e075570cea3cb77608aacba4b.tar.bz2
mds-2fdbbc75ac46920e075570cea3cb77608aacba4b.tar.xz
check that the parsing stack is empty when the end of a file has been reached
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-kbdc/parse-error.c13
1 files changed, 9 insertions, 4 deletions
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");
}