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

Diff of /code/trunk/pcre_exec.c

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

revision 219 by ph10, Thu Aug 16 11:46:40 2007 UTC revision 230 by ph10, Mon Sep 10 13:23:56 2007 UTC
# Line 4408  if (re->magic_number != MAGIC_NUMBER) Line 4408  if (re->magic_number != MAGIC_NUMBER)
4408  /* Set up other data */  /* Set up other data */
4409    
4410  anchored = ((re->options | options) & PCRE_ANCHORED) != 0;  anchored = ((re->options | options) & PCRE_ANCHORED) != 0;
4411  startline = (re->options & PCRE_STARTLINE) != 0;  startline = (re->flags & PCRE_STARTLINE) != 0;
4412  firstline = (re->options & PCRE_FIRSTLINE) != 0;  firstline = (re->options & PCRE_FIRSTLINE) != 0;
4413    
4414  /* The code starts after the real_pcre block and the capture name table. */  /* The code starts after the real_pcre block and the capture name table. */
# Line 4438  md->ctypes = tables + ctypes_offset; Line 4438  md->ctypes = tables + ctypes_offset;
4438  /* Handle different types of newline. The three bits give eight cases. If  /* Handle different types of newline. The three bits give eight cases. If
4439  nothing is set at run time, whatever was used at compile time applies. */  nothing is set at run time, whatever was used at compile time applies. */
4440    
4441  switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : (pcre_uint32)options) &  switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options :
4442         PCRE_NEWLINE_BITS)          (pcre_uint32)options) & PCRE_NEWLINE_BITS)
4443    {    {
4444    case 0: newline = NEWLINE; break;   /* Compile-time default */    case 0: newline = NEWLINE; break;   /* Compile-time default */
4445    case PCRE_NEWLINE_CR: newline = '\r'; break;    case PCRE_NEWLINE_CR: newline = '\r'; break;
# Line 4478  else Line 4478  else
4478  /* Partial matching is supported only for a restricted set of regexes at the  /* Partial matching is supported only for a restricted set of regexes at the
4479  moment. */  moment. */
4480    
4481  if (md->partial && (re->options & PCRE_NOPARTIAL) != 0)  if (md->partial && (re->flags & PCRE_NOPARTIAL) != 0)
4482    return PCRE_ERROR_BADPARTIAL;    return PCRE_ERROR_BADPARTIAL;
4483    
4484  /* Check a UTF-8 string if required. Unfortunately there's no way of passing  /* Check a UTF-8 string if required. Unfortunately there's no way of passing
# Line 4555  studied, there may be a bitmap of possib Line 4555  studied, there may be a bitmap of possib
4555    
4556  if (!anchored)  if (!anchored)
4557    {    {
4558    if ((re->options & PCRE_FIRSTSET) != 0)    if ((re->flags & PCRE_FIRSTSET) != 0)
4559      {      {
4560      first_byte = re->first_byte & 255;      first_byte = re->first_byte & 255;
4561      if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)      if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
# Line 4570  if (!anchored) Line 4570  if (!anchored)
4570  /* For anchored or unanchored matches, there may be a "last known required  /* For anchored or unanchored matches, there may be a "last known required
4571  character" set. */  character" set. */
4572    
4573  if ((re->options & PCRE_REQCHSET) != 0)  if ((re->flags & PCRE_REQCHSET) != 0)
4574    {    {
4575    req_byte = re->req_byte & 255;    req_byte = re->req_byte & 255;
4576    req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;    req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
# Line 4785  for(;;) Line 4785  for(;;)
4785    
4786    if (anchored || start_match > end_subject) break;    if (anchored || start_match > end_subject) break;
4787    
4788    /* If we have just passed a CR and the newline option is CRLF or ANY or    /* If we have just passed a CR and we are now at a LF, and the pattern does
4789    ANYCRLF, and we are now at a LF, advance the match position by one more    not contain any explicit matches for \r or \n, and the newline option is CRLF
4790    character. */    or ANY or ANYCRLF, advance the match position by one more character. */
4791    
4792    if (start_match[-1] == '\r' &&    if (start_match[-1] == '\r' &&
4793         (md->nltype == NLTYPE_ANY ||        start_match < end_subject &&
4794          md->nltype == NLTYPE_ANYCRLF ||        *start_match == '\n' &&
4795          md->nllen == 2) &&        (re->flags & PCRE_HASCRORLF) == 0 &&
4796         start_match < end_subject &&          (md->nltype == NLTYPE_ANY ||
4797         *start_match == '\n')           md->nltype == NLTYPE_ANYCRLF ||
4798             md->nllen == 2))
4799      start_match++;      start_match++;
4800    
4801    }   /* End of for(;;) "bumpalong" loop */    }   /* End of for(;;) "bumpalong" loop */

Legend:
Removed from v.219  
changed lines
  Added in v.230

  ViewVC Help
Powered by ViewVC 1.1.5