diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java index 3648b5382..72314d460 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TAbstractStringBuilder.java @@ -773,7 +773,7 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ } public TString substring(int from, int to) { - if (from > to || from < 0 || to >= length) { + if (from > to || from < 0 || to > length) { throw new TIndexOutOfBoundsException(); } return new TString(buffer, from, to - from); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TCharacter.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TCharacter.java index 53193d103..b56d5a3d8 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TCharacter.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TCharacter.java @@ -636,8 +636,12 @@ public class TCharacter extends TObject implements TComparable { case 0x1E: case 0x1F: return true; + case 0xA0: + case 0x2007: + case 0x202F: + return false; default: - return isWhitespace(codePoint); + return isSpaceChar(codePoint); } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/I18n.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/I18n.java deleted file mode 100644 index e1f950959..000000000 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/I18n.java +++ /dev/null @@ -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}); - } - -} diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractCharClass.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractCharClass.java similarity index 84% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractCharClass.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractCharClass.java index 3b5844884..2d47eeadc 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractCharClass.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractCharClass.java @@ -45,7 +45,7 @@ import java.util.BitSet; * * @author Nikolay A. Kuznetsov */ -abstract class AbstractCharClass extends SpecialToken { +abstract class TAbstractCharClass extends TSpecialToken { protected boolean alt; protected boolean altSurrogates; @@ -55,9 +55,9 @@ abstract class AbstractCharClass extends SpecialToken { BitSet lowHighSurrogates = new BitSet(SURROGATE_CARDINALITY); - AbstractCharClass charClassWithoutSurrogates = null; + TAbstractCharClass charClassWithoutSurrogates = null; - AbstractCharClass charClassWithSurrogates = null; + TAbstractCharClass charClassWithSurrogates = null; static PredefinedCharacterClasses charClasses = new PredefinedCharacterClasses(); @@ -101,24 +101,24 @@ abstract class AbstractCharClass extends SpecialToken { @Override public int getType() { - return SpecialToken.TOK_CHARCLASS; + return TSpecialToken.TOK_CHARCLASS; } - public AbstractCharClass getInstance() { + public TAbstractCharClass getInstance() { return this; } - public AbstractCharClass getSurrogates() { + public TAbstractCharClass getSurrogates() { if (charClassWithSurrogates == null) { final BitSet lHS = getLowHighSurrogates(); - charClassWithSurrogates = new AbstractCharClass() { + charClassWithSurrogates = new TAbstractCharClass() { @Override public boolean contains(int ch) { 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; } }; @@ -128,17 +128,17 @@ abstract class AbstractCharClass extends SpecialToken { return charClassWithSurrogates; } - public AbstractCharClass getWithoutSurrogates() { + public TAbstractCharClass getWithoutSurrogates() { if (charClassWithoutSurrogates == null) { final BitSet lHS = getLowHighSurrogates(); - final AbstractCharClass thisClass = this; + final TAbstractCharClass thisClass = this; - charClassWithoutSurrogates = new AbstractCharClass() { + charClassWithoutSurrogates = new TAbstractCharClass() { @Override public boolean contains(int ch) { 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) : false; @@ -165,10 +165,10 @@ abstract class AbstractCharClass extends SpecialToken { * just overall meaning of the class. * * @see #contains(int) - * @see #intersect(CharClass) - * @see #union(CharClass) + * @see #intersect(TCharClass) + * @see #union(TCharClass) */ - public AbstractCharClass setNegative(boolean value) { + public TAbstractCharClass setNegative(boolean value) { if (alt ^ value) { alt = !alt; altSurrogates = !altSurrogates; @@ -191,26 +191,26 @@ abstract class AbstractCharClass extends SpecialToken { return ch1 == ch2; } - public static boolean intersects(AbstractCharClass cc, int ch) { + public static boolean intersects(TAbstractCharClass cc, int 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) return true; 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); } 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) { posValue = computeValue(); } else if (negative && negValue == null) { @@ -221,20 +221,20 @@ abstract class AbstractCharClass extends SpecialToken { return negValue; } - protected abstract AbstractCharClass computeValue(); + protected abstract TAbstractCharClass computeValue(); } static class LazyDigit extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add('0', '9'); + protected TAbstractCharClass computeValue() { + return new TCharClass().add('0', '9'); } } static class LazyNonDigit extends LazyDigit { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = super.computeValue().setNegative(true); + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = super.computeValue().setNegative(true); chCl.mayContainSupplCodepoints = true; return chCl; @@ -243,16 +243,16 @@ abstract class AbstractCharClass extends SpecialToken { static class LazySpace extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { + protected TAbstractCharClass computeValue() { /* 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 { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = super.computeValue().setNegative(true); + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = super.computeValue().setNegative(true); chCl.mayContainSupplCodepoints = true; return chCl; @@ -261,15 +261,15 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyWord extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add('a', 'z').add('A', 'Z').add('0', '9').add('_'); + protected TAbstractCharClass computeValue() { + return new TCharClass().add('a', 'z').add('A', 'Z').add('0', '9').add('_'); } } static class LazyNonWord extends LazyWord { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = super.computeValue().setNegative(true); + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = super.computeValue().setNegative(true); chCl.mayContainSupplCodepoints = true; return chCl; @@ -278,80 +278,80 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyLower extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add('a', 'z'); + protected TAbstractCharClass computeValue() { + return new TCharClass().add('a', 'z'); } } static class LazyUpper extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add('A', 'Z'); + protected TAbstractCharClass computeValue() { + return new TCharClass().add('A', 'Z'); } } static class LazyASCII extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add(0x00, 0x7F); + protected TAbstractCharClass computeValue() { + return new TCharClass().add(0x00, 0x7F); } } static class LazyAlpha extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add('a', 'z').add('A', 'Z'); + protected TAbstractCharClass computeValue() { + return new TCharClass().add('a', 'z').add('A', 'Z'); } } static class LazyAlnum extends LazyAlpha { @Override - protected AbstractCharClass computeValue() { - return ((CharClass)super.computeValue()).add('0', '9'); + protected TAbstractCharClass computeValue() { + return ((TCharClass)super.computeValue()).add('0', '9'); } } static class LazyPunct extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { + protected TAbstractCharClass computeValue() { /* 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 { @Override - protected AbstractCharClass computeValue() { + protected TAbstractCharClass computeValue() { /* 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 { @Override - protected AbstractCharClass computeValue() { - return ((CharClass)super.computeValue()).add(0x20); + protected TAbstractCharClass computeValue() { + return ((TCharClass)super.computeValue()).add(0x20); } } static class LazyBlank extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add(' ').add('\t'); + protected TAbstractCharClass computeValue() { + return new TCharClass().add(' ').add('\t'); } } static class LazyCntrl extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add(0x00, 0x1F).add(0x7F); + protected TAbstractCharClass computeValue() { + return new TCharClass().add(0x00, 0x1F).add(0x7F); } } static class LazyXDigit extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new CharClass().add('0', '9').add('a', 'f').add('A', 'F'); + protected TAbstractCharClass computeValue() { + return new TCharClass().add('0', '9').add('a', 'f').add('A', 'F'); } } @@ -364,16 +364,16 @@ abstract class AbstractCharClass extends SpecialToken { } @Override - public AbstractCharClass computeValue() { - AbstractCharClass chCl = new CharClass().add(start, end); + public TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TCharClass().add(start, end); return chCl; } } static class LazySpecialsBlock extends LazyCharClass { @Override - public AbstractCharClass computeValue() { - return new CharClass().add(0xFEFF, 0xFEFF).add(0xFFF0, 0xFFFD); + public TAbstractCharClass computeValue() { + return new TCharClass().add(0xFEFF, 0xFEFF).add(0xFFF0, 0xFFFD); } } @@ -396,8 +396,8 @@ abstract class AbstractCharClass extends SpecialToken { } @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new UnicodeCategoryScope(category); + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TUnicodeCategoryScope(category); if (containsAllSurrogates) { chCl.lowHighSurrogates.set(0, SURROGATE_CARDINALITY); } @@ -426,8 +426,8 @@ abstract class AbstractCharClass extends SpecialToken { } @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new UnicodeCategory(category); + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TUnicodeCategory(category); if (containsAllSurrogates) { chCl.lowHighSurrogates.set(0, SURROGATE_CARDINALITY); } @@ -439,8 +439,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaLowerCase extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isLowerCase(ch); @@ -454,8 +454,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaUpperCase extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isUpperCase(ch); @@ -469,8 +469,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaWhitespace extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + return new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isWhitespace(ch); @@ -481,8 +481,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaMirrored extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + return new TAbstractCharClass() { @Override public boolean contains(int ch) { // TODO implement this method and uncomment @@ -495,8 +495,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaDefined extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isDefined(ch); @@ -511,8 +511,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaDigit extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isDigit(ch); @@ -526,8 +526,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaIdentifierIgnorable extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isIdentifierIgnorable(ch); @@ -541,8 +541,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaISOControl extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + return new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isISOControl(ch); @@ -553,8 +553,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaJavaIdentifierPart extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isJavaIdentifierPart(ch); @@ -568,8 +568,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaJavaIdentifierStart extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isJavaIdentifierStart(ch); @@ -583,8 +583,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaLetter extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isLetter(ch); @@ -598,8 +598,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaLetterOrDigit extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isLetterOrDigit(ch); @@ -613,8 +613,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaSpaceChar extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + return new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isSpaceChar(ch); @@ -625,8 +625,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaTitleCase extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - return new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + return new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isTitleCase(ch); @@ -637,8 +637,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaUnicodeIdentifierPart extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isUnicodeIdentifierPart(ch); @@ -652,8 +652,8 @@ abstract class AbstractCharClass extends SpecialToken { static class LazyJavaUnicodeIdentifierStart extends LazyCharClass { @Override - protected AbstractCharClass computeValue() { - AbstractCharClass chCl = new AbstractCharClass() { + protected TAbstractCharClass computeValue() { + TAbstractCharClass chCl = new TAbstractCharClass() { @Override public boolean contains(int ch) { return Character.isUnicodeIdentifierStart(ch); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractLineTerminator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractLineTerminator.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractLineTerminator.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractLineTerminator.java index 02770355f..377402d03 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractLineTerminator.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractLineTerminator.java @@ -40,20 +40,20 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -abstract class AbstractLineTerminator { - static AbstractLineTerminator unixLT = null; +abstract class TAbstractLineTerminator { + static TAbstractLineTerminator unixLT = null; - static AbstractLineTerminator unicodeLT = null; + static TAbstractLineTerminator unicodeLT = null; public abstract boolean isLineTerminator(int ch); 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 (unixLT != null) return unixLT; - unixLT = new AbstractLineTerminator() { + unixLT = new TAbstractLineTerminator() { @Override public boolean isLineTerminator(int ch) { return ch == '\n'; @@ -68,7 +68,7 @@ abstract class AbstractLineTerminator { } else { if (unicodeLT != null) return unicodeLT; - unicodeLT = new AbstractLineTerminator() { + unicodeLT = new TAbstractLineTerminator() { @Override public boolean isLineTerminator(int ch) { return (ch == '\n' || ch == '\r' || ch == '\u0085' || (ch | 1) == '\u2029'); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractSet.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractSet.java index 3c32e1fff..5c1c5841f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AbstractSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAbstractSet.java @@ -41,7 +41,7 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -abstract class AbstractSet { +abstract class TAbstractSet { public static final int TYPE_LEAF = 1 << 0; @@ -54,7 +54,7 @@ abstract class AbstractSet { /** * Next node to visit */ - protected AbstractSet next; + protected TAbstractSet next; /** * Counter for debugging purposes, represent unique node index; @@ -63,14 +63,14 @@ abstract class AbstractSet { protected boolean isSecondPassVisited = false; - protected String index = new Integer(AbstractSet.counter++).toString(); + protected String index = new Integer(TAbstractSet.counter++).toString(); private int type = 0; - public AbstractSet() { + public TAbstractSet() { } - public AbstractSet(AbstractSet n) { + public TAbstractSet(TAbstractSet n) { next = n; } @@ -87,7 +87,7 @@ abstract class AbstractSet { * - MatchResult to sore result into * @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 @@ -108,7 +108,7 @@ abstract class AbstractSet { * result of the match * @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(); while (stringIndex <= length) { 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 * 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) { if (matches(startSearch, testString, matchResult) >= 0) { return startSearch; @@ -152,7 +152,7 @@ abstract class AbstractSet { * @param matchResult * @return */ - public abstract boolean hasConsumed(MatchResultImpl matchResult); + public abstract boolean hasConsumed(TMatchResultImpl matchResult); /** * Returns name for the particular node type. Used for debugging purposes. @@ -179,7 +179,7 @@ abstract class AbstractSet { /** * Returns the next. */ - public AbstractSet getNext() { + public TAbstractSet getNext() { return next; } @@ -189,7 +189,7 @@ abstract class AbstractSet { * @param next * The next to set. */ - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @@ -206,7 +206,7 @@ abstract class AbstractSet { * * @return true if the given node intersects with this one */ - public boolean first(AbstractSet set) { + public boolean first(TAbstractSet set) { return true; } @@ -218,7 +218,7 @@ abstract class AbstractSet { * @return null if current node need not to be replaced JointSet which is * replacement of current node otherwise */ - public JointSet processBackRefReplacement() { + public TJointSet processBackRefReplacement() { return null; } @@ -236,7 +236,7 @@ abstract class AbstractSet { /* * Add here code to do during the pass */ - JointSet set = next.processBackRefReplacement(); + TJointSet set = next.processBackRefReplacement(); if (set != null) { next.isSecondPassVisited = true; @@ -259,7 +259,7 @@ abstract class AbstractSet { /* * 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; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AheadFSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAheadFSet.java similarity index 95% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AheadFSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAheadFSet.java index 47ed0ac25..7e6cbe29e 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AheadFSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAheadFSet.java @@ -40,13 +40,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class AheadFSet extends FSet { - public AheadFSet() { +class TAheadFSet extends TFSet { + public TAheadFSet() { super(-1); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { return stringIndex; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AltGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAltGroupQuantifierSet.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AltGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAltGroupQuantifierSet.java index c27b4193f..37a56020f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AltGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAltGroupQuantifierSet.java @@ -40,13 +40,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class AltGroupQuantifierSet extends GroupQuantifierSet { - public AltGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { +class TAltGroupQuantifierSet extends TGroupQuantifierSet { + public TAltGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) { super(innerSet, next, type); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { if (!innerSet.hasConsumed(matchResult)) return next.matches(stringIndex, testString, matchResult); @@ -60,7 +60,7 @@ class AltGroupQuantifierSet extends GroupQuantifierSet { } @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { super.setNext(next); innerSet.setNext(next); } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AltQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAltQuantifierSet.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AltQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAltQuantifierSet.java index 8c476ec57..7dae4eb19 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AltQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAltQuantifierSet.java @@ -40,14 +40,14 @@ package org.teavm.classlib.java.util.regex; * * @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); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int shift = 0; if ((shift = innerSet.matches(stringIndex, testString, matchResult)) >= 0) { @@ -58,7 +58,7 @@ class AltQuantifierSet extends LeafQuantifierSet { } @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { super.setNext(next); innerSet.setNext(next); } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AtomicFSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAtomicFSet.java similarity index 92% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AtomicFSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAtomicFSet.java index 9396a9e6a..5331e6a78 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AtomicFSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAtomicFSet.java @@ -38,16 +38,16 @@ package org.teavm.classlib.java.util.regex; /** * @author Nikolay A. Kuznetsov */ -class AtomicFSet extends FSet { +class TAtomicFSet extends TFSet { int index; - public AtomicFSet(int groupIndex) { + public TAtomicFSet(int groupIndex) { super(groupIndex); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int gr = getGroupIndex(); matchResult.setConsumed(gr, stringIndex - matchResult.getConsumed(gr)); @@ -66,7 +66,7 @@ class AtomicFSet extends FSet { } @Override - public boolean hasConsumed(MatchResultImpl mr) { + public boolean hasConsumed(TMatchResultImpl mr) { return false; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AtomicJointSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAtomicJointSet.java similarity index 87% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AtomicJointSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAtomicJointSet.java index 92fa543ba..1a83280d0 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/AtomicJointSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TAtomicJointSet.java @@ -43,8 +43,8 @@ import java.util.ArrayList; * * @author Nikolay A. Kuznetsov */ -class AtomicJointSet extends NonCapJointSet { - public AtomicJointSet(ArrayList children, FSet fSet) { +class TAtomicJointSet extends TNonCapJointSet { + public TAtomicJointSet(ArrayList children, TFSet fSet) { super(children, fSet); } @@ -52,18 +52,18 @@ class AtomicJointSet extends NonCapJointSet { * Returns stringIndex+shift, the next position to match */ @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int start = matchResult.getConsumed(groupIndex); matchResult.setConsumed(groupIndex, stringIndex); int size = children.size(); for (int i = 0; i < size; i++) { - AbstractSet e = children.get(i); + TAbstractSet e = children.get(i); int shift = e.matches(stringIndex, testString, matchResult); if (shift >= 0) { // AtomicFset always returns true, but saves the index to run // 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 - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return next; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BackReferenceSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBackReferenceSet.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BackReferenceSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBackReferenceSet.java index c7cd45de1..937b2672f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BackReferenceSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBackReferenceSet.java @@ -40,14 +40,14 @@ package org.teavm.classlib.java.util.regex; * * @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); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { String group = getString(matchResult); if (group == null || (stringIndex + group.length()) > matchResult.getRightBound()) return -1; @@ -61,7 +61,7 @@ class BackReferenceSet extends CIBackReferenceSet { } @Override - public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) { String group = getString(matchResult); int strLength = matchResult.getLeftBound(); @@ -86,7 +86,7 @@ class BackReferenceSet extends CIBackReferenceSet { } @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); if (group == null) @@ -109,12 +109,12 @@ class BackReferenceSet extends CIBackReferenceSet { } @Override - public boolean first(AbstractSet set) { + public boolean first(TAbstractSet set) { return true; } @Override public String getName() { - return "back reference: " + this.groupIndex; //$NON-NLS-1$ + return "back reference: " + this.groupIndex; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BackReferencedSingleSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBackReferencedSingleSet.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BackReferencedSingleSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBackReferencedSingleSet.java index 3578288dd..083c73074 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BackReferencedSingleSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBackReferencedSingleSet.java @@ -41,7 +41,7 @@ package org.teavm.classlib.java.util.regex; * group is referenced via backreference. */ -class BackReferencedSingleSet extends SingleSet { +class TBackReferencedSingleSet extends TSingleSet { /* * 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. */ - public BackReferencedSingleSet(AbstractSet child, FSet fSet) { + public TBackReferencedSingleSet(TAbstractSet child, TFSet fSet) { super(child, fSet); } - public BackReferencedSingleSet(SingleSet node) { - super(node.kid, ((FSet)node.fSet)); + public TBackReferencedSingleSet(TSingleSet node) { + super(node.kid, ((TFSet)node.fSet)); } @Override - public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int res = 0; int lastIndex = matchResult.getRightBound(); int startSearch = stringIndex; @@ -88,7 +88,7 @@ class BackReferencedSingleSet extends SingleSet { } @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 startSearch = lastIndex; @@ -115,7 +115,7 @@ class BackReferencedSingleSet extends SingleSet { * - node who references to this node */ @Override - public JointSet processBackRefReplacement() { + public TJointSet processBackRefReplacement() { return null; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BehindFSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBehindFSet.java similarity index 93% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BehindFSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBehindFSet.java index 517571574..cfd5ffaca 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/BehindFSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TBehindFSet.java @@ -42,13 +42,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class BehindFSet extends FSet { - public BehindFSet(int groupIndex) { +class TBehindFSet extends TFSet { + public TBehindFSet(int groupIndex) { super(groupIndex); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int gr = getGroupIndex(); int rightBound = matchResult.getConsumed(gr); @@ -57,6 +57,6 @@ class BehindFSet extends FSet { @Override protected String getName() { - return "BehindFSet"; //$NON-NLS-1$ + return "BehindFSet"; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CIBackReferenceSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCIBackReferenceSet.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CIBackReferenceSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCIBackReferenceSet.java index 0e517834d..bfd34251c 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CIBackReferenceSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCIBackReferenceSet.java @@ -40,11 +40,11 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class CIBackReferenceSet extends JointSet { +class TCIBackReferenceSet extends TJointSet { protected int referencedGroup; protected int consCounter; - public CIBackReferenceSet(int groupIndex, int consCounter) { + public TCIBackReferenceSet(int groupIndex, int consCounter) { this.referencedGroup = groupIndex; this.consCounter = consCounter; } @@ -54,7 +54,7 @@ class CIBackReferenceSet extends JointSet { } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { String group = getString(matchResult); if (group == null || (stringIndex + group.length()) > matchResult.getRightBound()) @@ -71,16 +71,16 @@ class CIBackReferenceSet extends JointSet { } @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } - protected String getString(MatchResultImpl matchResult) { + protected String getString(TMatchResultImpl matchResult) { String res = matchResult.getGroupNoCheck(referencedGroup); return res; } @@ -91,7 +91,7 @@ class CIBackReferenceSet extends JointSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { int cons; boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); matchResult.setConsumed(consCounter, -1); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CICharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCICharSet.java similarity index 96% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CICharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCICharSet.java index 31cdae8bb..f73cd948f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CICharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCICharSet.java @@ -40,13 +40,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class CICharSet extends LeafSet { +class TCICharSet extends TLeafSet { private char ch; private char supplement; - public CICharSet(char ch) { + public TCICharSet(char ch) { this.ch = ch; this.supplement = TPattern.getSupplement(ch); } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CIDecomposedCharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCIDecomposedCharSet.java similarity index 92% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CIDecomposedCharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCIDecomposedCharSet.java index 24204e94c..221495964 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CIDecomposedCharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCIDecomposedCharSet.java @@ -39,12 +39,12 @@ package org.teavm.classlib.java.util.regex; * CANON_EQ flag of Pattern class * is specified. */ -class CIDecomposedCharSet extends DecomposedCharSet{ +class TCIDecomposedCharSet extends TDecomposedCharSet { /* * Just only a stub */ - public CIDecomposedCharSet(int [] decomp, int decomposedCharLength) { + public TCIDecomposedCharSet(int [] decomp, int decomposedCharLength) { super(decomp, decomposedCharLength); } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CISequenceSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCISequenceSet.java similarity index 96% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CISequenceSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCISequenceSet.java index 1f564b966..3aeb9d8de 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CISequenceSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCISequenceSet.java @@ -40,10 +40,10 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class CISequenceSet extends LeafSet { +class TCISequenceSet extends TLeafSet { private String string = null; - CISequenceSet(StringBuffer substring) { + TCISequenceSet(StringBuffer substring) { this.string = substring.toString(); this.charCount = substring.length(); } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CharClass.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCharClass.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CharClass.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCharClass.java index 5f2578cca..7729d3e85 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CharClass.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCharClass.java @@ -43,7 +43,7 @@ import java.util.BitSet; * * @author Nikolay A. Kuznetsov */ -class CharClass extends AbstractCharClass { +class TCharClass extends TAbstractCharClass { // Flag indicates if we add supplement upper/lower case boolean ci = false; @@ -60,17 +60,17 @@ class CharClass extends AbstractCharClass { 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.uci = uci; } - public CharClass(boolean negative, boolean ci, boolean uci) { + public TCharClass(boolean negative, boolean ci, boolean uci) { this(ci, uci); setNegative(negative); } @@ -79,7 +79,7 @@ class CharClass extends AbstractCharClass { * We can use this method safely even if nonBitSet != null due to specific * of range constructions in regular expressions. */ - public CharClass add(int ch) { + public TCharClass add(int ch) { if (ci) { if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { 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) { lowHighSurrogates.set(ch - Character.MIN_SURROGATE); } else { @@ -120,7 +120,7 @@ class CharClass extends AbstractCharClass { * "[^abc\\d]" (this pattern doesn't match "1") while union is used for * constructions like "[^abc[\\d]]" (this pattern matches "1"). */ - public CharClass add(final AbstractCharClass cc) { + public TCharClass add(final TAbstractCharClass cc) { if (!mayContainSupplCodepoints && cc.mayContainSupplCodepoints) { mayContainSupplCodepoints = true; @@ -182,7 +182,7 @@ class CharClass extends AbstractCharClass { if (nonBitSet == null) { if (curAlt && !inverted && bits.isEmpty()) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return cc.contains(ch); @@ -196,7 +196,7 @@ class CharClass extends AbstractCharClass { * [^[abc]fgb] by using the formula a ^ b == !a ^ !b. */ if (curAlt) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return !((curAlt ^ bits.get(ch)) || ((curAlt ^ inverted) ^ cc.contains(ch))); @@ -204,7 +204,7 @@ class CharClass extends AbstractCharClass { }; // alt = true } else { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return (curAlt ^ bits.get(ch)) || ((curAlt ^ inverted) ^ cc.contains(ch)); @@ -216,10 +216,10 @@ class CharClass extends AbstractCharClass { hideBits = true; } else { - final AbstractCharClass nb = nonBitSet; + final TAbstractCharClass nb = nonBitSet; if (curAlt) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return !(curAlt ^ (nb.contains(ch) || cc.contains(ch))); @@ -227,7 +227,7 @@ class CharClass extends AbstractCharClass { }; // alt = true } else { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return curAlt ^ (nb.contains(ch) || cc.contains(ch)); @@ -241,7 +241,7 @@ class CharClass extends AbstractCharClass { return this; } - public CharClass add(int st, int end) { + public TCharClass add(int st, int end) { if (st > end) throw new IllegalArgumentException(); if (!ci @@ -263,7 +263,7 @@ class CharClass extends AbstractCharClass { } // OR operation - public void union(final AbstractCharClass clazz) { + public void union(final TAbstractCharClass clazz) { if (!mayContainSupplCodepoints && clazz.mayContainSupplCodepoints) { mayContainSupplCodepoints = true; } @@ -328,7 +328,7 @@ class CharClass extends AbstractCharClass { if (!inverted && bits.isEmpty()) { if (curAlt) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return !clazz.contains(ch); @@ -336,7 +336,7 @@ class CharClass extends AbstractCharClass { }; // alt = true } else { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return clazz.contains(ch); @@ -347,7 +347,7 @@ class CharClass extends AbstractCharClass { } else { if (curAlt) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return !(clazz.contains(ch) || (curAlt ^ bits.get(ch))); @@ -355,7 +355,7 @@ class CharClass extends AbstractCharClass { }; // alt = true } else { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return clazz.contains(ch) || (curAlt ^ bits.get(ch)); @@ -366,10 +366,10 @@ class CharClass extends AbstractCharClass { } hideBits = true; } else { - final AbstractCharClass nb = nonBitSet; + final TAbstractCharClass nb = nonBitSet; if (curAlt) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return !((curAlt ^ nb.contains(ch)) || clazz.contains(ch)); @@ -377,7 +377,7 @@ class CharClass extends AbstractCharClass { }; // alt = true } else { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return (curAlt ^ nb.contains(ch)) || clazz.contains(ch); @@ -390,7 +390,7 @@ class CharClass extends AbstractCharClass { } // AND operation - public void intersection(final AbstractCharClass clazz) { + public void intersection(final TAbstractCharClass clazz) { if (!mayContainSupplCodepoints && clazz.mayContainSupplCodepoints) { mayContainSupplCodepoints = true; } @@ -454,7 +454,7 @@ class CharClass extends AbstractCharClass { if (!inverted && bits.isEmpty()) { if (curAlt) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return !clazz.contains(ch); @@ -462,7 +462,7 @@ class CharClass extends AbstractCharClass { }; // alt = true } else { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return clazz.contains(ch); @@ -473,7 +473,7 @@ class CharClass extends AbstractCharClass { } else { if (curAlt) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return !(clazz.contains(ch) && (curAlt ^ bits.get(ch))); @@ -481,7 +481,7 @@ class CharClass extends AbstractCharClass { }; // alt = true } else { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return clazz.contains(ch) && (curAlt ^ bits.get(ch)); @@ -492,10 +492,10 @@ class CharClass extends AbstractCharClass { } hideBits = true; } else { - final AbstractCharClass nb = nonBitSet; + final TAbstractCharClass nb = nonBitSet; if (curAlt) { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return !((curAlt ^ nb.contains(ch)) && clazz.contains(ch)); @@ -503,7 +503,7 @@ class CharClass extends AbstractCharClass { }; // alt = true } else { - nonBitSet = new AbstractCharClass() { + nonBitSet = new TAbstractCharClass() { @Override public boolean contains(int ch) { return (curAlt ^ nb.contains(ch)) && clazz.contains(ch); @@ -550,12 +550,12 @@ class CharClass extends AbstractCharClass { } @Override - public AbstractCharClass getInstance() { + public TAbstractCharClass getInstance() { if (nonBitSet == null) { final BitSet bs = getBits(); - AbstractCharClass res = new AbstractCharClass() { + TAbstractCharClass res = new TAbstractCharClass() { @Override public boolean contains(int ch) { return this.alt ^ bs.get(ch); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCharSet.java similarity index 84% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCharSet.java index 4a9d36881..7ab24de04 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCharSet.java @@ -40,11 +40,11 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class CharSet extends LeafSet { +class TCharSet extends TLeafSet { private char ch = 0; - public CharSet(char ch) { + public TCharSet(char ch) { this.ch = ch; } @@ -59,7 +59,7 @@ class CharSet extends LeafSet { } @Override - public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) { if (testString instanceof String) { String testStr = (String)testString; int strLength = matchResult.getRightBound(); @@ -81,7 +81,7 @@ class CharSet extends LeafSet { } @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) { String testStr = (String)testString; @@ -114,14 +114,14 @@ class CharSet extends LeafSet { } @Override - public boolean first(AbstractSet set) { - if (set instanceof CharSet) { - return ((CharSet)set).getChar() == ch; - } else if (set instanceof RangeSet) { - return ((RangeSet)set).accepts(0, Character.toString(ch)) > 0; - } else if (set instanceof SupplRangeSet) { - return ((SupplRangeSet)set).contains(ch); - } else if (set instanceof SupplCharSet) { + public boolean first(TAbstractSet set) { + if (set instanceof TCharSet) { + return ((TCharSet)set).getChar() == ch; + } else if (set instanceof TRangeSet) { + return ((TRangeSet)set).accepts(0, Character.toString(ch)) > 0; + } else if (set instanceof TSupplRangeSet) { + return ((TSupplRangeSet)set).contains(ch); + } else if (set instanceof TSupplCharSet) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeGroupQuantifierSet.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeGroupQuantifierSet.java index 425053726..09cbfca29 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeGroupQuantifierSet.java @@ -40,9 +40,9 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class CompositeGroupQuantifierSet extends GroupQuantifierSet { +class TCompositeGroupQuantifierSet extends TGroupQuantifierSet { - protected Quantifier quantifier = null; + protected TQuantifier quantifier = null; int setCounter; @@ -56,7 +56,7 @@ class CompositeGroupQuantifierSet extends GroupQuantifierSet { * @param next * - 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) { super(innerSet, next, type); this.quantifier = quant; @@ -64,7 +64,7 @@ class CompositeGroupQuantifierSet extends GroupQuantifierSet { } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int enterCounter = matchResult.getEnterCounter(setCounter); if (!innerSet.hasConsumed(matchResult)) @@ -102,7 +102,7 @@ class CompositeGroupQuantifierSet extends GroupQuantifierSet { return quantifier.toString(); } - void setQuantifier(Quantifier quant) { + void setQuantifier(TQuantifier quant) { this.quantifier = quant; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeQuantifierSet.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeQuantifierSet.java index f240b1763..3b83d7ae1 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeQuantifierSet.java @@ -40,17 +40,17 @@ package org.teavm.classlib.java.util.regex; * * @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); this.quantifier = quant; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int min = quantifier.min(); int max = quantifier.max(); int i = 0; @@ -98,7 +98,7 @@ class CompositeQuantifierSet extends LeafQuantifierSet { return quantifier.toString(); } - void setQuantifier(Quantifier quant) { + void setQuantifier(TQuantifier quant) { this.quantifier = quant; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeRangeSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeRangeSet.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeRangeSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeRangeSet.java index 3bb3f0307..3e4228a74 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/CompositeRangeSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TCompositeRangeSet.java @@ -103,21 +103,21 @@ package org.teavm.classlib.java.util.regex; * consisting of all others characters from the parent range. This class * represents the parent range split in such a manner. */ -class CompositeRangeSet extends JointSet { +class TCompositeRangeSet extends TJointSet { // range without surrogates - AbstractSet withoutSurrogates; + TAbstractSet withoutSurrogates; // 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.withSurrogates = withSurrogates; setNext(next); } - public CompositeRangeSet(AbstractSet withoutSurrogates, AbstractSet withSurrogates) { + public TCompositeRangeSet(TAbstractSet withoutSurrogates, TAbstractSet withSurrogates) { this.withoutSurrogates = withoutSurrogates; this.withSurrogates = withSurrogates; } @@ -126,12 +126,12 @@ class CompositeRangeSet extends JointSet { * Returns the next. */ @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @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); if (shift < 0) { @@ -151,17 +151,17 @@ class CompositeRangeSet extends JointSet { * The next to set. */ @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; withSurrogates.setNext(next); withoutSurrogates.setNext(next); } - public AbstractSet getSurrogates() { + public TAbstractSet getSurrogates() { return withSurrogates; } - public AbstractSet getWithoutSurrogates() { + public TAbstractSet getWithoutSurrogates() { return withoutSurrogates; } @@ -171,12 +171,12 @@ class CompositeRangeSet extends JointSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return true; } @Override - public boolean first(AbstractSet set) { + public boolean first(TAbstractSet set) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DecomposedCharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDecomposedCharSet.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DecomposedCharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDecomposedCharSet.java index 54559ebe8..b1248adca 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DecomposedCharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDecomposedCharSet.java @@ -21,7 +21,7 @@ package org.teavm.classlib.java.util.regex; * Represents canonical decomposition of Unicode character. Is used when * 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 @@ -45,7 +45,7 @@ class DecomposedCharSet extends JointSet { */ private int decomposedCharLength; - public DecomposedCharSet(int[] decomposedChar, int decomposedCharLength) { + public TDecomposedCharSet(int[] decomposedChar, int decomposedCharLength) { this.decomposedChar = decomposedChar; this.decomposedCharLength = decomposedCharLength; } @@ -54,7 +54,7 @@ class DecomposedCharSet extends JointSet { * Returns the next. */ @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @@ -65,19 +65,19 @@ class DecomposedCharSet extends JointSet { * The next to set. */ @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @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 * Lexer.MAX_DECOMPOSITION_LENGTH */ int[] decCurCodePoint; - int[] decCodePoint = new int[Lexer.MAX_DECOMPOSITION_LENGTH]; + int[] decCodePoint = new int[TLexer.MAX_DECOMPOSITION_LENGTH]; int readCodePoints = 0; int rightBound = matchResult.getRightBound(); int curChar; @@ -93,7 +93,7 @@ class DecomposedCharSet extends JointSet { */ curChar = codePointAt(strIndex, testString, rightBound); strIndex += readCharsForCodePoint; - decCurCodePoint = Lexer.getDecomposition(curChar); + decCurCodePoint = TLexer.getDecomposition(curChar); if (decCurCodePoint == null) { decCodePoint[readCodePoints++] = curChar; } else { @@ -109,9 +109,9 @@ class DecomposedCharSet extends JointSet { * Read testString until we met a decomposed char boundary and * 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 @@ -119,7 +119,7 @@ class DecomposedCharSet extends JointSet { * consideration, but general rule is: if canonical class != * 0 then no decomposition */ - decCurCodePoint = Lexer.getDecomposition(curChar); + decCurCodePoint = TLexer.getDecomposition(curChar); /* * Length of such decomposition is 1 or 2. See UnicodeData @@ -156,8 +156,8 @@ class DecomposedCharSet extends JointSet { break; case 3: - int i1 = Lexer.getCanonicalClass(decCodePoint[1]); - int i2 = Lexer.getCanonicalClass(decCodePoint[2]); + int i1 = TLexer.getCanonicalClass(decCodePoint[1]); + int i2 = TLexer.getCanonicalClass(decCodePoint[2]); if ((i2 != 0) && (i1 > i2)) { i1 = decCodePoint[1]; @@ -167,7 +167,7 @@ class DecomposedCharSet extends JointSet { break; default: - decCodePoint = Lexer.getCanonicalOrder(decCodePoint, readCodePoints); + decCodePoint = TLexer.getCanonicalOrder(decCodePoint, readCodePoints); } /* @@ -248,13 +248,13 @@ class DecomposedCharSet extends JointSet { } @Override - public boolean first(AbstractSet set) { - return (set instanceof DecomposedCharSet) ? ((DecomposedCharSet)set).getDecomposedChar().equals( + public boolean first(TAbstractSet set) { + return (set instanceof TDecomposedCharSet) ? ((TDecomposedCharSet)set).getDecomposedChar().equals( getDecomposedChar()) : true; } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotAllQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotAllQuantifierSet.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotAllQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotAllQuantifierSet.java index e11126a08..a2c1e9889 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotAllQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotAllQuantifierSet.java @@ -26,14 +26,14 @@ package org.teavm.classlib.java.util.regex; * * @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); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); @@ -44,7 +44,7 @@ class DotAllQuantifierSet extends QuantifierSet { } @Override - public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); if (next.findBack(stringIndex, strLength, testString, matchResult) >= 0) { return stringIndex; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotAllSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotAllSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotAllSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotAllSet.java index 87a135a2f..498405205 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotAllSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotAllSet.java @@ -25,10 +25,10 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class DotAllSet extends JointSet { +class TDotAllSet extends TJointSet { @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); if (stringIndex + 1 > strLength) { @@ -54,22 +54,22 @@ class DotAllSet extends JointSet { } @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @Override public int getType() { - return AbstractSet.TYPE_DOTSET; + return TAbstractSet.TYPE_DOTSET; } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotQuantifierSet.java similarity index 93% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotQuantifierSet.java index 09e74e0b6..ed9d43bc6 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotQuantifierSet.java @@ -26,17 +26,17 @@ package org.teavm.classlib.java.util.regex; * * @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); this.lt = lt; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); @@ -54,7 +54,7 @@ class DotQuantifierSet extends QuantifierSet { } @Override - public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { // String testStr = testString.toString(); int strLength = matchResult.getRightBound(); // 1. skip line terminators ??? diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotSet.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotSet.java index 25086e364..2939181fd 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/DotSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TDotSet.java @@ -25,17 +25,17 @@ package org.teavm.classlib.java.util.regex; * * @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(); this.lt = lt; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); if (stringIndex + 1 > strLength) { @@ -62,22 +62,22 @@ final class DotSet extends JointSet { } @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @Override public int getType() { - return AbstractSet.TYPE_DOTSET; + return TAbstractSet.TYPE_DOTSET; } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EOISet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEOISet.java similarity index 92% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EOISet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEOISet.java index bb554b1ec..fcd8b4e00 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EOISet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEOISet.java @@ -25,10 +25,10 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class EOISet extends AbstractSet { +class TEOISet extends TAbstractSet { @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(); if (stringIndex < rightBound) return -1; @@ -43,7 +43,7 @@ class EOISet extends AbstractSet { * Returns false, enough for quantifiers */ @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EOLSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEOLSet.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EOLSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEOLSet.java index f94414dfd..c264c039a 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EOLSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEOLSet.java @@ -25,15 +25,15 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -final class EOLSet extends AbstractSet { +final class TEOLSet extends TAbstractSet { private int consCounter; - public EOLSet(int counter) { + public TEOLSet(int counter) { this.consCounter = counter; } @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(); if (strIndex >= rightBound) { @@ -59,7 +59,7 @@ final class EOLSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { int cons; boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); matchResult.setConsumed(consCounter, -1); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EmptySet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEmptySet.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EmptySet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEmptySet.java index 8e092b52c..2467a7570 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/EmptySet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TEmptySet.java @@ -25,8 +25,8 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class EmptySet extends LeafSet { - public EmptySet(AbstractSet next) { +class TEmptySet extends TLeafSet { + public TEmptySet(TAbstractSet next) { super(next); charCount = 0; } @@ -37,7 +37,7 @@ class EmptySet extends LeafSet { } @Override - public int find(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); int startStr = matchResult.getLeftBound(); @@ -69,7 +69,7 @@ class EmptySet extends LeafSet { } @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 startStr = matchResult.getLeftBound(); @@ -106,7 +106,7 @@ class EmptySet extends LeafSet { } @Override - public boolean hasConsumed(MatchResultImpl mr) { + public boolean hasConsumed(TMatchResultImpl mr) { return false; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/FSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TFSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/FSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TFSet.java index 0d829a366..9b2ca8cc7 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/FSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TFSet.java @@ -25,7 +25,7 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class FSet extends AbstractSet { +class TFSet extends TAbstractSet { static PossessiveFSet posFSet = new PossessiveFSet(); @@ -33,12 +33,12 @@ class FSet extends AbstractSet { private int groupIndex; - public FSet(int groupIndex) { + public TFSet(int groupIndex) { this.groupIndex = groupIndex; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int end = matchResult.getEnd(groupIndex); matchResult.setEnd(groupIndex, stringIndex); int shift = next.matches(stringIndex, testString, matchResult); @@ -61,7 +61,7 @@ class FSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl mr) { + public boolean hasConsumed(TMatchResultImpl mr) { return false; } @@ -70,10 +70,10 @@ class FSet extends AbstractSet { * kickbacks(required for atomic groups, for instance) * */ - static class PossessiveFSet extends AbstractSet { + static class PossessiveFSet extends TAbstractSet { @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { return stringIndex; } @@ -83,7 +83,7 @@ class FSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl mr) { + public boolean hasConsumed(TMatchResultImpl mr) { return false; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/FinalSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TFinalSet.java similarity index 94% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/FinalSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TFinalSet.java index d67ad03d2..8325d53c1 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/FinalSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TFinalSet.java @@ -25,14 +25,14 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class FinalSet extends FSet { +class TFinalSet extends TFSet { - public FinalSet() { + public TFinalSet() { super(0); } @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()) { matchResult.setValid(); matchResult.setEnd(0, stringIndex); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/GroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TGroupQuantifierSet.java similarity index 84% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/GroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TGroupQuantifierSet.java index 38c402cba..ca0c23037 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/GroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TGroupQuantifierSet.java @@ -26,19 +26,17 @@ package org.teavm.classlib.java.util.regex; * * @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); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { if (!innerSet.hasConsumed(matchResult)) - return next.matches(stringIndex, testString, matchResult);// return - // -1; - + return next.matches(stringIndex, testString, matchResult); int nextIndex = innerSet.matches(stringIndex, testString, matchResult); if (nextIndex < 0) { @@ -50,6 +48,6 @@ class GroupQuantifierSet extends QuantifierSet { @Override protected String getName() { - return ""; //$NON-NLS-1$ + return ""; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/HangulDecomposedCharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/THangulDecomposedCharSet.java similarity index 83% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/HangulDecomposedCharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/THangulDecomposedCharSet.java index 3a41acc93..44e121900 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/HangulDecomposedCharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/THangulDecomposedCharSet.java @@ -21,7 +21,7 @@ package org.teavm.classlib.java.util.regex; * Represents canonical decomposition of Hangul syllable. Is used when CANON_EQ * flag of Pattern class is specified. */ -class HangulDecomposedCharSet extends JointSet { +class THangulDecomposedCharSet extends TJointSet { /** * Decomposed Hangul syllable. @@ -39,7 +39,7 @@ class HangulDecomposedCharSet extends JointSet { */ private int decomposedCharLength; - public HangulDecomposedCharSet(char[] decomposedChar, int decomposedCharLength) { + public THangulDecomposedCharSet(char[] decomposedChar, int decomposedCharLength) { this.decomposedChar = decomposedChar; this.decomposedCharLength = decomposedCharLength; } @@ -48,7 +48,7 @@ class HangulDecomposedCharSet extends JointSet { * Returns the next. */ @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @@ -59,7 +59,7 @@ class HangulDecomposedCharSet extends JointSet { * The next to set. */ @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @@ -78,7 +78,7 @@ class HangulDecomposedCharSet extends JointSet { } @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 @@ -86,7 +86,7 @@ class HangulDecomposedCharSet extends JointSet { */ int rightBound = matchResult.getRightBound(); int SyllIndex = 0; - int[] decompSyllable = new int[Lexer.MAX_HANGUL_DECOMPOSITION_LENGTH]; + int[] decompSyllable = new int[TLexer.MAX_HANGUL_DECOMPOSITION_LENGTH]; int[] decompCurSymb; char curSymb; @@ -103,7 +103,7 @@ class HangulDecomposedCharSet extends JointSet { return -1; } curSymb = testString.charAt(strIndex++); - decompCurSymb = Lexer.getHangulDecomposition(curSymb); + decompCurSymb = TLexer.getHangulDecomposition(curSymb); if (decompCurSymb == null) { @@ -112,9 +112,9 @@ class HangulDecomposedCharSet extends JointSet { * testString. */ 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 @@ -124,10 +124,10 @@ class HangulDecomposedCharSet extends JointSet { if (strIndex < rightBound) { 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 @@ -140,10 +140,10 @@ class HangulDecomposedCharSet extends JointSet { if (strIndex < rightBound) { 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 @@ -182,13 +182,13 @@ class HangulDecomposedCharSet extends JointSet { } @Override - public boolean first(AbstractSet set) { - return (set instanceof HangulDecomposedCharSet) ? ((HangulDecomposedCharSet)set).getDecomposedChar().equals( + public boolean first(TAbstractSet set) { + return (set instanceof THangulDecomposedCharSet) ? ((THangulDecomposedCharSet)set).getDecomposedChar().equals( getDecomposedChar()) : true; } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/HighSurrogateCharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/THighSurrogateCharSet.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/HighSurrogateCharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/THighSurrogateCharSet.java index 911df1c88..c25bca1a6 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/HighSurrogateCharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/THighSurrogateCharSet.java @@ -85,7 +85,7 @@ package org.teavm.classlib.java.util.regex; /** * 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 @@ -95,7 +95,7 @@ class HighSurrogateCharSet extends JointSet { private char high; - public HighSurrogateCharSet(char high) { + public THighSurrogateCharSet(char high) { this.high = high; } @@ -103,7 +103,7 @@ class HighSurrogateCharSet extends JointSet { * Returns the next. */ @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @@ -114,12 +114,12 @@ class HighSurrogateCharSet extends JointSet { * The next to set. */ @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); if (stringIndex + 1 > strLength) { @@ -149,7 +149,7 @@ class HighSurrogateCharSet extends JointSet { } @Override - public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) { if (testString instanceof String) { String testStr = (String)testString; int strLength = matchResult.getRightBound(); @@ -185,7 +185,7 @@ class HighSurrogateCharSet extends JointSet { } @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) { String testStr = (String)testString; int strLength = matchResult.getRightBound(); @@ -231,26 +231,26 @@ class HighSurrogateCharSet extends JointSet { } @Override - public boolean first(AbstractSet set) { - if (set instanceof CharSet) { + public boolean first(TAbstractSet set) { + if (set instanceof TCharSet) { return false; - } else if (set instanceof RangeSet) { + } else if (set instanceof TRangeSet) { return false; - } else if (set instanceof SupplRangeSet) { + } else if (set instanceof TSupplRangeSet) { return false; - } else if (set instanceof SupplCharSet) { + } else if (set instanceof TSupplCharSet) { return false; - } else if (set instanceof LowSurrogateCharSet) { + } else if (set instanceof TLowSurrogateCharSet) { return false; - } else if (set instanceof HighSurrogateCharSet) { - return ((HighSurrogateCharSet)set).high == this.high; + } else if (set instanceof THighSurrogateCharSet) { + return ((THighSurrogateCharSet)set).high == this.high; } return true; } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/IntArrHash.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TIntArrHash.java similarity index 97% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/IntArrHash.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TIntArrHash.java index 8369f3be5..e6a6b178d 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/IntArrHash.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TIntArrHash.java @@ -20,14 +20,14 @@ package org.teavm.classlib.java.util.regex; /** * Hashtable implementation for int arrays. */ -class IntArrHash { +class TIntArrHash { final int[] table; final Object[] values; final int mask; - public IntArrHash(int size) { + public TIntArrHash(int size) { int tmpMask = 0; while (size >= tmpMask) { tmpMask = (tmpMask << 1) | 1; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/IntHash.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TIntHash.java similarity index 97% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/IntHash.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TIntHash.java index 295c04620..325c291fc 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/IntHash.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TIntHash.java @@ -20,7 +20,7 @@ package org.teavm.classlib.java.util.regex; /** * Hashtable implementation for int values. */ -class IntHash { +class TIntHash { int[] table; int[] values; @@ -29,7 +29,7 @@ class IntHash { int size; // maximum shift - public IntHash(int size) { + public TIntHash(int size) { while (size >= mask) { mask = (mask << 1) | 1; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/JointSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TJointSet.java similarity index 83% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/JointSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TJointSet.java index aeaf1ec1f..281d87bf8 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/JointSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TJointSet.java @@ -28,18 +28,18 @@ import java.util.Iterator; * think about "group" in this model as JointSet opening group and corresponding * FSet closing group. */ -class JointSet extends AbstractSet { +class TJointSet extends TAbstractSet { - protected ArrayList children; + protected ArrayList children; - protected AbstractSet fSet; + protected TAbstractSet fSet; protected int groupIndex; - protected JointSet() { + protected TJointSet() { } - public JointSet(ArrayList children, FSet fSet) { + public TJointSet(ArrayList children, TFSet fSet) { this.children = children; this.fSet = fSet; this.groupIndex = fSet.getGroupIndex(); @@ -49,7 +49,7 @@ class JointSet extends AbstractSet { * Returns stringIndex+shift, the next position to match */ @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { if (children == null) { return -1; } @@ -57,7 +57,7 @@ class JointSet extends AbstractSet { matchResult.setStart(groupIndex, stringIndex); int size = children.size(); for (int i = 0; i < size; i++) { - AbstractSet e = children.get(i); + TAbstractSet e = children.get(i); int shift = e.matches(stringIndex, testString, matchResult); if (shift >= 0) { return shift; @@ -68,12 +68,12 @@ class JointSet extends AbstractSet { } @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { fSet.setNext(next); } @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return fSet.getNext(); } @@ -87,9 +87,9 @@ class JointSet extends AbstractSet { } @Override - public boolean first(AbstractSet set) { + public boolean first(TAbstractSet set) { if (children != null) { - for (Iterator i = children.iterator(); i.hasNext();) { + for (Iterator i = children.iterator(); i.hasNext();) { if ((i.next()).first(set)) { return true; } @@ -100,7 +100,7 @@ class JointSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return !(matchResult.getEnd(groupIndex) >= 0 && matchResult.getStart(groupIndex) == matchResult .getEnd(groupIndex)); } @@ -121,8 +121,8 @@ class JointSet extends AbstractSet { int childrenSize = children.size(); for (int i = 0; i < childrenSize; i++) { - AbstractSet child = children.get(i); - JointSet set = child.processBackRefReplacement(); + TAbstractSet child = children.get(i); + TJointSet set = child.processBackRefReplacement(); if (set != null) { child.isSecondPassVisited = true; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LeafQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLeafQuantifierSet.java similarity index 85% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LeafQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLeafQuantifierSet.java index f68476eea..6b96c6197 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LeafQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLeafQuantifierSet.java @@ -23,17 +23,17 @@ package org.teavm.classlib.java.util.regex; /** * @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); this.leaf = innerSet; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int i = 0; int shift = 0; @@ -66,10 +66,10 @@ class LeafQuantifierSet extends QuantifierSet { * The innerSet to set. */ @Override - public void setInnerSet(AbstractSet innerSet) { - if (!(innerSet instanceof LeafSet)) + public void setInnerSet(TAbstractSet innerSet) { + if (!(innerSet instanceof TLeafSet)) throw new RuntimeException(""); super.setInnerSet(innerSet); - this.leaf = (LeafSet)innerSet; + this.leaf = (TLeafSet)innerSet; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LeafSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLeafSet.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LeafSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLeafSet.java index d517990b3..9d349dbd0 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LeafSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLeafSet.java @@ -26,16 +26,16 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -abstract class LeafSet extends AbstractSet { +abstract class TLeafSet extends TAbstractSet { protected int charCount = 1; - public LeafSet(AbstractSet next) { + public TLeafSet(TAbstractSet 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. */ @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { if (stringIndex + charCount() > matchResult.getRightBound()) { matchResult.hitEnd = true; @@ -74,7 +74,7 @@ abstract class LeafSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl mr) { + public boolean hasConsumed(TMatchResultImpl mr) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/Lexer.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLexer.java similarity index 95% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/Lexer.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLexer.java index 2b7d47a6a..4c4dde32f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/Lexer.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLexer.java @@ -27,7 +27,7 @@ import java.util.MissingResourceException; * * @author Nikolay A. Kuznetsov */ -class Lexer { +class TLexer { public static final int CHAR_DOLLAR = 0xe0000000 | '$'; @@ -145,10 +145,10 @@ class Lexer { static final int NCount = 588; // table that contains canonical decomposition mappings - private static IntArrHash decompTable = null; + private static TIntArrHash decompTable = null; // table that contains canonical combining classes - private static IntHash canonClassesTable = null; + private static TIntHash canonClassesTable = null; private static int canonClassesTableSize; @@ -156,7 +156,7 @@ class Lexer { * Table that contains information about Unicode codepoints with single * codepoint decomposition */ - private static IntHash singleDecompTable = null; + private static TIntHash singleDecompTable = null; private static int singleDecompTableSize; @@ -182,10 +182,10 @@ class Lexer { private int patternFullLength = 0; // cur special token - private SpecialToken curST = null; + private TSpecialToken curST = null; // next special token - private SpecialToken lookAheadST = null; + private TSpecialToken lookAheadST = null; // cur char being processed private int index = 0; @@ -202,12 +202,12 @@ class Lexer { // original string representing pattern private String orig = null; - public Lexer(String pattern, int flags) { + public TLexer(String pattern, int flags) { orig = pattern; if ((flags & TPattern.LITERAL) > 0) { pattern = TPattern.quote(pattern); } else if ((flags & TPattern.CANON_EQ) > 0) { - pattern = Lexer.normalize(pattern); + pattern = TLexer.normalize(pattern); } this.pattern = new char[pattern.length() + 2]; @@ -244,7 +244,7 @@ class Lexer { this.mode = mode; } - if (mode == Lexer.MODE_PATTERN) { + if (mode == TLexer.MODE_PATTERN) { reread(); } } @@ -265,7 +265,7 @@ class Lexer { movePointer(); } - public SpecialToken peekSpecial() { + public TSpecialToken peekSpecial() { return curST; } @@ -280,7 +280,7 @@ class Lexer { } public boolean isQuantifier() { - return isSpecial() && curST.getType() == SpecialToken.TOK_QUANTIFIER; + return isSpecial() && curST.getType() == TSpecialToken.TOK_QUANTIFIER; } public boolean isNextSpecial() { @@ -299,8 +299,8 @@ class Lexer { /** * Returns current special token and moves string index to the next one; */ - public SpecialToken nextSpecial() { - SpecialToken res = curST; + public TSpecialToken nextSpecial() { + TSpecialToken res = curST; movePointer(); return res; } @@ -409,7 +409,7 @@ class Lexer { lookAhead = (index < pattern.length) ? nextCodePoint() : 0; lookAheadST = null; - if (mode == Lexer.MODE_ESCAPE) { + if (mode == TLexer.MODE_ESCAPE) { if (lookAhead == '\\') { // need not care about supplementary codepoints here @@ -448,7 +448,7 @@ class Lexer { if (lookAhead == 'P') negative = true; try { - lookAheadST = AbstractCharClass.getPredefinedClass(cs, negative); + lookAheadST = TAbstractCharClass.getPredefinedClass(cs, negative); } catch (MissingResourceException mre) { throw new TPatternSyntaxException("", this.toString(), index); } @@ -462,14 +462,14 @@ class Lexer { case 'W': case 'S': case 'D': { - lookAheadST = CharClass.getPredefinedClass(new String(pattern, prevNW, 1), false); + lookAheadST = TCharClass.getPredefinedClass(new String(pattern, prevNW, 1), false); lookAhead = 0; break; } case 'Q': { saved_mode = mode; - mode = Lexer.MODE_ESCAPE; + mode = TLexer.MODE_ESCAPE; reread = true; break; } @@ -502,7 +502,7 @@ class Lexer { case '7': case '8': case '9': { - if (mode == Lexer.MODE_PATTERN) { + if (mode == TLexer.MODE_PATTERN) { lookAhead = 0x80000000 | lookAhead; } break; @@ -578,7 +578,7 @@ class Lexer { default: break; } - } else if (mode == Lexer.MODE_PATTERN) { + } else if (mode == TLexer.MODE_PATTERN) { switch (lookAhead) { case '+': case '*': @@ -586,17 +586,17 @@ class Lexer { char mod = (index < pattern.length) ? pattern[index] : '*'; switch (mod) { case '+': { - lookAhead = lookAhead | Lexer.QMOD_POSSESSIVE; + lookAhead = lookAhead | TLexer.QMOD_POSSESSIVE; nextIndex(); break; } case '?': { - lookAhead = lookAhead | Lexer.QMOD_RELUCTANT; + lookAhead = lookAhead | TLexer.QMOD_RELUCTANT; nextIndex(); break; } default: { - lookAhead = lookAhead | Lexer.QMOD_GREEDY; + lookAhead = lookAhead | TLexer.QMOD_GREEDY; break; } } @@ -688,11 +688,11 @@ class Lexer { break; case '[': { lookAhead = CHAR_LEFT_SQUARE_BRACKET; - setMode(Lexer.MODE_RANGE); + setMode(TLexer.MODE_RANGE); break; } case ']': { - if (mode == Lexer.MODE_RANGE) { + if (mode == TLexer.MODE_RANGE) { lookAhead = CHAR_RIGHT_SQUARE_BRACKET; } break; @@ -709,7 +709,7 @@ class Lexer { default: break; } - } else if (mode == Lexer.MODE_RANGE) { + } else if (mode == TLexer.MODE_RANGE) { switch (lookAhead) { case '[': lookAhead = CHAR_LEFT_SQUARE_BRACKET; @@ -765,7 +765,7 @@ class Lexer { /** * Process given character in assumption that it's quantifier. */ - private Quantifier processQuantifier(int ch) { + private TQuantifier processQuantifier(int ch) { StringBuilder sb = new StringBuilder(4); int min = -1; int max = Integer.MAX_VALUE; @@ -803,18 +803,18 @@ class Lexer { switch (mod) { case '+': - lookAhead = Lexer.QUANT_COMP_P; + lookAhead = TLexer.QUANT_COMP_P; nextIndex(); break; case '?': - lookAhead = Lexer.QUANT_COMP_R; + lookAhead = TLexer.QUANT_COMP_R; nextIndex(); break; default: - lookAhead = Lexer.QUANT_COMP; + lookAhead = TLexer.QUANT_COMP; break; } - return new Quantifier(min, max); + return new TQuantifier(min, max); } @Override diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LowHighSurrogateRangeSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLowHighSurrogateRangeSet.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LowHighSurrogateRangeSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLowHighSurrogateRangeSet.java index b9db75eb0..09fc8d517 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LowHighSurrogateRangeSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLowHighSurrogateRangeSet.java @@ -85,19 +85,19 @@ package org.teavm.classlib.java.util.regex; /* * 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; - public LowHighSurrogateRangeSet(AbstractCharClass surrChars, AbstractSet next) { + public TLowHighSurrogateRangeSet(TAbstractCharClass surrChars, TAbstractSet next) { this.surrChars = surrChars.getInstance(); this.alt = surrChars.alt; setNext(next); } - public LowHighSurrogateRangeSet(AbstractCharClass surrChars) { + public TLowHighSurrogateRangeSet(TAbstractCharClass surrChars) { this.surrChars = surrChars.getInstance(); this.alt = surrChars.alt; } @@ -106,7 +106,7 @@ class LowHighSurrogateRangeSet extends JointSet { * Returns the next. */ @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @@ -117,7 +117,7 @@ class LowHighSurrogateRangeSet extends JointSet { * The next to set. */ @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @@ -125,7 +125,7 @@ class LowHighSurrogateRangeSet extends JointSet { * Returns stringIndex+shift, the next position to match */ @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int startStr = matchResult.getLeftBound(); int strLength = matchResult.getRightBound(); @@ -169,26 +169,26 @@ class LowHighSurrogateRangeSet extends JointSet { } @Override - public boolean first(AbstractSet set) { - if (set instanceof CharSet) { + public boolean first(TAbstractSet set) { + if (set instanceof TCharSet) { return false; - } else if (set instanceof RangeSet) { + } else if (set instanceof TRangeSet) { return false; - } else if (set instanceof SupplRangeSet) { + } else if (set instanceof TSupplRangeSet) { return false; - } else if (set instanceof SupplCharSet) { + } else if (set instanceof TSupplCharSet) { return false; } return true; } - protected AbstractCharClass getChars() { + protected TAbstractCharClass getChars() { return surrChars; } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LowSurrogateCharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLowSurrogateCharSet.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LowSurrogateCharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLowSurrogateCharSet.java index 5af40e9c0..9f5356505 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/LowSurrogateCharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TLowSurrogateCharSet.java @@ -85,7 +85,7 @@ package org.teavm.classlib.java.util.regex; /** * 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 @@ -94,7 +94,7 @@ class LowSurrogateCharSet extends JointSet { */ private char low; - public LowSurrogateCharSet(char low) { + public TLowSurrogateCharSet(char low) { this.low = low; } @@ -102,7 +102,7 @@ class LowSurrogateCharSet extends JointSet { * Returns the next. */ @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return this.next; } @@ -113,12 +113,12 @@ class LowSurrogateCharSet extends JointSet { * The next to set. */ @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { if (stringIndex + 1 > matchResult.getRightBound()) { matchResult.hitEnd = true; @@ -147,7 +147,7 @@ class LowSurrogateCharSet extends JointSet { } @Override - public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) { if (testString instanceof String) { String testStr = (String)testString; int startStr = matchResult.getLeftBound(); @@ -184,7 +184,7 @@ class LowSurrogateCharSet extends JointSet { } @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) { int startStr = matchResult.getLeftBound(); String testStr = (String)testString; @@ -230,26 +230,26 @@ class LowSurrogateCharSet extends JointSet { } @Override - public boolean first(AbstractSet set) { - if (set instanceof CharSet) { + public boolean first(TAbstractSet set) { + if (set instanceof TCharSet) { return false; - } else if (set instanceof RangeSet) { + } else if (set instanceof TRangeSet) { return false; - } else if (set instanceof SupplRangeSet) { + } else if (set instanceof TSupplRangeSet) { return false; - } else if (set instanceof SupplCharSet) { + } else if (set instanceof TSupplCharSet) { return false; - } else if (set instanceof HighSurrogateCharSet) { + } else if (set instanceof THighSurrogateCharSet) { return false; - } else if (set instanceof LowSurrogateCharSet) { - return ((LowSurrogateCharSet)set).low == this.low; + } else if (set instanceof TLowSurrogateCharSet) { + return ((TLowSurrogateCharSet)set).low == this.low; } return true; } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MatchResultImpl.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMatchResultImpl.java similarity index 95% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MatchResultImpl.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMatchResultImpl.java index 52d136723..828bf5a46 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MatchResultImpl.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMatchResultImpl.java @@ -28,7 +28,7 @@ import java.util.Arrays; * * @author Nikolay A. Kuznetsov */ -class MatchResultImpl implements TMatchResult { +class TMatchResultImpl implements TMatchResult { private int[] groupBounds = null; @@ -60,7 +60,7 @@ class MatchResultImpl implements TMatchResult { 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) { this.groupCount = ++groupCount; this.groupBounds = new int[groupCount * 2]; @@ -75,7 +75,7 @@ class MatchResultImpl implements TMatchResult { } 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); res.valid = valid; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMatcher.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMatcher.java index 2a945a351..ecba9b2a0 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMatcher.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMatcher.java @@ -54,11 +54,11 @@ public final class TMatcher implements TMatchResult { private TPattern pat = null; - private AbstractSet start = null; + private TAbstractSet start = null; private CharSequence string = null; - private MatchResultImpl matchResult = null; + private TMatchResultImpl matchResult = null; // bounds private int leftBound = -1; @@ -480,7 +480,7 @@ public final class TMatcher implements TMatchResult { * sequence starting at index specified; Result of the match * 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) { matchResult.finalizeMatch(); @@ -670,7 +670,7 @@ public final class TMatcher implements TMatchResult { int mode = matchResult.mode(); this.pat = pattern; 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()); matchResult.setStartIndex(startIndex); matchResult.setMode(mode); @@ -683,7 +683,7 @@ public final class TMatcher implements TMatchResult { this.string = cs; this.leftBound = 0; 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 diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MultiLineEOLSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMultiLineEOLSet.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MultiLineEOLSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMultiLineEOLSet.java index 19428b49b..d974a8b55 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MultiLineEOLSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMultiLineEOLSet.java @@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class MultiLineEOLSet extends AbstractSet { +class TMultiLineEOLSet extends TAbstractSet { private int consCounter; - public MultiLineEOLSet(int counter) { + public TMultiLineEOLSet(int counter) { this.consCounter = counter; } @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() - strIndex; char ch1; @@ -74,7 +74,7 @@ class MultiLineEOLSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { int cons; boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); matchResult.setConsumed(consCounter, -1); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MultiLineSOLSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMultiLineSOLSet.java similarity index 83% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MultiLineSOLSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMultiLineSOLSet.java index ca49d0069..d4807dc72 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/MultiLineSOLSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TMultiLineSOLSet.java @@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex; * * @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; } @Override - public int matches(int strIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int strIndex, CharSequence testString, TMatchResultImpl matchResult) { if (strIndex != matchResult.getRightBound() && ((strIndex == 0 || (matchResult.hasAnchoringBounds() && strIndex == matchResult.getLeftBound())) || lt .isAfterLineTerminator(testString.charAt(strIndex - 1), testString.charAt(strIndex)))) { @@ -44,7 +44,7 @@ class MultiLineSOLSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NegativeLookAhead.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNegativeLookAhead.java similarity index 85% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NegativeLookAhead.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNegativeLookAhead.java index a93dfd4ce..f50d8d3d8 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NegativeLookAhead.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNegativeLookAhead.java @@ -27,9 +27,9 @@ import java.util.ArrayList; * * @author Nikolay A. Kuznetsov */ -class NegativeLookAhead extends AtomicJointSet { +class TNegativeLookAhead extends TAtomicJointSet { - public NegativeLookAhead(ArrayList children, FSet fSet) { + public TNegativeLookAhead(ArrayList children, TFSet fSet) { super(children, fSet); } @@ -37,11 +37,11 @@ class NegativeLookAhead extends AtomicJointSet { * Returns stringIndex+shift, the next position to match */ @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int size = children.size(); for (int i = 0; i < size; i++) { - AbstractSet e = children.get(i); + TAbstractSet e = children.get(i); if (e.matches(stringIndex, testString, matchResult) >= 0) return -1; } @@ -50,7 +50,7 @@ class NegativeLookAhead extends AtomicJointSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NegativeLookBehind.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNegativeLookBehind.java similarity index 87% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NegativeLookBehind.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNegativeLookBehind.java index 5eb334473..037c88096 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NegativeLookBehind.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNegativeLookBehind.java @@ -27,9 +27,9 @@ import java.util.ArrayList; * * @author Nikolay A. Kuznetsov */ -class NegativeLookBehind extends AtomicJointSet { +class TNegativeLookBehind extends TAtomicJointSet { - public NegativeLookBehind(ArrayList children, FSet fSet) { + public TNegativeLookBehind(ArrayList children, TFSet fSet) { super(children, fSet); } @@ -38,7 +38,7 @@ class NegativeLookBehind extends AtomicJointSet { */ @Override public int matches(int stringIndex, CharSequence testString, - MatchResultImpl matchResult) { + TMatchResultImpl matchResult) { int size = children.size(); int shift; @@ -48,7 +48,7 @@ class NegativeLookBehind extends AtomicJointSet { matchResult.setConsumed(groupIndex, stringIndex); 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() // fSet will return true only if string index at fSet equal // to stringIndex @@ -62,7 +62,7 @@ class NegativeLookBehind extends AtomicJointSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NonCapFSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNonCapFSet.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NonCapFSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNonCapFSet.java index 5e07f81d7..b6cddf3ef 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NonCapFSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNonCapFSet.java @@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class NonCapFSet extends FSet { - public NonCapFSet(int groupIndex) { +class TNonCapFSet extends TFSet { + public TNonCapFSet(int groupIndex) { super(groupIndex); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int gr = getGroupIndex(); matchResult.setConsumed(gr, stringIndex - matchResult.getConsumed(gr)); @@ -44,7 +44,7 @@ class NonCapFSet extends FSet { } @Override - public boolean hasConsumed(MatchResultImpl mr) { + public boolean hasConsumed(TMatchResultImpl mr) { return false; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NonCapJointSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNonCapJointSet.java similarity index 85% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NonCapJointSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNonCapJointSet.java index 3a28acc93..d70986076 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/NonCapJointSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TNonCapJointSet.java @@ -26,12 +26,12 @@ import java.util.ArrayList; * Node representing non-capturing group * @author Nikolay A. Kuznetsov */ -class NonCapJointSet extends JointSet { +class TNonCapJointSet extends TJointSet { - protected NonCapJointSet() { + protected TNonCapJointSet() { } - public NonCapJointSet(ArrayList children, FSet fSet) { + public TNonCapJointSet(ArrayList children, TFSet fSet) { super(children, fSet); } @@ -40,13 +40,13 @@ class NonCapJointSet extends JointSet { */ @Override public int matches(int stringIndex, CharSequence testString, - MatchResultImpl matchResult) { + TMatchResultImpl matchResult) { int start = matchResult.getConsumed(groupIndex); matchResult.setConsumed(groupIndex, stringIndex); int size = children.size(); for (int i = 0; i < size; i++) { - AbstractSet e = children.get(i); + TAbstractSet e = children.get(i); int shift = e.matches(stringIndex, testString, matchResult); if (shift >= 0) { return shift; @@ -62,7 +62,7 @@ class NonCapJointSet extends JointSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { int cons = matchResult.getConsumed(groupIndex); return cons != 0; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPattern.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPattern.java index 307c6cf41..2f28f3f34 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPattern.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPattern.java @@ -124,7 +124,7 @@ public final class TPattern implements Serializable { /** * Current pattern to be compiled; */ - private transient Lexer lexemes = null; + private transient TLexer lexemes = null; /** * Pattern compile flags; @@ -136,7 +136,7 @@ public final class TPattern implements Serializable { /* * All backreferences that may be used in pattern. */ - transient private FSet backRefs[] = new FSet[BACK_REF_NUMBER]; + transient private TFSet backRefs[] = new TFSet[BACK_REF_NUMBER]; /* * Is true if backreferenced sets replacement is needed @@ -149,7 +149,7 @@ public final class TPattern implements Serializable { transient private int consCount = -1; - transient AbstractSet start = null; + transient TAbstractSet start = null; /** * Returns a {@link TMatcher} for the {@code Pattern} and a given input. The @@ -303,7 +303,7 @@ public final class TPattern implements Serializable { throw new IllegalArgumentException(""); } - AbstractSet.counter = 1; + TAbstractSet.counter = 1; return new TPattern().compileImpl(pattern, flags); } @@ -319,7 +319,7 @@ public final class TPattern implements Serializable { * @return Compiled pattern */ private TPattern compileImpl(String pattern, int flags) throws TPatternSyntaxException { - this.lexemes = new Lexer(pattern, flags); + this.lexemes = new TLexer(pattern, flags); this.flags = flags; this.pattern = pattern; @@ -334,16 +334,16 @@ public final class TPattern implements Serializable { /** * A->(a|)+ */ - private AbstractSet processAlternations(AbstractSet last) { - CharClass auxRange = new CharClass(hasFlag(TPattern.CASE_INSENSITIVE), hasFlag(TPattern.UNICODE_CASE)); + private TAbstractSet processAlternations(TAbstractSet last) { + TCharClass auxRange = new TCharClass(hasFlag(TPattern.CASE_INSENSITIVE), hasFlag(TPattern.UNICODE_CASE)); while (!lexemes.isEmpty() && lexemes.isLetter() && - (lexemes.lookAhead() == 0 || lexemes.lookAhead() == Lexer.CHAR_VERTICAL_BAR || lexemes.lookAhead() == Lexer.CHAR_RIGHT_PARENTHESIS)) { + (lexemes.lookAhead() == 0 || lexemes.lookAhead() == TLexer.CHAR_VERTICAL_BAR || lexemes.lookAhead() == TLexer.CHAR_RIGHT_PARENTHESIS)) { auxRange.add(lexemes.next()); - if (lexemes.peek() == Lexer.CHAR_VERTICAL_BAR) + if (lexemes.peek() == TLexer.CHAR_VERTICAL_BAR) lexemes.next(); } - AbstractSet rangeSet = processRangeSet(auxRange); + TAbstractSet rangeSet = processRangeSet(auxRange); rangeSet.setNext(last); return rangeSet; @@ -352,11 +352,11 @@ public final class TPattern implements Serializable { /** * E->AE; E->S|E; E->S; A->(a|)+ E->S(|S)* */ - private AbstractSet processExpression(int ch, int newFlags, AbstractSet last) { - ArrayList children = new ArrayList<>(); - AbstractSet child; + private TAbstractSet processExpression(int ch, int newFlags, TAbstractSet last) { + ArrayList children = new ArrayList<>(); + TAbstractSet child; int saveFlags = flags; - FSet fSet; + TFSet fSet; boolean saveChangedFlags = false; if (newFlags != flags) { @@ -364,26 +364,26 @@ public final class TPattern implements Serializable { } switch (ch) { - case Lexer.CHAR_NONCAP_GROUP: - fSet = new NonCapFSet(++consCount); + case TLexer.CHAR_NONCAP_GROUP: + fSet = new TNonCapFSet(++consCount); break; - case Lexer.CHAR_POS_LOOKAHEAD: + case TLexer.CHAR_POS_LOOKAHEAD: /* falls through */ - case Lexer.CHAR_NEG_LOOKAHEAD: - fSet = new AheadFSet(); + case TLexer.CHAR_NEG_LOOKAHEAD: + fSet = new TAheadFSet(); break; - case Lexer.CHAR_POS_LOOKBEHIND: + case TLexer.CHAR_POS_LOOKBEHIND: /* falls through */ - case Lexer.CHAR_NEG_LOOKBEHIND: - fSet = new BehindFSet(++consCount); + case TLexer.CHAR_NEG_LOOKBEHIND: + fSet = new TBehindFSet(++consCount); break; - case Lexer.CHAR_ATOMIC_GROUP: - fSet = new AtomicFSet(++consCount); + case TLexer.CHAR_ATOMIC_GROUP: + fSet = new TAtomicFSet(++consCount); break; default: @@ -391,12 +391,12 @@ public final class TPattern implements Serializable { if (last == null) { // expr = new StartSet(); - fSet = new FinalSet(); + fSet = new TFinalSet(); saveChangedFlags = true; } else { // expr = new JointSet(globalGroupIndex); - fSet = new FSet(globalGroupIndex); + fSet = new TFSet(globalGroupIndex); } if (globalGroupIndex > -1 && globalGroupIndex < 10) { backRefs[globalGroupIndex] = fSet; @@ -405,14 +405,14 @@ public final class TPattern implements Serializable { } do { - if (lexemes.isLetter() && lexemes.lookAhead() == Lexer.CHAR_VERTICAL_BAR) { + if (lexemes.isLetter() && lexemes.lookAhead() == TLexer.CHAR_VERTICAL_BAR) { child = processAlternations(fSet); - } else if (lexemes.peek() == Lexer.CHAR_VERTICAL_BAR) { - child = new EmptySet(fSet); + } else if (lexemes.peek() == TLexer.CHAR_VERTICAL_BAR) { + child = new TEmptySet(fSet); lexemes.next(); } else { child = processSubExpression(fSet); - if (lexemes.peek() == Lexer.CHAR_VERTICAL_BAR) { + if (lexemes.peek() == TLexer.CHAR_VERTICAL_BAR) { lexemes.next(); } } @@ -421,10 +421,10 @@ public final class TPattern implements Serializable { // expr.addChild(child); children.add(child); } - } while (!(lexemes.isEmpty() || (lexemes.peek() == Lexer.CHAR_RIGHT_PARENTHESIS))); + } while (!(lexemes.isEmpty() || (lexemes.peek() == TLexer.CHAR_RIGHT_PARENTHESIS))); - if (lexemes.back() == Lexer.CHAR_VERTICAL_BAR) { - children.add(new EmptySet(fSet)); + if (lexemes.back() == TLexer.CHAR_VERTICAL_BAR) { + children.add(new TEmptySet(fSet)); } if (flags != saveFlags && !saveChangedFlags) { @@ -433,34 +433,34 @@ public final class TPattern implements Serializable { } switch (ch) { - case Lexer.CHAR_NONCAP_GROUP: - return new NonCapJointSet(children, fSet); + case TLexer.CHAR_NONCAP_GROUP: + return new TNonCapJointSet(children, fSet); - case Lexer.CHAR_POS_LOOKAHEAD: - return new PositiveLookAhead(children, fSet); + case TLexer.CHAR_POS_LOOKAHEAD: + return new TPositiveLookAhead(children, fSet); - case Lexer.CHAR_NEG_LOOKAHEAD: - return new NegativeLookAhead(children, fSet); + case TLexer.CHAR_NEG_LOOKAHEAD: + return new TNegativeLookAhead(children, fSet); - case Lexer.CHAR_POS_LOOKBEHIND: - return new PositiveLookBehind(children, fSet); + case TLexer.CHAR_POS_LOOKBEHIND: + return new TPositiveLookBehind(children, fSet); - case Lexer.CHAR_NEG_LOOKBEHIND: - return new NegativeLookBehind(children, fSet); + case TLexer.CHAR_NEG_LOOKBEHIND: + return new TNegativeLookBehind(children, fSet); - case Lexer.CHAR_ATOMIC_GROUP: - return new AtomicJointSet(children, fSet); + case TLexer.CHAR_ATOMIC_GROUP: + return new TAtomicJointSet(children, fSet); default: switch (children.size()) { case 0: - return new EmptySet(fSet); + return new TEmptySet(fSet); case 1: - return new SingleSet(children.get(0), fSet); + return new TSingleSet(children.get(0), fSet); default: - return new JointSet(children, fSet); + return new TJointSet(children, fSet); } } } @@ -468,7 +468,7 @@ public final class TPattern implements Serializable { /** * T->a+ */ - private AbstractSet processSequence() { + private TAbstractSet processSequence() { StringBuffer substring = new StringBuffer(); while (!lexemes.isEmpty() && @@ -479,10 +479,10 @@ public final class TPattern implements Serializable { // of // pattern || - (!lexemes.isNextSpecial() && Lexer.isLetter(lexemes.lookAhead())) || - lexemes.lookAhead() == Lexer.CHAR_RIGHT_PARENTHESIS || - (lexemes.lookAhead() & 0x8000ffff) == Lexer.CHAR_LEFT_PARENTHESIS || - lexemes.lookAhead() == Lexer.CHAR_VERTICAL_BAR || lexemes.lookAhead() == Lexer.CHAR_DOLLAR)) { + (!lexemes.isNextSpecial() && TLexer.isLetter(lexemes.lookAhead())) || + lexemes.lookAhead() == TLexer.CHAR_RIGHT_PARENTHESIS || + (lexemes.lookAhead() & 0x8000ffff) == TLexer.CHAR_LEFT_PARENTHESIS || + lexemes.lookAhead() == TLexer.CHAR_VERTICAL_BAR || lexemes.lookAhead() == TLexer.CHAR_DOLLAR)) { int ch = lexemes.next(); if (Character.isSupplementaryCodePoint(ch)) { @@ -492,19 +492,19 @@ public final class TPattern implements Serializable { } } if (!hasFlag(TPattern.CASE_INSENSITIVE)) { - return new SequenceSet(substring); + return new TSequenceSet(substring); } else if (!hasFlag(TPattern.UNICODE_CASE)) { - return new CISequenceSet(substring); + return new TCISequenceSet(substring); } else { - return new UCISequenceSet(substring); + return new TUCISequenceSet(substring); } } /** * D->a */ - private AbstractSet processDecomposedChar() { - int[] codePoints = new int[Lexer.MAX_DECOMPOSITION_LENGTH]; + private TAbstractSet processDecomposedChar() { + int[] codePoints = new int[TLexer.MAX_DECOMPOSITION_LENGTH]; char[] codePointsHangul; int readCodePoints = 0; int curSymb = -1; @@ -513,7 +513,7 @@ public final class TPattern implements Serializable { if (!lexemes.isEmpty() && lexemes.isLetter()) { curSymb = lexemes.next(); codePoints[readCodePoints] = curSymb; - curSymbIndex = curSymb - Lexer.LBase; + curSymbIndex = curSymb - TLexer.LBase; } /* @@ -521,37 +521,37 @@ public final class TPattern implements Serializable { * See http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf * "3.12 Conjoining Jamo Behavior" */ - if ((curSymbIndex >= 0) && (curSymbIndex < Lexer.LCount)) { - codePointsHangul = new char[Lexer.MAX_HANGUL_DECOMPOSITION_LENGTH]; + if ((curSymbIndex >= 0) && (curSymbIndex < TLexer.LCount)) { + codePointsHangul = new char[TLexer.MAX_HANGUL_DECOMPOSITION_LENGTH]; codePointsHangul[readCodePoints++] = (char)curSymb; curSymb = lexemes.peek(); - curSymbIndex = curSymb - Lexer.VBase; - if ((curSymbIndex >= 0) && (curSymbIndex < Lexer.VCount)) { + curSymbIndex = curSymb - TLexer.VBase; + if ((curSymbIndex >= 0) && (curSymbIndex < TLexer.VCount)) { codePointsHangul[readCodePoints++] = (char)curSymb; lexemes.next(); curSymb = lexemes.peek(); - curSymbIndex = curSymb - Lexer.TBase; - if ((curSymbIndex >= 0) && (curSymbIndex < Lexer.TCount)) { + curSymbIndex = curSymb - TLexer.TBase; + if ((curSymbIndex >= 0) && (curSymbIndex < TLexer.TCount)) { codePointsHangul[readCodePoints++] = (char)curSymb; lexemes.next(); // LVT syllable - return new HangulDecomposedCharSet(codePointsHangul, 3); + return new THangulDecomposedCharSet(codePointsHangul, 3); } else { // LV syllable - return new HangulDecomposedCharSet(codePointsHangul, 2); + return new THangulDecomposedCharSet(codePointsHangul, 2); } } else { // L jamo if (!hasFlag(TPattern.CASE_INSENSITIVE)) { - return new CharSet(codePointsHangul[0]); + return new TCharSet(codePointsHangul[0]); } else if (!hasFlag(TPattern.UNICODE_CASE)) { - return new CICharSet(codePointsHangul[0]); + return new TCICharSet(codePointsHangul[0]); } else { - return new UCICharSet(codePointsHangul[0]); + return new TUCICharSet(codePointsHangul[0]); } } @@ -562,23 +562,23 @@ public final class TPattern implements Serializable { } else { readCodePoints++; - while ((readCodePoints < Lexer.MAX_DECOMPOSITION_LENGTH) && !lexemes.isEmpty() && lexemes.isLetter() && - !Lexer.isDecomposedCharBoundary(lexemes.peek())) { + while ((readCodePoints < TLexer.MAX_DECOMPOSITION_LENGTH) && !lexemes.isEmpty() && lexemes.isLetter() && + !TLexer.isDecomposedCharBoundary(lexemes.peek())) { codePoints[readCodePoints++] = lexemes.next(); } /* * We have read an ordinary symbol. */ - if (readCodePoints == 1 && !Lexer.hasSingleCodepointDecomposition(codePoints[0])) { + if (readCodePoints == 1 && !TLexer.hasSingleCodepointDecomposition(codePoints[0])) { return processCharSet(codePoints[0]); } else { if (!hasFlag(TPattern.CASE_INSENSITIVE)) { - return new DecomposedCharSet(codePoints, readCodePoints); + return new TDecomposedCharSet(codePoints, readCodePoints); } else if (!hasFlag(TPattern.UNICODE_CASE)) { - return new CIDecomposedCharSet(codePoints, readCodePoints); + return new TCIDecomposedCharSet(codePoints, readCodePoints); } else { - return new UCIDecomposedCharSet(codePoints, readCodePoints); + return new TUCIDecomposedCharSet(codePoints, readCodePoints); } } } @@ -587,54 +587,54 @@ public final class TPattern implements Serializable { /** * S->BS; S->QS; S->Q; B->a+ */ - private AbstractSet processSubExpression(AbstractSet last) { - AbstractSet cur; - if (lexemes.isLetter() && !lexemes.isNextSpecial() && Lexer.isLetter(lexemes.lookAhead())) { + private TAbstractSet processSubExpression(TAbstractSet last) { + TAbstractSet cur; + if (lexemes.isLetter() && !lexemes.isNextSpecial() && TLexer.isLetter(lexemes.lookAhead())) { if (hasFlag(TPattern.CANON_EQ)) { cur = processDecomposedChar(); if (!lexemes.isEmpty() /* && !pattern.isQuantifier() */ - && (lexemes.peek() != Lexer.CHAR_RIGHT_PARENTHESIS || last instanceof FinalSet) && - lexemes.peek() != Lexer.CHAR_VERTICAL_BAR && !lexemes.isLetter()) { + && (lexemes.peek() != TLexer.CHAR_RIGHT_PARENTHESIS || last instanceof TFinalSet) && + lexemes.peek() != TLexer.CHAR_VERTICAL_BAR && !lexemes.isLetter()) { cur = processQuantifier(last, cur); } } else if (lexemes.isHighSurrogate() || lexemes.isLowSurrogate()) { - AbstractSet term = processTerminal(last); + TAbstractSet term = processTerminal(last); cur = processQuantifier(last, term); } else { cur = processSequence(); } - } else if (lexemes.peek() == Lexer.CHAR_RIGHT_PARENTHESIS) { - if (last instanceof FinalSet) { + } else if (lexemes.peek() == TLexer.CHAR_RIGHT_PARENTHESIS) { + if (last instanceof TFinalSet) { throw new TPatternSyntaxException("", lexemes.toString(), lexemes.getIndex()); } else { - cur = new EmptySet(last); + cur = new TEmptySet(last); } } else { - AbstractSet term = processTerminal(last); + TAbstractSet term = processTerminal(last); cur = processQuantifier(last, term); } if (!lexemes.isEmpty() // && !pattern.isQuantifier() && - (lexemes.peek() != Lexer.CHAR_RIGHT_PARENTHESIS || last instanceof FinalSet) && - lexemes.peek() != Lexer.CHAR_VERTICAL_BAR) { - AbstractSet next = processSubExpression(last); - if (cur instanceof LeafQuantifierSet + (lexemes.peek() != TLexer.CHAR_RIGHT_PARENTHESIS || last instanceof TFinalSet) && + lexemes.peek() != TLexer.CHAR_VERTICAL_BAR) { + TAbstractSet next = processSubExpression(last); + if (cur instanceof TLeafQuantifierSet // TODO create personal UnifiedQuantifierSet for composite // quantifiers // to take into account Quantifier counters // //// && - !(cur instanceof CompositeQuantifierSet) && - !(cur instanceof GroupQuantifierSet) && - !(cur instanceof AltQuantifierSet) && !next.first(((LeafQuantifierSet)cur).getInnerSet())) { - cur = new UnifiedQuantifierSet((LeafQuantifierSet)cur); + !(cur instanceof TCompositeQuantifierSet) && + !(cur instanceof TGroupQuantifierSet) && + !(cur instanceof TAltQuantifierSet) && !next.first(((TLeafQuantifierSet)cur).getInnerSet())) { + cur = new TUnifiedQuantifierSet((TLeafQuantifierSet)cur); } if (((char)next.getType()) == '+') { - cur.setNext(((LeafQuantifierSet)next).getInnerSet()); + cur.setNext(((TLeafQuantifierSet)next).getInnerSet()); } else { cur.setNext(next); } @@ -645,7 +645,7 @@ public final class TPattern implements Serializable { } if (((char)cur.getType()) == '+') { - return ((QuantifierSet)cur).getInnerSet(); + return ((TQuantifierSet)cur).getInnerSet(); } else { return cur; } @@ -655,85 +655,85 @@ public final class TPattern implements Serializable { * Q->T(*|+|?...) also do some optimizations. * */ - private AbstractSet processQuantifier(AbstractSet last, AbstractSet term) { + private TAbstractSet processQuantifier(TAbstractSet last, TAbstractSet term) { int quant = lexemes.peek(); - if (term != null && !(term instanceof LeafSet)) { + if (term != null && !(term instanceof TLeafSet)) { switch (quant) { - case Lexer.QUANT_STAR: - case Lexer.QUANT_PLUS: { - QuantifierSet q; + case TLexer.QUANT_STAR: + case TLexer.QUANT_PLUS: { + TQuantifierSet q; lexemes.next(); - if (term.getType() == AbstractSet.TYPE_DOTSET) { + if (term.getType() == TAbstractSet.TYPE_DOTSET) { if (!hasFlag(TPattern.DOTALL)) { - q = new DotQuantifierSet(term, last, quant, AbstractLineTerminator.getInstance(flags)); + q = new TDotQuantifierSet(term, last, quant, TAbstractLineTerminator.getInstance(flags)); } else { - q = new DotAllQuantifierSet(term, last, quant); + q = new TDotAllQuantifierSet(term, last, quant); } } else { - q = new GroupQuantifierSet(term, last, quant); + q = new TGroupQuantifierSet(term, last, quant); } term.setNext(q); return q; } - case Lexer.QUANT_STAR_R: - case Lexer.QUANT_PLUS_R: { + case TLexer.QUANT_STAR_R: + case TLexer.QUANT_PLUS_R: { lexemes.next(); - GroupQuantifierSet q = new ReluctantGroupQuantifierSet(term, last, quant); + TGroupQuantifierSet q = new TReluctantGroupQuantifierSet(term, last, quant); term.setNext(q); return q; } - case Lexer.QUANT_PLUS_P: { + case TLexer.QUANT_PLUS_P: { lexemes.next(); // possessive plus will be handled by unique class // and should not be postprocessed to point previous set // to the inner one. // // - return new PosPlusGroupQuantifierSet(term, last, Lexer.QUANT_STAR_P); + return new TPosPlusGroupQuantifierSet(term, last, TLexer.QUANT_STAR_P); } - case Lexer.QUANT_STAR_P: { + case TLexer.QUANT_STAR_P: { lexemes.next(); - return new PossessiveGroupQuantifierSet(term, last, quant); + return new TPossessiveGroupQuantifierSet(term, last, quant); } - case Lexer.QUANT_ALT: { + case TLexer.QUANT_ALT: { lexemes.next(); - AltGroupQuantifierSet q = new AltGroupQuantifierSet(term, last, Lexer.QUANT_ALT); + TAltGroupQuantifierSet q = new TAltGroupQuantifierSet(term, last, TLexer.QUANT_ALT); term.setNext(last); return q; } - case Lexer.QUANT_ALT_P: { + case TLexer.QUANT_ALT_P: { lexemes.next(); - return new PosAltGroupQuantifierSet(term, last, Lexer.QUANT_ALT); + return new TPosAltGroupQuantifierSet(term, last, TLexer.QUANT_ALT); } - case Lexer.QUANT_ALT_R: { + case TLexer.QUANT_ALT_R: { lexemes.next(); - RelAltGroupQuantifierSet q = new RelAltGroupQuantifierSet(term, last, Lexer.QUANT_ALT); + TRelAltGroupQuantifierSet q = new TRelAltGroupQuantifierSet(term, last, TLexer.QUANT_ALT); term.setNext(last); return q; } - case Lexer.QUANT_COMP: { - CompositeGroupQuantifierSet q = new CompositeGroupQuantifierSet((Quantifier)lexemes.nextSpecial(), - term, last, Lexer.QUANT_ALT, ++compCount); + case TLexer.QUANT_COMP: { + TCompositeGroupQuantifierSet q = new TCompositeGroupQuantifierSet((TQuantifier)lexemes.nextSpecial(), + term, last, TLexer.QUANT_ALT, ++compCount); term.setNext(q); return q; } - case Lexer.QUANT_COMP_P: { - return new PosCompositeGroupQuantifierSet((Quantifier)lexemes.nextSpecial(), term, last, - Lexer.QUANT_ALT, ++compCount); + case TLexer.QUANT_COMP_P: { + return new TPosCompositeGroupQuantifierSet((TQuantifier)lexemes.nextSpecial(), term, last, + TLexer.QUANT_ALT, ++compCount); } - case Lexer.QUANT_COMP_R: { - RelCompositeGroupQuantifierSet q = new RelCompositeGroupQuantifierSet( - (Quantifier)lexemes.nextSpecial(), term, last, Lexer.QUANT_ALT, ++compCount); + case TLexer.QUANT_COMP_R: { + TRelCompositeGroupQuantifierSet q = new TRelCompositeGroupQuantifierSet( + (TQuantifier)lexemes.nextSpecial(), term, last, TLexer.QUANT_ALT, ++compCount); term.setNext(q); return q; } @@ -742,60 +742,60 @@ public final class TPattern implements Serializable { return term; } } else { - LeafSet leaf = null; + TLeafSet leaf = null; if (term != null) - leaf = (LeafSet)term; + leaf = (TLeafSet)term; switch (quant) { - case Lexer.QUANT_STAR: - case Lexer.QUANT_PLUS: { + case TLexer.QUANT_STAR: + case TLexer.QUANT_PLUS: { lexemes.next(); - LeafQuantifierSet q = new LeafQuantifierSet(leaf, last, quant); + TLeafQuantifierSet q = new TLeafQuantifierSet(leaf, last, quant); leaf.setNext(q); return q; } - case Lexer.QUANT_STAR_R: - case Lexer.QUANT_PLUS_R: { + case TLexer.QUANT_STAR_R: + case TLexer.QUANT_PLUS_R: { lexemes.next(); - ReluctantQuantifierSet q = new ReluctantQuantifierSet(leaf, last, quant); + TReluctantQuantifierSet q = new TReluctantQuantifierSet(leaf, last, quant); leaf.setNext(q); return q; } - case Lexer.QUANT_PLUS_P: - case Lexer.QUANT_STAR_P: { + case TLexer.QUANT_PLUS_P: + case TLexer.QUANT_STAR_P: { lexemes.next(); - PossessiveQuantifierSet q = new PossessiveQuantifierSet(leaf, last, quant); + TPossessiveQuantifierSet q = new TPossessiveQuantifierSet(leaf, last, quant); leaf.setNext(q); return q; } - case Lexer.QUANT_ALT: { + case TLexer.QUANT_ALT: { lexemes.next(); - return new AltQuantifierSet(leaf, last, Lexer.QUANT_ALT); + return new TAltQuantifierSet(leaf, last, TLexer.QUANT_ALT); } - case Lexer.QUANT_ALT_P: { + case TLexer.QUANT_ALT_P: { lexemes.next(); - return new PossessiveAltQuantifierSet(leaf, last, Lexer.QUANT_ALT_P); + return new TPossessiveAltQuantifierSet(leaf, last, TLexer.QUANT_ALT_P); } - case Lexer.QUANT_ALT_R: { + case TLexer.QUANT_ALT_R: { lexemes.next(); - return new ReluctantAltQuantifierSet(leaf, last, Lexer.QUANT_ALT_R); + return new TReluctantAltQuantifierSet(leaf, last, TLexer.QUANT_ALT_R); } - case Lexer.QUANT_COMP: { - return new CompositeQuantifierSet((Quantifier)lexemes.nextSpecial(), leaf, last, Lexer.QUANT_COMP); + case TLexer.QUANT_COMP: { + return new TCompositeQuantifierSet((TQuantifier)lexemes.nextSpecial(), leaf, last, TLexer.QUANT_COMP); } - case Lexer.QUANT_COMP_P: { - return new PossessiveCompositeQuantifierSet((Quantifier)lexemes.nextSpecial(), leaf, last, - Lexer.QUANT_COMP_P); + case TLexer.QUANT_COMP_P: { + return new TPossessiveCompositeQuantifierSet((TQuantifier)lexemes.nextSpecial(), leaf, last, + TLexer.QUANT_COMP_P); } - case Lexer.QUANT_COMP_R: { - return new ReluctantCompositeQuantifierSet((Quantifier)lexemes.nextSpecial(), leaf, last, - Lexer.QUANT_COMP_R); + case TLexer.QUANT_COMP_R: { + return new TReluctantCompositeQuantifierSet((TQuantifier)lexemes.nextSpecial(), leaf, last, + TLexer.QUANT_COMP_R); } default: @@ -807,121 +807,121 @@ public final class TPattern implements Serializable { /** * T-> letter|[range]|{char-class}|(E) */ - private AbstractSet processTerminal(AbstractSet last) { + private TAbstractSet processTerminal(TAbstractSet last) { int ch; - AbstractSet term = null; + TAbstractSet term = null; do { ch = lexemes.peek(); - if ((ch & 0x8000ffff) == Lexer.CHAR_LEFT_PARENTHESIS) { + if ((ch & 0x8000ffff) == TLexer.CHAR_LEFT_PARENTHESIS) { int newFlags; lexemes.next(); newFlags = (ch & 0x00ff0000) >> 16; ch = ch & 0xff00ffff; - if (ch == Lexer.CHAR_FLAGS) { + if (ch == TLexer.CHAR_FLAGS) { flags = newFlags; } else { - newFlags = (ch == Lexer.CHAR_NONCAP_GROUP) ? newFlags : flags; + newFlags = (ch == TLexer.CHAR_NONCAP_GROUP) ? newFlags : flags; term = processExpression(ch, newFlags, last); - if (lexemes.peek() != Lexer.CHAR_RIGHT_PARENTHESIS) { + if (lexemes.peek() != TLexer.CHAR_RIGHT_PARENTHESIS) { throw new TPatternSyntaxException("", lexemes.toString(), lexemes.getIndex()); } lexemes.next(); } } else switch (ch) { - case Lexer.CHAR_LEFT_SQUARE_BRACKET: { + case TLexer.CHAR_LEFT_SQUARE_BRACKET: { lexemes.next(); boolean negative = false; - if (lexemes.peek() == Lexer.CHAR_CARET) { + if (lexemes.peek() == TLexer.CHAR_CARET) { negative = true; lexemes.next(); } term = processRange(negative, last); - if (lexemes.peek() != Lexer.CHAR_RIGHT_SQUARE_BRACKET) + if (lexemes.peek() != TLexer.CHAR_RIGHT_SQUARE_BRACKET) throw new TPatternSyntaxException("", lexemes.toString(), lexemes.getIndex()); - lexemes.setMode(Lexer.MODE_PATTERN); + lexemes.setMode(TLexer.MODE_PATTERN); lexemes.next(); break; } - case Lexer.CHAR_DOT: { + case TLexer.CHAR_DOT: { lexemes.next(); if (!hasFlag(TPattern.DOTALL)) { - term = new DotSet(AbstractLineTerminator.getInstance(flags)); + term = new TDotSet(TAbstractLineTerminator.getInstance(flags)); } else { - term = new DotAllSet(); + term = new TDotAllSet(); } break; } - case Lexer.CHAR_CARET: { + case TLexer.CHAR_CARET: { lexemes.next(); consCount++; if (!hasFlag(TPattern.MULTILINE)) { - term = new SOLSet(); + term = new TSOLSet(); } else { - term = new MultiLineSOLSet(AbstractLineTerminator.getInstance(flags)); + term = new TMultiLineSOLSet(TAbstractLineTerminator.getInstance(flags)); } break; } - case Lexer.CHAR_DOLLAR: { + case TLexer.CHAR_DOLLAR: { lexemes.next(); consCount++; if (!hasFlag(TPattern.MULTILINE)) { if (!hasFlag(TPattern.UNIX_LINES)) { - term = new EOLSet(consCount); + term = new TEOLSet(consCount); } else { - term = new UEOLSet(consCount); + term = new TUEOLSet(consCount); } } else { if (!hasFlag(TPattern.UNIX_LINES)) { - term = new MultiLineEOLSet(consCount); + term = new TMultiLineEOLSet(consCount); } else { - term = new UMultiLineEOLSet(consCount); + term = new TUMultiLineEOLSet(consCount); } } break; } - case Lexer.CHAR_WORD_BOUND: { + case TLexer.CHAR_WORD_BOUND: { lexemes.next(); - term = new WordBoundary(true); + term = new TWordBoundary(true); break; } - case Lexer.CHAR_NONWORD_BOUND: { + case TLexer.CHAR_NONWORD_BOUND: { lexemes.next(); - term = new WordBoundary(false); + term = new TWordBoundary(false); break; } - case Lexer.CHAR_END_OF_INPUT: { + case TLexer.CHAR_END_OF_INPUT: { lexemes.next(); - term = new EOISet(); + term = new TEOISet(); break; } - case Lexer.CHAR_END_OF_LINE: { + case TLexer.CHAR_END_OF_LINE: { lexemes.next(); - term = new EOLSet(++consCount); + term = new TEOLSet(++consCount); break; } - case Lexer.CHAR_START_OF_INPUT: { + case TLexer.CHAR_START_OF_INPUT: { lexemes.next(); - term = new SOLSet(); + term = new TSOLSet(); break; } - case Lexer.CHAR_PREVIOUS_MATCH: { + case TLexer.CHAR_PREVIOUS_MATCH: { lexemes.next(); - term = new PreviousMatch(); + term = new TPreviousMatch(); break; } @@ -939,11 +939,11 @@ public final class TPattern implements Serializable { lexemes.next(); consCount++; if (!hasFlag(TPattern.CASE_INSENSITIVE)) { - term = new BackReferenceSet(number, consCount); + term = new TBackReferenceSet(number, consCount); } else if (!hasFlag(TPattern.UNICODE_CASE)) { - term = new CIBackReferenceSet(number, consCount); + term = new TCIBackReferenceSet(number, consCount); } else { - term = new UCIBackReferenceSet(number, consCount); + term = new TUCIBackReferenceSet(number, consCount); } (backRefs[number]).isBackReferenced = true; needsBackRefReplacement = true; @@ -954,15 +954,15 @@ public final class TPattern implements Serializable { } case 0: { - AbstractCharClass cc = null; - if ((cc = (AbstractCharClass)lexemes.peekSpecial()) != null) { + TAbstractCharClass cc = null; + if ((cc = (TAbstractCharClass)lexemes.peekSpecial()) != null) { term = processRangeSet(cc); } else if (!lexemes.isEmpty()) { // ch == 0 - term = new CharSet((char)ch); + term = new TCharSet((char)ch); } else { - term = new EmptySet(last); + term = new TEmptySet(last); break; } lexemes.next(); @@ -973,13 +973,13 @@ public final class TPattern implements Serializable { if (ch >= 0 && !lexemes.isSpecial()) { term = processCharSet(ch); lexemes.next(); - } else if (ch == Lexer.CHAR_VERTICAL_BAR) { - term = new EmptySet(last); - } else if (ch == Lexer.CHAR_RIGHT_PARENTHESIS) { - if (last instanceof FinalSet) { + } else if (ch == TLexer.CHAR_VERTICAL_BAR) { + term = new TEmptySet(last); + } else if (ch == TLexer.CHAR_RIGHT_PARENTHESIS) { + if (last instanceof TFinalSet) { throw new TPatternSyntaxException("", lexemes.toString(), lexemes.getIndex()); } else { - term = new EmptySet(last); + term = new TEmptySet(last); } } else { throw new TPatternSyntaxException((lexemes.isSpecial() ? lexemes.peekSpecial().toString() @@ -987,13 +987,13 @@ public final class TPattern implements Serializable { } } } - } while (ch == Lexer.CHAR_FLAGS); + } while (ch == TLexer.CHAR_FLAGS); return term; } - private AbstractSet processRange(boolean negative, AbstractSet last) { - AbstractCharClass res = processRangeExpression(negative); - AbstractSet rangeSet = processRangeSet(res); + private TAbstractSet processRange(boolean negative, TAbstractSet last) { + TAbstractCharClass res = processRangeExpression(negative); + TAbstractSet rangeSet = processRangeSet(res); rangeSet.setNext(last); return rangeSet; @@ -1002,31 +1002,31 @@ public final class TPattern implements Serializable { /** * process [...] ranges */ - private CharClass processRangeExpression(boolean alt) { - CharClass res = new CharClass(alt, hasFlag(TPattern.CASE_INSENSITIVE), hasFlag(TPattern.UNICODE_CASE)); + private TCharClass processRangeExpression(boolean alt) { + TCharClass res = new TCharClass(alt, hasFlag(TPattern.CASE_INSENSITIVE), hasFlag(TPattern.UNICODE_CASE)); int buffer = -1; boolean intersection = false; boolean notClosed = false; boolean firstInClass = true; - while (!lexemes.isEmpty() && (notClosed = (lexemes.peek()) != Lexer.CHAR_RIGHT_SQUARE_BRACKET || firstInClass)) { + while (!lexemes.isEmpty() && (notClosed = (lexemes.peek()) != TLexer.CHAR_RIGHT_SQUARE_BRACKET || firstInClass)) { switch (lexemes.peek()) { - case Lexer.CHAR_RIGHT_SQUARE_BRACKET: { + case TLexer.CHAR_RIGHT_SQUARE_BRACKET: { if (buffer >= 0) res.add(buffer); buffer = ']'; lexemes.next(); break; } - case Lexer.CHAR_LEFT_SQUARE_BRACKET: { + case TLexer.CHAR_LEFT_SQUARE_BRACKET: { if (buffer >= 0) { res.add(buffer); buffer = -1; } lexemes.next(); boolean negative = false; - if (lexemes.peek() == Lexer.CHAR_CARET) { + if (lexemes.peek() == TLexer.CHAR_CARET) { lexemes.next(); negative = true; } @@ -1040,7 +1040,7 @@ public final class TPattern implements Serializable { break; } - case Lexer.CHAR_AMPERSAND: { + case TLexer.CHAR_AMPERSAND: { if (buffer >= 0) res.add(buffer); buffer = lexemes.next(); @@ -1049,8 +1049,8 @@ public final class TPattern implements Serializable { * if there is a start for subrange we will do an * intersection otherwise treat '&' as a normal character */ - if (lexemes.peek() == Lexer.CHAR_AMPERSAND) { - if (lexemes.lookAhead() == Lexer.CHAR_LEFT_SQUARE_BRACKET) { + if (lexemes.peek() == TLexer.CHAR_AMPERSAND) { + if (lexemes.lookAhead() == TLexer.CHAR_LEFT_SQUARE_BRACKET) { lexemes.next(); intersection = true; buffer = -1; @@ -1064,7 +1064,7 @@ public final class TPattern implements Serializable { // ignore "&&" at "[X&&]" ending where X != // empty string - if (!(lexemes.peek() == Lexer.CHAR_RIGHT_SQUARE_BRACKET)) { + if (!(lexemes.peek() == TLexer.CHAR_RIGHT_SQUARE_BRACKET)) { res.intersection(processRangeExpression(false)); } } @@ -1079,9 +1079,9 @@ public final class TPattern implements Serializable { break; } - case Lexer.CHAR_HYPHEN: { - if (firstInClass || lexemes.lookAhead() == Lexer.CHAR_RIGHT_SQUARE_BRACKET || - lexemes.lookAhead() == Lexer.CHAR_LEFT_SQUARE_BRACKET || buffer < 0) { + case TLexer.CHAR_HYPHEN: { + if (firstInClass || lexemes.lookAhead() == TLexer.CHAR_RIGHT_SQUARE_BRACKET || + lexemes.lookAhead() == TLexer.CHAR_LEFT_SQUARE_BRACKET || buffer < 0) { // treat hypen as normal character if (buffer >= 0) res.add(buffer); @@ -1093,11 +1093,11 @@ public final class TPattern implements Serializable { int cur = lexemes.peek(); if (!lexemes.isSpecial() && - (cur >= 0 || lexemes.lookAhead() == Lexer.CHAR_RIGHT_SQUARE_BRACKET || - lexemes.lookAhead() == Lexer.CHAR_LEFT_SQUARE_BRACKET || buffer < 0)) { + (cur >= 0 || lexemes.lookAhead() == TLexer.CHAR_RIGHT_SQUARE_BRACKET || + lexemes.lookAhead() == TLexer.CHAR_LEFT_SQUARE_BRACKET || buffer < 0)) { try { - if (!Lexer.isLetter(cur)) { + if (!TLexer.isLetter(cur)) { cur = cur & 0xFFFF; } res.add(buffer, cur); @@ -1114,7 +1114,7 @@ public final class TPattern implements Serializable { break; } - case Lexer.CHAR_CARET: { + case TLexer.CHAR_CARET: { if (buffer >= 0) res.add(buffer); buffer = '^'; @@ -1125,7 +1125,7 @@ public final class TPattern implements Serializable { case 0: { if (buffer >= 0) res.add(buffer); - AbstractCharClass cs = (AbstractCharClass)lexemes.peekSpecial(); + TAbstractCharClass cs = (TAbstractCharClass)lexemes.peekSpecial(); if (cs != null) { res.add(cs); buffer = -1; @@ -1155,75 +1155,75 @@ public final class TPattern implements Serializable { return res; } - private AbstractSet processCharSet(int ch) { + private TAbstractSet processCharSet(int ch) { boolean isSupplCodePoint = Character.isSupplementaryCodePoint(ch); if (hasFlag(TPattern.CASE_INSENSITIVE)) { if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { - return new CICharSet((char)ch); + return new TCICharSet((char)ch); } else if (hasFlag(TPattern.UNICODE_CASE) && ch > 128) { if (isSupplCodePoint) { - return new UCISupplCharSet(ch); - } else if (Lexer.isLowSurrogate(ch)) { + return new TUCISupplCharSet(ch); + } else if (TLexer.isLowSurrogate(ch)) { // we need no UCILowSurrogateCharSet - return new LowSurrogateCharSet((char)ch); - } else if (Lexer.isHighSurrogate(ch)) { + return new TLowSurrogateCharSet((char)ch); + } else if (TLexer.isHighSurrogate(ch)) { // we need no UCIHighSurrogateCharSet - return new HighSurrogateCharSet((char)ch); + return new THighSurrogateCharSet((char)ch); } else { - return new UCICharSet((char)ch); + return new TUCICharSet((char)ch); } } } if (isSupplCodePoint) { - return new SupplCharSet(ch); - } else if (Lexer.isLowSurrogate(ch)) { - return new LowSurrogateCharSet((char)ch); - } else if (Lexer.isHighSurrogate(ch)) { - return new HighSurrogateCharSet((char)ch); + return new TSupplCharSet(ch); + } else if (TLexer.isLowSurrogate(ch)) { + return new TLowSurrogateCharSet((char)ch); + } else if (TLexer.isHighSurrogate(ch)) { + return new THighSurrogateCharSet((char)ch); } else { - return new CharSet((char)ch); + return new TCharSet((char)ch); } } - private AbstractSet processRangeSet(AbstractCharClass charClass) { + private TAbstractSet processRangeSet(TAbstractCharClass charClass) { if (charClass.hasLowHighSurrogates()) { - AbstractCharClass surrogates = charClass.getSurrogates(); - LowHighSurrogateRangeSet lowHighSurrRangeSet = new LowHighSurrogateRangeSet(surrogates); + TAbstractCharClass surrogates = charClass.getSurrogates(); + TLowHighSurrogateRangeSet lowHighSurrRangeSet = new TLowHighSurrogateRangeSet(surrogates); if (charClass.mayContainSupplCodepoints()) { if (!charClass.hasUCI()) { - return new CompositeRangeSet(new SupplRangeSet(charClass.getWithoutSurrogates()), + return new TCompositeRangeSet(new TSupplRangeSet(charClass.getWithoutSurrogates()), lowHighSurrRangeSet); } else { - return new CompositeRangeSet(new UCISupplRangeSet(charClass.getWithoutSurrogates()), + return new TCompositeRangeSet(new TUCISupplRangeSet(charClass.getWithoutSurrogates()), lowHighSurrRangeSet); } } if (!charClass.hasUCI()) { - return new CompositeRangeSet(new RangeSet(charClass.getWithoutSurrogates()), lowHighSurrRangeSet); + return new TCompositeRangeSet(new TRangeSet(charClass.getWithoutSurrogates()), lowHighSurrRangeSet); } else { - return new CompositeRangeSet(new UCIRangeSet(charClass.getWithoutSurrogates()), lowHighSurrRangeSet); + return new TCompositeRangeSet(new TUCIRangeSet(charClass.getWithoutSurrogates()), lowHighSurrRangeSet); } } if (charClass.mayContainSupplCodepoints()) { if (!charClass.hasUCI()) { - return new SupplRangeSet(charClass); + return new TSupplRangeSet(charClass); } else { - return new UCISupplRangeSet(charClass); + return new TUCISupplRangeSet(charClass); } } if (!charClass.hasUCI()) { - return new RangeSet(charClass); + return new TRangeSet(charClass); } else { - return new UCIRangeSet(charClass); + return new TUCIRangeSet(charClass); } } @@ -1350,11 +1350,11 @@ public final class TPattern implements Serializable { */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); - AbstractSet.counter = 1; + TAbstractSet.counter = 1; globalGroupIndex = -1; compCount = -1; consCount = -1; - backRefs = new FSet[BACK_REF_NUMBER]; + backRefs = new TFSet[BACK_REF_NUMBER]; compileImpl(pattern, flags); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosAltGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosAltGroupQuantifierSet.java similarity index 83% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosAltGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosAltGroupQuantifierSet.java index 8f9e83767..83f36d353 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosAltGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosAltGroupQuantifierSet.java @@ -26,15 +26,15 @@ package org.teavm.classlib.java.util.regex; * * @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); - ((JointSet)innerSet).setNext(FSet.posFSet); + ((TJointSet)innerSet).setNext(TFSet.posFSet); } @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); if (nextIndex > 0) { stringIndex = nextIndex; @@ -43,7 +43,7 @@ class PosAltGroupQuantifierSet extends AltGroupQuantifierSet { } @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosCompositeGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosCompositeGroupQuantifierSet.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosCompositeGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosCompositeGroupQuantifierSet.java index 061bd2018..0614a1a24 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosCompositeGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosCompositeGroupQuantifierSet.java @@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex; * * @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) { super(quant, innerSet, next, type, setCounter); - innerSet.setNext(FSet.posFSet); + innerSet.setNext(TFSet.posFSet); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int nextIndex; int counter = 0; int max = quantifier.max(); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosPlusGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosPlusGroupQuantifierSet.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosPlusGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosPlusGroupQuantifierSet.java index 265ea0e99..98d879efc 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PosPlusGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPosPlusGroupQuantifierSet.java @@ -25,15 +25,15 @@ package org.teavm.classlib.java.util.regex; * * @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); - ((JointSet)innerSet).setNext(FSet.posFSet); + ((TJointSet)innerSet).setNext(TFSet.posFSet); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int nextIndex; if ((nextIndex = innerSet.matches(stringIndex, testString, matchResult)) < 0) { return -1; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PositiveLookAhead.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPositiveLookAhead.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PositiveLookAhead.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPositiveLookAhead.java index 66e4ea841..f6a97f237 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PositiveLookAhead.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPositiveLookAhead.java @@ -27,8 +27,8 @@ import java.util.ArrayList; * * @author Nikolay A. Kuznetsov */ -class PositiveLookAhead extends AtomicJointSet { - public PositiveLookAhead(ArrayList children, FSet fSet) { +class TPositiveLookAhead extends TAtomicJointSet { + public TPositiveLookAhead(ArrayList children, TFSet fSet) { super(children, fSet); } @@ -36,10 +36,10 @@ class PositiveLookAhead extends AtomicJointSet { * Returns stringIndex+shift, the next position to match */ @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int size = children.size(); for (int i = 0; i < size; i++) { - AbstractSet e = children.get(i); + TAbstractSet e = children.get(i); int shift = e.matches(stringIndex, testString, matchResult); if (shift >= 0) { // PosLookaheadFset always returns true, position remains the @@ -53,7 +53,7 @@ class PositiveLookAhead extends AtomicJointSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PositiveLookBehind.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPositiveLookBehind.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PositiveLookBehind.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPositiveLookBehind.java index 9392ddac9..2cbacb23f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PositiveLookBehind.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPositiveLookBehind.java @@ -27,9 +27,9 @@ import java.util.ArrayList; * * @author Nikolay A. Kuznetsov */ -class PositiveLookBehind extends AtomicJointSet { +class TPositiveLookBehind extends TAtomicJointSet { - public PositiveLookBehind(ArrayList children, FSet fSet) { + public TPositiveLookBehind(ArrayList children, TFSet fSet) { super(children, fSet); } @@ -37,7 +37,7 @@ class PositiveLookBehind extends AtomicJointSet { * Returns stringIndex+shift, the next position to match */ @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int size = children.size(); 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 matchResult.setConsumed(groupIndex, stringIndex); 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() // fSet will return true only if string index at fSet equal // to stringIndex @@ -63,7 +63,7 @@ class PositiveLookBehind extends AtomicJointSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveAltQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveAltQuantifierSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveAltQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveAltQuantifierSet.java index 2c27aa3b4..c95cdbddc 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveAltQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveAltQuantifierSet.java @@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class PossessiveAltQuantifierSet extends AltQuantifierSet { - public PossessiveAltQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { +class TPossessiveAltQuantifierSet extends TAltQuantifierSet { + public TPossessiveAltQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) { super(innerSet, next, type); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int shift = 0; if (stringIndex + leaf.charCount() <= matchResult.getRightBound() && diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveCompositeQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveCompositeQuantifierSet.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveCompositeQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveCompositeQuantifierSet.java index 525bdca12..bbce17013 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveCompositeQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveCompositeQuantifierSet.java @@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class PossessiveCompositeQuantifierSet extends CompositeQuantifierSet { - public PossessiveCompositeQuantifierSet(Quantifier quant, LeafSet innerSet, AbstractSet next, int type) { +class TPossessiveCompositeQuantifierSet extends TCompositeQuantifierSet { + public TPossessiveCompositeQuantifierSet(TQuantifier quant, TLeafSet innerSet, TAbstractSet next, int type) { super(quant, innerSet, next, type); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int min = quantifier.min(); int max = quantifier.max(); int i = 0; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveGroupQuantifierSet.java similarity index 85% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveGroupQuantifierSet.java index ce748b26a..5b1beef96 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveGroupQuantifierSet.java @@ -25,15 +25,15 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class PossessiveGroupQuantifierSet extends GroupQuantifierSet { - public PossessiveGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { +class TPossessiveGroupQuantifierSet extends TGroupQuantifierSet { + public TPossessiveGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) { super(innerSet, next, type); - innerSet.setNext(FSet.posFSet); + innerSet.setNext(TFSet.posFSet); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int nextIndex; while ((nextIndex = innerSet.matches(stringIndex, testString, matchResult)) > 0) { stringIndex = nextIndex; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveQuantifierSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveQuantifierSet.java index 5fd7c7072..256a70e3a 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PossessiveQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPossessiveQuantifierSet.java @@ -25,14 +25,14 @@ package org.teavm.classlib.java.util.regex; * * @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); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int shift = 0; while (stringIndex + leaf.charCount() <= matchResult.getRightBound() && (shift = leaf.accepts(stringIndex, testString)) >= 1) { diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PreviousMatch.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPreviousMatch.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PreviousMatch.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPreviousMatch.java index d6368da51..7e0940bbb 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/PreviousMatch.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TPreviousMatch.java @@ -25,10 +25,10 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class PreviousMatch extends AbstractSet { +class TPreviousMatch extends TAbstractSet { @Override public int matches(int stringIndex, CharSequence testString, - MatchResultImpl matchResult) { + TMatchResultImpl matchResult) { if (stringIndex == matchResult.getPreviousMatchEnd()) { return next.matches(stringIndex, testString, matchResult); } @@ -36,7 +36,7 @@ class PreviousMatch extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/Quantifier.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TQuantifier.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/Quantifier.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TQuantifier.java index 7b49303fb..711903d4e 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/Quantifier.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TQuantifier.java @@ -27,7 +27,7 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class Quantifier extends SpecialToken implements Cloneable { +class TQuantifier extends TSpecialToken implements Cloneable { private int min; @@ -35,11 +35,11 @@ class Quantifier extends SpecialToken implements Cloneable { private int counter = 0; - public Quantifier(int min) { + public TQuantifier(int min) { this.min = this.max = min; } - public Quantifier(int min, int max) { + public TQuantifier(int min, int max) { this.min = min; this.max = max; } @@ -71,11 +71,11 @@ class Quantifier extends SpecialToken implements Cloneable { @Override public int getType() { - return SpecialToken.TOK_QUANTIFIER; + return TSpecialToken.TOK_QUANTIFIER; } @Override public Object clone() { - return new Quantifier(min, max); + return new TQuantifier(min, max); } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/QuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TQuantifierSet.java similarity index 83% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/QuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TQuantifierSet.java index 450e81057..52d38ee98 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/QuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TQuantifierSet.java @@ -25,11 +25,11 @@ package org.teavm.classlib.java.util.regex; * * @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); this.innerSet = innerSet; setType(type); @@ -38,7 +38,7 @@ abstract class QuantifierSet extends AbstractSet { /** * Returns the innerSet. */ - public AbstractSet getInnerSet() { + public TAbstractSet getInnerSet() { return innerSet; } @@ -48,17 +48,17 @@ abstract class QuantifierSet extends AbstractSet { * @param innerSet * The innerSet to set. */ - public void setInnerSet(AbstractSet innerSet) { + public void setInnerSet(TAbstractSet innerSet) { this.innerSet = innerSet; } @Override - public boolean first(AbstractSet set) { + public boolean first(TAbstractSet set) { return innerSet.first(set) || next.first(set); } @Override - public boolean hasConsumed(MatchResultImpl mr) { + public boolean hasConsumed(TMatchResultImpl mr) { return true; } @@ -77,7 +77,7 @@ abstract class QuantifierSet extends AbstractSet { /* * Add here code to do during the pass */ - JointSet set = next.processBackRefReplacement(); + TJointSet set = next.processBackRefReplacement(); if (set != null) { next.isSecondPassVisited = true; @@ -98,7 +98,7 @@ abstract class QuantifierSet extends AbstractSet { /* * Add here code to do during the pass */ - JointSet set = innerSet.processBackRefReplacement(); + TJointSet set = innerSet.processBackRefReplacement(); if (set != null) { innerSet.isSecondPassVisited = true; @@ -121,7 +121,7 @@ abstract class QuantifierSet extends AbstractSet { /* * 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; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RangeSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRangeSet.java similarity index 68% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RangeSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRangeSet.java index 23cd8e742..b3c2c16b7 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RangeSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRangeSet.java @@ -26,19 +26,19 @@ package org.teavm.classlib.java.util.regex; * @author Nikolay A. Kuznetsov */ -class RangeSet extends LeafSet { +class TRangeSet extends TLeafSet { - private AbstractCharClass chars; + private TAbstractCharClass chars; private boolean alt = false; - public RangeSet(AbstractCharClass cs, AbstractSet next) { + public TRangeSet(TAbstractCharClass cs, TAbstractSet next) { super(next); this.chars = cs.getInstance(); this.alt = cs.alt; } - public RangeSet(AbstractCharClass cc) { + public TRangeSet(TAbstractCharClass cc) { this.chars = cc.getInstance(); this.alt = cc.alt; } @@ -54,20 +54,20 @@ class RangeSet extends LeafSet { } @Override - public boolean first(AbstractSet set) { - if (set instanceof CharSet) { - return AbstractCharClass.intersects(chars, ((CharSet)set).getChar()); - } else if (set instanceof RangeSet) { - return AbstractCharClass.intersects(chars, ((RangeSet)set).chars); - } else if (set instanceof SupplRangeSet) { - return AbstractCharClass.intersects(chars, ((SupplRangeSet)set).getChars()); - } else if (set instanceof SupplCharSet) { + public boolean first(TAbstractSet set) { + if (set instanceof TCharSet) { + return TAbstractCharClass.intersects(chars, ((TCharSet)set).getChar()); + } else if (set instanceof TRangeSet) { + return TAbstractCharClass.intersects(chars, ((TRangeSet)set).chars); + } else if (set instanceof TSupplRangeSet) { + return TAbstractCharClass.intersects(chars, ((TSupplRangeSet)set).getChars()); + } else if (set instanceof TSupplCharSet) { return false; } return true; } - protected AbstractCharClass getChars() { + protected TAbstractCharClass getChars() { return chars; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RelAltGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRelAltGroupQuantifierSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RelAltGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRelAltGroupQuantifierSet.java index 49f791174..9085f932b 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RelAltGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRelAltGroupQuantifierSet.java @@ -25,14 +25,14 @@ package org.teavm.classlib.java.util.regex; * * @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); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { if (!innerSet.hasConsumed(matchResult)) return next.matches(stringIndex, testString, matchResult); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RelCompositeGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRelCompositeGroupQuantifierSet.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RelCompositeGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRelCompositeGroupQuantifierSet.java index b0196527c..c29d677bd 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/RelCompositeGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TRelCompositeGroupQuantifierSet.java @@ -25,15 +25,15 @@ package org.teavm.classlib.java.util.regex; * * @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) { super(quant, innerSet, next, type, setCounter); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int enterCounter = matchResult.getEnterCounter(setCounter); if (!innerSet.hasConsumed(matchResult)) diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantAltQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantAltQuantifierSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantAltQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantAltQuantifierSet.java index 3548d9574..a10817588 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantAltQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantAltQuantifierSet.java @@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class ReluctantAltQuantifierSet extends AltQuantifierSet { - public ReluctantAltQuantifierSet(LeafSet innerSet, AbstractSet next, int type) { +class TReluctantAltQuantifierSet extends TAltQuantifierSet { + public TReluctantAltQuantifierSet(TLeafSet innerSet, TAbstractSet next, int type) { super(innerSet, next, type); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int shift; if ((shift = next.matches(stringIndex, testString, matchResult)) >= 0) { diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantCompositeQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantCompositeQuantifierSet.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantCompositeQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantCompositeQuantifierSet.java index 084a24008..dc1e3630c 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantCompositeQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantCompositeQuantifierSet.java @@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class ReluctantCompositeQuantifierSet extends CompositeQuantifierSet { - public ReluctantCompositeQuantifierSet(Quantifier quant, LeafSet innerSet, AbstractSet next, int type) { +class TReluctantCompositeQuantifierSet extends TCompositeQuantifierSet { + public TReluctantCompositeQuantifierSet(TQuantifier quant, TLeafSet innerSet, TAbstractSet next, int type) { super(quant, innerSet, next, type); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int min = quantifier.min(); int max = quantifier.max(); int i = 0; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantGroupQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantGroupQuantifierSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantGroupQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantGroupQuantifierSet.java index 497340f09..5f1720695 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantGroupQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantGroupQuantifierSet.java @@ -25,13 +25,13 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class ReluctantGroupQuantifierSet extends GroupQuantifierSet { - public ReluctantGroupQuantifierSet(AbstractSet innerSet, AbstractSet next, int type) { +class TReluctantGroupQuantifierSet extends TGroupQuantifierSet { + public TReluctantGroupQuantifierSet(TAbstractSet innerSet, TAbstractSet next, int type) { super(innerSet, next, type); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { if (!innerSet.hasConsumed(matchResult)) return next.matches(stringIndex, testString, matchResult); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantQuantifierSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantQuantifierSet.java index 3dbaf5f3b..e2fa3142b 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/ReluctantQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TReluctantQuantifierSet.java @@ -23,17 +23,17 @@ package org.teavm.classlib.java.util.regex; /** * This class represents [+*]? constructs over LeafSets. * - * @see java.util.regex.LeafSet + * @see java.util.regex.TLeafSet * @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); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int shift = 0; do { diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SOLSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSOLSet.java similarity index 90% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SOLSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSOLSet.java index 6e56ceb67..2e08d47d5 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SOLSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSOLSet.java @@ -25,11 +25,11 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -final class SOLSet extends AbstractSet { +final class TSOLSet extends TAbstractSet { @Override public int matches(int strIndex, CharSequence testString, - MatchResultImpl matchResult) { + TMatchResultImpl matchResult) { if (strIndex == 0 || (matchResult.hasAnchoringBounds() && strIndex == matchResult .getLeftBound())) { @@ -39,7 +39,7 @@ final class SOLSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SequenceSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSequenceSet.java similarity index 87% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SequenceSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSequenceSet.java index b88fe34f7..d63d1aa92 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SequenceSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSequenceSet.java @@ -34,7 +34,7 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class SequenceSet extends LeafSet { +class TSequenceSet extends TLeafSet { private String string = null; @@ -42,7 +42,7 @@ class SequenceSet extends LeafSet { private IntHash rightToLeft; - SequenceSet(StringBuffer substring) { + TSequenceSet(StringBuffer substring) { this.string = substring.toString(); charCount = substring.length(); @@ -50,8 +50,7 @@ class SequenceSet extends LeafSet { rightToLeft = new IntHash(charCount); for (int j = 0; j < charCount - 1; j++) { leftToRight.put(string.charAt(j), charCount - j - 1); - rightToLeft - .put(string.charAt(charCount - j - 1), charCount - j - 1); + rightToLeft.put(string.charAt(charCount - j - 1), charCount - j - 1); } } @@ -62,7 +61,7 @@ class SequenceSet extends LeafSet { @Override public int find(int strIndex, CharSequence testString, - MatchResultImpl matchResult) { + TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); @@ -82,7 +81,7 @@ class SequenceSet extends LeafSet { @Override public int findBack(int strIndex, int lastIndex, CharSequence testString, - MatchResultImpl matchResult) { + TMatchResultImpl matchResult) { while (lastIndex >= strIndex) { lastIndex = lastIndexOf(testString, strIndex, lastIndex); @@ -104,18 +103,18 @@ class SequenceSet extends LeafSet { } @Override - public boolean first(AbstractSet set) { - if (set instanceof CharSet) { - return ((CharSet) set).getChar() == string.charAt(0); - } else if (set instanceof RangeSet) { - return ((RangeSet) set).accepts(0, string.substring(0, 1)) > 0; - } else if (set instanceof SupplRangeSet) { - return ((SupplRangeSet) set).contains(string.charAt(0)) - || ((string.length() > 1) && ((SupplRangeSet) set).contains(Character + public boolean first(TAbstractSet set) { + if (set instanceof TCharSet) { + return ((TCharSet) set).getChar() == string.charAt(0); + } else if (set instanceof TRangeSet) { + return ((TRangeSet) set).accepts(0, string.substring(0, 1)) > 0; + } else if (set instanceof TSupplRangeSet) { + return ((TSupplRangeSet) set).contains(string.charAt(0)) + || ((string.length() > 1) && ((TSupplRangeSet) set).contains(Character .toCodePoint(string.charAt(0), string.charAt(1)))); - } else if ((set instanceof SupplCharSet)) { + } else if ((set instanceof TSupplCharSet)) { return (string.length() > 1) - ? ((SupplCharSet) set).getCodePoint() + ? ((TSupplCharSet) set).getCodePoint() == Character.toCodePoint(string.charAt(0), string.charAt(1)) : false; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SingleSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSingleSet.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SingleSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSingleSet.java index f733606a2..bcfae940d 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SingleSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSingleSet.java @@ -25,18 +25,18 @@ package org.teavm.classlib.java.util.regex; * * @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.fSet = fSet; this.groupIndex = fSet.getGroupIndex(); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int start = matchResult.getStart(groupIndex); matchResult.setStart(groupIndex, stringIndex); int shift = kid.matches(stringIndex, testString, matchResult); @@ -48,7 +48,7 @@ class SingleSet extends JointSet { } @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); if (res >= 0) matchResult.setStart(groupIndex, res); @@ -56,7 +56,7 @@ class SingleSet extends JointSet { } @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); if (res >= 0) matchResult.setStart(groupIndex, res); @@ -64,7 +64,7 @@ class SingleSet extends JointSet { } @Override - public boolean first(AbstractSet set) { + public boolean first(TAbstractSet set) { return kid.first(set); } @@ -72,8 +72,8 @@ class SingleSet extends JointSet { * This method is used for replacement backreferenced sets. */ @Override - public JointSet processBackRefReplacement() { - BackReferencedSingleSet set = new BackReferencedSingleSet(this); + public TJointSet processBackRefReplacement() { + TBackReferencedSingleSet set = new TBackReferencedSingleSet(this); /* * 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 */ - JointSet set = kid.processBackRefReplacement(); + TJointSet set = kid.processBackRefReplacement(); if (set != null) { kid.isSecondPassVisited = true; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SpecialToken.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSpecialToken.java similarity index 97% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SpecialToken.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSpecialToken.java index f8732e854..0cfe69d42 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SpecialToken.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSpecialToken.java @@ -26,7 +26,7 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -abstract class SpecialToken { +abstract class TSpecialToken { public static final int TOK_CHARCLASS = 1 << 0; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SupplCharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSupplCharSet.java similarity index 92% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SupplCharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSupplCharSet.java index 342316ba6..d0979c7bd 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SupplCharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSupplCharSet.java @@ -85,7 +85,7 @@ package org.teavm.classlib.java.util.regex; /** * Represents node accepting single supplementary codepoint. */ -class SupplCharSet extends LeafSet { +class TSupplCharSet extends TLeafSet { /* * UTF-16 encoding of this supplementary codepoint @@ -97,7 +97,7 @@ class SupplCharSet extends LeafSet { // int value of this supplementary codepoint private int ch; - public SupplCharSet(int ch) { + public TSupplCharSet(int ch) { charCount = 2; this.ch = ch; char[] chUTF16 = Character.toChars(ch); @@ -118,7 +118,7 @@ class SupplCharSet extends LeafSet { } @Override - public int find(int strIndex, CharSequence testString, MatchResultImpl matchResult) { + public int find(int strIndex, CharSequence testString, TMatchResultImpl matchResult) { if (testString instanceof String) { String testStr = (String)testString; @@ -146,7 +146,7 @@ class SupplCharSet extends LeafSet { } @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) { String testStr = (String)testString; @@ -180,14 +180,14 @@ class SupplCharSet extends LeafSet { } @Override - public boolean first(AbstractSet set) { - if (set instanceof SupplCharSet) { - return ((SupplCharSet)set).getCodePoint() == ch; - } else if (set instanceof SupplRangeSet) { - return ((SupplRangeSet)set).contains(ch); - } else if (set instanceof CharSet) { + public boolean first(TAbstractSet set) { + if (set instanceof TSupplCharSet) { + return ((TSupplCharSet)set).getCodePoint() == ch; + } else if (set instanceof TSupplRangeSet) { + return ((TSupplRangeSet)set).contains(ch); + } else if (set instanceof TCharSet) { return false; - } else if (set instanceof RangeSet) { + } else if (set instanceof TRangeSet) { return false; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SupplRangeSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSupplRangeSet.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SupplRangeSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSupplRangeSet.java index 169ac68ed..eca75c1a5 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/SupplRangeSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TSupplRangeSet.java @@ -87,25 +87,25 @@ package org.teavm.classlib.java.util.regex; * character can be supplementary (2 chars needed to represent) or from basic * 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; - public SupplRangeSet(AbstractCharClass cs, AbstractSet next) { + public TSupplRangeSet(TAbstractCharClass cs, TAbstractSet next) { this.chars = cs.getInstance(); this.alt = cs.alt; this.next = next; } - public SupplRangeSet(AbstractCharClass cc) { + public TSupplRangeSet(TAbstractCharClass cc) { this.chars = cc.getInstance(); this.alt = cc.alt; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { int strLength = matchResult.getRightBound(); int offset = -1; @@ -138,36 +138,36 @@ class SupplRangeSet extends JointSet { } @Override - public boolean first(AbstractSet set) { - if (set instanceof SupplCharSet) { - return AbstractCharClass.intersects(chars, ((SupplCharSet)set).getCodePoint()); - } else if (set instanceof CharSet) { - return AbstractCharClass.intersects(chars, ((CharSet)set).getChar()); - } else if (set instanceof SupplRangeSet) { - return AbstractCharClass.intersects(chars, ((SupplRangeSet)set).chars); - } else if (set instanceof RangeSet) { - return AbstractCharClass.intersects(chars, ((RangeSet)set).getChars()); + public boolean first(TAbstractSet set) { + if (set instanceof TSupplCharSet) { + return TAbstractCharClass.intersects(chars, ((TSupplCharSet)set).getCodePoint()); + } else if (set instanceof TCharSet) { + return TAbstractCharClass.intersects(chars, ((TCharSet)set).getChar()); + } else if (set instanceof TSupplRangeSet) { + return TAbstractCharClass.intersects(chars, ((TSupplRangeSet)set).chars); + } else if (set instanceof TRangeSet) { + return TAbstractCharClass.intersects(chars, ((TRangeSet)set).getChars()); } return true; } - protected AbstractCharClass getChars() { + protected TAbstractCharClass getChars() { return chars; } @Override - public AbstractSet getNext() { + public TAbstractSet getNext() { return next; } @Override - public void setNext(AbstractSet next) { + public void setNext(TAbstractSet next) { this.next = next; } @Override - public boolean hasConsumed(MatchResultImpl mr) { + public boolean hasConsumed(TMatchResultImpl mr) { return true; } } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIBackReferenceSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIBackReferenceSet.java similarity index 92% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIBackReferenceSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIBackReferenceSet.java index cb71d0173..0cb8693aa 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIBackReferenceSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIBackReferenceSet.java @@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class UCIBackReferenceSet extends CIBackReferenceSet { +class TUCIBackReferenceSet extends TCIBackReferenceSet { int groupIndex; - public UCIBackReferenceSet(int groupIndex, int consCounter) { + public TUCIBackReferenceSet(int groupIndex, int consCounter) { super(groupIndex, consCounter); } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { String group = getString(matchResult); if (group == null || (stringIndex + group.length()) > matchResult.getRightBound()) diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCICharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCICharSet.java similarity index 86% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCICharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCICharSet.java index cec7ceb9b..30a1e4bff 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCICharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCICharSet.java @@ -26,18 +26,17 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class UCICharSet extends LeafSet { +class TUCICharSet extends TLeafSet { private char ch; - public UCICharSet(char ch) { + public TUCICharSet(char ch) { this.ch = Character.toLowerCase(Character.toUpperCase(ch)); } @Override public int accepts(int strIndex, CharSequence testString) { - return (this.ch == Character.toLowerCase(Character - .toUpperCase(testString.charAt(strIndex)))) ? 1 : -1; + return (this.ch == Character.toLowerCase(Character.toUpperCase(testString.charAt(strIndex)))) ? 1 : -1; } @Override diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIDecomposedCharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIDecomposedCharSet.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIDecomposedCharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIDecomposedCharSet.java index e95b6cd6b..ab292cec5 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIDecomposedCharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIDecomposedCharSet.java @@ -24,12 +24,12 @@ package org.teavm.classlib.java.util.regex; * CANON_EQ flag of Pattern class * is specified. */ -class UCIDecomposedCharSet extends DecomposedCharSet{ +class TUCIDecomposedCharSet extends TDecomposedCharSet{ /* * Just only a stub */ - public UCIDecomposedCharSet(int [] decomp, int decomposedCharLength) { + public TUCIDecomposedCharSet(int [] decomp, int decomposedCharLength) { super(decomp, decomposedCharLength); } } \ No newline at end of file diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIRangeSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIRangeSet.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIRangeSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIRangeSet.java index 1ef12365f..64f66cde5 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCIRangeSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCIRangeSet.java @@ -27,19 +27,19 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class UCIRangeSet extends LeafSet { +class TUCIRangeSet extends TLeafSet { - private AbstractCharClass chars; + private TAbstractCharClass chars; private boolean alt = false; - public UCIRangeSet(AbstractCharClass cs, AbstractSet next) { + public TUCIRangeSet(TAbstractCharClass cs, TAbstractSet next) { super(next); this.chars = cs.getInstance(); this.alt = cs.alt; } - public UCIRangeSet(AbstractCharClass cc) { + public TUCIRangeSet(TAbstractCharClass cc) { this.chars = cc.getInstance(); this.alt = cc.alt; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISequenceSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISequenceSet.java similarity index 95% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISequenceSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISequenceSet.java index f05441e01..63154566f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISequenceSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISequenceSet.java @@ -25,11 +25,11 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class UCISequenceSet extends LeafSet { +class TUCISequenceSet extends TLeafSet { private String string = null; - UCISequenceSet(StringBuffer substring) { + TUCISequenceSet(StringBuffer substring) { StringBuilder res = new StringBuilder(); for (int i = 0; i < substring.length(); i++) { res.append(Character.toLowerCase(Character.toUpperCase(substring.charAt(i)))); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISupplCharSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISupplCharSet.java similarity index 98% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISupplCharSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISupplCharSet.java index ea64b1661..d60eb446d 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISupplCharSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISupplCharSet.java @@ -86,12 +86,12 @@ package org.teavm.classlib.java.util.regex; * Represents node accepting single supplementary codepoint in Unicode case * insensitive manner. */ -class UCISupplCharSet extends LeafSet { +class TUCISupplCharSet extends TLeafSet { // int value of this supplementary codepoint private int ch; - public UCISupplCharSet(int ch) { + public TUCISupplCharSet(int ch) { charCount = 2; this.ch = Character.toLowerCase(Character.toUpperCase(ch)); } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISupplRangeSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISupplRangeSet.java similarity index 96% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISupplRangeSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISupplRangeSet.java index 8aa2f2837..74ceedb6c 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UCISupplRangeSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUCISupplRangeSet.java @@ -88,13 +88,13 @@ package org.teavm.classlib.java.util.regex; * This character can be supplementary (2 chars to represent) or from * 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); } - public UCISupplRangeSet(AbstractCharClass cc) { + public TUCISupplRangeSet(TAbstractCharClass cc) { super(cc); } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UEOLSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUEOLSet.java similarity index 89% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UEOLSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUEOLSet.java index f34431102..66eab770e 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UEOLSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUEOLSet.java @@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -final class UEOLSet extends AbstractSet { +final class TUEOLSet extends TAbstractSet { private int consCounter; - public UEOLSet(int counter) { + public TUEOLSet(int counter) { this.consCounter = counter; } @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(); if (strIndex >= rightBound) { @@ -52,7 +52,7 @@ final class UEOLSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { int cons; boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); matchResult.setConsumed(consCounter, -1); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UMultiLineEOLSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUMultiLineEOLSet.java similarity index 88% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UMultiLineEOLSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUMultiLineEOLSet.java index 9c278274e..067774d25 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UMultiLineEOLSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUMultiLineEOLSet.java @@ -25,16 +25,16 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class UMultiLineEOLSet extends AbstractSet { +class TUMultiLineEOLSet extends TAbstractSet { private int consCounter; - public UMultiLineEOLSet(int counter) { + public TUMultiLineEOLSet(int counter) { this.consCounter = counter; } @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() - strIndex; if (strDif <= 0) { @@ -48,7 +48,7 @@ class UMultiLineEOLSet extends AbstractSet { } @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { int cons; boolean res = ((cons = matchResult.getConsumed(consCounter)) < 0 || cons > 0); matchResult.setConsumed(consCounter, -1); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnicodeCategory.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnicodeCategory.java similarity index 92% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnicodeCategory.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnicodeCategory.java index 310352af5..de4ef93d4 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnicodeCategory.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnicodeCategory.java @@ -25,11 +25,11 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class UnicodeCategory extends AbstractCharClass { +class TUnicodeCategory extends TAbstractCharClass { protected int category; - public UnicodeCategory(int category) { + public TUnicodeCategory(int category) { this.category = category; } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnicodeCategoryScope.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnicodeCategoryScope.java similarity index 91% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnicodeCategoryScope.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnicodeCategoryScope.java index ad6360d37..3f7fb4aba 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnicodeCategoryScope.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnicodeCategoryScope.java @@ -24,9 +24,9 @@ package org.teavm.classlib.java.util.regex; * Unicode category scope (i.e IsL, IsM, ...) * @author Nikolay A. Kuznetsov */ -class UnicodeCategoryScope extends UnicodeCategory { +class TUnicodeCategoryScope extends TUnicodeCategory { - public UnicodeCategoryScope(int category) { + public TUnicodeCategoryScope(int category) { super(category); } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnifiedQuantifierSet.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnifiedQuantifierSet.java similarity index 82% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnifiedQuantifierSet.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnifiedQuantifierSet.java index d9bf00315..832acab8c 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/UnifiedQuantifierSet.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TUnifiedQuantifierSet.java @@ -26,20 +26,20 @@ package org.teavm.classlib.java.util.regex; * * @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); } - public UnifiedQuantifierSet(LeafQuantifierSet quant) { - super((LeafSet)quant.getInnerSet(), quant.getNext(), quant.getType()); + public TUnifiedQuantifierSet(TLeafQuantifierSet quant) { + super((TLeafSet)quant.getInnerSet(), quant.getNext(), quant.getType()); innerSet.setNext(this); } @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() && leaf.accepts(stringIndex, testString) > 0) stringIndex += leaf.charCount(); @@ -48,7 +48,7 @@ class UnifiedQuantifierSet extends LeafQuantifierSet { } @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); if (startSearch < 0) return -1; diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/WordBoundary.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TWordBoundary.java similarity index 93% rename from teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/WordBoundary.java rename to teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TWordBoundary.java index 68d71e9e7..369be8878 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/WordBoundary.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/regex/TWordBoundary.java @@ -26,16 +26,16 @@ package org.teavm.classlib.java.util.regex; * * @author Nikolay A. Kuznetsov */ -class WordBoundary extends AbstractSet { +class TWordBoundary extends TAbstractSet { boolean positive; - public WordBoundary(boolean positive) { + public TWordBoundary(boolean positive) { this.positive = positive; } @Override - public int matches(int stringIndex, CharSequence testString, MatchResultImpl matchResult) { + public int matches(int stringIndex, CharSequence testString, TMatchResultImpl matchResult) { boolean left; boolean right; @@ -53,7 +53,7 @@ class WordBoundary extends AbstractSet { * do not move string index. */ @Override - public boolean hasConsumed(MatchResultImpl matchResult) { + public boolean hasConsumed(TMatchResultImpl matchResult) { // only checks boundary, do not consumes characters return false; } diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/MatcherTest.java b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/MatcherTest.java index 12af6b879..ce6fbbb48 100644 --- a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/MatcherTest.java +++ b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/MatcherTest.java @@ -625,42 +625,6 @@ public class MatcherTest { 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 public void testFindRegionChanged() { // Regression for HARMONY-625 @@ -705,8 +669,7 @@ public class MatcherTest { @Test public void testGeneralPunctuationCategory() { - String[] s = { ",", "!", "\"", "#", "%", "&", "'", "(", ")", "-", ".", - "/" }; + String[] s = { ",", "!", "\"", "#", "%", "&", "'", "(", ")", "-", ".", "/" }; String regexp = "\\p{P}"; for (int i = 0; i < s.length; i++) { @@ -728,12 +691,9 @@ public class MatcherTest { String floatRegex = getHexFloatRegex(); hitEndTest(true, "#03.0", floatRegex, Double.toHexString(-1.234d), true); - hitEndTest(true, "#03.1", floatRegex, "1 ABC" - + Double.toHexString(Double.NaN) + "buhuhu", false); - hitEndTest(true, "#03.2", floatRegex, Double.toHexString(-0.0) + "--", - false); - hitEndTest(true, "#03.3", floatRegex, "--" - + Double.toHexString(Double.MIN_VALUE) + "--", false); + hitEndTest(true, "#03.1", floatRegex, "1 ABC" + Double.toHexString(Double.NaN) + "buhuhu", false); + hitEndTest(true, "#03.2", floatRegex, Double.toHexString(-0.0) + "--", false); + hitEndTest(true, "#03.3", floatRegex, "--" + Double.toHexString(Double.MIN_VALUE) + "--", false); hitEndTest(true, "#04.0", "(\\d+) fish (\\d+) fish (\\w+) fish (\\d+)", "1 fish 2 fish red fish 5", true); @@ -743,10 +703,8 @@ public class MatcherTest { @Test public void testToString() { - String result = Pattern.compile("(\\d{1,3})").matcher( - "aaaa123456789045").toString(); - assertTrue("The result doesn't contain pattern info", result - .contains("(\\d{1,3})")); + String result = Pattern.compile("(\\d{1,3})").matcher("aaaa123456789045").toString(); + assertTrue("The result doesn't contain pattern info", result.contains("(\\d{1,3})")); } private void hitEndTest(boolean callFind, String testNo, String regex, diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/ModeTest.java b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/ModeTest.java index b8b95395e..b7ec7785c 100644 --- a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/ModeTest.java +++ b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/ModeTest.java @@ -19,7 +19,7 @@ package org.teavm.classlib.java.util.regex; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; - +import org.junit.Test; import junit.framework.TestCase; /** @@ -27,6 +27,7 @@ import junit.framework.TestCase; */ @SuppressWarnings("nls") public class ModeTest extends TestCase { + @Test public void testCase() throws PatternSyntaxException { Pattern p; Matcher m; @@ -54,6 +55,7 @@ public class ModeTest extends TestCase { assertFalse(m.find()); } + @Test public void testMultiline() throws PatternSyntaxException { Pattern p; Matcher m; diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/Pattern2Test.java b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/Pattern2Test.java index dfacec463..9413c5d95 100644 --- a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/Pattern2Test.java +++ b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/Pattern2Test.java @@ -19,7 +19,7 @@ package org.teavm.classlib.java.util.regex; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; - +import org.junit.Test; import junit.framework.TestCase; /** @@ -27,6 +27,7 @@ import junit.framework.TestCase; */ @SuppressWarnings("nls") public class Pattern2Test extends TestCase { + @Test public void testSimpleMatch() throws PatternSyntaxException { Pattern p = Pattern.compile("foo.*"); @@ -48,6 +49,7 @@ public class Pattern2Test extends TestCase { assertTrue(Pattern.matches("", "")); } + @Test public void testCursors() { Pattern p; Matcher m; @@ -103,6 +105,7 @@ public class Pattern2Test extends TestCase { } } + @Test public void testGroups() throws PatternSyntaxException { Pattern p; Matcher m; @@ -156,6 +159,7 @@ public class Pattern2Test extends TestCase { assertFalse(m.find()); } + @Test public void testReplace() throws PatternSyntaxException { Pattern p; Matcher m; @@ -197,12 +201,11 @@ public class Pattern2Test extends TestCase { p = Pattern.compile("([CcPp][hl]e[ea]se)"); m = p.matcher("I want cheese. Please."); - assertTrue(m.replaceFirst(" $1 ").equals( - "I want cheese . Please.")); - assertTrue(m.replaceAll(" $1 ").equals( - "I want cheese . Please .")); + assertTrue(m.replaceFirst(" $1 ").equals("I want cheese . Please.")); + assertTrue(m.replaceAll(" $1 ").equals("I want cheese . Please .")); } + @Test public void testEscapes() throws PatternSyntaxException { Pattern p; Matcher m; @@ -239,7 +242,7 @@ public class Pattern2Test extends TestCase { assertFalse(m.find()); // Test \\u and \\x sequences -p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); + p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); m = p.matcher("11:;22 ;33-;44!;"); assertTrue(m.find()); assertEquals("11", m.group(1)); @@ -396,6 +399,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); // } } + @Test public void testCharacterClasses() throws PatternSyntaxException { Pattern p; Matcher m; @@ -654,6 +658,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); // TODO } + @Test public void testPOSIXGroups() throws PatternSyntaxException { Pattern p; Matcher m; @@ -795,6 +800,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); // TODO } + @Test public void testUnicodeCategories() throws PatternSyntaxException { // Test Unicode categories using \p and \P // One letter codes: L, M, N, P, S, Z, C @@ -843,6 +849,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); // Cn } + @Test public void testUnicodeBlocks() throws PatternSyntaxException { Pattern p; Matcher m; @@ -912,6 +919,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); } } + @Test public void testCapturingGroups() throws PatternSyntaxException { // Test simple capturing groups // TODO @@ -929,6 +937,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); // TODO } + @Test public void testRepeats() { // Test ? // TODO @@ -949,6 +958,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); // TODO } + @Test public void testAnchors() throws PatternSyntaxException { // Test ^, default and MULTILINE // TODO @@ -987,6 +997,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); // TODO } + @Test public void testMisc() throws PatternSyntaxException { Pattern p; Matcher m; @@ -1048,6 +1059,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); // TODO } + @Test public void testCompile1() throws PatternSyntaxException { Pattern pattern = Pattern .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()); } + @Test public void testCompile2() throws PatternSyntaxException { String findString = "\\Qimport\\E"; @@ -1065,6 +1078,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); assertTrue(matcher.find(0)); } + @Test public void testCompile3() throws PatternSyntaxException { Pattern p; Matcher m; @@ -1144,6 +1158,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); assertFalse(m.find()); } + @Test public void testCompile4() throws PatternSyntaxException { String findString = "\\Qpublic\\E"; StringBuffer text = new StringBuffer(" public class Class {\n" @@ -1166,6 +1181,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); assertFalse(found); } + @Test public void testCompile5() throws PatternSyntaxException { Pattern p = Pattern.compile("^[0-9]"); String s[] = p.split("12", -1); diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternErrorTest.java b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternErrorTest.java index a73f91895..f5d553840 100644 --- a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternErrorTest.java +++ b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternErrorTest.java @@ -17,7 +17,7 @@ package org.teavm.classlib.java.util.regex; import java.util.regex.Pattern; - +import org.junit.Test; import junit.framework.TestCase; /** @@ -25,6 +25,7 @@ import junit.framework.TestCase; */ @SuppressWarnings("nls") public class PatternErrorTest extends TestCase { + @Test public void testCompileErrors() throws Exception { // null regex string - should get NullPointerException try { diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternSyntaxExceptionTest.java b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternSyntaxExceptionTest.java index c9e53a633..63b01e995 100644 --- a/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternSyntaxExceptionTest.java +++ b/teavm-classlib/src/test/java/org/teavm/classlib/java/util/regex/PatternSyntaxExceptionTest.java @@ -18,7 +18,7 @@ package org.teavm.classlib.java.util.regex; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; - +import org.junit.Test; import junit.framework.TestCase; @@ -27,6 +27,7 @@ import junit.framework.TestCase; */ @SuppressWarnings("nls") public class PatternSyntaxExceptionTest extends TestCase { + @Test public void testCase() { String regex = "("; try { @@ -43,6 +44,7 @@ public class PatternSyntaxExceptionTest extends TestCase { } } + @Test public void testCase2() { String regex = "[4-"; try {