/[pcre]/code/branches/pcre16/pcre_compile.c
ViewVC logotype

Diff of /code/branches/pcre16/pcre_compile.c

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

revision 654 by ph10, Tue Aug 2 11:00:40 2011 UTC revision 721 by ph10, Fri Oct 7 15:51:39 2011 UTC
# Line 1761  for (;;) Line 1761  for (;;)
1761        break;        break;
1762    
1763        case OP_THEN_ARG:        case OP_THEN_ARG:
1764        code += code[1+LINK_SIZE];        code += code[1];
1765        break;        break;
1766        }        }
1767    
# Line 1880  for (;;) Line 1880  for (;;)
1880        break;        break;
1881    
1882        case OP_THEN_ARG:        case OP_THEN_ARG:
1883        code += code[1+LINK_SIZE];        code += code[1];
1884        break;        break;
1885        }        }
1886    
# Line 2217  for (code = first_significant_code(code Line 2217  for (code = first_significant_code(code
2217      break;      break;
2218    
2219      case OP_THEN_ARG:      case OP_THEN_ARG:
2220      code += code[1+LINK_SIZE];      code += code[1];
2221      break;      break;
2222    
2223      /* None of the remaining opcodes are required to match a character. */      /* None of the remaining opcodes are required to match a character. */
# Line 2295  I think. Line 2295  I think.
2295  A user pointed out that PCRE was rejecting [:a[:digit:]] whereas Perl was not.  A user pointed out that PCRE was rejecting [:a[:digit:]] whereas Perl was not.
2296  It seems that the appearance of a nested POSIX class supersedes an apparent  It seems that the appearance of a nested POSIX class supersedes an apparent
2297  external class. For example, [:a[:digit:]b:] matches "a", "b", ":", or  external class. For example, [:a[:digit:]b:] matches "a", "b", ":", or
2298  a digit. Also, unescaped square brackets may also appear as part of class  a digit.
2299  names. For example, [:a[:abc]b:] gives unknown class "[:abc]b:]"in Perl.  
2300    In Perl, unescaped square brackets may also appear as part of class names. For
2301    example, [:a[:abc]b:] gives unknown POSIX class "[:abc]b:]". However, for
2302    [:a[:abc]b][b:] it gives unknown POSIX class "[:abc]b][b:]", which does not
2303    seem right at all. PCRE does not allow closing square brackets in POSIX class
2304    names.
2305    
2306  Arguments:  Arguments:
2307    ptr      pointer to the initial [    ptr      pointer to the initial [
# Line 2314  for (++ptr; *ptr != 0; ptr++) Line 2319  for (++ptr; *ptr != 0; ptr++)
2319    {    {
2320    if (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)    if (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
2321      ptr++;      ptr++;
2322      else if (*ptr == CHAR_RIGHT_SQUARE_BRACKET) return FALSE;
2323    else    else
2324      {      {
2325      if (*ptr == terminator && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)      if (*ptr == terminator && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
# Line 3086  uschar *class_utf8data_base; Line 3092  uschar *class_utf8data_base;
3092  uschar utf8_char[6];  uschar utf8_char[6];
3093  #else  #else
3094  BOOL utf8 = FALSE;  BOOL utf8 = FALSE;
 uschar *utf8_char = NULL;  
3095  #endif  #endif
3096    
3097  #ifdef PCRE_DEBUG  #ifdef PCRE_DEBUG
# Line 5040  for (;; ptr++) Line 5045  for (;; ptr++)
5045                PUT2INC(code, 0, oc->number);                PUT2INC(code, 0, oc->number);
5046                }                }
5047              *code++ = (cd->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;              *code++ = (cd->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;
5048    
5049                /* Do not set firstbyte after *ACCEPT */
5050                if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
5051              }              }
5052    
5053            /* Handle other cases with/without an argument */            /* Handle other cases with/without an argument */
# Line 5052  for (;; ptr++) Line 5060  for (;; ptr++)
5060                goto FAILED;                goto FAILED;
5061                }                }
5062              *code = verbs[i].op;              *code = verbs[i].op;
5063              if (*code++ == OP_THEN)              if (*code++ == OP_THEN) cd->external_flags |= PCRE_HASTHEN;
               {  
               PUT(code, 0, code - bcptr->current_branch - 1);  
               code += LINK_SIZE;  
               }  
5064              }              }
5065    
5066            else            else
# Line 5067  for (;; ptr++) Line 5071  for (;; ptr++)
5071                goto FAILED;                goto FAILED;
5072                }                }
5073              *code = verbs[i].op_arg;              *code = verbs[i].op_arg;
5074              if (*code++ == OP_THEN_ARG)              if (*code++ == OP_THEN_ARG) cd->external_flags |= PCRE_HASTHEN;
               {  
               PUT(code, 0, code - bcptr->current_branch - 1);  
               code += LINK_SIZE;  
               }  
5075              *code++ = arglen;              *code++ = arglen;
5076              memcpy(code, arg, arglen);              memcpy(code, arg, arglen);
5077              code += arglen;              code += arglen;
# Line 5932  for (;; ptr++) Line 5932  for (;; ptr++)
5932        cd->assert_depth -= 1;        cd->assert_depth -= 1;
5933    
5934      /* At the end of compiling, code is still pointing to the start of the      /* At the end of compiling, code is still pointing to the start of the
5935      group, while tempcode has been updated to point past the end of the group      group, while tempcode has been updated to point past the end of the group.
5936      and any option resetting that may follow it. The pattern pointer (ptr)      The pattern pointer (ptr) is on the bracket.
     is on the bracket. */  
5937    
5938      /* If this is a conditional bracket, check that there are no more than      If this is a conditional bracket, check that there are no more than
5939      two branches in the group, or just one if it's a DEFINE group. We do this      two branches in the group, or just one if it's a DEFINE group. We do this
5940      in the real compile phase, not in the pre-pass, where the whole group may      in the real compile phase, not in the pre-pass, where the whole group may
5941      not be available. */      not be available. */
# Line 6335  for (;; ptr++) Line 6334  for (;; ptr++)
6334        else firstbyte = reqbyte = REQ_NONE;        else firstbyte = reqbyte = REQ_NONE;
6335        }        }
6336    
6337      /* firstbyte was previously set; we can set reqbyte only the length is      /* firstbyte was previously set; we can set reqbyte only if the length is
6338      1 or the matching is caseful. */      1 or the matching is caseful. */
6339    
6340      else      else
# Line 7282  re->top_bracket = cd->bracount; Line 7281  re->top_bracket = cd->bracount;
7281  re->top_backref = cd->top_backref;  re->top_backref = cd->top_backref;
7282  re->flags = cd->external_flags;  re->flags = cd->external_flags;
7283    
7284  if (cd->had_accept) reqbyte = -1;   /* Must disable after (*ACCEPT) */  if (cd->had_accept) reqbyte = REQ_NONE;   /* Must disable after (*ACCEPT) */
7285    
7286  /* If not reached end of pattern on success, there's an excess bracket. */  /* If not reached end of pattern on success, there's an excess bracket. */
7287    

Legend:
Removed from v.654  
changed lines
  Added in v.721

  ViewVC Help
Powered by ViewVC 1.1.5