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

Diff of /code/trunk/pcre_compile.c

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

revision 613 by ph10, Sat Jul 2 16:59:52 2011 UTC revision 618 by ph10, Sat Jul 16 17:24:16 2011 UTC
# Line 1694  _pcre_find_bracket(const uschar *code, B Line 1694  _pcre_find_bracket(const uschar *code, B
1694  for (;;)  for (;;)
1695    {    {
1696    register int c = *code;    register int c = *code;
1697    
1698    if (c == OP_END) return NULL;    if (c == OP_END) return NULL;
1699    
1700    /* XCLASS is used for classes that cannot be represented just by a bit    /* XCLASS is used for classes that cannot be represented just by a bit
# Line 4726  for (;; ptr++) Line 4727  for (;; ptr++)
4727          }          }
4728    
4729        /* If the maximum is unlimited, set a repeater in the final copy. For        /* If the maximum is unlimited, set a repeater in the final copy. For
4730        ONCE brackets, that's all we need to do.        ONCE brackets, that's all we need to do.
4731    
4732          (To be done next, after recursion adjusted)
4733          However, possessively repeated
4734          ONCE brackets can be converted into non-capturing brackets, as the
4735          behaviour of (?:xx)++ is the same as (?>xx)++ and this saves having to
4736          deal with possessive ONCEs specially.
4737          (....)
4738    
4739        Otherwise, if the quantifier was possessive, we convert the BRA code to        Otherwise, if the quantifier was possessive, we convert the BRA code to
4740        the POS form, and the KET code to KETRPOS. (It turns out to be convenient        the POS form, and the KET code to KETRPOS. (It turns out to be convenient
# Line 4748  for (;; ptr++) Line 4756  for (;; ptr++)
4756          uschar *ketcode = code - 1 - LINK_SIZE;          uschar *ketcode = code - 1 - LINK_SIZE;
4757          uschar *bracode = ketcode - GET(ketcode, 1);          uschar *bracode = ketcode - GET(ketcode, 1);
4758    
4759          if (*bracode == OP_ONCE)  /****
4760            if (*bracode == OP_ONCE && possessive_quantifier)
4761              *bracode = OP_BRA;
4762    ****/
4763    
4764            if (*bracode == OP_ONCE)
4765            *ketcode = OP_KETRMAX + repeat_type;            *ketcode = OP_KETRMAX + repeat_type;
4766          else          else
4767            {            {
# Line 5685  for (;; ptr++) Line 5698  for (;; ptr++)
5698            /* Insert the recursion/subroutine item, automatically wrapped inside            /* Insert the recursion/subroutine item, automatically wrapped inside
5699            "once" brackets. Set up a "previous group" length so that a            "once" brackets. Set up a "previous group" length so that a
5700            subsequent quantifier will work. */            subsequent quantifier will work. */
5701    
5702            *code = OP_ONCE;            *code = OP_ONCE;
5703            PUT(code, 1, 2 + 2*LINK_SIZE);            PUT(code, 1, 2 + 2*LINK_SIZE);
5704            code += 1 + LINK_SIZE;            code += 1 + LINK_SIZE;

Legend:
Removed from v.613  
changed lines
  Added in v.618

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12