@@ -134,7 +134,7 @@ enum BuilderAction {
134134 }
135135 }
136136
137- private static final Pattern ERROR_FORMAT = Pattern .compile ("(.+\\ .\\ w+):(\\ d+)(:\\ d+)*:\\ s*(fatal)?\\ s*error:\\ s*(.*)\\ s*" , Pattern .MULTILINE | Pattern .DOTALL );
137+ private static final Pattern ERROR_FORMAT = Pattern .compile ("(.+\\ .\\ w+):(\\ d+)(:\\ d+)*:\\ s*(( fatal)?\\ s*error:\\ s*) (.*)\\ s*" , Pattern .MULTILINE | Pattern .DOTALL );
138138
139139 private final File pathToSketch ;
140140 private final Sketch sketch ;
@@ -516,16 +516,14 @@ public void message(String s) {
516516
517517 if (pieces != null ) {
518518 String msg = "" ;
519- int errorIdx = pieces .length - 1 ;
520- String error = pieces [errorIdx ];
521519 String filename = pieces [1 ];
522520 int line = PApplet .parseInt (pieces [2 ]);
523- int col ;
524- if (errorIdx > 3 ) {
521+ int col = - 1 ;
522+ if (pieces [ 3 ] != null ) {
525523 col = PApplet .parseInt (pieces [3 ].substring (1 ));
526- } else {
527- col = -1 ;
528524 }
525+ String errorPrefix = pieces [4 ];
526+ String error = pieces [6 ];
529527
530528 if (error .trim ().equals ("SPI.h: No such file or directory" )) {
531529 error = tr ("Please import the SPI library from the Sketch > Import Library menu." );
@@ -585,11 +583,8 @@ public void message(String s) {
585583 String fileName = ex .getCodeFile ().getPrettyName ();
586584 int lineNum = ex .getCodeLine () + 1 ;
587585 int colNum = ex .getCodeColumn ();
588- if (colNum != -1 ) {
589- s = fileName + ":" + lineNum + ":" + colNum + ": error: " + error + msg ;
590- } else {
591- s = fileName + ":" + lineNum + ": error: " + error + msg ;
592- }
586+ String column = (colNum != -1 ) ? (":" + colNum ) : "" ;
587+ s = fileName + ":" + lineNum + column + ": " + errorPrefix + error + msg ;
593588 }
594589
595590 if (ex != null ) {
0 commit comments