In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/0c2829400b005cbfc6543affe3aa5a63616b7498?hp=b4069bca6054692e4fffa8e9e04572511e910fbd>
- Log ----------------------------------------------------------------- commit 0c2829400b005cbfc6543affe3aa5a63616b7498 Author: Karl Williamson <[email protected]> Date: Tue Feb 28 17:27:43 2012 -0700 regcomp.c: Add comment M regcomp.c commit 00b27cfcf04d3cbe5327f810377c46c2007c10d5 Author: Karl Williamson <[email protected]> Date: Tue Feb 28 17:11:31 2012 -0700 regcomp.c: Add comment, reorder #define more logically M regcomp.c commit 9fa196e11dd896d12236f0f566c5c556473e1cdc Author: Karl Williamson <[email protected]> Date: Mon Feb 20 11:32:18 2012 -0700 re/pat.t: Remove obsolete comment M t/re/pat.t commit 96f54887615ec13b0713f735c3ec6618468ec51f Author: Karl Williamson <[email protected]> Date: Mon Feb 20 11:27:03 2012 -0700 (?foo:...) loses passed in charset This commit looks for the passed-in charset, and overrides it only if it is /d and the pattern requires /u. Previously the passed-in value was ignored. M regcomp.c M t/re/pat.t ----------------------------------------------------------------------- Summary of changes: regcomp.c | 15 +++++++++++---- t/re/pat.t | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/regcomp.c b/regcomp.c index 1e1dcfd..7a3433a 100644 --- a/regcomp.c +++ b/regcomp.c @@ -382,9 +382,11 @@ static const scan_data_t zero_scan_data = #define SCF_SEEN_ACCEPT 0x8000 #define UTF cBOOL(RExC_utf8) + +/* The enums for all these are ordered so things work out correctly */ #define LOC (get_regex_charset(RExC_flags) == REGEX_LOCALE_CHARSET) -#define UNI_SEMANTICS (get_regex_charset(RExC_flags) == REGEX_UNICODE_CHARSET) #define DEPENDS_SEMANTICS (get_regex_charset(RExC_flags) == REGEX_DEPENDS_CHARSET) +#define UNI_SEMANTICS (get_regex_charset(RExC_flags) == REGEX_UNICODE_CHARSET) #define AT_LEAST_UNI_SEMANTICS (get_regex_charset(RExC_flags) >= REGEX_UNICODE_CHARSET) #define ASCII_RESTRICTED (get_regex_charset(RExC_flags) == REGEX_ASCII_RESTRICTED_CHARSET) #define MORE_ASCII_RESTRICTED (get_regex_charset(RExC_flags) == REGEX_ASCII_MORE_RESTRICTED_CHARSET) @@ -8010,9 +8012,12 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth) U32 posflags = 0, negflags = 0; U32 *flagsp = &posflags; char has_charset_modifier = '\0'; - regex_charset cs = (RExC_utf8 || RExC_uni_semantics) - ? REGEX_UNICODE_CHARSET - : REGEX_DEPENDS_CHARSET; + regex_charset cs = get_regex_charset(RExC_flags); + if (cs == REGEX_DEPENDS_CHARSET + && (RExC_utf8 || RExC_uni_semantics)) + { + cs = REGEX_UNICODE_CHARSET; + } while (*RExC_parse) { /* && strchr("iogcmsx", *RExC_parse) */ @@ -10848,6 +10853,8 @@ parseit: PL_PosixCntrl, PL_XPosixCntrl); break; case ANYOF_DIGIT: + /* Ignore the compiler warning for this macro, planned to + * be eliminated later */ DO_POSIX_LATIN1_ONLY_KNOWN(ret, namedclass, properties, PL_PosixDigit, PL_PosixDigit, "XPosixDigit", listsv); break; diff --git a/t/re/pat.t b/t/re/pat.t index b4b7ac4..624b0d9 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -2,9 +2,7 @@ # # This is a home for regular expression tests that don't fit into # the format supported by re/regexp.t. If you want to add a test -# that does fit that format, add it to re/re_tests, not here. Tests for \N -# should be added here because they are treated as single quoted strings -# there, which means they avoid the lexer which otherwise would look at them. +# that does fit that format, add it to re/re_tests, not here. use strict; use warnings; @@ -21,7 +19,7 @@ BEGIN { require './test.pl'; } -plan tests => 469; # Update this when adding/deleting tests. +plan tests => 472; # Update this when adding/deleting tests. run_tests() unless caller; @@ -1253,6 +1251,15 @@ EOP $anch_count++ while $str=~/^.*/mg; is $anch_count, 1, 'while "\n"=~/^.*/mg should match only once'; } + + { # [perl #111174] + use re '/u'; + like "\xe0", qr/(?i:\xc0)/, "(?i: shouldn't lose the passed in /u"; + use re '/a'; + unlike "\x{100}", qr/(?i:\w)/, "(?i: shouldn't lose the passed in /a"; + use re '/aa'; + unlike 'k', qr/(?i:\N{KELVIN SIGN})/, "(?i: shouldn't lose the passed in /aa"; + } } # End of sub run_tests 1; -- Perl5 Master Repository
