On Dec-04, Leopold Toetsch wrote: > Steve Fink (via RT) wrote: > > >so that I can just use 'rx_pos' within my (possibly nested) namespace. > > > >So that's what this patch implements. A .local <type> <varname> > >directive now creates a variable named <current-namespace>::<varname> > >(or just <varname> at the top level), > > Looks ok too. If no one hollers, I'll apply it. > > I don't know, if your are speaking of the current rx.c or a new regex > implementation, but the current "stateless" approach has some drawbacks: > it leaks memory (bitmap) and isn't reentrant (intstack). > There should probably be some regex PMC that can store the state of a regex.
I don't use either one. For character classes, I use inclusion/exclusion lists. Maybe someday I'll add bitmaps as an optimization, but they're very charset-specific and I doubt they gain much speed over a JITted inclusion/exclusion search. For the things that the intstack could be used for, I use an IntList PMC. And the rest of the state that the regex state object was maintaining is kept in a combination of IntList PMCs, integer registers, and a string register. Different registers are used for each regex, so it is properly reentrant (and it relies on IMCC for register allocation, so it doesn't waste them either.) I don't use any of the rx_* ops at all. The engine I'm referring to is the one checked into languages/regex, although at the moment it may not work straight out of there (try a 'make test'). I'll do a commit of stuff that works with perl6 soon, now that the necessary IMCC changes are in (thanks). But the regex compiler is the same one that's been there since August; it just isn't used in anything, so is easily overlooked. :-)