This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regex: Remove FOLDCHAR regnode type
authorKarl Williamson <public@khwilliamson.com>
Sat, 24 Dec 2011 03:19:27 +0000 (20:19 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 19 Jan 2012 18:58:19 +0000 (11:58 -0700)
This node type hasn't been used since 5.14.0.  Instead an ANYOFV node
was generated where formerly a FOLDCHAR node would have been used.  The
ANYOFV was used because it already existed and was up-to-date, whereas
FOLDCHAR would have needed some bug fixes to adapt it, even though it
would be faster in execution than ANYOFV; so the code for it was
retained in case it was needed.

However, both these solutions were defective, and a previous commit has
changed things to a different type of solution entirely.  Thus FOLDCHAR
is obsolescent and can be removed, though the code in it was used as a
base for some of the new solutions.

regcomp.c
regcomp.sym
regexec.c
regnodes.h

index d2085fc..b880599 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -3944,18 +3944,6 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
                data->longest = &(data->longest_float);
            }
        }
-       else if (OP(scan) == FOLDCHAR) {
-           int d = ARG(scan) == LATIN_SMALL_LETTER_SHARP_S ? 1 : 2;
-           flags &= ~SCF_DO_STCLASS;
-            min += 1;
-            delta += d;
-            if (flags & SCF_DO_SUBSTR) {
-               SCAN_COMMIT(pRExC_state,data,minlenp);  /* Cannot expect anything... */
-               data->pos_min += 1;
-               data->pos_delta += d;
-               data->longest = &(data->longest_float);
-           }
-       }
        else if (REGNODE_SIMPLE(OP(scan))) {
            int value = 0;
 
@@ -11976,8 +11964,6 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
                           SVfARG((MUTABLE_SV(progi->data->data[ ARG( o ) ]))));
     } else if (k == LOGICAL)
        Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags);     /* 2: embedded, otherwise 1 */
-    else if (k == FOLDCHAR)
-       Perl_sv_catpvf(aTHX_ sv, "[0x%"UVXf"]", PTR2UV(ARG(o)) );
     else if (k == ANYOF) {
        int i, rangestart = -1;
        const U8 flags = ANYOF_FLAGS(o);
index 9f7788d..f0ee701 100644 (file)
@@ -217,8 +217,6 @@ NVERTWS     NVERTWS,    none 0 S  ; not vertical whitespace     (Perl 6)
 HORIZWS     HORIZWS,    none 0 S  ; horizontal whitespace       (Perl 6)
 NHORIZWS    NHORIZWS,   none 0 S  ; not horizontal whitespace   (Perl 6)
 
-FOLDCHAR    FOLDCHAR,   codepoint 1 ; codepoint with tricky case folding properties.
-
 
 # NEW STUFF SOMEWHERE ABOVE THIS LINE
 
index 54cc017..6bd8b20 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -5710,27 +5710,6 @@ NULL
             sayNO;
             /* NOTREACHED */
 #undef ST
-        case FOLDCHAR:
-            n = ARG(scan);
-            if ( n == (U32)what_len_TRICKYFOLD(locinput,utf8_target,ln) ) {
-                locinput += ln;
-            } else if ( LATIN_SMALL_LETTER_SHARP_S == n && !utf8_target && !UTF_PATTERN ) {
-                sayNO;
-            } else  {
-                U8 folded[UTF8_MAXBYTES_CASE+1];
-                STRLEN foldlen;
-                const char * const l = locinput;
-                char *e = PL_regeol;
-                to_uni_fold(n, folded, &foldlen);
-
-               if (! foldEQ_utf8((const char*) folded, 0,  foldlen, 1,
-                              l, &e, 0,  utf8_target)) {
-                        sayNO;
-                }
-                locinput = e;
-            } 
-            nextchr = UCHARAT(locinput);  
-            break;
         case LNBREAK:
             if ((n=is_LNBREAK(locinput,utf8_target))) {
                 locinput += n;
index 785ff1c..9941593 100644 (file)
@@ -6,8 +6,8 @@
 
 /* Regops and State definitions */
 
-#define REGNODE_MAX            113
-#define REGMATCH_STATE_MAX     153
+#define REGNODE_MAX            112
+#define REGMATCH_STATE_MAX     152
 
 #define        END                     0       /* 0000 End of program. */
 #define        SUCCEED                 1       /* 0x01 Return from a subroutine, basically. */
 #define        NVERTWS                 108     /* 0x6c not vertical whitespace     (Perl 6) */
 #define        HORIZWS                 109     /* 0x6d horizontal whitespace       (Perl 6) */
 #define        NHORIZWS                110     /* 0x6e not horizontal whitespace   (Perl 6) */
-#define        FOLDCHAR                111     /* 0x6f codepoint with tricky case folding properties. */
-#define        OPTIMIZED               112     /* 0x70 Placeholder for dump. */
-#define        PSEUDO                  113     /* 0x71 Pseudo opcode for internal use. */
+#define        OPTIMIZED               111     /* 0x6f Placeholder for dump. */
+#define        PSEUDO                  112     /* 0x70 Pseudo opcode for internal use. */
        /* ------------ States ------------- */
 #define        TRIE_next               (REGNODE_MAX + 1)       /* state for TRIE */
 #define        TRIE_next_fail          (REGNODE_MAX + 2)       /* state for TRIE */
@@ -282,7 +281,6 @@ EXTCONST U8 PL_regkind[] = {
        NVERTWS,        /* NVERTWS                */
        HORIZWS,        /* HORIZWS                */
        NHORIZWS,       /* NHORIZWS               */
-       FOLDCHAR,       /* FOLDCHAR               */
        NOTHING,        /* OPTIMIZED              */
        PSEUDO,         /* PSEUDO                 */
        /* ------------ States ------------- */
@@ -444,7 +442,6 @@ static const U8 regarglen[] = {
        0,                                      /* NVERTWS      */
        0,                                      /* HORIZWS      */
        0,                                      /* NHORIZWS     */
-       EXTRA_SIZE(struct regnode_1),           /* FOLDCHAR     */
        0,                                      /* OPTIMIZED    */
        0,                                      /* PSEUDO       */
 };
@@ -563,7 +560,6 @@ static const char reg_off_by_arg[] = {
        0,      /* NVERTWS      */
        0,      /* HORIZWS      */
        0,      /* NHORIZWS     */
-       0,      /* FOLDCHAR     */
        0,      /* OPTIMIZED    */
        0,      /* PSEUDO       */
 };
@@ -687,9 +683,8 @@ EXTCONST char * const PL_reg_name[] = {
        "NVERTWS",                      /* 0x6c */
        "HORIZWS",                      /* 0x6d */
        "NHORIZWS",                     /* 0x6e */
-       "FOLDCHAR",                     /* 0x6f */
-       "OPTIMIZED",                    /* 0x70 */
-       "PSEUDO",                       /* 0x71 */
+       "OPTIMIZED",                    /* 0x6f */
+       "PSEUDO",                       /* 0x70 */
        /* ------------ States ------------- */
        "TRIE_next",                    /* REGNODE_MAX +0x01 */
        "TRIE_next_fail",               /* REGNODE_MAX +0x02 */