summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-12-23 20:19:27 -0700
committerKarl Williamson <public@khwilliamson.com>2012-01-19 11:58:19 -0700
commitfa01018c102d8360898153b9f4b062716ad06702 (patch)
tree4cd4070d320abb9936fe0d2a08a732c597637def
parentbb9144850c8033592c0187ea712691a97703385e (diff)
downloadperl-fa01018c102d8360898153b9f4b062716ad06702.tar.gz
regex: Remove FOLDCHAR regnode type
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.
-rw-r--r--regcomp.c14
-rw-r--r--regcomp.sym2
-rw-r--r--regexec.c21
-rw-r--r--regnodes.h17
4 files changed, 6 insertions, 48 deletions
diff --git a/regcomp.c b/regcomp.c
index d2085fc753..b880599b11 100644
--- 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);
diff --git a/regcomp.sym b/regcomp.sym
index 9f7788d943..f0ee701991 100644
--- a/regcomp.sym
+++ b/regcomp.sym
@@ -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
diff --git a/regexec.c b/regexec.c
index 54cc0174b1..6bd8b20b60 100644
--- 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;
diff --git a/regnodes.h b/regnodes.h
index 785ff1c9ca..994159342f 100644
--- a/regnodes.h
+++ b/regnodes.h
@@ -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. */
@@ -120,9 +120,8 @@
#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 */