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

Diff of /code/trunk/pcretest.c

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

revision 558 by ph10, Tue Oct 26 15:26:45 2010 UTC revision 579 by ph10, Wed Nov 24 17:39:25 2010 UTC
# Line 1588  while (!done) Line 1588  while (!done)
1588        case 'U': options |= PCRE_UNGREEDY; break;        case 'U': options |= PCRE_UNGREEDY; break;
1589        case 'W': options |= PCRE_UCP; break;        case 'W': options |= PCRE_UCP; break;
1590        case 'X': options |= PCRE_EXTRA; break;        case 'X': options |= PCRE_EXTRA; break;
1591          case 'Y': options |= PCRE_NO_START_OPTIMISE; break;
1592        case 'Z': debug_lengths = 0; break;        case 'Z': debug_lengths = 0; break;
1593        case '8': options |= PCRE_UTF8; use_utf8 = 1; break;        case '8': options |= PCRE_UTF8; use_utf8 = 1; break;
1594        case '?': options |= PCRE_NO_UTF8_CHECK; break;        case '?': options |= PCRE_NO_UTF8_CHECK; break;
# Line 1924  while (!done) Line 1925  while (!done)
1925        if (do_flip) all_options = byteflip(all_options, sizeof(all_options));        if (do_flip) all_options = byteflip(all_options, sizeof(all_options));
1926    
1927        if (get_options == 0) fprintf(outfile, "No options\n");        if (get_options == 0) fprintf(outfile, "No options\n");
1928          else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",          else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
1929            ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",            ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",
1930            ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",            ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",
1931            ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",            ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",
# Line 1940  while (!done) Line 1941  while (!done)
1941            ((get_options & PCRE_UTF8) != 0)? " utf8" : "",            ((get_options & PCRE_UTF8) != 0)? " utf8" : "",
1942            ((get_options & PCRE_UCP) != 0)? " ucp" : "",            ((get_options & PCRE_UCP) != 0)? " ucp" : "",
1943            ((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf8_check" : "",            ((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf8_check" : "",
1944              ((get_options & PCRE_NO_START_OPTIMIZE) != 0)? " no_start_optimize" : "",
1945            ((get_options & PCRE_DUPNAMES) != 0)? " dupnames" : "");            ((get_options & PCRE_DUPNAMES) != 0)? " dupnames" : "");
1946    
1947        if (jchanged) fprintf(outfile, "Duplicate name status changes\n");        if (jchanged) fprintf(outfile, "Duplicate name status changes\n");
# Line 2132  while (!done) Line 2134  while (!done)
2134      int getlist = 0;      int getlist = 0;
2135      int gmatched = 0;      int gmatched = 0;
2136      int start_offset = 0;      int start_offset = 0;
2137        int start_offset_sign = 1;
2138      int g_notempty = 0;      int g_notempty = 0;
2139      int use_dfa = 0;      int use_dfa = 0;
2140    
# Line 2264  while (!done) Line 2267  while (!done)
2267          continue;          continue;
2268    
2269          case '>':          case '>':
2270            if (*p == '-')
2271              {
2272              start_offset_sign = -1;
2273              p++;
2274              }
2275          while(isdigit(*p)) start_offset = start_offset * 10 + *p++ - '0';          while(isdigit(*p)) start_offset = start_offset * 10 + *p++ - '0';
2276            start_offset *= start_offset_sign;
2277          continue;          continue;
2278    
2279          case 'A':  /* Option setting */          case 'A':  /* Option setting */
# Line 2791  while (!done) Line 2800  while (!done)
2800        to advance the start offset, and continue. We won't be at the end of the        to advance the start offset, and continue. We won't be at the end of the
2801        string - that was checked before setting g_notempty.        string - that was checked before setting g_notempty.
2802    
2803        Complication arises in the case when the newline option is "any" or        Complication arises in the case when the newline convention is "any",
2804        "anycrlf". If the previous match was at the end of a line terminated by        "crlf", or "anycrlf". If the previous match was at the end of a line
2805        CRLF, an advance of one character just passes the \r, whereas we should        terminated by CRLF, an advance of one character just passes the \r,
2806        prefer the longer newline sequence, as does the code in pcre_exec().        whereas we should prefer the longer newline sequence, as does the code in
2807        Fudge the offset value to achieve this.        pcre_exec(). Fudge the offset value to achieve this. We check for a
2808          newline setting in the pattern; if none was set, use pcre_config() to
2809          find the default.
2810    
2811        Otherwise, in the case of UTF-8 matching, the advance must be one        Otherwise, in the case of UTF-8 matching, the advance must be one
2812        character, not one byte. */        character, not one byte. */
# Line 2820  while (!done) Line 2831  while (!done)
2831                      (d == -1)? PCRE_NEWLINE_ANY : 0;                      (d == -1)? PCRE_NEWLINE_ANY : 0;
2832              }              }
2833            if (((obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY ||            if (((obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY ||
2834                   (obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_CRLF ||
2835                 (obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANYCRLF)                 (obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANYCRLF)
2836                &&                &&
2837                start_offset < len - 1 &&                start_offset < len - 1 &&
# Line 2830  while (!done) Line 2842  while (!done)
2842              {              {
2843              while (start_offset + onechar < len)              while (start_offset + onechar < len)
2844                {                {
2845                int tb = bptr[start_offset+onechar];                if ((bptr[start_offset+onechar] & 0xc0) != 0x80) break;
2846                if (tb <= 127) break;                onechar++;
               tb &= 0xc0;  
               if (tb != 0 && tb != 0xc0) onechar++;  
2847                }                }
2848              }              }
2849            use_offsets[1] = start_offset + onechar;            use_offsets[1] = start_offset + onechar;

Legend:
Removed from v.558  
changed lines
  Added in v.579

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12