#!/usr/bin/env perl use 5.014; use warnings; use open IN => ':utf8', ':std'; our $VERSION = '1.03'; my $di = do "data/digraphs-rfc.inc.pl" or warn "official digraphs not included for comparison: ", $@ // $!; say "# automatically generated by $0"; say '+{'; for (readline) { 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}"', $cp // ord $chr; say "q{$mnem} => $chrstr,"; } say '}'; __END__ =head1 NAME mkdigraphs-shiar - Output digraph data from proposal text =head1 SYNOPSIS mkdigraphs-shiar shiar.inc.txt >digraphs-shiar.inc.pl perl -e'$di = do "digraphs-shiar.inc.pl"; print chr $di->{":)"}' =head1 DESCRIPTION Parses a text file containing digraphs followed by the literal unicode character and optional comments. If successful, Perl code is output resulting in a hash with Unicode code points keyed by digraph. Any errors and warnings are given at STDERR. =head1 AUTHOR Mischa POSLAWSKY =head1 LICENSE Licensed under the GNU Affero General Public License version 3.