summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-13 12:23:44 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-13 12:23:44 (GMT)
commit367d7b3244c0091f9ca8b5b39a62c5d49886577c (patch)
tree9f84ad2b9f1701aa2b3af17434d83e0fab9f0c01
parentd724385dd003f871c0b1218392387e6ab87db28f (diff)
Clifford Wolf:
Added details (line num / not top level object) to "compilation failed" error message. git-svn-id: http://svn.clifford.at/openscad/trunk@274 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r--mainwin.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/mainwin.cc b/mainwin.cc
index 2510353..be40a7d 100644
--- a/mainwin.cc
+++ b/mainwin.cc
@@ -617,7 +617,22 @@ void MainWindow::compile(bool procevents)
QApplication::processEvents();
} else {
fail:
- PRINT("ERROR: Compilation failed!");
+ if (parser_error_pos < 0) {
+ PRINT("ERROR: Compilation failed! (no top level object found)");
+ } else {
+ int line = 1;
+ QByteArray pb = last_compiled_doc.toAscii();
+ char *p = pb.data();
+ for (int i = 0; i < parser_error_pos; i++) {
+ if (p[i] == '\n')
+ line++;
+ if (p[i] == 0) {
+ line = -1;
+ break;
+ }
+ }
+ PRINTF("ERROR: Compilation failed! (parser error in line %d)", line);
+ }
if (procevents)
QApplication::processEvents();
}
contact: Jan Huwald // Impressum