Skip to content

Commit e7a625b

Browse files
committed
Scrub comments: skip the second chracter in the escape sequence
Fixes #5016
1 parent 6919bef commit e7a625b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

java/src/processing/mode/java/preproc/PdePreprocessor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,16 @@ static public String scrubComments(String what) {
730730
throw new RuntimeException("Missing the */ from the end of a " +
731731
"/* comment */");
732732
}
733-
} else if (p[index] == '"' && index > 0 && p[index-1] != '\\') {
733+
734+
// switch in/out of quoted region
735+
} else if (p[index] == '"') {
734736
insideQuote = !insideQuote;
735737
index++;
736738

739+
// skip the escaped char
740+
} else if (insideQuote && p[index] == '\\') {
741+
index += 2;
742+
737743
} else { // any old character, move along
738744
index++;
739745
}

0 commit comments

Comments
 (0)