From: Jarkko Hietaniemi Date: Sat, 31 Jul 1999 22:11:03 +0000 (+0000) Subject: Remove a lot of unused regnode codes. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d6a287148f674729887096e6af50b42b464c3451;p=p5sagit%2Fp5-mst-13.2.git Remove a lot of unused regnode codes. Noticed by Ilya. p4raw-id: //depot/cfgperl@3842 --- diff --git a/regcomp.sym b/regcomp.sym index 4e5c1c1..bb5f8f8 100644 --- a/regcomp.sym +++ b/regcomp.sym @@ -33,97 +33,29 @@ SANYUTF8 REG_ANY, no Match any one Unicode character. ANYOF ANYOF, sv Match character in (or not in) this class. ANYOFUTF8 ANYOF, sv 1 Match character in (or not in) this class. ALNUM ALNUM, no Match any alphanumeric character -ALNUMUTF8 ALNUM, no Match any alphanumeric character +ALNUMUTF8 ALNUM, no Match any alphanumeric character in utf8 ALNUML ALNUM, no Match any alphanumeric char in locale -ALNUMLUTF8 ALNUM, no Match any alphanumeric char in locale +ALNUMLUTF8 ALNUM, no Match any alphanumeric char in locale+utf8 NALNUM NALNUM, no Match any non-alphanumeric character -NALNUMUTF8 NALNUM, no Match any non-alphanumeric character +NALNUMUTF8 NALNUM, no Match any non-alphanumeric character in utf8 NALNUML NALNUM, no Match any non-alphanumeric char in locale -NALNUMLUTF8 NALNUM, no Match any non-alphanumeric char in locale +NALNUMLUTF8 NALNUM, no Match any non-alphanumeric char in locale+utf8 SPACE SPACE, no Match any whitespace character -SPACEUTF8 SPACE, no Match any whitespace character +SPACEUTF8 SPACE, no Match any whitespace character in utf8 SPACEL SPACE, no Match any whitespace char in locale -SPACELUTF8 SPACE, no Match any whitespace char in locale +SPACELUTF8 SPACE, no Match any whitespace char in locale+utf8 NSPACE NSPACE, no Match any non-whitespace character -NSPACEUTF8 NSPACE, no Match any non-whitespace character +NSPACEUTF8 NSPACE, no Match any non-whitespace character in utf8 NSPACEL NSPACE, no Match any non-whitespace char in locale -NSPACELUTF8 NSPACE, no Match any non-whitespace char in locale +NSPACELUTF8 NSPACE, no Match any non-whitespace char in locale+utf8 DIGIT DIGIT, no Match any numeric character -DIGITUTF8 DIGIT, no Match any numeric character +DIGITUTF8 DIGIT, no Match any numeric character in utf8 DIGITL DIGIT, no Match any numeric character in locale -DIGITLUTF8 DIGIT, no Match any numeric character in locale +DIGITLUTF8 DIGIT, no Match any numeric character in locale+utf8 NDIGIT NDIGIT, no Match any non-numeric character -NDIGITUTF8 NDIGIT, no Match any non-numeric character +NDIGITUTF8 NDIGIT, no Match any non-numeric character in utf8 NDIGITL NDIGIT, no Match any non-numeric character in locale -NDIGITLUTF8 NDIGIT, no Match any non-numeric character in locale -ALNUMC ALNUMC, no Match any alphanumeric character -ALNUMCUTF8 ALNUMC, no Match any alphanumeric character -ALNUMCL ALNUMC, no Match any alphanumeric character in locale -ALNUMCLUTF8 ALNUMC, no Match any alphanumeric character in locale -NALNUMC NALNUMC, no Match any non-alphanumeric character -NALNUMCUTF8 NALNUMC, no Match any non-alphanumeric character -NALNUMCL NALNUMC, no Match any non-alphanumeric character in locale -NALNUMCLUTF8 NALNUMC, no Match any non-alphanumeric character in locale -ALPHA ALPHA, no Match any alphabetic character -ALPHAUTF8 ALPHA, no Match any alphabetic character -ALPHAL ALPHA, no Match any alphabetic character in locale -ALPHALUTF8 ALPHA, no Match any alphabetic character in locale -NALPHA NALPHA, no Match any non-alphabetic character -NALPHAUTF8 NALPHA, no Match any non-alphabetic character -NALPHAL NALPHA, no Match any non-alphabetic character in locale -NALPHALUTF8 NALPHA, no Match any non-alphabetic character in locale -ASCII ASCII, no Match any ASCII character -NASCII NASCII, no Match any non-ASCII character -CNTRL CNTRL, no Match any control character -CNTRLUTF8 CNTRL, no Match any control character -CNTRLL CNTRL, no Match any control character in locale -CNTRLLUTF8 CNTRL, no Match any control character in locale -NCNTRL NCNTRL, no Match any non-control character -NCNTRLUTF8 NCNTRL, no Match any non-control character -NCNTRLL NCNTRL, no Match any non-control character in locale -NCNTRLLUTF8 NCNTRL, no Match any non-control character in locale -GRAPH GRAPH, no Match any graphical character -GRAPHUTF8 GRAPH, no Match any graphical character -GRAPHL GRAPH, no Match any graphical character in locale -GRAPHLUTF8 GRAPH, no Match any graphical character in locale -NGRAPH NGRAPH, no Match any non-graphical character -NGRAPHUTF8 NGRAPH, no Match any non-graphical character -NGRAPHL NGRAPH, no Match any non-graphical character in locale -NGRAPHLUTF8 NGRAPH, no Match any non-graphical character in locale -LOWER LOWER, no Match any lowercase character -LOWERUTF8 LOWER, no Match any lowercase character -LOWERL LOWER, no Match any lowercase character in locale -LOWERLUTF8 LOWER, no Match any lowercase character in locale -NLOWER NLOWER, no Match any non-lowercase character -NLOWERUTF8 NLOWER, no Match any non-lowercase character -NLOWERL NLOWER, no Match any non-lowercase character in locale -NLOWERLUTF8 NLOWER, no Match any non-lowercase character in locale -PRINT PRINT, no Match any printable character -PRINTUTF8 PRINT, no Match any printable character -PRINTL PRINT, no Match any printable character in locale -PRINTLUTF8 PRINT, no Match any printable character in locale -NPRINT NPRINT, no Match any non-printable character -NPRINTUTF8 NPRINT, no Match any non-printable character -NPRINTL NPRINT, no Match any non-printable character in locale -NPRINTLUTF8 NPRINT, no Match any non-printable character in locale -PUNCT PUNCT, no Match any punctuation character -PUNCTUTF8 PUNCT, no Match any punctuation character -PUNCTL PUNCT, no Match any punctuation character in locale -PUNCTLUTF8 PUNCT, no Match any punctuation character in locale -NPUNCT NPUNCT, no Match any non-punctuation character -NPUNCTUTF8 NPUNCT, no Match any non-punctuation character -NPUNCTL NPUNCT, no Match any non-punctuation character in locale -NPUNCTLUTF8 NPUNCT, no Match any non-punctuation character in locale -UPPER UPPER, no Match any uppercase character -UPPERUTF8 UPPER, no Match any uppercase character -UPPERL UPPER, no Match any uppercase character in locale -UPPERLUTF8 UPPER, no Match any uppercase character in locale -NUPPER NUPPER, no Match any non-uppercase character -NUPPERUTF8 NUPPER, no Match any non-uppercase character -NUPPERL NUPPER, no Match any non-uppercase character in locale -NUPPERLUTF8 NUPPER, no Match any non-uppercase character in locale -XDIGIT XDIGIT, no Match any hexdigit character -NXDIGIT NXDIGIT, no Match any non-hexdigit character +NDIGITLUTF8 NDIGIT, no Match any non-numeric character in locale+utf8 CLUMP CLUMP, no Match any combining character sequence # BRANCH The set of branches constituting a single choice are hooked diff --git a/regexec.c b/regexec.c index e69c4ff..f6ed328 100644 --- a/regexec.c +++ b/regexec.c @@ -1142,1772 +1142,475 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * s += UTF8SKIP(s); } break; - case ALNUMC: - while (s < strend) { - if (isALNUMC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case ALNUMCUTF8: - while (s < strend) { - if (swash_fetch(PL_utf8_alnumc, (U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case ALNUMCL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (isALNUMC_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case ALNUMCLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (isALNUMC_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NALNUMC: - while (s < strend) { - if (!isALNUMC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; + } + } + else { + dontbother = 0; + if (prog->float_substr != Nullsv) { /* Trim the end. */ + char *last; + I32 oldpos = scream_pos; + + if (flags & REXEC_SCREAM) { + last = screaminstr(sv, prog->float_substr, s - strbeg, + end_shift, &scream_pos, 1); /* last one */ + if (!last) + last = scream_olds; /* Only one occurence. */ } - break; - case NALNUMCUTF8: - while (s < strend) { - if (!swash_fetch(PL_utf8_alnumc, (U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; + else { + STRLEN len; + char *little = SvPV(prog->float_substr, len); + + if (SvTAIL(prog->float_substr)) { + if (memEQ(strend - len + 1, little, len - 1)) + last = strend - len + 1; + else if (!PL_multiline) + last = memEQ(strend - len, little, len) + ? strend - len : Nullch; else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NALNUMCL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isALNUMC_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; + goto find_last; + } else { + find_last: + if (len) + last = rninstr(s, strend, little, little + len); else - tmp = doevery; + last = strend; /* matching `$' */ } - else - tmp = 1; - s++; } - break; - case NALNUMCLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isALNUMC_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; + if (last == NULL) goto phooey; /* Should not happen! */ + dontbother = strend - last + prog->float_min_offset; + } + if (minlen && (dontbother < minlen)) + dontbother = minlen - 1; + strend -= dontbother; /* this one's always in bytes! */ + /* We don't know much -- general case. */ + if (UTF) { + for (;;) { + if (regtry(prog, s)) + goto got_it; + if (s >= strend) + break; s += UTF8SKIP(s); + }; + } + else { + do { + if (regtry(prog, s)) + goto got_it; + } while (s++ < strend); + } + } + + /* Failure. */ + goto phooey; + +got_it: + RX_MATCH_TAINTED_set(prog, PL_reg_flags & RF_tainted); + + if (PL_reg_eval_set) { + /* Preserve the current value of $^R */ + if (oreplsv != GvSV(PL_replgv)) + sv_setsv(oreplsv, GvSV(PL_replgv));/* So that when GvSV(replgv) is + restored, the value remains + the same. */ + restore_pos(aTHXo_ 0); + } + + /* make sure $`, $&, $', and $digit will work later */ + if ( !(flags & REXEC_NOT_FIRST) ) { + if (RX_MATCH_COPIED(prog)) { + Safefree(prog->subbeg); + RX_MATCH_COPIED_off(prog); + } + if (flags & REXEC_COPY_STR) { + I32 i = PL_regeol - startpos + (stringarg - strbeg); + + s = savepvn(strbeg, i); + prog->subbeg = s; + prog->sublen = i; + RX_MATCH_COPIED_on(prog); + } + else { + prog->subbeg = strbeg; + prog->sublen = PL_regeol - strbeg; /* strend may have been modified */ + } + } + + return 1; + +phooey: + if (PL_reg_eval_set) + restore_pos(aTHXo_ 0); + return 0; +} + +/* + - regtry - try match at specific point + */ +STATIC I32 /* 0 failure, 1 success */ +S_regtry(pTHX_ regexp *prog, char *startpos) +{ + dTHR; + register I32 i; + register I32 *sp; + register I32 *ep; + CHECKPOINT lastcp; + + if ((prog->reganch & ROPT_EVAL_SEEN) && !PL_reg_eval_set) { + MAGIC *mg; + + PL_reg_eval_set = RS_init; + DEBUG_r(DEBUG_s( + PerlIO_printf(Perl_debug_log, " setting stack tmpbase at %i\n", + PL_stack_sp - PL_stack_base); + )); + SAVEINT(cxstack[cxstack_ix].blk_oldsp); + cxstack[cxstack_ix].blk_oldsp = PL_stack_sp - PL_stack_base; + /* Otherwise OP_NEXTSTATE will free whatever on stack now. */ + SAVETMPS; + /* Apparently this is not needed, judging by wantarray. */ + /* SAVEINT(cxstack[cxstack_ix].blk_gimme); + cxstack[cxstack_ix].blk_gimme = G_SCALAR; */ + + if (PL_reg_sv) { + /* Make $_ available to executed code. */ + if (PL_reg_sv != DEFSV) { + /* SAVE_DEFSV does *not* suffice here for USE_THREADS */ + SAVESPTR(DEFSV); + DEFSV = PL_reg_sv; } - break; - case ASCII: - while (s < strend) { - if (isASCII(*(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NASCII: - while (s < strend) { - if (!isASCII(*(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case CNTRL: - while (s < strend) { - if (isCNTRL(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case CNTRLUTF8: - while (s < strend) { - if (swash_fetch(PL_utf8_cntrl,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case CNTRLL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (isCNTRL_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case CNTRLLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (*s == ' ' || isCNTRL_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NCNTRL: - while (s < strend) { - if (!isCNTRL(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NCNTRLUTF8: - while (s < strend) { - if (!swash_fetch(PL_utf8_cntrl,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NCNTRLL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isCNTRL_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NCNTRLLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isCNTRL_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case GRAPH: - while (s < strend) { - if (isGRAPH(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case GRAPHUTF8: - while (s < strend) { - if (swash_fetch(PL_utf8_graph,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case GRAPHL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (isGRAPH_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case GRAPHLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (*s == ' ' || isGRAPH_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NGRAPH: - while (s < strend) { - if (!isGRAPH(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NGRAPHUTF8: - while (s < strend) { - if (!swash_fetch(PL_utf8_graph,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NGRAPHL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isGRAPH_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NGRAPHLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isGRAPH_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case LOWER: - while (s < strend) { - if (isLOWER(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case LOWERUTF8: - while (s < strend) { - if (swash_fetch(PL_utf8_lower,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case LOWERL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (isLOWER_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case LOWERLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (*s == ' ' || isLOWER_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NLOWER: - while (s < strend) { - if (!isLOWER(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NLOWERUTF8: - while (s < strend) { - if (!swash_fetch(PL_utf8_lower,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NLOWERL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isLOWER_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NLOWERLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isLOWER_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case PRINT: - while (s < strend) { - if (isPRINT(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case PRINTUTF8: - while (s < strend) { - if (swash_fetch(PL_utf8_print,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case PRINTL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (isPRINT_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case PRINTLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (*s == ' ' || isPRINT_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NPRINT: - while (s < strend) { - if (!isPRINT(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NPRINTUTF8: - while (s < strend) { - if (!swash_fetch(PL_utf8_print,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NPRINTL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isPRINT_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NPRINTLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isPRINT_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case PUNCT: - while (s < strend) { - if (isPUNCT(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case PUNCTUTF8: - while (s < strend) { - if (swash_fetch(PL_utf8_punct,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case PUNCTL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (isPUNCT_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case PUNCTLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (*s == ' ' || isPUNCT_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NPUNCT: - while (s < strend) { - if (!isPUNCT(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NPUNCTUTF8: - while (s < strend) { - if (!swash_fetch(PL_utf8_punct,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NPUNCTL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isPUNCT_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NPUNCTLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isPUNCT_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case UPPER: - while (s < strend) { - if (isUPPER(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case UPPERUTF8: - while (s < strend) { - if (swash_fetch(PL_utf8_upper,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case UPPERL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (isUPPER_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case UPPERLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (*s == ' ' || isUPPER_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NUPPER: - while (s < strend) { - if (!isUPPER(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NUPPERUTF8: - while (s < strend) { - if (!swash_fetch(PL_utf8_upper,(U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case NUPPERL: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isUPPER_LC(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NUPPERLUTF8: - PL_reg_flags |= RF_tainted; - while (s < strend) { - if (!isUPPER_LC_utf8((U8*)s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s += UTF8SKIP(s); - } - break; - case XDIGIT: - while (s < strend) { - if (isXDIGIT(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - case NXDIGIT: - while (s < strend) { - if (!isXDIGIT(*s)) { - if (tmp && regtry(prog, s)) - goto got_it; - else - tmp = doevery; - } - else - tmp = 1; - s++; - } - break; - } - } - else { - dontbother = 0; - if (prog->float_substr != Nullsv) { /* Trim the end. */ - char *last; - I32 oldpos = scream_pos; - - if (flags & REXEC_SCREAM) { - last = screaminstr(sv, prog->float_substr, s - strbeg, - end_shift, &scream_pos, 1); /* last one */ - if (!last) - last = scream_olds; /* Only one occurence. */ - } - else { - STRLEN len; - char *little = SvPV(prog->float_substr, len); - - if (SvTAIL(prog->float_substr)) { - if (memEQ(strend - len + 1, little, len - 1)) - last = strend - len + 1; - else if (!PL_multiline) - last = memEQ(strend - len, little, len) - ? strend - len : Nullch; - else - goto find_last; - } else { - find_last: - if (len) - last = rninstr(s, strend, little, little + len); - else - last = strend; /* matching `$' */ - } - } - if (last == NULL) goto phooey; /* Should not happen! */ - dontbother = strend - last + prog->float_min_offset; - } - if (minlen && (dontbother < minlen)) - dontbother = minlen - 1; - strend -= dontbother; /* this one's always in bytes! */ - /* We don't know much -- general case. */ - if (UTF) { - for (;;) { - if (regtry(prog, s)) - goto got_it; - if (s >= strend) - break; - s += UTF8SKIP(s); - }; - } - else { - do { - if (regtry(prog, s)) - goto got_it; - } while (s++ < strend); - } - } - - /* Failure. */ - goto phooey; - -got_it: - RX_MATCH_TAINTED_set(prog, PL_reg_flags & RF_tainted); - - if (PL_reg_eval_set) { - /* Preserve the current value of $^R */ - if (oreplsv != GvSV(PL_replgv)) - sv_setsv(oreplsv, GvSV(PL_replgv));/* So that when GvSV(replgv) is - restored, the value remains - the same. */ - restore_pos(aTHXo_ 0); - } - - /* make sure $`, $&, $', and $digit will work later */ - if ( !(flags & REXEC_NOT_FIRST) ) { - if (RX_MATCH_COPIED(prog)) { - Safefree(prog->subbeg); - RX_MATCH_COPIED_off(prog); - } - if (flags & REXEC_COPY_STR) { - I32 i = PL_regeol - startpos + (stringarg - strbeg); - - s = savepvn(strbeg, i); - prog->subbeg = s; - prog->sublen = i; - RX_MATCH_COPIED_on(prog); - } - else { - prog->subbeg = strbeg; - prog->sublen = PL_regeol - strbeg; /* strend may have been modified */ - } - } - - return 1; - -phooey: - if (PL_reg_eval_set) - restore_pos(aTHXo_ 0); - return 0; -} - -/* - - regtry - try match at specific point - */ -STATIC I32 /* 0 failure, 1 success */ -S_regtry(pTHX_ regexp *prog, char *startpos) -{ - dTHR; - register I32 i; - register I32 *sp; - register I32 *ep; - CHECKPOINT lastcp; - - if ((prog->reganch & ROPT_EVAL_SEEN) && !PL_reg_eval_set) { - MAGIC *mg; - - PL_reg_eval_set = RS_init; - DEBUG_r(DEBUG_s( - PerlIO_printf(Perl_debug_log, " setting stack tmpbase at %i\n", - PL_stack_sp - PL_stack_base); - )); - SAVEINT(cxstack[cxstack_ix].blk_oldsp); - cxstack[cxstack_ix].blk_oldsp = PL_stack_sp - PL_stack_base; - /* Otherwise OP_NEXTSTATE will free whatever on stack now. */ - SAVETMPS; - /* Apparently this is not needed, judging by wantarray. */ - /* SAVEINT(cxstack[cxstack_ix].blk_gimme); - cxstack[cxstack_ix].blk_gimme = G_SCALAR; */ - - if (PL_reg_sv) { - /* Make $_ available to executed code. */ - if (PL_reg_sv != DEFSV) { - /* SAVE_DEFSV does *not* suffice here for USE_THREADS */ - SAVESPTR(DEFSV); - DEFSV = PL_reg_sv; - } - - if (!(SvTYPE(PL_reg_sv) >= SVt_PVMG && SvMAGIC(PL_reg_sv) - && (mg = mg_find(PL_reg_sv, 'g')))) { - /* prepare for quick setting of pos */ - sv_magic(PL_reg_sv, (SV*)0, 'g', Nullch, 0); - mg = mg_find(PL_reg_sv, 'g'); - mg->mg_len = -1; - } - PL_reg_magic = mg; - PL_reg_oldpos = mg->mg_len; - SAVEDESTRUCTOR(restore_pos, 0); - } - if (!PL_reg_curpm) - New(22,PL_reg_curpm, 1, PMOP); - PL_reg_curpm->op_pmregexp = prog; - PL_reg_oldcurpm = PL_curpm; - PL_curpm = PL_reg_curpm; - if (RX_MATCH_COPIED(prog)) { - /* Here is a serious problem: we cannot rewrite subbeg, - since it may be needed if this match fails. Thus - $` inside (?{}) could fail... */ - PL_reg_oldsaved = prog->subbeg; - PL_reg_oldsavedlen = prog->sublen; - RX_MATCH_COPIED_off(prog); - } - else - PL_reg_oldsaved = Nullch; - prog->subbeg = PL_bostr; - prog->sublen = PL_regeol - PL_bostr; /* strend may have been modified */ - } - prog->startp[0] = startpos - PL_bostr; - PL_reginput = startpos; - PL_regstartp = prog->startp; - PL_regendp = prog->endp; - PL_reglastparen = &prog->lastparen; - prog->lastparen = 0; - PL_regsize = 0; - DEBUG_r(PL_reg_starttry = startpos); - if (PL_reg_start_tmpl <= prog->nparens) { - PL_reg_start_tmpl = prog->nparens*3/2 + 3; - if(PL_reg_start_tmp) - Renew(PL_reg_start_tmp, PL_reg_start_tmpl, char*); - else - New(22,PL_reg_start_tmp, PL_reg_start_tmpl, char*); - } - - /* XXXX What this code is doing here?!!! There should be no need - to do this again and again, PL_reglastparen should take care of - this! */ - sp = prog->startp; - ep = prog->endp; - if (prog->nparens) { - for (i = prog->nparens; i >= 1; i--) { - *++sp = -1; - *++ep = -1; - } - } - REGCP_SET; - if (regmatch(prog->program + 1)) { - prog->endp[0] = PL_reginput - PL_bostr; - return 1; - } - REGCP_UNWIND; - return 0; -} - -/* - - regmatch - main matching routine - * - * Conceptually the strategy is simple: check to see whether the current - * node matches, call self recursively to see whether the rest matches, - * and then act accordingly. In practice we make some effort to avoid - * recursion, in particular by going through "ordinary" nodes (that don't - * need to know whether the rest of the match failed) by a loop instead of - * by recursion. - */ -/* [lwall] I've hoisted the register declarations to the outer block in order to - * maybe save a little bit of pushing and popping on the stack. It also takes - * advantage of machines that use a register save mask on subroutine entry. - */ -STATIC I32 /* 0 failure, 1 success */ -S_regmatch(pTHX_ regnode *prog) -{ - dTHR; - register regnode *scan; /* Current node. */ - regnode *next; /* Next node. */ - regnode *inner; /* Next node in internal branch. */ - register I32 nextchr; /* renamed nextchr - nextchar colides with - function of same name */ - register I32 n; /* no or next */ - register I32 ln; /* len or last */ - register char *s; /* operand or save */ - register char *locinput = PL_reginput; - register I32 c1, c2, paren; /* case fold search, parenth */ - int minmod = 0, sw = 0, logical = 0; -#ifdef DEBUGGING - PL_regindent++; -#endif - - /* Note that nextchr is a byte even in UTF */ - nextchr = UCHARAT(locinput); - scan = prog; - while (scan != NULL) { -#define sayNO_L (logical ? (logical = 0, sw = 0, goto cont) : sayNO) -#ifdef DEBUGGING -# define sayYES goto yes -# define sayNO goto no -# define saySAME(x) if (x) goto yes; else goto no -# define REPORT_CODE_OFF 24 -#else -# define sayYES return 1 -# define sayNO return 0 -# define saySAME(x) return x -#endif - DEBUG_r( { - SV *prop = sv_newmortal(); - int docolor = *PL_colors[0]; - int taill = (docolor ? 10 : 7); /* 3 chars for "> <" */ - int l = (PL_regeol - locinput > taill ? taill : PL_regeol - locinput); - /* The part of the string before starttry has one color - (pref0_len chars), between starttry and current - position another one (pref_len - pref0_len chars), - after the current position the third one. - We assume that pref0_len <= pref_len, otherwise we - decrease pref0_len. */ - int pref_len = (locinput - PL_bostr > (5 + taill) - l - ? (5 + taill) - l : locinput - PL_bostr); - int pref0_len = pref_len - (locinput - PL_reg_starttry); - - if (l + pref_len < (5 + taill) && l < PL_regeol - locinput) - l = ( PL_regeol - locinput > (5 + taill) - pref_len - ? (5 + taill) - pref_len : PL_regeol - locinput); - if (pref0_len < 0) - pref0_len = 0; - if (pref0_len > pref_len) - pref0_len = pref_len; - regprop(prop, scan); - PerlIO_printf(Perl_debug_log, - "%4i <%s%.*s%s%s%.*s%s%s%s%.*s%s>%*s|%3d:%*s%s\n", - locinput - PL_bostr, - PL_colors[4], pref0_len, - locinput - pref_len, PL_colors[5], - PL_colors[2], pref_len - pref0_len, - locinput - pref_len + pref0_len, PL_colors[3], - (docolor ? "" : "> <"), - PL_colors[0], l, locinput, PL_colors[1], - 15 - l - pref_len + 1, - "", - scan - PL_regprogram, PL_regindent*2, "", - SvPVX(prop)); - } ); - - next = scan + NEXT_OFF(scan); - if (next == scan) - next = NULL; - - switch (OP(scan)) { - case BOL: - if (locinput == PL_bostr - ? PL_regprev == '\n' - : (PL_multiline && - (nextchr || locinput < PL_regeol) && locinput[-1] == '\n') ) - { - /* regtill = regbol; */ - break; - } - sayNO; - case MBOL: - if (locinput == PL_bostr - ? PL_regprev == '\n' - : ((nextchr || locinput < PL_regeol) && locinput[-1] == '\n') ) - { - break; - } - sayNO; - case SBOL: - if (locinput == PL_regbol && PL_regprev == '\n') - break; - sayNO; - case GPOS: - if (locinput == PL_reg_ganch) - break; - sayNO; - case EOL: - if (PL_multiline) - goto meol; - else - goto seol; - case MEOL: - meol: - if ((nextchr || locinput < PL_regeol) && nextchr != '\n') - sayNO; - break; - case SEOL: - seol: - if ((nextchr || locinput < PL_regeol) && nextchr != '\n') - sayNO; - if (PL_regeol - locinput > 1) - sayNO; - break; - case EOS: - if (PL_regeol != locinput) - sayNO; - break; - case SANYUTF8: - if (nextchr & 0x80) { - locinput += PL_utf8skip[nextchr]; - if (locinput > PL_regeol) - sayNO; - nextchr = UCHARAT(locinput); - break; - } - if (!nextchr && locinput >= PL_regeol) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case SANY: - if (!nextchr && locinput >= PL_regeol) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case ANYUTF8: - if (nextchr & 0x80) { - locinput += PL_utf8skip[nextchr]; - if (locinput > PL_regeol) - sayNO; - nextchr = UCHARAT(locinput); - break; - } - if (!nextchr && locinput >= PL_regeol || nextchr == '\n') - sayNO; - nextchr = UCHARAT(++locinput); - break; - case REG_ANY: - if (!nextchr && locinput >= PL_regeol || nextchr == '\n') - sayNO; - nextchr = UCHARAT(++locinput); - break; - case EXACT: - s = (char *) OPERAND(scan); - ln = UCHARAT(s++); - /* Inline the first character, for speed. */ - if (UCHARAT(s) != nextchr) - sayNO; - if (PL_regeol - locinput < ln) - sayNO; - if (ln > 1 && memNE(s, locinput, ln)) - sayNO; - locinput += ln; - nextchr = UCHARAT(locinput); - break; - case EXACTFL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case EXACTF: - s = (char *) OPERAND(scan); - ln = UCHARAT(s++); - - if (UTF) { - char *l = locinput; - char *e = s + ln; - c1 = OP(scan) == EXACTF; - while (s < e) { - if (l >= PL_regeol) - sayNO; - if (utf8_to_uv((U8*)s, 0) != (c1 ? - toLOWER_utf8((U8*)l) : - toLOWER_LC_utf8((U8*)l))) - { - sayNO; - } - s += UTF8SKIP(s); - l += UTF8SKIP(l); - } - locinput = l; - nextchr = UCHARAT(locinput); - break; - } - - /* Inline the first character, for speed. */ - if (UCHARAT(s) != nextchr && - UCHARAT(s) != ((OP(scan) == EXACTF) - ? PL_fold : PL_fold_locale)[nextchr]) - sayNO; - if (PL_regeol - locinput < ln) - sayNO; - if (ln > 1 && (OP(scan) == EXACTF - ? ibcmp(s, locinput, ln) - : ibcmp_locale(s, locinput, ln))) - sayNO; - locinput += ln; - nextchr = UCHARAT(locinput); - break; - case ANYOFUTF8: - s = (char *) OPERAND(scan); - if (!REGINCLASSUTF8(scan, (U8*)locinput)) - sayNO; - if (locinput >= PL_regeol) - sayNO; - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); - break; - case ANYOF: - s = (char *) OPERAND(scan); - if (nextchr < 0) - nextchr = UCHARAT(locinput); - if (!REGINCLASS(s, nextchr)) - sayNO; - if (!nextchr && locinput >= PL_regeol) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case ALNUML: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case ALNUM: - if (!nextchr) - sayNO; - if (!(OP(scan) == ALNUM - ? isALNUM(nextchr) : isALNUM_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case ALNUMLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case ALNUMUTF8: - if (!nextchr) - sayNO; - if (nextchr & 0x80) { - if (!(OP(scan) == ALNUMUTF8 - ? swash_fetch(PL_utf8_alnum, (U8*)locinput) - : isALNUM_LC_utf8((U8*)locinput))) - { - sayNO; - } - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); - break; - } - if (!(OP(scan) == ALNUMUTF8 - ? isALNUM(nextchr) : isALNUM_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NALNUML: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NALNUM: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (OP(scan) == NALNUM - ? isALNUM(nextchr) : isALNUM_LC(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NALNUMLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NALNUMUTF8: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (nextchr & 0x80) { - if (OP(scan) == NALNUMUTF8 - ? swash_fetch(PL_utf8_alnum, (U8*)locinput) - : isALNUM_LC_utf8((U8*)locinput)) - { - sayNO; - } - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); - break; - } - if (OP(scan) == NALNUMUTF8 - ? isALNUM(nextchr) : isALNUM_LC(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case BOUNDL: - case NBOUNDL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case BOUND: - case NBOUND: - /* was last char in word? */ - ln = (locinput != PL_regbol) ? UCHARAT(locinput - 1) : PL_regprev; - if (OP(scan) == BOUND || OP(scan) == NBOUND) { - ln = isALNUM(ln); - n = isALNUM(nextchr); - } - else { - ln = isALNUM_LC(ln); - n = isALNUM_LC(nextchr); - } - if (((!ln) == (!n)) == (OP(scan) == BOUND || OP(scan) == BOUNDL)) - sayNO; - break; - case BOUNDLUTF8: - case NBOUNDLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case BOUNDUTF8: - case NBOUNDUTF8: - /* was last char in word? */ - ln = (locinput != PL_regbol) - ? utf8_to_uv(reghop((U8*)locinput, -1), 0) : PL_regprev; - if (OP(scan) == BOUNDUTF8 || OP(scan) == NBOUNDUTF8) { - ln = isALNUM_uni(ln); - n = swash_fetch(PL_utf8_alnum, (U8*)locinput); - } - else { - ln = isALNUM_LC_uni(ln); - n = isALNUM_LC_utf8((U8*)locinput); - } - if (((!ln) == (!n)) == (OP(scan) == BOUNDUTF8 || OP(scan) == BOUNDLUTF8)) - sayNO; - break; - case SPACEL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case SPACE: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (!(OP(scan) == SPACE - ? isSPACE(nextchr) : isSPACE_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case SPACELUTF8: - 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; - } - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); - break; - } - if (!(OP(scan) == SPACEUTF8 - ? isSPACE(nextchr) : isSPACE_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NSPACEL: - 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); - break; - case NSPACELUTF8: - 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; - } - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); - break; - } - if (OP(scan) == NSPACEUTF8 - ? isSPACE(nextchr) : isSPACE_LC(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case DIGITL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case DIGIT: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (!(OP(scan) == DIGIT - ? isDIGIT(nextchr) : isDIGIT_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case DIGITLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case DIGITUTF8: - if (!nextchr) - 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 (!isDIGIT(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NDIGITL: - 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); - break; - case NDIGITLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NDIGITUTF8: - 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; - case ALNUMCL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case ALNUMC: - if (!nextchr) - sayNO; - if (!(OP(scan) == ALNUMC - ? isALNUMC(nextchr) : isALNUMC_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case ALNUMCLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case ALNUMCUTF8: - if (!nextchr) - sayNO; - if (nextchr & 0x80) { - if (!(OP(scan) == ALNUMCUTF8 - ? swash_fetch(PL_utf8_alnumc, (U8*)locinput) - : isALNUMC_LC_utf8((U8*)locinput))) - { - sayNO; - } - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); - break; + + if (!(SvTYPE(PL_reg_sv) >= SVt_PVMG && SvMAGIC(PL_reg_sv) + && (mg = mg_find(PL_reg_sv, 'g')))) { + /* prepare for quick setting of pos */ + sv_magic(PL_reg_sv, (SV*)0, 'g', Nullch, 0); + mg = mg_find(PL_reg_sv, 'g'); + mg->mg_len = -1; } - if (!(OP(scan) == ALNUMCUTF8 - ? isALNUMC(nextchr) : isALNUMC_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NALNUMCL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NALNUMC: - if (!nextchr) - sayNO; - if (OP(scan) == ALNUMC - ? isALNUMC(nextchr) : isALNUMC_LC(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NALNUMCLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NALNUMCUTF8: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (nextchr & 0x80) { - if (swash_fetch(PL_utf8_alnumc,(U8*)locinput)) - sayNO; - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); + PL_reg_magic = mg; + PL_reg_oldpos = mg->mg_len; + SAVEDESTRUCTOR(restore_pos, 0); + } + if (!PL_reg_curpm) + New(22,PL_reg_curpm, 1, PMOP); + PL_reg_curpm->op_pmregexp = prog; + PL_reg_oldcurpm = PL_curpm; + PL_curpm = PL_reg_curpm; + if (RX_MATCH_COPIED(prog)) { + /* Here is a serious problem: we cannot rewrite subbeg, + since it may be needed if this match fails. Thus + $` inside (?{}) could fail... */ + PL_reg_oldsaved = prog->subbeg; + PL_reg_oldsavedlen = prog->sublen; + RX_MATCH_COPIED_off(prog); + } + else + PL_reg_oldsaved = Nullch; + prog->subbeg = PL_bostr; + prog->sublen = PL_regeol - PL_bostr; /* strend may have been modified */ + } + prog->startp[0] = startpos - PL_bostr; + PL_reginput = startpos; + PL_regstartp = prog->startp; + PL_regendp = prog->endp; + PL_reglastparen = &prog->lastparen; + prog->lastparen = 0; + PL_regsize = 0; + DEBUG_r(PL_reg_starttry = startpos); + if (PL_reg_start_tmpl <= prog->nparens) { + PL_reg_start_tmpl = prog->nparens*3/2 + 3; + if(PL_reg_start_tmp) + Renew(PL_reg_start_tmp, PL_reg_start_tmpl, char*); + else + New(22,PL_reg_start_tmp, PL_reg_start_tmpl, char*); + } + + /* XXXX What this code is doing here?!!! There should be no need + to do this again and again, PL_reglastparen should take care of + this! */ + sp = prog->startp; + ep = prog->endp; + if (prog->nparens) { + for (i = prog->nparens; i >= 1; i--) { + *++sp = -1; + *++ep = -1; + } + } + REGCP_SET; + if (regmatch(prog->program + 1)) { + prog->endp[0] = PL_reginput - PL_bostr; + return 1; + } + REGCP_UNWIND; + return 0; +} + +/* + - regmatch - main matching routine + * + * Conceptually the strategy is simple: check to see whether the current + * node matches, call self recursively to see whether the rest matches, + * and then act accordingly. In practice we make some effort to avoid + * recursion, in particular by going through "ordinary" nodes (that don't + * need to know whether the rest of the match failed) by a loop instead of + * by recursion. + */ +/* [lwall] I've hoisted the register declarations to the outer block in order to + * maybe save a little bit of pushing and popping on the stack. It also takes + * advantage of machines that use a register save mask on subroutine entry. + */ +STATIC I32 /* 0 failure, 1 success */ +S_regmatch(pTHX_ regnode *prog) +{ + dTHR; + register regnode *scan; /* Current node. */ + regnode *next; /* Next node. */ + regnode *inner; /* Next node in internal branch. */ + register I32 nextchr; /* renamed nextchr - nextchar colides with + function of same name */ + register I32 n; /* no or next */ + register I32 ln; /* len or last */ + register char *s; /* operand or save */ + register char *locinput = PL_reginput; + register I32 c1, c2, paren; /* case fold search, parenth */ + int minmod = 0, sw = 0, logical = 0; +#ifdef DEBUGGING + PL_regindent++; +#endif + + /* Note that nextchr is a byte even in UTF */ + nextchr = UCHARAT(locinput); + scan = prog; + while (scan != NULL) { +#define sayNO_L (logical ? (logical = 0, sw = 0, goto cont) : sayNO) +#ifdef DEBUGGING +# define sayYES goto yes +# define sayNO goto no +# define saySAME(x) if (x) goto yes; else goto no +# define REPORT_CODE_OFF 24 +#else +# define sayYES return 1 +# define sayNO return 0 +# define saySAME(x) return x +#endif + DEBUG_r( { + SV *prop = sv_newmortal(); + int docolor = *PL_colors[0]; + int taill = (docolor ? 10 : 7); /* 3 chars for "> <" */ + int l = (PL_regeol - locinput > taill ? taill : PL_regeol - locinput); + /* The part of the string before starttry has one color + (pref0_len chars), between starttry and current + position another one (pref_len - pref0_len chars), + after the current position the third one. + We assume that pref0_len <= pref_len, otherwise we + decrease pref0_len. */ + int pref_len = (locinput - PL_bostr > (5 + taill) - l + ? (5 + taill) - l : locinput - PL_bostr); + int pref0_len = pref_len - (locinput - PL_reg_starttry); + + if (l + pref_len < (5 + taill) && l < PL_regeol - locinput) + l = ( PL_regeol - locinput > (5 + taill) - pref_len + ? (5 + taill) - pref_len : PL_regeol - locinput); + if (pref0_len < 0) + pref0_len = 0; + if (pref0_len > pref_len) + pref0_len = pref_len; + regprop(prop, scan); + PerlIO_printf(Perl_debug_log, + "%4i <%s%.*s%s%s%.*s%s%s%s%.*s%s>%*s|%3d:%*s%s\n", + locinput - PL_bostr, + PL_colors[4], pref0_len, + locinput - pref_len, PL_colors[5], + PL_colors[2], pref_len - pref0_len, + locinput - pref_len + pref0_len, PL_colors[3], + (docolor ? "" : "> <"), + PL_colors[0], l, locinput, PL_colors[1], + 15 - l - pref_len + 1, + "", + scan - PL_regprogram, PL_regindent*2, "", + SvPVX(prop)); + } ); + + next = scan + NEXT_OFF(scan); + if (next == scan) + next = NULL; + + switch (OP(scan)) { + case BOL: + if (locinput == PL_bostr + ? PL_regprev == '\n' + : (PL_multiline && + (nextchr || locinput < PL_regeol) && locinput[-1] == '\n') ) + { + /* regtill = regbol; */ break; } - if (isALNUMC(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case ALPHAL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case ALPHA: - if (!nextchr) - sayNO; - if (!(OP(scan) == ALPHA - ? isALPHA(nextchr) : isALPHA_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case ALPHALUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case ALPHAUTF8: - if (!nextchr) - sayNO; - if (nextchr & 0x80) { - if (!(OP(scan) == ALPHAUTF8 - ? swash_fetch(PL_utf8_alpha, (U8*)locinput) - : isALPHA_LC_utf8((U8*)locinput))) - { - sayNO; - } - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); + sayNO; + case MBOL: + if (locinput == PL_bostr + ? PL_regprev == '\n' + : ((nextchr || locinput < PL_regeol) && locinput[-1] == '\n') ) + { break; } - if (!(OP(scan) == ALPHAUTF8 - ? isALPHA(nextchr) : isALPHA_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NALPHAL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NALPHA: - if (!nextchr) - sayNO; - if (OP(scan) == ALPHA - ? isALPHA(nextchr) : isALPHA_LC(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NALPHALUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NALPHAUTF8: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (nextchr & 0x80) { - if (swash_fetch(PL_utf8_alpha,(U8*)locinput)) - sayNO; - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); + sayNO; + case SBOL: + if (locinput == PL_regbol && PL_regprev == '\n') break; - } - if (isALPHA(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case ASCII: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (!isASCII(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NASCII: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (isASCII(nextchr)) + sayNO; + case GPOS: + if (locinput == PL_reg_ganch) + break; + sayNO; + case EOL: + if (PL_multiline) + goto meol; + else + goto seol; + case MEOL: + meol: + if ((nextchr || locinput < PL_regeol) && nextchr != '\n') sayNO; - nextchr = UCHARAT(++locinput); break; - case CNTRLL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case CNTRL: - if (!nextchr) + case SEOL: + seol: + if ((nextchr || locinput < PL_regeol) && nextchr != '\n') sayNO; - if (!(OP(scan) == CNTRL - ? isCNTRL(nextchr) : isCNTRL_LC(nextchr))) + if (PL_regeol - locinput > 1) sayNO; - nextchr = UCHARAT(++locinput); break; - case CNTRLLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case CNTRLUTF8: - if (!nextchr) + case EOS: + if (PL_regeol != locinput) sayNO; + break; + case SANYUTF8: if (nextchr & 0x80) { - if (!(OP(scan) == CNTRLUTF8 - ? swash_fetch(PL_utf8_cntrl, (U8*)locinput) - : isCNTRL_LC_utf8((U8*)locinput))) - { - sayNO; - } locinput += PL_utf8skip[nextchr]; + if (locinput > PL_regeol) + sayNO; nextchr = UCHARAT(locinput); break; } - if (!(OP(scan) == CNTRLUTF8 - ? isCNTRL(nextchr) : isCNTRL_LC(nextchr))) + if (!nextchr && locinput >= PL_regeol) sayNO; nextchr = UCHARAT(++locinput); break; - case NCNTRLL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NCNTRL: - if (!nextchr) - sayNO; - if (OP(scan) == CNTRL - ? isCNTRL(nextchr) : isCNTRL_LC(nextchr)) + case SANY: + if (!nextchr && locinput >= PL_regeol) sayNO; nextchr = UCHARAT(++locinput); break; - case NCNTRLLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NCNTRLUTF8: - if (!nextchr && locinput >= PL_regeol) - sayNO; + case ANYUTF8: if (nextchr & 0x80) { - if (swash_fetch(PL_utf8_cntrl,(U8*)locinput)) - sayNO; locinput += PL_utf8skip[nextchr]; + if (locinput > PL_regeol) + sayNO; nextchr = UCHARAT(locinput); break; } - if (isCNTRL(nextchr)) + if (!nextchr && locinput >= PL_regeol || nextchr == '\n') sayNO; nextchr = UCHARAT(++locinput); break; - case GRAPHL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case GRAPH: - if (!nextchr) - sayNO; - if (!(OP(scan) == GRAPH - ? isGRAPH(nextchr) : isGRAPH_LC(nextchr))) + case REG_ANY: + if (!nextchr && locinput >= PL_regeol || nextchr == '\n') sayNO; nextchr = UCHARAT(++locinput); break; - case GRAPHLUTF8: + case EXACT: + s = (char *) OPERAND(scan); + ln = UCHARAT(s++); + /* Inline the first character, for speed. */ + if (UCHARAT(s) != nextchr) + sayNO; + if (PL_regeol - locinput < ln) + sayNO; + if (ln > 1 && memNE(s, locinput, ln)) + sayNO; + locinput += ln; + nextchr = UCHARAT(locinput); + break; + case EXACTFL: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case GRAPHUTF8: - if (!nextchr) - sayNO; - if (nextchr & 0x80) { - if (!(OP(scan) == GRAPHUTF8 - ? swash_fetch(PL_utf8_graph, (U8*)locinput) - : isGRAPH_LC_utf8((U8*)locinput))) - { - sayNO; + case EXACTF: + s = (char *) OPERAND(scan); + ln = UCHARAT(s++); + + if (UTF) { + char *l = locinput; + char *e = s + ln; + c1 = OP(scan) == EXACTF; + while (s < e) { + if (l >= PL_regeol) + sayNO; + if (utf8_to_uv((U8*)s, 0) != (c1 ? + toLOWER_utf8((U8*)l) : + toLOWER_LC_utf8((U8*)l))) + { + sayNO; + } + s += UTF8SKIP(s); + l += UTF8SKIP(l); } - locinput += PL_utf8skip[nextchr]; + locinput = l; nextchr = UCHARAT(locinput); break; } - if (!(OP(scan) == GRAPHUTF8 - ? isGRAPH(nextchr) : isGRAPH_LC(nextchr))) + + /* Inline the first character, for speed. */ + if (UCHARAT(s) != nextchr && + UCHARAT(s) != ((OP(scan) == EXACTF) + ? PL_fold : PL_fold_locale)[nextchr]) sayNO; - nextchr = UCHARAT(++locinput); - break; - case NGRAPHL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NGRAPH: - if (!nextchr) + if (PL_regeol - locinput < ln) sayNO; - if (OP(scan) == GRAPH - ? isGRAPH(nextchr) : isGRAPH_LC(nextchr)) + if (ln > 1 && (OP(scan) == EXACTF + ? ibcmp(s, locinput, ln) + : ibcmp_locale(s, locinput, ln))) sayNO; - nextchr = UCHARAT(++locinput); + locinput += ln; + nextchr = UCHARAT(locinput); break; - case NGRAPHLUTF8: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NGRAPHUTF8: - if (!nextchr && locinput >= PL_regeol) + case ANYOFUTF8: + s = (char *) OPERAND(scan); + if (!REGINCLASSUTF8(scan, (U8*)locinput)) sayNO; - if (nextchr & 0x80) { - if (swash_fetch(PL_utf8_graph,(U8*)locinput)) - sayNO; - locinput += PL_utf8skip[nextchr]; + if (locinput >= PL_regeol) + sayNO; + locinput += PL_utf8skip[nextchr]; + nextchr = UCHARAT(locinput); + break; + case ANYOF: + s = (char *) OPERAND(scan); + if (nextchr < 0) nextchr = UCHARAT(locinput); - break; - } - if (isGRAPH(nextchr)) + if (!REGINCLASS(s, nextchr)) + sayNO; + if (!nextchr && locinput >= PL_regeol) sayNO; nextchr = UCHARAT(++locinput); break; - case LOWERL: + case ALNUML: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case LOWER: + case ALNUM: if (!nextchr) sayNO; - if (!(OP(scan) == LOWER - ? isLOWER(nextchr) : isLOWER_LC(nextchr))) + if (!(OP(scan) == ALNUM + ? isALNUM(nextchr) : isALNUM_LC(nextchr))) sayNO; nextchr = UCHARAT(++locinput); break; - case LOWERLUTF8: + case ALNUMLUTF8: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case LOWERUTF8: + case ALNUMUTF8: if (!nextchr) sayNO; if (nextchr & 0x80) { - if (!(OP(scan) == LOWERUTF8 - ? swash_fetch(PL_utf8_lower, (U8*)locinput) - : isLOWER_LC_utf8((U8*)locinput))) + if (!(OP(scan) == ALNUMUTF8 + ? swash_fetch(PL_utf8_alnum, (U8*)locinput) + : isALNUM_LC_utf8((U8*)locinput))) { sayNO; } @@ -2915,121 +1618,137 @@ S_regmatch(pTHX_ regnode *prog) nextchr = UCHARAT(locinput); break; } - if (!(OP(scan) == LOWERUTF8 - ? isLOWER(nextchr) : isLOWER_LC(nextchr))) + if (!(OP(scan) == ALNUMUTF8 + ? isALNUM(nextchr) : isALNUM_LC(nextchr))) sayNO; nextchr = UCHARAT(++locinput); break; - case NLOWERL: + case NALNUML: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case NLOWER: - if (!nextchr) + case NALNUM: + if (!nextchr && locinput >= PL_regeol) sayNO; - if (OP(scan) == LOWER - ? isLOWER(nextchr) : isLOWER_LC(nextchr)) + if (OP(scan) == NALNUM + ? isALNUM(nextchr) : isALNUM_LC(nextchr)) sayNO; nextchr = UCHARAT(++locinput); break; - case NLOWERLUTF8: + case NALNUMLUTF8: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case NLOWERUTF8: + case NALNUMUTF8: if (!nextchr && locinput >= PL_regeol) sayNO; if (nextchr & 0x80) { - if (swash_fetch(PL_utf8_lower,(U8*)locinput)) + if (OP(scan) == NALNUMUTF8 + ? swash_fetch(PL_utf8_alnum, (U8*)locinput) + : isALNUM_LC_utf8((U8*)locinput)) + { sayNO; + } locinput += PL_utf8skip[nextchr]; nextchr = UCHARAT(locinput); break; } - if (isLOWER(nextchr)) + if (OP(scan) == NALNUMUTF8 + ? isALNUM(nextchr) : isALNUM_LC(nextchr)) sayNO; nextchr = UCHARAT(++locinput); break; - case PRINTL: + case BOUNDL: + case NBOUNDL: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case PRINT: - if (!nextchr) - sayNO; - if (!(OP(scan) == PRINT - ? isPRINT(nextchr) : isPRINT_LC(nextchr))) + case BOUND: + case NBOUND: + /* was last char in word? */ + ln = (locinput != PL_regbol) ? UCHARAT(locinput - 1) : PL_regprev; + if (OP(scan) == BOUND || OP(scan) == NBOUND) { + ln = isALNUM(ln); + n = isALNUM(nextchr); + } + else { + ln = isALNUM_LC(ln); + n = isALNUM_LC(nextchr); + } + if (((!ln) == (!n)) == (OP(scan) == BOUND || OP(scan) == BOUNDL)) sayNO; - nextchr = UCHARAT(++locinput); break; - case PRINTLUTF8: + case BOUNDLUTF8: + case NBOUNDLUTF8: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case PRINTUTF8: - if (!nextchr) - sayNO; - if (nextchr & 0x80) { - if (!(OP(scan) == PRINTUTF8 - ? swash_fetch(PL_utf8_print, (U8*)locinput) - : isPRINT_LC_utf8((U8*)locinput))) - { - sayNO; - } - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); - break; + case BOUNDUTF8: + case NBOUNDUTF8: + /* was last char in word? */ + ln = (locinput != PL_regbol) + ? utf8_to_uv(reghop((U8*)locinput, -1), 0) : PL_regprev; + if (OP(scan) == BOUNDUTF8 || OP(scan) == NBOUNDUTF8) { + ln = isALNUM_uni(ln); + n = swash_fetch(PL_utf8_alnum, (U8*)locinput); } - if (!(OP(scan) == PRINTUTF8 - ? isPRINT(nextchr) : isPRINT_LC(nextchr))) + else { + ln = isALNUM_LC_uni(ln); + n = isALNUM_LC_utf8((U8*)locinput); + } + if (((!ln) == (!n)) == (OP(scan) == BOUNDUTF8 || OP(scan) == BOUNDLUTF8)) sayNO; - nextchr = UCHARAT(++locinput); break; - case NPRINTL: + case SPACEL: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case NPRINT: - if (!nextchr) + case SPACE: + if (!nextchr && locinput >= PL_regeol) sayNO; - if (OP(scan) == PRINT - ? isPRINT(nextchr) : isPRINT_LC(nextchr)) + if (!(OP(scan) == SPACE + ? isSPACE(nextchr) : isSPACE_LC(nextchr))) sayNO; nextchr = UCHARAT(++locinput); break; - case NPRINTLUTF8: + case SPACELUTF8: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case NPRINTUTF8: + case SPACEUTF8: if (!nextchr && locinput >= PL_regeol) sayNO; if (nextchr & 0x80) { - if (swash_fetch(PL_utf8_print,(U8*)locinput)) + if (!(OP(scan) == SPACEUTF8 + ? swash_fetch(PL_utf8_space,(U8*)locinput) + : isSPACE_LC_utf8((U8*)locinput))) + { sayNO; + } locinput += PL_utf8skip[nextchr]; nextchr = UCHARAT(locinput); break; } - if (isPRINT(nextchr)) + if (!(OP(scan) == SPACEUTF8 + ? isSPACE(nextchr) : isSPACE_LC(nextchr))) sayNO; nextchr = UCHARAT(++locinput); break; - case PUNCTL: + case NSPACEL: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case PUNCT: + case NSPACE: if (!nextchr) sayNO; - if (!(OP(scan) == PUNCT - ? isPUNCT(nextchr) : isPUNCT_LC(nextchr))) + if (OP(scan) == SPACE + ? isSPACE(nextchr) : isSPACE_LC(nextchr)) sayNO; nextchr = UCHARAT(++locinput); break; - case PUNCTLUTF8: + case NSPACELUTF8: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case PUNCTUTF8: + case NSPACEUTF8: if (!nextchr) sayNO; if (nextchr & 0x80) { - if (!(OP(scan) == PUNCTUTF8 - ? swash_fetch(PL_utf8_punct, (U8*)locinput) - : isPUNCT_LC_utf8((U8*)locinput))) + if (OP(scan) == NSPACEUTF8 + ? swash_fetch(PL_utf8_space,(U8*)locinput) + : isSPACE_LC_utf8((U8*)locinput)) { sayNO; } @@ -3037,60 +1756,32 @@ S_regmatch(pTHX_ regnode *prog) nextchr = UCHARAT(locinput); break; } - if (!(OP(scan) == PUNCTUTF8 - ? isPUNCT(nextchr) : isPUNCT_LC(nextchr))) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NPUNCTL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case NPUNCT: - if (!nextchr) - sayNO; - if (OP(scan) == PUNCT - ? isPUNCT(nextchr) : isPUNCT_LC(nextchr)) + if (OP(scan) == NSPACEUTF8 + ? isSPACE(nextchr) : isSPACE_LC(nextchr)) sayNO; nextchr = UCHARAT(++locinput); break; - case NPUNCTLUTF8: + case DIGITL: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case NPUNCTUTF8: + case DIGIT: if (!nextchr && locinput >= PL_regeol) sayNO; - if (nextchr & 0x80) { - if (swash_fetch(PL_utf8_punct,(U8*)locinput)) - sayNO; - locinput += PL_utf8skip[nextchr]; - nextchr = UCHARAT(locinput); - break; - } - if (isPUNCT(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case UPPERL: - PL_reg_flags |= RF_tainted; - /* FALL THROUGH */ - case UPPER: - if (!nextchr) - sayNO; - if (!(OP(scan) == UPPER - ? isUPPER(nextchr) : isUPPER_LC(nextchr))) + if (!(OP(scan) == DIGIT + ? isDIGIT(nextchr) : isDIGIT_LC(nextchr))) sayNO; nextchr = UCHARAT(++locinput); break; - case UPPERLUTF8: + case DIGITLUTF8: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case UPPERUTF8: + case DIGITUTF8: if (!nextchr) sayNO; if (nextchr & 0x80) { - if (!(OP(scan) == UPPERUTF8 - ? swash_fetch(PL_utf8_upper, (U8*)locinput) - : isUPPER_LC_utf8((U8*)locinput))) + if (OP(scan) == NDIGITUTF8 + ? swash_fetch(PL_utf8_digit,(U8*)locinput) + : isDIGIT_LC_utf8((U8*)locinput)) { sayNO; } @@ -3098,50 +1789,35 @@ S_regmatch(pTHX_ regnode *prog) nextchr = UCHARAT(locinput); break; } - if (!(OP(scan) == UPPERUTF8 - ? isUPPER(nextchr) : isUPPER_LC(nextchr))) + if (!isDIGIT(nextchr)) sayNO; nextchr = UCHARAT(++locinput); break; - case NUPPERL: + case NDIGITL: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case NUPPER: + case NDIGIT: if (!nextchr) sayNO; - if (OP(scan) == UPPER - ? isUPPER(nextchr) : isUPPER_LC(nextchr)) + if (OP(scan) == DIGIT + ? isDIGIT(nextchr) : isDIGIT_LC(nextchr)) sayNO; nextchr = UCHARAT(++locinput); break; - case NUPPERLUTF8: + case NDIGITLUTF8: PL_reg_flags |= RF_tainted; /* FALL THROUGH */ - case NUPPERUTF8: + case NDIGITUTF8: if (!nextchr && locinput >= PL_regeol) sayNO; if (nextchr & 0x80) { - if (swash_fetch(PL_utf8_upper,(U8*)locinput)) + if (swash_fetch(PL_utf8_digit,(U8*)locinput)) sayNO; locinput += PL_utf8skip[nextchr]; nextchr = UCHARAT(locinput); break; } - if (isUPPER(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case XDIGIT: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (!isXDIGIT(nextchr)) - sayNO; - nextchr = UCHARAT(++locinput); - break; - case NXDIGIT: - if (!nextchr && locinput >= PL_regeol) - sayNO; - if (isXDIGIT(nextchr)) + if (isDIGIT(nextchr)) sayNO; nextchr = UCHARAT(++locinput); break; diff --git a/regnodes.h b/regnodes.h index cdc6dd4..c5725cd 100644 --- a/regnodes.h +++ b/regnodes.h @@ -28,129 +28,61 @@ #define ANYOF 22 /* 0x16 Match character in (or not in) this class. */ #define ANYOFUTF8 23 /* 0x17 Match character in (or not in) this class. */ #define ALNUM 24 /* 0x18 Match any alphanumeric character */ -#define ALNUMUTF8 25 /* 0x19 Match any alphanumeric character */ +#define ALNUMUTF8 25 /* 0x19 Match any alphanumeric character in utf8 */ #define ALNUML 26 /* 0x1a Match any alphanumeric char in locale */ -#define ALNUMLUTF8 27 /* 0x1b Match any alphanumeric char in locale */ +#define ALNUMLUTF8 27 /* 0x1b Match any alphanumeric char in locale+utf8 */ #define NALNUM 28 /* 0x1c Match any non-alphanumeric character */ -#define NALNUMUTF8 29 /* 0x1d Match any non-alphanumeric character */ +#define NALNUMUTF8 29 /* 0x1d Match any non-alphanumeric character in utf8 */ #define NALNUML 30 /* 0x1e Match any non-alphanumeric char in locale */ -#define NALNUMLUTF8 31 /* 0x1f Match any non-alphanumeric char in locale */ +#define NALNUMLUTF8 31 /* 0x1f Match any non-alphanumeric char in locale+utf8 */ #define SPACE 32 /* 0x20 Match any whitespace character */ -#define SPACEUTF8 33 /* 0x21 Match any whitespace character */ +#define SPACEUTF8 33 /* 0x21 Match any whitespace character in utf8 */ #define SPACEL 34 /* 0x22 Match any whitespace char in locale */ -#define SPACELUTF8 35 /* 0x23 Match any whitespace char in locale */ +#define SPACELUTF8 35 /* 0x23 Match any whitespace char in locale+utf8 */ #define NSPACE 36 /* 0x24 Match any non-whitespace character */ -#define NSPACEUTF8 37 /* 0x25 Match any non-whitespace character */ +#define NSPACEUTF8 37 /* 0x25 Match any non-whitespace character in utf8 */ #define NSPACEL 38 /* 0x26 Match any non-whitespace char in locale */ -#define NSPACELUTF8 39 /* 0x27 Match any non-whitespace char in locale */ +#define NSPACELUTF8 39 /* 0x27 Match any non-whitespace char in locale+utf8 */ #define DIGIT 40 /* 0x28 Match any numeric character */ -#define DIGITUTF8 41 /* 0x29 Match any numeric character */ +#define DIGITUTF8 41 /* 0x29 Match any numeric character in utf8 */ #define DIGITL 42 /* 0x2a Match any numeric character in locale */ -#define DIGITLUTF8 43 /* 0x2b Match any numeric character in locale */ +#define DIGITLUTF8 43 /* 0x2b Match any numeric character in locale+utf8 */ #define NDIGIT 44 /* 0x2c Match any non-numeric character */ -#define NDIGITUTF8 45 /* 0x2d Match any non-numeric character */ +#define NDIGITUTF8 45 /* 0x2d Match any non-numeric character in utf8 */ #define NDIGITL 46 /* 0x2e Match any non-numeric character in locale */ -#define NDIGITLUTF8 47 /* 0x2f Match any non-numeric character in locale */ -#define ALNUMC 48 /* 0x30 Match any alphanumeric character */ -#define ALNUMCUTF8 49 /* 0x31 Match any alphanumeric character */ -#define ALNUMCL 50 /* 0x32 Match any alphanumeric character in locale */ -#define ALNUMCLUTF8 51 /* 0x33 Match any alphanumeric character in locale */ -#define NALNUMC 52 /* 0x34 Match any non-alphanumeric character */ -#define NALNUMCUTF8 53 /* 0x35 Match any non-alphanumeric character */ -#define NALNUMCL 54 /* 0x36 Match any non-alphanumeric character in locale */ -#define NALNUMCLUTF8 55 /* 0x37 Match any non-alphanumeric character in locale */ -#define ALPHA 56 /* 0x38 Match any alphabetic character */ -#define ALPHAUTF8 57 /* 0x39 Match any alphabetic character */ -#define ALPHAL 58 /* 0x3a Match any alphabetic character in locale */ -#define ALPHALUTF8 59 /* 0x3b Match any alphabetic character in locale */ -#define NALPHA 60 /* 0x3c Match any non-alphabetic character */ -#define NALPHAUTF8 61 /* 0x3d Match any non-alphabetic character */ -#define NALPHAL 62 /* 0x3e Match any non-alphabetic character in locale */ -#define NALPHALUTF8 63 /* 0x3f Match any non-alphabetic character in locale */ -#define ASCII 64 /* 0x40 Match any ASCII character */ -#define NASCII 65 /* 0x41 Match any non-ASCII character */ -#define CNTRL 66 /* 0x42 Match any control character */ -#define CNTRLUTF8 67 /* 0x43 Match any control character */ -#define CNTRLL 68 /* 0x44 Match any control character in locale */ -#define CNTRLLUTF8 69 /* 0x45 Match any control character in locale */ -#define NCNTRL 70 /* 0x46 Match any non-control character */ -#define NCNTRLUTF8 71 /* 0x47 Match any non-control character */ -#define NCNTRLL 72 /* 0x48 Match any non-control character in locale */ -#define NCNTRLLUTF8 73 /* 0x49 Match any non-control character in locale */ -#define GRAPH 74 /* 0x4a Match any graphical character */ -#define GRAPHUTF8 75 /* 0x4b Match any graphical character */ -#define GRAPHL 76 /* 0x4c Match any graphical character in locale */ -#define GRAPHLUTF8 77 /* 0x4d Match any graphical character in locale */ -#define NGRAPH 78 /* 0x4e Match any non-graphical character */ -#define NGRAPHUTF8 79 /* 0x4f Match any non-graphical character */ -#define NGRAPHL 80 /* 0x50 Match any non-graphical character in locale */ -#define NGRAPHLUTF8 81 /* 0x51 Match any non-graphical character in locale */ -#define LOWER 82 /* 0x52 Match any lowercase character */ -#define LOWERUTF8 83 /* 0x53 Match any lowercase character */ -#define LOWERL 84 /* 0x54 Match any lowercase character in locale */ -#define LOWERLUTF8 85 /* 0x55 Match any lowercase character in locale */ -#define NLOWER 86 /* 0x56 Match any non-lowercase character */ -#define NLOWERUTF8 87 /* 0x57 Match any non-lowercase character */ -#define NLOWERL 88 /* 0x58 Match any non-lowercase character in locale */ -#define NLOWERLUTF8 89 /* 0x59 Match any non-lowercase character in locale */ -#define PRINT 90 /* 0x5a Match any printable character */ -#define PRINTUTF8 91 /* 0x5b Match any printable character */ -#define PRINTL 92 /* 0x5c Match any printable character in locale */ -#define PRINTLUTF8 93 /* 0x5d Match any printable character in locale */ -#define NPRINT 94 /* 0x5e Match any non-printable character */ -#define NPRINTUTF8 95 /* 0x5f Match any non-printable character */ -#define NPRINTL 96 /* 0x60 Match any non-printable character in locale */ -#define NPRINTLUTF8 97 /* 0x61 Match any non-printable character in locale */ -#define PUNCT 98 /* 0x62 Match any punctuation character */ -#define PUNCTUTF8 99 /* 0x63 Match any punctuation character */ -#define PUNCTL 100 /* 0x64 Match any punctuation character in locale */ -#define PUNCTLUTF8 101 /* 0x65 Match any punctuation character in locale */ -#define NPUNCT 102 /* 0x66 Match any non-punctuation character */ -#define NPUNCTUTF8 103 /* 0x67 Match any non-punctuation character */ -#define NPUNCTL 104 /* 0x68 Match any non-punctuation character in locale */ -#define NPUNCTLUTF8 105 /* 0x69 Match any non-punctuation character in locale */ -#define UPPER 106 /* 0x6a Match any uppercase character */ -#define UPPERUTF8 107 /* 0x6b Match any uppercase character */ -#define UPPERL 108 /* 0x6c Match any uppercase character in locale */ -#define UPPERLUTF8 109 /* 0x6d Match any uppercase character in locale */ -#define NUPPER 110 /* 0x6e Match any non-uppercase character */ -#define NUPPERUTF8 111 /* 0x6f Match any non-uppercase character */ -#define NUPPERL 112 /* 0x70 Match any non-uppercase character in locale */ -#define NUPPERLUTF8 113 /* 0x71 Match any non-uppercase character in locale */ -#define XDIGIT 114 /* 0x72 Match any hexdigit character */ -#define NXDIGIT 115 /* 0x73 Match any non-hexdigit character */ -#define CLUMP 116 /* 0x74 Match any combining character sequence */ -#define BRANCH 117 /* 0x75 Match this alternative, or the next... */ -#define BACK 118 /* 0x76 Match "", "next" ptr points backward. */ -#define EXACT 119 /* 0x77 Match this string (preceded by length). */ -#define EXACTF 120 /* 0x78 Match this string, folded (prec. by length). */ -#define EXACTFL 121 /* 0x79 Match this string, folded in locale (w/len). */ -#define NOTHING 122 /* 0x7a Match empty string. */ -#define TAIL 123 /* 0x7b Match empty string. Can jump here from outside. */ -#define STAR 124 /* 0x7c Match this (simple) thing 0 or more times. */ -#define PLUS 125 /* 0x7d Match this (simple) thing 1 or more times. */ -#define CURLY 126 /* 0x7e Match this simple thing {n,m} times. */ -#define CURLYN 127 /* 0x7f Match next-after-this simple thing */ -#define CURLYM 128 /* 0x80 Match this medium-complex thing {n,m} times. */ -#define CURLYX 129 /* 0x81 Match this complex thing {n,m} times. */ -#define WHILEM 130 /* 0x82 Do curly processing and see if rest matches. */ -#define OPEN 131 /* 0x83 Mark this point in input as start of #n. */ -#define CLOSE 132 /* 0x84 Analogous to OPEN. */ -#define REF 133 /* 0x85 Match some already matched string */ -#define REFF 134 /* 0x86 Match already matched string, folded */ -#define REFFL 135 /* 0x87 Match already matched string, folded in loc. */ -#define IFMATCH 136 /* 0x88 Succeeds if the following matches. */ -#define UNLESSM 137 /* 0x89 Fails if the following matches. */ -#define SUSPEND 138 /* 0x8a "Independent" sub-RE. */ -#define IFTHEN 139 /* 0x8b Switch, should be preceeded by switcher . */ -#define GROUPP 140 /* 0x8c Whether the group matched. */ -#define LONGJMP 141 /* 0x8d Jump far away. */ -#define BRANCHJ 142 /* 0x8e BRANCH with long offset. */ -#define EVAL 143 /* 0x8f Execute some Perl code. */ -#define MINMOD 144 /* 0x90 Next operator is not greedy. */ -#define LOGICAL 145 /* 0x91 Next opcode should set the flag only. */ -#define RENUM 146 /* 0x92 Group with independently numbered parens. */ -#define OPTIMIZED 147 /* 0x93 Placeholder for dump. */ +#define NDIGITLUTF8 47 /* 0x2f Match any non-numeric character in locale+utf8 */ +#define CLUMP 48 /* 0x30 Match any combining character sequence */ +#define BRANCH 49 /* 0x31 Match this alternative, or the next... */ +#define BACK 50 /* 0x32 Match "", "next" ptr points backward. */ +#define EXACT 51 /* 0x33 Match this string (preceded by length). */ +#define EXACTF 52 /* 0x34 Match this string, folded (prec. by length). */ +#define EXACTFL 53 /* 0x35 Match this string, folded in locale (w/len). */ +#define NOTHING 54 /* 0x36 Match empty string. */ +#define TAIL 55 /* 0x37 Match empty string. Can jump here from outside. */ +#define STAR 56 /* 0x38 Match this (simple) thing 0 or more times. */ +#define PLUS 57 /* 0x39 Match this (simple) thing 1 or more times. */ +#define CURLY 58 /* 0x3a Match this simple thing {n,m} times. */ +#define CURLYN 59 /* 0x3b Match next-after-this simple thing */ +#define CURLYM 60 /* 0x3c Match this medium-complex thing {n,m} times. */ +#define CURLYX 61 /* 0x3d Match this complex thing {n,m} times. */ +#define WHILEM 62 /* 0x3e Do curly processing and see if rest matches. */ +#define OPEN 63 /* 0x3f Mark this point in input as start of #n. */ +#define CLOSE 64 /* 0x40 Analogous to OPEN. */ +#define REF 65 /* 0x41 Match some already matched string */ +#define REFF 66 /* 0x42 Match already matched string, folded */ +#define REFFL 67 /* 0x43 Match already matched string, folded in loc. */ +#define IFMATCH 68 /* 0x44 Succeeds if the following matches. */ +#define UNLESSM 69 /* 0x45 Fails if the following matches. */ +#define SUSPEND 70 /* 0x46 "Independent" sub-RE. */ +#define IFTHEN 71 /* 0x47 Switch, should be preceeded by switcher . */ +#define GROUPP 72 /* 0x48 Whether the group matched. */ +#define LONGJMP 73 /* 0x49 Jump far away. */ +#define BRANCHJ 74 /* 0x4a BRANCH with long offset. */ +#define EVAL 75 /* 0x4b Execute some Perl code. */ +#define MINMOD 76 /* 0x4c Next operator is not greedy. */ +#define LOGICAL 77 /* 0x4d Next opcode should set the flag only. */ +#define RENUM 78 /* 0x4e Group with independently numbered parens. */ +#define OPTIMIZED 79 /* 0x4f Placeholder for dump. */ #ifndef DOINIT EXTCONST U8 PL_regkind[]; @@ -204,74 +136,6 @@ EXTCONST U8 PL_regkind[] = { NDIGIT, /* NDIGITUTF8 */ NDIGIT, /* NDIGITL */ NDIGIT, /* NDIGITLUTF8 */ - ALNUMC, /* ALNUMC */ - ALNUMC, /* ALNUMCUTF8 */ - ALNUMC, /* ALNUMCL */ - ALNUMC, /* ALNUMCLUTF8 */ - NALNUMC, /* NALNUMC */ - NALNUMC, /* NALNUMCUTF8 */ - NALNUMC, /* NALNUMCL */ - NALNUMC, /* NALNUMCLUTF8 */ - ALPHA, /* ALPHA */ - ALPHA, /* ALPHAUTF8 */ - ALPHA, /* ALPHAL */ - ALPHA, /* ALPHALUTF8 */ - NALPHA, /* NALPHA */ - NALPHA, /* NALPHAUTF8 */ - NALPHA, /* NALPHAL */ - NALPHA, /* NALPHALUTF8 */ - ASCII, /* ASCII */ - NASCII, /* NASCII */ - CNTRL, /* CNTRL */ - CNTRL, /* CNTRLUTF8 */ - CNTRL, /* CNTRLL */ - CNTRL, /* CNTRLLUTF8 */ - NCNTRL, /* NCNTRL */ - NCNTRL, /* NCNTRLUTF8 */ - NCNTRL, /* NCNTRLL */ - NCNTRL, /* NCNTRLLUTF8 */ - GRAPH, /* GRAPH */ - GRAPH, /* GRAPHUTF8 */ - GRAPH, /* GRAPHL */ - GRAPH, /* GRAPHLUTF8 */ - NGRAPH, /* NGRAPH */ - NGRAPH, /* NGRAPHUTF8 */ - NGRAPH, /* NGRAPHL */ - NGRAPH, /* NGRAPHLUTF8 */ - LOWER, /* LOWER */ - LOWER, /* LOWERUTF8 */ - LOWER, /* LOWERL */ - LOWER, /* LOWERLUTF8 */ - NLOWER, /* NLOWER */ - NLOWER, /* NLOWERUTF8 */ - NLOWER, /* NLOWERL */ - NLOWER, /* NLOWERLUTF8 */ - PRINT, /* PRINT */ - PRINT, /* PRINTUTF8 */ - PRINT, /* PRINTL */ - PRINT, /* PRINTLUTF8 */ - NPRINT, /* NPRINT */ - NPRINT, /* NPRINTUTF8 */ - NPRINT, /* NPRINTL */ - NPRINT, /* NPRINTLUTF8 */ - PUNCT, /* PUNCT */ - PUNCT, /* PUNCTUTF8 */ - PUNCT, /* PUNCTL */ - PUNCT, /* PUNCTLUTF8 */ - NPUNCT, /* NPUNCT */ - NPUNCT, /* NPUNCTUTF8 */ - NPUNCT, /* NPUNCTL */ - NPUNCT, /* NPUNCTLUTF8 */ - UPPER, /* UPPER */ - UPPER, /* UPPERUTF8 */ - UPPER, /* UPPERL */ - UPPER, /* UPPERLUTF8 */ - NUPPER, /* NUPPER */ - NUPPER, /* NUPPERUTF8 */ - NUPPER, /* NUPPERL */ - NUPPER, /* NUPPERLUTF8 */ - XDIGIT, /* XDIGIT */ - NXDIGIT, /* NXDIGIT */ CLUMP, /* CLUMP */ BRANCH, /* BRANCH */ BACK, /* BACK */ @@ -358,74 +222,6 @@ const static U8 regarglen[] = { 0, /* NDIGITUTF8 */ 0, /* NDIGITL */ 0, /* NDIGITLUTF8 */ - 0, /* ALNUMC */ - 0, /* ALNUMCUTF8 */ - 0, /* ALNUMCL */ - 0, /* ALNUMCLUTF8 */ - 0, /* NALNUMC */ - 0, /* NALNUMCUTF8 */ - 0, /* NALNUMCL */ - 0, /* NALNUMCLUTF8 */ - 0, /* ALPHA */ - 0, /* ALPHAUTF8 */ - 0, /* ALPHAL */ - 0, /* ALPHALUTF8 */ - 0, /* NALPHA */ - 0, /* NALPHAUTF8 */ - 0, /* NALPHAL */ - 0, /* NALPHALUTF8 */ - 0, /* ASCII */ - 0, /* NASCII */ - 0, /* CNTRL */ - 0, /* CNTRLUTF8 */ - 0, /* CNTRLL */ - 0, /* CNTRLLUTF8 */ - 0, /* NCNTRL */ - 0, /* NCNTRLUTF8 */ - 0, /* NCNTRLL */ - 0, /* NCNTRLLUTF8 */ - 0, /* GRAPH */ - 0, /* GRAPHUTF8 */ - 0, /* GRAPHL */ - 0, /* GRAPHLUTF8 */ - 0, /* NGRAPH */ - 0, /* NGRAPHUTF8 */ - 0, /* NGRAPHL */ - 0, /* NGRAPHLUTF8 */ - 0, /* LOWER */ - 0, /* LOWERUTF8 */ - 0, /* LOWERL */ - 0, /* LOWERLUTF8 */ - 0, /* NLOWER */ - 0, /* NLOWERUTF8 */ - 0, /* NLOWERL */ - 0, /* NLOWERLUTF8 */ - 0, /* PRINT */ - 0, /* PRINTUTF8 */ - 0, /* PRINTL */ - 0, /* PRINTLUTF8 */ - 0, /* NPRINT */ - 0, /* NPRINTUTF8 */ - 0, /* NPRINTL */ - 0, /* NPRINTLUTF8 */ - 0, /* PUNCT */ - 0, /* PUNCTUTF8 */ - 0, /* PUNCTL */ - 0, /* PUNCTLUTF8 */ - 0, /* NPUNCT */ - 0, /* NPUNCTUTF8 */ - 0, /* NPUNCTL */ - 0, /* NPUNCTLUTF8 */ - 0, /* UPPER */ - 0, /* UPPERUTF8 */ - 0, /* UPPERL */ - 0, /* UPPERLUTF8 */ - 0, /* NUPPER */ - 0, /* NUPPERUTF8 */ - 0, /* NUPPERL */ - 0, /* NUPPERLUTF8 */ - 0, /* XDIGIT */ - 0, /* NXDIGIT */ 0, /* CLUMP */ 0, /* BRANCH */ 0, /* BACK */ @@ -509,74 +305,6 @@ const static char reg_off_by_arg[] = { 0, /* NDIGITUTF8 */ 0, /* NDIGITL */ 0, /* NDIGITLUTF8 */ - 0, /* ALNUMC */ - 0, /* ALNUMCUTF8 */ - 0, /* ALNUMCL */ - 0, /* ALNUMCLUTF8 */ - 0, /* NALNUMC */ - 0, /* NALNUMCUTF8 */ - 0, /* NALNUMCL */ - 0, /* NALNUMCLUTF8 */ - 0, /* ALPHA */ - 0, /* ALPHAUTF8 */ - 0, /* ALPHAL */ - 0, /* ALPHALUTF8 */ - 0, /* NALPHA */ - 0, /* NALPHAUTF8 */ - 0, /* NALPHAL */ - 0, /* NALPHALUTF8 */ - 0, /* ASCII */ - 0, /* NASCII */ - 0, /* CNTRL */ - 0, /* CNTRLUTF8 */ - 0, /* CNTRLL */ - 0, /* CNTRLLUTF8 */ - 0, /* NCNTRL */ - 0, /* NCNTRLUTF8 */ - 0, /* NCNTRLL */ - 0, /* NCNTRLLUTF8 */ - 0, /* GRAPH */ - 0, /* GRAPHUTF8 */ - 0, /* GRAPHL */ - 0, /* GRAPHLUTF8 */ - 0, /* NGRAPH */ - 0, /* NGRAPHUTF8 */ - 0, /* NGRAPHL */ - 0, /* NGRAPHLUTF8 */ - 0, /* LOWER */ - 0, /* LOWERUTF8 */ - 0, /* LOWERL */ - 0, /* LOWERLUTF8 */ - 0, /* NLOWER */ - 0, /* NLOWERUTF8 */ - 0, /* NLOWERL */ - 0, /* NLOWERLUTF8 */ - 0, /* PRINT */ - 0, /* PRINTUTF8 */ - 0, /* PRINTL */ - 0, /* PRINTLUTF8 */ - 0, /* NPRINT */ - 0, /* NPRINTUTF8 */ - 0, /* NPRINTL */ - 0, /* NPRINTLUTF8 */ - 0, /* PUNCT */ - 0, /* PUNCTUTF8 */ - 0, /* PUNCTL */ - 0, /* PUNCTLUTF8 */ - 0, /* NPUNCT */ - 0, /* NPUNCTUTF8 */ - 0, /* NPUNCTL */ - 0, /* NPUNCTLUTF8 */ - 0, /* UPPER */ - 0, /* UPPERUTF8 */ - 0, /* UPPERL */ - 0, /* UPPERLUTF8 */ - 0, /* NUPPER */ - 0, /* NUPPERUTF8 */ - 0, /* NUPPERL */ - 0, /* NUPPERLUTF8 */ - 0, /* XDIGIT */ - 0, /* NXDIGIT */ 0, /* CLUMP */ 0, /* BRANCH */ 0, /* BACK */ @@ -661,109 +389,41 @@ const static char * const reg_name[] = { "NDIGITUTF8", /* 0x2d */ "NDIGITL", /* 0x2e */ "NDIGITLUTF8", /* 0x2f */ - "ALNUMC", /* 0x30 */ - "ALNUMCUTF8", /* 0x31 */ - "ALNUMCL", /* 0x32 */ - "ALNUMCLUTF8", /* 0x33 */ - "NALNUMC", /* 0x34 */ - "NALNUMCUTF8", /* 0x35 */ - "NALNUMCL", /* 0x36 */ - "NALNUMCLUTF8", /* 0x37 */ - "ALPHA", /* 0x38 */ - "ALPHAUTF8", /* 0x39 */ - "ALPHAL", /* 0x3a */ - "ALPHALUTF8", /* 0x3b */ - "NALPHA", /* 0x3c */ - "NALPHAUTF8", /* 0x3d */ - "NALPHAL", /* 0x3e */ - "NALPHALUTF8", /* 0x3f */ - "ASCII", /* 0x40 */ - "NASCII", /* 0x41 */ - "CNTRL", /* 0x42 */ - "CNTRLUTF8", /* 0x43 */ - "CNTRLL", /* 0x44 */ - "CNTRLLUTF8", /* 0x45 */ - "NCNTRL", /* 0x46 */ - "NCNTRLUTF8", /* 0x47 */ - "NCNTRLL", /* 0x48 */ - "NCNTRLLUTF8", /* 0x49 */ - "GRAPH", /* 0x4a */ - "GRAPHUTF8", /* 0x4b */ - "GRAPHL", /* 0x4c */ - "GRAPHLUTF8", /* 0x4d */ - "NGRAPH", /* 0x4e */ - "NGRAPHUTF8", /* 0x4f */ - "NGRAPHL", /* 0x50 */ - "NGRAPHLUTF8", /* 0x51 */ - "LOWER", /* 0x52 */ - "LOWERUTF8", /* 0x53 */ - "LOWERL", /* 0x54 */ - "LOWERLUTF8", /* 0x55 */ - "NLOWER", /* 0x56 */ - "NLOWERUTF8", /* 0x57 */ - "NLOWERL", /* 0x58 */ - "NLOWERLUTF8", /* 0x59 */ - "PRINT", /* 0x5a */ - "PRINTUTF8", /* 0x5b */ - "PRINTL", /* 0x5c */ - "PRINTLUTF8", /* 0x5d */ - "NPRINT", /* 0x5e */ - "NPRINTUTF8", /* 0x5f */ - "NPRINTL", /* 0x60 */ - "NPRINTLUTF8", /* 0x61 */ - "PUNCT", /* 0x62 */ - "PUNCTUTF8", /* 0x63 */ - "PUNCTL", /* 0x64 */ - "PUNCTLUTF8", /* 0x65 */ - "NPUNCT", /* 0x66 */ - "NPUNCTUTF8", /* 0x67 */ - "NPUNCTL", /* 0x68 */ - "NPUNCTLUTF8", /* 0x69 */ - "UPPER", /* 0x6a */ - "UPPERUTF8", /* 0x6b */ - "UPPERL", /* 0x6c */ - "UPPERLUTF8", /* 0x6d */ - "NUPPER", /* 0x6e */ - "NUPPERUTF8", /* 0x6f */ - "NUPPERL", /* 0x70 */ - "NUPPERLUTF8", /* 0x71 */ - "XDIGIT", /* 0x72 */ - "NXDIGIT", /* 0x73 */ - "CLUMP", /* 0x74 */ - "BRANCH", /* 0x75 */ - "BACK", /* 0x76 */ - "EXACT", /* 0x77 */ - "EXACTF", /* 0x78 */ - "EXACTFL", /* 0x79 */ - "NOTHING", /* 0x7a */ - "TAIL", /* 0x7b */ - "STAR", /* 0x7c */ - "PLUS", /* 0x7d */ - "CURLY", /* 0x7e */ - "CURLYN", /* 0x7f */ - "CURLYM", /* 0x80 */ - "CURLYX", /* 0x81 */ - "WHILEM", /* 0x82 */ - "OPEN", /* 0x83 */ - "CLOSE", /* 0x84 */ - "REF", /* 0x85 */ - "REFF", /* 0x86 */ - "REFFL", /* 0x87 */ - "IFMATCH", /* 0x88 */ - "UNLESSM", /* 0x89 */ - "SUSPEND", /* 0x8a */ - "IFTHEN", /* 0x8b */ - "GROUPP", /* 0x8c */ - "LONGJMP", /* 0x8d */ - "BRANCHJ", /* 0x8e */ - "EVAL", /* 0x8f */ - "MINMOD", /* 0x90 */ - "LOGICAL", /* 0x91 */ - "RENUM", /* 0x92 */ - "OPTIMIZED", /* 0x93 */ + "CLUMP", /* 0x30 */ + "BRANCH", /* 0x31 */ + "BACK", /* 0x32 */ + "EXACT", /* 0x33 */ + "EXACTF", /* 0x34 */ + "EXACTFL", /* 0x35 */ + "NOTHING", /* 0x36 */ + "TAIL", /* 0x37 */ + "STAR", /* 0x38 */ + "PLUS", /* 0x39 */ + "CURLY", /* 0x3a */ + "CURLYN", /* 0x3b */ + "CURLYM", /* 0x3c */ + "CURLYX", /* 0x3d */ + "WHILEM", /* 0x3e */ + "OPEN", /* 0x3f */ + "CLOSE", /* 0x40 */ + "REF", /* 0x41 */ + "REFF", /* 0x42 */ + "REFFL", /* 0x43 */ + "IFMATCH", /* 0x44 */ + "UNLESSM", /* 0x45 */ + "SUSPEND", /* 0x46 */ + "IFTHEN", /* 0x47 */ + "GROUPP", /* 0x48 */ + "LONGJMP", /* 0x49 */ + "BRANCHJ", /* 0x4a */ + "EVAL", /* 0x4b */ + "MINMOD", /* 0x4c */ + "LOGICAL", /* 0x4d */ + "RENUM", /* 0x4e */ + "OPTIMIZED", /* 0x4f */ }; -const static int reg_num = 148; +const static int reg_num = 80; #endif /* DEBUGGING */ #endif /* REG_COMP_C */