git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
apl: click to expand all descriptions
[sheet.git]
/
tools
/
mkcharinfo
diff --git
a/tools/mkcharinfo
b/tools/mkcharinfo
index b58f0c373f6215e828e4ad787683d1cfc23cd114..66f3a0022d94058a525bce55cb90c476e13826b7 100755
(executable)
--- a/
tools/mkcharinfo
+++ b/
tools/mkcharinfo
@@
-8,7
+8,7
@@
no if $] >= 5.018, warnings => 'experimental::smartmatch';
use open OUT => ':utf8', ':std';
use Data::Dump 'pp';
use open OUT => ':utf8', ':std';
use Data::Dump 'pp';
-our $VERSION = '1.0
0
';
+our $VERSION = '1.0
1
';
my %info = (
# prepare presentational string for some control(lish) entries
my %info = (
# prepare presentational string for some control(lish) entries
@@
-48,16
+48,18
@@
eval {
my %diinc = (
'data/digraphs-rfc.inc.pl' => 'u-di',
my %diinc = (
'data/digraphs-rfc.inc.pl' => 'u-di',
- 'data/digraphs-shiar.inc.pl' => 'u-prop Xz',
+ 'data/digraphs-shiar.inc.pl' => 'u-prop ex',
+ 'data/digraphs-vim.inc.pl' => 'u-prop',
);
);
-for (keys %diinc) {
+for (
sort
keys %diinc) {
-e $_ or next;
my $di = do $_ or die "Error reading digraphs file $_: ", $@ || $!;
-e $_ or next;
my $di = do $_ or die "Error reading digraphs file $_: ", $@ || $!;
- while (my ($mnem, $cp) = each %$di) {
+ for my $mnem (sort keys %{$di}) {
+ my $cp = $di->{$mnem};
length $mnem == 2 or next; # limit to digraphs
my $class = $diinc{$_};
length $mnem == 2 or next; # limit to digraphs
my $class = $diinc{$_};
- $info{
chr
$cp}->{di} //= $mnem;
- $info{
chr
$cp}->{class}->{$class}++;
+ $info{$cp}->{di} //= $mnem;
+ $info{$cp}->{class}->{$class}++;
}
}
}
}
@@
-82,6
+84,10
@@
for my $chr (keys %info) {
$info->{$_} = $info{$chr}->{$_} for keys %{ $info{$chr} };
$info->{$_} = $info{$chr}->{$_} for keys %{ $info{$chr} };
+ # official digraphs either lose vim flag or gain experimental
+ delete $info->{class}->{'u-prop'} or $info->{class}->{ex}++
+ if $info->{class}->{'u-di'};
+
# categorise by unicode types and writing script
$info->{class}->{$_}++ for $info->{category};
$info->{class}->{$_}++ for $info->{script} || ();
# categorise by unicode types and writing script
$info->{class}->{$_}++ for $info->{category};
$info->{class}->{$_}++ for $info->{script} || ();
@@
-90,15
+96,15
@@
for my $chr (keys %info) {
$info->{class}->{Xa}++ if $info->{block} eq 'Basic Latin';
$info->{class}->{Xl}++ if $info->{block} eq 'Latin-1 Supplement';
$info->{class}->{Xa}++ if $info->{block} eq 'Basic Latin';
$info->{class}->{Xl}++ if $info->{block} eq 'Latin-1 Supplement';
-
given ($cp)
{
-
when
($info->{string}) {
+ {
+
if
($info->{string}) {
# keep predefined presentational string
}
# keep predefined presentational string
}
-
when
($info->{combining}) {
+
elsif
($info->{combining}) {
# overlay combining accents
$info->{string} = chr(9676) . $chr;
}
# overlay combining accents
$info->{string} = chr(9676) . $chr;
}
-
when
(($cp & ~0b1001_1111) == 0 or $cp == 127) {
+
elsif
(($cp & ~0b1001_1111) == 0 or $cp == 127) {
# control characters (first 32 chars from 0 and 128)
# rename to something more descriptive
$info->{name} = $info->{unicode10}
# control characters (first 32 chars from 0 and 128)
# rename to something more descriptive
$info->{name} = $info->{unicode10}