Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ wrapper {
gradleVersion '5.2'
}

sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
Expand Down
21 changes: 8 additions & 13 deletions java/com/google/re2j/Unicode.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Unicode {
// Minimum and maximum runes involved in folding.
// Checked during test.
static final int MIN_FOLD = 0x0041;
static final int MAX_FOLD = 0x1044f;
static final int MAX_FOLD = 0x1E943;

// is32 uses binary search to test whether rune is in the specified
// slice of 32-bit ranges.
Expand Down Expand Up @@ -107,19 +107,14 @@ static boolean isPrint(int r) {
// Derived from Go's unicode.SimpleFold.
//
static int simpleFold(int r) {
// Consult caseOrbit table for special cases.
if (r < UnicodeTables.CASE_ORBIT.length && UnicodeTables.CASE_ORBIT[r] != 0) {
return UnicodeTables.CASE_ORBIT[r];
}

// No folding specified. This is a one- or two-element
// equivalence class containing rune and toLower(rune)
// and toUpper(rune) if they are different from rune.
int l = Characters.toLowerCase(r);
if (l != r) {
return l;
// Consult caseOrbit table.
if (r < UnicodeTables.CASE_ORBIT.length << 8) {
int[] page = UnicodeTables.CASE_ORBIT[r >> 8];
if (page != null && page[r & 0xff] != 0) {
return page[r & 0xff];
}
}
return Characters.toUpperCase(r);
return r;
}

// equalsIgnoreCase performs case-insensitive equality comparison
Expand Down
Loading
Loading