From: Yves Orton Date: Thu, 28 Jun 2007 22:14:14 +0000 (+0000) Subject: Replace pattern parsing logic with optree "parsing" logic. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7bd1e61447493a93405e0d15fe2f8a0b6bf71de1;p=p5sagit%2Fp5-mst-13.2.git Replace pattern parsing logic with optree "parsing" logic. p4raw-id: //depot/perl@31496 --- diff --git a/regcomp.c b/regcomp.c index d7b9981..6266ab3 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4752,6 +4752,7 @@ reStudy: else r->paren_names = NULL; +#ifdef STUPID_PATTERN_CHECKS if (r->extflags & RXf_SPLIT && r->prelen == 1 && r->precomp[0] == ' ') /* XXX: this should happen BEFORE we compile */ r->extflags |= (RXf_SKIPWHITE|RXf_WHITE); @@ -4759,6 +4760,20 @@ reStudy: r->extflags |= RXf_WHITE; else if (r->prelen == 1 && r->precomp[0] == '^') r->extflags |= RXf_START_ONLY; +#endif + if (r->extflags & RXf_SPLIT && r->prelen == 1 && r->precomp[0] == ' ') + /* XXX: this should happen BEFORE we compile */ + r->extflags |= (RXf_SKIPWHITE|RXf_WHITE); + else { + regnode *first = ri->program + 1; + char fop = OP(first); + char nop = OP(NEXTOPER(first)); + + if (PL_regkind[fop] == BOL && nop == END) + r->extflags |= RXf_START_ONLY; + else if (fop == PLUS && nop ==SPACE && OP(regnext(first))==END) + r->extflags |= RXf_WHITE; + } #ifdef DEBUGGING if (RExC_paren_names) {