mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
f31c5e72b2
commit
179045acaf
3 changed files with 13 additions and 4 deletions
|
@ -786,7 +786,6 @@ SpecialsCopy:
|
|||
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] = {
|
|||
0
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
|
13
regparse.c
13
regparse.c
|
@ -35,6 +35,7 @@
|
|||
|
||||
#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 |
|
||||
|
@ -6067,7 +6068,7 @@ node_extended_grapheme_cluster(Node** np, ScanEnv* env)
|
|||
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,
|
||||
|
@ -6209,7 +6210,7 @@ node_extended_grapheme_cluster(Node** np, ScanEnv* env)
|
|||
if (IS_NULL(np1)) goto err;
|
||||
cc = NCCLASS(np1);
|
||||
{
|
||||
static const OnigCodePoint ranges[] = {
|
||||
static const OnigCodePoint ranges9[] = {
|
||||
8,
|
||||
0x1F3C2, 0x1F3C2,
|
||||
0x1F3C7, 0x1F3C7,
|
||||
|
@ -6220,6 +6221,14 @@ node_extended_grapheme_cluster(Node** np, ScanEnv* env)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -962,6 +962,8 @@ class TestRegexp < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue