diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-08-09 14:38:03 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-08-11 19:32:31 -0600 |
commit | 34b39fc9cd81fbff0d52451a5c4570293817ca32 (patch) | |
tree | 2d3faa4109ecba6c5d1c1cb2bb2279fd1048d122 /embed.h | |
parent | 78412e20d4b28d3841c99754748aa4a28fe204d3 (diff) | |
download | perl-34b39fc9cd81fbff0d52451a5c4570293817ca32.tar.gz |
regcomp.c: Set flags when optimizing a [char class]
A bracketed character class containing a single Latin1-range character
has long been optimized into an EXACT node. Also, flags are set to
include SIMPLE. However, EXACT nodes containing code points that are
different when encoded under UTF-8 versus not UTF-8 should not be marked
simple.
To fix this, the address of the flags parameter is now passed to
regclass(), the function that parses bracketed character classes, which
now sets it appropriately. The unconditional setting of SIMPLE that was
always done in the code after calling regclass() has been removed.
In addition, the setting of the flags for EXACT nodes has been pushed
into the common function that populates them.
regclass() will also now increment the naughtiness count if optimized to
a node that normally does that. I do not understand this heuristic
behavior very well, and could not come up with a test case for it;
experimentation revealed that there are no test cases in our test suite
for which naughtiness makes any difference at all.
Diffstat (limited to 'embed.h')
-rw-r--r-- | embed.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -908,7 +908,7 @@ #define add_alternate(a,b,c) S_add_alternate(aTHX_ a,b,c) #define add_cp_to_invlist(a,b) S_add_cp_to_invlist(aTHX_ a,b) #define add_data S_add_data -#define alloc_maybe_populate_EXACT(a,b,c,d) S_alloc_maybe_populate_EXACT(aTHX_ a,b,c,d) +#define alloc_maybe_populate_EXACT(a,b,c,d,e) S_alloc_maybe_populate_EXACT(aTHX_ a,b,c,d,e) #define checkposixcc(a) S_checkposixcc(aTHX_ a) #define cl_and S_cl_and #define cl_anything S_cl_anything @@ -943,7 +943,7 @@ #define reganode(a,b,c) S_reganode(aTHX_ a,b,c) #define regatom(a,b,c) S_regatom(aTHX_ a,b,c) #define regbranch(a,b,c,d) S_regbranch(aTHX_ a,b,c,d) -#define regclass(a,b) S_regclass(aTHX_ a,b) +#define regclass(a,b,c) S_regclass(aTHX_ a,b,c) #define reginsert(a,b,c,d) S_reginsert(aTHX_ a,b,c,d) #define regpiece(a,b,c) S_regpiece(aTHX_ a,b,c) #define regpposixcc(a,b) S_regpposixcc(aTHX_ a,b) |