digraphs: allow proposals by decimal code point escape
[sheet.git] / tools / mkdigraphs-shiar
index 05399b0aecb12fa911f952f3566173a918452e85..443de5d025d71d04478c82920973fb7713f91646 100755 (executable)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use open IN => ':utf8', ':std';
 
-our $VERSION = '1.01';
+our $VERSION = '1.02';
 
 my $di = do "data/digraphs-rfc.inc.pl"
        or warn "official digraphs not included for comparison: ", $@ // $!;
@@ -12,9 +12,9 @@ my $di = do "data/digraphs-rfc.inc.pl"
 say "# automatically generated by $0";
 say '+{';
 for (readline) {
-       my ($mnem, $chr) = m{^([!"%'-Z_a-z]{2}) (.)} or next;
+       my ($mnem, $cp, $chr) = m{^([!"%'-Z_a-z]{2}) (?:(\\\d+)|(.))} or next;
        warn("$mnem already defined"), next if defined $di->{$mnem};
-       my $chrstr = sprintf '"\x{%x}"', ord $chr;
+       my $chrstr = sprintf '"\x{%x}"', $cp // ord $chr;
        say "q{$mnem} => $chrstr,";
 }
 say '}';