-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClangError.cpp
More file actions
28 lines (25 loc) · 823 Bytes
/
ClangError.cpp
File metadata and controls
28 lines (25 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "ClangError.h"
#include <iostream>
#include <regex>
using std::cout;
using std::endl;
using std::regex;
using std::regex_match;
using std::smatch;
using std::string;
ClangError::ClangError(string stderr) {
smatch errMatch;
regex errReg("((?:.\\/)?\\w+(?:.\\w+)?):(\\d+):(\\d+):\\s([^\\\\n]+):\\s(.*)", regex::ECMAScript);
/* Iterate over each error regex match in output */
string::const_iterator pos(stderr.cbegin());
while (regex_search(pos, stderr.cend(), errMatch, errReg)) {
/* Update iterable */
pos = errMatch.suffix().first;
/* Push onto list of errors */
ERR err(errMatch[1], errMatch[2], errMatch[3], errMatch[4], errMatch[5]);
__errors.push_back(err);
};
};
std::vector<ClangError::ERR> ClangError::getErrors() {
return __errors;
}