diff options
author | Karl Williamson <khw@cpan.org> | 2021-06-30 12:13:45 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-08-07 04:46:45 -0600 |
commit | 0dc7c8106f0701205185b7e0ec7632a6b4d98025 (patch) | |
tree | e2d1d7d78f822555bb5cf11d516729ec9cab61dd /regen | |
parent | bb20f3e292ecbc490b2b4d0903c7bb28504d5fcc (diff) | |
download | perl-0dc7c8106f0701205185b7e0ec7632a6b4d98025.tar.gz |
regcharclass.pl: Add ability to avoid wrong mnemonic
A future commit will pass this function data that shouldn't be
translated into a mnemonic, like 'f' for the letter f. The reason is
that that code will potentially be executed on a machine with a
different character set than what the mnemonic would be valid for.
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/regcharclass.pl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl index 2c53e8e344..f5155aab1a 100755 --- a/regen/regcharclass.pl +++ b/regen/regcharclass.pl @@ -309,6 +309,7 @@ sub val_fmt { my $self = shift; my $arg = shift; + my $always_hex = shift // 0; # Use \x{}; don't look for a mnemonic # Format 'arg' using the printable character if it has one, or a %x if # not, returning a string containing the result @@ -317,7 +318,7 @@ sub val_fmt return $hex_fmt unless defined $arg && $arg !~ /\D/; # We convert only things inside Latin1 - if ($arg < 256) { + if (! $always_hex && $arg < 256) { # Find the ASCII equivalent of this argument (as the current character # set might not be ASCII) |