/[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 144 by ph10, Mon Apr 2 13:32:07 2007 UTC revision 402 by ph10, Sat Mar 21 17:26:03 2009 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2007 University of Cambridge             Copyright (c) 1997-2009 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 42  POSSIBILITY OF SUCH DAMAGE. Line 42  POSSIBILITY OF SUCH DAMAGE.
42  pattern matching using an NFA algorithm, trying to mimic Perl as closely as  pattern matching using an NFA algorithm, trying to mimic Perl as closely as
43  possible. There are also some static supporting functions. */  possible. There are also some static supporting functions. */
44    
45    #ifdef HAVE_CONFIG_H
46    #include "config.h"
47    #endif
48    
49  #define NLBLOCK md             /* Block containing newline information */  #define NLBLOCK md             /* Block containing newline information */
50  #define PSSTART start_subject  /* Field containing processed string start */  #define PSSTART start_subject  /* Field containing processed string start */
51  #define PSEND   end_subject    /* Field containing processed string end */  #define PSEND   end_subject    /* Field containing processed string end */
# Line 53  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    
 /* The chain of eptrblocks for tail recursions uses memory in stack workspace,  
 obtained at top level, the size of which is defined by EPTR_WORK_SIZE. */  
   
 #define EPTR_WORK_SIZE (1000)  
   
60  /* Flag bits for the match() function */  /* Flag bits for the match() function */
61    
62  #define match_condassert     0x01  /* Called to check a condition assertion */  #define match_condassert     0x01  /* Called to check a condition assertion */
63  #define match_cbegroup       0x02  /* Could-be-empty unlimited repeat group */  #define match_cbegroup       0x02  /* Could-be-empty unlimited repeat group */
 #define match_tail_recursed  0x04  /* Tail recursive call */  
64    
65  /* Non-error returns from the match() function. Error returns are externally  /* Non-error returns from the match() function. Error returns are externally
66  defined PCRE_ERROR_xxx codes, which are all negative. */  defined PCRE_ERROR_xxx codes, which are all negative. */
# Line 70  defined PCRE_ERROR_xxx codes, which are Line 68  defined PCRE_ERROR_xxx codes, which are
68  #define MATCH_MATCH        1  #define MATCH_MATCH        1
69  #define MATCH_NOMATCH      0  #define MATCH_NOMATCH      0
70    
71    /* Special internal returns from the match() function. Make them sufficiently
72    negative to avoid the external error codes. */
73    
74    #define MATCH_COMMIT       (-999)
75    #define MATCH_PRUNE        (-998)
76    #define MATCH_SKIP         (-997)
77    #define MATCH_THEN         (-996)
78    
79  /* Maximum number of ints of offset to save on the stack for recursive calls.  /* Maximum number of ints of offset to save on the stack for recursive calls.
80  If the offset vector is bigger, malloc is used. This should be a multiple of 3,  If the offset vector is bigger, malloc is used. This should be a multiple of 3,
81  because the offset vector is always a multiple of 3 long. */  because the offset vector is always a multiple of 3 long. */
# Line 152  printf("\n"); Line 158  printf("\n");
158    
159  if (length > md->end_subject - eptr) return FALSE;  if (length > md->end_subject - eptr) return FALSE;
160    
161  /* Separate the caselesss case for speed */  /* Separate the caseless case for speed. In UTF-8 mode we can only do this
162    properly if Unicode properties are supported. Otherwise, we can check only
163    ASCII characters. */
164    
165  if ((ims & PCRE_CASELESS) != 0)  if ((ims & PCRE_CASELESS) != 0)
166    {    {
167    #ifdef SUPPORT_UTF8
168    #ifdef SUPPORT_UCP
169      if (md->utf8)
170        {
171        USPTR endptr = eptr + length;
172        while (eptr < endptr)
173          {
174          int c, d;
175          GETCHARINC(c, eptr);
176          GETCHARINC(d, p);
177          if (c != d && c != UCD_OTHERCASE(d)) return FALSE;
178          }
179        }
180      else
181    #endif
182    #endif
183    
184      /* The same code works when not in UTF-8 mode and in UTF-8 mode when there
185      is no UCP support. */
186    
187    while (length-- > 0)    while (length-- > 0)
188      if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE;      { if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE; }
189    }    }
190    
191    /* In the caseful case, we can just compare the bytes, whether or not we
192    are in UTF-8 mode. */
193    
194  else  else
195    { while (length-- > 0) if (*p++ != *eptr++) return FALSE; }    { while (length-- > 0) if (*p++ != *eptr++) return FALSE; }
196    
# Line 188  calls by keeping local variables that ne Line 220  calls by keeping local variables that ne
220  obtained from malloc() instead instead of on the stack. Macros are used to  obtained from malloc() instead instead of on the stack. Macros are used to
221  achieve this so that the actual code doesn't look very different to what it  achieve this so that the actual code doesn't look very different to what it
222  always used to.  always used to.
223    
224    The original heap-recursive code used longjmp(). However, it seems that this
225    can be very slow on some operating systems. Following a suggestion from Stan
226    Switzer, the use of longjmp() has been abolished, at the cost of having to
227    provide a unique number for each call to RMATCH. There is no way of generating
228    a sequence of numbers at compile time in C. I have given them names, to make
229    them stand out more clearly.
230    
231    Crude tests on x86 Linux show a small speedup of around 5-8%. However, on
232    FreeBSD, avoiding longjmp() more than halves the time taken to run the standard
233    tests. Furthermore, not using longjmp() means that local dynamic variables
234    don't have indeterminate values; this has meant that the frame size can be
235    reduced because the result can be "passed back" by straight setting of the
236    variable instead of being passed in the frame.
237  ****************************************************************************  ****************************************************************************
238  ***************************************************************************/  ***************************************************************************/
239    
240    /* Numbers for RMATCH calls. When this list is changed, the code at HEAP_RETURN
241    below must be updated in sync.  */
242    
243    enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM6,  RM7,  RM8,  RM9,  RM10,
244           RM11,  RM12, RM13, RM14, RM15, RM16, RM17, RM18, RM19, RM20,
245           RM21,  RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30,
246           RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
247           RM41,  RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,
248           RM51,  RM52, RM53, RM54 };
249    
250  /* 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
251  versions and production versions. */  versions and production versions. Note that the "rw" argument of RMATCH isn't
252    actuall used in this definition. */
253    
254  #ifndef NO_RECURSE  #ifndef NO_RECURSE
255  #define REGISTER register  #define REGISTER register
256    
257  #ifdef DEBUG  #ifdef DEBUG
258  #define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) \  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \
259    { \    { \
260    printf("match() called in line %d\n", __LINE__); \    printf("match() called in line %d\n", __LINE__); \
261    rx = match(ra,rb,rc,rd,re,rf,rg,rdepth+1); \    rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1); \
262    printf("to line %d\n", __LINE__); \    printf("to line %d\n", __LINE__); \
263    }    }
264  #define RRETURN(ra) \  #define RRETURN(ra) \
# Line 210  versions and production versions. */ Line 267  versions and production versions. */
267    return ra; \    return ra; \
268    }    }
269  #else  #else
270  #define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) \  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \
271    rx = match(ra,rb,rc,rd,re,rf,rg,rdepth+1)    rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1)
272  #define RRETURN(ra) return ra  #define RRETURN(ra) return ra
273  #endif  #endif
274    
275  #else  #else
276    
277    
278  /* These versions of the macros manage a private stack on the heap. Note  /* These versions of the macros manage a private stack on the heap. Note that
279  that the rd argument of RMATCH isn't actually used. It's the md argument of  the "rd" argument of RMATCH isn't actually used in this definition. It's the md
280  match(), which never changes. */  argument of match(), which never changes. */
281    
282  #define REGISTER  #define REGISTER
283    
284  #define RMATCH(rx,ra,rb,rc,rd,re,rf,rg)\  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\
285    {\    {\
286    heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\    heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
287    if (setjmp(frame->Xwhere) == 0)\    frame->Xwhere = rw; \
288      {\    newframe->Xeptr = ra;\
289      newframe->Xeptr = ra;\    newframe->Xecode = rb;\
290      newframe->Xecode = rb;\    newframe->Xmstart = mstart;\
291      newframe->Xoffset_top = rc;\    newframe->Xoffset_top = rc;\
292      newframe->Xims = re;\    newframe->Xims = re;\
293      newframe->Xeptrb = rf;\    newframe->Xeptrb = rf;\
294      newframe->Xflags = rg;\    newframe->Xflags = rg;\
295      newframe->Xrdepth = frame->Xrdepth + 1;\    newframe->Xrdepth = frame->Xrdepth + 1;\
296      newframe->Xprevframe = frame;\    newframe->Xprevframe = frame;\
297      frame = newframe;\    frame = newframe;\
298      DPRINTF(("restarting from line %d\n", __LINE__));\    DPRINTF(("restarting from line %d\n", __LINE__));\
299      goto HEAP_RECURSE;\    goto HEAP_RECURSE;\
300      }\    L_##rw:\
301    else\    DPRINTF(("jumped back to line %d\n", __LINE__));\
     {\  
     DPRINTF(("longjumped back to line %d\n", __LINE__));\  
     frame = md->thisframe;\  
     rx = frame->Xresult;\  
     }\  
302    }    }
303    
304  #define RRETURN(ra)\  #define RRETURN(ra)\
# Line 256  match(), which never changes. */ Line 308  match(), which never changes. */
308    (pcre_stack_free)(newframe);\    (pcre_stack_free)(newframe);\
309    if (frame != NULL)\    if (frame != NULL)\
310      {\      {\
311      frame->Xresult = ra;\      rrc = ra;\
312      md->thisframe = frame;\      goto HEAP_RETURN;\
     longjmp(frame->Xwhere, 1);\  
313      }\      }\
314    return ra;\    return ra;\
315    }    }
# Line 273  typedef struct heapframe { Line 324  typedef struct heapframe {
324    
325    const uschar *Xeptr;    const uschar *Xeptr;
326    const uschar *Xecode;    const uschar *Xecode;
327      const uschar *Xmstart;
328    int Xoffset_top;    int Xoffset_top;
329    long int Xims;    long int Xims;
330    eptrblock *Xeptrb;    eptrblock *Xeptrb;
# Line 282  typedef struct heapframe { Line 334  typedef struct heapframe {
334    /* Function local variables */    /* Function local variables */
335    
336    const uschar *Xcallpat;    const uschar *Xcallpat;
337    #ifdef SUPPORT_UTF8
338    const uschar *Xcharptr;    const uschar *Xcharptr;
339    #endif
340    const uschar *Xdata;    const uschar *Xdata;
341    const uschar *Xnext;    const uschar *Xnext;
342    const uschar *Xpp;    const uschar *Xpp;
# Line 323  typedef struct heapframe { Line 377  typedef struct heapframe {
377    
378    eptrblock Xnewptrb;    eptrblock Xnewptrb;
379    
380    /* Place to pass back result, and where to jump back to */    /* Where to jump back to */
381    
382    int  Xresult;    int Xwhere;
   jmp_buf Xwhere;  
383    
384  } heapframe;  } heapframe;
385    
# Line 354  made performance worse. Line 407  made performance worse.
407  Arguments:  Arguments:
408     eptr        pointer to current character in subject     eptr        pointer to current character in subject
409     ecode       pointer to current position in compiled code     ecode       pointer to current position in compiled code
410       mstart      pointer to the current match start position (can be modified
411                     by encountering \K)
412     offset_top  current top pointer     offset_top  current top pointer
413     md          pointer to "static" info for the match     md          pointer to "static" info for the match
414     ims         current /i, /m, and /s options     ims         current /i, /m, and /s options
# Line 363  Arguments: Line 418  Arguments:
418                   match_condassert - this is an assertion condition                   match_condassert - this is an assertion condition
419                   match_cbegroup - this is the start of an unlimited repeat                   match_cbegroup - this is the start of an unlimited repeat
420                     group that can match an empty string                     group that can match an empty string
                  match_tail_recursed - this is a tail_recursed group  
421     rdepth      the recursion depth     rdepth      the recursion depth
422    
423  Returns:       MATCH_MATCH if matched            )  these values are >= 0  Returns:       MATCH_MATCH if matched            )  these values are >= 0
# Line 373  Returns:       MATCH_MATCH if matched Line 427  Returns:       MATCH_MATCH if matched
427  */  */
428    
429  static int  static int
430  match(REGISTER USPTR eptr, REGISTER const uschar *ecode,  match(REGISTER USPTR eptr, REGISTER const uschar *ecode, const uschar *mstart,
431    int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb,    int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb,
432    int flags, unsigned int rdepth)    int flags, unsigned int rdepth)
433  {  {
# Line 401  frame->Xprevframe = NULL;            /* Line 455  frame->Xprevframe = NULL;            /*
455    
456  frame->Xeptr = eptr;  frame->Xeptr = eptr;
457  frame->Xecode = ecode;  frame->Xecode = ecode;
458    frame->Xmstart = mstart;
459  frame->Xoffset_top = offset_top;  frame->Xoffset_top = offset_top;
460  frame->Xims = ims;  frame->Xims = ims;
461  frame->Xeptrb = eptrb;  frame->Xeptrb = eptrb;
# Line 415  HEAP_RECURSE: Line 470  HEAP_RECURSE:
470    
471  #define eptr               frame->Xeptr  #define eptr               frame->Xeptr
472  #define ecode              frame->Xecode  #define ecode              frame->Xecode
473    #define mstart             frame->Xmstart
474  #define offset_top         frame->Xoffset_top  #define offset_top         frame->Xoffset_top
475  #define ims                frame->Xims  #define ims                frame->Xims
476  #define eptrb              frame->Xeptrb  #define eptrb              frame->Xeptrb
# Line 507  int oclength; Line 563  int oclength;
563  uschar occhars[8];  uschar occhars[8];
564  #endif  #endif
565    
566    int codelink;
567    int condcode;
568  int ctype;  int ctype;
569  int length;  int length;
570  int max;  int max;
# Line 545  defined). However, RMATCH isn't like a f Line 603  defined). However, RMATCH isn't like a f
603  complicated macro. It has to be used in one particular way. This shouldn't,  complicated macro. It has to be used in one particular way. This shouldn't,
604  however, impact performance when true recursion is being used. */  however, impact performance when true recursion is being used. */
605    
606    #ifdef SUPPORT_UTF8
607    utf8 = md->utf8;       /* Local copy of the flag */
608    #else
609    utf8 = FALSE;
610    #endif
611    
612  /* First check that we haven't called match() too many times, or that we  /* First check that we haven't called match() too many times, or that we
613  haven't exceeded the recursive call limit. */  haven't exceeded the recursive call limit. */
614    
# Line 553  if (rdepth >= md->match_limit_recursion) Line 617  if (rdepth >= md->match_limit_recursion)
617    
618  original_ims = ims;    /* Save for resetting on ')' */  original_ims = ims;    /* Save for resetting on ')' */
619    
 #ifdef SUPPORT_UTF8  
 utf8 = md->utf8;       /* Local copy of the flag */  
 #else  
 utf8 = FALSE;  
 #endif  
   
620  /* 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
621  string, the match_cbegroup flag is set. When this is the case, add the current  string, the match_cbegroup flag is set. When this is the case, add the current
622  subject pointer to the chain of such remembered pointers, to be checked when we  subject pointer to the chain of such remembered pointers, to be checked when we
623  hit the closing ket, in order to break infinite loops that match no characters.  hit the closing ket, in order to break infinite loops that match no characters.
624  When match() is called in other circumstances, don't add to the chain. If this  When match() is called in other circumstances, don't add to the chain. The
625  is a tail recursion, use a block from the workspace, as the one on the stack is  match_cbegroup flag must NOT be used with tail recursion, because the memory
626  already used. */  block that is used is on the stack, so a new one may be required for each
627    match(). */
628    
629  if ((flags & match_cbegroup) != 0)  if ((flags & match_cbegroup) != 0)
630    {    {
631    eptrblock *p;    newptrb.epb_saved_eptr = eptr;
632    if ((flags & match_tail_recursed) != 0)    newptrb.epb_prev = eptrb;
633      {    eptrb = &newptrb;
     if (md->eptrn >= EPTR_WORK_SIZE) RRETURN(PCRE_ERROR_NULLWSLIMIT);  
     p = md->eptrchain + md->eptrn++;  
     }  
   else p = &newptrb;  
   p->epb_saved_eptr = eptr;  
   p->epb_prev = eptrb;  
   eptrb = p;  
634    }    }
635    
636  /* Now start processing the opcodes. */  /* Now start processing the opcodes. */
# Line 587  for (;;) Line 639  for (;;)
639    {    {
640    minimize = possessive = FALSE;    minimize = possessive = FALSE;
641    op = *ecode;    op = *ecode;
642    
643    /* For partial matching, remember if we ever hit the end of the subject after    /* For partial matching, remember if we ever hit the end of the subject after
644    matching at least one subject character. */    matching at least one subject character. */
645    
646    if (md->partial &&    if (md->partial &&
647        eptr >= md->end_subject &&        eptr >= md->end_subject &&
648        eptr > md->start_match)        eptr > mstart)
649      md->hitend = TRUE;      md->hitend = TRUE;
650    
651    switch(op)    switch(op)
652      {      {
653        case OP_FAIL:
654        RRETURN(MATCH_NOMATCH);
655    
656        case OP_PRUNE:
657        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
658          ims, eptrb, flags, RM51);
659        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
660        RRETURN(MATCH_PRUNE);
661    
662        case OP_COMMIT:
663        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
664          ims, eptrb, flags, RM52);
665        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
666        RRETURN(MATCH_COMMIT);
667    
668        case OP_SKIP:
669        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
670          ims, eptrb, flags, RM53);
671        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
672        md->start_match_ptr = eptr;   /* Pass back current position */
673        RRETURN(MATCH_SKIP);
674    
675        case OP_THEN:
676        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
677          ims, eptrb, flags, RM54);
678        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
679        RRETURN(MATCH_THEN);
680    
681      /* Handle a capturing bracket. If there is space in the offset vector, save      /* Handle a capturing bracket. If there is space in the offset vector, save
682      the current subject position in the working slot at the top of the vector.      the current subject position in the working slot at the top of the vector.
683      We mustn't change the current values of the data slot, because they may be      We mustn't change the current values of the data slot, because they may be
# Line 637  for (;;) Line 717  for (;;)
717        flags = (op == OP_SCBRA)? match_cbegroup : 0;        flags = (op == OP_SCBRA)? match_cbegroup : 0;
718        do        do
719          {          {
720          RMATCH(rrc, eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
721            ims, eptrb, flags);            ims, eptrb, flags, RM1);
722          if (rrc != MATCH_NOMATCH) RRETURN(rrc);          if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
723          md->capture_last = save_capture_last;          md->capture_last = save_capture_last;
724          ecode += GET(ecode, 1);          ecode += GET(ecode, 1);
725          }          }
# Line 654  for (;;) Line 734  for (;;)
734        RRETURN(MATCH_NOMATCH);        RRETURN(MATCH_NOMATCH);
735        }        }
736    
737      /* Insufficient room for saving captured contents. Treat as a non-capturing      /* FALL THROUGH ... Insufficient room for saving captured contents. Treat
738      bracket. */      as a non-capturing bracket. */
739    
740        /* VVVVVVVVVVVVVVVVVVVVVVVVV */
741        /* VVVVVVVVVVVVVVVVVVVVVVVVV */
742    
743      DPRINTF(("insufficient capture room: treat as non-capturing\n"));      DPRINTF(("insufficient capture room: treat as non-capturing\n"));
744    
745        /* VVVVVVVVVVVVVVVVVVVVVVVVV */
746        /* VVVVVVVVVVVVVVVVVVVVVVVVV */
747    
748      /* Non-capturing bracket. Loop for all the alternatives. When we get to the      /* Non-capturing bracket. Loop for all the alternatives. When we get to the
749      final alternative within the brackets, we would return the result of a      final alternative within the brackets, we would return the result of a
750      recursive call to match() whatever happened. We can reduce stack usage by      recursive call to match() whatever happened. We can reduce stack usage by
751      turning this into a tail recursion. */      turning this into a tail recursion, except in the case when match_cbegroup
752        is set.*/
753    
754      case OP_BRA:      case OP_BRA:
755      case OP_SBRA:      case OP_SBRA:
# Line 670  for (;;) Line 757  for (;;)
757      flags = (op >= OP_SBRA)? match_cbegroup : 0;      flags = (op >= OP_SBRA)? match_cbegroup : 0;
758      for (;;)      for (;;)
759        {        {
760        if (ecode[GET(ecode, 1)] != OP_ALT)        if (ecode[GET(ecode, 1)] != OP_ALT)   /* Final alternative */
761          {          {
762          ecode += _pcre_OP_lengths[*ecode];          if (flags == 0)    /* Not a possibly empty group */
763          flags |= match_tail_recursed;            {
764          DPRINTF(("bracket 0 tail recursion\n"));            ecode += _pcre_OP_lengths[*ecode];
765          goto TAIL_RECURSE;            DPRINTF(("bracket 0 tail recursion\n"));
766              goto TAIL_RECURSE;
767              }
768    
769            /* Possibly empty group; can't use tail recursion. */
770    
771            RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
772              eptrb, flags, RM48);
773            RRETURN(rrc);
774          }          }
775    
776        /* For non-final alternatives, continue the loop for a NOMATCH result;        /* For non-final alternatives, continue the loop for a NOMATCH result;
777        otherwise return. */        otherwise return. */
778    
779        RMATCH(rrc, eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
780          eptrb, flags);          eptrb, flags, RM2);
781        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
782        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
783        }        }
784      /* Control never reaches here. */      /* Control never reaches here. */
# Line 696  for (;;) Line 791  for (;;)
791    
792      case OP_COND:      case OP_COND:
793      case OP_SCOND:      case OP_SCOND:
794      if (ecode[LINK_SIZE+1] == OP_RREF)         /* Recursion test */      codelink= GET(ecode, 1);
795    
796        /* Because of the way auto-callout works during compile, a callout item is
797        inserted between OP_COND and an assertion condition. */
798    
799        if (ecode[LINK_SIZE+1] == OP_CALLOUT)
800          {
801          if (pcre_callout != NULL)
802            {
803            pcre_callout_block cb;
804            cb.version          = 1;   /* Version 1 of the callout block */
805            cb.callout_number   = ecode[LINK_SIZE+2];
806            cb.offset_vector    = md->offset_vector;
807            cb.subject          = (PCRE_SPTR)md->start_subject;
808            cb.subject_length   = md->end_subject - md->start_subject;
809            cb.start_match      = mstart - md->start_subject;
810            cb.current_position = eptr - md->start_subject;
811            cb.pattern_position = GET(ecode, LINK_SIZE + 3);
812            cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE);
813            cb.capture_top      = offset_top/2;
814            cb.capture_last     = md->capture_last;
815            cb.callout_data     = md->callout_data;
816            if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH);
817            if (rrc < 0) RRETURN(rrc);
818            }
819          ecode += _pcre_OP_lengths[OP_CALLOUT];
820          }
821    
822        condcode = ecode[LINK_SIZE+1];
823    
824        /* Now see what the actual condition is */
825    
826        if (condcode == OP_RREF)         /* Recursion test */
827        {        {
828        offset = GET2(ecode, LINK_SIZE + 2);     /* Recursion group number*/        offset = GET2(ecode, LINK_SIZE + 2);     /* Recursion group number*/
829        condition = md->recursive != NULL &&        condition = md->recursive != NULL &&
# Line 704  for (;;) Line 831  for (;;)
831        ecode += condition? 3 : GET(ecode, 1);        ecode += condition? 3 : GET(ecode, 1);
832        }        }
833    
834      else if (ecode[LINK_SIZE+1] == OP_CREF)    /* Group used test */      else if (condcode == OP_CREF)    /* Group used test */
835        {        {
836        offset = GET2(ecode, LINK_SIZE+2) << 1;  /* Doubled ref number */        offset = GET2(ecode, LINK_SIZE+2) << 1;  /* Doubled ref number */
837        condition = offset < offset_top && md->offset_vector[offset] >= 0;        condition = offset < offset_top && md->offset_vector[offset] >= 0;
838        ecode += condition? 3 : GET(ecode, 1);        ecode += condition? 3 : GET(ecode, 1);
839        }        }
840    
841      else if (ecode[LINK_SIZE+1] == OP_DEF)     /* DEFINE - always false */      else if (condcode == OP_DEF)     /* DEFINE - always false */
842        {        {
843        condition = FALSE;        condition = FALSE;
844        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
# Line 723  for (;;) Line 850  for (;;)
850    
851      else      else
852        {        {
853        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
854            match_condassert);            match_condassert, RM3);
855        if (rrc == MATCH_MATCH)        if (rrc == MATCH_MATCH)
856          {          {
857          condition = TRUE;          condition = TRUE;
858          ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2);          ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2);
859          while (*ecode == OP_ALT) ecode += GET(ecode, 1);          while (*ecode == OP_ALT) ecode += GET(ecode, 1);
860          }          }
861        else if (rrc != MATCH_NOMATCH)        else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
862          {          {
863          RRETURN(rrc);         /* Need braces because of following else */          RRETURN(rrc);         /* Need braces because of following else */
864          }          }
865        else        else
866          {          {
867          condition = FALSE;          condition = FALSE;
868          ecode += GET(ecode, 1);          ecode += codelink;
869          }          }
870        }        }
871    
872      /* 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,
873      we can use tail recursion to avoid using another stack frame. If the second      we can use tail recursion to avoid using another stack frame, except when
874      alternative doesn't exist, we can just plough on. */      match_cbegroup is required for an unlimited repeat of a possibly empty
875        group. If the second alternative doesn't exist, we can just plough on. */
876    
877      if (condition || *ecode == OP_ALT)      if (condition || *ecode == OP_ALT)
878        {        {
879        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
880        flags = match_tail_recursed | ((op == OP_SCOND)? match_cbegroup : 0);        if (op == OP_SCOND)        /* Possibly empty group */
881        goto TAIL_RECURSE;          {
882            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, match_cbegroup, RM49);
883            RRETURN(rrc);
884            }
885          else                       /* Group must match something */
886            {
887            flags = 0;
888            goto TAIL_RECURSE;
889            }
890        }        }
891      else      else                         /* Condition false & no alternative */
892        {        {
893        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
894        }        }
895      break;      break;
896    
897    
898      /* End of the pattern. If we are in a top-level recursion, we should      /* End of the pattern, either real or forced. If we are in a top-level
899      restore the offsets appropriately and continue from after the call. */      recursion, we should restore the offsets appropriately and continue from
900        after the call. */
901    
902        case OP_ACCEPT:
903      case OP_END:      case OP_END:
904      if (md->recursive != NULL && md->recursive->group_num == 0)      if (md->recursive != NULL && md->recursive->group_num == 0)
905        {        {
# Line 770  for (;;) Line 908  for (;;)
908        md->recursive = rec->prevrec;        md->recursive = rec->prevrec;
909        memmove(md->offset_vector, rec->offset_save,        memmove(md->offset_vector, rec->offset_save,
910          rec->saved_max * sizeof(int));          rec->saved_max * sizeof(int));
911        md->start_match = rec->save_start;        mstart = rec->save_start;
912        ims = original_ims;        ims = original_ims;
913        ecode = rec->after_call;        ecode = rec->after_call;
914        break;        break;
# Line 779  for (;;) Line 917  for (;;)
917      /* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty      /* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty
918      string - backtracking will then try other alternatives, if any. */      string - backtracking will then try other alternatives, if any. */
919    
920      if (md->notempty && eptr == md->start_match) RRETURN(MATCH_NOMATCH);      if (md->notempty && eptr == mstart) RRETURN(MATCH_NOMATCH);
921      md->end_match_ptr = eptr;          /* Record where we ended */      md->end_match_ptr = eptr;           /* Record where we ended */
922      md->end_offset_top = offset_top;   /* and how many extracts were taken */      md->end_offset_top = offset_top;    /* and how many extracts were taken */
923        md->start_match_ptr = mstart;       /* and the start (\K can modify) */
924      RRETURN(MATCH_MATCH);      RRETURN(MATCH_MATCH);
925    
926      /* Change option settings */      /* Change option settings */
# Line 802  for (;;) Line 941  for (;;)
941      case OP_ASSERTBACK:      case OP_ASSERTBACK:
942      do      do
943        {        {
944        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
945            RM4);
946        if (rrc == MATCH_MATCH) break;        if (rrc == MATCH_MATCH) break;
947        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
948        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
949        }        }
950      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
# Line 828  for (;;) Line 968  for (;;)
968      case OP_ASSERTBACK_NOT:      case OP_ASSERTBACK_NOT:
969      do      do
970        {        {
971        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
972            RM5);
973        if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);        if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);
974        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
975        ecode += GET(ecode,1);        ecode += GET(ecode,1);
976        }        }
977      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
# Line 854  for (;;) Line 995  for (;;)
995          {          {
996          eptr--;          eptr--;
997          if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);          if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
998          BACKCHAR(eptr)          BACKCHAR(eptr);
999          }          }
1000        }        }
1001      else      else
# Line 885  for (;;) Line 1026  for (;;)
1026        cb.offset_vector    = md->offset_vector;        cb.offset_vector    = md->offset_vector;
1027        cb.subject          = (PCRE_SPTR)md->start_subject;        cb.subject          = (PCRE_SPTR)md->start_subject;
1028        cb.subject_length   = md->end_subject - md->start_subject;        cb.subject_length   = md->end_subject - md->start_subject;
1029        cb.start_match      = md->start_match - md->start_subject;        cb.start_match      = mstart - md->start_subject;
1030        cb.current_position = eptr - md->start_subject;        cb.current_position = eptr - md->start_subject;
1031        cb.pattern_position = GET(ecode, 2);        cb.pattern_position = GET(ecode, 2);
1032        cb.next_item_length = GET(ecode, 2 + LINK_SIZE);        cb.next_item_length = GET(ecode, 2 + LINK_SIZE);
# Line 947  for (;;) Line 1088  for (;;)
1088    
1089        memcpy(new_recursive.offset_save, md->offset_vector,        memcpy(new_recursive.offset_save, md->offset_vector,
1090              new_recursive.saved_max * sizeof(int));              new_recursive.saved_max * sizeof(int));
1091        new_recursive.save_start = md->start_match;        new_recursive.save_start = mstart;
1092        md->start_match = eptr;        mstart = eptr;
1093    
1094        /* OK, now we can do the recursion. For each top-level alternative we        /* OK, now we can do the recursion. For each top-level alternative we
1095        restore the offset and recursion data. */        restore the offset and recursion data. */
# Line 957  for (;;) Line 1098  for (;;)
1098        flags = (*callpat >= OP_SBRA)? match_cbegroup : 0;        flags = (*callpat >= OP_SBRA)? match_cbegroup : 0;
1099        do        do
1100          {          {
1101          RMATCH(rrc, eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,          RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,
1102            md, ims, eptrb, flags);            md, ims, eptrb, flags, RM6);
1103          if (rrc == MATCH_MATCH)          if (rrc == MATCH_MATCH)
1104            {            {
1105            DPRINTF(("Recursion matched\n"));            DPRINTF(("Recursion matched\n"));
# Line 967  for (;;) Line 1108  for (;;)
1108              (pcre_free)(new_recursive.offset_save);              (pcre_free)(new_recursive.offset_save);
1109            RRETURN(MATCH_MATCH);            RRETURN(MATCH_MATCH);
1110            }            }
1111          else if (rrc != MATCH_NOMATCH)          else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
1112            {            {
1113            DPRINTF(("Recursion gave error %d\n", rrc));            DPRINTF(("Recursion gave error %d\n", rrc));
1114              if (new_recursive.offset_save != stacksave)
1115                (pcre_free)(new_recursive.offset_save);
1116            RRETURN(rrc);            RRETURN(rrc);
1117            }            }
1118    
# Line 1001  for (;;) Line 1144  for (;;)
1144    
1145      do      do
1146        {        {
1147        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims,        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7);
         eptrb, 0);  
1148        if (rrc == MATCH_MATCH) break;        if (rrc == MATCH_MATCH) break;
1149        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
1150        ecode += GET(ecode,1);        ecode += GET(ecode,1);
1151        }        }
1152      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
# Line 1047  for (;;) Line 1189  for (;;)
1189    
1190      if (*ecode == OP_KETRMIN)      if (*ecode == OP_KETRMIN)
1191        {        {
1192        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM8);
1193        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1194        ecode = prev;        ecode = prev;
1195        flags = match_tail_recursed;        flags = 0;
1196        goto TAIL_RECURSE;        goto TAIL_RECURSE;
1197        }        }
1198      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
1199        {        {
1200        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_cbegroup);        RMATCH(eptr, prev, offset_top, md, ims, eptrb, match_cbegroup, RM9);
1201        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1202        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
1203        flags = match_tail_recursed;        flags = 0;
1204        goto TAIL_RECURSE;        goto TAIL_RECURSE;
1205        }        }
1206      /* Control never gets here */      /* Control never gets here */
# Line 1070  for (;;) Line 1212  for (;;)
1212      do ecode += GET(ecode,1); while (*ecode == OP_ALT);      do ecode += GET(ecode,1); while (*ecode == OP_ALT);
1213      break;      break;
1214    
1215      /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating      /* BRAZERO, BRAMINZERO and SKIPZERO occur just before a bracket group,
1216      that it may occur zero times. It may repeat infinitely, or not at all -      indicating that it may occur zero times. It may repeat infinitely, or not
1217      i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper      at all - i.e. it could be ()* or ()? or even (){0} in the pattern. Brackets
1218      repeat limits are compiled as a number of copies, with the optional ones      with fixed upper repeat limits are compiled as a number of copies, with the
1219      preceded by BRAZERO or BRAMINZERO. */      optional ones preceded by BRAZERO or BRAMINZERO. */
1220    
1221      case OP_BRAZERO:      case OP_BRAZERO:
1222        {        {
1223        next = ecode+1;        next = ecode+1;
1224        RMATCH(rrc, eptr, next, offset_top, md, ims, eptrb, 0);        RMATCH(eptr, next, offset_top, md, ims, eptrb, 0, RM10);
1225        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1226        do next += GET(next,1); while (*next == OP_ALT);        do next += GET(next,1); while (*next == OP_ALT);
1227        ecode = next + 1 + LINK_SIZE;        ecode = next + 1 + LINK_SIZE;
# Line 1090  for (;;) Line 1232  for (;;)
1232        {        {
1233        next = ecode+1;        next = ecode+1;
1234        do next += GET(next, 1); while (*next == OP_ALT);        do next += GET(next, 1); while (*next == OP_ALT);
1235        RMATCH(rrc, eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);        RMATCH(eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0, RM11);
1236        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1237        ecode++;        ecode++;
1238        }        }
1239      break;      break;
1240    
1241        case OP_SKIPZERO:
1242          {
1243          next = ecode+1;
1244          do next += GET(next,1); while (*next == OP_ALT);
1245          ecode = next + 1 + LINK_SIZE;
1246          }
1247        break;
1248    
1249      /* End of a group, repeated or non-repeating. */      /* End of a group, repeated or non-repeating. */
1250    
1251      case OP_KET:      case OP_KET:
# Line 1160  for (;;) Line 1310  for (;;)
1310          recursion_info *rec = md->recursive;          recursion_info *rec = md->recursive;
1311          DPRINTF(("Recursion (%d) succeeded - continuing\n", number));          DPRINTF(("Recursion (%d) succeeded - continuing\n", number));
1312          md->recursive = rec->prevrec;          md->recursive = rec->prevrec;
1313          md->start_match = rec->save_start;          mstart = rec->save_start;
1314          memcpy(md->offset_vector, rec->offset_save,          memcpy(md->offset_vector, rec->offset_save,
1315            rec->saved_max * sizeof(int));            rec->saved_max * sizeof(int));
1316          ecode = rec->after_call;          ecode = rec->after_call;
# Line 1189  for (;;) Line 1339  for (;;)
1339    
1340      /* The repeating kets try the rest of the pattern or restart from the      /* The repeating kets try the rest of the pattern or restart from the
1341      preceding bracket, in the appropriate order. In the second case, we can use      preceding bracket, in the appropriate order. In the second case, we can use
1342      tail recursion to avoid using another stack frame. */      tail recursion to avoid using another stack frame, unless we have an
1343        unlimited repeat of a group that can match an empty string. */
1344    
1345      flags = (*prev >= OP_SBRA)? match_cbegroup : 0;      flags = (*prev >= OP_SBRA)? match_cbegroup : 0;
1346    
1347      if (*ecode == OP_KETRMIN)      if (*ecode == OP_KETRMIN)
1348        {        {
1349        RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM12);
1350        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1351          if (flags != 0)    /* Could match an empty string */
1352            {
1353            RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM50);
1354            RRETURN(rrc);
1355            }
1356        ecode = prev;        ecode = prev;
       flags |= match_tail_recursed;  
1357        goto TAIL_RECURSE;        goto TAIL_RECURSE;
1358        }        }
1359      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
1360        {        {
1361        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, flags);        RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM13);
1362        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1363        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
1364        flags = match_tail_recursed;        flags = 0;
1365        goto TAIL_RECURSE;        goto TAIL_RECURSE;
1366        }        }
1367      /* Control never gets here */      /* Control never gets here */
# Line 1239  for (;;) Line 1394  for (;;)
1394      ecode++;      ecode++;
1395      break;      break;
1396    
1397        /* Reset the start of match point */
1398    
1399        case OP_SET_SOM:
1400        mstart = eptr;
1401        ecode++;
1402        break;
1403    
1404      /* Assert before internal newline if multiline, or before a terminating      /* Assert before internal newline if multiline, or before a terminating
1405      newline unless endonly is set, else end of subject unless noteol is set. */      newline unless endonly is set, else end of subject unless noteol is set. */
1406    
# Line 1331  for (;;) Line 1493  for (;;)
1493      /* Match a single character type; inline for speed */      /* Match a single character type; inline for speed */
1494    
1495      case OP_ANY:      case OP_ANY:
1496      if ((ims & PCRE_DOTALL) == 0)      if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
1497        {      /* Fall through */
1498        if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);  
1499        }      case OP_ALLANY:
1500      if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);
1501      if (utf8)      if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
       while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;  
1502      ecode++;      ecode++;
1503      break;      break;
1504    
# Line 1436  for (;;) Line 1597  for (;;)
1597        case 0x000d:        case 0x000d:
1598        if (eptr < md->end_subject && *eptr == 0x0a) eptr++;        if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
1599        break;        break;
1600    
1601        case 0x000a:        case 0x000a:
1602          break;
1603    
1604        case 0x000b:        case 0x000b:
1605        case 0x000c:        case 0x000c:
1606        case 0x0085:        case 0x0085:
1607        case 0x2028:        case 0x2028:
1608        case 0x2029:        case 0x2029:
1609          if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
1610          break;
1611          }
1612        ecode++;
1613        break;
1614    
1615        case OP_NOT_HSPACE:
1616        if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1617        GETCHARINCTEST(c, eptr);
1618        switch(c)
1619          {
1620          default: break;
1621          case 0x09:      /* HT */
1622          case 0x20:      /* SPACE */
1623          case 0xa0:      /* NBSP */
1624          case 0x1680:    /* OGHAM SPACE MARK */
1625          case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
1626          case 0x2000:    /* EN QUAD */
1627          case 0x2001:    /* EM QUAD */
1628          case 0x2002:    /* EN SPACE */
1629          case 0x2003:    /* EM SPACE */
1630          case 0x2004:    /* THREE-PER-EM SPACE */
1631          case 0x2005:    /* FOUR-PER-EM SPACE */
1632          case 0x2006:    /* SIX-PER-EM SPACE */
1633          case 0x2007:    /* FIGURE SPACE */
1634          case 0x2008:    /* PUNCTUATION SPACE */
1635          case 0x2009:    /* THIN SPACE */
1636          case 0x200A:    /* HAIR SPACE */
1637          case 0x202f:    /* NARROW NO-BREAK SPACE */
1638          case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
1639          case 0x3000:    /* IDEOGRAPHIC SPACE */
1640          RRETURN(MATCH_NOMATCH);
1641          }
1642        ecode++;
1643        break;
1644    
1645        case OP_HSPACE:
1646        if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1647        GETCHARINCTEST(c, eptr);
1648        switch(c)
1649          {
1650          default: RRETURN(MATCH_NOMATCH);
1651          case 0x09:      /* HT */
1652          case 0x20:      /* SPACE */
1653          case 0xa0:      /* NBSP */
1654          case 0x1680:    /* OGHAM SPACE MARK */
1655          case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
1656          case 0x2000:    /* EN QUAD */
1657          case 0x2001:    /* EM QUAD */
1658          case 0x2002:    /* EN SPACE */
1659          case 0x2003:    /* EM SPACE */
1660          case 0x2004:    /* THREE-PER-EM SPACE */
1661          case 0x2005:    /* FOUR-PER-EM SPACE */
1662          case 0x2006:    /* SIX-PER-EM SPACE */
1663          case 0x2007:    /* FIGURE SPACE */
1664          case 0x2008:    /* PUNCTUATION SPACE */
1665          case 0x2009:    /* THIN SPACE */
1666          case 0x200A:    /* HAIR SPACE */
1667          case 0x202f:    /* NARROW NO-BREAK SPACE */
1668          case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
1669          case 0x3000:    /* IDEOGRAPHIC SPACE */
1670          break;
1671          }
1672        ecode++;
1673        break;
1674    
1675        case OP_NOT_VSPACE:
1676        if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1677        GETCHARINCTEST(c, eptr);
1678        switch(c)
1679          {
1680          default: break;
1681          case 0x0a:      /* LF */
1682          case 0x0b:      /* VT */
1683          case 0x0c:      /* FF */
1684          case 0x0d:      /* CR */
1685          case 0x85:      /* NEL */
1686          case 0x2028:    /* LINE SEPARATOR */
1687          case 0x2029:    /* PARAGRAPH SEPARATOR */
1688          RRETURN(MATCH_NOMATCH);
1689          }
1690        ecode++;
1691        break;
1692    
1693        case OP_VSPACE:
1694        if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1695        GETCHARINCTEST(c, eptr);
1696        switch(c)
1697          {
1698          default: RRETURN(MATCH_NOMATCH);
1699          case 0x0a:      /* LF */
1700          case 0x0b:      /* VT */
1701          case 0x0c:      /* FF */
1702          case 0x0d:      /* CR */
1703          case 0x85:      /* NEL */
1704          case 0x2028:    /* LINE SEPARATOR */
1705          case 0x2029:    /* PARAGRAPH SEPARATOR */
1706        break;        break;
1707        }        }
1708      ecode++;      ecode++;
# Line 1456  for (;;) Line 1717  for (;;)
1717      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1718      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1719        {        {
1720        int chartype, script;        const ucd_record *prop = GET_UCD(c);
       int category = _pcre_ucp_findprop(c, &chartype, &script);  
1721    
1722        switch(ecode[1])        switch(ecode[1])
1723          {          {
# Line 1466  for (;;) Line 1726  for (;;)
1726          break;          break;
1727    
1728          case PT_LAMP:          case PT_LAMP:
1729          if ((chartype == ucp_Lu ||          if ((prop->chartype == ucp_Lu ||
1730               chartype == ucp_Ll ||               prop->chartype == ucp_Ll ||
1731               chartype == ucp_Lt) == (op == OP_NOTPROP))               prop->chartype == ucp_Lt) == (op == OP_NOTPROP))
1732            RRETURN(MATCH_NOMATCH);            RRETURN(MATCH_NOMATCH);
1733           break;           break;
1734    
1735          case PT_GC:          case PT_GC:
1736          if ((ecode[2] != category) == (op == OP_PROP))          if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP))
1737            RRETURN(MATCH_NOMATCH);            RRETURN(MATCH_NOMATCH);
1738          break;          break;
1739    
1740          case PT_PC:          case PT_PC:
1741          if ((ecode[2] != chartype) == (op == OP_PROP))          if ((ecode[2] != prop->chartype) == (op == OP_PROP))
1742            RRETURN(MATCH_NOMATCH);            RRETURN(MATCH_NOMATCH);
1743          break;          break;
1744    
1745          case PT_SC:          case PT_SC:
1746          if ((ecode[2] != script) == (op == OP_PROP))          if ((ecode[2] != prop->script) == (op == OP_PROP))
1747            RRETURN(MATCH_NOMATCH);            RRETURN(MATCH_NOMATCH);
1748          break;          break;
1749    
# Line 1502  for (;;) Line 1762  for (;;)
1762      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1763      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1764        {        {
1765        int chartype, script;        int category = UCD_CATEGORY(c);
       int category = _pcre_ucp_findprop(c, &chartype, &script);  
1766        if (category == ucp_M) RRETURN(MATCH_NOMATCH);        if (category == ucp_M) RRETURN(MATCH_NOMATCH);
1767        while (eptr < md->end_subject)        while (eptr < md->end_subject)
1768          {          {
# Line 1512  for (;;) Line 1771  for (;;)
1771            {            {
1772            GETCHARLEN(c, eptr, len);            GETCHARLEN(c, eptr, len);
1773            }            }
1774          category = _pcre_ucp_findprop(c, &chartype, &script);          category = UCD_CATEGORY(c);
1775          if (category != ucp_M) break;          if (category != ucp_M) break;
1776          eptr += len;          eptr += len;
1777          }          }
# Line 1533  for (;;) Line 1792  for (;;)
1792      case OP_REF:      case OP_REF:
1793        {        {
1794        offset = GET2(ecode, 1) << 1;               /* Doubled ref number */        offset = GET2(ecode, 1) << 1;               /* Doubled ref number */
1795        ecode += 3;                                 /* Advance past item */        ecode += 3;
1796    
1797        /* If the reference is unset, set the length to be longer than the amount        /* If the reference is unset, there are two possibilities:
1798        of subject left; this ensures that every attempt at a match fails. We  
1799        can't just fail here, because of the possibility of quantifiers with zero        (a) In the default, Perl-compatible state, set the length to be longer
1800        minima. */        than the amount of subject left; this ensures that every attempt at a
1801          match fails. We can't just fail here, because of the possibility of
1802        length = (offset >= offset_top || md->offset_vector[offset] < 0)?        quantifiers with zero minima.
1803          md->end_subject - eptr + 1 :  
1804          md->offset_vector[offset+1] - md->offset_vector[offset];        (b) If the JavaScript compatibility flag is set, set the length to zero
1805          so that the back reference matches an empty string.
1806    
1807          Otherwise, set the length to the length of what was matched by the
1808          referenced subpattern. */
1809    
1810          if (offset >= offset_top || md->offset_vector[offset] < 0)
1811            length = (md->jscript_compat)? 0 : md->end_subject - eptr + 1;
1812          else
1813            length = md->offset_vector[offset+1] - md->offset_vector[offset];
1814    
1815        /* Set up for repetition, or handle the non-repeated case */        /* Set up for repetition, or handle the non-repeated case */
1816    
# Line 1602  for (;;) Line 1870  for (;;)
1870          {          {
1871          for (fi = min;; fi++)          for (fi = min;; fi++)
1872            {            {
1873            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14);
1874            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1875            if (fi >= max || !match_ref(offset, eptr, length, md, ims))            if (fi >= max || !match_ref(offset, eptr, length, md, ims))
1876              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
# Line 1623  for (;;) Line 1891  for (;;)
1891            }            }
1892          while (eptr >= pp)          while (eptr >= pp)
1893            {            {
1894            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15);
1895            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1896            eptr -= length;            eptr -= length;
1897            }            }
# Line 1728  for (;;) Line 1996  for (;;)
1996            {            {
1997            for (fi = min;; fi++)            for (fi = min;; fi++)
1998              {              {
1999              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16);
2000              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2001              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2002              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
# Line 1748  for (;;) Line 2016  for (;;)
2016            {            {
2017            for (fi = min;; fi++)            for (fi = min;; fi++)
2018              {              {
2019              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17);
2020              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2021              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2022              c = *eptr++;              c = *eptr++;
# Line 1785  for (;;) Line 2053  for (;;)
2053              }              }
2054            for (;;)            for (;;)
2055              {              {
2056              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM18);
2057              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2058              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
2059              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 1804  for (;;) Line 2072  for (;;)
2072              }              }
2073            while (eptr >= pp)            while (eptr >= pp)
2074              {              {
2075              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM19);
2076              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2077              eptr--;              eptr--;
2078              }              }
# Line 1817  for (;;) Line 2085  for (;;)
2085    
2086    
2087      /* Match an extended character class. This opcode is encountered only      /* Match an extended character class. This opcode is encountered only
2088      in UTF-8 mode, because that's the only time it is compiled. */      when UTF-8 mode mode is supported. Nevertheless, we may not be in UTF-8
2089        mode, because Unicode properties are supported in non-UTF-8 mode. */
2090    
2091  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2092      case OP_XCLASS:      case OP_XCLASS:
# Line 1859  for (;;) Line 2128  for (;;)
2128        for (i = 1; i <= min; i++)        for (i = 1; i <= min; i++)
2129          {          {
2130          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2131          GETCHARINC(c, eptr);          GETCHARINCTEST(c, eptr);
2132          if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);          if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);
2133          }          }
2134    
# Line 1875  for (;;) Line 2144  for (;;)
2144          {          {
2145          for (fi = min;; fi++)          for (fi = min;; fi++)
2146            {            {
2147            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20);
2148            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2149            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2150            GETCHARINC(c, eptr);            GETCHARINCTEST(c, eptr);
2151            if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);            if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);
2152            }            }
2153          /* Control never gets here */          /* Control never gets here */
# Line 1893  for (;;) Line 2162  for (;;)
2162            {            {
2163            int len = 1;            int len = 1;
2164            if (eptr >= md->end_subject) break;            if (eptr >= md->end_subject) break;
2165            GETCHARLEN(c, eptr, len);            GETCHARLENTEST(c, eptr, len);
2166            if (!_pcre_xclass(c, data)) break;            if (!_pcre_xclass(c, data)) break;
2167            eptr += len;            eptr += len;
2168            }            }
2169          for(;;)          for(;;)
2170            {            {
2171            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM21);
2172            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2173            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
2174            BACKCHAR(eptr)            if (utf8) BACKCHAR(eptr);
2175            }            }
2176          RRETURN(MATCH_NOMATCH);          RRETURN(MATCH_NOMATCH);
2177          }          }
# Line 1968  for (;;) Line 2237  for (;;)
2237          if (fc != dc)          if (fc != dc)
2238            {            {
2239  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2240            if (dc != _pcre_ucp_othercase(fc))            if (dc != UCD_OTHERCASE(fc))
2241  #endif  #endif
2242              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
2243            }            }
# Line 2059  for (;;) Line 2328  for (;;)
2328  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2329          unsigned int othercase;          unsigned int othercase;
2330          if ((ims & PCRE_CASELESS) != 0 &&          if ((ims & PCRE_CASELESS) != 0 &&
2331              (othercase = _pcre_ucp_othercase(fc)) != NOTACHAR)              (othercase = UCD_OTHERCASE(fc)) != fc)
2332            oclength = _pcre_ord2utf8(othercase, occhars);            oclength = _pcre_ord2utf8(othercase, occhars);
2333          else oclength = 0;          else oclength = 0;
2334  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
# Line 2086  for (;;) Line 2355  for (;;)
2355            {            {
2356            for (fi = min;; fi++)            for (fi = min;; fi++)
2357              {              {
2358              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22);
2359              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2360              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2361              if (memcmp(eptr, charptr, length) == 0) eptr += length;              if (memcmp(eptr, charptr, length) == 0) eptr += length;
# Line 2127  for (;;) Line 2396  for (;;)
2396            if (possessive) continue;            if (possessive) continue;
2397            for(;;)            for(;;)
2398             {             {
2399             RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);             RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23);
2400             if (rrc != MATCH_NOMATCH) RRETURN(rrc);             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2401             if (eptr == pp) RRETURN(MATCH_NOMATCH);             if (eptr == pp) RRETURN(MATCH_NOMATCH);
2402  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2176  for (;;) Line 2445  for (;;)
2445          {          {
2446          for (fi = min;; fi++)          for (fi = min;; fi++)
2447            {            {
2448            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24);
2449            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2450            if (fi >= max || eptr >= md->end_subject ||            if (fi >= max || eptr >= md->end_subject ||
2451                fc != md->lcc[*eptr++])                fc != md->lcc[*eptr++])
# Line 2195  for (;;) Line 2464  for (;;)
2464          if (possessive) continue;          if (possessive) continue;
2465          while (eptr >= pp)          while (eptr >= pp)
2466            {            {
2467            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM25);
2468            eptr--;            eptr--;
2469            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2470            }            }
# Line 2214  for (;;) Line 2483  for (;;)
2483          {          {
2484          for (fi = min;; fi++)          for (fi = min;; fi++)
2485            {            {
2486            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26);
2487            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2488            if (fi >= max || eptr >= md->end_subject || fc != *eptr++)            if (fi >= max || eptr >= md->end_subject || fc != *eptr++)
2489              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
# Line 2232  for (;;) Line 2501  for (;;)
2501          if (possessive) continue;          if (possessive) continue;
2502          while (eptr >= pp)          while (eptr >= pp)
2503            {            {
2504            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM27);
2505            eptr--;            eptr--;
2506            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2507            }            }
# Line 2377  for (;;) Line 2646  for (;;)
2646            register unsigned int d;            register unsigned int d;
2647            for (fi = min;; fi++)            for (fi = min;; fi++)
2648              {              {
2649              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28);
2650              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2651                if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2652              GETCHARINC(d, eptr);              GETCHARINC(d, eptr);
2653              if (d < 256) d = md->lcc[d];              if (d < 256) d = md->lcc[d];
2654              if (fi >= max || eptr >= md->end_subject || fc == d)              if (fc == d) RRETURN(MATCH_NOMATCH);
2655                RRETURN(MATCH_NOMATCH);  
2656              }              }
2657            }            }
2658          else          else
# Line 2391  for (;;) Line 2661  for (;;)
2661            {            {
2662            for (fi = min;; fi++)            for (fi = min;; fi++)
2663              {              {
2664              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29);
2665              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2666              if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++])              if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++])
2667                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
# Line 2423  for (;;) Line 2693  for (;;)
2693          if (possessive) continue;          if (possessive) continue;
2694          for(;;)          for(;;)
2695              {              {
2696              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM30);
2697              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2698              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
2699              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 2441  for (;;) Line 2711  for (;;)
2711            if (possessive) continue;            if (possessive) continue;
2712            while (eptr >= pp)            while (eptr >= pp)
2713              {              {
2714              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM31);
2715              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2716              eptr--;              eptr--;
2717              }              }
# Line 2486  for (;;) Line 2756  for (;;)
2756            register unsigned int d;            register unsigned int d;
2757            for (fi = min;; fi++)            for (fi = min;; fi++)
2758              {              {
2759              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32);
2760              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2761                if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2762              GETCHARINC(d, eptr);              GETCHARINC(d, eptr);
2763              if (fi >= max || eptr >= md->end_subject || fc == d)              if (fc == d) RRETURN(MATCH_NOMATCH);
               RRETURN(MATCH_NOMATCH);  
2764              }              }
2765            }            }
2766          else          else
# Line 2499  for (;;) Line 2769  for (;;)
2769            {            {
2770            for (fi = min;; fi++)            for (fi = min;; fi++)
2771              {              {
2772              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33);
2773              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2774              if (fi >= max || eptr >= md->end_subject || fc == *eptr++)              if (fi >= max || eptr >= md->end_subject || fc == *eptr++)
2775                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
# Line 2530  for (;;) Line 2800  for (;;)
2800            if (possessive) continue;            if (possessive) continue;
2801            for(;;)            for(;;)
2802              {              {
2803              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM34);
2804              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2805              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
2806              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 2548  for (;;) Line 2818  for (;;)
2818            if (possessive) continue;            if (possessive) continue;
2819            while (eptr >= pp)            while (eptr >= pp)
2820              {              {
2821              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM35);
2822              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2823              eptr--;              eptr--;
2824              }              }
# Line 2655  for (;;) Line 2925  for (;;)
2925            for (i = 1; i <= min; i++)            for (i = 1; i <= min; i++)
2926              {              {
2927              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2928              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
2929              }              }
2930            break;            break;
2931    
# Line 2663  for (;;) Line 2933  for (;;)
2933            for (i = 1; i <= min; i++)            for (i = 1; i <= min; i++)
2934              {              {
2935              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2936              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
2937              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_chartype = UCD_CHARTYPE(c);
2938              if ((prop_chartype == ucp_Lu ||              if ((prop_chartype == ucp_Lu ||
2939                   prop_chartype == ucp_Ll ||                   prop_chartype == ucp_Ll ||
2940                   prop_chartype == ucp_Lt) == prop_fail_result)                   prop_chartype == ucp_Lt) == prop_fail_result)
# Line 2676  for (;;) Line 2946  for (;;)
2946            for (i = 1; i <= min; i++)            for (i = 1; i <= min; i++)
2947              {              {
2948              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2949              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
2950              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_category = UCD_CATEGORY(c);
2951              if ((prop_category == prop_value) == prop_fail_result)              if ((prop_category == prop_value) == prop_fail_result)
2952                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
2953              }              }
# Line 2687  for (;;) Line 2957  for (;;)
2957            for (i = 1; i <= min; i++)            for (i = 1; i <= min; i++)
2958              {              {
2959              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2960              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
2961              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_chartype = UCD_CHARTYPE(c);
2962              if ((prop_chartype == prop_value) == prop_fail_result)              if ((prop_chartype == prop_value) == prop_fail_result)
2963                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
2964              }              }
# Line 2698  for (;;) Line 2968  for (;;)
2968            for (i = 1; i <= min; i++)            for (i = 1; i <= min; i++)
2969              {              {
2970              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2971              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
2972              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_script = UCD_SCRIPT(c);
2973              if ((prop_script == prop_value) == prop_fail_result)              if ((prop_script == prop_value) == prop_fail_result)
2974                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
2975              }              }
# Line 2718  for (;;) Line 2988  for (;;)
2988          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
2989            {            {
2990            GETCHARINCTEST(c, eptr);            GETCHARINCTEST(c, eptr);
2991            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);            prop_category = UCD_CATEGORY(c);
2992            if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);            if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);
2993            while (eptr < md->end_subject)            while (eptr < md->end_subject)
2994              {              {
# Line 2727  for (;;) Line 2997  for (;;)
2997                {                {
2998                GETCHARLEN(c, eptr, len);                GETCHARLEN(c, eptr, len);
2999                }                }
3000              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_category = UCD_CATEGORY(c);
3001              if (prop_category != ucp_M) break;              if (prop_category != ucp_M) break;
3002              eptr += len;              eptr += len;
3003              }              }
# Line 2745  for (;;) Line 3015  for (;;)
3015          case OP_ANY:          case OP_ANY:
3016          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
3017            {            {
3018            if (eptr >= md->end_subject ||            if (eptr >= md->end_subject || IS_NEWLINE(eptr))
                ((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr)))  
3019              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
3020            eptr++;            eptr++;
3021            while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;            while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
3022            }            }
3023          break;          break;
3024    
3025            case OP_ALLANY:
3026            for (i = 1; i <= min; i++)
3027              {
3028              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3029              eptr++;
3030              while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
3031              }
3032            break;
3033    
3034          case OP_ANYBYTE:          case OP_ANYBYTE:
3035          eptr += min;          eptr += min;
3036          break;          break;
# Line 2768  for (;;) Line 3046  for (;;)
3046              case 0x000d:              case 0x000d:
3047              if (eptr < md->end_subject && *eptr == 0x0a) eptr++;              if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
3048              break;              break;
3049    
3050              case 0x000a:              case 0x000a:
3051                break;
3052    
3053              case 0x000b:              case 0x000b:
3054              case 0x000c:              case 0x000c:
3055              case 0x0085:              case 0x0085:
3056              case 0x2028:              case 0x2028:
3057              case 0x2029:              case 0x2029:
3058                if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
3059                break;
3060                }
3061              }
3062            break;
3063    
3064            case OP_NOT_HSPACE:
3065            for (i = 1; i <= min; i++)
3066              {
3067              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3068              GETCHARINC(c, eptr);
3069              switch(c)
3070                {
3071                default: break;
3072                case 0x09:      /* HT */
3073                case 0x20:      /* SPACE */
3074                case 0xa0:      /* NBSP */
3075                case 0x1680:    /* OGHAM SPACE MARK */
3076                case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
3077                case 0x2000:    /* EN QUAD */
3078                case 0x2001:    /* EM QUAD */
3079                case 0x2002:    /* EN SPACE */
3080                case 0x2003:    /* EM SPACE */
3081                case 0x2004:    /* THREE-PER-EM SPACE */
3082                case 0x2005:    /* FOUR-PER-EM SPACE */
3083                case 0x2006:    /* SIX-PER-EM SPACE */
3084                case 0x2007:    /* FIGURE SPACE */
3085                case 0x2008:    /* PUNCTUATION SPACE */
3086                case 0x2009:    /* THIN SPACE */
3087                case 0x200A:    /* HAIR SPACE */
3088                case 0x202f:    /* NARROW NO-BREAK SPACE */
3089                case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
3090                case 0x3000:    /* IDEOGRAPHIC SPACE */
3091                RRETURN(MATCH_NOMATCH);
3092                }
3093              }
3094            break;
3095    
3096            case OP_HSPACE:
3097            for (i = 1; i <= min; i++)
3098              {
3099              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3100              GETCHARINC(c, eptr);
3101              switch(c)
3102                {
3103                default: RRETURN(MATCH_NOMATCH);
3104                case 0x09:      /* HT */
3105                case 0x20:      /* SPACE */
3106                case 0xa0:      /* NBSP */
3107                case 0x1680:    /* OGHAM SPACE MARK */
3108                case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
3109                case 0x2000:    /* EN QUAD */
3110                case 0x2001:    /* EM QUAD */
3111                case 0x2002:    /* EN SPACE */
3112                case 0x2003:    /* EM SPACE */
3113                case 0x2004:    /* THREE-PER-EM SPACE */
3114                case 0x2005:    /* FOUR-PER-EM SPACE */
3115                case 0x2006:    /* SIX-PER-EM SPACE */
3116                case 0x2007:    /* FIGURE SPACE */
3117                case 0x2008:    /* PUNCTUATION SPACE */
3118                case 0x2009:    /* THIN SPACE */
3119                case 0x200A:    /* HAIR SPACE */
3120                case 0x202f:    /* NARROW NO-BREAK SPACE */
3121                case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
3122                case 0x3000:    /* IDEOGRAPHIC SPACE */
3123                break;
3124                }
3125              }
3126            break;
3127    
3128            case OP_NOT_VSPACE:
3129            for (i = 1; i <= min; i++)
3130              {
3131              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3132              GETCHARINC(c, eptr);
3133              switch(c)
3134                {
3135                default: break;
3136                case 0x0a:      /* LF */
3137                case 0x0b:      /* VT */
3138                case 0x0c:      /* FF */
3139                case 0x0d:      /* CR */
3140                case 0x85:      /* NEL */
3141                case 0x2028:    /* LINE SEPARATOR */
3142                case 0x2029:    /* PARAGRAPH SEPARATOR */
3143                RRETURN(MATCH_NOMATCH);
3144                }
3145              }
3146            break;
3147    
3148            case OP_VSPACE:
3149            for (i = 1; i <= min; i++)
3150              {
3151              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3152              GETCHARINC(c, eptr);
3153              switch(c)
3154                {
3155                default: RRETURN(MATCH_NOMATCH);
3156                case 0x0a:      /* LF */
3157                case 0x0b:      /* VT */
3158                case 0x0c:      /* FF */
3159                case 0x0d:      /* CR */
3160                case 0x85:      /* NEL */
3161                case 0x2028:    /* LINE SEPARATOR */
3162                case 0x2029:    /* PARAGRAPH SEPARATOR */
3163              break;              break;
3164              }              }
3165            }            }
# Line 2803  for (;;) Line 3189  for (;;)
3189          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
3190            {            {
3191            if (eptr >= md->end_subject ||            if (eptr >= md->end_subject ||
3192               (*eptr < 128 && (md->ctypes[*eptr++] & ctype_space) != 0))               (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0))
3193              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
3194            while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;            while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
3195            }            }
3196          break;          break;
3197    
# Line 2823  for (;;) Line 3209  for (;;)
3209          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
3210            {            {
3211            if (eptr >= md->end_subject ||            if (eptr >= md->end_subject ||
3212               (*eptr < 128 && (md->ctypes[*eptr++] & ctype_word) != 0))               (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0))
3213              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
3214            while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;            while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
3215            }            }
3216          break;          break;
3217    
# Line 2853  for (;;) Line 3239  for (;;)
3239        switch(ctype)        switch(ctype)
3240          {          {
3241          case OP_ANY:          case OP_ANY:
3242          if ((ims & PCRE_DOTALL) == 0)          for (i = 1; i <= min; i++)
3243            {            {
3244            for (i = 1; i <= min; i++)            if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
3245              {            eptr++;
             if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);  
             eptr++;  
             }  
3246            }            }
3247          else eptr += min;          break;
3248    
3249            case OP_ALLANY:
3250            eptr += min;
3251          break;          break;
3252    
3253          case OP_ANYBYTE:          case OP_ANYBYTE:
# Line 2882  for (;;) Line 3268  for (;;)
3268              if (eptr < md->end_subject && *eptr == 0x0a) eptr++;              if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
3269              break;              break;
3270              case 0x000a:              case 0x000a:
3271                break;
3272    
3273              case 0x000b:              case 0x000b:
3274              case 0x000c:              case 0x000c:
3275              case 0x0085:              case 0x0085:
3276                if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
3277                break;
3278                }
3279              }
3280            break;
3281    
3282            case OP_NOT_HSPACE:
3283            for (i = 1; i <= min; i++)
3284              {
3285              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3286              switch(*eptr++)
3287                {
3288                default: break;
3289                case 0x09:      /* HT */
3290                case 0x20:      /* SPACE */
3291                case 0xa0:      /* NBSP */
3292                RRETURN(MATCH_NOMATCH);
3293                }
3294              }
3295            break;
3296    
3297            case OP_HSPACE:
3298            for (i = 1; i <= min; i++)
3299              {
3300              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3301              switch(*eptr++)
3302                {
3303                default: RRETURN(MATCH_NOMATCH);
3304                case 0x09:      /* HT */
3305                case 0x20:      /* SPACE */
3306                case 0xa0:      /* NBSP */
3307                break;
3308                }
3309              }
3310            break;
3311    
3312            case OP_NOT_VSPACE:
3313            for (i = 1; i <= min; i++)
3314              {
3315              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3316              switch(*eptr++)
3317                {
3318                default: break;
3319                case 0x0a:      /* LF */
3320                case 0x0b:      /* VT */
3321                case 0x0c:      /* FF */
3322                case 0x0d:      /* CR */
3323                case 0x85:      /* NEL */
3324                RRETURN(MATCH_NOMATCH);
3325                }
3326              }
3327            break;
3328    
3329            case OP_VSPACE:
3330            for (i = 1; i <= min; i++)
3331              {
3332              if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3333              switch(*eptr++)
3334                {
3335                default: RRETURN(MATCH_NOMATCH);
3336                case 0x0a:      /* LF */
3337                case 0x0b:      /* VT */
3338                case 0x0c:      /* FF */
3339                case 0x0d:      /* CR */
3340                case 0x85:      /* NEL */
3341              break;              break;
3342              }              }
3343            }            }
# Line 2945  for (;;) Line 3398  for (;;)
3398            case PT_ANY:            case PT_ANY:
3399            for (fi = min;; fi++)            for (fi = min;; fi++)
3400              {              {
3401              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36);
3402              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3403              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3404              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
# Line 2956  for (;;) Line 3409  for (;;)
3409            case PT_LAMP:            case PT_LAMP:
3410            for (fi = min;; fi++)            for (fi = min;; fi++)
3411              {              {
3412              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37);
3413              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3414              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3415              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
3416              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_chartype = UCD_CHARTYPE(c);
3417              if ((prop_chartype == ucp_Lu ||              if ((prop_chartype == ucp_Lu ||
3418                   prop_chartype == ucp_Ll ||                   prop_chartype == ucp_Ll ||
3419                   prop_chartype == ucp_Lt) == prop_fail_result)                   prop_chartype == ucp_Lt) == prop_fail_result)
# Line 2971  for (;;) Line 3424  for (;;)
3424            case PT_GC:            case PT_GC:
3425            for (fi = min;; fi++)            for (fi = min;; fi++)
3426              {              {
3427              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38);
3428              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3429              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3430              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
3431              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_category = UCD_CATEGORY(c);
3432              if ((prop_category == prop_value) == prop_fail_result)              if ((prop_category == prop_value) == prop_fail_result)
3433                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
3434              }              }
# Line 2984  for (;;) Line 3437  for (;;)
3437            case PT_PC:            case PT_PC:
3438            for (fi = min;; fi++)            for (fi = min;; fi++)
3439              {              {
3440              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
3441              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3442              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3443              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
3444              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_chartype = UCD_CHARTYPE(c);
3445              if ((prop_chartype == prop_value) == prop_fail_result)              if ((prop_chartype == prop_value) == prop_fail_result)
3446                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
3447              }              }
# Line 2997  for (;;) Line 3450  for (;;)
3450            case PT_SC:            case PT_SC:
3451            for (fi = min;; fi++)            for (fi = min;; fi++)
3452              {              {
3453              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40);
3454              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3455              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3456              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
3457              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_script = UCD_SCRIPT(c);
3458              if ((prop_script == prop_value) == prop_fail_result)              if ((prop_script == prop_value) == prop_fail_result)
3459                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
3460              }              }
# Line 3019  for (;;) Line 3472  for (;;)
3472          {          {
3473          for (fi = min;; fi++)          for (fi = min;; fi++)
3474            {            {
3475            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41);
3476            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3477            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3478            GETCHARINCTEST(c, eptr);            GETCHARINCTEST(c, eptr);
3479            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);            prop_category = UCD_CATEGORY(c);
3480            if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);            if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);
3481            while (eptr < md->end_subject)            while (eptr < md->end_subject)
3482              {              {
# Line 3032  for (;;) Line 3485  for (;;)
3485                {                {
3486                GETCHARLEN(c, eptr, len);                GETCHARLEN(c, eptr, len);
3487                }                }
3488              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_category = UCD_CATEGORY(c);
3489              if (prop_category != ucp_M) break;              if (prop_category != ucp_M) break;
3490              eptr += len;              eptr += len;
3491              }              }
# Line 3048  for (;;) Line 3501  for (;;)
3501          {          {
3502          for (fi = min;; fi++)          for (fi = min;; fi++)
3503            {            {
3504            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42);
3505            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3506            if (fi >= max || eptr >= md->end_subject ||            if (fi >= max || eptr >= md->end_subject ||
3507                 (ctype == OP_ANY && (ims & PCRE_DOTALL) == 0 &&                 (ctype == OP_ANY && IS_NEWLINE(eptr)))
                 IS_NEWLINE(eptr)))  
3508              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
3509    
3510            GETCHARINC(c, eptr);            GETCHARINC(c, eptr);
3511            switch(ctype)            switch(ctype)
3512              {              {
3513              case OP_ANY:        /* This is the DOTALL case */              case OP_ANY:        /* This is the non-NL case */
3514              break;              case OP_ALLANY:
   
3515              case OP_ANYBYTE:              case OP_ANYBYTE:
3516              break;              break;
3517    
# Line 3072  for (;;) Line 3523  for (;;)
3523                if (eptr < md->end_subject && *eptr == 0x0a) eptr++;                if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
3524                break;                break;
3525                case 0x000a:                case 0x000a:
3526                  break;
3527    
3528                case 0x000b:                case 0x000b:
3529                case 0x000c:                case 0x000c:
3530                case 0x0085:                case 0x0085:
3531                case 0x2028:                case 0x2028:
3532                case 0x2029:                case 0x2029:
3533                  if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
3534                  break;
3535                  }
3536                break;
3537    
3538                case OP_NOT_HSPACE:
3539                switch(c)
3540                  {
3541                  default: break;
3542                  case 0x09:      /* HT */
3543                  case 0x20:      /* SPACE */
3544                  case 0xa0:      /* NBSP */
3545                  case 0x1680:    /* OGHAM SPACE MARK */
3546                  case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
3547                  case 0x2000:    /* EN QUAD */
3548                  case 0x2001:    /* EM QUAD */
3549                  case 0x2002:    /* EN SPACE */
3550                  case 0x2003:    /* EM SPACE */
3551                  case 0x2004:    /* THREE-PER-EM SPACE */
3552                  case 0x2005:    /* FOUR-PER-EM SPACE */
3553                  case 0x2006:    /* SIX-PER-EM SPACE */
3554                  case 0x2007:    /* FIGURE SPACE */
3555                  case 0x2008:    /* PUNCTUATION SPACE */
3556                  case 0x2009:    /* THIN SPACE */
3557                  case 0x200A:    /* HAIR SPACE */
3558                  case 0x202f:    /* NARROW NO-BREAK SPACE */
3559                  case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
3560                  case 0x3000:    /* IDEOGRAPHIC SPACE */
3561                  RRETURN(MATCH_NOMATCH);
3562                  }
3563                break;
3564    
3565                case OP_HSPACE:
3566                switch(c)
3567                  {
3568                  default: RRETURN(MATCH_NOMATCH);
3569                  case 0x09:      /* HT */
3570                  case 0x20:      /* SPACE */
3571                  case 0xa0:      /* NBSP */
3572                  case 0x1680:    /* OGHAM SPACE MARK */
3573                  case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
3574                  case 0x2000:    /* EN QUAD */
3575                  case 0x2001:    /* EM QUAD */
3576                  case 0x2002:    /* EN SPACE */
3577                  case 0x2003:    /* EM SPACE */
3578                  case 0x2004:    /* THREE-PER-EM SPACE */
3579                  case 0x2005:    /* FOUR-PER-EM SPACE */
3580                  case 0x2006:    /* SIX-PER-EM SPACE */
3581                  case 0x2007:    /* FIGURE SPACE */
3582                  case 0x2008:    /* PUNCTUATION SPACE */
3583                  case 0x2009:    /* THIN SPACE */
3584                  case 0x200A:    /* HAIR SPACE */
3585                  case 0x202f:    /* NARROW NO-BREAK SPACE */
3586                  case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
3587                  case 0x3000:    /* IDEOGRAPHIC SPACE */
3588                  break;
3589                  }
3590                break;
3591    
3592                case OP_NOT_VSPACE:
3593                switch(c)
3594                  {
3595                  default: break;
3596                  case 0x0a:      /* LF */
3597                  case 0x0b:      /* VT */
3598                  case 0x0c:      /* FF */
3599                  case 0x0d:      /* CR */
3600                  case 0x85:      /* NEL */
3601                  case 0x2028:    /* LINE SEPARATOR */
3602                  case 0x2029:    /* PARAGRAPH SEPARATOR */
3603                  RRETURN(MATCH_NOMATCH);
3604                  }
3605                break;
3606    
3607                case OP_VSPACE:
3608                switch(c)
3609                  {
3610                  default: RRETURN(MATCH_NOMATCH);
3611                  case 0x0a:      /* LF */
3612                  case 0x0b:      /* VT */
3613                  case 0x0c:      /* FF */
3614                  case 0x0d:      /* CR */
3615                  case 0x85:      /* NEL */
3616                  case 0x2028:    /* LINE SEPARATOR */
3617                  case 0x2029:    /* PARAGRAPH SEPARATOR */
3618                break;                break;
3619                }                }
3620              break;              break;
# Line 3122  for (;;) Line 3660  for (;;)
3660          {          {
3661          for (fi = min;; fi++)          for (fi = min;; fi++)
3662            {            {
3663            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43);
3664            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3665            if (fi >= max || eptr >= md->end_subject ||            if (fi >= max || eptr >= md->end_subject ||
3666                 ((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr)))                 (ctype == OP_ANY && IS_NEWLINE(eptr)))
3667              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
3668    
3669            c = *eptr++;            c = *eptr++;
3670            switch(ctype)            switch(ctype)
3671              {              {
3672              case OP_ANY:   /* This is the DOTALL case */              case OP_ANY:     /* This is the non-NL case */
3673              break;              case OP_ALLANY:
   
3674              case OP_ANYBYTE:              case OP_ANYBYTE:
3675              break;              break;
3676    
# Line 3144  for (;;) Line 3681  for (;;)
3681                case 0x000d:                case 0x000d:
3682                if (eptr < md->end_subject && *eptr == 0x0a) eptr++;                if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
3683                break;                break;
3684    
3685                case 0x000a:                case 0x000a:
3686                  break;
3687    
3688                case 0x000b:                case 0x000b:
3689                case 0x000c:                case 0x000c:
3690                case 0x0085:                case 0x0085:
3691                  if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
3692                  break;
3693                  }
3694                break;
3695    
3696                case OP_NOT_HSPACE:
3697                switch(c)
3698                  {
3699                  default: break;
3700                  case 0x09:      /* HT */
3701                  case 0x20:      /* SPACE */
3702                  case 0xa0:      /* NBSP */
3703                  RRETURN(MATCH_NOMATCH);
3704                  }
3705                break;
3706    
3707                case OP_HSPACE:
3708                switch(c)
3709                  {
3710                  default: RRETURN(MATCH_NOMATCH);
3711                  case 0x09:      /* HT */
3712                  case 0x20:      /* SPACE */
3713                  case 0xa0:      /* NBSP */
3714                  break;
3715                  }
3716                break;
3717    
3718                case OP_NOT_VSPACE:
3719                switch(c)
3720                  {
3721                  default: break;
3722                  case 0x0a:      /* LF */
3723                  case 0x0b:      /* VT */
3724                  case 0x0c:      /* FF */
3725                  case 0x0d:      /* CR */
3726                  case 0x85:      /* NEL */
3727                  RRETURN(MATCH_NOMATCH);
3728                  }
3729                break;
3730    
3731                case OP_VSPACE:
3732                switch(c)
3733                  {
3734                  default: RRETURN(MATCH_NOMATCH);
3735                  case 0x0a:      /* LF */
3736                  case 0x0b:      /* VT */
3737                  case 0x0c:      /* FF */
3738                  case 0x0d:      /* CR */
3739                  case 0x85:      /* NEL */
3740                break;                break;
3741                }                }
3742              break;              break;
# Line 3214  for (;;) Line 3803  for (;;)
3803              int len = 1;              int len = 1;
3804              if (eptr >= md->end_subject) break;              if (eptr >= md->end_subject) break;
3805              GETCHARLEN(c, eptr, len);              GETCHARLEN(c, eptr, len);
3806              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_chartype = UCD_CHARTYPE(c);
3807              if ((prop_chartype == ucp_Lu ||              if ((prop_chartype == ucp_Lu ||
3808                   prop_chartype == ucp_Ll ||                   prop_chartype == ucp_Ll ||
3809                   prop_chartype == ucp_Lt) == prop_fail_result)                   prop_chartype == ucp_Lt) == prop_fail_result)
# Line 3229  for (;;) Line 3818  for (;;)
3818              int len = 1;              int len = 1;
3819              if (eptr >= md->end_subject) break;              if (eptr >= md->end_subject) break;
3820              GETCHARLEN(c, eptr, len);              GETCHARLEN(c, eptr, len);
3821              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_category = UCD_CATEGORY(c);
3822              if ((prop_category == prop_value) == prop_fail_result)              if ((prop_category == prop_value) == prop_fail_result)
3823                break;                break;
3824              eptr+= len;              eptr+= len;
# Line 3242  for (;;) Line 3831  for (;;)
3831              int len = 1;              int len = 1;
3832              if (eptr >= md->end_subject) break;              if (eptr >= md->end_subject) break;
3833              GETCHARLEN(c, eptr, len);              GETCHARLEN(c, eptr, len);
3834              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_chartype = UCD_CHARTYPE(c);
3835              if ((prop_chartype == prop_value) == prop_fail_result)              if ((prop_chartype == prop_value) == prop_fail_result)
3836                break;                break;
3837              eptr+= len;              eptr+= len;
# Line 3255  for (;;) Line 3844  for (;;)
3844              int len = 1;              int len = 1;
3845              if (eptr >= md->end_subject) break;              if (eptr >= md->end_subject) break;
3846              GETCHARLEN(c, eptr, len);              GETCHARLEN(c, eptr, len);
3847              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_script = UCD_SCRIPT(c);
3848              if ((prop_script == prop_value) == prop_fail_result)              if ((prop_script == prop_value) == prop_fail_result)
3849                break;                break;
3850              eptr+= len;              eptr+= len;
# Line 3268  for (;;) Line 3857  for (;;)
3857          if (possessive) continue;          if (possessive) continue;
3858          for(;;)          for(;;)
3859            {            {
3860            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM44);
3861            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3862            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
3863            BACKCHAR(eptr);            if (utf8) BACKCHAR(eptr);
3864            }            }
3865          }          }
3866    
# Line 3284  for (;;) Line 3873  for (;;)
3873            {            {
3874            if (eptr >= md->end_subject) break;            if (eptr >= md->end_subject) break;
3875            GETCHARINCTEST(c, eptr);            GETCHARINCTEST(c, eptr);
3876            prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);            prop_category = UCD_CATEGORY(c);
3877            if (prop_category == ucp_M) break;            if (prop_category == ucp_M) break;
3878            while (eptr < md->end_subject)            while (eptr < md->end_subject)
3879              {              {
# Line 3293  for (;;) Line 3882  for (;;)
3882                {                {
3883                GETCHARLEN(c, eptr, len);                GETCHARLEN(c, eptr, len);
3884                }                }
3885              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_category = UCD_CATEGORY(c);
3886              if (prop_category != ucp_M) break;              if (prop_category != ucp_M) break;
3887              eptr += len;              eptr += len;
3888              }              }
# Line 3304  for (;;) Line 3893  for (;;)
3893          if (possessive) continue;          if (possessive) continue;
3894          for(;;)          for(;;)
3895            {            {
3896            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM45);
3897            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3898            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
3899            for (;;)                        /* Move back over one extended */            for (;;)                        /* Move back over one extended */
3900              {              {
3901              int len = 1;              int len = 1;
             BACKCHAR(eptr);  
3902              if (!utf8) c = *eptr; else              if (!utf8) c = *eptr; else
3903                {                {
3904                  BACKCHAR(eptr);
3905                GETCHARLEN(c, eptr, len);                GETCHARLEN(c, eptr, len);
3906                }                }
3907              prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);              prop_category = UCD_CATEGORY(c);
3908              if (prop_category != ucp_M) break;              if (prop_category != ucp_M) break;
3909              eptr--;              eptr--;
3910              }              }
# Line 3333  for (;;) Line 3922  for (;;)
3922          switch(ctype)          switch(ctype)
3923            {            {
3924            case OP_ANY:            case OP_ANY:
   
           /* Special code is required for UTF8, but when the maximum is  
           unlimited we don't need it, so we repeat the non-UTF8 code. This is  
           probably worth it, because .* is quite a common idiom. */  
   
3925            if (max < INT_MAX)            if (max < INT_MAX)
3926              {              {
3927              if ((ims & PCRE_DOTALL) == 0)              for (i = min; i < max; i++)
               {  
               for (i = min; i < max; i++)  
                 {  
                 if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;  
                 eptr++;  
                 while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;  
                 }  
               }  
             else  
3928                {                {
3929                for (i = min; i < max; i++)                if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
3930                  {                eptr++;
3931                  if (eptr >= md->end_subject) break;                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
                 eptr++;  
                 while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;  
                 }  
3932                }                }
3933              }              }
3934    
# Line 3364  for (;;) Line 3936  for (;;)
3936    
3937            else            else
3938              {              {
3939              if ((ims & PCRE_DOTALL) == 0)              for (i = min; i < max; i++)
3940                {                {
3941                for (i = min; i < max; i++)                if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
3942                  {                eptr++;
3943                  if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
                 eptr++;  
                 }  
               break;  
3944                }                }
3945              else              }
3946              break;
3947    
3948              case OP_ALLANY:
3949              if (max < INT_MAX)
3950                {
3951                for (i = min; i < max; i++)
3952                {                {
3953                c = max - min;                if (eptr >= md->end_subject) break;
3954                if (c > (unsigned int)(md->end_subject - eptr))                eptr++;
3955                  c = md->end_subject - eptr;                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
               eptr += c;  
3956                }                }
3957              }              }
3958              else eptr = md->end_subject;   /* Unlimited UTF-8 repeat */
3959            break;            break;
3960    
3961            /* The byte case is the same as non-UTF8 */            /* The byte case is the same as non-UTF8 */
# Line 3405  for (;;) Line 3980  for (;;)
3980                }                }
3981              else              else
3982                {                {
3983                if (c != 0x000a && c != 0x000b && c != 0x000c &&                if (c != 0x000a &&
3984                    c != 0x0085 && c != 0x2028 && c != 0x2029)                    (md->bsr_anycrlf ||
3985                       (c != 0x000b && c != 0x000c &&
3986                        c != 0x0085 && c != 0x2028 && c != 0x2029)))
3987                  break;                  break;
3988                eptr += len;                eptr += len;
3989                }                }
3990              }              }
3991            break;            break;
3992    
3993              case OP_NOT_HSPACE:
3994              case OP_HSPACE:
3995              for (i = min; i < max; i++)
3996                {
3997                BOOL gotspace;
3998                int len = 1;
3999                if (eptr >= md->end_subject) break;
4000                GETCHARLEN(c, eptr, len);
4001                switch(c)
4002                  {
4003                  default: gotspace = FALSE; break;
4004                  case 0x09:      /* HT */
4005                  case 0x20:      /* SPACE */
4006                  case 0xa0:      /* NBSP */
4007                  case 0x1680:    /* OGHAM SPACE MARK */
4008                  case 0x180e:    /* MONGOLIAN VOWEL SEPARATOR */
4009                  case 0x2000:    /* EN QUAD */
4010                  case 0x2001:    /* EM QUAD */
4011                  case 0x2002:    /* EN SPACE */
4012                  case 0x2003:    /* EM SPACE */
4013                  case 0x2004:    /* THREE-PER-EM SPACE */
4014                  case 0x2005:    /* FOUR-PER-EM SPACE */
4015                  case 0x2006:    /* SIX-PER-EM SPACE */
4016                  case 0x2007:    /* FIGURE SPACE */
4017                  case 0x2008:    /* PUNCTUATION SPACE */
4018                  case 0x2009:    /* THIN SPACE */
4019                  case 0x200A:    /* HAIR SPACE */
4020                  case 0x202f:    /* NARROW NO-BREAK SPACE */
4021                  case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
4022                  case 0x3000:    /* IDEOGRAPHIC SPACE */
4023                  gotspace = TRUE;
4024                  break;
4025                  }
4026                if (gotspace == (ctype == OP_NOT_HSPACE)) break;
4027                eptr += len;
4028                }
4029              break;
4030    
4031              case OP_NOT_VSPACE:
4032              case OP_VSPACE:
4033              for (i = min; i < max; i++)
4034                {
4035                BOOL gotspace;
4036                int len = 1;
4037                if (eptr >= md->end_subject) break;
4038                GETCHARLEN(c, eptr, len);
4039                switch(c)
4040                  {
4041                  default: gotspace = FALSE; break;
4042                  case 0x0a:      /* LF */
4043                  case 0x0b:      /* VT */
4044                  case 0x0c:      /* FF */
4045                  case 0x0d:      /* CR */
4046                  case 0x85:      /* NEL */
4047                  case 0x2028:    /* LINE SEPARATOR */
4048                  case 0x2029:    /* PARAGRAPH SEPARATOR */
4049                  gotspace = TRUE;
4050                  break;
4051                  }
4052                if (gotspace == (ctype == OP_NOT_VSPACE)) break;
4053                eptr += len;
4054                }
4055              break;
4056    
4057            case OP_NOT_DIGIT:            case OP_NOT_DIGIT:
4058            for (i = min; i < max; i++)            for (i = min; i < max; i++)
4059              {              {
# Line 3488  for (;;) Line 4129  for (;;)
4129          if (possessive) continue;          if (possessive) continue;
4130          for(;;)          for(;;)
4131            {            {
4132            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM46);
4133            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4134            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
4135            BACKCHAR(eptr);            BACKCHAR(eptr);
4136            }            }
4137          }          }
4138        else        else
4139  #endif  #endif  /* SUPPORT_UTF8 */
4140    
4141        /* Not UTF-8 mode */        /* Not UTF-8 mode */
4142          {          {
4143          switch(ctype)          switch(ctype)
4144            {            {
4145            case OP_ANY:            case OP_ANY:
4146            if ((ims & PCRE_DOTALL) == 0)            for (i = min; i < max; i++)
4147              {              {
4148              for (i = min; i < max; i++)              if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
4149                {              eptr++;
               if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;  
               eptr++;  
               }  
             break;  
4150              }              }
4151            /* For DOTALL case, fall through and treat as \C */            break;
4152    
4153              case OP_ALLANY:
4154            case OP_ANYBYTE:            case OP_ANYBYTE:
4155            c = max - min;            c = max - min;
4156            if (c > (unsigned int)(md->end_subject - eptr))            if (c > (unsigned int)(md->end_subject - eptr))
# Line 3532  for (;;) Line 4170  for (;;)
4170                }                }
4171              else              else
4172                {                {
4173                if (c != 0x000a && c != 0x000b && c != 0x000c && c != 0x0085)                if (c != 0x000a &&
4174                      (md->bsr_anycrlf ||
4175                        (c != 0x000b && c != 0x000c && c != 0x0085)))
4176                  break;                  break;
4177                eptr++;                eptr++;
4178                }                }
4179              }              }
4180            break;            break;
4181    
4182              case OP_NOT_HSPACE:
4183              for (i = min; i < max; i++)
4184                {
4185                if (eptr >= md->end_subject) break;
4186                c = *eptr;
4187                if (c == 0x09 || c == 0x20 || c == 0xa0) break;
4188                eptr++;
4189                }
4190              break;
4191    
4192              case OP_HSPACE:
4193              for (i = min; i < max; i++)
4194                {
4195                if (eptr >= md->end_subject) break;
4196                c = *eptr;
4197                if (c != 0x09 && c != 0x20 && c != 0xa0) break;
4198                eptr++;
4199                }
4200              break;
4201    
4202              case OP_NOT_VSPACE:
4203              for (i = min; i < max; i++)
4204                {
4205                if (eptr >= md->end_subject) break;
4206                c = *eptr;
4207                if (c == 0x0a || c == 0x0b || c == 0x0c || c == 0x0d || c == 0x85)
4208                  break;
4209                eptr++;
4210                }
4211              break;
4212    
4213              case OP_VSPACE:
4214              for (i = min; i < max; i++)
4215                {
4216                if (eptr >= md->end_subject) break;
4217                c = *eptr;
4218                if (c != 0x0a && c != 0x0b && c != 0x0c && c != 0x0d && c != 0x85)
4219                  break;
4220                eptr++;
4221                }
4222              break;
4223    
4224            case OP_NOT_DIGIT:            case OP_NOT_DIGIT:
4225            for (i = min; i < max; i++)            for (i = min; i < max; i++)
4226              {              {
# Line 3602  for (;;) Line 4284  for (;;)
4284          if (possessive) continue;          if (possessive) continue;
4285          while (eptr >= pp)          while (eptr >= pp)
4286            {            {
4287            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM47);
4288            eptr--;            eptr--;
4289            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4290            }            }
# Line 3628  for (;;) Line 4310  for (;;)
4310    
4311    }             /* End of main loop */    }             /* End of main loop */
4312  /* Control never reaches here */  /* Control never reaches here */
4313    
4314    
4315    /* When compiling to use the heap rather than the stack for recursive calls to
4316    match(), the RRETURN() macro jumps here. The number that is saved in
4317    frame->Xwhere indicates which label we actually want to return to. */
4318    
4319    #ifdef NO_RECURSE
4320    #define LBL(val) case val: goto L_RM##val;
4321    HEAP_RETURN:
4322    switch (frame->Xwhere)
4323      {
4324      LBL( 1) LBL( 2) LBL( 3) LBL( 4) LBL( 5) LBL( 6) LBL( 7) LBL( 8)
4325      LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)
4326      LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)
4327      LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)
4328      LBL(53) LBL(54)
4329    #ifdef SUPPORT_UTF8
4330      LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30)
4331      LBL(32) LBL(34) LBL(42) LBL(46)
4332    #ifdef SUPPORT_UCP
4333      LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45)
4334    #endif  /* SUPPORT_UCP */
4335    #endif  /* SUPPORT_UTF8 */
4336      default:
4337      DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere));
4338      return PCRE_ERROR_INTERNAL;
4339      }
4340    #undef LBL
4341    #endif  /* NO_RECURSE */
4342  }  }
4343    
4344    
# Line 3640  Undefine all the macros that were define Line 4351  Undefine all the macros that were define
4351  #ifdef NO_RECURSE  #ifdef NO_RECURSE
4352  #undef eptr  #undef eptr
4353  #undef ecode  #undef ecode
4354    #undef mstart
4355  #undef offset_top  #undef offset_top
4356  #undef ims  #undef ims
4357  #undef eptrb  #undef eptrb
# Line 3712  Returns:          > 0 => success; value Line 4424  Returns:          > 0 => success; value
4424                   < -1 => some kind of unexpected problem                   < -1 => some kind of unexpected problem
4425  */  */
4426    
4427  PCRE_DATA_SCOPE int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
4428  pcre_exec(const pcre *argument_re, const pcre_extra *extra_data,  pcre_exec(const pcre *argument_re, const pcre_extra *extra_data,
4429    PCRE_SPTR subject, int length, int start_offset, int options, int *offsets,    PCRE_SPTR subject, int length, int start_offset, int options, int *offsets,
4430    int offsetcount)    int offsetcount)
# Line 3737  const uschar *start_bits = NULL; Line 4449  const uschar *start_bits = NULL;
4449  USPTR start_match = (USPTR)subject + start_offset;  USPTR start_match = (USPTR)subject + start_offset;
4450  USPTR end_subject;  USPTR end_subject;
4451  USPTR req_byte_ptr = start_match - 1;  USPTR req_byte_ptr = start_match - 1;
 eptrblock eptrchain[EPTR_WORK_SIZE];  
