From 6df392d80bf3e191f7b761bd0514bb39d3438199 Mon Sep 17 00:00:00 2001 From: Neelabh Gupta Date: Wed, 26 Nov 2014 00:33:02 -0600 Subject: [PATCH 1/4] Updated gcc-parser regex to take into account all filenames. Also, if no error/warning count information is available on a failed compilation (due to parsing problems), then an error label is still shown. --- app/scripts/gcc-output-parser.js | 2 +- app/scripts/sys-runtime.js | 6 ++++++ app/scripts/sys-view-model.js | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/scripts/gcc-output-parser.js b/app/scripts/gcc-output-parser.js index 66eea75e..0efab201 100644 --- a/app/scripts/gcc-output-parser.js +++ b/app/scripts/gcc-output-parser.js @@ -1,7 +1,7 @@ window.GccOutputParser = (function () { 'use strict'; - var gccOutputParseRe = /(program\.c|gcc|cc1|collect2):\s*(.+)\s*:\s*(.+)\s*/; + var gccOutputParseRe = /(.+?):\s*(.+)\s*:\s*(.+)\s*/; var gccRowColTypeParseRe = /(\d+):(\d+):\s*(.+)/; var gccOutputTypeTextSplitRe = /\s*(.+)\s*:\s*(.+)\s*/; var errorTypeMap = { diff --git a/app/scripts/sys-runtime.js b/app/scripts/sys-runtime.js index 1cb8e9ee..90efe8bc 100644 --- a/app/scripts/sys-runtime.js +++ b/app/scripts/sys-runtime.js @@ -123,6 +123,12 @@ window.SysRuntime = (function () { aceAnnotationType = 'info'; } + if (typeof error.type === 'undefined') { + // if the errors are not in program.c, invalidate the row and column so that + // the editor does not place an annotation + error.row = error.col = -1; + } + return { // line numbers in ace start from zero row: error.row - 1, diff --git a/app/scripts/sys-view-model.js b/app/scripts/sys-view-model.js index 4ce434b0..c1a753a6 100644 --- a/app/scripts/sys-view-model.js +++ b/app/scripts/sys-view-model.js @@ -50,7 +50,14 @@ window.SysViewModel = (function () { str += errors ? (errors + ' error' + (errors > 1 ? 's ' : ' ')) : ''; str += warnings ? (warnings + ' warning' + (warnings > 1 ? 's' : '')) : ''; - if(str) { str += '\u2026'; } + if (str) { + str += '\u2026'; + } else { + if (self.showErrorWarningLabel()) { + // the compilation failed but error/warning count is not available + str = self.compileStatus() + '\u2026'; + } + } return str; }); self.showErrorWarningLabel = ko.pureComputed(function () { From 5cd4f0eacef05eafa0238ee18292db463715bf70 Mon Sep 17 00:00:00 2001 From: Neelabh Gupta Date: Wed, 26 Nov 2014 01:04:41 -0600 Subject: [PATCH 2/4] Remove unnecessary popover markup from gcc error label (because now we use a modal) and move gcc error modal html markup inside the show-if-supported div --- app/index.html | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/app/index.html b/app/index.html index 3b65d265..4ef07d2c 100644 --- a/app/index.html +++ b/app/index.html @@ -265,8 +265,8 @@

Search Linux Man Pages

Compiler: Idle + data-bind="text: errorWarningLabel, visible: showErrorWarningLabel, css: compileStatusClass" + data-toggle="modal" data-target="#gccErrorWindow">

@@ -275,28 +275,27 @@

Search Linux Man Pages

© 2014, Lawrence Angrave and Neelabh Gupta

- - - - - +