ruby-changes:53828
From: duerst <ko1@a...>
Date: Wed, 28 Nov 2018 06:39:01 +0900 (JST)
Subject: [ruby-changes:53828] duerst:r66046 (trunk): introduce two more uses of create_sequence_node in node_extended_grapheme_cluster
duerst 2018-11-28 06:38:53 +0900 (Wed, 28 Nov 2018) New Revision: 66046 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66046 Log: introduce two more uses of create_sequence_node in node_extended_grapheme_cluster Modified files: trunk/regparse.c Index: regparse.c =================================================================== --- regparse.c (revision 66045) +++ regparse.c (revision 66046) @@ -5922,37 +5922,22 @@ node_extended_grapheme_cluster(Node** np https://github.com/ruby/ruby/blob/trunk/regparse.c#L5922 list2 = NULL; /* L* LV V* T* */ - r = quantify_property_node(&np1, env, "Grapheme_Cluster_Break=T", 0, REPEAT_INFINITE); - if (r != 0) goto err; + { + Node* seq[5]; - tmp = node_new_list(np1, NULL_NODE); - if (IS_NULL(tmp)) goto err; - list2 = tmp; - np1 = NULL; - - r = quantify_property_node(&np1, env, "Grapheme_Cluster_Break=V", 0, REPEAT_INFINITE); - if (r != 0) goto err; - - tmp = node_new_list(np1, list2); - if (IS_NULL(tmp)) goto err; - list2 = tmp; - np1 = NULL; - - r = create_property_node(&np1, env, "Grapheme_Cluster_Break=LV"); - if (r != 0) goto err; - - tmp = node_new_list(np1, list2); - if (IS_NULL(tmp)) goto err; - list2 = tmp; - np1 = NULL; - - r = quantify_property_node(&np1, env, "Grapheme_Cluster_Break=L", 0, REPEAT_INFINITE); - if (r != 0) goto err; - - tmp = node_new_list(np1, list2); - if (IS_NULL(tmp)) goto err; - list2 = tmp; - np1 = NULL; + r = quantify_property_node(seq+0, env, "Grapheme_Cluster_Break=T", 0, REPEAT_INFINITE); + if (r != 0) goto err; + r = quantify_property_node(seq+1, env, "Grapheme_Cluster_Break=V", 0, REPEAT_INFINITE); + if (r != 0) goto err; + r = create_property_node(seq+2, env, "Grapheme_Cluster_Break=LV"); + if (r != 0) goto err; + r = quantify_property_node(seq+3, env, "Grapheme_Cluster_Break=L", 0, REPEAT_INFINITE); + if (r != 0) goto err; + + seq[4] = NULL_NODE; + r = create_sequence_node(&list2, seq); + if (r != 0) goto err; + } tmp = onig_node_new_alt(list2, alt); if (IS_NULL(tmp)) goto err; @@ -5960,29 +5945,20 @@ node_extended_grapheme_cluster(Node** np https://github.com/ruby/ruby/blob/trunk/regparse.c#L5945 list2 = NULL; /* L* V+ T* */ - r = quantify_property_node(&np1, env, "Grapheme_Cluster_Break=T", 0, REPEAT_INFINITE); - if (r != 0) goto err; - - tmp = node_new_list(np1, NULL_NODE); - if (IS_NULL(tmp)) goto err; - list2 = tmp; - np1 = NULL; - - r = quantify_property_node(&np1, env, "Grapheme_Cluster_Break=V", 1, REPEAT_INFINITE); - if (r != 0) goto err; + { + Node* seq[4]; - tmp = node_new_list(np1, list2); - if (IS_NULL(tmp)) goto err; - list2 = tmp; - np1 = NULL; - - r = quantify_property_node(&np1, env, "Grapheme_Cluster_Break=L", 0, REPEAT_INFINITE); - if (r != 0) goto err; - - tmp = node_new_list(np1, list2); - if (IS_NULL(tmp)) goto err; - list2 = tmp; - np1 = NULL; + r = quantify_property_node(seq+0, env, "Grapheme_Cluster_Break=T", 0, REPEAT_INFINITE); + if (r != 0) goto err; + r = quantify_property_node(seq+1, env, "Grapheme_Cluster_Break=V", 1, REPEAT_INFINITE); + if (r != 0) goto err; + r = quantify_property_node(seq+2, env, "Grapheme_Cluster_Break=L", 0, REPEAT_INFINITE); + if (r != 0) goto err; + + seq[3] = NULL_NODE; + r = create_sequence_node(&list2, seq); + if (r != 0) goto err; + } tmp = onig_node_new_alt(list2, alt); if (IS_NULL(tmp)) goto err; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/