From 367d7b3244c0091f9ca8b5b39a62c5d49886577c Mon Sep 17 00:00:00 2001 From: clifford Date: Wed, 13 Jan 2010 12:23:44 +0000 Subject: 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 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(); } -- cgit v0.10.1