Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/arduino/Arduino.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2020-01-28 17:23:22 +0300
committerMatthijs Kooijman <matthijs@stdin.nl>2020-01-29 21:38:03 +0300
commit3d4b026b506afd56d516144cf3c558d956c75758 (patch)
treed51b642af2fc5b289e20ebacec95188b45965128 /arduino-core
parente387c23b608434c10fd46a758958186dcc3c4c6a (diff)
Preserve "fatal" in compiler errors
When transforming compiler errors (to make filenames more friendly), it would match "fatal error" or "error" but then always reconstruct as "error", modifying the compiler error in a way that is not intended. This commit fixes that, as well as the previous hardcoding of the "error: " prefix when rebuilding the error message, by capturing this entire prefix and simply reproducing it in the resulting error message.
Diffstat (limited to 'arduino-core')
-rw-r--r--arduino-core/src/cc/arduino/Compiler.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/arduino-core/src/cc/arduino/Compiler.java b/arduino-core/src/cc/arduino/Compiler.java
index 608bf23b0..c2c5b0ff6 100644
--- a/arduino-core/src/cc/arduino/Compiler.java
+++ b/arduino-core/src/cc/arduino/Compiler.java
@@ -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 Sketch sketch;
@@ -522,7 +522,8 @@ public class Compiler implements MessageConsumer {
if (pieces[3] != null) {
col = PApplet.parseInt(pieces[3].substring(1));
}
- String error = pieces[5];
+ 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.");
@@ -583,7 +584,7 @@ public class Compiler implements MessageConsumer {
int lineNum = ex.getCodeLine() + 1;
int colNum = ex.getCodeColumn();
String column = (colNum != -1) ? (":" + colNum) : "";
- s = fileName + ":" + lineNum + column + ": error: " + error + msg;
+ s = fileName + ":" + lineNum + column + ": " + errorPrefix + error + msg;
}
if (ex != null) {