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

📄 pcre_exec.c

📁 SDL文件。SDL_ERROwenjian.....
💻 C
📖 第 1 页 / 共 5 页
字号:
    case OP_NOTPROP:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);      {      int chartype, script;      int category = _pcre_ucp_findprop(c, &chartype, &script);      switch(ecode[1])        {        case PT_ANY:        if (op == OP_NOTPROP) RRETURN(MATCH_NOMATCH);        break;        case PT_LAMP:        if ((chartype == ucp_Lu ||             chartype == ucp_Ll ||             chartype == ucp_Lt) == (op == OP_NOTPROP))          RRETURN(MATCH_NOMATCH);         break;        case PT_GC:        if ((ecode[2] != category) == (op == OP_PROP))          RRETURN(MATCH_NOMATCH);        break;        case PT_PC:        if ((ecode[2] != chartype) == (op == OP_PROP))          RRETURN(MATCH_NOMATCH);        break;        case PT_SC:        if ((ecode[2] != script) == (op == OP_PROP))          RRETURN(MATCH_NOMATCH);        break;        default:        RRETURN(PCRE_ERROR_INTERNAL);        }      ecode += 3;      }    break;    /* Match an extended Unicode sequence. We will get here only if the support    is in the binary; otherwise a compile-time error occurs. */    case OP_EXTUNI:    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);    GETCHARINCTEST(c, eptr);      {      int chartype, script;      int category = _pcre_ucp_findprop(c, &chartype, &script);      if (category == ucp_M) RRETURN(MATCH_NOMATCH);      while (eptr < md->end_subject)        {        int len = 1;        if (!utf8) c = *eptr; else          {          GETCHARLEN(c, eptr, len);          }        category = _pcre_ucp_findprop(c, &chartype, &script);        if (category != ucp_M) break;        eptr += len;        }      }    ecode++;    break;#endif    /* Match a back reference, possibly repeatedly. Look past the end of the    item to see if there is repeat information following. The code is similar    to that for character classes, but repeated for efficiency. Then obey    similar code to character type repeats - written out again for speed.    However, if the referenced string is the empty string, always treat    it as matched, any number of times (otherwise there could be infinite    loops). */    case OP_REF:      {      offset = GET2(ecode, 1) << 1;               /* Doubled ref number */      ecode += 3;                                 /* Advance past item */      /* If the reference is unset, set the length to be longer than the amount      of subject left; this ensures that every attempt at a match fails. We      can't just fail here, because of the possibility of quantifiers with zero      minima. */      length = (offset >= offset_top || md->offset_vector[offset] < 0)?        md->end_subject - eptr + 1 :        md->offset_vector[offset+1] - md->offset_vector[offset];      /* Set up for repetition, or handle the non-repeated case */      switch (*ecode)        {        case OP_CRSTAR:        case OP_CRMINSTAR:        case OP_CRPLUS:        case OP_CRMINPLUS:        case OP_CRQUERY:        case OP_CRMINQUERY:        c = *ecode++ - OP_CRSTAR;        minimize = (c & 1) != 0;        min = rep_min[c];                 /* Pick up values from tables; */        max = rep_max[c];                 /* zero for max => infinity */        if (max == 0) max = INT_MAX;        break;        case OP_CRRANGE:        case OP_CRMINRANGE:        minimize = (*ecode == OP_CRMINRANGE);        min = GET2(ecode, 1);        max = GET2(ecode, 3);        if (max == 0) max = INT_MAX;        ecode += 5;        break;        default:               /* No repeat follows */        if (!match_ref(offset, eptr, length, md, ims)) RRETURN(MATCH_NOMATCH);        eptr += length;        continue;              /* With the main loop */        }      /* If the length of the reference is zero, just continue with the      main loop. */      if (length == 0) continue;      /* First, ensure the minimum number of matches are present. We get back      the length of the reference string explicitly rather than passing the      address of eptr, so that eptr can be a register variable. */      for (i = 1; i <= min; i++)        {        if (!match_ref(offset, eptr, length, md, ims)) RRETURN(MATCH_NOMATCH);        eptr += length;        }      /* If min = max, continue at the same level without recursion.      They are not both allowed to be zero. */      if (min == max) continue;      /* If minimizing, keep trying and advancing the pointer */      if (minimize)        {        for (fi = min;; fi++)          {          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14);          if (rrc != MATCH_NOMATCH) RRETURN(rrc);          if (fi >= max || !match_ref(offset, eptr, length, md, ims))            RRETURN(MATCH_NOMATCH);          eptr += length;          }        /* Control never gets here */        }      /* If maximizing, find the longest string and work backwards */      else        {        pp = eptr;        for (i = min; i < max; i++)          {          if (!match_ref(offset, eptr, length, md, ims)) break;          eptr += length;          }        while (eptr >= pp)          {          RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15);          if (rrc != MATCH_NOMATCH) RRETURN(rrc);          eptr -= length;          }        RRETURN(MATCH_NOMATCH);        }      }    /* Control never gets here */    /* Match a bit-mapped character class, possibly repeatedly. This op code is    used when all the characters in the class have values in the range 0-255,    and either the matching is caseful, or the characters are in the range    0-127 when UTF-8 processing is enabled. The only difference between    OP_CLASS and OP_NCLASS occurs when a data character outside the range is    encountered.    First, look past the end of the item to see if there is repeat information    following. Then obey similar code to character type repeats - written out    again for speed. */    case OP_NCLASS:    case OP_CLASS:      {      data = ecode + 1;                /* Save for matching */      ecode += 33;                     /* Advance past the item */      switch (*ecode)        {        case OP_CRSTAR:        case OP_CRMINSTAR:        case OP_CRPLUS:        case OP_CRMINPLUS:        case OP_CRQUERY:        case OP_CRMINQUERY:        c = *ecode++ - OP_CRSTAR;        minimize = (c & 1) != 0;        min = rep_min[c];                 /* Pick up values from tables; */        max = rep_max[c];                 /* zero for max => infinity */        if (max == 0) max = INT_MAX;        break;        case OP_CRRANGE:        case OP_CRMINRANGE:        minimize = (*ecode == OP_CRMINRANGE);        min = GET2(ecode, 1);        max = GET2(ecode, 3);        if (max == 0) max = INT_MAX;        ecode += 5;        break;        default:               /* No repeat follows */        min = max = 1;        break;        }      /* First, ensure the minimum number of matches are present. */#ifdef SUPPORT_UTF8      /* UTF-8 mode */      if (utf8)        {        for (i = 1; i <= min; i++)          {          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);          GETCHARINC(c, eptr);          if (c > 255)            {            if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);            }          else            {            if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);            }          }        }      else#endif      /* Not UTF-8 mode */        {        for (i = 1; i <= min; i++)          {          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);          c = *eptr++;          if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);          }        }      /* If max == min we can continue with the main loop without the      need to recurse. */      if (min == max) continue;      /* If minimizing, keep testing the rest of the expression and advancing      the pointer while it matches the class. */      if (minimize)        {#ifdef SUPPORT_UTF8        /* UTF-8 mode */        if (utf8)          {          for (fi = min;; fi++)            {            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);            GETCHARINC(c, eptr);            if (c > 255)              {              if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);              }            else              {              if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);              }            }          }        else#endif        /* Not UTF-8 mode */          {          for (fi = min;; fi++)            {            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);            c = *eptr++;            if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);            }          }        /* Control never gets here */        }      /* If maximizing, find the longest possible run, then work backwards. */      else        {        pp = eptr;#ifdef SUPPORT_UTF8        /* UTF-8 mode */        if (utf8)          {          for (i = min; i < max; i++)            {            int len = 1;            if (eptr >= md->end_subject) break;            GETCHARLEN(c, eptr, len);            if (c > 255)              {              if (op == OP_CLASS) break;              }            else              {              if ((data[c/8] & (1 << (c&7))) == 0) break;              }            eptr += len;            }          for (;;)            {            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM18);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (eptr-- == pp) break;        /* Stop if tried at original pos */            BACKCHAR(eptr);            }          }        else#endif          /* Not UTF-8 mode */          {          for (i = min; i < max; i++)            {            if (eptr >= md->end_subject) break;            c = *eptr;            if ((data[c/8] & (1 << (c&7))) == 0) break;            eptr++;            }          while (eptr >= pp)            {            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM19);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            eptr--;            }          }        RRETURN(MATCH_NOMATCH);        }      }    /* Control never gets here */    /* Match an extended character class. This opcode is encountered only    in UTF-8 mode, because that's the only time it is compiled. */#ifdef SUPPORT_UTF8    case OP_XCLASS:      {      data = ecode + 1 + LINK_SIZE;                /* Save for matching */      ecode += GET(ecode, 1);                      /* Advance past the item */      switch (*ecode)        {        case OP_CRSTAR:        case OP_CRMINSTAR:        case OP_CRPLUS:        case OP_CRMINPLUS:        case OP_CRQUERY:        case OP_CRMINQUERY:        c = *ecode++ - OP_CRSTAR;        minimize = (c & 1) != 0;        min = rep_min[c];                 /* Pick up values from tables; */        max = rep_max[c];                 /* zero for max => infinity */        if (max == 0) max = INT_MAX;        break;        case OP_CRRANGE:        case OP_CRMINRANGE:        minimize = (*ecode == OP_CRMINRANGE);        min = GET2(ecode, 1);        max = GET2(ecode, 3);        if (max == 0) max = INT_MAX;        ecode += 5;        break;        default:               /* No repeat follows */        min = max = 1;        break;        }      /* First, ensure the minimum number of matches are present. */      for (i = 1; i <= min; i++)        {        if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);        GETCHARINC(c, eptr);        if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);   

⌨️ 快捷键说明

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