summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-30 17:29:19 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-30 17:29:19 (GMT)
commitc11e648799cf32d267875381d967e8228a07cea6 (patch)
treea138fea7cd605c02139800096905c5249bef8e27 /regcomp.c
parente680bfb1aba5438d5f0912b0712e5eb7d96239e0 (diff)
Regexp supports Unicoe 9.0.0's \X
* meta character \X matches Unicode 9.0.0 characters with some workarounds for UTR #51 Unicode Emoji, Version 4.0 emoji zwj sequences. [Feature #12831] [ruby-core:77586] The term "character" can have many meanings bytes, codepoints, combined characters, and so on. "grapheme cluster" is highest one of such words, which means user-perceived characters. Unicode Standard Annex #29 UNICODE TEXT SEGMENTATION specifies how to handle grapheme clusters (extended grapheme cluster). But some specs aren't updated to current situation because Unicode Emoji is rapidly extended without well definition. It breaks the precondition of UTR#29 "Grapheme cluster boundaries can be easily tested by looking at immediately adjacent characters". (the sentence will be removed in the next version) Though some of its detail are described in Unicode Technical Report #51 UNICODE EMOJI but it is not merged into UTR#29 yet. http://unicode.org/reports/tr29/ http://unicode.org/reports/tr51/ http://unicode.org/Public/emoji/4.0/ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/regcomp.c b/regcomp.c
index 4364beb..222d1d6 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6572,7 +6572,7 @@ print_compiled_byte_code_list(FILE* f, regex_t* reg)
#endif /* ONIG_DEBUG_COMPILE */
#ifdef ONIG_DEBUG_PARSE_TREE
-static void
+void
print_indent_tree(FILE* f, Node* node, int indent)
{
int i, type, container_p = 0;
@@ -6618,12 +6618,15 @@ print_indent_tree(FILE* f, Node* node, int indent)
case NT_CCLASS:
fprintf(f, "<cclass:%"PRIxPTR">", (intptr_t )node);
- if (IS_NCCLASS_NOT(NCCLASS(node))) fputs(" not", f);
+ if (IS_NCCLASS_NOT(NCCLASS(node))) fputs("not ", f);
if (NCCLASS(node)->mbuf) {
BBuf* bbuf = NCCLASS(node)->mbuf;
- for (i = 0; i < (int )bbuf->used; i++) {
- if (i > 0) fprintf(f, ",");
- fprintf(f, "%0x", bbuf->p[i]);
+ OnigCodePoint* data = (OnigCodePoint*)bbuf->p;
+ OnigCodePoint* end = (OnigCodePoint*)(bbuf->p + bbuf->used);
+ fprintf(f, "%d", *data++);
+ for (; data < end; data+=2) {
+ fprintf(f, ",");
+ fprintf(f, "%04x-%04x", data[0], data[1]);
}
}
break;