[kaffe] java.util.regex patch
Mark Wielaard
mark@klomp.org
Thu Jan 8 03:20:04 2004
--=-fkKhJ0WoFw6OpVwfHiSi
Content-Type: multipart/mixed; boundary="=-106XG9QxvTgpgVBZVOOu"
--=-106XG9QxvTgpgVBZVOOu
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Hi,
I am preparing for inclusion of java.util.regex and gnu.regexp in GNU
Classpath. I just added some test cases to Mauve. I need the following
patches to make them work correctly with kaffe. Hope they make sense.
2004-01-08 Mark Wielaard <mark@klomp.org>
* java/util/regex/Matcher.java (find): Check whether or not we are
stuck at the same position after a successful match and bump position
of possible.
* java/util/regex/Pattern.java (split(CharSequence, int)): Use
ArrayList, not Vector. Make sure we match at most limit -1 times, w=
hen
limit > 0. Check whether or not to add emtpty strings.
They are only against the java.util.regex wrappers, I haven't looked at
gnu.regexp proper yet. I have some more Mauve tests that I will check in
later, but gnu.regexp doesn't seem to support octal, hex and unicode
escapes yet so most of them fail.
Cheers,
Mark
--=-106XG9QxvTgpgVBZVOOu
Content-Disposition: inline; filename=regex.patch
Content-Type: text/x-patch; name=regex.patch; charset=ISO-8859-1
Content-Transfer-Encoding: base64
SW5kZXg6IGxpYnJhcmllcy9qYXZhbGliL2phdmEvdXRpbC9yZWdleC9NYXRjaGVyLmphdmENCj09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT0NClJDUyBmaWxlOiAvY3ZzL2thZmZlL2thZmZlL2xpYnJhcmllcy9qYXZhbGliL2ph
dmEvdXRpbC9yZWdleC9NYXRjaGVyLmphdmEsdg0KcmV0cmlldmluZyByZXZpc2lvbiAxLjMNCmRp
ZmYgLXUgLXIxLjMgTWF0Y2hlci5qYXZhDQotLS0gbGlicmFyaWVzL2phdmFsaWIvamF2YS91dGls
L3JlZ2V4L01hdGNoZXIuamF2YQkxMyBPY3QgMjAwMyAwMzoxMDowNCAtMDAwMAkxLjMNCisrKyBs
aWJyY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KIAl9DQorDQogCVN0cmluZ1tdIG91dHB1dCA9IG5ldyBTdHJpbmcgW2xpc3Quc2l6ZSgp
XTsNCi0JbGlzdC5jb3B5SW50byhvdXRwdXQpOw0KKwlsaXN0LnRvQXJyYXkob3V0cHV0KTsNCiAJ
cmV0dXJuIG91dHB1dDsNCiAgICAgfQ0KIH0NCg==
--=-106XG9QxvTgpgVBZVOOu--
--=-fkKhJ0WoFw6OpVwfHiSi
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQA//Ty5xVhZCJWr9QwRAg83AJ9BlHBEM00KEDIIbbh0jH12LXIe7ACgoBAd
bptgRFRimf2xUjguqhH7ZUs=
=A6xk
-----END PGP SIGNATURE-----
--=-fkKhJ0WoFw6OpVwfHiSi--