diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-09-22 17:54:12 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-09-22 18:50:50 -0700 |
commit | 5255171e6cd0accee6f76ea2980e32b3b5b8e171 (patch) | |
tree | f198188a949f401983d4493ed514365d2c09213c /regexp.h | |
parent | d8e299374017857bcc055c31b6d4a808fb862100 (diff) | |
download | perl-5255171e6cd0accee6f76ea2980e32b3b5b8e171.tar.gz |
[perl #94490] const fold should not trigger special split " "
The easiest way to fix this was to move the special handling out of
the regexp engine. Now a flag is set on the split op itself for
this case. A real regexp is still created, as that is the most
convenient way to propagate locale settings, and it prevents the
need to rework pp_split to handle a null regexp.
This also means that custom regexp plugins no longer need to handle
split specially (which they all do currently).
Diffstat (limited to 'regexp.h')
-rw-r--r-- | regexp.h | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -395,11 +395,14 @@ get_regex_charset_name(const U32 flags, STRLEN* const lenp) #define RXf_INTUIT_TAIL (1<<(RXf_BASE_SHIFT+14)) /* - Set in Perl_pmruntime if op_flags & OPf_SPECIAL, i.e. split. Will - be used by regex engines to check whether they should set - RXf_SKIPWHITE + This used to be set in Perl_pmruntime if op_flags & OPf_SPECIAL, i.e. + split. It was used by the regex engine to check whether it should set + RXf_SKIPWHITE. Regexp plugins on CPAN also have done the same thing + historically, so we leave this flag defined, even though it is never set. */ -#define RXf_SPLIT (1<<(RXf_BASE_SHIFT+15)) +#if !defined(PERL_CORE) || defined(PERL_IN_DUMP_C) +# define RXf_SPLIT (1<<(RXf_BASE_SHIFT+15)) +#endif #define RXf_USE_INTUIT (RXf_USE_INTUIT_NOML|RXf_USE_INTUIT_ML) @@ -414,7 +417,10 @@ get_regex_charset_name(const U32 flags, STRLEN* const lenp) /* Flags indicating special patterns */ #define RXf_START_ONLY (1<<(RXf_BASE_SHIFT+19)) /* Pattern is /^/ */ -#define RXf_SKIPWHITE (1<<(RXf_BASE_SHIFT+20)) /* Pattern is for a split " " */ +/* No longer used, but CPAN modules still mention it. */ +#if !defined(PERL_CORE) || defined(PERL_IN_DUMP_C) +# define RXf_SKIPWHITE (1<<(RXf_BASE_SHIFT+20)) /* Pattern is for a split " " */ +#endif #define RXf_WHITE (1<<(RXf_BASE_SHIFT+21)) /* Pattern is /\s+/ */ #define RXf_NULL (1U<<(RXf_BASE_SHIFT+22)) /* Pattern is // */ #if RXf_BASE_SHIFT+22 > 31 |