From 3bb0146072f0a611c18b31dca137cd135e2cc0ff Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 5 Jun 2017 00:01:26 +0200 Subject: [PATCH] digraphs: extended regexps for all xorg parsing --- tools/mkdigraphs-xorg | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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); } -- 2.30.0