mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 22:29:18 +01:00
deal with character constant error with unicode (issue #714)
This commit is contained in:
@@ -249,21 +249,30 @@ public class PdePreprocessor {
|
||||
stringStart)));
|
||||
}
|
||||
} else if (program.charAt(i) == '\'') {
|
||||
i++;
|
||||
i++; // step over the initial quote
|
||||
if (i >= length) {
|
||||
throw new SketchException("Unterminated character constant", 0,
|
||||
throw new SketchException("Unterminated character constant (after initial quote)", 0,
|
||||
countNewlines(program.substring(0, i)));
|
||||
}
|
||||
if (program.charAt(i) == '\\') {
|
||||
i++;
|
||||
i++; // step over the backslash
|
||||
}
|
||||
if (i >= length) {
|
||||
throw new SketchException("Unterminated character constant (after backslash)", 0,
|
||||
countNewlines(program.substring(0, i)));
|
||||
}
|
||||
if (program.charAt(i) == 'u') {
|
||||
i += 5; // step over the u, and the four digit unicode constant
|
||||
} else {
|
||||
i++; // step over a single character
|
||||
}
|
||||
i++;
|
||||
if (i >= length) {
|
||||
throw new SketchException("Unterminated character constant", 0,
|
||||
countNewlines(program.substring(0, i)));
|
||||
}
|
||||
if (program.charAt(i) != '\'') {
|
||||
throw new SketchException("Badly formed character constant", 0,
|
||||
throw new SketchException("Badly formed character constant " +
|
||||
"(expecting quote, got " + program.charAt(i) + ")", 0,
|
||||
countNewlines(program.substring(0, i)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user