mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
6635133: Exception thrown when using a Unicode escape
Update regex engine to handle unicode escape correctly in character class Reviewed-by: okutsu
This commit is contained in:
parent
6c33c4e721
commit
f935457fef
1 changed files with 23 additions and 1 deletions
|
@ -2844,7 +2844,15 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||||
/**
|
/**
|
||||||
* Utility method for parsing unicode escape sequences.
|
* Utility method for parsing unicode escape sequences.
|
||||||
*/
|
*/
|
||||||
private int u() {
|
private int cursor() {
|
||||||
|
return cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setcursor(int pos) {
|
||||||
|
cursor = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int uxxxx() {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
int ch = read();
|
int ch = read();
|
||||||
|
@ -2856,6 +2864,20 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int u() {
|
||||||
|
int n = uxxxx();
|
||||||
|
if (Character.isHighSurrogate((char)n)) {
|
||||||
|
int cur = cursor();
|
||||||
|
if (read() == '\\' && read() == 'u') {
|
||||||
|
int n2 = uxxxx();
|
||||||
|
if (Character.isLowSurrogate((char)n2))
|
||||||
|
return Character.toCodePoint((char)n, (char)n2);
|
||||||
|
}
|
||||||
|
setcursor(cur);
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Utility methods for code point support
|
// Utility methods for code point support
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue