Andy Dougherty:
# On Tue, 15 Jan 2002, Melvin Smith wrote:
#
# > Maybe set the check to :
# >
# > if(rx->startindex-- == 0)
#
# That still sets startindex to the equivalent of (unsigned)
# -1, which might
# be something like 4294967295. I'm wondering whether that was
# the actual
# intent. I suspect probably not. Perhaps Brent really wanted
# a -1 there
# and forgot that startindex was unsigned. Perhaps this is
# supposed to be a
# "Can't happen" branch and it would benefit from a stronger
# diagnostic. I
# don't understand the surrounding context well enough to say.
Short answer: This might as well be signed, and I committed a patch
earlier today that makes it signed.
Long answer:
The structure of that opcode is something like this:
op rx_advance {
if(we're starting at the left side of the string) {
if(++startindex is past the end of the string) {
BACKTRACK
}
}
else { /* we're starting at the right side of the string */
if(--startindex is past the beginning of the string) {
BACKTRACK
}
}
synchronize startindex and index
clear the stack
CONTINUE
}
The --startindex < 0 is a convenient way to test if it's past the
beginning. startindex-- == 0 would probably work just as well. Either
way, I've changed startindex to an INTVAL, since more of the contexts
it's used in expect INTVALs than not.
--Brent Dax
[EMAIL PROTECTED]
Parrot Configure pumpking and regex hacker
<obra> mmmm. hawt sysadmin chx0rs
<lathos> This is sad. I know of *a* hawt sysamin chx0r.
<obra> I know more than a few.
<lathos> obra: There are two? Are you sure it's not the same one?