Skip to content

Commit

Permalink
Merge pull request #308 from charliva/pr-better-errors
Browse files Browse the repository at this point in the history
Fix issue #307, improve regular expression to parse error messages
  • Loading branch information
Obijuan authored Feb 8, 2019
2 parents b7460f8 + 74920df commit a2f294d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/scripts/services/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,22 +469,21 @@ angular.module('icestudio')

// - Yosys syntax errors
// - main.v:31: ERROR: #...
re = /\smain\.v:([0-9]+):\s(.*?)(ERROR):\s(.*?), (.*?)[\r|\n]/g;
re = /\smain\.v:([0-9]+):\s(.*?)(ERROR):\s(.*?)[\r|\n]/g;
while (matchError = re.exec(stdout)) {

var msg = '';
var line = parseInt(matchError[1]);
var type = matchError[3].toLowerCase();
var preContent = matchError[5];
var postContent = matchError[4];
var preContent = matchError[4];

// If the error is about an unexpected token, the error is not
// deterministic, therefore we indicate that "the error
//is around this line ..."
if (preContent.indexOf('unexpected TOK_')>=0) {
msg = 'Syntax error arround this line';
}else{
msg = preContent+': '+postContent;
msg = preContent;
}
codeErrors.push( {
line: line,
Expand Down

0 comments on commit a2f294d

Please sign in to comment.