On Tuesday 10 May 2005 20:29, Patrick R. Michaud wrote: > On Tue, May 10, 2005 at 05:08:49PM +0200, Jens Rieks wrote: > > On Monday 09 May 2005 07:53, Patrick R. Michaud wrote: > > > The attached patch file adjusts C<is_cclass> to always return false > > > for offsets beyond the end of the string, and updates > > > t/op/string_cclass.t to test this. > > > > Thanks, applied! > > > > find_cclass and find_not_cclass are in now. > > This is *excellent*. > > However, now that I look at things, I'm wondering if a slight > change to the specification would be in order -- in my original > post I said that find_cclass and find_not_cclass would return -1 > whenever they (didn't find | found) the character of interest -- > perhaps it would be better for them to return the length of > the string instead? > > This might make it easier to do things like: > > .local int pos > .local string token > > $I0 = find_not_cclass .CCLASS_WORD, $S0, pos > $I0 -= pos > token = $S0 > > whereas if we return -1 on "not found", we have to do some funny > checking for it (rather than getting a nice null string). > Note that we can still easily check for the existence of the char... > > .local int pos > .local string token > > $I2 = length $S0 > $I0 = find_not_cclass .CCLASS_WORD, $S0, pos > if $I0 == $I2 goto end_of_string_reached > > If you're in agreement, I'll create/submit a patch and update > the test files. Best to decide this now before too many people > start using it. :-) Yes, sounds reasonable.
> Pm jens