Skip to content

Commit

Permalink
Merge pull request #306 from charliva/pr-better-errors
Browse files Browse the repository at this point in the history
Fixed issue #305, blank syntax error messages after YOSYS synthesis
  • Loading branch information
Obijuan authored Feb 8, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 847e9d1 + 52e5aba commit b7460f8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app/scripts/services/tools.js
Original file line number Diff line number Diff line change
@@ -467,6 +467,32 @@ angular.module('icestudio')
});
}

// - Yosys syntax errors
// - main.v:31: ERROR: #...
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];

// 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;
}
codeErrors.push( {
line: line,
msg: msg,
type: type
});
}

// Extract modules map from code
var modules = mapCodeModules(code);
var hasErrors = false;

0 comments on commit b7460f8

Please sign in to comment.