From 688e30019c08369bc6edab9a501146c703d15b13 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Fri, 31 May 2013 18:19:12 +0200 Subject: [PATCH] preprocessor: pretty print error info --- preprocessor/ParsingDriver.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index a5f345634..39c240238 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -105,7 +105,16 @@ ParsingDriver::parse(istream &in, bool debug) void ParsingDriver::error(const Dynare::parser::location_type &l, const string &m) { - cerr << "ERROR: " << l << ": " << m << endl; + cerr << "ERROR: " << *l.begin.filename << ": line " << l.begin.line; + if (l.begin.line == l.end.line) + if (l.begin.column == l.end.column - 1) + cerr << ", col " << l.begin.column; + else + cerr << ", cols " << l.begin.column << "-" << l.end.column - 1; + else + cerr << ", col " << l.begin.column << " -" + << " line " << l.end.line << ", col " << l.end.column - 1; + cerr << ": " << m << endl; exit(EXIT_FAILURE); }