Unicode::UCD: Special case prop_aliases() 'indic'
authorKarl Williamson <public@khwilliamson.com>
Fri, 30 Dec 2011 15:37:04 +0000 (08:37 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 30 Dec 2011 18:08:29 +0000 (11:08 -0700)
This is in preparation for Unicode 6.1 which adds a property whose name
begins with 'indic', as in Indic languages.  This creates a conflict
with Perl's longstanding use of 'in' as a prefix in a property name.
"\p{infoo}" is a synonym for "\p{blk=foo}".  The conflict is resolved
here with a special case.

lib/Unicode/UCD.pm

index db95111..38f0c3b 100644 (file)
@@ -1623,8 +1623,16 @@ sub prop_aliases ($) {
                 # Here, it wasn't one of the gc or script single-form
                 # extensions.  It could be a block property single-form
                 # extension.  An 'in' prefix definitely means that, and should
-                # be looked up without the prefix.
-                my $began_with_in = $loose =~ s/^in//;
+                # be looked up without the prefix.  However, starting in
+                # Unicode 6.1, we have to special case 'indic...', as there
+                # is a property that begins with that name.   We shouldn't
+                # strip the 'in' from that.   I'm (khw) generalizing this to
+                # 'indic' instead of the single property, because I suspect
+                # that others of this class may come along in the future.
+                # However, this could backfire and a block created whose name
+                # begins with 'dic...', and we would want to strip the 'in'.
+                # At which point this would have to be tweaked.
+                my $began_with_in = $loose =~ s/^in(?!dic)//;
                 @list = prop_value_aliases("block", $loose);
                 if (@list) {
                     map { $_ =~ s/^/In_/ } @list;