4452    
4453  pcre_study_data internal_study;  pcre_study_data internal_study;
4454  const pcre_study_data *study;  const pcre_study_data *study;
# Line 3800  if (re->magic_number != MAGIC_NUMBER) Line 4511  if (re->magic_number != MAGIC_NUMBER)
4511  /* Set up other data */  /* Set up other data */
4512    
4513  anchored = ((re->options | options) & PCRE_ANCHORED) != 0;  anchored = ((re->options | options) & PCRE_ANCHORED) != 0;
4514  startline = (re->options & PCRE_STARTLINE) != 0;  startline = (re->flags & PCRE_STARTLINE) != 0;
4515  firstline = (re->options & PCRE_FIRSTLINE) != 0;  firstline = (re->options & PCRE_FIRSTLINE) != 0;
4516    
4517  /* 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 3815  end_subject = md->end_subject; Line 4526  end_subject = md->end_subject;
4526    
4527  md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;  md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
4528  utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;  utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;
4529    md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
4530    
4531  md->notbol = (options & PCRE_NOTBOL) != 0;  md->notbol = (options & PCRE_NOTBOL) != 0;
4532  md->noteol = (options & PCRE_NOTEOL) != 0;  md->noteol = (options & PCRE_NOTEOL) != 0;
# Line 3823  md->partial = (options & PCRE_PARTIAL) ! Line 4535  md->partial = (options & PCRE_PARTIAL) !
4535  md->hitend = FALSE;  md->hitend = FALSE;
4536    
4537  md->recursive = NULL;                   /* No recursion at top level */  md->recursive = NULL;                   /* No recursion at top level */
 md->eptrchain = eptrchain;              /* Make workspace generally available */  
4538    
4539  md->lcc = tables + lcc_offset;  md->lcc = tables + lcc_offset;
4540  md->ctypes = tables + ctypes_offset;  md->ctypes = tables + ctypes_offset;
4541    
4542    /* Handle different \R options. */
4543    
4544    switch (options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE))
4545      {
4546      case 0:
4547      if ((re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) != 0)
4548        md->bsr_anycrlf = (re->options & PCRE_BSR_ANYCRLF) != 0;
4549      else
4550    #ifdef BSR_ANYCRLF
4551      md->bsr_anycrlf = TRUE;
4552    #else
4553      md->bsr_anycrlf = FALSE;
4554    #endif
4555      break;
4556    
4557      case PCRE_BSR_ANYCRLF:
4558      md->bsr_anycrlf = TRUE;
4559      break;
4560    
4561      case PCRE_BSR_UNICODE:
4562      md->bsr_anycrlf = FALSE;
4563      break;
4564    
4565      default: return PCRE_ERROR_BADNEWLINE;
4566      }
4567    
4568  /* Handle different types of newline. The three bits give eight cases. If  /* Handle different types of newline. The three bits give eight cases. If
4569  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. */
4570    
4571  switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : (pcre_uint32)options) &  switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options :
4572         PCRE_NEWLINE_BITS)          (pcre_uint32)options) & PCRE_NEWLINE_BITS)
4573    {    {
4574    case 0: newline = NEWLINE; break;   /* Compile-time default */    case 0: newline = NEWLINE; break;   /* Compile-time default */
4575    case PCRE_NEWLINE_CR: newline = '\r'; break;    case PCRE_NEWLINE_CR: newline = CHAR_CR; break;
4576    case PCRE_NEWLINE_LF: newline = '\n'; break;    case PCRE_NEWLINE_LF: newline = CHAR_NL; break;
4577    case PCRE_NEWLINE_CR+    case PCRE_NEWLINE_CR+
4578         PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;         PCRE_NEWLINE_LF: newline = (CHAR_CR << 8) | CHAR_NL; break;
4579    case PCRE_NEWLINE_ANY: newline = -1; break;    case PCRE_NEWLINE_ANY: newline = -1; break;
4580      case PCRE_NEWLINE_ANYCRLF: newline = -2; break;
4581    default: return PCRE_ERROR_BADNEWLINE;    default: return PCRE_ERROR_BADNEWLINE;
4582    }    }
4583    
4584  if (newline < 0)  if (newline == -2)
4585      {
4586      md->nltype = NLTYPE_ANYCRLF;
4587      }
4588    else if (newline < 0)
4589    {    {
4590    md->nltype = NLTYPE_ANY;    md->nltype = NLTYPE_ANY;
4591    }    }
# Line 3866  else Line 4608  else
4608  /* 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
4609  moment. */  moment. */
4610    
4611  if (md->partial && (re->options & PCRE_NOPARTIAL) != 0)  if (md->partial && (re->flags & PCRE_NOPARTIAL) != 0)
4612    return PCRE_ERROR_BADPARTIAL;    return PCRE_ERROR_BADPARTIAL;
4613    
4614  /* 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 3943  studied, there may be a bitmap of possib Line 4685  studied, there may be a bitmap of possib
4685    
4686  if (!anchored)  if (!anchored)
4687    {    {
4688    if ((re->options & PCRE_FIRSTSET) != 0)    if ((re->flags & PCRE_FIRSTSET) != 0)
4689      {      {
4690      first_byte = re->first_byte & 255;      first_byte = re->first_byte & 255;
4691      if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)      if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
# Line 3958  if (!anchored) Line 4700  if (!anchored)
4700  /* For anchored or unanchored matches, there may be a "last known required  /* For anchored or unanchored matches, there may be a "last known required
4701  character" set. */  character" set. */
4702    
4703  if ((re->options & PCRE_REQCHSET) != 0)  if ((re->flags & PCRE_REQCHSET) != 0)
4704    {    {
4705    req_byte = re->req_byte & 255;    req_byte = re->req_byte & 255;
4706    req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;    req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
# Line 3974  the loop runs just once. */ Line 4716  the loop runs just once. */
4716  for(;;)  for(;;)
4717    {    {
4718    USPTR save_end_subject = end_subject;    USPTR save_end_subject = end_subject;
4719      USPTR new_start_match;
4720    
4721    /* Reset the maximum number of extractions we might see. */    /* Reset the maximum number of extractions we might see. */
4722    
# Line 3984  for(;;) Line 4727  for(;;)
4727      while (iptr < iend) *iptr++ = -1;      while (iptr < iend) *iptr++ = -1;
4728      }      }
4729    
4730    /* Advance to a unique first char if possible. If firstline is TRUE, the    /* If firstline is TRUE, the start of the match is constrained to the first
4731    start of the match is constrained to the first line of a multiline string.    line of a multiline string. That is, the match must be before or at the first
4732    That is, the match must be before or at the first newline. Implement this by    newline. Implement this by temporarily adjusting end_subject so that we stop
4733    temporarily adjusting end_subject so that we stop scanning at a newline. If    scanning at a newline. If the match fails at the newline, later code breaks
4734    the match fails at the newline, later code breaks this loop. */    this loop. */
4735    
4736    if (firstline)    if (firstline)
4737      {      {
4738      USPTR t = start_match;      USPTR t = start_match;
4739    #ifdef SUPPORT_UTF8
4740        if (utf8)
4741          {
4742          while (t < md->end_subject && !IS_NEWLINE(t))
4743            {
4744            t++;
4745            while (t < end_subject && (*t & 0xc0) == 0x80) t++;
4746            }
4747          }
4748        else
4749    #endif
4750      while (t < md->end_subject && !IS_NEWLINE(t)) t++;      while (t < md->end_subject && !IS_NEWLINE(t)) t++;
4751      end_subject = t;      end_subject = t;
4752      }      }
4753    
4754    /* Now test for a unique first byte */    /* There are some optimizations that avoid running the match if a known
4755      starting point is not found, or if a known later character is not present.
4756      However, there is an option that disables these, for testing and for ensuring
4757      that all callouts do actually occur. */
4758    
4759    if (first_byte >= 0)    if ((options & PCRE_NO_START_OPTIMIZE) == 0)
4760      {      {
4761      if (first_byte_caseless)      /* Advance to a unique first byte if there is one. */
       while (start_match < end_subject &&  
              md->lcc[*start_match] != first_byte)  
         start_match++;  
     else  
       while (start_match < end_subject && *start_match != first_byte)  
         start_match++;  
     }  
4762    
4763    /* Or to just after a linebreak for a multiline match if possible */      if (first_byte >= 0)
4764          {
4765          if (first_byte_caseless)
4766            while (start_match < end_subject && md->lcc[*start_match] != first_byte)
4767              start_match++;
4768          else
4769            while (start_match < end_subject && *start_match != first_byte)
4770              start_match++;
4771          }
4772    
4773    else if (startline)      /* Or to just after a linebreak for a multiline match */
4774      {  
4775      if (start_match > md->start_subject + start_offset)      else if (startline)
4776        {        {
4777        while (start_match <= end_subject && !WAS_NEWLINE(start_match))        if (start_match > md->start_subject + start_offset)
4778          start_match++;          {
4779    #ifdef SUPPORT_UTF8
4780            if (utf8)
4781              {
4782              while (start_match < end_subject && !WAS_NEWLINE(start_match))
4783                {
4784                start_match++;
4785                while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
4786                  start_match++;
4787                }
4788              }
4789            else
4790    #endif
4791            while (start_match < end_subject && !WAS_NEWLINE(start_match))
4792              start_match++;
4793    
4794        /* If we have just passed a CR and the newline option is ANY, and we are          /* If we have just passed a CR and the newline option is ANY or ANYCRLF,
4795        now at a LF, advance the match position by one more character. */          and we are now at a LF, advance the match position by one more character.
4796            */
4797    
4798        if (start_match[-1] == '\r' &&          if (start_match[-1] == CHAR_CR &&
4799             md->nltype == NLTYPE_ANY &&               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&
4800             start_match < end_subject &&               start_match < end_subject &&
4801             *start_match == '\n')               *start_match == CHAR_NL)
4802          start_match++;            start_match++;
4803            }
4804        }        }
     }  
4805    
4806    /* Or to a non-unique first char after study */      /* Or to a non-unique first byte after study */
4807    
4808    else if (start_bits != NULL)      else if (start_bits != NULL)
     {  
     while (start_match < end_subject)  
4809        {        {
4810        register unsigned int c = *start_match;        while (start_match < end_subject)
4811        if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; else break;          {
4812            register unsigned int c = *start_match;
4813            if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++;
4814              else break;
4815            }
4816        }        }
4817      }      }   /* Starting optimizations */
4818    
4819    /* Restore fudged end_subject */    /* Restore fudged end_subject */
4820    
# Line 4051  for(;;) Line 4826  for(;;)
4826    printf("\n");    printf("\n");
4827  #endif  #endif
4828    
4829    /* If req_byte is set, we know that that character must appear in the subject    /* If req_byte is set, we know that that character must appear in the
4830    for the match to succeed. If the first character is set, req_byte must be    subject for the match to succeed. If the first character is set, req_byte
4831    later in the subject; otherwise the test starts at the match point. This    must be later in the subject; otherwise the test starts at the match point.
4832    optimization can save a huge amount of backtracking in patterns with nested    This optimization can save a huge amount of backtracking in patterns with
4833    unlimited repeats that aren't going to match. Writing separate code for    nested unlimited repeats that aren't going to match. Writing separate code
4834    cased/caseless versions makes it go faster, as does using an autoincrement    for cased/caseless versions makes it go faster, as does using an
4835    and backing off on a match.    autoincrement and backing off on a match.
4836    
4837    HOWEVER: when the subject string is very, very long, searching to its end can    HOWEVER: when the subject string is very, very long, searching to its end
4838    take a long time, and give bad performance on quite ordinary patterns. This    can take a long time, and give bad performance on quite ordinary patterns.
4839    showed up when somebody was matching something like /^\d+C/ on a 32-megabyte    This showed up when somebody was matching something like /^\d+C/ on a
4840    string... so we don't do this when the string is sufficiently long.    32-megabyte string... so we don't do this when the string is sufficiently
4841      long.
4842    
4843    ALSO: this processing is disabled when partial matching is requested.    ALSO: this processing is disabled when partial matching is requested, or if
4844    */    disabling is explicitly requested. */
4845    
4846    if (req_byte >= 0 &&    if ((options & PCRE_NO_START_OPTIMIZE) == 0 &&
4847          req_byte >= 0 &&
4848        end_subject - start_match < REQ_BYTE_MAX &&        end_subject - start_match < REQ_BYTE_MAX &&
4849        !md->partial)        !md->partial)
4850      {      {
# Line 4113  for(;;) Line 4890  for(;;)
4890    
4891    /* OK, we can now run the match. */    /* OK, we can now run the match. */
4892    
4893    md->start_match = start_match;    md->start_match_ptr = start_match;
4894    md->match_call_count = 0;    md->match_call_count = 0;
4895    md->eptrn = 0;                          /* Next free eptrchain slot */    rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0);
4896    rc = match(start_match, md->start_code, 2, md, ims, NULL, 0, 0);  
4897      switch(rc)
4898        {
4899        /* NOMATCH and PRUNE advance by one character. THEN at this level acts
4900        exactly like PRUNE. */
4901    
4902        case MATCH_NOMATCH:
4903        case MATCH_PRUNE:
4904        case MATCH_THEN:
4905        new_start_match = start_match + 1;
4906    #ifdef SUPPORT_UTF8
4907        if (utf8)
4908          while(new_start_match < end_subject && (*new_start_match & 0xc0) == 0x80)
4909            new_start_match++;
4910    #endif
4911        break;
4912    
4913        /* SKIP passes back the next starting point explicitly. */
4914    
4915        case MATCH_SKIP:
4916        new_start_match = md->start_match_ptr;
4917        break;
4918    
4919        /* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */
4920    
4921    /* Any return other than MATCH_NOMATCH breaks the loop. */      case MATCH_COMMIT:
4922        rc = MATCH_NOMATCH;
4923        goto ENDLOOP;
4924    
4925    if (rc != MATCH_NOMATCH) break;      /* Any other return is some kind of error. */
4926    
4927        default:
4928        goto ENDLOOP;
4929        }
4930    
4931      /* Control reaches here for the various types of "no match at this point"
4932      result. Reset the code to MATCH_NOMATCH for subsequent checking. */
4933    
4934      rc = MATCH_NOMATCH;
4935    
4936    /* If PCRE_FIRSTLINE is set, the match must happen before or at the first    /* If PCRE_FIRSTLINE is set, the match must happen before or at the first
4937    newline in the subject (though it may continue over the newline). Therefore,    newline in the subject (though it may continue over the newline). Therefore,
# Line 4128  for(;;) Line 4939  for(;;)
4939    
4940    if (firstline && IS_NEWLINE(start_match)) break;    if (firstline && IS_NEWLINE(start_match)) break;
4941    
4942    /* Advance the match position by one character. */    /* Advance to new matching position */
4943    
4944    start_match++;    start_match = new_start_match;
 #ifdef SUPPORT_UTF8  
   if (utf8)  
     while(start_match < end_subject && (*start_match & 0xc0) == 0x80)  
       start_match++;  
 #endif  
4945    
4946    /* Break the loop if the pattern is anchored or if we have passed the end of    /* Break the loop if the pattern is anchored or if we have passed the end of
4947    the subject. */    the subject. */
4948    
4949    if (anchored || start_match > end_subject) break;    if (anchored || start_match > end_subject) break;
4950    
4951    /* If we have just passed a CR and the newline option is CRLF or ANY, and we    /* If we have just passed a CR and we are now at a LF, and the pattern does
4952    are now at a LF, advance the match position by one more character. */    not contain any explicit matches for \r or \n, and the newline option is CRLF
4953      or ANY or ANYCRLF, advance the match position by one more character. */
4954    if (start_match[-1] == '\r' &&  
4955         (md->nltype == NLTYPE_ANY || md->nllen == 2) &&    if (start_match[-1] == CHAR_CR &&
4956         start_match < end_subject &&        start_match < end_subject &&
4957         *start_match == '\n')        *start_match == CHAR_NL &&
4958          (re->flags & PCRE_HASCRORLF) == 0 &&
4959            (md->nltype == NLTYPE_ANY ||
4960             md->nltype == NLTYPE_ANYCRLF ||
4961             md->nllen == 2))
4962      start_match++;      start_match++;
4963    
4964    }   /* End of for(;;) "bumpalong" loop */    }   /* End of for(;;) "bumpalong" loop */
# Line 4158  for(;;) Line 4968  for(;;)
4968  /* We reach here when rc is not MATCH_NOMATCH, or if one of the stopping  /* We reach here when rc is not MATCH_NOMATCH, or if one of the stopping
4969  conditions is true:  conditions is true:
4970    
4971  (1) The pattern is anchored;  (1) The pattern is anchored or the match was failed by (*COMMIT);
4972    
4973  (2) We are past the end of the subject;  (2) We are past the end of the subject;
4974    
# Line 4173  processing, copy those that we can. In t Line 4983  processing, copy those that we can. In t
4983  certain parts of the pattern were not used, even though there are more  certain parts of the pattern were not used, even though there are more
4984  capturing parentheses than vector slots. */  capturing parentheses than vector slots. */
4985    
4986    ENDLOOP:
4987    
4988  if (rc == MATCH_MATCH)  if (rc == MATCH_MATCH)
4989    {    {
4990    if (using_temporary_offsets)    if (using_temporary_offsets)
# Line 4193  if (rc == MATCH_MATCH) Line 5005  if (rc == MATCH_MATCH)
5005    
5006    rc = md->offset_overflow? 0 : md->end_offset_top/2;    rc = md->offset_overflow? 0 : md->end_offset_top/2;
5007    
5008    /* If there is space, set up the whole thing as substring 0. */    /* If there is space, set up the whole thing as substring 0. The value of
5009      md->start_match_ptr might be modified if \K was encountered on the success
5010      matching path. */
5011    
5012    if (offsetcount < 2) rc = 0; else    if (offsetcount < 2) rc = 0; else
5013      {      {
5014      offsets[0] = start_match - md->start_subject;      offsets[0] = md->start_match_ptr - md->start_subject;
5015      offsets[1] = md->end_match_ptr - md->start_subject;      offsets[1] = md->end_match_ptr - md->start_subject;
5016      }      }
5017    

Legend:
Removed from v.144  
changed lines
  Added in v.402

  ViewVC Help
Powered by ViewVC 1.1.5