ruby-changes:57266
From: usa <ko1@a...>
Date: Mon, 26 Aug 2019 23:07:10 +0900 (JST)
Subject: [ruby-changes:57266] usa: 59ed372bcb (ruby_2_5): merge revision(s) 179045acaf5de8398c321ada86a76f1afb77a796: [Backport #14539]
https://git.ruby-lang.org/ruby.git/commit/?id=59ed372bcb From 59ed372bcb5ddcb04f743509fb7c318645261149 Mon Sep 17 00:00:00 2001 From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Mon, 26 Aug 2019 14:06:52 +0000 Subject: merge revision(s) 179045acaf5de8398c321ada86a76f1afb77a796: [Backport #14539] regparse.c: Suppress duplicated range warning by mere \X * regparse.c (node_extended_grapheme_cluster): as Unicode 10 has added Grapheme_Cluster_Break properties to some characters, remove duplicated ranges for Unicode 9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e diff --git a/enc/unicode.c b/enc/unicode.c index 72ff5a9..c909022 100644 --- a/enc/unicode.c +++ b/enc/unicode.c @@ -786,7 +786,6 @@ SpecialsCopy: https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L786 return (int )(to - to_start); } -#if 0 const char onigenc_unicode_version_string[] = #ifdef ONIG_UNICODE_VERSION_STRING ONIG_UNICODE_VERSION_STRING @@ -802,4 +801,3 @@ const int onigenc_unicode_version_number[3] = { https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L801 0 #endif }; -#endif diff --git a/regparse.c b/regparse.c index 431aad9..c281292 100644 --- a/regparse.c +++ b/regparse.c @@ -35,6 +35,7 @@ https://github.com/ruby/ruby/blob/trunk/regparse.c#L35 #define CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS +extern const int onigenc_unicode_version_number[3]; const OnigSyntaxType OnigSyntaxRuby = { (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | @@ -6063,7 +6064,7 @@ node_extended_grapheme_cluster(Node** np, ScanEnv* env) https://github.com/ruby/ruby/blob/trunk/regparse.c#L6064 np1 = node_new_cclass(); if (IS_NULL(np1)) goto err; cc = NCCLASS(np1); - { + if (onigenc_unicode_version_number[0] < 10) { static const OnigCodePoint ranges[] = { 13, 0x1F308, 0x1F308, @@ -6205,7 +6206,7 @@ node_extended_grapheme_cluster(Node** np, ScanEnv* env) https://github.com/ruby/ruby/blob/trunk/regparse.c#L6206 if (IS_NULL(np1)) goto err; cc = NCCLASS(np1); { - static const OnigCodePoint ranges[] = { + static const OnigCodePoint ranges9[] = { 8, 0x1F3C2, 0x1F3C2, 0x1F3C7, 0x1F3C7, @@ -6216,6 +6217,14 @@ node_extended_grapheme_cluster(Node** np, ScanEnv* env) https://github.com/ruby/ruby/blob/trunk/regparse.c#L6217 0x1F574, 0x1F574, 0x1F6CC, 0x1F6CC, }; + static const OnigCodePoint ranges10[] = { + 3, + 0x1F3F3, 0x1F3F3, + 0x1F441, 0x1F441, + 0x1F46F, 0x1F46F, + }; + const OnigCodePoint *ranges = + (onigenc_unicode_version_number[0] < 10) ? ranges9 : ranges10; r = add_ctype_to_cc_by_range(cc, -1, 0, env, sb_out, ranges); if (r != 0) goto err; } diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 85d5b2c..a22975d 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -955,6 +955,8 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L955 assert_match /\A\X\z/, "\u{1F468 200D 1F393}" assert_match /\A\X\z/, "\u{1F46F 200D 2642 FE0F}" assert_match /\A\X\z/, "\u{1f469 200d 2764 fe0f 200d 1f469}" + + assert_warning('') {/\X/ =~ "\u{a0}"} end def test_backward diff --git a/version.h b/version.h index d3c912d..eb5ba2c 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1 #define RUBY_VERSION "2.5.6" #define RUBY_RELEASE_DATE "2019-08-26" -#define RUBY_PATCHLEVEL 171 +#define RUBY_PATCHLEVEL 172 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 8 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/