[前][次][番号順一覧][スレッド一覧]

ruby-changes:53803

From: duerst <ko1@a...>
Date: Tue, 27 Nov 2018 13:13:27 +0900 (JST)
Subject: [ruby-changes:53803] duerst:r66021 (trunk): use explicit property name when creating nodes for "Grapheme_Cluster_Break=Extend"

duerst	2018-11-27 13:13:21 +0900 (Tue, 27 Nov 2018)

  New Revision: 66021

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66021

  Log:
    use explicit property name when creating nodes for "Grapheme_Cluster_Break=Extend"

  Modified files:
    trunk/regparse.c
Index: regparse.c
===================================================================
--- regparse.c	(revision 66020)
+++ regparse.c	(revision 66021)
@@ -5757,9 +5757,8 @@ node_extended_grapheme_cluster(Node** np https://github.com/ruby/ruby/blob/trunk/regparse.c#L5757
     /* UTF-8, UTF-16BE/LE, UTF-32BE/LE */
     CClassNode* cc;
     OnigCodePoint sb_out = (ONIGENC_MBC_MINLEN(env->enc) > 1) ? 0x00 : 0x80;
-    int extend = propname2ctype(env, "Grapheme_Cluster_Break=Extend");
 
-    if (extend < 0) goto err;
+    if (propname2ctype(env, "Grapheme_Cluster_Break=Extend") < 0) goto err;
     /* main comment: The order of the code is mostly in reverse of the order
      *               the various expressions appear in the grammar */
     /* Unicode 10.0.0 */
@@ -5771,11 +5770,10 @@ node_extended_grapheme_cluster(Node** np https://github.com/ruby/ruby/blob/trunk/regparse.c#L5770
 
     /* Unicode 10.0.0 */
     /* ( Grapheme_Extend | SpacingMark )* */
-    np1 = node_new_cclass();
-    if (IS_NULL(np1)) goto err;
-    cc = NCCLASS(np1);
-    r = add_ctype_to_cc(cc, extend, 0, 0, env);
+    r = create_property_node(&np1, env, "Grapheme_Cluster_Break=Extend");
     if (r != 0) goto err;
+
+    cc = NCCLASS(np1);
     r = add_property_to_cc(cc, "Grapheme_Cluster_Break=SpacingMark", 0, env);
     if (r != 0) goto err;
     r = add_code_range(&(cc->mbuf), env, 0x200D, 0x200D);
@@ -6024,10 +6022,7 @@ node_extended_grapheme_cluster(Node** np https://github.com/ruby/ruby/blob/trunk/regparse.c#L6022
     list2 = tmp;
     np1 = NULL;
 
-    np1 = node_new_cclass();
-    if (IS_NULL(np1)) goto err;
-    cc = NCCLASS(np1);
-    r = add_ctype_to_cc(cc, extend, 0, 0, env);
+    r = create_property_node(&np1, env, "Grapheme_Cluster_Break=Extend");
     if (r != 0) goto err;
 
     tmp = node_new_quantifier(0, REPEAT_INFINITE, 0);
@@ -6055,10 +6050,7 @@ node_extended_grapheme_cluster(Node** np https://github.com/ruby/ruby/blob/trunk/regparse.c#L6050
 
     /* Unicode 10.0.0 */
     /* Glue_After_Zwj */
-    np1 = node_new_cclass();
-    if (IS_NULL(np1)) goto err;
-    cc = NCCLASS(np1);
-    r = add_ctype_to_cc(cc, extend, 0, 0, env);
+    r = create_property_node(&np1, env, "Grapheme_Cluster_Break=Extend");
     if (r != 0) goto err;
 
     tmp = node_new_quantifier(0, REPEAT_INFINITE, 0);
@@ -6172,10 +6164,7 @@ node_extended_grapheme_cluster(Node** np https://github.com/ruby/ruby/blob/trunk/regparse.c#L6164
     np1 = NULL;
 
     /* Extend* */
-    np1 = node_new_cclass();
-    if (IS_NULL(np1)) goto err;
-    cc = NCCLASS(np1);
-    r = add_ctype_to_cc(cc, extend, 0, 0, env);
+    r = create_property_node(&np1, env, "Grapheme_Cluster_Break=Extend");
     if (r != 0) goto err;
 
     tmp = node_new_quantifier(0, REPEAT_INFINITE, 0);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]