preprocessor: pretty print error info

time-shift
Houtan Bastani 2013-05-31 18:19:12 +02:00
parent 8c14339a0f
commit 688e30019c
1 changed files with 10 additions and 1 deletions

View File

@ -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);
}