@@ -515,7 +515,17 @@ public void message(String s) {
515
515
String [] pieces = PApplet .match (s , ERROR_FORMAT );
516
516
517
517
if (pieces != null ) {
518
- String error = pieces [pieces .length - 1 ], msg = "" ;
518
+ String msg = "" ;
519
+ int errorIdx = pieces .length - 1 ;
520
+ String error = pieces [errorIdx ];
521
+ String filename = pieces [1 ];
522
+ int line = PApplet .parseInt (pieces [2 ]);
523
+ int col ;
524
+ if (errorIdx > 3 ) {
525
+ col = PApplet .parseInt (pieces [3 ].substring (1 ));
526
+ } else {
527
+ col = -1 ;
528
+ }
519
529
520
530
if (error .trim ().equals ("SPI.h: No such file or directory" )) {
521
531
error = tr ("Please import the SPI library from the Sketch > Import Library menu." );
@@ -569,12 +579,17 @@ public void message(String s) {
569
579
//msg = _("\nThe 'Keyboard' class is only supported on the Arduino Leonardo.\n\n");
570
580
}
571
581
572
- RunnerException ex = placeException (error , pieces [ 1 ], PApplet . parseInt ( pieces [ 2 ]) - 1 );
582
+ RunnerException ex = placeException (error , filename , line - 1 , col );
573
583
574
584
if (ex != null ) {
575
585
String fileName = ex .getCodeFile ().getPrettyName ();
576
586
int lineNum = ex .getCodeLine () + 1 ;
577
- s = fileName + ":" + lineNum + ": error: " + error + msg ;
587
+ 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
+ }
578
593
}
579
594
580
595
if (ex != null ) {
@@ -600,10 +615,10 @@ public void message(String s) {
600
615
System .err .println (s );
601
616
}
602
617
603
- private RunnerException placeException (String message , String fileName , int line ) {
618
+ private RunnerException placeException (String message , String fileName , int line , int col ) {
604
619
for (SketchFile file : sketch .getFiles ()) {
605
620
if (new File (fileName ).getName ().equals (file .getFileName ())) {
606
- return new RunnerException (message , file , line );
621
+ return new RunnerException (message , file , line , col );
607
622
}
608
623
}
609
624
return null ;
0 commit comments