From 9b4e380a0c2cfcae174bddd911f9f6437cd7d53f Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Wed, 3 Oct 2001 16:47:30 +0000 Subject: [PATCH] Unicode properties: fix L& (the #12319 didn't allow L&, only IsL&) and Inherited (negative lookahead good); add tests for Common, Inherited, and L&. p4raw-id: //depot/perl@12320 --- lib/utf8_heavy.pl | 4 ++-- pod/perltodo.pod | 4 ++-- t/op/pat.t | 26 +++++++++++++++++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl index 0961509..3efd421 100644 --- a/lib/utf8_heavy.pl +++ b/lib/utf8_heavy.pl @@ -23,7 +23,7 @@ sub SWASHNEW { defined %utf8::In || do "unicore/In.pl"; - $type =~ s/^In(?:[-_]|\s+)?//i; + $type =~ s/^In(?:[-_]|\s+)?(?!herited$)//i; $type =~ s/\s+$//; my $inprefix = substr(lc($type), 0, 3); @@ -43,7 +43,7 @@ sub SWASHNEW { unless (defined $file) { # This is separate from 'To' in preparation of Is.pl (a la In.pl). - if ($type =~ /^Is([A-Z][A-Za-z]*|L&)$/) { + if ($type =~ /^Is([A-Z][A-Za-z]*|L&)$/ || $type =~ /^(L&)$/ ) { my $cat = $1 eq 'L&' ? 'L' : $1; $file = "unicore/Is/$cat"; } elsif ((not defined $file) && $type =~ /^To([A-Z][A-Za-z]*)$/) { diff --git a/pod/perltodo.pod b/pod/perltodo.pod index 1f57c0c..2a086f9 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -73,9 +73,9 @@ C<\p{IsPs}>. =item * -Allow for the metaproperties C and C, and C; +Allow for the metaproperties C and C; C, C, C, C (note that -are large classes than the general categories C and C), +these are larger classes than the general categories C and C), C, C, C, C, C, , C, C, C, C, C, C. diff --git a/t/op/pat.t b/t/op/pat.t index 6379866..63c5ba2 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..738\n"; +print "1..744\n"; BEGIN { chdir 't' if -d 't'; @@ -2206,3 +2206,27 @@ print "# some Unicode properties\n"; print "ok 738\n"; } + +{ + print "not " if "a" =~ /\p{Common}/; + print "ok 739\n"; + + print "not " unless "1" =~ /\p{Common}/; + print "ok 740\n"; +} + +{ + print "not " if "a" =~ /\p{Inherited}/; + print "ok 741\n"; + + print "not " unless "\x{300}" =~ /\p{Inherited}/; + print "ok 742\n"; +} + +{ + print "not " unless "a" =~ /\p{L&}/; + print "ok 743\n"; + + print "not " if "1" =~ /\p{L&}/; + print "ok 744\n"; +} -- 2.7.4