In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/37820adc4aeb8cb209843cf0abf3b24c8e5b59e8?hp=5149cfce110f600477036b7ec146007b3c1a2ba8>

- Log -----------------------------------------------------------------
commit 37820adc4aeb8cb209843cf0abf3b24c8e5b59e8
Author: Karl Williamson <k...@khw-desktop.(none)>
Date:   Sat May 8 14:06:10 2010 -0600

    PATCH [perl #74978] dot after } breaks \N{}
    
    The problem is that a dot can come between the braces in \N{foo.bar},
    but when searching for it, I didn't stop looking at the right brace, so
    it generated an error inappropriately.
    
    This is essentially a minimum patch; efficiency could be improved
    slightly with a little more work.

M       regcomp.c
M       t/re/pat.t

commit 223766f2ba0eeef12a35d112ccbad9d07bb5e8ae
Author: Karl Williamson <k...@khw-desktop.(none)>
Date:   Sat May 8 13:38:27 2010 -0600

    Note in comment that many \N{...} tests won't work here

M       t/re/re_tests

commit dc86499e2e4862410d2fe059473fe379d570b6c2
Author: Karl Williamson <k...@khw-desktop.(none)>
Date:   Sat May 8 13:12:53 2010 -0600

    Comment where to find file's format

M       t/re/re_tests
-----------------------------------------------------------------------

Summary of changes:
 regcomp.c     |    8 +++-----
 t/re/pat.t    |    8 +++++++-
 t/re/re_tests |    4 +++-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/regcomp.c b/regcomp.c
index f665f0b..be5acdb 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6762,11 +6762,10 @@ S_reg_namedseq(pTHX_ RExC_state_t *pRExC_state, UV 
*valuep, I32 *flagp)
            | PERL_SCAN_DISALLOW_PREFIX
            | (SIZE_ONLY ? PERL_SCAN_SILENT_ILLDIGIT : 0);
     
-       char * endchar = strchr(RExC_parse, '.');
-       if (endchar) {
+       char * endchar = RExC_parse + strcspn(RExC_parse, ".}");
+       if (endchar < endbrace) {
            ckWARNreg(endchar, "Using just the first character returned by 
\\N{} in character class");
        }
-       else endchar = endbrace;
 
        length_of_hex = (STRLEN)(endchar - RExC_parse);
        *valuep = grok_hex(RExC_parse, &length_of_hex, &flags, NULL);
@@ -6817,8 +6816,7 @@ S_reg_namedseq(pTHX_ RExC_state_t *pRExC_state, UV 
*valuep, I32 *flagp)
 
            /* Code points are separated by dots.  If none, there is only one
             * code point, and is terminated by the brace */
-           endchar = strchr(RExC_parse, '.');
-           if (! endchar) endchar = endbrace;
+           endchar = RExC_parse + strcspn(RExC_parse, ".}");
 
            /* The values are Unicode even on EBCDIC machines */
            length_of_hex = (STRLEN)(endchar - RExC_parse);
diff --git a/t/re/pat.t b/t/re/pat.t
index 40ae52e..7b9594c 100644
--- a/t/re/pat.t
+++ b/t/re/pat.t
@@ -23,7 +23,7 @@ BEGIN {
 }
 
 
-plan tests => 297;  # Update this when adding/deleting tests.
+plan tests => 299;  # Update this when adding/deleting tests.
 
 run_tests() unless caller;
 
@@ -987,6 +987,12 @@ sub run_tests {
         ok "abbbbc" =~ m/\N{3,4}/ && $& eq "abbb", '"abbbbc" =~ m/\N{3,4}/ && 
$& eq "abbb"';
     }
 
+    {
+        use charnames ":full";
+        local $Message = '[perl #74982] Period coming after \N{}';
+        ok "\x{ff08}." =~ m/\N{FULLWIDTH LEFT PARENTHESIS}./ && $& eq 
"\x{ff08}.";
+        ok "\x{ff08}." =~ m/[\N{FULLWIDTH LEFT PARENTHESIS}]./ && $& eq 
"\x{ff08}.";
+    }
 
 } # End of sub run_tests
 
diff --git a/t/re/re_tests b/t/re/re_tests
index 1807ffc..ffa96a8 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1,5 +1,7 @@
 # This stops me getting screenfulls of syntax errors every time I accidentally
-# run this file via a shell glob
+# run this file via a shell glob.  Format of this file is given in regexp.t
+# Can't use \N{VALID NAME TEST} here because need 'use charnames'; but can use
+# \N{U+valid} here.
 __END__
 abc    abc     y       $&      abc
 abc    abc     y       $-[0]   0

--
Perl5 Master Repository

Reply via email to