>>>>> "Ito" == Ito Kazumitsu <[EMAIL PROTECTED]> writes:

Ito> I am not sure of what java.util.regex.Matcher#hitEnd() should return,
Ito> but this is my proposed patch.

It should return true if more input could possibly satisfy the regular
expression.

This is needed by Scanner.  Scanner buffers input from a data source;
if there is insufficient data in the buffer then a regular expression
describing a token may not match -- but if we had buffered more data,
it might match.  So, this method is needed to ensure that we can
distinguish between the case of "failed because the regular expression
cannot match this buffer" and "failed because the buffer does not
contain enough data".

Eg consider the expression "bbba+".  If the buffer contains "bbb",
then hitEnd should return true -- if we read more data we might
possibly match this expression.  But if the buffer contained "maude",
then hitEnd would return false.

FWIW I have a decent chunk of Scanner sitting here.  Not enough to
test yet... if someone is interested I can send it out.

Ito> +  public boolean hitEnd()
Ito> +  {
Ito> +    assertMatchOp();
Ito> +    return (match.getEndIndex() == input.length());

I suspect this won't work properly.

Tom

Reply via email to