From: Ito Kazumitsu <[EMAIL PROTECTED]>
Date: Mon, 30 Jan 2006 00:18:47 +0900 (JST)
> ChangeLog
> 2006-01-29 Ito Kazumitsu <[EMAIL PROTECTED]>
>
> Fixes bug #24876
> * gnu/regexp/gnu/regexp/RE.java(REG_TRY_ENTIRE_MATCH):
> New execution flag.
> (getMatchImpl): if REG_TRY_ENTIRE_MATCH is set, add an
> implicit RETokenEnd at the end of the regexp chain.
> Do not select the longest match, but select the first match.
> (match): Do not take care of REMatch.empty.
> * gnu/regexp/REMatch.java(empty): To be used only in RETokenRepeated.
> * gnu/regexp/RETokenOneOf.java: Corrected a typo in a comment.
> * gnu/regexp/RETokenBackRef.java: Do not take care of REMatch.empty.
> * gnu/regexp/RETokenRepeated.java (match): Rewrote stingy matching.
> Do not take care of REMatch.empty. Set and check REMatch.empty
> when trying to match the single token.
I should have checked this in at the same time as above.
2006-02-06 Ito Kazumitsu <[EMAIL PROTECTED]>
* java/util/regex/Matcher.java(matches):
set RE.REG_TRY_ENTIRE_MATCH as an execution flag of getMatch.
Index: classpath/java/util/regex/Matcher.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/regex/Matcher.java,v
retrieving revision 1.11
diff -u -r1.11 Matcher.java
--- classpath/java/util/regex/Matcher.java 24 Jan 2006 15:44:28 -0000
1.11
+++ classpath/java/util/regex/Matcher.java 6 Feb 2006 14:11:25 -0000
@@ -1,5 +1,5 @@
/* Matcher.java -- Instance of a regular expression applied to a char sequence.
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,7 @@
package java.util.regex;
+import gnu.regexp.RE;
import gnu.regexp.REMatch;
/**
@@ -233,10 +234,15 @@
*/
public boolean matches ()
{
- if (lookingAt())
+ match = pattern.getRE().getMatch(input, 0, RE.REG_TRY_ENTIRE_MATCH);
+ if (match != null)
{
- if (position == input.length())
- return true;
+ if (match.getStartIndex() == 0)
+ {
+ position = match.getEndIndex();
+ if (position == input.length())
+ return true;
+ }
match = null;
}
return false;