/[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 602 by ph10, Wed May 25 08:29:03 2011 UTC revision 604 by ph10, Thu Jun 2 19:04:54 2011 UTC
# Line 57  possible. There are also some static sup Line 57  possible. There are also some static sup
57  #undef min  #undef min
58  #undef max  #undef max
59    
60  /* Flag bits for the match() function */  /* Values for setting in md->match_function_type to indicate two special types
61    of call to match(). We do it this way to save on using another stack variable,
62    as stack usage is to be discouraged. */
63    
64  #define match_condassert     0x01  /* Called to check a condition assertion */  #define MATCH_CONDASSERT     1  /* Called to check a condition assertion */
65  #define match_cbegroup       0x02  /* Could-be-empty unlimited repeat group */  #define MATCH_CBEGROUP       2  /* Could-be-empty unlimited repeat group */
66    
67  /* Non-error returns from the match() function. Error returns are externally  /* Non-error returns from the match() function. Error returns are externally
68  defined PCRE_ERROR_xxx codes, which are all negative. */  defined PCRE_ERROR_xxx codes, which are all negative. */
# Line 73  negative to avoid the external error cod Line 75  negative to avoid the external error cod
75    
76  #define MATCH_ACCEPT       (-999)  #define MATCH_ACCEPT       (-999)
77  #define MATCH_COMMIT       (-998)  #define MATCH_COMMIT       (-998)
78  #define MATCH_PRUNE        (-997)  #define MATCH_KETRPOS      (-997)
79  #define MATCH_SKIP         (-996)  #define MATCH_PRUNE        (-996)
80  #define MATCH_SKIP_ARG     (-995)  #define MATCH_SKIP         (-995)
81  #define MATCH_THEN         (-994)  #define MATCH_SKIP_ARG     (-994)
82    #define MATCH_THEN         (-993)
83    
84  /* This is a convenience macro for code that occurs many times. */  /* This is a convenience macro for code that occurs many times. */
85    
# Line 273  enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM Line 276  enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM
276         RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,         RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
277         RM41,  RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,         RM41,  RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,
278         RM51,  RM52, RM53, RM54, RM55, RM56, RM57, RM58, RM59, RM60,         RM51,  RM52, RM53, RM54, RM55, RM56, RM57, RM58, RM59, RM60,
279         RM61,  RM62 };         RM61,  RM62, RM63, RM64 };
280    
281  /* These versions of the macros use the stack, as normal. There are debugging  /* These versions of the macros use the stack, as normal. There are debugging
282  versions and production versions. Note that the "rw" argument of RMATCH isn't  versions and production versions. Note that the "rw" argument of RMATCH isn't
# Line 283  actually used in this definition. */ Line 286  actually used in this definition. */
286  #define REGISTER register  #define REGISTER register
287    
288  #ifdef PCRE_DEBUG  #ifdef PCRE_DEBUG
289  #define RMATCH(ra,rb,rc,rd,re,rf,rw) \  #define RMATCH(ra,rb,rc,rd,re,rw) \
290    { \    { \
291    printf("match() called in line %d\n", __LINE__); \    printf("match() called in line %d\n", __LINE__); \
292    rrc = match(ra,rb,mstart,markptr,rc,rd,re,rf,rdepth+1); \    rrc = match(ra,rb,mstart,markptr,rc,rd,re,rdepth+1); \
293    printf("to line %d\n", __LINE__); \    printf("to line %d\n", __LINE__); \
294    }    }
295  #define RRETURN(ra) \  #define RRETURN(ra) \
# Line 295  actually used in this definition. */ Line 298  actually used in this definition. */
298    return ra; \    return ra; \
299    }    }
300  #else  #else
301  #define RMATCH(ra,rb,rc,rd,re,rf,rw) \  #define RMATCH(ra,rb,rc,rd,re,rw) \
302    rrc = match(ra,rb,mstart,markptr,rc,rd,re,rf,rdepth+1)    rrc = match(ra,rb,mstart,markptr,rc,rd,re,rdepth+1)
303  #define RRETURN(ra) return ra  #define RRETURN(ra) return ra
304  #endif  #endif
305    
# Line 309  argument of match(), which never changes Line 312  argument of match(), which never changes
312    
313  #define REGISTER  #define REGISTER
314    
315  #define RMATCH(ra,rb,rc,rd,re,rf,rw)\  #define RMATCH(ra,rb,rc,rd,re,rw)\
316    {\    {\
317    heapframe *newframe = (heapframe *)(pcre_stack_malloc)(sizeof(heapframe));\    heapframe *newframe = (heapframe *)(pcre_stack_malloc)(sizeof(heapframe));\
318    if (newframe == NULL) RRETURN(PCRE_ERROR_NOMEMORY);\    if (newframe == NULL) RRETURN(PCRE_ERROR_NOMEMORY);\
# Line 320  argument of match(), which never changes Line 323  argument of match(), which never changes
323    newframe->Xmarkptr = markptr;\    newframe->Xmarkptr = markptr;\
324    newframe->Xoffset_top = rc;\    newframe->Xoffset_top = rc;\
325    newframe->Xeptrb = re;\    newframe->Xeptrb = re;\
   newframe->Xflags = rf;\  
326    newframe->Xrdepth = frame->Xrdepth + 1;\    newframe->Xrdepth = frame->Xrdepth + 1;\
327    newframe->Xprevframe = frame;\    newframe->Xprevframe = frame;\
328    frame = newframe;\    frame = newframe;\
# Line 357  typedef struct heapframe { Line 359  typedef struct heapframe {
359    USPTR Xmarkptr;    USPTR Xmarkptr;
360    int Xoffset_top;    int Xoffset_top;
361    eptrblock *Xeptrb;    eptrblock *Xeptrb;
   int Xflags;  
362    unsigned int Xrdepth;    unsigned int Xrdepth;
363    
364    /* Function local variables */    /* Function local variables */
# Line 465  Arguments: Line 466  Arguments:
466     md          pointer to "static" info for the match     md          pointer to "static" info for the match
467     eptrb       pointer to chain of blocks containing eptr at start of     eptrb       pointer to chain of blocks containing eptr at start of
468                   brackets - for testing for empty matches                   brackets - for testing for empty matches
    flags       can contain  
                  match_condassert - this is an assertion condition  
                  match_cbegroup - this is the start of an unlimited repeat  
                    group that can match an empty string  
469     rdepth      the recursion depth     rdepth      the recursion depth
470    
471  Returns:       MATCH_MATCH if matched            )  these values are >= 0  Returns:       MATCH_MATCH if matched            )  these values are >= 0
# Line 481  Returns:       MATCH_MATCH if matched Line 478  Returns:       MATCH_MATCH if matched
478  static int  static int
479  match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart,  match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart,
480    const uschar *markptr, int offset_top, match_data *md, eptrblock *eptrb,    const uschar *markptr, int offset_top, match_data *md, eptrblock *eptrb,
481    int flags, unsigned int rdepth)    unsigned int rdepth)
482  {  {
483  /* These variables do not need to be preserved over recursion in this function,  /* These variables do not need to be preserved over recursion in this function,
484  so they can be ordinary variables in all cases. Mark some of them with  so they can be ordinary variables in all cases. Mark some of them with
# Line 514  frame->Xmstart = mstart; Line 511  frame->Xmstart = mstart;
511  frame->Xmarkptr = markptr;  frame->Xmarkptr = markptr;
512  frame->Xoffset_top = offset_top;  frame->Xoffset_top = offset_top;
513  frame->Xeptrb = eptrb;  frame->Xeptrb = eptrb;
 frame->Xflags = flags;  
514  frame->Xrdepth = rdepth;  frame->Xrdepth = rdepth;
515    
516  /* This is where control jumps back to to effect "recursion" */  /* This is where control jumps back to to effect "recursion" */
# Line 529  HEAP_RECURSE: Line 525  HEAP_RECURSE:
525  #define markptr            frame->Xmarkptr  #define markptr            frame->Xmarkptr
526  #define offset_top         frame->Xoffset_top  #define offset_top         frame->Xoffset_top
527  #define eptrb              frame->Xeptrb  #define eptrb              frame->Xeptrb
 #define flags              frame->Xflags  
528  #define rdepth             frame->Xrdepth  #define rdepth             frame->Xrdepth
529    
530  /* Ditto for the local variables */  /* Ditto for the local variables */
# Line 587  i, and fc and c, can be the same variabl Line 582  i, and fc and c, can be the same variabl
582  #define fi i  #define fi i
583  #define fc c  #define fc c
584    
585    /* Many of the following variables are used only in small blocks of the code.
586  #ifdef SUPPORT_UTF8                /* Many of these variables are used only  */  My normal style of coding would have declared them within each of those blocks.
587  const uschar *charptr;             /* in small blocks of the code. My normal */  However, in order to accommodate the version of this code that uses an external
588  #endif                             /* style of coding would have declared    */  "stack" implemented on the heap, it is easier to declare them all here, so the
589  const uschar *callpat;             /* them within each of those blocks.      */  declarations can be cut out in a block. The only declarations within blocks
590  const uschar *data;                /* However, in order to accommodate the   */  below are for variables that do not have to be preserved over a recursive call
591  const uschar *next;                /* version of this code that uses an      */  to RMATCH(). */
592  USPTR         pp;                  /* external "stack" implemented on the    */  
593  const uschar *prev;                /* heap, it is easier to declare them all */  #ifdef SUPPORT_UTF8
594  USPTR         saved_eptr;          /* here, so the declarations can be cut   */  const uschar *charptr;
595                                     /* out in a block. The only declarations  */  #endif
596  recursion_info new_recursive;      /* within blocks below are for variables  */  const uschar *callpat;
597                                     /* that do not have to be preserved over  */  const uschar *data;
598  BOOL cur_is_word;                  /* a recursive call to RMATCH().          */  const uschar *next;
599    USPTR         pp;
600    const uschar *prev;
601    USPTR         saved_eptr;
602    
603    recursion_info new_recursive;
604    
605    BOOL cur_is_word;
606  BOOL condition;  BOOL condition;
607  BOOL prev_is_word;  BOOL prev_is_word;
608    
# Line 630  int stacksave[REC_STACK_SAVE_MAX]; Line 632  int stacksave[REC_STACK_SAVE_MAX];
632  eptrblock newptrb;  eptrblock newptrb;
633  #endif     /* NO_RECURSE */  #endif     /* NO_RECURSE */
634    
635    /* To save space on the stack and in the heap frame, I have doubled up on some
636    of the local variables that are used only in localised parts of the code, but
637    still need to be preserved over recursive calls of match(). These macros define
638    the alternative names that are used. */
639    
640    #define allow_zero    cur_is_word
641    #define cbegroup      condition
642    #define code_offset   codelink
643    #define condassert    condition
644    #define matched_once  prev_is_word
645    
646  /* These statements are here to stop the compiler complaining about unitialized  /* These statements are here to stop the compiler complaining about unitialized
647  variables. */  variables. */
648    
# Line 667  if (md->match_call_count++ >= md->match_ Line 680  if (md->match_call_count++ >= md->match_
680  if (rdepth >= md->match_limit_recursion) RRETURN(PCRE_ERROR_RECURSIONLIMIT);  if (rdepth >= md->match_limit_recursion) RRETURN(PCRE_ERROR_RECURSIONLIMIT);
681    
682  /* At the start of a group with an unlimited repeat that may match an empty  /* At the start of a group with an unlimited repeat that may match an empty
683  string, the match_cbegroup flag is set. When this is the case, add the current  string, the variable md->match_function_type is set to MATCH_CBEGROUP. It is
684  subject pointer to the chain of such remembered pointers, to be checked when we  done this way to save having to use another function argument, which would take
685  hit the closing ket, in order to break infinite loops that match no characters.  up space on the stack. See also MATCH_CONDASSERT below.
686  When match() is called in other circumstances, don't add to the chain. The  
687  match_cbegroup flag must NOT be used with tail recursion, because the memory  When MATCH_CBEGROUP is set, add the current subject pointer to the chain of
688  block that is used is on the stack, so a new one may be required for each  such remembered pointers, to be checked when we hit the closing ket, in order
689  match(). */  to break infinite loops that match no characters. When match() is called in
690    other circumstances, don't add to the chain. The MATCH_CBEGROUP feature must
691    NOT be used with tail recursion, because the memory block that is used is on
692    the stack, so a new one may be required for each match(). */
693    
694  if ((flags & match_cbegroup) != 0)  if (md->match_function_type == MATCH_CBEGROUP)
695    {    {
696    newptrb.epb_saved_eptr = eptr;    newptrb.epb_saved_eptr = eptr;
697    newptrb.epb_prev = eptrb;    newptrb.epb_prev = eptrb;
698    eptrb = &newptrb;    eptrb = &newptrb;
699      md->match_function_type = 0;
700    }    }
701    
702  /* Now start processing the opcodes. */  /* Now start processing the opcodes. */
# Line 688  for (;;) Line 705  for (;;)
705    {    {
706    minimize = possessive = FALSE;    minimize = possessive = FALSE;
707    op = *ecode;    op = *ecode;
708    
709    switch(op)    switch(op)
710      {      {
711      case OP_MARK:      case OP_MARK:
712      markptr = ecode + 2;      markptr = ecode + 2;
713      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
714        eptrb, flags, RM55);        eptrb, RM55);
715    
716      /* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an      /* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an
717      argument, and we must check whether that argument matches this MARK's      argument, and we must check whether that argument matches this MARK's
# Line 720  for (;;) Line 737  for (;;)
737    
738      case OP_COMMIT:      case OP_COMMIT:
739      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
740        eptrb, flags, RM52);        eptrb, RM52);
741      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE &&      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE &&
742          rrc != MATCH_SKIP && rrc != MATCH_SKIP_ARG &&          rrc != MATCH_SKIP && rrc != MATCH_SKIP_ARG &&
743          rrc != MATCH_THEN)          rrc != MATCH_THEN)
# Line 731  for (;;) Line 748  for (;;)
748    
749      case OP_PRUNE:      case OP_PRUNE:
750      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
751        eptrb, flags, RM51);        eptrb, RM51);
752      if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);      if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
753      MRRETURN(MATCH_PRUNE);      MRRETURN(MATCH_PRUNE);
754    
755      case OP_PRUNE_ARG:      case OP_PRUNE_ARG:
756      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
757        eptrb, flags, RM56);        eptrb, RM56);
758      if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);      if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
759      md->mark = ecode + 2;      md->mark = ecode + 2;
760      RRETURN(MATCH_PRUNE);      RRETURN(MATCH_PRUNE);
# Line 746  for (;;) Line 763  for (;;)
763    
764      case OP_SKIP:      case OP_SKIP:
765      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
766        eptrb, flags, RM53);        eptrb, RM53);
767      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)
768        RRETURN(rrc);        RRETURN(rrc);
769      md->start_match_ptr = eptr;   /* Pass back current position */      md->start_match_ptr = eptr;   /* Pass back current position */
# Line 754  for (;;) Line 771  for (;;)
771    
772      case OP_SKIP_ARG:      case OP_SKIP_ARG:
773      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
774        eptrb, flags, RM57);        eptrb, RM57);
775      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)
776        RRETURN(rrc);        RRETURN(rrc);
777    
# Line 773  for (;;) Line 790  for (;;)
790    
791      case OP_THEN:      case OP_THEN:
792      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
793        eptrb, flags, RM54);        eptrb, RM54);
794      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
795      md->start_match_ptr = ecode - GET(ecode, 1);      md->start_match_ptr = ecode - GET(ecode, 1);
796      MRRETURN(MATCH_THEN);      MRRETURN(MATCH_THEN);
797    
798      case OP_THEN_ARG:      case OP_THEN_ARG:
799      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1+LINK_SIZE],      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1+LINK_SIZE],
800        offset_top, md, eptrb, flags, RM58);        offset_top, md, eptrb, RM58);
801      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
802      md->start_match_ptr = ecode - GET(ecode, 1);      md->start_match_ptr = ecode - GET(ecode, 1);
803      md->mark = ecode + LINK_SIZE + 2;      md->mark = ecode + LINK_SIZE + 2;
804      RRETURN(MATCH_THEN);      RRETURN(MATCH_THEN);
805    
806      /* Handle a capturing bracket. If there is space in the offset vector, save      /* Handle a capturing bracket, other than those that are possessive with an
807      the current subject position in the working slot at the top of the vector.      unlimited repeat. If there is space in the offset vector, save the current
808      We mustn't change the current values of the data slot, because they may be      subject position in the working slot at the top of the vector. We mustn't
809      set from a previous iteration of this group, and be referred to by a      change the current values of the data slot, because they may be set from a
810      reference inside the group.      previous iteration of this group, and be referred to by a reference inside
811        the group. If we fail to match, we need to restore this value and also the
     If the bracket fails to match, we need to restore this value and also the  
812      values of the final offsets, in case they were set by a previous iteration      values of the final offsets, in case they were set by a previous iteration
813      of the same bracket.      of the same bracket.
814    
# Line 804  for (;;) Line 820  for (;;)
820      case OP_SCBRA:      case OP_SCBRA:
821      number = GET2(ecode, 1+LINK_SIZE);      number = GET2(ecode, 1+LINK_SIZE);
822      offset = number << 1;      offset = number << 1;
823    
824  #ifdef PCRE_DEBUG  #ifdef PCRE_DEBUG
825      printf("start bracket %d\n", number);      printf("start bracket %d\n", number);
826      printf("subject=");      printf("subject=");
# Line 823  for (;;) Line 839  for (;;)
839        md->offset_vector[md->offset_end - number] =        md->offset_vector[md->offset_end - number] =
840          (int)(eptr - md->start_subject);          (int)(eptr - md->start_subject);
841    
842        flags = (op == OP_SCBRA)? match_cbegroup : 0;        for (;;)
       do  
843          {          {
844          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,          if (op >= OP_SBRA) md->match_function_type = MATCH_CBEGROUP;
845            eptrb, flags, RM1);          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
846              eptrb, RM1);
847          if (rrc != MATCH_NOMATCH &&          if (rrc != MATCH_NOMATCH &&
848              (rrc != MATCH_THEN || md->start_match_ptr != ecode))              (rrc != MATCH_THEN || md->start_match_ptr != ecode))
849            RRETURN(rrc);            RRETURN(rrc);
850          md->capture_last = save_capture_last;          md->capture_last = save_capture_last;
851          ecode += GET(ecode, 1);          ecode += GET(ecode, 1);
852            if (*ecode != OP_ALT) break;
853          }          }
       while (*ecode == OP_ALT);  
854    
855        DPRINTF(("bracket %d failed\n", number));        DPRINTF(("bracket %d failed\n", number));
856    
# Line 857  for (;;) Line 873  for (;;)
873      /* VVVVVVVVVVVVVVVVVVVVVVVVV */      /* VVVVVVVVVVVVVVVVVVVVVVVVV */
874      /* VVVVVVVVVVVVVVVVVVVVVVVVV */      /* VVVVVVVVVVVVVVVVVVVVVVVVV */
875    
876      /* Non-capturing bracket. Loop for all the alternatives. When we get to the      /* Non-capturing bracket, except for possessive with unlimited repeat. Loop
877      final alternative within the brackets, we would return the result of a      for all the alternatives. When we get to the final alternative within the
878      recursive call to match() whatever happened. We can reduce stack usage by      brackets, we would return the result of a recursive call to match()
879      turning this into a tail recursion, except in the case when match_cbegroup      whatever happened. We can reduce stack usage by turning this into a tail
880      is set.*/      recursion, except in the case of a possibly empty group.*/
881    
882      case OP_BRA:      case OP_BRA:
883      case OP_SBRA:      case OP_SBRA:
884      DPRINTF(("start non-capturing bracket\n"));      DPRINTF(("start non-capturing bracket\n"));
     flags = (op >= OP_SBRA)? match_cbegroup : 0;  
885      for (;;)      for (;;)
886        {        {
887        if (ecode[GET(ecode, 1)] != OP_ALT)   /* Final alternative */        if (ecode[GET(ecode, 1)] != OP_ALT)   /* Final alternative */
888          {          {
889          if (flags == 0)    /* Not a possibly empty group */          if (op >= OP_SBRA)   /* Possibly empty group */
890            {            {
891            ecode += _pcre_OP_lengths[*ecode];            md->match_function_type = MATCH_CBEGROUP;
892            DPRINTF(("bracket 0 tail recursion\n"));            RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, eptrb,
893            goto TAIL_RECURSE;              RM48);
894            }            if (rrc == MATCH_NOMATCH) md->mark = markptr;
895              RRETURN(rrc);
896          /* Possibly empty group; can't use tail recursion. */            }
897            /* Not a possibly empty group; use tail recursion */
898          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, eptrb,          ecode += _pcre_OP_lengths[*ecode];
899            flags, RM48);          DPRINTF(("bracket 0 tail recursion\n"));
900          if (rrc == MATCH_NOMATCH) md->mark = markptr;          goto TAIL_RECURSE;
         RRETURN(rrc);  
901          }          }
902    
903        /* For non-final alternatives, continue the loop for a NOMATCH result;        /* For non-final alternatives, continue the loop for a NOMATCH result;
904        otherwise return. */        otherwise return. */
905    
906          if (op >= OP_SBRA) md->match_function_type = MATCH_CBEGROUP;
907        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, eptrb,        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, eptrb,
908          flags, RM2);          RM2);
909        if (rrc != MATCH_NOMATCH &&        if (rrc != MATCH_NOMATCH &&
910            (rrc != MATCH_THEN || md->start_match_ptr != ecode))            (rrc != MATCH_THEN || md->start_match_ptr != ecode))
911          RRETURN(rrc);          RRETURN(rrc);
# Line 898  for (;;) Line 913  for (;;)
913        }        }
914      /* Control never reaches here. */      /* Control never reaches here. */
915    
916        /* Handle possessive capturing brackets with an unlimited repeat. We come
917        here from BRAZERO with allow_zero set TRUE. The offset_vector values are
918        handled similarly to the normal case above. However, the matching is
919        different. The end of these brackets will always be OP_KETRPOS, which
920        returns MATCH_KETRPOS without going further in the pattern. By this means
921        we can handle the group by iteration rather than recursion, thereby
922        reducing the amount of stack needed. */
923    
924        case OP_CBRAPOS:
925        case OP_SCBRAPOS:
926        allow_zero = FALSE;
927    
928        POSSESSIVE_CAPTURE:
929        number = GET2(ecode, 1+LINK_SIZE);
930        offset = number << 1;
931    
932    #ifdef PCRE_DEBUG
933        printf("start possessive bracket %d\n", number);
934        printf("subject=");
935        pchars(eptr, 16, TRUE, md);
936        printf("\n");
937    #endif
938    
939        if (offset < md->offset_max)
940          {
941          matched_once = FALSE;
942          code_offset = ecode - md->start_code;
943    
944          save_offset1 = md->offset_vector[offset];
945          save_offset2 = md->offset_vector[offset+1];
946          save_offset3 = md->offset_vector[md->offset_end - number];
947          save_capture_last = md->capture_last;
948    
949          DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
950    
951          /* Each time round the loop, save the current subject position for use
952          when the group matches. For MATCH_MATCH, the group has matched, so we
953          restart it with a new subject starting position, remembering that we had
954          at least one match. For MATCH_NOMATCH, carry on with the alternatives, as
955          usual. If we haven't matched any alternatives in any iteration, check to
956          see if a previous iteration matched. If so, the group has matched;
957          continue from afterwards. Otherwise it has failed; restore the previous
958          capture values before returning NOMATCH. */
959    
960          for (;;)
961            {
962            md->offset_vector[md->offset_end - number] =
963              (int)(eptr - md->start_subject);
964            if (op >= OP_SBRA) md->match_function_type = MATCH_CBEGROUP;
965            RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
966              eptrb, RM63);
967            if (rrc == MATCH_KETRPOS)
968              {
969              offset_top = md->end_offset_top;
970              eptr = md->end_match_ptr;
971              ecode = md->start_code + code_offset;
972              save_capture_last = md->capture_last;
973              matched_once = TRUE;
974              continue;
975              }
976            if (rrc != MATCH_NOMATCH &&
977                (rrc != MATCH_THEN || md->start_match_ptr != ecode))
978              RRETURN(rrc);
979            md->capture_last = save_capture_last;
980            ecode += GET(ecode, 1);
981            if (*ecode != OP_ALT) break;
982            }
983    
984          if (!matched_once)
985            {
986            md->offset_vector[offset] = save_offset1;
987            md->offset_vector[offset+1] = save_offset2;
988            md->offset_vector[md->offset_end - number] = save_offset3;
989            }
990    
991          if (rrc != MATCH_THEN) md->mark = markptr;
992          if (allow_zero || matched_once)
993            {
994            ecode += 1 + LINK_SIZE;
995            break;
996            }
997    
998          RRETURN(MATCH_NOMATCH);
999          }
1000    
1001        /* FALL THROUGH ... Insufficient room for saving captured contents. Treat
1002        as a non-capturing bracket. */
1003    
1004        /* VVVVVVVVVVVVVVVVVVVVVVVVV */
1005        /* VVVVVVVVVVVVVVVVVVVVVVVVV */
1006    
1007        DPRINTF(("insufficient capture room: treat as non-capturing\n"));
1008    
1009        /* VVVVVVVVVVVVVVVVVVVVVVVVV */
1010        /* VVVVVVVVVVVVVVVVVVVVVVVVV */
1011    
1012        /* Non-capturing possessive bracket with unlimited repeat. We come here
1013        from BRAZERO with allow_zero = TRUE. The code is similar to the above,
1014        without the capturing complication. It is written out separately for speed
1015        and cleanliness. */
1016    
1017        case OP_BRAPOS:
1018        case OP_SBRAPOS:
1019        allow_zero = FALSE;
1020    
1021        POSSESSIVE_NON_CAPTURE:
1022        matched_once = FALSE;
1023        code_offset = ecode - md->start_code;
1024    
1025        for (;;)
1026          {
1027          if (op >= OP_SBRA) md->match_function_type = MATCH_CBEGROUP;
1028          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
1029            eptrb, RM64);
1030          if (rrc == MATCH_KETRPOS)
1031            {
1032            eptr = md->end_match_ptr;
1033            ecode = md->start_code + code_offset;
1034            matched_once = TRUE;
1035            continue;
1036            }
1037          if (rrc != MATCH_NOMATCH &&
1038              (rrc != MATCH_THEN || md->start_match_ptr != ecode))
1039            RRETURN(rrc);
1040          ecode += GET(ecode, 1);
1041          if (*ecode != OP_ALT) break;
1042          }
1043    
1044        if (matched_once || allow_zero)
1045          {
1046          ecode += 1 + LINK_SIZE;
1047          break;
1048          }
1049        RRETURN(MATCH_NOMATCH);
1050    
1051        /* Control never reaches here. */
1052    
1053      /* Conditional group: compilation checked that there are no more than      /* Conditional group: compilation checked that there are no more than
1054      two branches. If the condition is false, skipping the first branch takes us      two branches. If the condition is false, skipping the first branch takes us
1055      past the end if there is only one branch, but that's OK because that is      past the end if there is only one branch, but that's OK because that is
# Line 906  for (;;) Line 1058  for (;;)
1058    
1059      case OP_COND:      case OP_COND:
1060      case OP_SCOND:      case OP_SCOND:
1061      codelink= GET(ecode, 1);      codelink = GET(ecode, 1);
1062    
1063      /* Because of the way auto-callout works during compile, a callout item is      /* Because of the way auto-callout works during compile, a callout item is
1064      inserted between OP_COND and an assertion condition. */      inserted between OP_COND and an assertion condition. */
# Line 1081  for (;;) Line 1233  for (;;)
1233        }        }
1234    
1235      /* The condition is an assertion. Call match() to evaluate it - setting      /* The condition is an assertion. Call match() to evaluate it - setting
1236      the final argument match_condassert causes it to stop at the end of an      md->match_function_type to MATCH_CONDASSERT causes it to stop at the end of
1237      assertion. */      an assertion. */
1238    
1239      else      else
1240        {        {
1241        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL,        md->match_function_type = MATCH_CONDASSERT;
1242            match_condassert, RM3);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, RM3);
1243        if (rrc == MATCH_MATCH)        if (rrc == MATCH_MATCH)
1244          {          {
1245          condition = TRUE;          condition = TRUE;
# Line 1108  for (;;) Line 1260  for (;;)
1260    
1261      /* We are now at the branch that is to be obeyed. As there is only one,      /* We are now at the branch that is to be obeyed. As there is only one,
1262      we can use tail recursion to avoid using another stack frame, except when      we can use tail recursion to avoid using another stack frame, except when
1263      match_cbegroup is required for an unlimited repeat of a possibly empty      we have an unlimited repeat of a possibly empty group. If the second
1264      group. If the second alternative doesn't exist, we can just plough on. */      alternative doesn't exist, we can just plough on. */
1265    
1266      if (condition || *ecode == OP_ALT)      if (condition || *ecode == OP_ALT)
1267        {        {
1268        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
1269        if (op == OP_SCOND)        /* Possibly empty group */        if (op == OP_SCOND)        /* Possibly empty group */
1270          {          {
1271          RMATCH(eptr, ecode, offset_top, md, eptrb, match_cbegroup, RM49);          md->match_function_type = MATCH_CBEGROUP;
1272            RMATCH(eptr, ecode, offset_top, md, eptrb, RM49);
1273          RRETURN(rrc);          RRETURN(rrc);
1274          }          }
1275        else                       /* Group must match something */        else goto TAIL_RECURSE;
         {  
         flags = 0;  
         goto TAIL_RECURSE;  
         }  
1276        }        }
1277      else                         /* Condition false & no alternative */      else                         /* Condition false & no alternative */
1278        {        {
# Line 1201  for (;;) Line 1350  for (;;)
1350      matching won't pass the KET for an assertion. If any one branch matches,      matching won't pass the KET for an assertion. If any one branch matches,
1351      the assertion is true. Lookbehind assertions have an OP_REVERSE item at the      the assertion is true. Lookbehind assertions have an OP_REVERSE item at the
1352      start of each branch to move the current point backwards, so the code at      start of each branch to move the current point backwards, so the code at
1353      this level is identical to the lookahead case. */      this level is identical to the lookahead case. When the assertion is part
1354        of a condition, we want to return immediately afterwards. The caller of
1355        this incarnation of the match() function will have set MATCH_CONDASSERT in
1356        md->match_function type, and one of these opcodes will be the first opcode
1357        that is processed. We use a local variable that is preserved over calls to
1358        match() to remember this case. */
1359    
1360      case OP_ASSERT:      case OP_ASSERT:
1361      case OP_ASSERTBACK:      case OP_ASSERTBACK:
1362        if (md->match_function_type == MATCH_CONDASSERT)
1363          {
1364          condassert = TRUE;
1365          md->match_function_type = 0;
1366          }
1367        else condassert = FALSE;
1368    
1369      do      do
1370        {        {
1371        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, 0,        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, RM4);
         RM4);  
1372        if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)        if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
1373          {          {
1374          mstart = md->start_match_ptr;   /* In case \K reset it */          mstart = md->start_match_ptr;   /* In case \K reset it */
# Line 1220  for (;;) Line 1380  for (;;)
1380        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
1381        }        }
1382      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
1383    
1384      if (*ecode == OP_KET) MRRETURN(MATCH_NOMATCH);      if (*ecode == OP_KET) MRRETURN(MATCH_NOMATCH);
1385    
1386      /* If checking an assertion for a condition, return MATCH_MATCH. */      /* If checking an assertion for a condition, return MATCH_MATCH. */
1387    
1388      if ((flags & match_condassert) != 0) RRETURN(MATCH_MATCH);      if (condassert) RRETURN(MATCH_MATCH);
1389    
1390      /* Continue from after the assertion, updating the offsets high water      /* Continue from after the assertion, updating the offsets high water
1391      mark, since extracts may have been taken during the assertion. */      mark, since extracts may have been taken during the assertion. */
# Line 1240  for (;;) Line 1401  for (;;)
1401    
1402      case OP_ASSERT_NOT:      case OP_ASSERT_NOT:
1403      case OP_ASSERTBACK_NOT:      case OP_ASSERTBACK_NOT:
1404        if (md->match_function_type == MATCH_CONDASSERT)
1405          {
1406          condassert = TRUE;
1407          md->match_function_type = 0;
1408          }
1409        else condassert = FALSE;
1410    
1411      do      do
1412        {        {
1413        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, 0,        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, RM5);
         RM5);  
1414        if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) MRRETURN(MATCH_NOMATCH);        if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) MRRETURN(MATCH_NOMATCH);
1415        if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT)        if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT)
1416          {          {
# Line 1257  for (;;) Line 1424  for (;;)
1424        }        }
1425      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
1426    
1427      if ((flags & match_condassert) != 0) RRETURN(MATCH_MATCH);      if (condassert) RRETURN(MATCH_MATCH);  /* Condition assertion */
1428    
1429      ecode += 1 + LINK_SIZE;      ecode += 1 + LINK_SIZE;
1430      continue;      continue;
1431    
# Line 1376  for (;;) Line 1543  for (;;)
1543        restore the offset and recursion data. */        restore the offset and recursion data. */
1544    
1545        DPRINTF(("Recursing into group %d\n", new_recursive.group_num));        DPRINTF(("Recursing into group %d\n", new_recursive.group_num));
1546        flags = (*callpat >= OP_SBRA)? match_cbegroup : 0;        cbegroup = (*callpat >= OP_SBRA);
1547        do        do
1548          {          {
1549            if (cbegroup) md->match_function_type = MATCH_CBEGROUP;
1550          RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,          RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,
1551            md, eptrb, flags, RM6);            md, eptrb, RM6);
1552          if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)          if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
1553            {            {
1554            DPRINTF(("Recursion matched\n"));            DPRINTF(("Recursion matched\n"));
# Line 1427  for (;;) Line 1595  for (;;)
1595    
1596      do      do
1597        {        {
1598        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, 0, RM7);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM7);
1599        if (rrc == MATCH_MATCH)  /* Note: _not_ MATCH_ACCEPT */        if (rrc == MATCH_MATCH)  /* Note: _not_ MATCH_ACCEPT */
1600          {          {
1601          mstart = md->start_match_ptr;          mstart = md->start_match_ptr;
# Line 1470  for (;;) Line 1638  for (;;)
1638    
1639      if (*ecode == OP_KETRMIN)      if (*ecode == OP_KETRMIN)
1640        {        {
1641        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, 0, RM8);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM8);
1642        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1643        ecode = prev;        ecode = prev;
       flags = 0;  
1644        goto TAIL_RECURSE;        goto TAIL_RECURSE;
1645        }        }
1646      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
1647        {        {
1648        RMATCH(eptr, prev, offset_top, md, eptrb, match_cbegroup, RM9);        md->match_function_type = MATCH_CBEGROUP;
1649          RMATCH(eptr, prev, offset_top, md, eptrb, RM9);
1650        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1651        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
       flags = 0;  
1652        goto TAIL_RECURSE;        goto TAIL_RECURSE;
1653        }        }
1654      /* Control never gets here */      /* Control never gets here */
# Line 1498  for (;;) Line 1665  for (;;)
1665      at all - i.e. it could be ()* or ()? or even (){0} in the pattern. Brackets      at all - i.e. it could be ()* or ()? or even (){0} in the pattern. Brackets
1666      with fixed upper repeat limits are compiled as a number of copies, with the      with fixed upper repeat limits are compiled as a number of copies, with the
1667      optional ones preceded by BRAZERO or BRAMINZERO. */      optional ones preceded by BRAZERO or BRAMINZERO. */
1668    
1669      case OP_BRAZERO:      case OP_BRAZERO:
1670        {      next = ecode + 1;
1671        next = ecode+1;      RMATCH(eptr, next, offset_top, md, eptrb, RM10);
1672        RMATCH(eptr, next, offset_top, md, eptrb, 0, RM10);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1673        if (rrc != MATCH_NOMATCH) RRETURN(rrc);      do next += GET(next, 1); while (*next == OP_ALT);
1674        do next += GET(next,1); while (*next == OP_ALT);      ecode = next + 1 + LINK_SIZE;
       ecode = next + 1 + LINK_SIZE;  
       }  
1675      break;      break;
1676    
1677      case OP_BRAMINZERO:      case OP_BRAMINZERO:
1678        {      next = ecode + 1;
1679        next = ecode+1;      do next += GET(next, 1); while (*next == OP_ALT);
1680        do next += GET(next, 1); while (*next == OP_ALT);      RMATCH(eptr, next + 1+LINK_SIZE, offset_top, md, eptrb, RM11);
1681        RMATCH(eptr, next + 1+LINK_SIZE, offset_top, md, eptrb, 0, RM11);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1682        if (rrc != MATCH_NOMATCH) RRETURN(rrc);      ecode++;
       ecode++;  
       }  
1683      break;      break;
1684    
1685      case OP_SKIPZERO:      case OP_SKIPZERO:
1686        {      next = ecode+1;
1687        next = ecode+1;      do next += GET(next,1); while (*next == OP_ALT);
1688        do next += GET(next,1); while (*next == OP_ALT);      ecode = next + 1 + LINK_SIZE;
       ecode = next + 1 + LINK_SIZE;  
       }  
1689      break;      break;
1690    
1691        /* BRAPOSZERO occurs before a possessive bracket group. Don't do anything
1692        here; just jump to the group, with allow_zero set TRUE. */
1693    
1694        case OP_BRAPOSZERO:
1695        op = *(++ecode);
1696        allow_zero = TRUE;
1697        if (op == OP_CBRAPOS || op == OP_SCBRAPOS) goto POSSESSIVE_CAPTURE;
1698          goto POSSESSIVE_NON_CAPTURE;
1699    
1700      /* End of a group, repeated or non-repeating. */      /* End of a group, repeated or non-repeating. */
1701    
1702      case OP_KET:      case OP_KET:
1703      case OP_KETRMIN:      case OP_KETRMIN:
1704      case OP_KETRMAX:      case OP_KETRMAX:
1705        case OP_KETRPOS:
1706      prev = ecode - GET(ecode, 1);      prev = ecode - GET(ecode, 1);
1707    
1708      /* If this was a group that remembered the subject start, in order to break      /* If this was a group that remembered the subject start, in order to break
# Line 1566  for (;;) Line 1737  for (;;)
1737      a recurse into group 0, so it won't be picked up here. Instead, we catch it      a recurse into group 0, so it won't be picked up here. Instead, we catch it
1738      when the OP_END is reached. Other recursion is handled here. */      when the OP_END is reached. Other recursion is handled here. */
1739    
1740      if (*prev == OP_CBRA || *prev == OP_SCBRA)      if (*prev == OP_CBRA || *prev == OP_SCBRA ||
1741            *prev == OP_CBRAPOS || *prev == OP_SCBRAPOS)
1742        {        {
1743        number = GET2(prev, 1+LINK_SIZE);        number = GET2(prev, 1+LINK_SIZE);
1744        offset = number << 1;        offset = number << 1;
# Line 1612  for (;;) Line 1784  for (;;)
1784        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
1785        break;        break;
1786        }        }
1787    
1788      /* The repeating kets try the rest of the pattern or restart from the      /* OP_KETRPOS is a possessive repeating ket. Remember the current position,
1789      preceding bracket, in the appropriate order. In the second case, we can use      and return the MATCH_KETRPOS. This makes it possible to do the repeats one
1790      tail recursion to avoid using another stack frame, unless we have an      at a time from the outer level, thus saving stack. */
1791    
1792        if (*ecode == OP_KETRPOS)
1793          {
1794          md->end_match_ptr = eptr;
1795          md->end_offset_top = offset_top;
1796          RRETURN(MATCH_KETRPOS);
1797          }
1798    
1799        /* The normal repeating kets try the rest of the pattern or restart from
1800        the preceding bracket, in the appropriate order. In the second case, we can
1801        use tail recursion to avoid using another stack frame, unless we have an
1802      unlimited repeat of a group that can match an empty string. */      unlimited repeat of a group that can match an empty string. */
1803    
     flags = (*prev >= OP_SBRA)? match_cbegroup : 0;  
   
1804      if (*ecode == OP_KETRMIN)      if (*ecode == OP_KETRMIN)
1805        {        {
1806        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, 0, RM12);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM12);
1807        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1808        if (flags != 0)    /* Could match an empty string */        if (*prev >= OP_SBRA)    /* Could match an empty string */
1809          {          {
1810          RMATCH(eptr, prev, offset_top, md, eptrb, flags, RM50);          md->match_function_type = MATCH_CBEGROUP;
1811            RMATCH(eptr, prev, offset_top, md, eptrb, RM50);
1812          RRETURN(rrc);          RRETURN(rrc);
1813          }          }
1814        ecode = prev;        ecode = prev;
# Line 1634  for (;;) Line 1816  for (;;)
1816        }        }
1817      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
1818        {        {
1819        RMATCH(eptr, prev, offset_top, md, eptrb, flags, RM13);        if (*prev >= OP_SBRA) md->match_function_type = MATCH_CBEGROUP;
1820          RMATCH(eptr, prev, offset_top, md, eptrb, RM13);
1821        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1822        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
       flags = 0;  
1823        goto TAIL_RECURSE;        goto TAIL_RECURSE;
1824        }        }
1825      /* Control never gets here */      /* Control never gets here */
# Line 2324  for (;;) Line 2506  for (;;)
2506        for (fi = min;; fi++)        for (fi = min;; fi++)
2507          {          {
2508          int slength;          int slength;
2509          RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM14);          RMATCH(eptr, ecode, offset_top, md, eptrb, RM14);
2510          if (rrc != MATCH_NOMATCH) RRETURN(rrc);          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2511          if (fi >= max) MRRETURN(MATCH_NOMATCH);          if (fi >= max) MRRETURN(MATCH_NOMATCH);
2512          if ((slength = match_ref(offset, eptr, length, md, caseless)) < 0)          if ((slength = match_ref(offset, eptr, length, md, caseless)) < 0)
# Line 2354  for (;;) Line 2536  for (;;)
2536          }          }
2537        while (eptr >= pp)        while (eptr >= pp)
2538          {          {
2539          RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM15);          RMATCH(eptr, ecode, offset_top, md, eptrb, RM15);
2540          if (rrc != MATCH_NOMATCH) RRETURN(rrc);          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2541          eptr -= length;          eptr -= length;
2542          }          }
# Line 2464  for (;;) Line 2646  for (;;)
2646            {            {
2647            for (fi = min;; fi++)            for (fi = min;; fi++)
2648              {              {
2649              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM16);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM16);
2650              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2651              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
2652              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 2489  for (;;) Line 2671  for (;;)
2671            {            {
2672            for (fi = min;; fi++)            for (fi = min;; fi++)
2673              {              {
2674              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM17);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM17);
2675              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2676              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
2677              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 2535  for (;;) Line 2717  for (;;)
2717              }              }
2718            for (;;)            for (;;)
2719              {              {
2720              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM18);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM18);
2721              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2722              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
2723              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 2558  for (;;) Line 2740  for (;;)
2740              }              }
2741            while (eptr >= pp)            while (eptr >= pp)
2742              {              {
2743              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM19);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM19);
2744              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2745              eptr--;              eptr--;
2746              }              }
# Line 2634  for (;;) Line 2816  for (;;)
2816          {          {
2817          for (fi = min;; fi++)          for (fi = min;; fi++)
2818            {            {
2819            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM20);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM20);
2820            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2821            if (fi >= max) MRRETURN(MATCH_NOMATCH);            if (fi >= max) MRRETURN(MATCH_NOMATCH);
2822            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
# Line 2667  for (;;) Line 2849  for (;;)
2849            }            }
2850          for(;;)          for(;;)
2851            {            {
2852            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM21);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM21);
2853            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2854            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
2855            if (utf8) BACKCHAR(eptr);            if (utf8) BACKCHAR(eptr);
# Line 2880  for (;;) Line 3062  for (;;)
3062            {            {
3063            for (fi = min;; fi++)            for (fi = min;; fi++)
3064              {              {
3065              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM22);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM22);
3066              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3067              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
3068              if (eptr <= md->end_subject - length &&              if (eptr <= md->end_subject - length &&
# Line 2922  for (;;) Line 3104  for (;;)
3104    
3105            for(;;)            for(;;)
3106              {              {
3107              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM23);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM23);
3108              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3109              if (eptr == pp) { MRRETURN(MATCH_NOMATCH); }              if (eptr == pp) { MRRETURN(MATCH_NOMATCH); }
3110  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2976  for (;;) Line 3158  for (;;)
3158          {          {
3159          for (fi = min;; fi++)          for (fi = min;; fi++)
3160            {            {
3161            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM24);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM24);
3162            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3163            if (fi >= max) MRRETURN(MATCH_NOMATCH);            if (fi >= max) MRRETURN(MATCH_NOMATCH);
3164            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
# Line 3006  for (;;) Line 3188  for (;;)
3188    
3189          while (eptr >= pp)          while (eptr >= pp)
3190            {            {
3191            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM25);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM25);
3192            eptr--;            eptr--;
3193            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3194            }            }
# Line 3035  for (;;) Line 3217  for (;;)
3217          {          {
3218          for (fi = min;; fi++)          for (fi = min;; fi++)
3219            {            {
3220            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM26);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM26);
3221            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3222            if (fi >= max) MRRETURN(MATCH_NOMATCH);            if (fi >= max) MRRETURN(MATCH_NOMATCH);
3223            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
# Line 3064  for (;;) Line 3246  for (;;)
3246    
3247          while (eptr >= pp)          while (eptr >= pp)
3248            {            {
3249            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM27);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM27);
3250            eptr--;            eptr--;
3251            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3252            }            }
# Line 3236  for (;;) Line 3418  for (;;)
3418            register unsigned int d;            register unsigned int d;
3419            for (fi = min;; fi++)            for (fi = min;; fi++)
3420              {              {
3421              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM28);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM28);
3422              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3423              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
3424              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 3255  for (;;) Line 3437  for (;;)
3437            {            {
3438            for (fi = min;; fi++)            for (fi = min;; fi++)
3439              {              {
3440              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM29);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM29);
3441              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3442              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
3443              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 3296  for (;;) Line 3478  for (;;)
3478          if (possessive) continue;          if (possessive) continue;
3479          for(;;)          for(;;)
3480              {              {
3481              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM30);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM30);
3482              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3483              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
3484              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 3319  for (;;) Line 3501  for (;;)
3501            if (possessive) continue;            if (possessive) continue;
3502            while (eptr >= pp)            while (eptr >= pp)
3503              {              {
3504              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM31);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM31);
3505              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3506              eptr--;              eptr--;
3507              }              }
# Line 3376  for (;;) Line 3558  for (;;)
3558            register unsigned int d;            register unsigned int d;
3559            for (fi = min;; fi++)            for (fi = min;; fi++)
3560              {              {
3561              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM32);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM32);
3562              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3563              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
3564              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 3394  for (;;) Line 3576  for (;;)
3576            {            {
3577            for (fi = min;; fi++)            for (fi = min;; fi++)
3578              {              {
3579              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM33);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM33);
3580              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3581              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
3582              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 3434  for (;;) Line 3616  for (;;)
3616            if (possessive) continue;            if (possessive) continue;
3617            for(;;)            for(;;)
3618              {              {
3619              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM34);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM34);
3620              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3621              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
3622              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 3457  for (;;) Line 3639  for (;;)
3639            if (possessive) continue;            if (possessive) continue;
3640            while (eptr >= pp)            while (eptr >= pp)
3641              {              {
3642              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM35);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM35);
3643              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3644              eptr--;              eptr--;
3645              }              }
# Line 4255  for (;;) Line 4437  for (;;)
4437            case PT_ANY:            case PT_ANY:
4438            for (fi = min;; fi++)            for (fi = min;; fi++)
4439              {              {
4440              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM36);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM36);
4441              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4442              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4443              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4271  for (;;) Line 4453  for (;;)
4453            case PT_LAMP:            case PT_LAMP:
4454            for (fi = min;; fi++)            for (fi = min;; fi++)
4455              {              {
4456              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM37);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM37);
4457              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4458              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4459              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4291  for (;;) Line 4473  for (;;)
4473            case PT_GC:            case PT_GC:
4474            for (fi = min;; fi++)            for (fi = min;; fi++)
4475              {              {
4476              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM38);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM38);
4477              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4478              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4479              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4309  for (;;) Line 4491  for (;;)
4491            case PT_PC:            case PT_PC:
4492            for (fi = min;; fi++)            for (fi = min;; fi++)
4493              {              {
4494              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM39);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM39);
4495              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4496              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4497              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4327  for (;;) Line 4509  for (;;)
4509            case PT_SC:            case PT_SC:
4510            for (fi = min;; fi++)            for (fi = min;; fi++)
4511              {              {
4512              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM40);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM40);
4513              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4514              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4515              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4345  for (;;) Line 4527  for (;;)
4527            case PT_ALNUM:            case PT_ALNUM:
4528            for (fi = min;; fi++)            for (fi = min;; fi++)
4529              {              {
4530              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM59);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM59);
4531              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4532              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4533              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4364  for (;;) Line 4546  for (;;)
4546            case PT_SPACE:    /* Perl space */            case PT_SPACE:    /* Perl space */
4547            for (fi = min;; fi++)            for (fi = min;; fi++)
4548              {              {
4549              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM60);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM60);
4550              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4551              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4552              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4384  for (;;) Line 4566  for (;;)
4566            case PT_PXSPACE:  /* POSIX space */            case PT_PXSPACE:  /* POSIX space */
4567            for (fi = min;; fi++)            for (fi = min;; fi++)
4568              {              {
4569              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM61);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM61);
4570              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4571              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4572              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4404  for (;;) Line 4586  for (;;)
4586            case PT_WORD:            case PT_WORD:
4587            for (fi = min;; fi++)            for (fi = min;; fi++)
4588              {              {
4589              RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM62);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM62);
4590              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4591              if (fi >= max) MRRETURN(MATCH_NOMATCH);              if (fi >= max) MRRETURN(MATCH_NOMATCH);
4592              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 4436  for (;;) Line 4618  for (;;)
4618          {          {
4619          for (fi = min;; fi++)          for (fi = min;; fi++)
4620            {            {
4621            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM41);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM41);
4622            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4623            if (fi >= max) MRRETURN(MATCH_NOMATCH);            if (fi >= max) MRRETURN(MATCH_NOMATCH);
4624            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
# Line 4468  for (;;) Line 4650  for (;;)
4650          {          {
4651          for (fi = min;; fi++)          for (fi = min;; fi++)
4652            {            {
4653            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM42);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM42);
4654            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4655            if (fi >= max) MRRETURN(MATCH_NOMATCH);            if (fi >= max) MRRETURN(MATCH_NOMATCH);
4656            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
# Line 4631  for (;;) Line 4813  for (;;)
4813          {          {
4814          for (fi = min;; fi++)          for (fi = min;; fi++)
4815            {            {
4816            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM43);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM43);
4817            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4818            if (fi >= max) MRRETURN(MATCH_NOMATCH);            if (fi >= max) MRRETURN(MATCH_NOMATCH);
4819            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
# Line 4929  for (;;) Line 5111  for (;;)
5111          if (possessive) continue;          if (possessive) continue;
5112          for(;;)          for(;;)
5113            {            {
5114            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM44);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM44);
5115            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
5116            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
5117            if (utf8) BACKCHAR(eptr);            if (utf8) BACKCHAR(eptr);
# Line 4970  for (;;) Line 5152  for (;;)
5152    
5153          for(;;)          for(;;)
5154            {            {
5155            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM45);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM45);
5156            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
5157            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
5158            for (;;)                        /* Move back over one extended */            for (;;)                        /* Move back over one extended */
# Line 5263  for (;;) Line 5445  for (;;)
5445          if (possessive) continue;          if (possessive) continue;
5446          for(;;)          for(;;)
5447            {            {
5448            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM46);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM46);
5449            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
5450            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
5451            BACKCHAR(eptr);            BACKCHAR(eptr);
# Line 5476  for (;;) Line 5658  for (;;)
5658          if (possessive) continue;          if (possessive) continue;
5659          while (eptr >= pp)          while (eptr >= pp)
5660            {            {
5661            RMATCH(eptr, ecode, offset_top, md, eptrb, 0, RM47);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM47);
5662            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
5663            eptr--;            eptr--;
5664            if (ctype == OP_ANYNL && eptr > pp  && *eptr == '\n' &&            if (ctype == OP_ANYNL && eptr > pp  && *eptr == '\n' &&
# Line 5519  switch (frame->Xwhere) Line 5701  switch (frame->Xwhere)
5701    LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)    LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)
5702    LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)    LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)
5703    LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)    LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)
5704    LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58)    LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) LBL(63) LBL(64)
5705  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
5706    LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30)    LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30)
5707    LBL(32) LBL(34) LBL(42) LBL(46)    LBL(32) LBL(34) LBL(42) LBL(46)
# Line 6120  for(;;) Line 6302  for(;;)
6302    md->start_match_ptr = start_match;    md->start_match_ptr = start_match;
6303    md->start_used_ptr = start_match;    md->start_used_ptr = start_match;
6304    md->match_call_count = 0;    md->match_call_count = 0;
6305    rc = match(start_match, md->start_code, start_match, NULL, 2, md, NULL,    md->match_function_type = 0;
6306      0, 0);    rc = match(start_match, md->start_code, start_match, NULL, 2, md, NULL, 0);
6307    if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr;    if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr;
6308    
6309    switch(rc)    switch(rc)
# Line 6244  if (rc == MATCH_MATCH || rc == MATCH_ACC Line 6426  if (rc == MATCH_MATCH || rc == MATCH_ACC
6426    
6427    /* Set the return code to the number of captured strings, or 0 if there are    /* Set the return code to the number of captured strings, or 0 if there are
6428    too many to fit into the vector. */    too many to fit into the vector. */
6429    
6430    rc = md->offset_overflow? 0 : md->end_offset_top/2;    rc = md->offset_overflow? 0 : md->end_offset_top/2;
6431    
6432    /* If there is space, set up the whole thing as substring 0. The value of    /* If there is space, set up the whole thing as substring 0. The value of

Legend:
Removed from v.602  
changed lines
  Added in v.604

  ViewVC Help
Powered by ViewVC 1.1.5