This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Revise bracketed char class optimizations
authorKarl Williamson <public@khwilliamson.com>
Mon, 23 Jul 2012 04:37:21 +0000 (22:37 -0600)
committerKarl Williamson <public@khwilliamson.com>
Wed, 25 Jul 2012 03:13:50 +0000 (21:13 -0600)
commita0a069481f2e588ef1b3d329a8063402684d2222
tree9b3151ff31a06509552c78f696dade0c80fc5576
parent5863c1497f9c3894866e6ddc60e96c35db9f547c
regcomp.c: Revise bracketed char class optimizations

This commit uses the inversion list instead of the bit map constructed
during compilation of [bracketed classes] for determining the
optimizations that are done at the very end of processing the class.
This provides optimizations for things that can't be seen by just
looking at the bitmap.

There are optimizations done earlier in the code for things
that can be easily caught in Pass 1, but now we have complete
information.  At this time, I'm not repeating checking for most
optimizations that are checked for earlier, though this could be added.
The earlier optimizations could overlook cases where someone specified a
class in a suboptimal way.  For example the earlier code looks for a
class with a single range [0-9], but those 10 code points could instead
have been specified via [0123456789], and the code doesn't catch that
currently; here we could, but I'm not doing so at this time.

The code does do some duplicate checking.  For example, some Unicode
properties match only a single code point, such as lb=cr, and these
aren't known at the earlier point where single code point classes are
checked for.
regcomp.c