summaryrefslogtreecommitdiff
path: root/lib/_charnames.pm
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-11-09 10:18:17 -0700
committerKarl Williamson <public@khwilliamson.com>2012-11-11 10:11:34 -0700
commitbde9e88d4f9dd5fc838744a75cfc6b9c1a2cfd82 (patch)
treeffef94c2d69ab6ec5b65299dc97712b5b5669c81 /lib/_charnames.pm
parent7baadcd09acc8f332e8235cc586cedcaa3f4616c (diff)
downloadperl-bde9e88d4f9dd5fc838744a75cfc6b9c1a2cfd82.tar.gz
Validate above-Latin1 characters in \N{} aliases
This completes the process of allowing users to define their own aliases for \N{} in any language they choose. Names have some validation applied so that they can't, for example, begin with something that is a digit in some Unicode script. Tests and documentation are included in this patch. The loop in toke.c that does the validation for user-supplied translators is revamped, and the messages that are output when there is an error are fixed to work with UTF-8.
Diffstat (limited to 'lib/_charnames.pm')
-rw-r--r--lib/_charnames.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/_charnames.pm b/lib/_charnames.pm
index ad7684d9f5..bbb7378a36 100644
--- a/lib/_charnames.pm
+++ b/lib/_charnames.pm
@@ -167,6 +167,8 @@ sub alias (@) # Set up a single alias
$^H{charnames_inverse_ords}{sprintf("%05X", $value)} = $name;
}
else {
+ # This regex needs to be sync'd with the code in toke.c that checks
+ # for the same thing
if ($name !~ / ^
\p{_Perl_Charname_Begin}
\p{_Perl_Charname_Continue}*