- REGEX_DUMP_DEBUG_PRINTF(("Original Pattern: "));
- UChar32 c = utext_next32From(This->fPattern, 0);
- while (c != U_SENTINEL) {
- if (c<32 || c>256) {
- c = '.';
- }
- REGEX_DUMP_DEBUG_PRINTF(("%c", c));
-
- c = UTEXT_NEXT32(This->fPattern);
- }
- REGEX_DUMP_DEBUG_PRINTF(("\n"));
- REGEX_DUMP_DEBUG_PRINTF((" Min Match Length: %d\n", This->fMinMatchLen));
- REGEX_DUMP_DEBUG_PRINTF((" Match Start Type: %s\n", START_OF_MATCH_STR(This->fStartType)));
- if (This->fStartType == START_STRING) {
- REGEX_DUMP_DEBUG_PRINTF((" Initial match string: \""));
- for (i=This->fInitialStringIdx; i<This->fInitialStringIdx+This->fInitialStringLen; i++) {
- REGEX_DUMP_DEBUG_PRINTF(("%c", This->fLiteralText[i])); // TODO: non-printables, surrogates.
- }
- REGEX_DUMP_DEBUG_PRINTF(("\"\n"));
-
- } else if (This->fStartType == START_SET) {
- int32_t numSetChars = This->fInitialChars->size();
- if (numSetChars > 20) {
- numSetChars = 20;
- }
- REGEX_DUMP_DEBUG_PRINTF((" Match First Chars : "));
- for (i=0; i<numSetChars; i++) {
- UChar32 c = This->fInitialChars->charAt(i);
- if (0x20<c && c <0x7e) {
- REGEX_DUMP_DEBUG_PRINTF(("%c ", c));
+ UnicodeString patStr;
+ for (UChar32 c = utext_next32From(fPattern, 0); c != U_SENTINEL; c = utext_next32(fPattern)) {
+ patStr.append(c);
+ }
+ printf("Original Pattern: \"%s\"\n", CStr(patStr)());
+ printf(" Min Match Length: %d\n", fMinMatchLen);
+ printf(" Match Start Type: %s\n", START_OF_MATCH_STR(fStartType));
+ if (fStartType == START_STRING) {
+ UnicodeString initialString(fLiteralText,fInitialStringIdx, fInitialStringLen);
+ printf(" Initial match string: \"%s\"\n", CStr(initialString)());
+ } else if (fStartType == START_SET) {
+ UnicodeString s;
+ fInitialChars->toPattern(s, TRUE);
+ printf(" Match First Chars: %s\n", CStr(s)());
+
+ } else if (fStartType == START_CHAR) {
+ printf(" First char of Match: ");
+ if (fInitialChar > 0x20) {
+ printf("'%s'\n", CStr(UnicodeString(fInitialChar))());