/[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 1521 by ph10, Sun Feb 8 16:43:13 2015 UTC revision 1523 by ph10, Sun Feb 8 18:00:45 2015 UTC
# Line 3639  for (;;) Line 3639  for (;;)
3639    c = *code;    c = *code;
3640    
3641    /* When a pattern with bad UTF-8 encoding is compiled with NO_UTF_CHECK,    /* When a pattern with bad UTF-8 encoding is compiled with NO_UTF_CHECK,
3642    it may compile without complaining, but may get into a loop here if the code    it may compile without complaining, but may get into a loop here if the code
3643    pointer points to a bad value. This is, of course a documentated possibility,    pointer points to a bad value. This is, of course a documentated possibility,
3644    when NO_UTF_CHECK is set, so it isn't a bug, but we can detect this case and    when NO_UTF_CHECK is set, so it isn't a bug, but we can detect this case and
3645    just give up on this optimization. */    just give up on this optimization. */
3646    
3647    if (c >= OP_TABLE_LENGTH) return;    if (c >= OP_TABLE_LENGTH) return;
3648    
3649    if (c >= OP_STAR && c <= OP_TYPEPOSUPTO)    if (c >= OP_STAR && c <= OP_TYPEPOSUPTO)
3650      {      {
3651      c -= get_repeat_base(c) - OP_STAR;      c -= get_repeat_base(c) - OP_STAR;
# Line 6657  for (;; ptr++) Line 6657  for (;; ptr++)
6657                (tempptr[2] == CHAR_EQUALS_SIGN ||                (tempptr[2] == CHAR_EQUALS_SIGN ||
6658                 tempptr[2] == CHAR_EXCLAMATION_MARK ||                 tempptr[2] == CHAR_EXCLAMATION_MARK ||
6659                 tempptr[2] == CHAR_LESS_THAN_SIGN))                 tempptr[2] == CHAR_LESS_THAN_SIGN))
6660              {
6661              cd->iscondassert = TRUE;
6662            break;            break;
6663              }
6664    
6665          /* Other conditions use OP_CREF/OP_DNCREF/OP_RREF/OP_DNRREF, and all          /* Other conditions use OP_CREF/OP_DNCREF/OP_RREF/OP_DNRREF, and all
6666          need to skip at least 1+IMM2_SIZE bytes at the start of the group. */          need to skip at least 1+IMM2_SIZE bytes at the start of the group. */
# Line 6770  for (;; ptr++) Line 6773  for (;; ptr++)
6773              goto FAILED;              goto FAILED;
6774              }              }
6775            PUT2(code, 2+LINK_SIZE, recno);            PUT2(code, 2+LINK_SIZE, recno);
6776            if (recno > cd->top_backref) cd->top_backref = recno;            if (recno > cd->top_backref) cd->top_backref = recno;
6777            break;            break;
6778            }            }
6779    
# Line 6793  for (;; ptr++) Line 6796  for (;; ptr++)
6796            int offset = i++;            int offset = i++;
6797            int count = 1;            int count = 1;
6798            recno = GET2(slot, 0);   /* Number from first found */            recno = GET2(slot, 0);   /* Number from first found */
6799            if (recno > cd->top_backref) cd->top_backref = recno;            if (recno > cd->top_backref) cd->top_backref = recno;
6800            for (; i < cd->names_found; i++)            for (; i < cd->names_found; i++)
6801              {              {
6802              slot += cd->name_entry_size;              slot += cd->name_entry_size;
# Line 7512  for (;; ptr++) Line 7515  for (;; ptr++)
7515        goto FAILED;        goto FAILED;
7516        }        }
7517    
7518      /* Assertions used not to be repeatable, but this was changed for Perl      /* All assertions used not to be repeatable, but this was changed for Perl
7519      compatibility, so all kinds can now be repeated. We copy code into a      compatibility. All kinds can now be repeated except for assertions that are
7520        conditions (Perl also forbids these to be repeated). We copy code into a
7521      non-register variable (tempcode) in order to be able to pass its address      non-register variable (tempcode) in order to be able to pass its address
7522      because some compilers complain otherwise. */      because some compilers complain otherwise. At the start of a conditional
7523        group whose condition is an assertion, cb->iscondassert is set. We unset it
7524        here so as to allow assertions later in the group to be quantified. */
7525    
7526        if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NOT &&
7527            cd->iscondassert)
7528          {
7529          previous = NULL;
7530          cd->iscondassert = FALSE;
7531          }
7532        else previous = code;
7533    
     previous = code;                      /* For handling repetition */  
7534      *code = bravalue;      *code = bravalue;
7535      tempcode = code;      tempcode = code;
7536      tempreqvary = cd->req_varyopt;        /* Save value before bracket */      tempreqvary = cd->req_varyopt;        /* Save value before bracket */
# Line 9118  cd->dupnames = FALSE; Line 9131  cd->dupnames = FALSE;
9131  cd->namedrefcount = 0;  cd->namedrefcount = 0;
9132  cd->start_code = cworkspace;  cd->start_code = cworkspace;
9133  cd->hwm = cworkspace;  cd->hwm = cworkspace;
9134    cd->iscondassert = FALSE;
9135  cd->start_workspace = cworkspace;  cd->start_workspace = cworkspace;
9136  cd->workspace_size = COMPILE_WORK_SIZE;  cd->workspace_size = COMPILE_WORK_SIZE;
9137  cd->named_groups = named_groups;  cd->named_groups = named_groups;
# Line 9213  cd->name_table = (pcre_uchar *)re + re-> Line 9227  cd->name_table = (pcre_uchar *)re + re->
9227  codestart = cd->name_table + re->name_entry_size * re->name_count;  codestart = cd->name_table + re->name_entry_size * re->name_count;
9228  cd->start_code = codestart;  cd->start_code = codestart;
9229  cd->hwm = (pcre_uchar *)(cd->start_workspace);  cd->hwm = (pcre_uchar *)(cd->start_workspace);
9230    cd->iscondassert = FALSE;
9231  cd->req_varyopt = 0;  cd->req_varyopt = 0;
9232  cd->had_accept = FALSE;  cd->had_accept = FALSE;
9233  cd->had_pruneorskip = FALSE;  cd->had_pruneorskip = FALSE;

Legend:
Removed from v.1521  
changed lines
  Added in v.1523

  ViewVC Help
Powered by ViewVC 1.1.5