summaryrefslogtreecommitdiff
path: root/graphics/asymptote/errormsg.cc
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/errormsg.cc')
-rw-r--r--graphics/asymptote/errormsg.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/graphics/asymptote/errormsg.cc b/graphics/asymptote/errormsg.cc
index 3870caba28..e55a2c4d6b 100644
--- a/graphics/asymptote/errormsg.cc
+++ b/graphics/asymptote/errormsg.cc
@@ -7,6 +7,7 @@
#include <cstdio>
#include <cstdlib>
+#include <regex>
#include "errormsg.h"
#include "interact.h"
@@ -19,6 +20,8 @@ static nullPosInitializer nullPosInit;
bool errorstream::interrupt=false;
+using camp::newl;
+
ostream& operator<< (ostream& out, const position& pos)
{
if (!pos)
@@ -33,6 +36,7 @@ ostream& operator<< (ostream& out, const position& pos)
while(count > 0 && getline(fin,s)) {
count--;
}
+ s=std::regex_replace(s,std::regex("\t")," ");
out << s << endl;
for(size_t i=1; i < pos.column; ++i)
out << " ";
@@ -40,7 +44,7 @@ ostream& operator<< (ostream& out, const position& pos)
}
out << filename << ": ";
- out << pos.line << "." << pos.column << ": ";
+ out << pos.line << "." << pos.column;
if(settings::getSetting<bool>("xasy")) {
camp::openpipeout();
@@ -60,7 +64,7 @@ void errorstream::clear()
void errorstream::message(position pos, const string& s)
{
if (floating) out << endl;
- out << pos << s;
+ out << pos << ": " << s;
floating = true;
}
@@ -120,9 +124,24 @@ void errorstream::cont()
floating = false;
}
-void errorstream::sync()
+void errorstream::sync(bool reportTraceback)
{
if (floating) out << endl;
+
+ if(reportTraceback && traceback.size()) {
+ bool first=true;
+ for(auto p=this->traceback.rbegin(); p != this->traceback.rend(); ++p) {
+ if(p->filename() != "-") {
+ if(first) {
+ out << newl << "TRACEBACK:";
+ first=false;
+ }
+ cout << newl << (*p) << endl;
+ }
+ }
+ traceback.clear();
+ }
+
floating = false;
}