From 73c18dbedd1f96a518e7e60f584d829a2b0dbeaa Mon Sep 17 00:00:00 2001 From: Chris--A Date: Wed, 27 May 2015 23:39:39 +1000 Subject: [PATCH] =?UTF-8?q?Fix=20for=20single=20line=20comments=20ending?= =?UTF-8?q?=20in=20\=EF=BB=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/preproc/PdePreprocessor.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arduino-core/src/processing/app/preproc/PdePreprocessor.java b/arduino-core/src/processing/app/preproc/PdePreprocessor.java index dc30922a92e..f6b9e9444da 100644 --- a/arduino-core/src/processing/app/preproc/PdePreprocessor.java +++ b/arduino-core/src/processing/app/preproc/PdePreprocessor.java @@ -394,10 +394,24 @@ public String scrubComments(String what) { (p[index+1] == '/')) { p[index++] = ' '; p[index++] = ' '; - while ((index < p.length) && - (p[index] != '\n')) { - p[index++] = ' '; - } + + char prev = ' '; + + while(index < p.length){ + + if(p[index] == '\n'){ + + if( prev == '\\' ){ + p[index - 1] = prev; + p[index - 2] = '/'; + p[index - 3] = '/'; + } + break; + }else{ + prev = p[index]; + p[index++] = ' '; + } + } // check to see if this is the start of a new multiline comment. // if it is, then make sure it's actually terminated somewhere.