Skip to content
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
19 changes: 7 additions & 12 deletions arduino-core/src/cc/arduino/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ enum BuilderAction {
}
}

private static final Pattern ERROR_FORMAT = Pattern.compile("(.+\\.\\w+):(\\d+)(:\\d+)*:\\s*(fatal)?\\s*error:\\s*(.*)\\s*", Pattern.MULTILINE | Pattern.DOTALL);
private static final Pattern ERROR_FORMAT = Pattern.compile("(.+\\.\\w+):(\\d+)(:\\d+)*:\\s*((fatal)?\\s*error:\\s*)(.*)\\s*", Pattern.MULTILINE | Pattern.DOTALL);

private final File pathToSketch;
private final Sketch sketch;
Expand Down Expand Up @@ -516,16 +516,14 @@ public void message(String s) {

if (pieces != null) {
String msg = "";
int errorIdx = pieces.length - 1;
String error = pieces[errorIdx];
String filename = pieces[1];
int line = PApplet.parseInt(pieces[2]);
int col;
if (errorIdx > 3) {
int col = -1;
if (pieces[3] != null) {
col = PApplet.parseInt(pieces[3].substring(1));
} else {
col = -1;
}
String errorPrefix = pieces[4];
String error = pieces[6];

if (error.trim().equals("SPI.h: No such file or directory")) {
error = tr("Please import the SPI library from the Sketch > Import Library menu.");
Expand Down Expand Up @@ -585,11 +583,8 @@ public void message(String s) {
String fileName = ex.getCodeFile().getPrettyName();
int lineNum = ex.getCodeLine() + 1;
int colNum = ex.getCodeColumn();
if (colNum != -1) {
s = fileName + ":" + lineNum + ":" + colNum + ": error: " + error + msg;
} else {
s = fileName + ":" + lineNum + ": error: " + error + msg;
}
String column = (colNum != -1) ? (":" + colNum) : "";
s = fileName + ":" + lineNum + column + ": " + errorPrefix + error + msg;
}

if (ex != null) {
Expand Down