summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-18 04:44:28 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-18 04:44:28 +0000
commit9442cb0ec25041ea5b061c40868e0a3c8bfbb2ab (patch)
tree5daab49f90f4f56ab0c78b3f182bbbf7c9c2bc15 /regexec.c
parentdc333d646a9558aeba3e1eead33465178e854942 (diff)
downloadperl-9442cb0ec25041ea5b061c40868e0a3c8bfbb2ab.tar.gz
make /\S/ match the same things /[\S]/ matches; likewise for
\D (from Rick Delaney <rick@consumercontact.com>) p4raw-id: //depot/perl@5126
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/regexec.c b/regexec.c
index cef98878f9..e63fa6f070 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2084,7 +2084,7 @@ S_regmatch(pTHX_ regnode *prog)
PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case SPACE:
- if (!nextchr && locinput >= PL_regeol)
+ if (!nextchr)
sayNO;
if (!(OP(scan) == SPACE
? isSPACE(nextchr) : isSPACE_LC(nextchr)))
@@ -2095,11 +2095,11 @@ S_regmatch(pTHX_ regnode *prog)
PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case SPACEUTF8:
- if (!nextchr && locinput >= PL_regeol)
+ if (!nextchr)
sayNO;
if (nextchr & 0x80) {
if (!(OP(scan) == SPACEUTF8
- ? swash_fetch(PL_utf8_space,(U8*)locinput)
+ ? swash_fetch(PL_utf8_space, (U8*)locinput)
: isSPACE_LC_utf8((U8*)locinput)))
{
sayNO;
@@ -2117,9 +2117,9 @@ S_regmatch(pTHX_ regnode *prog)
PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case NSPACE:
- if (!nextchr)
+ if (!nextchr && locinput >= PL_regeol)
sayNO;
- if (OP(scan) == SPACE
+ if (OP(scan) == NSPACE
? isSPACE(nextchr) : isSPACE_LC(nextchr))
sayNO;
nextchr = UCHARAT(++locinput);
@@ -2128,11 +2128,11 @@ S_regmatch(pTHX_ regnode *prog)
PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case NSPACEUTF8:
- if (!nextchr)
+ if (!nextchr && locinput >= PL_regeol)
sayNO;
if (nextchr & 0x80) {
if (OP(scan) == NSPACEUTF8
- ? swash_fetch(PL_utf8_space,(U8*)locinput)
+ ? swash_fetch(PL_utf8_space, (U8*)locinput)
: isSPACE_LC_utf8((U8*)locinput))
{
sayNO;
@@ -2150,7 +2150,7 @@ S_regmatch(pTHX_ regnode *prog)
PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case DIGIT:
- if (!nextchr && locinput >= PL_regeol)
+ if (!nextchr)
sayNO;
if (!(OP(scan) == DIGIT
? isDIGIT(nextchr) : isDIGIT_LC(nextchr)))
@@ -2164,9 +2164,9 @@ S_regmatch(pTHX_ regnode *prog)
if (!nextchr)
sayNO;
if (nextchr & 0x80) {
- if (OP(scan) == NDIGITUTF8
- ? swash_fetch(PL_utf8_digit,(U8*)locinput)
- : isDIGIT_LC_utf8((U8*)locinput))
+ if (!(OP(scan) == DIGITUTF8
+ ? swash_fetch(PL_utf8_digit, (U8*)locinput)
+ : isDIGIT_LC_utf8((U8*)locinput)))
{
sayNO;
}
@@ -2174,7 +2174,8 @@ S_regmatch(pTHX_ regnode *prog)
nextchr = UCHARAT(locinput);
break;
}
- if (!isDIGIT(nextchr))
+ if (!(OP(scan) == DIGITUTF8
+ ? isDIGIT(nextchr) : isDIGIT_LC(nextchr)))
sayNO;
nextchr = UCHARAT(++locinput);
break;
@@ -2182,9 +2183,9 @@ S_regmatch(pTHX_ regnode *prog)
PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case NDIGIT:
- if (!nextchr)
+ if (!nextchr && locinput >= PL_regeol)
sayNO;
- if (OP(scan) == DIGIT
+ if (OP(scan) == NDIGIT
? isDIGIT(nextchr) : isDIGIT_LC(nextchr))
sayNO;
nextchr = UCHARAT(++locinput);
@@ -2196,13 +2197,18 @@ S_regmatch(pTHX_ regnode *prog)
if (!nextchr && locinput >= PL_regeol)
sayNO;
if (nextchr & 0x80) {
- if (swash_fetch(PL_utf8_digit,(U8*)locinput))
+ if (OP(scan) == NDIGITUTF8
+ ? swash_fetch(PL_utf8_digit, (U8*)locinput)
+ : isDIGIT_LC_utf8((U8*)locinput))
+ {
sayNO;
+ }
locinput += PL_utf8skip[nextchr];
nextchr = UCHARAT(locinput);
break;
}
- if (isDIGIT(nextchr))
+ if (OP(scan) == NDIGITUTF8
+ ? isDIGIT(nextchr) : isDIGIT_LC(nextchr))
sayNO;
nextchr = UCHARAT(++locinput);
break;