Merge remote-tracking branch 'origin/regex'

This commit is contained in:
Alexey Andreev 2014-10-25 17:37:56 +04:00
commit a0493055a8
96 changed files with 936 additions and 1003 deletions

View File

@ -773,7 +773,7 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
} }
public TString substring(int from, int to) { public TString substring(int from, int to) {
if (from > to || from < 0 || to >= length) { if (from > to || from < 0 || to > length) {
throw new TIndexOutOfBoundsException(); throw new TIndexOutOfBoundsException();
} }
return new TString(buffer, from, to - from); return new TString(buffer, from, to - from);

View File

@ -636,8 +636,12 @@ public class TCharacter extends TObject implements TComparable<TCharacter> {
case 0x1E: case 0x1E:
case 0x1F: case 0x1F:
return true; return true;
case 0xA0:
case 0x2007:
case 0x202F:
return false;
default: default:
return isWhitespace(codePoint); return isSpaceChar(codePoint);
} }
} }

View File

@ -1,46 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Nikolay A. Kuznetsov
*/
package org.teavm.classlib.java.util.regex;
import java.text.MessageFormat;
/**
* Internationalization stub. All the messages in java.util.regexp
* package done though this class. This class should be lately replaced with
* real internationalization utility.
*
* @author Nikolay A. Kuznetsov
*
*/
class I18n {
public static String getMessage(String message) {
return message;
}
public static String getFormattedMessage(String message, Object arg1) {
return MessageFormat.format(message, new Object[] {arg1});
}
public static String getFormattedMessage(String message, Object arg1, Object arg2) {
return MessageFormat.format(message, new Object[] {arg1, arg2});
}
}

View File

@ -45,7 +45,7 @@ import java.util.BitSet;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
abstract class AbstractCharClass extends SpecialToken { abstract class TAbstractCharClass extends TSpecialToken {
protected boolean alt; protected boolean alt;
protected boolean altSurrogates; protected boolean altSurrogates;
@ -55,9 +55,9 @@ abstract class AbstractCharClass extends SpecialToken {
BitSet lowHighSurrogates = new BitSet(SURROGATE_CARDINALITY); BitSet lowHighSurrogates = new BitSet(SURROGATE_CARDINALITY);
AbstractCharClass charClassWithoutSurrogates = null; TAbstractCharClass charClassWithoutSurrogates = null;
AbstractCharClass charClassWithSurrogates = null; TAbstractCharClass charClassWithSurrogates = null;
static PredefinedCharacterClasses charClasses = new PredefinedCharacterClasses(); static PredefinedCharacterClasses charClasses = new PredefinedCharacterClasses();
@ -101,24 +101,24 @@ abstract class AbstractCharClass extends SpecialToken {
@Override @Override
public int getType() { public int getType() {
return SpecialToken.TOK_CHARCLASS; return TSpecialToken.TOK_CHARCLASS;
} }
public AbstractCharClass getInstance() { public TAbstractCharClass getInstance() {
return this; return this;
} }
public AbstractCharClass getSurrogates() { public TAbstractCharClass getSurrogates() {
if (charClassWithSurrogates == null) { if (charClassWithSurrogates == null) {
final BitSet lHS = getLowHighSurrogates(); final BitSet lHS = getLowHighSurrogates();
charClassWithSurrogates = new AbstractCharClass() { charClassWithSurrogates = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
int index = ch - Character.MIN_SURROGATE; int index = ch - Character.MIN_SURROGATE;
return ((index >= 0) && (index < AbstractCharClass.SURROGATE_CARDINALITY)) ? this.altSurrogates ^ return ((index >= 0) && (index < TAbstractCharClass.SURROGATE_CARDINALITY)) ? this.altSurrogates ^
lHS.get(index) : false; lHS.get(index) : false;
} }
}; };
@ -128,17 +128,17 @@ abstract class AbstractCharClass extends SpecialToken {
return charClassWithSurrogates; return charClassWithSurrogates;
} }
public AbstractCharClass getWithoutSurrogates() { public TAbstractCharClass getWithoutSurrogates() {
if (charClassWithoutSurrogates == null) { if (charClassWithoutSurrogates == null) {
final BitSet lHS = getLowHighSurrogates(); final BitSet lHS = getLowHighSurrogates();
final AbstractCharClass thisClass = this; final TAbstractCharClass thisClass = this;
charClassWithoutSurrogates = new AbstractCharClass() { charClassWithoutSurrogates = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
int index = ch - Character.MIN_SURROGATE; int index = ch - Character.MIN_SURROGATE;
boolean containslHS = ((index >= 0) && (index < AbstractCharClass.SURROGATE_CARDINALITY)) ? this.altSurrogates ^ boolean containslHS = ((index >= 0) && (index < TAbstractCharClass.SURROGATE_CARDINALITY)) ? this.altSurrogates ^
lHS.get(index) lHS.get(index)
: false; : false;
@ -165,10 +165,10 @@ abstract class AbstractCharClass extends SpecialToken {
* just overall meaning of the class. * just overall meaning of the class.
* *
* @see #contains(int) * @see #contains(int)
* @see #intersect(CharClass) * @see #intersect(TCharClass)
* @see #union(CharClass) * @see #union(TCharClass)
*/ */
public AbstractCharClass setNegative(boolean value) { public TAbstractCharClass setNegative(boolean value) {
if (alt ^ value) { if (alt ^ value) {
alt = !alt; alt = !alt;
altSurrogates = !altSurrogates; altSurrogates = !altSurrogates;
@ -191,26 +191,26 @@ abstract class AbstractCharClass extends SpecialToken {
return ch1 == ch2; return ch1 == ch2;
} }
public static boolean intersects(AbstractCharClass cc, int ch) { public static boolean intersects(TAbstractCharClass cc, int ch) {
return cc.contains(ch); return cc.contains(ch);
} }
public static boolean intersects(AbstractCharClass cc1, AbstractCharClass cc2) { public static boolean intersects(TAbstractCharClass cc1, TAbstractCharClass cc2) {
if (cc1.getBits() == null || cc2.getBits() == null) if (cc1.getBits() == null || cc2.getBits() == null)
return true; return true;
return cc1.getBits().intersects(cc2.getBits()); return cc1.getBits().intersects(cc2.getBits());
} }
public static AbstractCharClass getPredefinedClass(String name, boolean negative) { public static TAbstractCharClass getPredefinedClass(String name, boolean negative) {
return ((LazyCharClass)charClasses.getObject(name)).getValue(negative); return ((LazyCharClass)charClasses.getObject(name)).getValue(negative);
} }
abstract static class LazyCharClass { abstract static class LazyCharClass {
AbstractCharClass posValue = null; TAbstractCharClass posValue = null;
AbstractCharClass negValue = null; TAbstractCharClass negValue = null;
public AbstractCharClass getValue(boolean negative) { public TAbstractCharClass getValue(boolean negative) {
if (!negative && posValue == null) { if (!negative && posValue == null) {
posValue = computeValue(); posValue = computeValue();
} else if (negative && negValue == null) { } else if (negative && negValue == null) {
@ -221,20 +221,20 @@ abstract class AbstractCharClass extends SpecialToken {
return negValue; return negValue;
} }
protected abstract AbstractCharClass computeValue(); protected abstract TAbstractCharClass computeValue();
} }
static class LazyDigit extends LazyCharClass { static class LazyDigit extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add('0', '9'); return new TCharClass().add('0', '9');
} }
} }
static class LazyNonDigit extends LazyDigit { static class LazyNonDigit extends LazyDigit {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = super.computeValue().setNegative(true); TAbstractCharClass chCl = super.computeValue().setNegative(true);
chCl.mayContainSupplCodepoints = true; chCl.mayContainSupplCodepoints = true;
return chCl; return chCl;
@ -243,16 +243,16 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazySpace extends LazyCharClass { static class LazySpace extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
/* 9-13 - \t\n\x0B\f\r; 32 - ' ' */ /* 9-13 - \t\n\x0B\f\r; 32 - ' ' */
return new CharClass().add(9, 13).add(32); return new TCharClass().add(9, 13).add(32);
} }
} }
static class LazyNonSpace extends LazySpace { static class LazyNonSpace extends LazySpace {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = super.computeValue().setNegative(true); TAbstractCharClass chCl = super.computeValue().setNegative(true);
chCl.mayContainSupplCodepoints = true; chCl.mayContainSupplCodepoints = true;
return chCl; return chCl;
@ -261,15 +261,15 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyWord extends LazyCharClass { static class LazyWord extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add('a', 'z').add('A', 'Z').add('0', '9').add('_'); return new TCharClass().add('a', 'z').add('A', 'Z').add('0', '9').add('_');
} }
} }
static class LazyNonWord extends LazyWord { static class LazyNonWord extends LazyWord {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = super.computeValue().setNegative(true); TAbstractCharClass chCl = super.computeValue().setNegative(true);
chCl.mayContainSupplCodepoints = true; chCl.mayContainSupplCodepoints = true;
return chCl; return chCl;
@ -278,80 +278,80 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyLower extends LazyCharClass { static class LazyLower extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add('a', 'z'); return new TCharClass().add('a', 'z');
} }
} }
static class LazyUpper extends LazyCharClass { static class LazyUpper extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add('A', 'Z'); return new TCharClass().add('A', 'Z');
} }
} }
static class LazyASCII extends LazyCharClass { static class LazyASCII extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add(0x00, 0x7F); return new TCharClass().add(0x00, 0x7F);
} }
} }
static class LazyAlpha extends LazyCharClass { static class LazyAlpha extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add('a', 'z').add('A', 'Z'); return new TCharClass().add('a', 'z').add('A', 'Z');
} }
} }
static class LazyAlnum extends LazyAlpha { static class LazyAlnum extends LazyAlpha {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return ((CharClass)super.computeValue()).add('0', '9'); return ((TCharClass)super.computeValue()).add('0', '9');
} }
} }
static class LazyPunct extends LazyCharClass { static class LazyPunct extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
/* Punctuation !"#$%&'()*+,-./:;<=>?@ [\]^_` {|}~ */ /* Punctuation !"#$%&'()*+,-./:;<=>?@ [\]^_` {|}~ */
return new CharClass().add(0x21, 0x40).add(0x5B, 0x60).add(0x7B, 0x7E); return new TCharClass().add(0x21, 0x40).add(0x5B, 0x60).add(0x7B, 0x7E);
} }
} }
static class LazyGraph extends LazyAlnum { static class LazyGraph extends LazyAlnum {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
/* plus punctuation */ /* plus punctuation */
return ((CharClass)super.computeValue()).add(0x21, 0x40).add(0x5B, 0x60).add(0x7B, 0x7E); return ((TCharClass)super.computeValue()).add(0x21, 0x40).add(0x5B, 0x60).add(0x7B, 0x7E);
} }
} }
static class LazyPrint extends LazyGraph { static class LazyPrint extends LazyGraph {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return ((CharClass)super.computeValue()).add(0x20); return ((TCharClass)super.computeValue()).add(0x20);
} }
} }
static class LazyBlank extends LazyCharClass { static class LazyBlank extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add(' ').add('\t'); return new TCharClass().add(' ').add('\t');
} }
} }
static class LazyCntrl extends LazyCharClass { static class LazyCntrl extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add(0x00, 0x1F).add(0x7F); return new TCharClass().add(0x00, 0x1F).add(0x7F);
} }
} }
static class LazyXDigit extends LazyCharClass { static class LazyXDigit extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new CharClass().add('0', '9').add('a', 'f').add('A', 'F'); return new TCharClass().add('0', '9').add('a', 'f').add('A', 'F');
} }
} }
@ -364,16 +364,16 @@ abstract class AbstractCharClass extends SpecialToken {
} }
@Override @Override
public AbstractCharClass computeValue() { public TAbstractCharClass computeValue() {
AbstractCharClass chCl = new CharClass().add(start, end); TAbstractCharClass chCl = new TCharClass().add(start, end);
return chCl; return chCl;
} }
} }
static class LazySpecialsBlock extends LazyCharClass { static class LazySpecialsBlock extends LazyCharClass {
@Override @Override
public AbstractCharClass computeValue() { public TAbstractCharClass computeValue() {
return new CharClass().add(0xFEFF, 0xFEFF).add(0xFFF0, 0xFFFD); return new TCharClass().add(0xFEFF, 0xFEFF).add(0xFFF0, 0xFFFD);
} }
} }
@ -396,8 +396,8 @@ abstract class AbstractCharClass extends SpecialToken {
} }
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new UnicodeCategoryScope(category); TAbstractCharClass chCl = new TUnicodeCategoryScope(category);
if (containsAllSurrogates) { if (containsAllSurrogates) {
chCl.lowHighSurrogates.set(0, SURROGATE_CARDINALITY); chCl.lowHighSurrogates.set(0, SURROGATE_CARDINALITY);
} }
@ -426,8 +426,8 @@ abstract class AbstractCharClass extends SpecialToken {
} }
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new UnicodeCategory(category); TAbstractCharClass chCl = new TUnicodeCategory(category);
if (containsAllSurrogates) { if (containsAllSurrogates) {
chCl.lowHighSurrogates.set(0, SURROGATE_CARDINALITY); chCl.lowHighSurrogates.set(0, SURROGATE_CARDINALITY);
} }
@ -439,8 +439,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaLowerCase extends LazyCharClass { static class LazyJavaLowerCase extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isLowerCase(ch); return Character.isLowerCase(ch);
@ -454,8 +454,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaUpperCase extends LazyCharClass { static class LazyJavaUpperCase extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isUpperCase(ch); return Character.isUpperCase(ch);
@ -469,8 +469,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaWhitespace extends LazyCharClass { static class LazyJavaWhitespace extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new AbstractCharClass() { return new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isWhitespace(ch); return Character.isWhitespace(ch);
@ -481,8 +481,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaMirrored extends LazyCharClass { static class LazyJavaMirrored extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new AbstractCharClass() { return new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
// TODO implement this method and uncomment // TODO implement this method and uncomment
@ -495,8 +495,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaDefined extends LazyCharClass { static class LazyJavaDefined extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isDefined(ch); return Character.isDefined(ch);
@ -511,8 +511,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaDigit extends LazyCharClass { static class LazyJavaDigit extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isDigit(ch); return Character.isDigit(ch);
@ -526,8 +526,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaIdentifierIgnorable extends LazyCharClass { static class LazyJavaIdentifierIgnorable extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isIdentifierIgnorable(ch); return Character.isIdentifierIgnorable(ch);
@ -541,8 +541,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaISOControl extends LazyCharClass { static class LazyJavaISOControl extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new AbstractCharClass() { return new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isISOControl(ch); return Character.isISOControl(ch);
@ -553,8 +553,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaJavaIdentifierPart extends LazyCharClass { static class LazyJavaJavaIdentifierPart extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isJavaIdentifierPart(ch); return Character.isJavaIdentifierPart(ch);
@ -568,8 +568,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaJavaIdentifierStart extends LazyCharClass { static class LazyJavaJavaIdentifierStart extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isJavaIdentifierStart(ch); return Character.isJavaIdentifierStart(ch);
@ -583,8 +583,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaLetter extends LazyCharClass { static class LazyJavaLetter extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isLetter(ch); return Character.isLetter(ch);
@ -598,8 +598,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaLetterOrDigit extends LazyCharClass { static class LazyJavaLetterOrDigit extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isLetterOrDigit(ch); return Character.isLetterOrDigit(ch);
@ -613,8 +613,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaSpaceChar extends LazyCharClass { static class LazyJavaSpaceChar extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new AbstractCharClass() { return new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isSpaceChar(ch); return Character.isSpaceChar(ch);
@ -625,8 +625,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaTitleCase extends LazyCharClass { static class LazyJavaTitleCase extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
return new AbstractCharClass() { return new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isTitleCase(ch); return Character.isTitleCase(ch);
@ -637,8 +637,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaUnicodeIdentifierPart extends LazyCharClass { static class LazyJavaUnicodeIdentifierPart extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isUnicodeIdentifierPart(ch); return Character.isUnicodeIdentifierPart(ch);
@ -652,8 +652,8 @@ abstract class AbstractCharClass extends SpecialToken {
static class LazyJavaUnicodeIdentifierStart extends LazyCharClass { static class LazyJavaUnicodeIdentifierStart extends LazyCharClass {
@Override @Override
protected AbstractCharClass computeValue() { protected TAbstractCharClass computeValue() {
AbstractCharClass chCl = new AbstractCharClass() { TAbstractCharClass chCl = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return Character.isUnicodeIdentifierStart(ch); return Character.isUnicodeIdentifierStart(ch);

View File

@ -40,20 +40,20 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
abstract class AbstractLineTerminator { abstract class TAbstractLineTerminator {
static AbstractLineTerminator unixLT = null; static TAbstractLineTerminator unixLT = null;
static AbstractLineTerminator unicodeLT = null; static TAbstractLineTerminator unicodeLT = null;
public abstract boolean isLineTerminator(int ch); public abstract boolean isLineTerminator(int ch);
public abstract boolean isAfterLineTerminator(int ch1, int ch2); public abstract boolean isAfterLineTerminator(int ch1, int ch2);
public static AbstractLineTerminator getInstance(int flag) { public static TAbstractLineTerminator getInstance(int flag) {
if ((flag & TPattern.UNIX_LINES) != 0) { if ((flag & TPattern.UNIX_LINES) != 0) {
if (unixLT != null) if (unixLT != null)
return unixLT; return unixLT;
unixLT = new AbstractLineTerminator() { unixLT = new TAbstractLineTerminator() {
@Override @Override
public boolean isLineTerminator(int ch) { public boolean isLineTerminator(int ch) {
return ch == '\n'; return ch == '\n';
@ -68,7 +68,7 @@ abstract class AbstractLineTerminator {
} else { } else {
if (unicodeLT != null) if (unicodeLT != null)
return unicodeLT; return unicodeLT;
unicodeLT = new AbstractLineTerminator() { unicodeLT = new TAbstractLineTerminator() {
@Override @Override
public boolean isLineTerminator(int ch) { public boolean isLineTerminator(int ch) {
return (ch == '\n' || ch == '\r' || ch == '\u0085' || (ch | 1) == '\u2029'); return (ch == '\n' || ch == '\r' || ch == '\u0085' || (ch | 1) == '\u2029');

View File

@ -41,7 +41,7 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
abstract class AbstractSet { abstract class TAbstractSet {
public static final int TYPE_LEAF = 1 << 0; public static final int TYPE_LEAF = 1 << 0;
@ -54,7 +54,7 @@ abstract class AbstractSet {
/** /**
* Next node to visit * Next node to visit
*/ */
protected AbstractSet next; protected TAbstractSet next;
/** /**
* Counter for debugging purposes, represent unique node index; * Counter for debugging purposes, represent unique node index;
@ -63,14 +63,14 @@ abstract class AbstractSet {
protected boolean isSecondPassVisited = false; protected boolean isSecondPassVisited = false;
protected String index = new Integer(AbstractSet.counter++).toString(); protected String index = new Integer(TAbstractSet.counter++).toString();
private int type = 0; private int type = 0;
public AbstractSet() { public TAbstractSet() {
} }
public AbstractSet(AbstractSet n) { public TAbstractSet(TAbstractSet n) {
next = n; next = n;
} }
@ -87,7 +87,7 @@ abstract class AbstractSet {
* - MatchResult to sore result into * - MatchResult to sore result into
* @return -1 if match fails or n > 0; * @return -1 if match fails or n > 0;
*/ */
public abstract int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult); public abstract int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult);
/** /**
* Attempts to apply pattern starting from this set/stringIndex; returns * Attempts to apply pattern starting from this set/stringIndex; returns
@ -108,7 +108,7 @@ abstract class AbstractSet {
* result of the match * result of the match
* @return last searched index * @return last searched index
*/ */
public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int length = matchResult.getRightBound(); int length = matchResult.getRightBound();
while (stringIndex <= length) { while (stringIndex <= length) {
if (matches(stringIndex, testString, matchResult) >= 0) { if (matches(stringIndex, testString, matchResult) >= 0) {
@ -132,7 +132,7 @@ abstract class AbstractSet {
* @return an index to start back search next time if this search fails(new * @return an index to start back search next time if this search fails(new
* left bound); if this search fails the value is negative; * left bound); if this search fails the value is negative;
*/ */
public int findBack(int stringIndex, int startSearch, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int stringIndex, int startSearch, CharSequence testString, TMatchResultImpl matchResult) {
while (startSearch >= stringIndex) { while (startSearch >= stringIndex) {
if (matches(startSearch, testString, matchResult) >= 0) { if (matches(startSearch, testString, matchResult) >= 0) {
return startSearch; return startSearch;
@ -152,7 +152,7 @@ abstract class AbstractSet {
* @param matchResult * @param matchResult
* @return * @return
*/ */
public abstract boolean hasConsumed(MatchResultImpl matchResult); public abstract boolean hasConsumed(TMatchResultImpl matchResult);
/** /**
* Returns name for the particular node type. Used for debugging purposes. * Returns name for the particular node type. Used for debugging purposes.
@ -179,7 +179,7 @@ abstract class AbstractSet {
/** /**
* Returns the next. * Returns the next.
*/ */
public AbstractSet getNext() { public TAbstractSet getNext() {
return next; return next;
} }
@ -189,7 +189,7 @@ abstract class AbstractSet {
* @param next * @param next
* The next to set. * The next to set.
*/ */
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@ -206,7 +206,7 @@ abstract class AbstractSet {
* *
* @return true if the given node intersects with this one * @return true if the given node intersects with this one
*/ */
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
return true; return true;
} }
@ -218,7 +218,7 @@ abstract class AbstractSet {
* @return null if current node need not to be replaced JointSet which is * @return null if current node need not to be replaced JointSet which is
* replacement of current node otherwise * replacement of current node otherwise
*/ */
public JointSet processBackRefReplacement() { public TJointSet processBackRefReplacement() {
return null; return null;
} }
@ -236,7 +236,7 @@ abstract class AbstractSet {
/* /*
* Add here code to do during the pass * Add here code to do during the pass
*/ */
JointSet set = next.processBackRefReplacement(); TJointSet set = next.processBackRefReplacement();
if (set != null) { if (set != null) {
next.isSecondPassVisited = true; next.isSecondPassVisited = true;
@ -259,7 +259,7 @@ abstract class AbstractSet {
/* /*
* Add here code to do during the pass * Add here code to do during the pass
*/ */
if (next instanceof SingleSet && ((FSet)((JointSet)next).fSet).isBackReferenced) { if (next instanceof TSingleSet && ((TFSet)((TJointSet)next).fSet).isBackReferenced) {
next = next.next; next = next.next;
} }

View File

@ -40,13 +40,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class AheadFSet extends FSet { class TAheadFSet extends TFSet {
public AheadFSet() { public TAheadFSet() {
super(-1); super(-1);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
return stringIndex; return stringIndex;
} }

View File

@ -40,13 +40,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class AltGroupQuantifierSet extends GroupQuantifierSet { class TAltGroupQuantifierSet extends TGroupQuantifierSet {
public AltGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TAltGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (!innerSet.hasConsumed(matchResult)) if (!innerSet.hasConsumed(matchResult))
return next.matches(stringIndex, testString, matchResult); return next.matches(stringIndex, testString, matchResult);
@ -60,7 +60,7 @@ class AltGroupQuantifierSet extends GroupQuantifierSet {
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
super.setNext(next); super.setNext(next);
innerSet.setNext(next); innerSet.setNext(next);
} }

View File

@ -40,14 +40,14 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class AltQuantifierSet extends LeafQuantifierSet { class TAltQuantifierSet extends TLeafQuantifierSet {
public AltQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { public TAltQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int shift = 0; int shift = 0;
if ((shift = innerSet.matches(stringIndex, testString, matchResult)) >= 0) { if ((shift = innerSet.matches(stringIndex, testString, matchResult)) >= 0) {
@ -58,7 +58,7 @@ class AltQuantifierSet extends LeafQuantifierSet {
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
super.setNext(next); super.setNext(next);
innerSet.setNext(next); innerSet.setNext(next);
} }

View File

@ -38,16 +38,16 @@ package org.teavm.classlib.java.util.regex;
/** /**
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class AtomicFSet extends FSet { class TAtomicFSet extends TFSet {
int index; int index;
public AtomicFSet(int groupIndex) { public TAtomicFSet(int groupIndex) {
super(groupIndex); super(groupIndex);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int gr = getGroupIndex(); int gr = getGroupIndex();
matchResult.setConsumed(gr, stringIndex - matchResult.getConsumed(gr)); matchResult.setConsumed(gr, stringIndex - matchResult.getConsumed(gr));
@ -66,7 +66,7 @@ class AtomicFSet extends FSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl mr) { public boolean hasConsumed(TMatchResultImpl mr) {
return false; return false;
} }
} }

View File

@ -43,8 +43,8 @@ import java.util.ArrayList;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class AtomicJointSet extends NonCapJointSet { class TAtomicJointSet extends TNonCapJointSet {
public AtomicJointSet(ArrayList<AbstractSet> children, FSet fSet) { public TAtomicJointSet(ArrayList<TAbstractSet> children, TFSet fSet) {
super(children, fSet); super(children, fSet);
} }
@ -52,18 +52,18 @@ class AtomicJointSet extends NonCapJointSet {
* Returns stringIndex+shift, the next position to match * Returns stringIndex+shift, the next position to match
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int start = matchResult.getConsumed(groupIndex); int start = matchResult.getConsumed(groupIndex);
matchResult.setConsumed(groupIndex, stringIndex); matchResult.setConsumed(groupIndex, stringIndex);
int size = children.size(); int size = children.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
AbstractSet e = children.get(i); TAbstractSet e = children.get(i);
int shift = e.matches(stringIndex, testString, matchResult); int shift = e.matches(stringIndex, testString, matchResult);
if (shift >= 0) { if (shift >= 0) {
// AtomicFset always returns true, but saves the index to run // AtomicFset always returns true, but saves the index to run
// this next.match() from; // this next.match() from;
return next.matches(((AtomicFSet)fSet).getIndex(), testString, matchResult); return next.matches(((TAtomicFSet)fSet).getIndex(), testString, matchResult);
} }
} }
@ -72,12 +72,12 @@ class AtomicJointSet extends NonCapJointSet {
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return next; return next;
} }

View File

@ -40,14 +40,14 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class BackReferenceSet extends CIBackReferenceSet { class TBackReferenceSet extends TCIBackReferenceSet {
public BackReferenceSet(int groupIndex, int consCounter) { public TBackReferenceSet(int groupIndex, int consCounter) {
super(groupIndex, consCounter); super(groupIndex, consCounter);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
String group = getString(matchResult); String group = getString(matchResult);
if (group == null || (stringIndex + group.length()) > matchResult.getRightBound()) if (group == null || (stringIndex + group.length()) > matchResult.getRightBound())
return -1; return -1;
@ -61,7 +61,7 @@ class BackReferenceSet extends CIBackReferenceSet {
} }
@Override @Override
public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
String group = getString(matchResult); String group = getString(matchResult);
int strLength = matchResult.getLeftBound(); int strLength = matchResult.getLeftBound();
@ -86,7 +86,7 @@ class BackReferenceSet extends CIBackReferenceSet {
} }
@Override @Override
public int findBack(int strIndex, int lastIndex, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int strIndex, int lastIndex, CharSequence testString, TMatchResultImpl matchResult) {
String group = getString(matchResult); String group = getString(matchResult);
if (group == null) if (group == null)
@ -109,12 +109,12 @@ class BackReferenceSet extends CIBackReferenceSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
return true; return true;
} }
@Override @Override
public String getName() { public String getName() {
return "back reference: " + this.groupIndex; //$NON-NLS-1$ return "back reference: " + this.groupIndex;
} }
} }

View File

@ -41,7 +41,7 @@ package org.teavm.classlib.java.util.regex;
* group is referenced via backreference. * group is referenced via backreference.
*/ */
class BackReferencedSingleSet extends SingleSet { class TBackReferencedSingleSet extends TSingleSet {
/* /*
* This class is needed only for overwriting find() and findBack() methods * This class is needed only for overwriting find() and findBack() methods
@ -57,16 +57,16 @@ class BackReferencedSingleSet extends SingleSet {
* performance, but ensure correctness of the match. * performance, but ensure correctness of the match.
*/ */
public BackReferencedSingleSet(AbstractSet child, FSet fSet) { public TBackReferencedSingleSet(TAbstractSet child, TFSet fSet) {
super(child, fSet); super(child, fSet);
} }
public BackReferencedSingleSet(SingleSet node) { public TBackReferencedSingleSet(TSingleSet node) {
super(node.kid, ((FSet)node.fSet)); super(node.kid, ((TFSet)node.fSet));
} }
@Override @Override
public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int res = 0; int res = 0;
int lastIndex = matchResult.getRightBound(); int lastIndex = matchResult.getRightBound();
int startSearch = stringIndex; int startSearch = stringIndex;
@ -88,7 +88,7 @@ class BackReferencedSingleSet extends SingleSet {
} }
@Override @Override
public int findBack(int stringIndex, int lastIndex, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int stringIndex, int lastIndex, CharSequence testString, TMatchResultImpl matchResult) {
int res = 0; int res = 0;
int startSearch = lastIndex; int startSearch = lastIndex;
@ -115,7 +115,7 @@ class BackReferencedSingleSet extends SingleSet {
* - node who references to this node * - node who references to this node
*/ */
@Override @Override
public JointSet processBackRefReplacement() { public TJointSet processBackRefReplacement() {
return null; return null;
} }
} }

View File

@ -42,13 +42,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class BehindFSet extends FSet { class TBehindFSet extends TFSet {
public BehindFSet(int groupIndex) { public TBehindFSet(int groupIndex) {
super(groupIndex); super(groupIndex);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int gr = getGroupIndex(); int gr = getGroupIndex();
int rightBound = matchResult.getConsumed(gr); int rightBound = matchResult.getConsumed(gr);
@ -57,6 +57,6 @@ class BehindFSet extends FSet {
@Override @Override
protected String getName() { protected String getName() {
return "BehindFSet"; //$NON-NLS-1$ return "BehindFSet";
} }
} }

View File

@ -40,11 +40,11 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class CIBackReferenceSet extends JointSet { class TCIBackReferenceSet extends TJointSet {
protected int referencedGroup; protected int referencedGroup;
protected int consCounter; protected int consCounter;
public CIBackReferenceSet(int groupIndex, int consCounter) { public TCIBackReferenceSet(int groupIndex, int consCounter) {
this.referencedGroup = groupIndex; this.referencedGroup = groupIndex;
this.consCounter = consCounter; this.consCounter = consCounter;
} }
@ -54,7 +54,7 @@ class CIBackReferenceSet extends JointSet {
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
String group = getString(matchResult); String group = getString(matchResult);
if (group == null || (stringIndex + group.length()) > matchResult.getRightBound()) if (group == null || (stringIndex + group.length()) > matchResult.getRightBound())
@ -71,16 +71,16 @@ class CIBackReferenceSet extends JointSet {
} }
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
protected String getString(MatchResultImpl matchResult) { protected String getString(TMatchResultImpl matchResult) {
String res = matchResult.getGroupNoCheck(referencedGroup); String res = matchResult.getGroupNoCheck(referencedGroup);
return res; return res;
} }
@ -91,7 +91,7 @@ class CIBackReferenceSet extends JointSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
int cons; int cons;
boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0);
matchResult.setConsumed(consCounter, -1); matchResult.setConsumed(consCounter, -1);

View File

@ -40,13 +40,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class CICharSet extends LeafSet { class TCICharSet extends TLeafSet {
private char ch; private char ch;
private char supplement; private char supplement;
public CICharSet(char ch) { public TCICharSet(char ch) {
this.ch = ch; this.ch = ch;
this.supplement = TPattern.getSupplement(ch); this.supplement = TPattern.getSupplement(ch);
} }

View File

@ -39,12 +39,12 @@ package org.teavm.classlib.java.util.regex;
* CANON_EQ flag of Pattern class * CANON_EQ flag of Pattern class
* is specified. * is specified.
*/ */
class CIDecomposedCharSet extends DecomposedCharSet{ class TCIDecomposedCharSet extends TDecomposedCharSet {
/* /*
* Just only a stub * Just only a stub
*/ */
public CIDecomposedCharSet(int [] decomp, int decomposedCharLength) { public TCIDecomposedCharSet(int [] decomp, int decomposedCharLength) {
super(decomp, decomposedCharLength); super(decomp, decomposedCharLength);
} }
} }

View File

@ -40,10 +40,10 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class CISequenceSet extends LeafSet { class TCISequenceSet extends TLeafSet {
private String string = null; private String string = null;
CISequenceSet(StringBuffer substring) { TCISequenceSet(StringBuffer substring) {
this.string = substring.toString(); this.string = substring.toString();
this.charCount = substring.length(); this.charCount = substring.length();
} }

View File

@ -43,7 +43,7 @@ import java.util.BitSet;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class CharClass extends AbstractCharClass { class TCharClass extends TAbstractCharClass {
// Flag indicates if we add supplement upper/lower case // Flag indicates if we add supplement upper/lower case
boolean ci = false; boolean ci = false;
@ -60,17 +60,17 @@ class CharClass extends AbstractCharClass {
BitSet bits = new BitSet(); BitSet bits = new BitSet();
AbstractCharClass nonBitSet = null; TAbstractCharClass nonBitSet = null;
public CharClass() { public TCharClass() {
} }
public CharClass(boolean ci, boolean uci) { public TCharClass(boolean ci, boolean uci) {
this.ci = ci; this.ci = ci;
this.uci = uci; this.uci = uci;
} }
public CharClass(boolean negative, boolean ci, boolean uci) { public TCharClass(boolean negative, boolean ci, boolean uci) {
this(ci, uci); this(ci, uci);
setNegative(negative); setNegative(negative);
} }
@ -79,7 +79,7 @@ class CharClass extends AbstractCharClass {
* We can use this method safely even if nonBitSet != null due to specific * We can use this method safely even if nonBitSet != null due to specific
* of range constructions in regular expressions. * of range constructions in regular expressions.
*/ */
public CharClass add(int ch) { public TCharClass add(int ch) {
if (ci) { if (ci) {
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
if (!inverted) { if (!inverted) {
@ -94,7 +94,7 @@ class CharClass extends AbstractCharClass {
} }
} }
if (Lexer.isHighSurrogate(ch) || Lexer.isLowSurrogate(ch)) { if (TLexer.isHighSurrogate(ch) || TLexer.isLowSurrogate(ch)) {
if (!invertedSurrogates) { if (!invertedSurrogates) {
lowHighSurrogates.set(ch - Character.MIN_SURROGATE); lowHighSurrogates.set(ch - Character.MIN_SURROGATE);
} else { } else {
@ -120,7 +120,7 @@ class CharClass extends AbstractCharClass {
* "[^abc\\d]" (this pattern doesn't match "1") while union is used for * "[^abc\\d]" (this pattern doesn't match "1") while union is used for
* constructions like "[^abc[\\d]]" (this pattern matches "1"). * constructions like "[^abc[\\d]]" (this pattern matches "1").
*/ */
public CharClass add(final AbstractCharClass cc) { public TCharClass add(final TAbstractCharClass cc) {
if (!mayContainSupplCodepoints && cc.mayContainSupplCodepoints) { if (!mayContainSupplCodepoints && cc.mayContainSupplCodepoints) {
mayContainSupplCodepoints = true; mayContainSupplCodepoints = true;
@ -182,7 +182,7 @@ class CharClass extends AbstractCharClass {
if (nonBitSet == null) { if (nonBitSet == null) {
if (curAlt && !inverted && bits.isEmpty()) { if (curAlt && !inverted && bits.isEmpty()) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return cc.contains(ch); return cc.contains(ch);
@ -196,7 +196,7 @@ class CharClass extends AbstractCharClass {
* [^[abc]fgb] by using the formula a ^ b == !a ^ !b. * [^[abc]fgb] by using the formula a ^ b == !a ^ !b.
*/ */
if (curAlt) { if (curAlt) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return !((curAlt ^ bits.get(ch)) || ((curAlt ^ inverted) ^ cc.contains(ch))); return !((curAlt ^ bits.get(ch)) || ((curAlt ^ inverted) ^ cc.contains(ch)));
@ -204,7 +204,7 @@ class CharClass extends AbstractCharClass {
}; };
// alt = true // alt = true
} else { } else {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return (curAlt ^ bits.get(ch)) || ((curAlt ^ inverted) ^ cc.contains(ch)); return (curAlt ^ bits.get(ch)) || ((curAlt ^ inverted) ^ cc.contains(ch));
@ -216,10 +216,10 @@ class CharClass extends AbstractCharClass {
hideBits = true; hideBits = true;
} else { } else {
final AbstractCharClass nb = nonBitSet; final TAbstractCharClass nb = nonBitSet;
if (curAlt) { if (curAlt) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return !(curAlt ^ (nb.contains(ch) || cc.contains(ch))); return !(curAlt ^ (nb.contains(ch) || cc.contains(ch)));
@ -227,7 +227,7 @@ class CharClass extends AbstractCharClass {
}; };
// alt = true // alt = true
} else { } else {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return curAlt ^ (nb.contains(ch) || cc.contains(ch)); return curAlt ^ (nb.contains(ch) || cc.contains(ch));
@ -241,7 +241,7 @@ class CharClass extends AbstractCharClass {
return this; return this;
} }
public CharClass add(int st, int end) { public TCharClass add(int st, int end) {
if (st > end) if (st > end)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
if (!ci if (!ci
@ -263,7 +263,7 @@ class CharClass extends AbstractCharClass {
} }
// OR operation // OR operation
public void union(final AbstractCharClass clazz) { public void union(final TAbstractCharClass clazz) {
if (!mayContainSupplCodepoints && clazz.mayContainSupplCodepoints) { if (!mayContainSupplCodepoints && clazz.mayContainSupplCodepoints) {
mayContainSupplCodepoints = true; mayContainSupplCodepoints = true;
} }
@ -328,7 +328,7 @@ class CharClass extends AbstractCharClass {
if (!inverted && bits.isEmpty()) { if (!inverted && bits.isEmpty()) {
if (curAlt) { if (curAlt) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return !clazz.contains(ch); return !clazz.contains(ch);
@ -336,7 +336,7 @@ class CharClass extends AbstractCharClass {
}; };
// alt = true // alt = true
} else { } else {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return clazz.contains(ch); return clazz.contains(ch);
@ -347,7 +347,7 @@ class CharClass extends AbstractCharClass {
} else { } else {
if (curAlt) { if (curAlt) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return !(clazz.contains(ch) || (curAlt ^ bits.get(ch))); return !(clazz.contains(ch) || (curAlt ^ bits.get(ch)));
@ -355,7 +355,7 @@ class CharClass extends AbstractCharClass {
}; };
// alt = true // alt = true
} else { } else {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return clazz.contains(ch) || (curAlt ^ bits.get(ch)); return clazz.contains(ch) || (curAlt ^ bits.get(ch));
@ -366,10 +366,10 @@ class CharClass extends AbstractCharClass {
} }
hideBits = true; hideBits = true;
} else { } else {
final AbstractCharClass nb = nonBitSet; final TAbstractCharClass nb = nonBitSet;
if (curAlt) { if (curAlt) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return !((curAlt ^ nb.contains(ch)) || clazz.contains(ch)); return !((curAlt ^ nb.contains(ch)) || clazz.contains(ch));
@ -377,7 +377,7 @@ class CharClass extends AbstractCharClass {
}; };
// alt = true // alt = true
} else { } else {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return (curAlt ^ nb.contains(ch)) || clazz.contains(ch); return (curAlt ^ nb.contains(ch)) || clazz.contains(ch);
@ -390,7 +390,7 @@ class CharClass extends AbstractCharClass {
} }
// AND operation // AND operation
public void intersection(final AbstractCharClass clazz) { public void intersection(final TAbstractCharClass clazz) {
if (!mayContainSupplCodepoints && clazz.mayContainSupplCodepoints) { if (!mayContainSupplCodepoints && clazz.mayContainSupplCodepoints) {
mayContainSupplCodepoints = true; mayContainSupplCodepoints = true;
} }
@ -454,7 +454,7 @@ class CharClass extends AbstractCharClass {
if (!inverted && bits.isEmpty()) { if (!inverted && bits.isEmpty()) {
if (curAlt) { if (curAlt) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return !clazz.contains(ch); return !clazz.contains(ch);
@ -462,7 +462,7 @@ class CharClass extends AbstractCharClass {
}; };
// alt = true // alt = true
} else { } else {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return clazz.contains(ch); return clazz.contains(ch);
@ -473,7 +473,7 @@ class CharClass extends AbstractCharClass {
} else { } else {
if (curAlt) { if (curAlt) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return !(clazz.contains(ch) && (curAlt ^ bits.get(ch))); return !(clazz.contains(ch) && (curAlt ^ bits.get(ch)));
@ -481,7 +481,7 @@ class CharClass extends AbstractCharClass {
}; };
// alt = true // alt = true
} else { } else {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return clazz.contains(ch) && (curAlt ^ bits.get(ch)); return clazz.contains(ch) && (curAlt ^ bits.get(ch));
@ -492,10 +492,10 @@ class CharClass extends AbstractCharClass {
} }
hideBits = true; hideBits = true;
} else { } else {
final AbstractCharClass nb = nonBitSet; final TAbstractCharClass nb = nonBitSet;
if (curAlt) { if (curAlt) {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return !((curAlt ^ nb.contains(ch)) && clazz.contains(ch)); return !((curAlt ^ nb.contains(ch)) && clazz.contains(ch));
@ -503,7 +503,7 @@ class CharClass extends AbstractCharClass {
}; };
// alt = true // alt = true
} else { } else {
nonBitSet = new AbstractCharClass() { nonBitSet = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return (curAlt ^ nb.contains(ch)) && clazz.contains(ch); return (curAlt ^ nb.contains(ch)) && clazz.contains(ch);
@ -550,12 +550,12 @@ class CharClass extends AbstractCharClass {
} }
@Override @Override
public AbstractCharClass getInstance() { public TAbstractCharClass getInstance() {
if (nonBitSet == null) { if (nonBitSet == null) {
final BitSet bs = getBits(); final BitSet bs = getBits();
AbstractCharClass res = new AbstractCharClass() { TAbstractCharClass res = new TAbstractCharClass() {
@Override @Override
public boolean contains(int ch) { public boolean contains(int ch) {
return this.alt ^ bs.get(ch); return this.alt ^ bs.get(ch);

View File

@ -40,11 +40,11 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class CharSet extends LeafSet { class TCharSet extends TLeafSet {
private char ch = 0; private char ch = 0;
public CharSet(char ch) { public TCharSet(char ch) {
this.ch = ch; this.ch = ch;
} }
@ -59,7 +59,7 @@ class CharSet extends LeafSet {
} }
@Override @Override
public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (testString instanceof String) { if (testString instanceof String) {
String testStr = (String)testString; String testStr = (String)testString;
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
@ -81,7 +81,7 @@ class CharSet extends LeafSet {
} }
@Override @Override
public int findBack(int strIndex, int lastIndex, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int strIndex, int lastIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (testString instanceof String) { if (testString instanceof String) {
String testStr = (String)testString; String testStr = (String)testString;
@ -114,14 +114,14 @@ class CharSet extends LeafSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (set instanceof CharSet) { if (set instanceof TCharSet) {
return ((CharSet)set).getChar() == ch; return ((TCharSet)set).getChar() == ch;
} else if (set instanceof RangeSet) { } else if (set instanceof TRangeSet) {
return ((RangeSet)set).accepts(0, Character.toString(ch)) > 0; return ((TRangeSet)set).accepts(0, Character.toString(ch)) > 0;
} else if (set instanceof SupplRangeSet) { } else if (set instanceof TSupplRangeSet) {
return ((SupplRangeSet)set).contains(ch); return ((TSupplRangeSet)set).contains(ch);
} else if (set instanceof SupplCharSet) { } else if (set instanceof TSupplCharSet) {
return false; return false;
} }

View File

@ -40,9 +40,9 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class CompositeGroupQuantifierSet extends GroupQuantifierSet { class TCompositeGroupQuantifierSet extends TGroupQuantifierSet {
protected Quantifier quantifier = null; protected TQuantifier quantifier = null;
int setCounter; int setCounter;
@ -56,7 +56,7 @@ class CompositeGroupQuantifierSet extends GroupQuantifierSet {
* @param next * @param next
* - next set after the quantifier * - next set after the quantifier
*/ */
public CompositeGroupQuantifierSet(Quantifier quant, AbstractSet innerSet, AbstractSet next, int type, public TCompositeGroupQuantifierSet(TQuantifier quant, TAbstractSet innerSet, TAbstractSet next, int type,
int setCounter) { int setCounter) {
super(innerSet, next, type); super(innerSet, next, type);
this.quantifier = quant; this.quantifier = quant;
@ -64,7 +64,7 @@ class CompositeGroupQuantifierSet extends GroupQuantifierSet {
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int enterCounter = matchResult.getEnterCounter(setCounter); int enterCounter = matchResult.getEnterCounter(setCounter);
if (!innerSet.hasConsumed(matchResult)) if (!innerSet.hasConsumed(matchResult))
@ -102,7 +102,7 @@ class CompositeGroupQuantifierSet extends GroupQuantifierSet {
return quantifier.toString(); return quantifier.toString();
} }
void setQuantifier(Quantifier quant) { void setQuantifier(TQuantifier quant) {
this.quantifier = quant; this.quantifier = quant;
} }
} }

View File

@ -40,17 +40,17 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class CompositeQuantifierSet extends LeafQuantifierSet { class TCompositeQuantifierSet extends TLeafQuantifierSet {
protected Quantifier quantifier = null; protected TQuantifier quantifier = null;
public CompositeQuantifierSet(Quantifier quant, LeafSet innerSet, AbstractSet next, int type) { public TCompositeQuantifierSet(TQuantifier quant, TLeafSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
this.quantifier = quant; this.quantifier = quant;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int min = quantifier.min(); int min = quantifier.min();
int max = quantifier.max(); int max = quantifier.max();
int i = 0; int i = 0;
@ -98,7 +98,7 @@ class CompositeQuantifierSet extends LeafQuantifierSet {
return quantifier.toString(); return quantifier.toString();
} }
void setQuantifier(Quantifier quant) { void setQuantifier(TQuantifier quant) {
this.quantifier = quant; this.quantifier = quant;
} }
} }

View File

@ -103,21 +103,21 @@ package org.teavm.classlib.java.util.regex;
* consisting of all others characters from the parent range. This class * consisting of all others characters from the parent range. This class
* represents the parent range split in such a manner. * represents the parent range split in such a manner.
*/ */
class CompositeRangeSet extends JointSet { class TCompositeRangeSet extends TJointSet {
// range without surrogates // range without surrogates
AbstractSet withoutSurrogates; TAbstractSet withoutSurrogates;
// range containing surrogates only // range containing surrogates only
AbstractSet withSurrogates; TAbstractSet withSurrogates;
public CompositeRangeSet(AbstractSet withoutSurrogates, AbstractSet withSurrogates, AbstractSet next) { public TCompositeRangeSet(TAbstractSet withoutSurrogates, TAbstractSet withSurrogates, TAbstractSet next) {
this.withoutSurrogates = withoutSurrogates; this.withoutSurrogates = withoutSurrogates;
this.withSurrogates = withSurrogates; this.withSurrogates = withSurrogates;
setNext(next); setNext(next);
} }
public CompositeRangeSet(AbstractSet withoutSurrogates, AbstractSet withSurrogates) { public TCompositeRangeSet(TAbstractSet withoutSurrogates, TAbstractSet withSurrogates) {
this.withoutSurrogates = withoutSurrogates; this.withoutSurrogates = withoutSurrogates;
this.withSurrogates = withSurrogates; this.withSurrogates = withSurrogates;
} }
@ -126,12 +126,12 @@ class CompositeRangeSet extends JointSet {
* Returns the next. * Returns the next.
*/ */
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int shift = withoutSurrogates.matches(stringIndex, testString, matchResult); int shift = withoutSurrogates.matches(stringIndex, testString, matchResult);
if (shift < 0) { if (shift < 0) {
@ -151,17 +151,17 @@ class CompositeRangeSet extends JointSet {
* The next to set. * The next to set.
*/ */
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
withSurrogates.setNext(next); withSurrogates.setNext(next);
withoutSurrogates.setNext(next); withoutSurrogates.setNext(next);
} }
public AbstractSet getSurrogates() { public TAbstractSet getSurrogates() {
return withSurrogates; return withSurrogates;
} }
public AbstractSet getWithoutSurrogates() { public TAbstractSet getWithoutSurrogates() {
return withoutSurrogates; return withoutSurrogates;
} }
@ -171,12 +171,12 @@ class CompositeRangeSet extends JointSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return true; return true;
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
return true; return true;
} }
} }

View File

@ -21,7 +21,7 @@ package org.teavm.classlib.java.util.regex;
* Represents canonical decomposition of Unicode character. Is used when * Represents canonical decomposition of Unicode character. Is used when
* CANON_EQ flag of Pattern class is specified. * CANON_EQ flag of Pattern class is specified.
*/ */
class DecomposedCharSet extends JointSet { class TDecomposedCharSet extends TJointSet {
/** /**
* Contains information about number of chars that were read for a codepoint * Contains information about number of chars that were read for a codepoint
@ -45,7 +45,7 @@ class DecomposedCharSet extends JointSet {
*/ */
private int decomposedCharLength; private int decomposedCharLength;
public DecomposedCharSet(int[] decomposedChar, int decomposedCharLength) { public TDecomposedCharSet(int[] decomposedChar, int decomposedCharLength) {
this.decomposedChar = decomposedChar; this.decomposedChar = decomposedChar;
this.decomposedCharLength = decomposedCharLength; this.decomposedCharLength = decomposedCharLength;
} }
@ -54,7 +54,7 @@ class DecomposedCharSet extends JointSet {
* Returns the next. * Returns the next.
*/ */
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@ -65,19 +65,19 @@ class DecomposedCharSet extends JointSet {
* The next to set. * The next to set.
*/ */
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@Override @Override
public int matches(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
/* /*
* All decompositions have length that is less or equal * All decompositions have length that is less or equal
* Lexer.MAX_DECOMPOSITION_LENGTH * Lexer.MAX_DECOMPOSITION_LENGTH
*/ */
int[] decCurCodePoint; int[] decCurCodePoint;
int[] decCodePoint = new int[Lexer.MAX_DECOMPOSITION_LENGTH]; int[] decCodePoint = new int[TLexer.MAX_DECOMPOSITION_LENGTH];
int readCodePoints = 0; int readCodePoints = 0;
int rightBound = matchResult.getRightBound(); int rightBound = matchResult.getRightBound();
int curChar; int curChar;
@ -93,7 +93,7 @@ class DecomposedCharSet extends JointSet {
*/ */
curChar = codePointAt(strIndex, testString, rightBound); curChar = codePointAt(strIndex, testString, rightBound);
strIndex += readCharsForCodePoint; strIndex += readCharsForCodePoint;
decCurCodePoint = Lexer.getDecomposition(curChar); decCurCodePoint = TLexer.getDecomposition(curChar);
if (decCurCodePoint == null) { if (decCurCodePoint == null) {
decCodePoint[readCodePoints++] = curChar; decCodePoint[readCodePoints++] = curChar;
} else { } else {
@ -109,9 +109,9 @@ class DecomposedCharSet extends JointSet {
* Read testString until we met a decomposed char boundary and * Read testString until we met a decomposed char boundary and
* decompose obtained portion of testString * decompose obtained portion of testString
*/ */
while ((readCodePoints < Lexer.MAX_DECOMPOSITION_LENGTH) && !Lexer.isDecomposedCharBoundary(curChar)) { while ((readCodePoints < TLexer.MAX_DECOMPOSITION_LENGTH) && !TLexer.isDecomposedCharBoundary(curChar)) {
if (Lexer.hasDecompositionNonNullCanClass(curChar)) { if (TLexer.hasDecompositionNonNullCanClass(curChar)) {
/* /*
* A few codepoints have decompositions and non null * A few codepoints have decompositions and non null
@ -119,7 +119,7 @@ class DecomposedCharSet extends JointSet {
* consideration, but general rule is: if canonical class != * consideration, but general rule is: if canonical class !=
* 0 then no decomposition * 0 then no decomposition
*/ */
decCurCodePoint = Lexer.getDecomposition(curChar); decCurCodePoint = TLexer.getDecomposition(curChar);
/* /*
* Length of such decomposition is 1 or 2. See UnicodeData * Length of such decomposition is 1 or 2. See UnicodeData
@ -156,8 +156,8 @@ class DecomposedCharSet extends JointSet {
break; break;
case 3: case 3:
int i1 = Lexer.getCanonicalClass(decCodePoint[1]); int i1 = TLexer.getCanonicalClass(decCodePoint[1]);
int i2 = Lexer.getCanonicalClass(decCodePoint[2]); int i2 = TLexer.getCanonicalClass(decCodePoint[2]);
if ((i2 != 0) && (i1 > i2)) { if ((i2 != 0) && (i1 > i2)) {
i1 = decCodePoint[1]; i1 = decCodePoint[1];
@ -167,7 +167,7 @@ class DecomposedCharSet extends JointSet {
break; break;
default: default:
decCodePoint = Lexer.getCanonicalOrder(decCodePoint, readCodePoints); decCodePoint = TLexer.getCanonicalOrder(decCodePoint, readCodePoints);
} }
/* /*
@ -248,13 +248,13 @@ class DecomposedCharSet extends JointSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
return (set instanceof DecomposedCharSet) ? ((DecomposedCharSet)set).getDecomposedChar().equals( return (set instanceof TDecomposedCharSet) ? ((TDecomposedCharSet)set).getDecomposedChar().equals(
getDecomposedChar()) : true; getDecomposedChar()) : true;
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return true; return true;
} }
} }

View File

@ -26,14 +26,14 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class DotAllQuantifierSet extends QuantifierSet { class TDotAllQuantifierSet extends TQuantifierSet {
public DotAllQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TDotAllQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
@ -44,7 +44,7 @@ class DotAllQuantifierSet extends QuantifierSet {
} }
@Override @Override
public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
if (next.findBack(stringIndex, strLength, testString, matchResult) >= 0) { if (next.findBack(stringIndex, strLength, testString, matchResult) >= 0) {
return stringIndex; return stringIndex;

View File

@ -25,10 +25,10 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class DotAllSet extends JointSet { class TDotAllSet extends TJointSet {
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
if (stringIndex + 1 > strLength) { if (stringIndex + 1 > strLength) {
@ -54,22 +54,22 @@ class DotAllSet extends JointSet {
} }
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@Override @Override
public int getType() { public int getType() {
return AbstractSet.TYPE_DOTSET; return TAbstractSet.TYPE_DOTSET;
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return true; return true;
} }
} }

View File

@ -26,17 +26,17 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class DotQuantifierSet extends QuantifierSet { class TDotQuantifierSet extends TQuantifierSet {
AbstractLineTerminator lt; TAbstractLineTerminator lt;
public DotQuantifierSet(AbstractSet innerSet, AbstractSet next, int type, AbstractLineTerminator lt) { public TDotQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type, TAbstractLineTerminator lt) {
super(innerSet, next, type); super(innerSet, next, type);
this.lt = lt; this.lt = lt;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
@ -54,7 +54,7 @@ class DotQuantifierSet extends QuantifierSet {
} }
@Override @Override
public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
// String testStr = testString.toString(); // String testStr = testString.toString();
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
// 1. skip line terminators ??? // 1. skip line terminators ???

View File

@ -25,17 +25,17 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
final class DotSet extends JointSet { final class TDotSet extends TJointSet {
AbstractLineTerminator lt; TAbstractLineTerminator lt;
public DotSet(AbstractLineTerminator lt) { public TDotSet(TAbstractLineTerminator lt) {
super(); super();
this.lt = lt; this.lt = lt;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
if (stringIndex + 1 > strLength) { if (stringIndex + 1 > strLength) {
@ -62,22 +62,22 @@ final class DotSet extends JointSet {
} }
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@Override @Override
public int getType() { public int getType() {
return AbstractSet.TYPE_DOTSET; return TAbstractSet.TYPE_DOTSET;
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return true; return true;
} }
} }

View File

@ -25,10 +25,10 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class EOISet extends AbstractSet { class TEOISet extends TAbstractSet {
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int rightBound = matchResult.hasTransparentBounds() ? testString.length() : matchResult.getRightBound(); int rightBound = matchResult.hasTransparentBounds() ? testString.length() : matchResult.getRightBound();
if (stringIndex < rightBound) if (stringIndex < rightBound)
return -1; return -1;
@ -43,7 +43,7 @@ class EOISet extends AbstractSet {
* Returns false, enough for quantifiers * Returns false, enough for quantifiers
*/ */
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return false; return false;
} }

View File

@ -25,15 +25,15 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
final class EOLSet extends AbstractSet { final class TEOLSet extends TAbstractSet {
private int consCounter; private int consCounter;
public EOLSet(int counter) { public TEOLSet(int counter) {
this.consCounter = counter; this.consCounter = counter;
} }
@Override @Override
public int matches(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
int rightBound = matchResult.hasAnchoringBounds() ? matchResult.getRightBound() : testString.length(); int rightBound = matchResult.hasAnchoringBounds() ? matchResult.getRightBound() : testString.length();
if (strIndex >= rightBound) { if (strIndex >= rightBound) {
@ -59,7 +59,7 @@ final class EOLSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
int cons; int cons;
boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0);
matchResult.setConsumed(consCounter, -1); matchResult.setConsumed(consCounter, -1);

View File

@ -25,8 +25,8 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class EmptySet extends LeafSet { class TEmptySet extends TLeafSet {
public EmptySet(AbstractSet next) { public TEmptySet(TAbstractSet next) {
super(next); super(next);
charCount = 0; charCount = 0;
} }
@ -37,7 +37,7 @@ class EmptySet extends LeafSet {
} }
@Override @Override
public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
int startStr = matchResult.getLeftBound(); int startStr = matchResult.getLeftBound();
@ -69,7 +69,7 @@ class EmptySet extends LeafSet {
} }
@Override @Override
public int findBack(int stringIndex, int startSearch, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int stringIndex, int startSearch, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
int startStr = matchResult.getLeftBound(); int startStr = matchResult.getLeftBound();
@ -106,7 +106,7 @@ class EmptySet extends LeafSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl mr) { public boolean hasConsumed(TMatchResultImpl mr) {
return false; return false;
} }
} }

View File

@ -25,7 +25,7 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class FSet extends AbstractSet { class TFSet extends TAbstractSet {
static PossessiveFSet posFSet = new PossessiveFSet(); static PossessiveFSet posFSet = new PossessiveFSet();
@ -33,12 +33,12 @@ class FSet extends AbstractSet {
private int groupIndex; private int groupIndex;
public FSet(int groupIndex) { public TFSet(int groupIndex) {
this.groupIndex = groupIndex; this.groupIndex = groupIndex;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int end = matchResult.getEnd(groupIndex); int end = matchResult.getEnd(groupIndex);
matchResult.setEnd(groupIndex, stringIndex); matchResult.setEnd(groupIndex, stringIndex);
int shift = next.matches(stringIndex, testString, matchResult); int shift = next.matches(stringIndex, testString, matchResult);
@ -61,7 +61,7 @@ class FSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl mr) { public boolean hasConsumed(TMatchResultImpl mr) {
return false; return false;
} }
@ -70,10 +70,10 @@ class FSet extends AbstractSet {
* kickbacks(required for atomic groups, for instance) * kickbacks(required for atomic groups, for instance)
* *
*/ */
static class PossessiveFSet extends AbstractSet { static class PossessiveFSet extends TAbstractSet {
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
return stringIndex; return stringIndex;
} }
@ -83,7 +83,7 @@ class FSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl mr) { public boolean hasConsumed(TMatchResultImpl mr) {
return false; return false;
} }
} }

View File

@ -25,14 +25,14 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class FinalSet extends FSet { class TFinalSet extends TFSet {
public FinalSet() { public TFinalSet() {
super(0); super(0);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (matchResult.mode() == TMatcher.MODE_FIND || stringIndex == matchResult.getRightBound()) { if (matchResult.mode() == TMatcher.MODE_FIND || stringIndex == matchResult.getRightBound()) {
matchResult.setValid(); matchResult.setValid();
matchResult.setEnd(0, stringIndex); matchResult.setEnd(0, stringIndex);

View File

@ -26,19 +26,17 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class GroupQuantifierSet extends QuantifierSet { class TGroupQuantifierSet extends TQuantifierSet {
public GroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (!innerSet.hasConsumed(matchResult)) if (!innerSet.hasConsumed(matchResult))
return next.matches(stringIndex, testString, matchResult);// return return next.matches(stringIndex, testString, matchResult);
// -1;
int nextIndex = innerSet.matches(stringIndex, testString, matchResult); int nextIndex = innerSet.matches(stringIndex, testString, matchResult);
if (nextIndex < 0) { if (nextIndex < 0) {
@ -50,6 +48,6 @@ class GroupQuantifierSet extends QuantifierSet {
@Override @Override
protected String getName() { protected String getName() {
return "<GroupQuant>"; //$NON-NLS-1$ return "<GroupQuant>";
} }
} }

View File

@ -21,7 +21,7 @@ package org.teavm.classlib.java.util.regex;
* Represents canonical decomposition of Hangul syllable. Is used when CANON_EQ * Represents canonical decomposition of Hangul syllable. Is used when CANON_EQ
* flag of Pattern class is specified. * flag of Pattern class is specified.
*/ */
class HangulDecomposedCharSet extends JointSet { class THangulDecomposedCharSet extends TJointSet {
/** /**
* Decomposed Hangul syllable. * Decomposed Hangul syllable.
@ -39,7 +39,7 @@ class HangulDecomposedCharSet extends JointSet {
*/ */
private int decomposedCharLength; private int decomposedCharLength;
public HangulDecomposedCharSet(char[] decomposedChar, int decomposedCharLength) { public THangulDecomposedCharSet(char[] decomposedChar, int decomposedCharLength) {
this.decomposedChar = decomposedChar; this.decomposedChar = decomposedChar;
this.decomposedCharLength = decomposedCharLength; this.decomposedCharLength = decomposedCharLength;
} }
@ -48,7 +48,7 @@ class HangulDecomposedCharSet extends JointSet {
* Returns the next. * Returns the next.
*/ */
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@ -59,7 +59,7 @@ class HangulDecomposedCharSet extends JointSet {
* The next to set. * The next to set.
*/ */
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@ -78,7 +78,7 @@ class HangulDecomposedCharSet extends JointSet {
} }
@Override @Override
public int matches(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
/* /*
* All decompositions for Hangul syllables have length that is less or * All decompositions for Hangul syllables have length that is less or
@ -86,7 +86,7 @@ class HangulDecomposedCharSet extends JointSet {
*/ */
int rightBound = matchResult.getRightBound(); int rightBound = matchResult.getRightBound();
int SyllIndex = 0; int SyllIndex = 0;
int[] decompSyllable = new int[Lexer.MAX_HANGUL_DECOMPOSITION_LENGTH]; int[] decompSyllable = new int[TLexer.MAX_HANGUL_DECOMPOSITION_LENGTH];
int[] decompCurSymb; int[] decompCurSymb;
char curSymb; char curSymb;
@ -103,7 +103,7 @@ class HangulDecomposedCharSet extends JointSet {
return -1; return -1;
} }
curSymb = testString.charAt(strIndex++); curSymb = testString.charAt(strIndex++);
decompCurSymb = Lexer.getHangulDecomposition(curSymb); decompCurSymb = TLexer.getHangulDecomposition(curSymb);
if (decompCurSymb == null) { if (decompCurSymb == null) {
@ -112,9 +112,9 @@ class HangulDecomposedCharSet extends JointSet {
* testString. * testString.
*/ */
decompSyllable[SyllIndex++] = curSymb; decompSyllable[SyllIndex++] = curSymb;
LIndex = curSymb - Lexer.LBase; LIndex = curSymb - TLexer.LBase;
if ((LIndex < 0) || (LIndex >= Lexer.LCount)) { if ((LIndex < 0) || (LIndex >= TLexer.LCount)) {
/* /*
* Ordinary letter, that doesn't match this * Ordinary letter, that doesn't match this
@ -124,10 +124,10 @@ class HangulDecomposedCharSet extends JointSet {
if (strIndex < rightBound) { if (strIndex < rightBound) {
curSymb = testString.charAt(strIndex); curSymb = testString.charAt(strIndex);
VIndex = curSymb - Lexer.VBase; VIndex = curSymb - TLexer.VBase;
} }
if ((VIndex < 0) || (VIndex >= Lexer.VCount)) { if ((VIndex < 0) || (VIndex >= TLexer.VCount)) {
/* /*
* Single L jamo doesn't compose Hangul syllable, so doesn't * Single L jamo doesn't compose Hangul syllable, so doesn't
@ -140,10 +140,10 @@ class HangulDecomposedCharSet extends JointSet {
if (strIndex < rightBound) { if (strIndex < rightBound) {
curSymb = testString.charAt(strIndex); curSymb = testString.charAt(strIndex);
TIndex = curSymb - Lexer.TBase; TIndex = curSymb - TLexer.TBase;
} }
if ((TIndex < 0) || (TIndex >= Lexer.TCount)) { if ((TIndex < 0) || (TIndex >= TLexer.TCount)) {
/* /*
* We deal with LV syllable at testString, so compare it to this * We deal with LV syllable at testString, so compare it to this
@ -182,13 +182,13 @@ class HangulDecomposedCharSet extends JointSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
return (set instanceof HangulDecomposedCharSet) ? ((HangulDecomposedCharSet)set).getDecomposedChar().equals( return (set instanceof THangulDecomposedCharSet) ? ((THangulDecomposedCharSet)set).getDecomposedChar().equals(
getDecomposedChar()) : true; getDecomposedChar()) : true;
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return true; return true;
} }
} }

View File

@ -85,7 +85,7 @@ package org.teavm.classlib.java.util.regex;
/** /**
* This class represents high surrogate character. * This class represents high surrogate character.
*/ */
class HighSurrogateCharSet extends JointSet { class THighSurrogateCharSet extends TJointSet {
/* /*
* Note that we can use high and low surrogate characters that don't combine * Note that we can use high and low surrogate characters that don't combine
@ -95,7 +95,7 @@ class HighSurrogateCharSet extends JointSet {
private char high; private char high;
public HighSurrogateCharSet(char high) { public THighSurrogateCharSet(char high) {
this.high = high; this.high = high;
} }
@ -103,7 +103,7 @@ class HighSurrogateCharSet extends JointSet {
* Returns the next. * Returns the next.
*/ */
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@ -114,12 +114,12 @@ class HighSurrogateCharSet extends JointSet {
* The next to set. * The next to set.
*/ */
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
if (stringIndex + 1 > strLength) { if (stringIndex + 1 > strLength) {
@ -149,7 +149,7 @@ class HighSurrogateCharSet extends JointSet {
} }
@Override @Override
public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (testString instanceof String) { if (testString instanceof String) {
String testStr = (String)testString; String testStr = (String)testString;
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
@ -185,7 +185,7 @@ class HighSurrogateCharSet extends JointSet {
} }
@Override @Override
public int findBack(int strIndex, int lastIndex, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int strIndex, int lastIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (testString instanceof String) { if (testString instanceof String) {
String testStr = (String)testString; String testStr = (String)testString;
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
@ -231,26 +231,26 @@ class HighSurrogateCharSet extends JointSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (set instanceof CharSet) { if (set instanceof TCharSet) {
return false; return false;
} else if (set instanceof RangeSet) { } else if (set instanceof TRangeSet) {
return false; return false;
} else if (set instanceof SupplRangeSet) { } else if (set instanceof TSupplRangeSet) {
return false; return false;
} else if (set instanceof SupplCharSet) { } else if (set instanceof TSupplCharSet) {
return false; return false;
} else if (set instanceof LowSurrogateCharSet) { } else if (set instanceof TLowSurrogateCharSet) {
return false; return false;
} else if (set instanceof HighSurrogateCharSet) { } else if (set instanceof THighSurrogateCharSet) {
return ((HighSurrogateCharSet)set).high == this.high; return ((THighSurrogateCharSet)set).high == this.high;
} }
return true; return true;
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return true; return true;
} }
} }

View File

@ -20,14 +20,14 @@ package org.teavm.classlib.java.util.regex;
/** /**
* Hashtable implementation for int arrays. * Hashtable implementation for int arrays.
*/ */
class IntArrHash { class TIntArrHash {
final int[] table; final int[] table;
final Object[] values; final Object[] values;
final int mask; final int mask;
public IntArrHash(int size) { public TIntArrHash(int size) {
int tmpMask = 0; int tmpMask = 0;
while (size >= tmpMask) { while (size >= tmpMask) {
tmpMask = (tmpMask << 1) | 1; tmpMask = (tmpMask << 1) | 1;

View File

@ -20,7 +20,7 @@ package org.teavm.classlib.java.util.regex;
/** /**
* Hashtable implementation for int values. * Hashtable implementation for int values.
*/ */
class IntHash { class TIntHash {
int[] table; int[] table;
int[] values; int[] values;
@ -29,7 +29,7 @@ class IntHash {
int size; // maximum shift int size; // maximum shift
public IntHash(int size) { public TIntHash(int size) {
while (size >= mask) { while (size >= mask) {
mask = (mask << 1) | 1; mask = (mask << 1) | 1;
} }

View File

@ -28,18 +28,18 @@ import java.util.Iterator;
* think about "group" in this model as JointSet opening group and corresponding * think about "group" in this model as JointSet opening group and corresponding
* FSet closing group. * FSet closing group.
*/ */
class JointSet extends AbstractSet { class TJointSet extends TAbstractSet {
protected ArrayList<AbstractSet> children; protected ArrayList<TAbstractSet> children;
protected AbstractSet fSet; protected TAbstractSet fSet;
protected int groupIndex; protected int groupIndex;
protected JointSet() { protected TJointSet() {
} }
public JointSet(ArrayList<AbstractSet> children, FSet fSet) { public TJointSet(ArrayList<TAbstractSet> children, TFSet fSet) {
this.children = children; this.children = children;
this.fSet = fSet; this.fSet = fSet;
this.groupIndex = fSet.getGroupIndex(); this.groupIndex = fSet.getGroupIndex();
@ -49,7 +49,7 @@ class JointSet extends AbstractSet {
* Returns stringIndex+shift, the next position to match * Returns stringIndex+shift, the next position to match
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (children == null) { if (children == null) {
return -1; return -1;
} }
@ -57,7 +57,7 @@ class JointSet extends AbstractSet {
matchResult.setStart(groupIndex, stringIndex); matchResult.setStart(groupIndex, stringIndex);
int size = children.size(); int size = children.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
AbstractSet e = children.get(i); TAbstractSet e = children.get(i);
int shift = e.matches(stringIndex, testString, matchResult); int shift = e.matches(stringIndex, testString, matchResult);
if (shift >= 0) { if (shift >= 0) {
return shift; return shift;
@ -68,12 +68,12 @@ class JointSet extends AbstractSet {
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
fSet.setNext(next); fSet.setNext(next);
} }
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return fSet.getNext(); return fSet.getNext();
} }
@ -87,9 +87,9 @@ class JointSet extends AbstractSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (children != null) { if (children != null) {
for (Iterator<AbstractSet> i = children.iterator(); i.hasNext();) { for (Iterator<TAbstractSet> i = children.iterator(); i.hasNext();) {
if ((i.next()).first(set)) { if ((i.next()).first(set)) {
return true; return true;
} }
@ -100,7 +100,7 @@ class JointSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return !(matchResult.getEnd(groupIndex) >= 0 && matchResult.getStart(groupIndex) == matchResult return !(matchResult.getEnd(groupIndex) >= 0 && matchResult.getStart(groupIndex) == matchResult
.getEnd(groupIndex)); .getEnd(groupIndex));
} }
@ -121,8 +121,8 @@ class JointSet extends AbstractSet {
int childrenSize = children.size(); int childrenSize = children.size();
for (int i = 0; i < childrenSize; i++) { for (int i = 0; i < childrenSize; i++) {
AbstractSet child = children.get(i); TAbstractSet child = children.get(i);
JointSet set = child.processBackRefReplacement(); TJointSet set = child.processBackRefReplacement();
if (set != null) { if (set != null) {
child.isSecondPassVisited = true; child.isSecondPassVisited = true;

View File

@ -23,17 +23,17 @@ package org.teavm.classlib.java.util.regex;
/** /**
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class LeafQuantifierSet extends QuantifierSet { class TLeafQuantifierSet extends TQuantifierSet {
protected LeafSet leaf; protected TLeafSet leaf;
public LeafQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { public TLeafQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
this.leaf = innerSet; this.leaf = innerSet;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int i = 0; int i = 0;
int shift = 0; int shift = 0;
@ -66,10 +66,10 @@ class LeafQuantifierSet extends QuantifierSet {
* The innerSet to set. * The innerSet to set.
*/ */
@Override @Override
public void setInnerSet(AbstractSet innerSet) { public void setInnerSet(TAbstractSet innerSet) {
if (!(innerSet instanceof LeafSet)) if (!(innerSet instanceof TLeafSet))
throw new RuntimeException(""); throw new RuntimeException("");
super.setInnerSet(innerSet); super.setInnerSet(innerSet);
this.leaf = (LeafSet)innerSet; this.leaf = (TLeafSet)innerSet;
} }
} }

View File

@ -26,16 +26,16 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
abstract class LeafSet extends AbstractSet { abstract class TLeafSet extends TAbstractSet {
protected int charCount = 1; protected int charCount = 1;
public LeafSet(AbstractSet next) { public TLeafSet(TAbstractSet next) {
super(next); super(next);
setType(AbstractSet.TYPE_LEAF); setType(TAbstractSet.TYPE_LEAF);
} }
public LeafSet() { public TLeafSet() {
} }
/** /**
@ -49,7 +49,7 @@ abstract class LeafSet extends AbstractSet {
* Return positive value if match succeeds, negative otherwise. * Return positive value if match succeeds, negative otherwise.
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (stringIndex + charCount() > matchResult.getRightBound()) { if (stringIndex + charCount() > matchResult.getRightBound()) {
matchResult.hitEnd = true; matchResult.hitEnd = true;
@ -74,7 +74,7 @@ abstract class LeafSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl mr) { public boolean hasConsumed(TMatchResultImpl mr) {
return true; return true;
} }
} }

View File

@ -27,7 +27,7 @@ import java.util.MissingResourceException;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class Lexer { class TLexer {
public static final int CHAR_DOLLAR = 0xe0000000 | '$'; public static final int CHAR_DOLLAR = 0xe0000000 | '$';
@ -145,10 +145,10 @@ class Lexer {
static final int NCount = 588; static final int NCount = 588;
// table that contains canonical decomposition mappings // table that contains canonical decomposition mappings
private static IntArrHash decompTable = null; private static TIntArrHash decompTable = null;
// table that contains canonical combining classes // table that contains canonical combining classes
private static IntHash canonClassesTable = null; private static TIntHash canonClassesTable = null;
private static int canonClassesTableSize; private static int canonClassesTableSize;
@ -156,7 +156,7 @@ class Lexer {
* Table that contains information about Unicode codepoints with single * Table that contains information about Unicode codepoints with single
* codepoint decomposition * codepoint decomposition
*/ */
private static IntHash singleDecompTable = null; private static TIntHash singleDecompTable = null;
private static int singleDecompTableSize; private static int singleDecompTableSize;
@ -182,10 +182,10 @@ class Lexer {
private int patternFullLength = 0; private int patternFullLength = 0;
// cur special token // cur special token
private SpecialToken curST = null; private TSpecialToken curST = null;
// next special token // next special token
private SpecialToken lookAheadST = null; private TSpecialToken lookAheadST = null;
// cur char being processed // cur char being processed
private int index = 0; private int index = 0;
@ -202,12 +202,12 @@ class Lexer {
// original string representing pattern // original string representing pattern
private String orig = null; private String orig = null;
public Lexer(String pattern, int flags) { public TLexer(String pattern, int flags) {
orig = pattern; orig = pattern;
if ((flags & TPattern.LITERAL) > 0) { if ((flags & TPattern.LITERAL) > 0) {
pattern = TPattern.quote(pattern); pattern = TPattern.quote(pattern);
} else if ((flags & TPattern.CANON_EQ) > 0) { } else if ((flags & TPattern.CANON_EQ) > 0) {
pattern = Lexer.normalize(pattern); pattern = TLexer.normalize(pattern);
} }
this.pattern = new char[pattern.length() + 2]; this.pattern = new char[pattern.length() + 2];
@ -244,7 +244,7 @@ class Lexer {
this.mode = mode; this.mode = mode;
} }
if (mode == Lexer.MODE_PATTERN) { if (mode == TLexer.MODE_PATTERN) {
reread(); reread();
} }
} }
@ -265,7 +265,7 @@ class Lexer {
movePointer(); movePointer();
} }
public SpecialToken peekSpecial() { public TSpecialToken peekSpecial() {
return curST; return curST;
} }
@ -280,7 +280,7 @@ class Lexer {
} }
public boolean isQuantifier() { public boolean isQuantifier() {
return isSpecial() && curST.getType() == SpecialToken.TOK_QUANTIFIER; return isSpecial() && curST.getType() == TSpecialToken.TOK_QUANTIFIER;
} }
public boolean isNextSpecial() { public boolean isNextSpecial() {
@ -299,8 +299,8 @@ class Lexer {
/** /**
* Returns current special token and moves string index to the next one; * Returns current special token and moves string index to the next one;
*/ */
public SpecialToken nextSpecial() { public TSpecialToken nextSpecial() {
SpecialToken res = curST; TSpecialToken res = curST;
movePointer(); movePointer();
return res; return res;
} }
@ -409,7 +409,7 @@ class Lexer {
lookAhead = (index < pattern.length) ? nextCodePoint() : 0; lookAhead = (index < pattern.length) ? nextCodePoint() : 0;
lookAheadST = null; lookAheadST = null;
if (mode == Lexer.MODE_ESCAPE) { if (mode == TLexer.MODE_ESCAPE) {
if (lookAhead == '\\') { if (lookAhead == '\\') {
// need not care about supplementary codepoints here // need not care about supplementary codepoints here
@ -448,7 +448,7 @@ class Lexer {
if (lookAhead == 'P') if (lookAhead == 'P')
negative = true; negative = true;
try { try {
lookAheadST = AbstractCharClass.getPredefinedClass(cs, negative); lookAheadST = TAbstractCharClass.getPredefinedClass(cs, negative);
} catch (MissingResourceException mre) { } catch (MissingResourceException mre) {
throw new TPatternSyntaxException("", this.toString(), index); throw new TPatternSyntaxException("", this.toString(), index);
} }
@ -462,14 +462,14 @@ class Lexer {
case 'W': case 'W':
case 'S': case 'S':
case 'D': { case 'D': {
lookAheadST = CharClass.getPredefinedClass(new String(pattern, prevNW, 1), false); lookAheadST = TCharClass.getPredefinedClass(new String(pattern, prevNW, 1), false);
lookAhead = 0; lookAhead = 0;
break; break;
} }
case 'Q': { case 'Q': {
saved_mode = mode; saved_mode = mode;
mode = Lexer.MODE_ESCAPE; mode = TLexer.MODE_ESCAPE;
reread = true; reread = true;
break; break;
} }
@ -502,7 +502,7 @@ class Lexer {
case '7': case '7':
case '8': case '8':
case '9': { case '9': {
if (mode == Lexer.MODE_PATTERN) { if (mode == TLexer.MODE_PATTERN) {
lookAhead = 0x80000000 | lookAhead; lookAhead = 0x80000000 | lookAhead;
} }
break; break;
@ -578,7 +578,7 @@ class Lexer {
default: default:
break; break;
} }
} else if (mode == Lexer.MODE_PATTERN) { } else if (mode == TLexer.MODE_PATTERN) {
switch (lookAhead) { switch (lookAhead) {
case '+': case '+':
case '*': case '*':
@ -586,17 +586,17 @@ class Lexer {
char mod = (index < pattern.length) ? pattern[index] : '*'; char mod = (index < pattern.length) ? pattern[index] : '*';
switch (mod) { switch (mod) {
case '+': { case '+': {
lookAhead = lookAhead | Lexer.QMOD_POSSESSIVE; lookAhead = lookAhead | TLexer.QMOD_POSSESSIVE;
nextIndex(); nextIndex();
break; break;
} }
case '?': { case '?': {
lookAhead = lookAhead | Lexer.QMOD_RELUCTANT; lookAhead = lookAhead | TLexer.QMOD_RELUCTANT;
nextIndex(); nextIndex();
break; break;
} }
default: { default: {
lookAhead = lookAhead | Lexer.QMOD_GREEDY; lookAhead = lookAhead | TLexer.QMOD_GREEDY;
break; break;
} }
} }
@ -688,11 +688,11 @@ class Lexer {
break; break;
case '[': { case '[': {
lookAhead = CHAR_LEFT_SQUARE_BRACKET; lookAhead = CHAR_LEFT_SQUARE_BRACKET;
setMode(Lexer.MODE_RANGE); setMode(TLexer.MODE_RANGE);
break; break;
} }
case ']': { case ']': {
if (mode == Lexer.MODE_RANGE) { if (mode == TLexer.MODE_RANGE) {
lookAhead = CHAR_RIGHT_SQUARE_BRACKET; lookAhead = CHAR_RIGHT_SQUARE_BRACKET;
} }
break; break;
@ -709,7 +709,7 @@ class Lexer {
default: default:
break; break;
} }
} else if (mode == Lexer.MODE_RANGE) { } else if (mode == TLexer.MODE_RANGE) {
switch (lookAhead) { switch (lookAhead) {
case '[': case '[':
lookAhead = CHAR_LEFT_SQUARE_BRACKET; lookAhead = CHAR_LEFT_SQUARE_BRACKET;
@ -765,7 +765,7 @@ class Lexer {
/** /**
* Process given character in assumption that it's quantifier. * Process given character in assumption that it's quantifier.
*/ */
private Quantifier processQuantifier(int ch) { private TQuantifier processQuantifier(int ch) {
StringBuilder sb = new StringBuilder(4); StringBuilder sb = new StringBuilder(4);
int min = -1; int min = -1;
int max = Integer.MAX_VALUE; int max = Integer.MAX_VALUE;
@ -803,18 +803,18 @@ class Lexer {
switch (mod) { switch (mod) {
case '+': case '+':
lookAhead = Lexer.QUANT_COMP_P; lookAhead = TLexer.QUANT_COMP_P;
nextIndex(); nextIndex();
break; break;
case '?': case '?':
lookAhead = Lexer.QUANT_COMP_R; lookAhead = TLexer.QUANT_COMP_R;
nextIndex(); nextIndex();
break; break;
default: default:
lookAhead = Lexer.QUANT_COMP; lookAhead = TLexer.QUANT_COMP;
break; break;
} }
return new Quantifier(min, max); return new TQuantifier(min, max);
} }
@Override @Override

View File

@ -85,19 +85,19 @@ package org.teavm.classlib.java.util.regex;
/* /*
* This class is a range that contains only surrogate characters. * This class is a range that contains only surrogate characters.
*/ */
class LowHighSurrogateRangeSet extends JointSet { class TLowHighSurrogateRangeSet extends TJointSet {
protected AbstractCharClass surrChars; protected TAbstractCharClass surrChars;
protected boolean alt = false; protected boolean alt = false;
public LowHighSurrogateRangeSet(AbstractCharClass surrChars, AbstractSet next) { public TLowHighSurrogateRangeSet(TAbstractCharClass surrChars, TAbstractSet next) {
this.surrChars = surrChars.getInstance(); this.surrChars = surrChars.getInstance();
this.alt = surrChars.alt; this.alt = surrChars.alt;
setNext(next); setNext(next);
} }
public LowHighSurrogateRangeSet(AbstractCharClass surrChars) { public TLowHighSurrogateRangeSet(TAbstractCharClass surrChars) {
this.surrChars = surrChars.getInstance(); this.surrChars = surrChars.getInstance();
this.alt = surrChars.alt; this.alt = surrChars.alt;
} }
@ -106,7 +106,7 @@ class LowHighSurrogateRangeSet extends JointSet {
* Returns the next. * Returns the next.
*/ */
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@ -117,7 +117,7 @@ class LowHighSurrogateRangeSet extends JointSet {
* The next to set. * The next to set.
*/ */
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@ -125,7 +125,7 @@ class LowHighSurrogateRangeSet extends JointSet {
* Returns stringIndex+shift, the next position to match * Returns stringIndex+shift, the next position to match
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int startStr = matchResult.getLeftBound(); int startStr = matchResult.getLeftBound();
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
@ -169,26 +169,26 @@ class LowHighSurrogateRangeSet extends JointSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (set instanceof CharSet) { if (set instanceof TCharSet) {
return false; return false;
} else if (set instanceof RangeSet) { } else if (set instanceof TRangeSet) {
return false; return false;
} else if (set instanceof SupplRangeSet) { } else if (set instanceof TSupplRangeSet) {
return false; return false;
} else if (set instanceof SupplCharSet) { } else if (set instanceof TSupplCharSet) {
return false; return false;
} }
return true; return true;
} }
protected AbstractCharClass getChars() { protected TAbstractCharClass getChars() {
return surrChars; return surrChars;
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return true; return true;
} }
} }

View File

@ -85,7 +85,7 @@ package org.teavm.classlib.java.util.regex;
/** /**
* This class represents low surrogate character. * This class represents low surrogate character.
*/ */
class LowSurrogateCharSet extends JointSet { class TLowSurrogateCharSet extends TJointSet {
/* /*
* Note that we can use high and low surrogate characters that don't combine * Note that we can use high and low surrogate characters that don't combine
@ -94,7 +94,7 @@ class LowSurrogateCharSet extends JointSet {
*/ */
private char low; private char low;
public LowSurrogateCharSet(char low) { public TLowSurrogateCharSet(char low) {
this.low = low; this.low = low;
} }
@ -102,7 +102,7 @@ class LowSurrogateCharSet extends JointSet {
* Returns the next. * Returns the next.
*/ */
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return this.next; return this.next;
} }
@ -113,12 +113,12 @@ class LowSurrogateCharSet extends JointSet {
* The next to set. * The next to set.
*/ */
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (stringIndex + 1 > matchResult.getRightBound()) { if (stringIndex + 1 > matchResult.getRightBound()) {
matchResult.hitEnd = true; matchResult.hitEnd = true;
@ -147,7 +147,7 @@ class LowSurrogateCharSet extends JointSet {
} }
@Override @Override
public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (testString instanceof String) { if (testString instanceof String) {
String testStr = (String)testString; String testStr = (String)testString;
int startStr = matchResult.getLeftBound(); int startStr = matchResult.getLeftBound();
@ -184,7 +184,7 @@ class LowSurrogateCharSet extends JointSet {
} }
@Override @Override
public int findBack(int strIndex, int lastIndex, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int strIndex, int lastIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (testString instanceof String) { if (testString instanceof String) {
int startStr = matchResult.getLeftBound(); int startStr = matchResult.getLeftBound();
String testStr = (String)testString; String testStr = (String)testString;
@ -230,26 +230,26 @@ class LowSurrogateCharSet extends JointSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (set instanceof CharSet) { if (set instanceof TCharSet) {
return false; return false;
} else if (set instanceof RangeSet) { } else if (set instanceof TRangeSet) {
return false; return false;
} else if (set instanceof SupplRangeSet) { } else if (set instanceof TSupplRangeSet) {
return false; return false;
} else if (set instanceof SupplCharSet) { } else if (set instanceof TSupplCharSet) {
return false; return false;
} else if (set instanceof HighSurrogateCharSet) { } else if (set instanceof THighSurrogateCharSet) {
return false; return false;
} else if (set instanceof LowSurrogateCharSet) { } else if (set instanceof TLowSurrogateCharSet) {
return ((LowSurrogateCharSet)set).low == this.low; return ((TLowSurrogateCharSet)set).low == this.low;
} }
return true; return true;
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return true; return true;
} }
} }

View File

@ -28,7 +28,7 @@ import java.util.Arrays;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class MatchResultImpl implements TMatchResult { class TMatchResultImpl implements TMatchResult {
private int[] groupBounds = null; private int[] groupBounds = null;
@ -60,7 +60,7 @@ class MatchResultImpl implements TMatchResult {
private int mode; private int mode;
MatchResultImpl(CharSequence string, int leftBound, int rightBound, int groupCount, int compQuantCount, TMatchResultImpl(CharSequence string, int leftBound, int rightBound, int groupCount, int compQuantCount,
int consumersCount) { int consumersCount) {
this.groupCount = ++groupCount; this.groupCount = ++groupCount;
this.groupBounds = new int[groupCount * 2]; this.groupBounds = new int[groupCount * 2];
@ -75,7 +75,7 @@ class MatchResultImpl implements TMatchResult {
} }
TMatchResult cloneImpl() { TMatchResult cloneImpl() {
MatchResultImpl res = new MatchResultImpl(this.string, this.leftBound, this.rightBound, this.groupCount - 1, 0, TMatchResultImpl res = new TMatchResultImpl(this.string, this.leftBound, this.rightBound, this.groupCount - 1, 0,
0); 0);
res.valid = valid; res.valid = valid;

View File

@ -54,11 +54,11 @@ public final class TMatcher implements TMatchResult {
private TPattern pat = null; private TPattern pat = null;
private AbstractSet start = null; private TAbstractSet start = null;
private CharSequence string = null; private CharSequence string = null;
private MatchResultImpl matchResult = null; private TMatchResultImpl matchResult = null;
// bounds // bounds
private int leftBound = -1; private int leftBound = -1;
@ -480,7 +480,7 @@ public final class TMatcher implements TMatchResult {
* sequence starting at <code>index</code> specified; Result of the match * sequence starting at <code>index</code> specified; Result of the match
* will be stored into matchResult instance; * will be stored into matchResult instance;
*/ */
private boolean runMatch(AbstractSet set, int index, MatchResultImpl matchResult) { private boolean runMatch(TAbstractSet set, int index, TMatchResultImpl matchResult) {
if (set.matches(index, string, matchResult) >= 0) { if (set.matches(index, string, matchResult) >= 0) {
matchResult.finalizeMatch(); matchResult.finalizeMatch();
@ -670,7 +670,7 @@ public final class TMatcher implements TMatchResult {
int mode = matchResult.mode(); int mode = matchResult.mode();
this.pat = pattern; this.pat = pattern;
this.start = pattern.start; this.start = pattern.start;
matchResult = new MatchResultImpl(this.string, leftBound, rightBound, pattern.groupCount(), matchResult = new TMatchResultImpl(this.string, leftBound, rightBound, pattern.groupCount(),
pattern.compCount(), pattern.consCount()); pattern.compCount(), pattern.consCount());
matchResult.setStartIndex(startIndex); matchResult.setStartIndex(startIndex);
matchResult.setMode(mode); matchResult.setMode(mode);
@ -683,7 +683,7 @@ public final class TMatcher implements TMatchResult {
this.string = cs; this.string = cs;
this.leftBound = 0; this.leftBound = 0;
this.rightBound = string.length(); this.rightBound = string.length();
matchResult = new MatchResultImpl(cs, leftBound, rightBound, pat.groupCount(), pat.compCount(), pat.consCount()); matchResult = new TMatchResultImpl(cs, leftBound, rightBound, pat.groupCount(), pat.compCount(), pat.consCount());
} }
@Override @Override

View File

@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class MultiLineEOLSet extends AbstractSet { class TMultiLineEOLSet extends TAbstractSet {
private int consCounter; private int consCounter;
public MultiLineEOLSet(int counter) { public TMultiLineEOLSet(int counter) {
this.consCounter = counter; this.consCounter = counter;
} }
@Override @Override
public int matches(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strDif = matchResult.hasAnchoringBounds() ? matchResult.getLeftBound() - strIndex : testString.length() - int strDif = matchResult.hasAnchoringBounds() ? matchResult.getLeftBound() - strIndex : testString.length() -
strIndex; strIndex;
char ch1; char ch1;
@ -74,7 +74,7 @@ class MultiLineEOLSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
int cons; int cons;
boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0);
matchResult.setConsumed(consCounter, -1); matchResult.setConsumed(consCounter, -1);

View File

@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class MultiLineSOLSet extends AbstractSet { class TMultiLineSOLSet extends TAbstractSet {
private AbstractLineTerminator lt; private TAbstractLineTerminator lt;
public MultiLineSOLSet(AbstractLineTerminator lt) { public TMultiLineSOLSet(TAbstractLineTerminator lt) {
this.lt = lt; this.lt = lt;
} }
@Override @Override
public int matches(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (strIndex != matchResult.getRightBound() && if (strIndex != matchResult.getRightBound() &&
((strIndex == 0 || (matchResult.hasAnchoringBounds() && strIndex == matchResult.getLeftBound())) || lt ((strIndex == 0 || (matchResult.hasAnchoringBounds() && strIndex == matchResult.getLeftBound())) || lt
.isAfterLineTerminator(testString.charAt(strIndex - 1), testString.charAt(strIndex)))) { .isAfterLineTerminator(testString.charAt(strIndex - 1), testString.charAt(strIndex)))) {
@ -44,7 +44,7 @@ class MultiLineSOLSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return false; return false;
} }

View File

@ -27,9 +27,9 @@ import java.util.ArrayList;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class NegativeLookAhead extends AtomicJointSet { class TNegativeLookAhead extends TAtomicJointSet {
public NegativeLookAhead(ArrayList<AbstractSet> children, FSet fSet) { public TNegativeLookAhead(ArrayList<TAbstractSet> children, TFSet fSet) {
super(children, fSet); super(children, fSet);
} }
@ -37,11 +37,11 @@ class NegativeLookAhead extends AtomicJointSet {
* Returns stringIndex+shift, the next position to match * Returns stringIndex+shift, the next position to match
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int size = children.size(); int size = children.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
AbstractSet e = children.get(i); TAbstractSet e = children.get(i);
if (e.matches(stringIndex, testString, matchResult) >= 0) if (e.matches(stringIndex, testString, matchResult) >= 0)
return -1; return -1;
} }
@ -50,7 +50,7 @@ class NegativeLookAhead extends AtomicJointSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return false; return false;
} }

View File

@ -27,9 +27,9 @@ import java.util.ArrayList;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class NegativeLookBehind extends AtomicJointSet { class TNegativeLookBehind extends TAtomicJointSet {
public NegativeLookBehind(ArrayList<AbstractSet> children, FSet fSet) { public TNegativeLookBehind(ArrayList<TAbstractSet> children, TFSet fSet) {
super(children, fSet); super(children, fSet);
} }
@ -38,7 +38,7 @@ class NegativeLookBehind extends AtomicJointSet {
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, public int matches(int stringIndex, CharSequence testString,
MatchResultImpl matchResult) { TMatchResultImpl matchResult) {
int size = children.size(); int size = children.size();
int shift; int shift;
@ -48,7 +48,7 @@ class NegativeLookBehind extends AtomicJointSet {
matchResult.setConsumed(groupIndex, stringIndex); matchResult.setConsumed(groupIndex, stringIndex);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
AbstractSet e = children.get(i); TAbstractSet e = children.get(i);
// find limits could be calculated though e.getCharCount() // find limits could be calculated though e.getCharCount()
// fSet will return true only if string index at fSet equal // fSet will return true only if string index at fSet equal
// to stringIndex // to stringIndex
@ -62,7 +62,7 @@ class NegativeLookBehind extends AtomicJointSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return false; return false;
} }

View File

@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class NonCapFSet extends FSet { class TNonCapFSet extends TFSet {
public NonCapFSet(int groupIndex) { public TNonCapFSet(int groupIndex) {
super(groupIndex); super(groupIndex);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int gr = getGroupIndex(); int gr = getGroupIndex();
matchResult.setConsumed(gr, stringIndex - matchResult.getConsumed(gr)); matchResult.setConsumed(gr, stringIndex - matchResult.getConsumed(gr));
@ -44,7 +44,7 @@ class NonCapFSet extends FSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl mr) { public boolean hasConsumed(TMatchResultImpl mr) {
return false; return false;
} }
} }

View File

@ -26,12 +26,12 @@ import java.util.ArrayList;
* Node representing non-capturing group * Node representing non-capturing group
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class NonCapJointSet extends JointSet { class TNonCapJointSet extends TJointSet {
protected NonCapJointSet() { protected TNonCapJointSet() {
} }
public NonCapJointSet(ArrayList<AbstractSet> children, FSet fSet) { public TNonCapJointSet(ArrayList<TAbstractSet> children, TFSet fSet) {
super(children, fSet); super(children, fSet);
} }
@ -40,13 +40,13 @@ class NonCapJointSet extends JointSet {
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, public int matches(int stringIndex, CharSequence testString,
MatchResultImpl matchResult) { TMatchResultImpl matchResult) {
int start = matchResult.getConsumed(groupIndex); int start = matchResult.getConsumed(groupIndex);
matchResult.setConsumed(groupIndex, stringIndex); matchResult.setConsumed(groupIndex, stringIndex);
int size = children.size(); int size = children.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
AbstractSet e = children.get(i); TAbstractSet e = children.get(i);
int shift = e.matches(stringIndex, testString, matchResult); int shift = e.matches(stringIndex, testString, matchResult);
if (shift >= 0) { if (shift >= 0) {
return shift; return shift;
@ -62,7 +62,7 @@ class NonCapJointSet extends JointSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
int cons = matchResult.getConsumed(groupIndex); int cons = matchResult.getConsumed(groupIndex);
return cons != 0; return cons != 0;
} }

View File

@ -26,15 +26,15 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PosAltGroupQuantifierSet extends AltGroupQuantifierSet { class TPosAltGroupQuantifierSet extends TAltGroupQuantifierSet {
public PosAltGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TPosAltGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
((JointSet)innerSet).setNext(FSet.posFSet); ((TJointSet)innerSet).setNext(TFSet.posFSet);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int nextIndex = innerSet.matches(stringIndex, testString, matchResult); int nextIndex = innerSet.matches(stringIndex, testString, matchResult);
if (nextIndex > 0) { if (nextIndex > 0) {
stringIndex = nextIndex; stringIndex = nextIndex;
@ -43,7 +43,7 @@ class PosAltGroupQuantifierSet extends AltGroupQuantifierSet {
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
} }

View File

@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PosCompositeGroupQuantifierSet extends CompositeGroupQuantifierSet { class TPosCompositeGroupQuantifierSet extends TCompositeGroupQuantifierSet {
public PosCompositeGroupQuantifierSet(Quantifier quant, AbstractSet innerSet, AbstractSet next, int type, public TPosCompositeGroupQuantifierSet(TQuantifier quant, TAbstractSet innerSet, TAbstractSet next, int type,
int setCounter) { int setCounter) {
super(quant, innerSet, next, type, setCounter); super(quant, innerSet, next, type, setCounter);
innerSet.setNext(FSet.posFSet); innerSet.setNext(TFSet.posFSet);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int nextIndex; int nextIndex;
int counter = 0; int counter = 0;
int max = quantifier.max(); int max = quantifier.max();

View File

@ -25,15 +25,15 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PosPlusGroupQuantifierSet extends GroupQuantifierSet { class TPosPlusGroupQuantifierSet extends TGroupQuantifierSet {
public PosPlusGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TPosPlusGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
((JointSet)innerSet).setNext(FSet.posFSet); ((TJointSet)innerSet).setNext(TFSet.posFSet);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int nextIndex; int nextIndex;
if ((nextIndex = innerSet.matches(stringIndex, testString, matchResult)) < 0) { if ((nextIndex = innerSet.matches(stringIndex, testString, matchResult)) < 0) {
return -1; return -1;

View File

@ -27,8 +27,8 @@ import java.util.ArrayList;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PositiveLookAhead extends AtomicJointSet { class TPositiveLookAhead extends TAtomicJointSet {
public PositiveLookAhead(ArrayList<AbstractSet> children, FSet fSet) { public TPositiveLookAhead(ArrayList<TAbstractSet> children, TFSet fSet) {
super(children, fSet); super(children, fSet);
} }
@ -36,10 +36,10 @@ class PositiveLookAhead extends AtomicJointSet {
* Returns stringIndex+shift, the next position to match * Returns stringIndex+shift, the next position to match
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int size = children.size(); int size = children.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
AbstractSet e = children.get(i); TAbstractSet e = children.get(i);
int shift = e.matches(stringIndex, testString, matchResult); int shift = e.matches(stringIndex, testString, matchResult);
if (shift >= 0) { if (shift >= 0) {
// PosLookaheadFset always returns true, position remains the // PosLookaheadFset always returns true, position remains the
@ -53,7 +53,7 @@ class PositiveLookAhead extends AtomicJointSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return false; return false;
} }

View File

@ -27,9 +27,9 @@ import java.util.ArrayList;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PositiveLookBehind extends AtomicJointSet { class TPositiveLookBehind extends TAtomicJointSet {
public PositiveLookBehind(ArrayList<AbstractSet> children, FSet fSet) { public TPositiveLookBehind(ArrayList<TAbstractSet> children, TFSet fSet) {
super(children, fSet); super(children, fSet);
} }
@ -37,7 +37,7 @@ class PositiveLookBehind extends AtomicJointSet {
* Returns stringIndex+shift, the next position to match * Returns stringIndex+shift, the next position to match
*/ */
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int size = children.size(); int size = children.size();
int leftBound = matchResult.hasTransparentBounds() ? 0 : matchResult.getLeftBound(); int leftBound = matchResult.hasTransparentBounds() ? 0 : matchResult.getLeftBound();
@ -48,7 +48,7 @@ class PositiveLookBehind extends AtomicJointSet {
// and return true if the current index equal to this one // and return true if the current index equal to this one
matchResult.setConsumed(groupIndex, stringIndex); matchResult.setConsumed(groupIndex, stringIndex);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
AbstractSet e = children.get(i); TAbstractSet e = children.get(i);
// find limits could be calculated though e.getCharCount() // find limits could be calculated though e.getCharCount()
// fSet will return true only if string index at fSet equal // fSet will return true only if string index at fSet equal
// to stringIndex // to stringIndex
@ -63,7 +63,7 @@ class PositiveLookBehind extends AtomicJointSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return false; return false;
} }

View File

@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PossessiveAltQuantifierSet extends AltQuantifierSet { class TPossessiveAltQuantifierSet extends TAltQuantifierSet {
public PossessiveAltQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { public TPossessiveAltQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int shift = 0; int shift = 0;
if (stringIndex + leaf.charCount() <= matchResult.getRightBound() && if (stringIndex + leaf.charCount() <= matchResult.getRightBound() &&

View File

@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PossessiveCompositeQuantifierSet extends CompositeQuantifierSet { class TPossessiveCompositeQuantifierSet extends TCompositeQuantifierSet {
public PossessiveCompositeQuantifierSet(Quantifier quant, LeafSet innerSet, AbstractSet next, int type) { public TPossessiveCompositeQuantifierSet(TQuantifier quant, TLeafSet innerSet, TAbstractSet next, int type) {
super(quant, innerSet, next, type); super(quant, innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int min = quantifier.min(); int min = quantifier.min();
int max = quantifier.max(); int max = quantifier.max();
int i = 0; int i = 0;

View File

@ -25,15 +25,15 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PossessiveGroupQuantifierSet extends GroupQuantifierSet { class TPossessiveGroupQuantifierSet extends TGroupQuantifierSet {
public PossessiveGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TPossessiveGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
innerSet.setNext(FSet.posFSet); innerSet.setNext(TFSet.posFSet);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int nextIndex; int nextIndex;
while ((nextIndex = innerSet.matches(stringIndex, testString, matchResult)) > 0) { while ((nextIndex = innerSet.matches(stringIndex, testString, matchResult)) > 0) {
stringIndex = nextIndex; stringIndex = nextIndex;

View File

@ -25,14 +25,14 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PossessiveQuantifierSet extends LeafQuantifierSet { class TPossessiveQuantifierSet extends TLeafQuantifierSet {
public PossessiveQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { public TPossessiveQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int shift = 0; int shift = 0;
while (stringIndex + leaf.charCount() <= matchResult.getRightBound() && while (stringIndex + leaf.charCount() <= matchResult.getRightBound() &&
(shift = leaf.accepts(stringIndex, testString)) >= 1) { (shift = leaf.accepts(stringIndex, testString)) >= 1) {

View File

@ -25,10 +25,10 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class PreviousMatch extends AbstractSet { class TPreviousMatch extends TAbstractSet {
@Override @Override
public int matches(int stringIndex, CharSequence testString, public int matches(int stringIndex, CharSequence testString,
MatchResultImpl matchResult) { TMatchResultImpl matchResult) {
if (stringIndex == matchResult.getPreviousMatchEnd()) { if (stringIndex == matchResult.getPreviousMatchEnd()) {
return next.matches(stringIndex, testString, matchResult); return next.matches(stringIndex, testString, matchResult);
} }
@ -36,7 +36,7 @@ class PreviousMatch extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return false; return false;
} }

View File

@ -27,7 +27,7 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class Quantifier extends SpecialToken implements Cloneable { class TQuantifier extends TSpecialToken implements Cloneable {
private int min; private int min;
@ -35,11 +35,11 @@ class Quantifier extends SpecialToken implements Cloneable {
private int counter = 0; private int counter = 0;
public Quantifier(int min) { public TQuantifier(int min) {
this.min = this.max = min; this.min = this.max = min;
} }
public Quantifier(int min, int max) { public TQuantifier(int min, int max) {
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
@ -71,11 +71,11 @@ class Quantifier extends SpecialToken implements Cloneable {
@Override @Override
public int getType() { public int getType() {
return SpecialToken.TOK_QUANTIFIER; return TSpecialToken.TOK_QUANTIFIER;
} }
@Override @Override
public Object clone() { public Object clone() {
return new Quantifier(min, max); return new TQuantifier(min, max);
} }
} }

View File

@ -25,11 +25,11 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
abstract class QuantifierSet extends AbstractSet { abstract class TQuantifierSet extends TAbstractSet {
protected AbstractSet innerSet; protected TAbstractSet innerSet;
public QuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(next); super(next);
this.innerSet = innerSet; this.innerSet = innerSet;
setType(type); setType(type);
@ -38,7 +38,7 @@ abstract class QuantifierSet extends AbstractSet {
/** /**
* Returns the innerSet. * Returns the innerSet.
*/ */
public AbstractSet getInnerSet() { public TAbstractSet getInnerSet() {
return innerSet; return innerSet;
} }
@ -48,17 +48,17 @@ abstract class QuantifierSet extends AbstractSet {
* @param innerSet * @param innerSet
* The innerSet to set. * The innerSet to set.
*/ */
public void setInnerSet(AbstractSet innerSet) { public void setInnerSet(TAbstractSet innerSet) {
this.innerSet = innerSet; this.innerSet = innerSet;
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
return innerSet.first(set) || next.first(set); return innerSet.first(set) || next.first(set);
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl mr) { public boolean hasConsumed(TMatchResultImpl mr) {
return true; return true;
} }
@ -77,7 +77,7 @@ abstract class QuantifierSet extends AbstractSet {
/* /*
* Add here code to do during the pass * Add here code to do during the pass
*/ */
JointSet set = next.processBackRefReplacement(); TJointSet set = next.processBackRefReplacement();
if (set != null) { if (set != null) {
next.isSecondPassVisited = true; next.isSecondPassVisited = true;
@ -98,7 +98,7 @@ abstract class QuantifierSet extends AbstractSet {
/* /*
* Add here code to do during the pass * Add here code to do during the pass
*/ */
JointSet set = innerSet.processBackRefReplacement(); TJointSet set = innerSet.processBackRefReplacement();
if (set != null) { if (set != null) {
innerSet.isSecondPassVisited = true; innerSet.isSecondPassVisited = true;
@ -121,7 +121,7 @@ abstract class QuantifierSet extends AbstractSet {
/* /*
* Add here code to do during the pass * Add here code to do during the pass
*/ */
if (innerSet instanceof SingleSet && ((FSet)((JointSet)innerSet).fSet).isBackReferenced) { if (innerSet instanceof TSingleSet && ((TFSet)((TJointSet)innerSet).fSet).isBackReferenced) {
innerSet = innerSet.next; innerSet = innerSet.next;
} }

View File

@ -26,19 +26,19 @@ package org.teavm.classlib.java.util.regex;
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class RangeSet extends LeafSet { class TRangeSet extends TLeafSet {
private AbstractCharClass chars; private TAbstractCharClass chars;
private boolean alt = false; private boolean alt = false;
public RangeSet(AbstractCharClass cs, AbstractSet next) { public TRangeSet(TAbstractCharClass cs, TAbstractSet next) {
super(next); super(next);
this.chars = cs.getInstance(); this.chars = cs.getInstance();
this.alt = cs.alt; this.alt = cs.alt;
} }
public RangeSet(AbstractCharClass cc) { public TRangeSet(TAbstractCharClass cc) {
this.chars = cc.getInstance(); this.chars = cc.getInstance();
this.alt = cc.alt; this.alt = cc.alt;
} }
@ -54,20 +54,20 @@ class RangeSet extends LeafSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (set instanceof CharSet) { if (set instanceof TCharSet) {
return AbstractCharClass.intersects(chars, ((CharSet)set).getChar()); return TAbstractCharClass.intersects(chars, ((TCharSet)set).getChar());
} else if (set instanceof RangeSet) { } else if (set instanceof TRangeSet) {
return AbstractCharClass.intersects(chars, ((RangeSet)set).chars); return TAbstractCharClass.intersects(chars, ((TRangeSet)set).chars);
} else if (set instanceof SupplRangeSet) { } else if (set instanceof TSupplRangeSet) {
return AbstractCharClass.intersects(chars, ((SupplRangeSet)set).getChars()); return TAbstractCharClass.intersects(chars, ((TSupplRangeSet)set).getChars());
} else if (set instanceof SupplCharSet) { } else if (set instanceof TSupplCharSet) {
return false; return false;
} }
return true; return true;
} }
protected AbstractCharClass getChars() { protected TAbstractCharClass getChars() {
return chars; return chars;
} }
} }

View File

@ -25,14 +25,14 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class RelAltGroupQuantifierSet extends AltGroupQuantifierSet { class TRelAltGroupQuantifierSet extends TAltGroupQuantifierSet {
public RelAltGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TRelAltGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (!innerSet.hasConsumed(matchResult)) if (!innerSet.hasConsumed(matchResult))
return next.matches(stringIndex, testString, matchResult); return next.matches(stringIndex, testString, matchResult);

View File

@ -25,15 +25,15 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class RelCompositeGroupQuantifierSet extends CompositeGroupQuantifierSet { class TRelCompositeGroupQuantifierSet extends TCompositeGroupQuantifierSet {
public RelCompositeGroupQuantifierSet(Quantifier quant, AbstractSet innerSet, AbstractSet next, int type, public TRelCompositeGroupQuantifierSet(TQuantifier quant, TAbstractSet innerSet, TAbstractSet next, int type,
int setCounter) { int setCounter) {
super(quant, innerSet, next, type, setCounter); super(quant, innerSet, next, type, setCounter);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int enterCounter = matchResult.getEnterCounter(setCounter); int enterCounter = matchResult.getEnterCounter(setCounter);
if (!innerSet.hasConsumed(matchResult)) if (!innerSet.hasConsumed(matchResult))

View File

@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class ReluctantAltQuantifierSet extends AltQuantifierSet { class TReluctantAltQuantifierSet extends TAltQuantifierSet {
public ReluctantAltQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { public TReluctantAltQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int shift; int shift;
if ((shift = next.matches(stringIndex, testString, matchResult)) >= 0) { if ((shift = next.matches(stringIndex, testString, matchResult)) >= 0) {

View File

@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class ReluctantCompositeQuantifierSet extends CompositeQuantifierSet { class TReluctantCompositeQuantifierSet extends TCompositeQuantifierSet {
public ReluctantCompositeQuantifierSet(Quantifier quant, LeafSet innerSet, AbstractSet next, int type) { public TReluctantCompositeQuantifierSet(TQuantifier quant, TLeafSet innerSet, TAbstractSet next, int type) {
super(quant, innerSet, next, type); super(quant, innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int min = quantifier.min(); int min = quantifier.min();
int max = quantifier.max(); int max = quantifier.max();
int i = 0; int i = 0;

View File

@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class ReluctantGroupQuantifierSet extends GroupQuantifierSet { class TReluctantGroupQuantifierSet extends TGroupQuantifierSet {
public ReluctantGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { public TReluctantGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (!innerSet.hasConsumed(matchResult)) if (!innerSet.hasConsumed(matchResult))
return next.matches(stringIndex, testString, matchResult); return next.matches(stringIndex, testString, matchResult);

View File

@ -23,17 +23,17 @@ package org.teavm.classlib.java.util.regex;
/** /**
* This class represents [+*]? constructs over LeafSets. * This class represents [+*]? constructs over LeafSets.
* *
* @see java.util.regex.LeafSet * @see java.util.regex.TLeafSet
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class ReluctantQuantifierSet extends LeafQuantifierSet { class TReluctantQuantifierSet extends TLeafQuantifierSet {
public ReluctantQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { public TReluctantQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int shift = 0; int shift = 0;
do { do {

View File

@ -25,11 +25,11 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
final class SOLSet extends AbstractSet { final class TSOLSet extends TAbstractSet {
@Override @Override
public int matches(int strIndex, CharSequence testString, public int matches(int strIndex, CharSequence testString,
MatchResultImpl matchResult) { TMatchResultImpl matchResult) {
if (strIndex == 0 if (strIndex == 0
|| (matchResult.hasAnchoringBounds() && strIndex == matchResult || (matchResult.hasAnchoringBounds() && strIndex == matchResult
.getLeftBound())) { .getLeftBound())) {
@ -39,7 +39,7 @@ final class SOLSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
return false; return false;
} }

View File

@ -34,7 +34,7 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class SequenceSet extends LeafSet { class TSequenceSet extends TLeafSet {
private String string = null; private String string = null;
@ -42,7 +42,7 @@ class SequenceSet extends LeafSet {
private IntHash rightToLeft; private IntHash rightToLeft;
SequenceSet(StringBuffer substring) { TSequenceSet(StringBuffer substring) {
this.string = substring.toString(); this.string = substring.toString();
charCount = substring.length(); charCount = substring.length();
@ -50,8 +50,7 @@ class SequenceSet extends LeafSet {
rightToLeft = new IntHash(charCount); rightToLeft = new IntHash(charCount);
for (int j = 0; j < charCount - 1; j++) { for (int j = 0; j < charCount - 1; j++) {
leftToRight.put(string.charAt(j), charCount - j - 1); leftToRight.put(string.charAt(j), charCount - j - 1);
rightToLeft rightToLeft.put(string.charAt(charCount - j - 1), charCount - j - 1);
.put(string.charAt(charCount - j - 1), charCount - j - 1);
} }
} }
@ -62,7 +61,7 @@ class SequenceSet extends LeafSet {
@Override @Override
public int find(int strIndex, CharSequence testString, public int find(int strIndex, CharSequence testString,
MatchResultImpl matchResult) { TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
@ -82,7 +81,7 @@ class SequenceSet extends LeafSet {
@Override @Override
public int findBack(int strIndex, int lastIndex, CharSequence testString, public int findBack(int strIndex, int lastIndex, CharSequence testString,
MatchResultImpl matchResult) { TMatchResultImpl matchResult) {
while (lastIndex >= strIndex) { while (lastIndex >= strIndex) {
lastIndex = lastIndexOf(testString, strIndex, lastIndex); lastIndex = lastIndexOf(testString, strIndex, lastIndex);
@ -104,18 +103,18 @@ class SequenceSet extends LeafSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (set instanceof CharSet) { if (set instanceof TCharSet) {
return ((CharSet) set).getChar() == string.charAt(0); return ((TCharSet) set).getChar() == string.charAt(0);
} else if (set instanceof RangeSet) { } else if (set instanceof TRangeSet) {
return ((RangeSet) set).accepts(0, string.substring(0, 1)) > 0; return ((TRangeSet) set).accepts(0, string.substring(0, 1)) > 0;
} else if (set instanceof SupplRangeSet) { } else if (set instanceof TSupplRangeSet) {
return ((SupplRangeSet) set).contains(string.charAt(0)) return ((TSupplRangeSet) set).contains(string.charAt(0))
|| ((string.length() > 1) && ((SupplRangeSet) set).contains(Character || ((string.length() > 1) && ((TSupplRangeSet) set).contains(Character
.toCodePoint(string.charAt(0), string.charAt(1)))); .toCodePoint(string.charAt(0), string.charAt(1))));
} else if ((set instanceof SupplCharSet)) { } else if ((set instanceof TSupplCharSet)) {
return (string.length() > 1) return (string.length() > 1)
? ((SupplCharSet) set).getCodePoint() ? ((TSupplCharSet) set).getCodePoint()
== Character.toCodePoint(string.charAt(0), == Character.toCodePoint(string.charAt(0),
string.charAt(1)) string.charAt(1))
: false; : false;

View File

@ -25,18 +25,18 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class SingleSet extends JointSet { class TSingleSet extends TJointSet {
protected AbstractSet kid; protected TAbstractSet kid;
public SingleSet(AbstractSet child, FSet fSet) { public TSingleSet(TAbstractSet child, TFSet fSet) {
this.kid = child; this.kid = child;
this.fSet = fSet; this.fSet = fSet;
this.groupIndex = fSet.getGroupIndex(); this.groupIndex = fSet.getGroupIndex();
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int start = matchResult.getStart(groupIndex); int start = matchResult.getStart(groupIndex);
matchResult.setStart(groupIndex, stringIndex); matchResult.setStart(groupIndex, stringIndex);
int shift = kid.matches(stringIndex, testString, matchResult); int shift = kid.matches(stringIndex, testString, matchResult);
@ -48,7 +48,7 @@ class SingleSet extends JointSet {
} }
@Override @Override
public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int res = kid.find(stringIndex, testString, matchResult); int res = kid.find(stringIndex, testString, matchResult);
if (res >= 0) if (res >= 0)
matchResult.setStart(groupIndex, res); matchResult.setStart(groupIndex, res);
@ -56,7 +56,7 @@ class SingleSet extends JointSet {
} }
@Override @Override
public int findBack(int stringIndex, int lastIndex, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int stringIndex, int lastIndex, CharSequence testString, TMatchResultImpl matchResult) {
int res = kid.findBack(stringIndex, lastIndex, testString, matchResult); int res = kid.findBack(stringIndex, lastIndex, testString, matchResult);
if (res >= 0) if (res >= 0)
matchResult.setStart(groupIndex, res); matchResult.setStart(groupIndex, res);
@ -64,7 +64,7 @@ class SingleSet extends JointSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
return kid.first(set); return kid.first(set);
} }
@ -72,8 +72,8 @@ class SingleSet extends JointSet {
* This method is used for replacement backreferenced sets. * This method is used for replacement backreferenced sets.
*/ */
@Override @Override
public JointSet processBackRefReplacement() { public TJointSet processBackRefReplacement() {
BackReferencedSingleSet set = new BackReferencedSingleSet(this); TBackReferencedSingleSet set = new TBackReferencedSingleSet(this);
/* /*
* We will store a reference to created BackReferencedSingleSet in next * We will store a reference to created BackReferencedSingleSet in next
@ -111,7 +111,7 @@ class SingleSet extends JointSet {
/* /*
* Add here code to do during the pass * Add here code to do during the pass
*/ */
JointSet set = kid.processBackRefReplacement(); TJointSet set = kid.processBackRefReplacement();
if (set != null) { if (set != null) {
kid.isSecondPassVisited = true; kid.isSecondPassVisited = true;

View File

@ -26,7 +26,7 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
abstract class SpecialToken { abstract class TSpecialToken {
public static final int TOK_CHARCLASS = 1 << 0; public static final int TOK_CHARCLASS = 1 << 0;

View File

@ -85,7 +85,7 @@ package org.teavm.classlib.java.util.regex;
/** /**
* Represents node accepting single supplementary codepoint. * Represents node accepting single supplementary codepoint.
*/ */
class SupplCharSet extends LeafSet { class TSupplCharSet extends TLeafSet {
/* /*
* UTF-16 encoding of this supplementary codepoint * UTF-16 encoding of this supplementary codepoint
@ -97,7 +97,7 @@ class SupplCharSet extends LeafSet {
// int value of this supplementary codepoint // int value of this supplementary codepoint
private int ch; private int ch;
public SupplCharSet(int ch) { public TSupplCharSet(int ch) {
charCount = 2; charCount = 2;
this.ch = ch; this.ch = ch;
char[] chUTF16 = Character.toChars(ch); char[] chUTF16 = Character.toChars(ch);
@ -118,7 +118,7 @@ class SupplCharSet extends LeafSet {
} }
@Override @Override
public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (testString instanceof String) { if (testString instanceof String) {
String testStr = (String)testString; String testStr = (String)testString;
@ -146,7 +146,7 @@ class SupplCharSet extends LeafSet {
} }
@Override @Override
public int findBack(int strIndex, int lastIndex, CharSequence testString, MatchResultImpl matchResult) { public int findBack(int strIndex, int lastIndex, CharSequence testString, TMatchResultImpl matchResult) {
if (testString instanceof String) { if (testString instanceof String) {
String testStr = (String)testString; String testStr = (String)testString;
@ -180,14 +180,14 @@ class SupplCharSet extends LeafSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (set instanceof SupplCharSet) { if (set instanceof TSupplCharSet) {
return ((SupplCharSet)set).getCodePoint() == ch; return ((TSupplCharSet)set).getCodePoint() == ch;
} else if (set instanceof SupplRangeSet) { } else if (set instanceof TSupplRangeSet) {
return ((SupplRangeSet)set).contains(ch); return ((TSupplRangeSet)set).contains(ch);
} else if (set instanceof CharSet) { } else if (set instanceof TCharSet) {
return false; return false;
} else if (set instanceof RangeSet) { } else if (set instanceof TRangeSet) {
return false; return false;
} }

View File

@ -87,25 +87,25 @@ package org.teavm.classlib.java.util.regex;
* character can be supplementary (2 chars needed to represent) or from basic * character can be supplementary (2 chars needed to represent) or from basic
* multilingual pane (1 needed char to represent it). * multilingual pane (1 needed char to represent it).
*/ */
class SupplRangeSet extends JointSet { class TSupplRangeSet extends TJointSet {
protected AbstractCharClass chars; protected TAbstractCharClass chars;
protected boolean alt = false; protected boolean alt = false;
public SupplRangeSet(AbstractCharClass cs, AbstractSet next) { public TSupplRangeSet(TAbstractCharClass cs, TAbstractSet next) {
this.chars = cs.getInstance(); this.chars = cs.getInstance();
this.alt = cs.alt; this.alt = cs.alt;
this.next = next; this.next = next;
} }
public SupplRangeSet(AbstractCharClass cc) { public TSupplRangeSet(TAbstractCharClass cc) {
this.chars = cc.getInstance(); this.chars = cc.getInstance();
this.alt = cc.alt; this.alt = cc.alt;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strLength = matchResult.getRightBound(); int strLength = matchResult.getRightBound();
int offset = -1; int offset = -1;
@ -138,36 +138,36 @@ class SupplRangeSet extends JointSet {
} }
@Override @Override
public boolean first(AbstractSet set) { public boolean first(TAbstractSet set) {
if (set instanceof SupplCharSet) { if (set instanceof TSupplCharSet) {
return AbstractCharClass.intersects(chars, ((SupplCharSet)set).getCodePoint()); return TAbstractCharClass.intersects(chars, ((TSupplCharSet)set).getCodePoint());
} else if (set instanceof CharSet) { } else if (set instanceof TCharSet) {
return AbstractCharClass.intersects(chars, ((CharSet)set).getChar()); return TAbstractCharClass.intersects(chars, ((TCharSet)set).getChar());
} else if (set instanceof SupplRangeSet) { } else if (set instanceof TSupplRangeSet) {
return AbstractCharClass.intersects(chars, ((SupplRangeSet)set).chars); return TAbstractCharClass.intersects(chars, ((TSupplRangeSet)set).chars);
} else if (set instanceof RangeSet) { } else if (set instanceof TRangeSet) {
return AbstractCharClass.intersects(chars, ((RangeSet)set).getChars()); return TAbstractCharClass.intersects(chars, ((TRangeSet)set).getChars());
} }
return true; return true;
} }
protected AbstractCharClass getChars() { protected TAbstractCharClass getChars() {
return chars; return chars;
} }
@Override @Override
public AbstractSet getNext() { public TAbstractSet getNext() {
return next; return next;
} }
@Override @Override
public void setNext(AbstractSet next) { public void setNext(TAbstractSet next) {
this.next = next; this.next = next;
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl mr) { public boolean hasConsumed(TMatchResultImpl mr) {
return true; return true;
} }
} }

View File

@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class UCIBackReferenceSet extends CIBackReferenceSet { class TUCIBackReferenceSet extends TCIBackReferenceSet {
int groupIndex; int groupIndex;
public UCIBackReferenceSet(int groupIndex, int consCounter) { public TUCIBackReferenceSet(int groupIndex, int consCounter) {
super(groupIndex, consCounter); super(groupIndex, consCounter);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
String group = getString(matchResult); String group = getString(matchResult);
if (group == null || (stringIndex + group.length()) > matchResult.getRightBound()) if (group == null || (stringIndex + group.length()) > matchResult.getRightBound())

View File

@ -26,18 +26,17 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class UCICharSet extends LeafSet { class TUCICharSet extends TLeafSet {
private char ch; private char ch;
public UCICharSet(char ch) { public TUCICharSet(char ch) {
this.ch = Character.toLowerCase(Character.toUpperCase(ch)); this.ch = Character.toLowerCase(Character.toUpperCase(ch));
} }
@Override @Override
public int accepts(int strIndex, CharSequence testString) { public int accepts(int strIndex, CharSequence testString) {
return (this.ch == Character.toLowerCase(Character return (this.ch == Character.toLowerCase(Character.toUpperCase(testString.charAt(strIndex)))) ? 1 : -1;
.toUpperCase(testString.charAt(strIndex)))) ? 1 : -1;
} }
@Override @Override

View File

@ -24,12 +24,12 @@ package org.teavm.classlib.java.util.regex;
* CANON_EQ flag of Pattern class * CANON_EQ flag of Pattern class
* is specified. * is specified.
*/ */
class UCIDecomposedCharSet extends DecomposedCharSet{ class TUCIDecomposedCharSet extends TDecomposedCharSet{
/* /*
* Just only a stub * Just only a stub
*/ */
public UCIDecomposedCharSet(int [] decomp, int decomposedCharLength) { public TUCIDecomposedCharSet(int [] decomp, int decomposedCharLength) {
super(decomp, decomposedCharLength); super(decomp, decomposedCharLength);
} }
} }

View File

@ -27,19 +27,19 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class UCIRangeSet extends LeafSet { class TUCIRangeSet extends TLeafSet {
private AbstractCharClass chars; private TAbstractCharClass chars;
private boolean alt = false; private boolean alt = false;
public UCIRangeSet(AbstractCharClass cs, AbstractSet next) { public TUCIRangeSet(TAbstractCharClass cs, TAbstractSet next) {
super(next); super(next);
this.chars = cs.getInstance(); this.chars = cs.getInstance();
this.alt = cs.alt; this.alt = cs.alt;
} }
public UCIRangeSet(AbstractCharClass cc) { public TUCIRangeSet(TAbstractCharClass cc) {
this.chars = cc.getInstance(); this.chars = cc.getInstance();
this.alt = cc.alt; this.alt = cc.alt;
} }

View File

@ -25,11 +25,11 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class UCISequenceSet extends LeafSet { class TUCISequenceSet extends TLeafSet {
private String string = null; private String string = null;
UCISequenceSet(StringBuffer substring) { TUCISequenceSet(StringBuffer substring) {
StringBuilder res = new StringBuilder(); StringBuilder res = new StringBuilder();
for (int i = 0; i < substring.length(); i++) { for (int i = 0; i < substring.length(); i++) {
res.append(Character.toLowerCase(Character.toUpperCase(substring.charAt(i)))); res.append(Character.toLowerCase(Character.toUpperCase(substring.charAt(i))));

View File

@ -86,12 +86,12 @@ package org.teavm.classlib.java.util.regex;
* Represents node accepting single supplementary codepoint in Unicode case * Represents node accepting single supplementary codepoint in Unicode case
* insensitive manner. * insensitive manner.
*/ */
class UCISupplCharSet extends LeafSet { class TUCISupplCharSet extends TLeafSet {
// int value of this supplementary codepoint // int value of this supplementary codepoint
private int ch; private int ch;
public UCISupplCharSet(int ch) { public TUCISupplCharSet(int ch) {
charCount = 2; charCount = 2;
this.ch = Character.toLowerCase(Character.toUpperCase(ch)); this.ch = Character.toLowerCase(Character.toUpperCase(ch));
} }

View File

@ -88,13 +88,13 @@ package org.teavm.classlib.java.util.regex;
* This character can be supplementary (2 chars to represent) or from * This character can be supplementary (2 chars to represent) or from
* basic multilingual pane (1 char to represent). * basic multilingual pane (1 char to represent).
*/ */
class UCISupplRangeSet extends SupplRangeSet{ class TUCISupplRangeSet extends TSupplRangeSet {
public UCISupplRangeSet(AbstractCharClass cs, AbstractSet next) { public TUCISupplRangeSet(TAbstractCharClass cs, TAbstractSet next) {
super(cs, next); super(cs, next);
} }
public UCISupplRangeSet(AbstractCharClass cc) { public TUCISupplRangeSet(TAbstractCharClass cc) {
super(cc); super(cc);
} }

View File

@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
final class UEOLSet extends AbstractSet { final class TUEOLSet extends TAbstractSet {
private int consCounter; private int consCounter;
public UEOLSet(int counter) { public TUEOLSet(int counter) {
this.consCounter = counter; this.consCounter = counter;
} }
@Override @Override
public int matches(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
int rightBound = matchResult.hasAnchoringBounds() ? matchResult.getRightBound() : testString.length(); int rightBound = matchResult.hasAnchoringBounds() ? matchResult.getRightBound() : testString.length();
if (strIndex >= rightBound) { if (strIndex >= rightBound) {
@ -52,7 +52,7 @@ final class UEOLSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
int cons; int cons;
boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0);
matchResult.setConsumed(consCounter, -1); matchResult.setConsumed(consCounter, -1);

View File

@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class UMultiLineEOLSet extends AbstractSet { class TUMultiLineEOLSet extends TAbstractSet {
private int consCounter; private int consCounter;
public UMultiLineEOLSet(int counter) { public TUMultiLineEOLSet(int counter) {
this.consCounter = counter; this.consCounter = counter;
} }
@Override @Override
public int matches(int strIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int strIndex, CharSequence testString, TMatchResultImpl matchResult) {
int strDif = matchResult.hasAnchoringBounds() ? matchResult.getRightBound() - strIndex : testString.length() - int strDif = matchResult.hasAnchoringBounds() ? matchResult.getRightBound() - strIndex : testString.length() -
strIndex; strIndex;
if (strDif <= 0) { if (strDif <= 0) {
@ -48,7 +48,7 @@ class UMultiLineEOLSet extends AbstractSet {
} }
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
int cons; int cons;
boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0);
matchResult.setConsumed(consCounter, -1); matchResult.setConsumed(consCounter, -1);

View File

@ -25,11 +25,11 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class UnicodeCategory extends AbstractCharClass { class TUnicodeCategory extends TAbstractCharClass {
protected int category; protected int category;
public UnicodeCategory(int category) { public TUnicodeCategory(int category) {
this.category = category; this.category = category;
} }

View File

@ -24,9 +24,9 @@ package org.teavm.classlib.java.util.regex;
* Unicode category scope (i.e IsL, IsM, ...) * Unicode category scope (i.e IsL, IsM, ...)
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class UnicodeCategoryScope extends UnicodeCategory { class TUnicodeCategoryScope extends TUnicodeCategory {
public UnicodeCategoryScope(int category) { public TUnicodeCategoryScope(int category) {
super(category); super(category);
} }

View File

@ -26,20 +26,20 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class UnifiedQuantifierSet extends LeafQuantifierSet { class TUnifiedQuantifierSet extends TLeafQuantifierSet {
public UnifiedQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { public TUnifiedQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) {
super(innerSet, next, type); super(innerSet, next, type);
} }
public UnifiedQuantifierSet(LeafQuantifierSet quant) { public TUnifiedQuantifierSet(TLeafQuantifierSet quant) {
super((LeafSet)quant.getInnerSet(), quant.getNext(), quant.getType()); super((TLeafSet)quant.getInnerSet(), quant.getNext(), quant.getType());
innerSet.setNext(this); innerSet.setNext(this);
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
while (stringIndex + leaf.charCount() <= matchResult.getRightBound() && while (stringIndex + leaf.charCount() <= matchResult.getRightBound() &&
leaf.accepts(stringIndex, testString) > 0) leaf.accepts(stringIndex, testString) > 0)
stringIndex += leaf.charCount(); stringIndex += leaf.charCount();
@ -48,7 +48,7 @@ class UnifiedQuantifierSet extends LeafQuantifierSet {
} }
@Override @Override
public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
int startSearch = next.find(stringIndex, testString, matchResult); int startSearch = next.find(stringIndex, testString, matchResult);
if (startSearch < 0) if (startSearch < 0)
return -1; return -1;

View File

@ -26,16 +26,16 @@ package org.teavm.classlib.java.util.regex;
* *
* @author Nikolay A. Kuznetsov * @author Nikolay A. Kuznetsov
*/ */
class WordBoundary extends AbstractSet { class TWordBoundary extends TAbstractSet {
boolean positive; boolean positive;
public WordBoundary(boolean positive) { public TWordBoundary(boolean positive) {
this.positive = positive; this.positive = positive;
} }
@Override @Override
public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) {
boolean left; boolean left;
boolean right; boolean right;
@ -53,7 +53,7 @@ class WordBoundary extends AbstractSet {
* do not move string index. * do not move string index.
*/ */
@Override @Override
public boolean hasConsumed(MatchResultImpl matchResult) { public boolean hasConsumed(TMatchResultImpl matchResult) {
// only checks boundary, do not consumes characters // only checks boundary, do not consumes characters
return false; return false;
} }

View File

@ -625,42 +625,6 @@ public class MatcherTest {
assertTrue(matcher.matches()); assertTrue(matcher.matches());
} }
@Test
public void testAllCodePoints() {
// Regression for HARMONY-3145
int[] codePoint = new int[1];
Pattern p = Pattern.compile("(\\p{all})+");
boolean res = true;
int cnt = 0;
String s;
for (int i = 0; i < 0x110000; i++) {
codePoint[0] = i;
s = new String(codePoint, 0, 1);
if (!s.matches(p.toString())) {
cnt++;
res = false;
}
}
assertTrue(res);
assertEquals(0, cnt);
p = Pattern.compile("(\\P{all})+");
res = true;
cnt = 0;
for (int i = 0; i < 0x110000; i++) {
codePoint[0] = i;
s = new String(codePoint, 0, 1);
if (!s.matches(p.toString())) {
cnt++;
res = false;
}
}
assertFalse(res);
assertEquals(0x110000, cnt);
}
@Test @Test
public void testFindRegionChanged() { public void testFindRegionChanged() {
// Regression for HARMONY-625 // Regression for HARMONY-625
@ -705,8 +669,7 @@ public class MatcherTest {
@Test @Test
public void testGeneralPunctuationCategory() { public void testGeneralPunctuationCategory() {
String[] s = { ",", "!", "\"", "#", "%", "&", "'", "(", ")", "-", ".", String[] s = { ",", "!", "\"", "#", "%", "&", "'", "(", ")", "-", ".", "/" };
"/" };
String regexp = "\\p{P}"; String regexp = "\\p{P}";
for (int i = 0; i < s.length; i++) { for (int i = 0; i < s.length; i++) {
@ -728,12 +691,9 @@ public class MatcherTest {
String floatRegex = getHexFloatRegex(); String floatRegex = getHexFloatRegex();
hitEndTest(true, "#03.0", floatRegex, Double.toHexString(-1.234d), true); hitEndTest(true, "#03.0", floatRegex, Double.toHexString(-1.234d), true);
hitEndTest(true, "#03.1", floatRegex, "1 ABC" hitEndTest(true, "#03.1", floatRegex, "1 ABC" + Double.toHexString(Double.NaN) + "buhuhu", false);
+ Double.toHexString(Double.NaN) + "buhuhu", false); hitEndTest(true, "#03.2", floatRegex, Double.toHexString(-0.0) + "--", false);
hitEndTest(true, "#03.2", floatRegex, Double.toHexString(-0.0) + "--", hitEndTest(true, "#03.3", floatRegex, "--" + Double.toHexString(Double.MIN_VALUE) + "--", false);
false);
hitEndTest(true, "#03.3", floatRegex, "--"
+ Double.toHexString(Double.MIN_VALUE) + "--", false);
hitEndTest(true, "#04.0", "(\\d+) fish (\\d+) fish (\\w+) fish (\\d+)", hitEndTest(true, "#04.0", "(\\d+) fish (\\d+) fish (\\w+) fish (\\d+)",
"1 fish 2 fish red fish 5", true); "1 fish 2 fish red fish 5", true);
@ -743,10 +703,8 @@ public class MatcherTest {
@Test @Test
public void testToString() { public void testToString() {
String result = Pattern.compile("(\\d{1,3})").matcher( String result = Pattern.compile("(\\d{1,3})").matcher("aaaa123456789045").toString();
"aaaa123456789045").toString(); assertTrue("The result doesn't contain pattern info", result.contains("(\\d{1,3})"));
assertTrue("The result doesn't contain pattern info", result
.contains("(\\d{1,3})"));
} }
private void hitEndTest(boolean callFind, String testNo, String regex, private void hitEndTest(boolean callFind, String testNo, String regex,

View File

@ -19,7 +19,7 @@ package org.teavm.classlib.java.util.regex;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import org.junit.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
/** /**
@ -27,6 +27,7 @@ import junit.framework.TestCase;
*/ */
@SuppressWarnings("nls") @SuppressWarnings("nls")
public class ModeTest extends TestCase { public class ModeTest extends TestCase {
@Test
public void testCase() throws PatternSyntaxException { public void testCase() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -54,6 +55,7 @@ public class ModeTest extends TestCase {
assertFalse(m.find()); assertFalse(m.find());
} }
@Test
public void testMultiline() throws PatternSyntaxException { public void testMultiline() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;

View File

@ -19,7 +19,7 @@ package org.teavm.classlib.java.util.regex;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import org.junit.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
/** /**
@ -27,6 +27,7 @@ import junit.framework.TestCase;
*/ */
@SuppressWarnings("nls") @SuppressWarnings("nls")
public class Pattern2Test extends TestCase { public class Pattern2Test extends TestCase {
@Test
public void testSimpleMatch() throws PatternSyntaxException { public void testSimpleMatch() throws PatternSyntaxException {
Pattern p = Pattern.compile("foo.*"); Pattern p = Pattern.compile("foo.*");
@ -48,6 +49,7 @@ public class Pattern2Test extends TestCase {
assertTrue(Pattern.matches("", "")); assertTrue(Pattern.matches("", ""));
} }
@Test
public void testCursors() { public void testCursors() {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -103,6 +105,7 @@ public class Pattern2Test extends TestCase {
} }
} }
@Test
public void testGroups() throws PatternSyntaxException { public void testGroups() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -156,6 +159,7 @@ public class Pattern2Test extends TestCase {
assertFalse(m.find()); assertFalse(m.find());
} }
@Test
public void testReplace() throws PatternSyntaxException { public void testReplace() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -197,12 +201,11 @@ public class Pattern2Test extends TestCase {
p = Pattern.compile("([CcPp][hl]e[ea]se)"); p = Pattern.compile("([CcPp][hl]e[ea]se)");
m = p.matcher("I want cheese. Please."); m = p.matcher("I want cheese. Please.");
assertTrue(m.replaceFirst("<b> $1 </b>").equals( assertTrue(m.replaceFirst("<b> $1 </b>").equals("I want <b> cheese </b>. Please."));
"I want <b> cheese </b>. Please.")); assertTrue(m.replaceAll("<b> $1 </b>").equals("I want <b> cheese </b>. <b> Please </b>."));
assertTrue(m.replaceAll("<b> $1 </b>").equals(
"I want <b> cheese </b>. <b> Please </b>."));
} }
@Test
public void testEscapes() throws PatternSyntaxException { public void testEscapes() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -396,6 +399,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// } // }
} }
@Test
public void testCharacterClasses() throws PatternSyntaxException { public void testCharacterClasses() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -654,6 +658,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// TODO // TODO
} }
@Test
public void testPOSIXGroups() throws PatternSyntaxException { public void testPOSIXGroups() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -795,6 +800,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// TODO // TODO
} }
@Test
public void testUnicodeCategories() throws PatternSyntaxException { public void testUnicodeCategories() throws PatternSyntaxException {
// Test Unicode categories using \p and \P // Test Unicode categories using \p and \P
// One letter codes: L, M, N, P, S, Z, C // One letter codes: L, M, N, P, S, Z, C
@ -843,6 +849,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// Cn // Cn
} }
@Test
public void testUnicodeBlocks() throws PatternSyntaxException { public void testUnicodeBlocks() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -912,6 +919,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
} }
} }
@Test
public void testCapturingGroups() throws PatternSyntaxException { public void testCapturingGroups() throws PatternSyntaxException {
// Test simple capturing groups // Test simple capturing groups
// TODO // TODO
@ -929,6 +937,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// TODO // TODO
} }
@Test
public void testRepeats() { public void testRepeats() {
// Test ? // Test ?
// TODO // TODO
@ -949,6 +958,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// TODO // TODO
} }
@Test
public void testAnchors() throws PatternSyntaxException { public void testAnchors() throws PatternSyntaxException {
// Test ^, default and MULTILINE // Test ^, default and MULTILINE
// TODO // TODO
@ -987,6 +997,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// TODO // TODO
} }
@Test
public void testMisc() throws PatternSyntaxException { public void testMisc() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -1048,6 +1059,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// TODO // TODO
} }
@Test
public void testCompile1() throws PatternSyntaxException { public void testCompile1() throws PatternSyntaxException {
Pattern pattern = Pattern Pattern pattern = Pattern
.compile("[0-9A-Za-z][0-9A-Za-z\\x2e\\x3a\\x2d\\x5f]*"); .compile("[0-9A-Za-z][0-9A-Za-z\\x2e\\x3a\\x2d\\x5f]*");
@ -1055,6 +1067,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
assertTrue(pattern.matcher(name).matches()); assertTrue(pattern.matcher(name).matches());
} }
@Test
public void testCompile2() throws PatternSyntaxException { public void testCompile2() throws PatternSyntaxException {
String findString = "\\Qimport\\E"; String findString = "\\Qimport\\E";
@ -1065,6 +1078,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
assertTrue(matcher.find(0)); assertTrue(matcher.find(0));
} }
@Test
public void testCompile3() throws PatternSyntaxException { public void testCompile3() throws PatternSyntaxException {
Pattern p; Pattern p;
Matcher m; Matcher m;
@ -1144,6 +1158,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
assertFalse(m.find()); assertFalse(m.find());
} }
@Test
public void testCompile4() throws PatternSyntaxException { public void testCompile4() throws PatternSyntaxException {
String findString = "\\Qpublic\\E"; String findString = "\\Qpublic\\E";
StringBuffer text = new StringBuffer(" public class Class {\n" StringBuffer text = new StringBuffer(" public class Class {\n"
@ -1166,6 +1181,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
assertFalse(found); assertFalse(found);
} }
@Test
public void testCompile5() throws PatternSyntaxException { public void testCompile5() throws PatternSyntaxException {
Pattern p = Pattern.compile("^[0-9]"); Pattern p = Pattern.compile("^[0-9]");
String s[] = p.split("12", -1); String s[] = p.split("12", -1);

View File

@ -17,7 +17,7 @@
package org.teavm.classlib.java.util.regex; package org.teavm.classlib.java.util.regex;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.junit.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
/** /**
@ -25,6 +25,7 @@ import junit.framework.TestCase;
*/ */
@SuppressWarnings("nls") @SuppressWarnings("nls")
public class PatternErrorTest extends TestCase { public class PatternErrorTest extends TestCase {
@Test
public void testCompileErrors() throws Exception { public void testCompileErrors() throws Exception {
// null regex string - should get NullPointerException // null regex string - should get NullPointerException
try { try {

View File

@ -18,7 +18,7 @@ package org.teavm.classlib.java.util.regex;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import org.junit.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
@ -27,6 +27,7 @@ import junit.framework.TestCase;
*/ */
@SuppressWarnings("nls") @SuppressWarnings("nls")
public class PatternSyntaxExceptionTest extends TestCase { public class PatternSyntaxExceptionTest extends TestCase {
@Test
public void testCase() { public void testCase() {
String regex = "("; String regex = "(";
try { try {
@ -43,6 +44,7 @@ public class PatternSyntaxExceptionTest extends TestCase {
} }
} }
@Test
public void testCase2() { public void testCase2() {
String regex = "[4-"; String regex = "[4-";
try { try {