live-bootstrap/steps/perl-5.18.4/patches/0005-Move-an-inversion-list-generation-to-mktables.patch
2025-10-06 12:21:45 +11:00

72 lines
2.6 KiB
Diff

SPDX-FileCopyrightText: 2015 Karl Williamson <public@khwilliamson.com>
SPDX-FileCopyrightText: 2025 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: Artistic-1.0
This renaming is expected by 5.22. The resulting modifications to
charclass_invlists.h are done in the script.
From c75f24e6fc1fa9676693e4e42f199e542b2b2549 Mon Sep 17 00:00:00 2001
From: Karl Williamson <public@khwilliamson.com>
Date: Thu, 23 Jan 2014 20:34:15 -0700
Subject: [PATCH 1/2] Move an inversion list generation to mktables
Prior to this patch, this was in regen/mk_invlists.pl, but future
commits will want it to also be used by the header generated by
regen/regcharclass.pl, so use a common source so the logic doesn't have
to be duplicated.
---
lib/unicore/mktables | 22 ++++++++++++++++++++++
regcomp.c | 3 ++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git perl-5.18.4/lib/unicore/mktables perl-5.18.4/lib/unicore/mktables
index 808760d002..a5c0d8930e 100644
--- perl-5.18.4/lib/unicore/mktables
+++ perl-5.18.4/lib/unicore/mktables
@@ -13321,6 +13321,28 @@ sub compile_perl() {
}
$PosixXDigit->add_description('[0-9A-Fa-f]');
+ my $folds_to_multi_char = $perl->add_match_table(
+ "_Perl_Folds_To_Multi_Char",
+ Description =>
+ "Code points whose fold is a string of more than one character",
+ );
+
+ foreach my $range (property_ref('Case_Folding')->ranges) {
+ my $start = $range->start;
+ my $end = $range->end;
+ $any_folds->add_range($start, $end);
+
+ my @hex_code_points = split " ", $range->value;
+ if (@hex_code_points > 1) {
+ $folds_to_multi_char->add_range($start, $end);
+ }
+
+ foreach my $i (0 .. @hex_code_points - 1) {
+ my $code_point = hex $hex_code_points[$i];
+ $any_folds->add_range($code_point, $code_point);
+ }
+ }
+
my $dt = property_ref('Decomposition_Type');
$dt->add_match_table('Non_Canon', Full_Name => 'Non_Canonical',
Initialize => ~ ($dt->table('None') + $dt->table('Canonical')),
diff --git perl-5.18.4/regcomp.c perl-5.18.4/regcomp.c
index 0841f172e5..e839e3e765 100644
--- perl-5.18.4/regcomp.c
+++ perl-5.18.4/regcomp.c
@@ -5566,7 +5566,8 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
PL_Posix_ptrs[_CC_XDIGIT] = _new_invlist_C_array(PosixXDigit_invlist);
PL_XPosix_ptrs[_CC_XDIGIT] = _new_invlist_C_array(XPosixXDigit_invlist);
- PL_HasMultiCharFold = _new_invlist_C_array(_Perl_Multi_Char_Folds_invlist);
+ PL_HasMultiCharFold =
+ _new_invlist_C_array(_Perl_Folds_To_Multi_Char_invlist);
}
#endif
--
2.49.1