@@ -545,7 +545,17 @@ public void message(String s) {
545
545
String [] pieces = PApplet .match (s , ERROR_FORMAT );
546
546
547
547
if (pieces != null ) {
548
- String error = pieces [pieces .length - 1 ], msg = "" ;
548
+ String msg = "" ;
549
+ int errorIdx = pieces .length - 1 ;
550
+ String error = pieces [errorIdx ];
551
+ String filename = pieces [1 ];
552
+ int line = PApplet .parseInt (pieces [2 ]);
553
+ int col ;
554
+ if (errorIdx > 3 ) {
555
+ col = PApplet .parseInt (pieces [3 ].substring (1 ));
556
+ } else {
557
+ col = -1 ;
558
+ }
549
559
550
560
if (error .trim ().equals ("SPI.h: No such file or directory" )) {
551
561
error = tr ("Please import the SPI library from the Sketch > Import Library menu." );
@@ -599,12 +609,17 @@ public void message(String s) {
599
609
//msg = _("\nThe 'Keyboard' class is only supported on the Arduino Leonardo.\n\n");
600
610
}
601
611
602
- RunnerException ex = placeException (error , pieces [ 1 ], PApplet . parseInt ( pieces [ 2 ]) - 1 );
612
+ RunnerException ex = placeException (error , filename , line - 1 , col );
603
613
604
614
if (ex != null ) {
605
615
String fileName = ex .getCodeFile ().getPrettyName ();
606
616
int lineNum = ex .getCodeLine () + 1 ;
607
- s = fileName + ":" + lineNum + ": error: " + error + msg ;
617
+ int colNum = ex .getCodeColumn ();
618
+ if (colNum != -1 ) {
619
+ s = fileName + ":" + lineNum + ":" + colNum + ": error: " + error + msg ;
620
+ } else {
621
+ s = fileName + ":" + lineNum + ": error: " + error + msg ;
622
+ }
608
623
}
609
624
610
625
if (ex != null ) {
@@ -630,10 +645,10 @@ public void message(String s) {
630
645
System .err .println (s );
631
646
}
632
647
633
- private RunnerException placeException (String message , String fileName , int line ) {
648
+ private RunnerException placeException (String message , String fileName , int line , int col ) {
634
649
for (SketchFile file : sketch .getFiles ()) {
635
650
if (new File (fileName ).getName ().equals (file .getFileName ())) {
636
- return new RunnerException (message , file , line );
651
+ return new RunnerException (message , file , line , col );
637
652
}
638
653
}
639
654
return null ;
0 commit comments