jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCallum <gho...@xtra.co.nz>
Subject Re: Bugs I've found
Date Mon, 26 Feb 2001 11:07:14 GMT
On Friday 23 February 2001 23:16, you wrote:
} I've found two bugs recently in regexp.  I'm new to the list, so I
} apologize if these are known issues.
New solutions are always good for comparison.
Esp when untainted by the previous ones. (Like the prime directive :)

} 1) RECompiler dies when compiling regular expressions with '*?('
} sequence of characters in the regexp.  Sometimes the next offset of a node
} has not been set to zero, so when next = node + instruction[node +
} offsetNext], next is very large, and you get an arrayoutOfBounds
} exception.  I added a check to make sure there was no array out of bounds
} case, and returned -1 in that case.  It appears to work, but there may be
} a more correct way to fix this bug.
I fixed this by making sure the nextOfEnd did not go past the list of currently defined nodes.

} 2) The other problem is with reluctant closures.  Because reluctant
} closures are not recursive, cases like the following fail: b(aaa|aaaaa)*?b
} does not accept baaaaaaaaaab (10 a's), when it should.  I have tried to
} change around reluctant closures so they're implemented more similarly to
} greedy ones(with recursive or's), but I don't have it working yet.
I noticed when looking at this that the greedy and non-greedy closures were implemented differently.
Was not sure why. Do you think you can get the recursive or's working?
Because of the current implementation of the nongreedy closures you get infinite loops generated
I stoped this by not allowing the loop to be created but if youve fixed the non-greedy closures
I can get rid of that hack.

Send a patch for the fixes you came up with.
I'll put them in.


View raw message