develooper Front page | perl.perl5.porters | Postings from February 2000

[ID 20000215.007][PATCH 5.5.650] /\S/ != /[\S]/

From:
Rick Delaney
Date:
February 17, 2000 11:14
Subject:
[ID 20000215.007][PATCH 5.5.650] /\S/ != /[\S]/
Message ID:
Pine.UW2.4.10.10002171357060.14369-100000@consumer
It looks like /\D/ isn't the same as /[\D]/ in 5.5.650 either (it is in
5.005_03).  

I have probably naively went too far on this but it seems to work.  It
looked to me like the code for DIGIT and SPACE should just be symmetric
with that for ALNUM so I made it that way.

I don't know how to test the UTF8 stuff.

Rick

*** perl5.5.650/regexec.c.old	Thu Feb 17 09:28:07 2000
--- perl5.5.650/regexec.c	Thu Feb 17 13:36:34 2000
***************
*** 2084,2090 ****
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case SPACE:
! 	    if (!nextchr && locinput >= PL_regeol)
  		sayNO;
  	    if (!(OP(scan) == SPACE
  		  ? isSPACE(nextchr) : isSPACE_LC(nextchr)))
--- 2084,2090 ----
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case SPACE:
! 	    if (!nextchr)
  		sayNO;
  	    if (!(OP(scan) == SPACE
  		  ? isSPACE(nextchr) : isSPACE_LC(nextchr)))
***************
*** 2095,2105 ****
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case SPACEUTF8:
! 	    if (!nextchr && locinput >= PL_regeol)
  		sayNO;
  	    if (nextchr & 0x80) {
  		if (!(OP(scan) == SPACEUTF8
! 		      ? swash_fetch(PL_utf8_space,(U8*)locinput)
  		      : isSPACE_LC_utf8((U8*)locinput)))
  		{
  		    sayNO;
--- 2095,2105 ----
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case SPACEUTF8:
! 	    if (!nextchr)
  		sayNO;
  	    if (nextchr & 0x80) {
  		if (!(OP(scan) == SPACEUTF8
! 		      ? swash_fetch(PL_utf8_space, (U8*)locinput)
  		      : isSPACE_LC_utf8((U8*)locinput)))
  		{
  		    sayNO;
***************
*** 2117,2125 ****
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case NSPACE:
! 	    if (!nextchr)
  		sayNO;
! 	    if (OP(scan) == SPACE
  		? isSPACE(nextchr) : isSPACE_LC(nextchr))
  		sayNO;
  	    nextchr = UCHARAT(++locinput);
--- 2117,2125 ----
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case NSPACE:
! 	    if (!nextchr && locinput >= PL_regeol)
  		sayNO;
! 	    if (OP(scan) == NSPACE
  		? isSPACE(nextchr) : isSPACE_LC(nextchr))
  		sayNO;
  	    nextchr = UCHARAT(++locinput);
***************
*** 2128,2138 ****
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case NSPACEUTF8:
! 	    if (!nextchr)
  		sayNO;
  	    if (nextchr & 0x80) {
  		if (OP(scan) == NSPACEUTF8
! 		    ? swash_fetch(PL_utf8_space,(U8*)locinput)
  		    : isSPACE_LC_utf8((U8*)locinput))
  		{
  		    sayNO;
--- 2128,2138 ----
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case NSPACEUTF8:
! 	    if (!nextchr && locinput >= PL_regeol)
  		sayNO;
  	    if (nextchr & 0x80) {
  		if (OP(scan) == NSPACEUTF8
! 		    ? swash_fetch(PL_utf8_space, (U8*)locinput)
  		    : isSPACE_LC_utf8((U8*)locinput))
  		{
  		    sayNO;
***************
*** 2150,2156 ****
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case DIGIT:
! 	    if (!nextchr && locinput >= PL_regeol)
  		sayNO;
  	    if (!(OP(scan) == DIGIT
  		  ? isDIGIT(nextchr) : isDIGIT_LC(nextchr)))
--- 2150,2156 ----
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case DIGIT:
! 	    if (!nextchr)
  		sayNO;
  	    if (!(OP(scan) == DIGIT
  		  ? isDIGIT(nextchr) : isDIGIT_LC(nextchr)))
***************
*** 2164,2172 ****
  	    if (!nextchr)
  		sayNO;
  	    if (nextchr & 0x80) {
! 		if (OP(scan) == NDIGITUTF8
! 		    ? swash_fetch(PL_utf8_digit,(U8*)locinput)
! 		    : isDIGIT_LC_utf8((U8*)locinput))
  		{
  		    sayNO;
  		}
--- 2164,2172 ----
  	    if (!nextchr)
  		sayNO;
  	    if (nextchr & 0x80) {
! 		if (!(OP(scan) == DIGITUTF8
! 		      ? swash_fetch(PL_utf8_digit, (U8*)locinput)
! 		      : isDIGIT_LC_utf8((U8*)locinput)))
  		{
  		    sayNO;
  		}
***************
*** 2174,2180 ****
  		nextchr = UCHARAT(locinput);
  		break;
  	    }
! 	    if (!isDIGIT(nextchr))
  		sayNO;
  	    nextchr = UCHARAT(++locinput);
  	    break;
--- 2174,2181 ----
  		nextchr = UCHARAT(locinput);
  		break;
  	    }
! 	    if (!(OP(scan) == DIGITUTF8
! 		  ? isDIGIT(nextchr) : isDIGIT_LC(nextchr)))
  		sayNO;
  	    nextchr = UCHARAT(++locinput);
  	    break;
***************
*** 2182,2190 ****
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case NDIGIT:
! 	    if (!nextchr)
  		sayNO;
! 	    if (OP(scan) == DIGIT
  		? isDIGIT(nextchr) : isDIGIT_LC(nextchr))
  		sayNO;
  	    nextchr = UCHARAT(++locinput);
--- 2183,2191 ----
  	    PL_reg_flags |= RF_tainted;
  	    /* FALL THROUGH */
  	case NDIGIT:
! 	    if (!nextchr && locinput >= PL_regeol)
  		sayNO;
! 	    if (OP(scan) == NDIGIT
  		? isDIGIT(nextchr) : isDIGIT_LC(nextchr))
  		sayNO;
  	    nextchr = UCHARAT(++locinput);
***************
*** 2196,2208 ****
  	    if (!nextchr && locinput >= PL_regeol)
  		sayNO;
  	    if (nextchr & 0x80) {
! 		if (swash_fetch(PL_utf8_digit,(U8*)locinput))
  		    sayNO;
  		locinput += PL_utf8skip[nextchr];
  		nextchr = UCHARAT(locinput);
  		break;
  	    }
! 	    if (isDIGIT(nextchr))
  		sayNO;
  	    nextchr = UCHARAT(++locinput);
  	    break;
--- 2197,2214 ----
  	    if (!nextchr && locinput >= PL_regeol)
  		sayNO;
  	    if (nextchr & 0x80) {
! 		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 (OP(scan) == NDIGITUTF8
! 		? isDIGIT(nextchr) : isDIGIT_LC(nextchr))
  		sayNO;
  	    nextchr = UCHARAT(++locinput);
  	    break;




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About