/[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 166 by ph10, Wed May 9 14:48:28 2007 UTC revision 167 by ph10, Wed May 9 15:53:54 2007 UTC
# Line 243  static const char *error_texts[] = { Line 243  static const char *error_texts[] = {
243    "repeating a DEFINE group is not allowed",    "repeating a DEFINE group is not allowed",
244    "inconsistent NEWLINE options",    "inconsistent NEWLINE options",
245    "\\g is not followed by an (optionally braced) non-zero number",    "\\g is not followed by an (optionally braced) non-zero number",
246    "(?+ or (?- must be followed by a non-zero number"    "(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number"
247  };  };
248    
249    
# Line 2096  for (;; ptr++) Line 2096  for (;; ptr++)
2096    int class_lastchar;    int class_lastchar;
2097    int newoptions;    int newoptions;
2098    int recno;    int recno;
2099      int refsign;
2100    int skipbytes;    int skipbytes;
2101    int subreqbyte;    int subreqbyte;
2102    int subfirstbyte;    int subfirstbyte;
# Line 3622  for (;; ptr++) Line 3623  for (;; ptr++)
3623    
3624          code[1+LINK_SIZE] = OP_CREF;          code[1+LINK_SIZE] = OP_CREF;
3625          skipbytes = 3;          skipbytes = 3;
3626            refsign = -1;
3627    
3628          /* Check for a test for recursion in a named group. */          /* Check for a test for recursion in a named group. */
3629    
# Line 3645  for (;; ptr++) Line 3647  for (;; ptr++)
3647            terminator = '\'';            terminator = '\'';
3648            ptr++;            ptr++;
3649            }            }
3650          else terminator = 0;          else
3651              {
3652              terminator = 0;
3653              if (ptr[1] == '-' || ptr[1] == '+') refsign = *(++ptr);
3654              }
3655    
3656          /* We now expect to read a name; any thing else is an error */          /* We now expect to read a name; any thing else is an error */
3657    
# Line 3681  for (;; ptr++) Line 3687  for (;; ptr++)
3687          if (lengthptr != NULL) break;          if (lengthptr != NULL) break;
3688    
3689          /* In the real compile we do the work of looking for the actual          /* In the real compile we do the work of looking for the actual
3690          reference. */          reference. If the string started with "+" or "-" we require the rest to
3691            be digits, in which case recno will be set. */
3692    
3693            if (refsign > 0)
3694              {
3695              if (recno <= 0)
3696                {
3697                *errorcodeptr = ERR58;
3698                goto FAILED;
3699                }
3700              if (refsign == '-')
3701                {
3702                recno = cd->bracount - recno + 1;
3703                if (recno <= 0)
3704                  {
3705                  *errorcodeptr = ERR15;
3706                  goto FAILED;
3707                  }
3708                }
3709              else recno += cd->bracount;
3710              PUT2(code, 2+LINK_SIZE, recno);
3711              break;
3712              }
3713    
3714            /* Otherwise (did not start with "+" or "-"), start by looking for the
3715            name. */
3716    
3717          slot = cd->name_table;          slot = cd->name_table;
3718          for (i = 0; i < cd->names_found; i++)          for (i = 0; i < cd->names_found; i++)
3719            {            {
# Line 4005  for (;; ptr++) Line 4036  for (;; ptr++)
4036          case '5': case '6': case '7': case '8': case '9':   /* subroutine */          case '5': case '6': case '7': case '8': case '9':   /* subroutine */
4037            {            {
4038            const uschar *called;            const uschar *called;
           int sign = *ptr;  
4039    
4040            if (sign == '+') ptr++;            if ((refsign = *ptr) == '+') ptr++;
4041            else if (sign == '-')            else if (refsign == '-')
4042              {              {
4043              if ((digitab[ptr[1]] & ctype_digit) == 0)              if ((digitab[ptr[1]] & ctype_digit) == 0)
4044                goto OTHER_CHAR_AFTER_QUERY;                goto OTHER_CHAR_AFTER_QUERY;
# Line 4025  for (;; ptr++) Line 4055  for (;; ptr++)
4055              goto FAILED;              goto FAILED;
4056              }              }
4057    
4058            if (sign == '-')            if (refsign == '-')
4059              {              {
4060              if (recno == 0)              if (recno == 0)
4061                {                {
# Line 4039  for (;; ptr++) Line 4069  for (;; ptr++)
4069                goto FAILED;                goto FAILED;
4070                }                }
4071              }              }
4072            else if (sign == '+')            else if (refsign == '+')
4073              {              {
4074              if (recno == 0)              if (recno == 0)
4075                {                {

Legend:
Removed from v.166  
changed lines
  Added in v.167

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12