/[pcre]/code/trunk/pcre_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_compile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 285 by ph10, Wed Dec 12 17:03:50 2007 UTC revision 286 by ph10, Mon Dec 17 14:46:11 2007 UTC
# Line 1531  for (code = first_significant_code(code Line 1531  for (code = first_significant_code(code
1531    const uschar *ccode;    const uschar *ccode;
1532    
1533    c = *code;    c = *code;
1534    
1535    /* Skip over forward assertions; the other assertions are skipped by    /* Skip over forward assertions; the other assertions are skipped by
1536    first_significant_code() with a TRUE final argument. */    first_significant_code() with a TRUE final argument. */
1537    
1538    if (c == OP_ASSERT)    if (c == OP_ASSERT)
1539      {      {
1540      do code += GET(code, 1); while (*code == OP_ALT);      do code += GET(code, 1); while (*code == OP_ALT);
1541      c = *code;      c = *code;
1542      continue;      continue;
1543      }      }
1544    
1545    /* Groups with zero repeats can of course be empty; skip them. */    /* Groups with zero repeats can of course be empty; skip them. */
1546    
# Line 2396  req_caseopt = ((options & PCRE_CASELESS) Line 2396  req_caseopt = ((options & PCRE_CASELESS)
2396  for (;; ptr++)  for (;; ptr++)
2397    {    {
2398    BOOL negate_class;    BOOL negate_class;
2399    BOOL should_flip_negation;    BOOL should_flip_negation;
2400    BOOL possessive_quantifier;    BOOL possessive_quantifier;
2401    BOOL is_quantifier;    BOOL is_quantifier;
2402    BOOL is_recurse;    BOOL is_recurse;
# Line 2645  for (;; ptr++) Line 2645  for (;; ptr++)
2645        else break;        else break;
2646        }        }
2647    
2648      /* If a class contains a negative special such as \S, we need to flip the      /* If a class contains a negative special such as \S, we need to flip the
2649      negation flag at the end, so that support for characters > 255 works      negation flag at the end, so that support for characters > 255 works
2650      correctly (they are all included in the class). */      correctly (they are all included in the class). */
2651    
2652      should_flip_negation = FALSE;      should_flip_negation = FALSE;
# Line 2723  for (;; ptr++) Line 2723  for (;; ptr++)
2723          if (*ptr == '^')          if (*ptr == '^')
2724            {            {
2725            local_negate = TRUE;            local_negate = TRUE;
2726            should_flip_negation = TRUE;  /* Note negative special */            should_flip_negation = TRUE;  /* Note negative special */
2727            ptr++;            ptr++;
2728            }            }
2729    
# Line 2826  for (;; ptr++) Line 2826  for (;; ptr++)
2826              continue;              continue;
2827    
2828              case ESC_D:              case ESC_D:
2829              should_flip_negation = TRUE;              should_flip_negation = TRUE;
2830              for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_digit];              for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_digit];
2831              continue;              continue;
2832    
# Line 2835  for (;; ptr++) Line 2835  for (;; ptr++)
2835              continue;              continue;
2836    
2837              case ESC_W:              case ESC_W:
2838              should_flip_negation = TRUE;              should_flip_negation = TRUE;
2839              for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_word];              for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_word];
2840              continue;              continue;
2841    
# Line 2845  for (;; ptr++) Line 2845  for (;; ptr++)
2845              continue;              continue;
2846    
2847              case ESC_S:              case ESC_S:
2848              should_flip_negation = TRUE;              should_flip_negation = TRUE;
2849              for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_space];              for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_space];
2850              classbits[1] |= 0x08;    /* Perl 5.004 onwards omits VT from \s */              classbits[1] |= 0x08;    /* Perl 5.004 onwards omits VT from \s */
2851              continue;              continue;
# Line 3348  we set the flag only if there is a liter Line 3348  we set the flag only if there is a liter
3348      zeroreqbyte = reqbyte;      zeroreqbyte = reqbyte;
3349    
3350      /* If there are characters with values > 255, we have to compile an      /* If there are characters with values > 255, we have to compile an
3351      extended class, with its own opcode, unless there was a negated special      extended class, with its own opcode, unless there was a negated special
3352      such as \S in the class, because in that case all characters > 255 are in      such as \S in the class, because in that case all characters > 255 are in
3353      the class, so any that were explicitly given as well can be ignored. If      the class, so any that were explicitly given as well can be ignored. If
3354      (when there are explicit characters > 255 that must be listed) there are no      (when there are explicit characters > 255 that must be listed) there are no
3355      characters < 256, we can omit the bitmap in the actual compiled code. */      characters < 256, we can omit the bitmap in the actual compiled code. */
3356    
# Line 3381  we set the flag only if there is a liter Line 3381  we set the flag only if there is a liter
3381        }        }
3382  #endif  #endif
3383    
3384      /* If there are no characters > 255, set the opcode to OP_CLASS or      /* If there are no characters > 255, set the opcode to OP_CLASS or
3385      OP_NCLASS, depending on whether the whole class was negated and whether      OP_NCLASS, depending on whether the whole class was negated and whether
3386      there were negative specials such as \S in the class. Then copy the 32-byte      there were negative specials such as \S in the class. Then copy the 32-byte
3387      map into the code vector, negating it if necessary. */      map into the code vector, negating it if necessary. */
3388    
3389      *code++ = (negate_class == should_flip_negation) ? OP_CLASS : OP_NCLASS;      *code++ = (negate_class == should_flip_negation) ? OP_CLASS : OP_NCLASS;
3390      if (negate_class)      if (negate_class)
3391        {        {
# Line 4030  we set the flag only if there is a liter Line 4030  we set the flag only if there is a liter
4030        if (*tempcode == OP_EXACT || *tempcode == OP_TYPEEXACT ||        if (*tempcode == OP_EXACT || *tempcode == OP_TYPEEXACT ||
4031            *tempcode == OP_NOTEXACT)            *tempcode == OP_NOTEXACT)
4032          tempcode += _pcre_OP_lengths[*tempcode] +          tempcode += _pcre_OP_lengths[*tempcode] +
4033            ((*tempcode == OP_TYPEEXACT &&            ((*tempcode == OP_TYPEEXACT &&
4034               (tempcode[3] == OP_PROP || tempcode[3] == OP_NOTPROP))? 2:0);               (tempcode[3] == OP_PROP || tempcode[3] == OP_NOTPROP))? 2:0);
4035        len = code - tempcode;        len = code - tempcode;
4036        if (len > 0) switch (*tempcode)        if (len > 0) switch (*tempcode)
4037          {          {
# Line 4258  we set the flag only if there is a liter Line 4258  we set the flag only if there is a liter
4258              *errorcodeptr = ERR58;              *errorcodeptr = ERR58;
4259              goto FAILED;              goto FAILED;
4260              }              }
4261            recno = (refsign == '-')?            recno = (refsign == '-')?
4262              cd->bracount - recno + 1 : recno +cd->bracount;              cd->bracount - recno + 1 : recno +cd->bracount;
4263            if (recno <= 0 || recno > cd->final_bracount)            if (recno <= 0 || recno > cd->final_bracount)
4264              {              {
# Line 4337  we set the flag only if there is a liter Line 4337  we set the flag only if there is a liter
4337            }            }
4338    
4339          /* Check for the "name" actually being a subpattern number. We are          /* Check for the "name" actually being a subpattern number. We are
4340          in the second pass here, so final_bracount is set. */          in the second pass here, so final_bracount is set. */
4341    
4342          else if (recno > 0 && recno <= cd->final_bracount)          else if (recno > 0 && recno <= cd->final_bracount)
4343            {            {
# Line 4551  we set the flag only if there is a liter Line 4551  we set the flag only if there is a liter
4551              {              {
4552              *errorcodeptr = ERR62;              *errorcodeptr = ERR62;
4553              goto FAILED;              goto FAILED;
4554              }              }
4555            if (*ptr != terminator)            if (*ptr != terminator)
4556              {              {
4557              *errorcodeptr = ERR42;              *errorcodeptr = ERR42;
# Line 4565  we set the flag only if there is a liter Line 4565  we set the flag only if there is a liter
4565            recno = 0;            recno = 0;
4566            }            }
4567    
4568          /* In the real compile, seek the name in the table. We check the name          /* In the real compile, seek the name in the table. We check the name
4569          first, and then check that we have reached the end of the name in the          first, and then check that we have reached the end of the name in the
4570          table. That way, if the name that is longer than any in the table,          table. That way, if the name that is longer than any in the table,
4571          the comparison will fail without reading beyond the table entry. */          the comparison will fail without reading beyond the table entry. */
4572    
# Line 4576  we set the flag only if there is a liter Line 4576  we set the flag only if there is a liter
4576            for (i = 0; i < cd->names_found; i++)            for (i = 0; i < cd->names_found; i++)
4577              {              {
4578              if (strncmp((char *)name, (char *)slot+2, namelen) == 0 &&              if (strncmp((char *)name, (char *)slot+2, namelen) == 0 &&
4579                  slot[2+namelen] == 0)                  slot[2+namelen] == 0)
4580                break;                break;
4581              slot += cd->name_entry_size;              slot += cd->name_entry_size;
4582              }              }
# Line 4614  we set the flag only if there is a liter Line 4614  we set the flag only if there is a liter
4614            {            {
4615            const uschar *called;            const uschar *called;
4616    
4617            if ((refsign = *ptr) == '+')            if ((refsign = *ptr) == '+')
4618              {              {
4619              ptr++;              ptr++;
4620              if ((digitab[*ptr] & ctype_digit) == 0)              if ((digitab[*ptr] & ctype_digit) == 0)
4621                {                {
4622                *errorcodeptr = ERR63;                *errorcodeptr = ERR63;
4623                goto FAILED;                goto FAILED;
4624                }                }
4625              }              }
4626            else if (refsign == '-')            else if (refsign == '-')
4627              {              {
4628              if ((digitab[ptr[1]] & ctype_digit) == 0)              if ((digitab[ptr[1]] & ctype_digit) == 0)

Legend:
Removed from v.285  
changed lines
  Added in v.286

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12