Front page | perl.perl6.internals |
Postings from January 2002
The dreaded regex patch
Thread Next
From:
Brent Dax
Date:
January 9, 2002 03:14
Subject:
The dreaded regex patch
Message ID:
FJELLKOPEAGHOOODKEDPIEJFDAAA.brentdax@cpan.org
Okay, here it is. Attached is the regular expression patch. It
currently segfaults on Windows because of a combination of two factors:
1) There are some bounds-checking issues in key.c
2) Windows's malloc() isn't as robust as Unix's
This is only a problem on native Windows, not on Cygwin; I've confirmed
this myself.
Besides what you'd expect it to do, this patch makes a (very) minor
change to string.c. Basically, it makes it so that you can take a
zero-length substring with an index equal to the size of the string.
This is done so that the equivalent to "<$`><$&><$'>" doesn't need a
special case in the bytecode when $& reaches all the way to the end of
the string.
Copious documentation is included in rx.ops, and twenty tests are
included in t/op/rx.t. This patch is reliant on the ParrotPointer patch
I sent in earlier.
I can't quite guarantee that the patch will apply cleanly--I had to
manually change some things in it--but the things that may not apply
well should be easy to put in manually.
UNIMPLEMENTED OPCODES:
rx_compile - compile a regex
rx_cloneinfo - clone the info structure (used for look(ahead|behind)s)
UNTESTED OPCODES:
rx_forwards - tell the regex to increment the current index when moving
rx_backwards - tell the regex to decrement the current index when
moving
Share and enjoy.
--Brent Dax
brentdax@cpan.org
Configure pumpking for Perl 6
<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?
Thread Next
-
The dreaded regex patch
by Brent Dax