/[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 543 by ph10, Thu Jun 3 19:18:24 2010 UTC revision 544 by ph10, Tue Jun 15 17:20:55 2010 UTC
# Line 1129  dealing with. The very first call may no Line 1129  dealing with. The very first call may no
1129    
1130  if (ptr[0] == CHAR_LEFT_PARENTHESIS)  if (ptr[0] == CHAR_LEFT_PARENTHESIS)
1131    {    {
1132    if (ptr[1] == CHAR_QUESTION_MARK &&    /* Handle specials such as (*SKIP) or (*UTF8) etc. */
1133        ptr[2] == CHAR_VERTICAL_LINE)  
1134      {    if (ptr[1] == CHAR_ASTERISK) ptr += 2;
1135      ptr += 3;  
1136      dup_parens = TRUE;    /* Handle a normal, unnamed capturing parenthesis. */
     }  
1137    
1138    /* Handle a normal, unnamed capturing parenthesis */    else if (ptr[1] != CHAR_QUESTION_MARK)
   
   else if (ptr[1] != CHAR_QUESTION_MARK && ptr[1] != CHAR_ASTERISK)  
1139      {      {
1140      *count += 1;      *count += 1;
1141      if (name == NULL && *count == lorn) return *count;      if (name == NULL && *count == lorn) return *count;
1142      ptr++;      ptr++;
1143      }      }
1144    
1145      /* All cases now have (? at the start. Remember when we are in a group
1146      where the parenthesis numbers are duplicated. */
1147    
1148      else if (ptr[2] == CHAR_VERTICAL_LINE)
1149        {
1150        ptr += 3;
1151        dup_parens = TRUE;
1152        }
1153    
1154      /* Handle comments; all characters are allowed until a ket is reached. */
1155    
1156      else if (ptr[2] == CHAR_NUMBER_SIGN)
1157        {
1158        for (ptr += 3; *ptr != 0; ptr++) if (*ptr == CHAR_RIGHT_PARENTHESIS) break;
1159        goto FAIL_EXIT;
1160        }
1161    
1162    /* Handle a condition. If it is an assertion, just carry on so that it    /* Handle a condition. If it is an assertion, just carry on so that it
1163    is processed as normal. If not, skip to the closing parenthesis of the    is processed as normal. If not, skip to the closing parenthesis of the
1164    condition (there can't be any nested parens. */    condition (there can't be any nested parens). */
1165    
1166    else if (ptr[2] == CHAR_LEFT_PARENTHESIS)    else if (ptr[2] == CHAR_LEFT_PARENTHESIS)
1167      {      {
# Line 1159  if (ptr[0] == CHAR_LEFT_PARENTHESIS) Line 1173  if (ptr[0] == CHAR_LEFT_PARENTHESIS)
1173        }        }
1174      }      }
1175    
1176    /* We have either (? or (* and not a condition */    /* Start with (? but not a condition. */
1177    
1178    else    else
1179      {      {
# Line 1281  for (; *ptr != 0; ptr++) Line 1295  for (; *ptr != 0; ptr++)
1295    else if (*ptr == CHAR_RIGHT_PARENTHESIS)    else if (*ptr == CHAR_RIGHT_PARENTHESIS)
1296      {      {
1297      if (dup_parens && *count < hwm_count) *count = hwm_count;      if (dup_parens && *count < hwm_count) *count = hwm_count;
1298      *ptrptr = ptr;      goto FAIL_EXIT;
     return -1;  
1299      }      }
1300    
1301    else if (*ptr == CHAR_VERTICAL_LINE && dup_parens)    else if (*ptr == CHAR_VERTICAL_LINE && dup_parens)

Legend:
Removed from v.543  
changed lines
  Added in v.544

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12