From: Mischa POSLAWSKY Date: Sun, 4 Jun 2017 22:01:26 +0000 (+0200) Subject: digraphs: extended regexps for all xorg parsing X-Git-Tag: v1.11~58 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/3bb0146072f0a611c18b31dca137cd135e2cc0ff digraphs: extended regexps for all xorg parsing --- diff --git a/tools/mkdigraphs-xorg b/tools/mkdigraphs-xorg index 1ce8c69..aeed5fe 100755 --- a/tools/mkdigraphs-xorg +++ b/tools/mkdigraphs-xorg @@ -3,6 +3,7 @@ use 5.014; use warnings; use utf8; use open IO => ':utf8', ':std'; +use re '/msx'; use Data::Dump 'pp'; our $VERSION = '1.01'; @@ -18,7 +19,7 @@ while (readline $keysymh) { \A [#]define[ ]XK_ (?[a-zA-Z_0-9]+) \h+ 0x(?[0-9a-f]+) \h* [/][*] [\h(] U[+] (?[0-9A-F]{4,6}) - }msx or next; + } or next; $keysym{ $+{name} } = chr hex $+{unicode}; } @@ -26,12 +27,12 @@ say "# automatically generated by $0"; say '+{'; while ($_ = readline) { - my ($mnem, $chr, $trail) = /^\h(.*?)\h+:\h"([^"]+)"\h*(.*)/ + my ($mnem, $chr, $trail) = m/\A \h (.*?) \h+ : \h "([^"]+)" \h* (.*)/ or next; $chr =~ s/\\(.)/$1/g; - $mnem !~ /]+)> ?}{$keysym{$1} // die "reference to unknown keysym $1\n"}eg; - $mnem !~ /[^ -\x7F]/ or next; # skip unicode + $mnem !~ m/]+)> \h?}{$keysym{$1} // die "reference to unknown keysym $1\n"}eg; + $mnem !~ m/[^\x20-\x7F]/ or next; # skip unicode # (state $seen = {})->{$chr}++ and next; printf "%s => %s,\n", pp($mnem), pp($chr); }