⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcre_exec.c

📁 SDL文件。SDL_ERROwenjian.....
💻 C
📖 第 1 页 / 共 5 页
字号:
      appropriately and continue from after the call. */      if (md->recursive != NULL && md->recursive->group_num == number)        {        recursion_info *rec = md->recursive;        DPRINTF(("Recursion (%d) succeeded - continuing\n", number));        md->recursive = rec->prevrec;        mstart = rec->save_start;        memcpy(md->offset_vector, rec->offset_save,          rec->saved_max * sizeof(int));        ecode = rec->after_call;        ims = original_ims;        break;        }      }    /* For both capturing and non-capturing groups, reset the value of the ims    flags, in case they got changed during the group. */    ims = original_ims;    DPRINTF(("ims reset to %02lx\n", ims));    /* For a non-repeating ket, just continue at this level. This also    happens for a repeating ket if no characters were matched in the group.    This is the forcible breaking of infinite loops as implemented in Perl    5.005. If there is an options reset, it will get obeyed in the normal    course of events. */    if (*ecode == OP_KET || eptr == saved_eptr)      {      ecode += 1 + LINK_SIZE;      break;      }    /* The repeating kets try the rest of the pattern or restart from the    preceding bracket, in the appropriate order. In the second case, we can use    tail recursion to avoid using another stack frame, unless we have an    unlimited repeat of a group that can match an empty string. */    flags = (*prev >= OP_SBRA)? match_cbegroup : 0;    if (*ecode == OP_KETRMIN)      {      RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM12);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (flags != 0)    /* Could match an empty string */        {        RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM50);        RRETURN(rrc);        }      ecode = prev;      goto TAIL_RECURSE;      }    else  /* OP_KETRMAX */      {      RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM13);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      ecode += 1 + LINK_SIZE;      flags = 0;      goto TAIL_RECURSE;      }    /* Control never gets here */    /* Start of subject unless notbol, or after internal newline if multiline */    case OP_CIRC:    if (md->notbol && eptr == md->start_subject) RRETURN(MATCH_NOMATCH);    if ((ims & PCRE_MULTILINE) != 0)      {      if (eptr != md->start_subject &&          (eptr == md->end_subject || !WAS_NEWLINE(eptr)))        RRETURN(MATCH_NOMATCH);      ecode++;      break;      }    /* ... else fall through */    /* Start of subject assertion */    case OP_SOD:    if (eptr != md->start_subject) RRETURN(MATCH_NOMATCH);    ecode++;    break;    /* Start of match assertion */    case OP_SOM:    if (eptr != md->start_subject + md->start_offset) RRETURN(MATCH_NOMATCH);    ecode++;    break;    /* Reset the start of match point */    case OP_SET_SOM:    mstart = eptr;    ecode++;    break;    /* Assert before internal newline if multiline, or before a terminating    newline unless endonly is set, else end of subject unless noteol is set. */    case OP_DOLL:    if ((ims & PCRE_MULTILINE) != 0)      {      if (eptr < md->end_subject)        { if (!IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); }      else        { if (md->noteol) RRETURN(MATCH_NOMATCH); }      ecode++;      break;      }    else      {      if (md->noteol) RRETURN(MATCH_NOMATCH);      if (!md->endonly)        {        if (eptr != md->end_subject &&            (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))          RRETURN(MATCH_NOMATCH);        ecode++;        break;        }      }    /* ... else fall through for endonly */    /* End of subject assertion (\z) */    case OP_EOD:    if (eptr < md->end_subject) RRETURN(MATCH_NOMATCH);    ecode++;    break;    /* End of subject or ending \n assertion (\Z) */    case OP_EODN:    if (eptr != md->end_subject &&        (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))      RRETURN(MATCH_NOMATCH);    ecode++;    break;    /* Word boundary assertions */    case OP_NOT_WORD_BOUNDARY:    case OP_WORD_BOUNDARY:      {      /* Find out if the previous and current characters are "word" characters.      It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to      be "non-word" characters. */#ifdef SUPPORT_UTF8      if (utf8)        {        if (eptr == md->start_subject) prev_is_word = FALSE; else          {          const uschar *lastptr = eptr - 1;          while((*lastptr & 0xc0) == 0x80) lastptr--;          GETCHAR(c, lastptr);          prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;          }        if (eptr >= md->end_subject) cur_is_word = FALSE; else          {          GETCHAR(c, eptr);          cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;          }        }      else#endif      /* More streamlined when not in UTF-8 mode */        {        prev_is_word = (eptr != md->start_subject) &&          ((md->ctypes[eptr[-1]] & ctype_word) != 0);        cur_is_word = (eptr < md->end_subject) &&          ((md->ctypes[*eptr] & ctype_word) != 0);        }      /* Now see if the situation is what we want */      if ((*ecode++ == OP_WORD_BOUNDARY)?           cur_is_word == prev_is_word : cur_is_word != prev_is_word)        RRETURN(MATCH_NOMATCH);      }    break;    /* Match a single character type; inline for speed */    case OP_ANY:    if ((ims & PCRE_DOTALL) == 0)      {      if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);      }    if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);    if (utf8)      while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;    ecode++;    break;    /* Match a single byte, even in UTF-8 mode. This opcode really does match    any byte, even newline, independent of the setting of PCRE_DOTALL. */    case OP_ANYBYTE:    if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);    ecode++;    break;    case OP_NOT_DIGIT:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    if (#ifdef SUPPORT_UTF8       c < 256 &&#endif       (md->ctypes[c] & ctype_digit) != 0       )      RRETURN(MATCH_NOMATCH);    ecode++;    break;    case OP_DIGIT:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    if (#ifdef SUPPORT_UTF8       c >= 256 ||#endif       (md->ctypes[c] & ctype_digit) == 0       )      RRETURN(MATCH_NOMATCH);    ecode++;    break;    case OP_NOT_WHITESPACE:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    if (#ifdef SUPPORT_UTF8       c < 256 &&#endif       (md->ctypes[c] & ctype_space) != 0       )      RRETURN(MATCH_NOMATCH);    ecode++;    break;    case OP_WHITESPACE:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    if (#ifdef SUPPORT_UTF8       c >= 256 ||#endif       (md->ctypes[c] & ctype_space) == 0       )      RRETURN(MATCH_NOMATCH);    ecode++;    break;    case OP_NOT_WORDCHAR:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    if (#ifdef SUPPORT_UTF8       c < 256 &&#endif       (md->ctypes[c] & ctype_word) != 0       )      RRETURN(MATCH_NOMATCH);    ecode++;    break;    case OP_WORDCHAR:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    if (#ifdef SUPPORT_UTF8       c >= 256 ||#endif       (md->ctypes[c] & ctype_word) == 0       )      RRETURN(MATCH_NOMATCH);    ecode++;    break;    case OP_ANYNL:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    switch(c)      {      default: RRETURN(MATCH_NOMATCH);      case 0x000d:      if (eptr < md->end_subject && *eptr == 0x0a) eptr++;      break;      case 0x000a:      break;      case 0x000b:      case 0x000c:      case 0x0085:      case 0x2028:      case 0x2029:      if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);      break;      }    ecode++;    break;    case OP_NOT_HSPACE:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    switch(c)      {      default: break;      case 0x09:      /* HT */      case 0x20:      /* SPACE */      case 0xa0:      /* NBSP */      case 0x1680:    /* OGHAM SPACE MARK */      case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */      case 0x2000:    /* EN QUAD */      case 0x2001:    /* EM QUAD */      case 0x2002:    /* EN SPACE */      case 0x2003:    /* EM SPACE */      case 0x2004:    /* THREE-PER-EM SPACE */      case 0x2005:    /* FOUR-PER-EM SPACE */      case 0x2006:    /* SIX-PER-EM SPACE */      case 0x2007:    /* FIGURE SPACE */      case 0x2008:    /* PUNCTUATION SPACE */      case 0x2009:    /* THIN SPACE */      case 0x200A:    /* HAIR SPACE */      case 0x202f:    /* NARROW NO-BREAK SPACE */      case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */      case 0x3000:    /* IDEOGRAPHIC SPACE */      RRETURN(MATCH_NOMATCH);      }    ecode++;    break;    case OP_HSPACE:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    switch(c)      {      default: RRETURN(MATCH_NOMATCH);      case 0x09:      /* HT */      case 0x20:      /* SPACE */      case 0xa0:      /* NBSP */      case 0x1680:    /* OGHAM SPACE MARK */      case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */      case 0x2000:    /* EN QUAD */      case 0x2001:    /* EM QUAD */      case 0x2002:    /* EN SPACE */      case 0x2003:    /* EM SPACE */      case 0x2004:    /* THREE-PER-EM SPACE */      case 0x2005:    /* FOUR-PER-EM SPACE */      case 0x2006:    /* SIX-PER-EM SPACE */      case 0x2007:    /* FIGURE SPACE */      case 0x2008:    /* PUNCTUATION SPACE */      case 0x2009:    /* THIN SPACE */      case 0x200A:    /* HAIR SPACE */      case 0x202f:    /* NARROW NO-BREAK SPACE */      case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */      case 0x3000:    /* IDEOGRAPHIC SPACE */      break;      }    ecode++;    break;    case OP_NOT_VSPACE:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    switch(c)      {      default: break;      case 0x0a:      /* LF */      case 0x0b:      /* VT */      case 0x0c:      /* FF */      case 0x0d:      /* CR */      case 0x85:      /* NEL */      case 0x2028:    /* LINE SEPARATOR */      case 0x2029:    /* PARAGRAPH SEPARATOR */      RRETURN(MATCH_NOMATCH);      }    ecode++;    break;    case OP_VSPACE:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);    switch(c)      {      default: RRETURN(MATCH_NOMATCH);      case 0x0a:      /* LF */      case 0x0b:      /* VT */      case 0x0c:      /* FF */      case 0x0d:      /* CR */      case 0x85:      /* NEL */      case 0x2028:    /* LINE SEPARATOR */      case 0x2029:    /* PARAGRAPH SEPARATOR */      break;      }    ecode++;    break;#ifdef SUPPORT_UCP    /* Check the next character by Unicode property. We will get here only    if the support is in the binary; otherwise a compile-time error occurs. */    case OP_PROP:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -