int toLower(int c) { return ASCII.toLower(c); } boolean match(Matcher matcher, int i, CharSequence seq) {
int toLower(int c) { return ASCII.toLower(c); } boolean match(Matcher matcher, int i, CharSequence seq) {
boolean match(Matcher matcher, int i, CharSequence seq) { int[] buf = buffer; int len = buf.length; for (int j=0; j<len; j++) { if ((i+j) >= matcher.to) { matcher.hitEnd = true; return false; } int c = seq.charAt(i+j); if (buf[j] != c && buf[j] != ASCII.toLower(c)) return false; } return next.match(matcher, i+len, seq); } }
boolean match(Matcher matcher, int i, CharSequence seq) { int[] buf = buffer; int len = buf.length; for (int j=0; j<len; j++) { if ((i+j) >= matcher.to) { matcher.hitEnd = true; return false; } int c = seq.charAt(i+j); if (buf[j] != c && buf[j] != ASCII.toLower(c)) return false; } return next.match(matcher, i+len, seq); } }
BitClass add(int c, int flags) { assert c >= 0 && c <= 255; if ((flags & CASE_INSENSITIVE) != 0) { if (ASCII.isAscii(c)) { bits[ASCII.toUpper(c)] = true; bits[ASCII.toLower(c)] = true; } else if ((flags & UNICODE_CASE) != 0) { bits[Character.toLowerCase(c)] = true; bits[Character.toUpperCase(c)] = true; } } bits[c] = true; return this; } boolean isSatisfiedBy(int ch) {
BitClass add(int c, int flags) { assert c >= 0 && c <= 255; if ((flags & CASE_INSENSITIVE) != 0) { if (ASCII.isAscii(c)) { bits[ASCII.toUpper(c)] = true; bits[ASCII.toLower(c)] = true; } else if ((flags & UNICODE_CASE) != 0) { bits[Character.toLowerCase(c)] = true; bits[Character.toUpperCase(c)] = true; } } bits[c] = true; return this; } boolean isSatisfiedBy(int ch) {
boolean isSatisfiedBy(int ch) { return inRange(lower, ch, upper) || ASCII.isAscii(ch) && (inRange(lower, ASCII.toUpper(ch), upper) || inRange(lower, ASCII.toLower(ch), upper)); }}; }
boolean isSatisfiedBy(int ch) { return inRange(lower, ch, upper) || ASCII.isAscii(ch) && (inRange(lower, ASCII.toUpper(ch), upper) || inRange(lower, ASCII.toLower(ch), upper)); }}; }
/** * Utility method for creating a string slice matcher. */ private Node newSlice(int[] buf, int count, boolean hasSupplementary) { int[] tmp = new int[count]; if (has(CASE_INSENSITIVE)) { if (has(UNICODE_CASE)) { for (int i = 0; i < count; i++) { tmp[i] = Character.toLowerCase( Character.toUpperCase(buf[i])); } return hasSupplementary? new SliceUS(tmp) : new SliceU(tmp); } for (int i = 0; i < count; i++) { tmp[i] = ASCII.toLower(buf[i]); } return hasSupplementary? new SliceIS(tmp) : new SliceI(tmp); } for (int i = 0; i < count; i++) { tmp[i] = buf[i]; } return hasSupplementary ? new SliceS(tmp) : new Slice(tmp); }
/** * Utility method for creating a string slice matcher. */ private Node newSlice(int[] buf, int count, boolean hasSupplementary) { int[] tmp = new int[count]; if (has(CASE_INSENSITIVE)) { if (has(UNICODE_CASE)) { for (int i = 0; i < count; i++) { tmp[i] = Character.toLowerCase( Character.toUpperCase(buf[i])); } return hasSupplementary? new SliceUS(tmp) : new SliceU(tmp); } for (int i = 0; i < count; i++) { tmp[i] = ASCII.toLower(buf[i]); } return hasSupplementary? new SliceIS(tmp) : new SliceI(tmp); } for (int i = 0; i < count; i++) { tmp[i] = buf[i]; } return hasSupplementary ? new SliceS(tmp) : new Slice(tmp); }
/** * Returns a suitably optimized, single character matcher. */ private CharProperty newSingle(final int ch) { if (has(CASE_INSENSITIVE)) { int lower, upper; if (has(UNICODE_CASE)) { upper = Character.toUpperCase(ch); lower = Character.toLowerCase(upper); if (upper != lower) return new SingleU(lower); } else if (ASCII.isAscii(ch)) { lower = ASCII.toLower(ch); upper = ASCII.toUpper(ch); if (lower != upper) return new SingleI(lower, upper); } } if (isSupplementary(ch)) return new SingleS(ch); // Match a given Unicode character return new Single(ch); // Match a given BMP character }
/** * Returns a suitably optimized, single character matcher. */ private CharProperty newSingle(final int ch) { if (has(CASE_INSENSITIVE)) { int lower, upper; if (has(UNICODE_CASE)) { upper = Character.toUpperCase(ch); lower = Character.toLowerCase(upper); if (upper != lower) return new SingleU(lower); } else if (ASCII.isAscii(ch)) { lower = ASCII.toLower(ch); upper = ASCII.toUpper(ch); if (lower != upper) return new SingleI(lower, upper); } } if (isSupplementary(ch)) return new SingleS(ch); // Match a given Unicode character return new Single(ch); // Match a given BMP character }