mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-21 10:52:14 +01:00
Merge pull request #9683 from matthijskooijman/compiler-errors-without-column
Compiler errors without column
This commit is contained in:
commit
88fa134d07
@ -134,7 +134,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 File pathToSketch;
|
||||||
private final Sketch sketch;
|
private final Sketch sketch;
|
||||||
@ -516,16 +516,14 @@ public class Compiler implements MessageConsumer {
|
|||||||
|
|
||||||
if (pieces != null) {
|
if (pieces != null) {
|
||||||
String msg = "";
|
String msg = "";
|
||||||
int errorIdx = pieces.length - 1;
|
|
||||||
String error = pieces[errorIdx];
|
|
||||||
String filename = pieces[1];
|
String filename = pieces[1];
|
||||||
int line = PApplet.parseInt(pieces[2]);
|
int line = PApplet.parseInt(pieces[2]);
|
||||||
int col;
|
int col = -1;
|
||||||
if (errorIdx > 3) {
|
if (pieces[3] != null) {
|
||||||
col = PApplet.parseInt(pieces[3].substring(1));
|
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")) {
|
if (error.trim().equals("SPI.h: No such file or directory")) {
|
||||||
error = tr("Please import the SPI library from the Sketch > Import Library menu.");
|
error = tr("Please import the SPI library from the Sketch > Import Library menu.");
|
||||||
@ -585,11 +583,8 @@ public class Compiler implements MessageConsumer {
|
|||||||
String fileName = ex.getCodeFile().getPrettyName();
|
String fileName = ex.getCodeFile().getPrettyName();
|
||||||
int lineNum = ex.getCodeLine() + 1;
|
int lineNum = ex.getCodeLine() + 1;
|
||||||
int colNum = ex.getCodeColumn();
|
int colNum = ex.getCodeColumn();
|
||||||
if (colNum != -1) {
|
String column = (colNum != -1) ? (":" + colNum) : "";
|
||||||
s = fileName + ":" + lineNum + ":" + colNum + ": error: " + error + msg;
|
s = fileName + ":" + lineNum + column + ": " + errorPrefix + error + msg;
|
||||||
} else {
|
|
||||||
s = fileName + ":" + lineNum + ": error: " + error + msg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user