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

Diff of /code/trunk/pcre_dfa_exec.c

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

revision 904 by ph10, Mon Jan 23 17:30:49 2012 UTC revision 916 by ph10, Wed Feb 15 09:50:53 2012 UTC
# Line 424  BOOL utf = (md->poptions & PCRE_UTF8) != Line 424  BOOL utf = (md->poptions & PCRE_UTF8) !=
424  BOOL utf = FALSE;  BOOL utf = FALSE;
425  #endif  #endif
426    
427    BOOL reset_could_continue = FALSE;
428    
429  rlevel++;  rlevel++;
430  offsetcount &= (-2);  offsetcount &= (-2);
431    
# Line 571  for (;;) Line 573  for (;;)
573    int clen, dlen;    int clen, dlen;
574    unsigned int c, d;    unsigned int c, d;
575    int forced_fail = 0;    int forced_fail = 0;
576    BOOL could_continue = FALSE;    BOOL partial_newline = FALSE;
577      BOOL could_continue = reset_could_continue;
578      reset_could_continue = FALSE;
579    
580    /* Make the new state list into the active state list and empty the    /* Make the new state list into the active state list and empty the
581    new state list. */    new state list. */
582    
# Line 641  for (;;) Line 645  for (;;)
645    
646      /* A negative offset is a special case meaning "hold off going to this      /* A negative offset is a special case meaning "hold off going to this
647      (negated) state until the number of characters in the data field have      (negated) state until the number of characters in the data field have
648      been skipped". */      been skipped". If the could_continue flag was passed over from a previous
649        state, arrange for it to passed on. */
650    
651      if (state_offset < 0)      if (state_offset < 0)
652        {        {
# Line 650  for (;;) Line 655  for (;;)
655          DPRINTF(("%.*sSkipping this character\n", rlevel*2-2, SP));          DPRINTF(("%.*sSkipping this character\n", rlevel*2-2, SP));
656          ADD_NEW_DATA(state_offset, current_state->count,          ADD_NEW_DATA(state_offset, current_state->count,
657            current_state->data - 1);            current_state->data - 1);
658            if (could_continue) reset_could_continue = TRUE;
659          continue;          continue;
660          }          }
661        else        else
# Line 916  for (;;) Line 922  for (;;)
922                 (ptr == end_subject - md->nllen)                 (ptr == end_subject - md->nllen)
923              ))              ))
924            { ADD_ACTIVE(state_offset + 1, 0); }            { ADD_ACTIVE(state_offset + 1, 0); }
925            else if (ptr + 1 >= md->end_subject &&
926                     (md->moptions & (PCRE_PARTIAL_HARD|PCRE_PARTIAL_SOFT)) != 0 &&
927                     NLBLOCK->nltype == NLTYPE_FIXED &&
928                     NLBLOCK->nllen == 2 &&
929                     c == NLBLOCK->nl[0])
930              {
931              if ((md->moptions & PCRE_PARTIAL_HARD) != 0)
932                {
933                reset_could_continue = TRUE;
934                ADD_NEW_DATA(-(state_offset + 1), 0, 1);
935                }
936              else could_continue = partial_newline = TRUE;
937              }
938          }          }
939        break;        break;
940    
# Line 928  for (;;) Line 947  for (;;)
947          else if (clen == 0 ||          else if (clen == 0 ||
948              ((md->poptions & PCRE_DOLLAR_ENDONLY) == 0 && IS_NEWLINE(ptr)))              ((md->poptions & PCRE_DOLLAR_ENDONLY) == 0 && IS_NEWLINE(ptr)))
949            { ADD_ACTIVE(state_offset + 1, 0); }            { ADD_ACTIVE(state_offset + 1, 0); }
950            else if (ptr + 1 >= md->end_subject &&
951                     (md->moptions & (PCRE_PARTIAL_HARD|PCRE_PARTIAL_SOFT)) != 0 &&
952                     NLBLOCK->nltype == NLTYPE_FIXED &&
953                     NLBLOCK->nllen == 2 &&
954                     c == NLBLOCK->nl[0])
955              {
956              if ((md->moptions & PCRE_PARTIAL_HARD) != 0)
957                {
958                reset_could_continue = TRUE;
959                ADD_NEW_DATA(-(state_offset + 1), 0, 1);
960                }
961              else could_continue = partial_newline = TRUE;
962              }
963          }          }
964        else if (IS_NEWLINE(ptr))        else if (IS_NEWLINE(ptr))
965          { ADD_ACTIVE(state_offset + 1, 0); }          { ADD_ACTIVE(state_offset + 1, 0); }
# Line 1824  for (;;) Line 1856  for (;;)
1856            ncount++;            ncount++;
1857            nptr += ndlen;            nptr += ndlen;
1858            }            }
1859            if (nptr >= end_subject && (md->moptions & PCRE_PARTIAL_HARD) != 0)
1860                reset_could_continue = TRUE;
1861          if (++count >= GET2(code, 1))          if (++count >= GET2(code, 1))
1862            { ADD_NEW_DATA(-(state_offset + 2 + IMM2_SIZE), 0, ncount); }            { ADD_NEW_DATA(-(state_offset + 2 + IMM2_SIZE), 0, ncount); }
1863          else          else
# Line 2037  for (;;) Line 2071  for (;;)
2071            ncount++;            ncount++;
2072            nptr += nclen;            nptr += nclen;
2073            }            }
2074            if (nptr >= end_subject && (md->moptions & PCRE_PARTIAL_HARD) != 0)
2075                reset_could_continue = TRUE;
2076          ADD_NEW_DATA(-(state_offset + 1), 0, ncount);          ADD_NEW_DATA(-(state_offset + 1), 0, ncount);
2077          }          }
2078        break;        break;
# Line 2062  for (;;) Line 2098  for (;;)
2098          break;          break;
2099    
2100          case 0x000d:          case 0x000d:
2101          if (ptr + 1 < end_subject && ptr[1] == 0x0a)          if (ptr + 1 >= end_subject)
2102              {
2103              ADD_NEW(state_offset + 1, 0);
2104              if ((md->moptions & PCRE_PARTIAL_HARD) != 0)
2105                reset_could_continue = TRUE;
2106              }
2107            else if (ptr[1] == 0x0a)
2108            {            {
2109            ADD_NEW_DATA(-(state_offset + 1), 0, 1);            ADD_NEW_DATA(-(state_offset + 1), 0, 1);
2110            }            }
2111          else          else
2112            {            {
2113            ADD_NEW(state_offset + 1, 0);            ADD_NEW(state_offset + 1, 0);
2114            }            }
2115          break;          break;
2116          }          }
2117        break;        break;
# Line 2942  for (;;) Line 2984  for (;;)
2984    
2985    The "could_continue" variable is true if a state could have continued but    The "could_continue" variable is true if a state could have continued but
2986    for the fact that the end of the subject was reached. */    for the fact that the end of the subject was reached. */
2987    
2988    if (new_count <= 0)    if (new_count <= 0)
2989      {      {
2990      if (rlevel == 1 &&                               /* Top level, and */      if (rlevel == 1 &&                               /* Top level, and */
# Line 2954  for (;;) Line 2996  for (;;)
2996          ((md->moptions & PCRE_PARTIAL_SOFT) != 0 &&  /* Soft partial and */          ((md->moptions & PCRE_PARTIAL_SOFT) != 0 &&  /* Soft partial and */
2997           match_count < 0)                            /* no matches */           match_count < 0)                            /* no matches */
2998          ) &&                                         /* And... */          ) &&                                         /* And... */
2999          ptr >= end_subject &&                  /* Reached end of subject */          (
3000            ptr >= end_subject ||                  /* Reached end of subject or */
3001            partial_newline                        /* a partial newline */
3002            ) &&
3003          ptr > md->start_used_ptr)              /* Inspected non-empty string */          ptr > md->start_used_ptr)              /* Inspected non-empty string */
3004        {        {
3005        if (offsetcount >= 2)        if (offsetcount >= 2)

Legend:
Removed from v.904  
changed lines
  Added in v.916

  ViewVC Help
Powered by ViewVC 1.1.5