mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
Fix preprocessing of code with double backslash in string or char literal
Fixes #4903
This commit is contained in:
@@ -266,6 +266,14 @@ public class SourceUtils {
|
||||
for (int i = 0; i <= length; i++) {
|
||||
char ch = (i < length) ? p.charAt(i) : 0;
|
||||
char pch = (i == 0) ? 0 : p.charAt(i-1);
|
||||
// Get rid of double backslash immediately, otherwise
|
||||
// the second backslash incorrectly triggers a new escape sequence
|
||||
if (pch == '\\' && ch == '\\') {
|
||||
p.setCharAt(i-1, ' ');
|
||||
p.setCharAt(i, ' ');
|
||||
pch = ' ';
|
||||
ch = ' ';
|
||||
}
|
||||
switch (state) {
|
||||
case OUT:
|
||||
switch (ch) {
|
||||
|
||||
Reference in New Issue
Block a user