Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #305, blank syntax error messages after YOSYS synthesis #306

Merged
merged 1 commit into from
Feb 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions app/scripts/services/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down