From: Jarkko Hietaniemi Date: Sun, 21 Apr 2002 22:24:52 +0000 (+0000) Subject: Make writing user-defined character properties nicer. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=11ef8fddd64f78304dc923b07dffddd7a4f28074;p=p5sagit%2Fp5-mst-13.2.git Make writing user-defined character properties nicer. p4raw-id: //depot/perl@16054 --- diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl index 29d4ac2..d5a0b33 100644 --- a/lib/utf8_heavy.pl +++ b/lib/utf8_heavy.pl @@ -184,7 +184,13 @@ sub SWASHNEW { print STDERR "$1 => $2\n" if DEBUG; if ($char =~ /[-+!]/) { my ($c,$t) = split(/::/, $name, 2); # bogus use of ::, really - my $subobj = $c->SWASHNEW($t, "", 0, 0, 0); + my $subobj; + if ($c eq 'utf8') { + $subobj = $c->SWASHNEW($t, "", 0, 0, 0); + } + elsif ($c =~ /^([0-9a-fA-F]+)/) { + $subobj = utf8->SWASHNEW("", $c, 0, 0, 0); + } return $subobj unless ref $subobj; push @extras, $name => $subobj; $bits = $subobj->{BITS} if $bits < $subobj->{BITS}; diff --git a/pod/perlunicode.pod b/pod/perlunicode.pod index 033c9ac..17e070c 100644 --- a/pod/perlunicode.pod +++ b/pod/perlunicode.pod @@ -631,22 +631,28 @@ newline-separated lines. Each line must be one of the following: =item * Two hexadecimal numbers separated by a tabulator denoting a range -of Unicode codepoints. +of Unicode codepoints to include. =item * -An existing character property prefixed by "+utf8::" to include -all the characters in that property. +Something to include, prefixed by "+": either an built-in character +property (prefixed by "utf8::"), for all the characters in that +property; or two hexadecimal codepoints for a range; or a single +hexadecimal codepoint. =item * -An existing character property prefixed by "-utf8::" to exclude -all the characters in that property. +Something to exclude, prefixed by "-": either an existing character +property (prefixed by "utf8::"), for all the characters in that +property; or two hexadecimal codepoints for a range; or a single +hexadecimal codepoint. =item * -An existing character property prefixed by "!utf8::" to include -all except the characters in that property. +Something to negate, prefixed "!": either an existing character +property (prefixed by "utf8::") for all the characters except the +characters in the property; or two hexadecimal codepoints for a range; +or a single hexadecimal codepoint. =back diff --git a/t/op/pat.t b/t/op/pat.t index 905204b..5681d6a 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..908\n"; +print "1..910\n"; BEGIN { chdir 't' if -d 't'; @@ -2870,3 +2870,17 @@ print "\x{3040}" =~ /\P{InKana3}/ ? "ok $test\n" : "not ok $test\n"; $test++; print "\x{3040}" =~ /\p{InNotKana}/ ? "ok $test\n" : "not ok $test\n"; $test++; print "\x{3041}" =~ /\P{InNotKana}/ ? "ok $test\n" : "not ok $test\n"; $test++; +sub InConsonant { # Not EBCDIC-aware. + return <