This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Better optimize [classes] under /aa.
authorKarl Williamson <public@khwilliamson.com>
Fri, 6 Jan 2012 20:46:17 +0000 (13:46 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:39 +0000 (09:58 -0700)
commitbf4c00b474859c4f7090aa4d9988621f0cd3946c
tree38e1a0505468ed8a82f5815c6a4a4e27436c0feb
parentd9105c956266099fce1d9a12501a44113182711e
regcomp.c: Better optimize [classes] under /aa.

An optimization introduced in 5.14 is for bracketed character classes of
the very special form like [Bb].  These can be optimized into an
EXACTFish node.  In this case, they can be optimized to an EXACTFA node
since they are ASCII characters.  If the surrounding options are /aa, it
is likely that any adjacent EXACTFish nodes will be EXACTFA, so optimize
to that node instead of the previous EXACTFU.  This will allow the
optimizer to collapse any adjacent nodes.  For example

    qr/a[B]c/aai

will now get optimized to  an EXACTFA of "abc".  Previously it would
have gotten optimized to EXACTFA<a> . EXACTFU<b> . EXACTFA<c>.
regcomp.c