Commit 0384c765 by Mark Wielaard Committed by Anthony Green

Reported by Timo Lindfors <timo.lindfors@iki.fi> java/util/regex/Matcher.java...

2005-02-07  Mark Wielaard  <mark@klomp.org>

        Reported by Timo Lindfors <timo.lindfors@iki.fi>
        java/util/regex/Matcher.java (lookingAt): Set position when match
        found.
        (matches): Implemented through lookingAt().

2005-02-07  Mark Wielaard  <mark@klomp.org>

        Fix suggested by Timo Lindfors <timo.lindfors@iki.fi>
        * java/util/regex/Pattern.java (split(CharSequence,int)):
        Fix while empties > 0 loops.

From-SVN: r94713
parent 7f5c93ac
2005-02-07 Mark Wielaard <mark@klomp.org>
Reported by Timo Lindfors <timo.lindfors@iki.fi>
java/util/regex/Matcher.java (lookingAt): Set position when match
found.
(matches): Implemented through lookingAt().
2005-02-07 Mark Wielaard <mark@klomp.org>
Fix suggested by Timo Lindfors <timo.lindfors@iki.fi>
* java/util/regex/Pattern.java (split(CharSequence,int)):
Fix while empties > 0 loops.
2005-02-07 Robert Schuster <thebohemian@gmx.net> 2005-02-07 Robert Schuster <thebohemian@gmx.net>
* gnu/java/nio/charset/ISO_8859_1.java, * gnu/java/nio/charset/ISO_8859_1.java,
......
...@@ -212,7 +212,10 @@ public final class Matcher ...@@ -212,7 +212,10 @@ public final class Matcher
if (match != null) if (match != null)
{ {
if (match.getStartIndex() == 0) if (match.getStartIndex() == 0)
return true; {
position = match.getEndIndex();
return true;
}
match = null; match = null;
} }
return false; return false;
...@@ -230,7 +233,13 @@ public final class Matcher ...@@ -230,7 +233,13 @@ public final class Matcher
*/ */
public boolean matches () public boolean matches ()
{ {
return find(0); if (lookingAt())
{
if (position == input.length())
return true;
match = null;
}
return false;
} }
/** /**
......
...@@ -198,8 +198,11 @@ public final class Pattern implements Serializable ...@@ -198,8 +198,11 @@ public final class Pattern implements Serializable
empties++; empties++;
else else
{ {
while (empties-- > 0) while (empties > 0)
list.add(""); {
list.add("");
empties--;
}
String text = input.subSequence(start, end).toString(); String text = input.subSequence(start, end).toString();
list.add(text); list.add(text);
...@@ -222,8 +225,11 @@ public final class Pattern implements Serializable ...@@ -222,8 +225,11 @@ public final class Pattern implements Serializable
int max = limit - list.size(); int max = limit - list.size();
empties = (empties > max) ? max : empties; empties = (empties > max) ? max : empties;
} }
while (empties-- > 0) while (empties > 0)
list.add(""); {
list.add("");
empties--;
}
} }
// last token at end // last token at end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment