/[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 1403 by ph10, Tue Nov 19 10:44:59 2013 UTC revision 1404 by ph10, Tue Nov 19 15:36:57 2013 UTC
# Line 2832  a message and return 0 if there is no ma Line 2832  a message and return 0 if there is no ma
2832  Arguments:  Arguments:
2833    p           points after the leading '<'    p           points after the leading '<'
2834    f           file for error message    f           file for error message
2835    nl          TRUE to check only for newline settings    nl          TRUE to check only for newline settings
2836    stype       "modifier" or "escape sequence"    stype       "modifier" or "escape sequence"
2837    
2838  Returns:      appropriate PCRE_NEWLINE_xxx flags, or 0  Returns:      appropriate PCRE_NEWLINE_xxx flags, or 0
2839  */  */
# Line 2852  if (strncmpic(p, (pcre_uint8 *)"bsr_unic Line 2852  if (strncmpic(p, (pcre_uint8 *)"bsr_unic
2852  if (!nl)  if (!nl)
2853    {    {
2854    if (strncmpic(p, (pcre_uint8 *)"JS>", 3) == 0) return PCRE_JAVASCRIPT_COMPAT;    if (strncmpic(p, (pcre_uint8 *)"JS>", 3) == 0) return PCRE_JAVASCRIPT_COMPAT;
2855    }    }
2856    
2857  fprintf(f, "Unknown %s at: <%s\n", stype, p);  fprintf(f, "Unknown %s at: <%s\n", stype, p);
2858  return 0;  return 0;
# Line 2901  printf("  -help    show usage informatio Line 2901  printf("  -help    show usage informatio
2901  printf("  -i       show information about compiled patterns\n"  printf("  -i       show information about compiled patterns\n"
2902         "  -M       find MATCH_LIMIT minimum for each subject\n"         "  -M       find MATCH_LIMIT minimum for each subject\n"
2903         "  -m       output memory used information\n"         "  -m       output memory used information\n"
2904         "  -O       set PCRE_NO_AUTO_POSSESS on each pattern\n"         "  -O       set PCRE_NO_AUTO_POSSESS on each pattern\n"
2905         "  -o <n>   set size of offsets vector to <n>\n");         "  -o <n>   set size of offsets vector to <n>\n");
2906  #if !defined NOPOSIX  #if !defined NOPOSIX
2907  printf("  -p       use POSIX interface\n");  printf("  -p       use POSIX interface\n");
# Line 3102  while (argc > 1 && argv[op][0] == '-') Line 3102  while (argc > 1 && argv[op][0] == '-')
3102      {      {
3103      int temp;      int temp;
3104      int both = arg[2] == 0;      int both = arg[2] == 0;
3105      showtotaltimes = arg[1] == 'T';      showtotaltimes = arg[1] == 'T';
3106      if (argc > 2 && (temp = get_value((pcre_uint8 *)argv[op+1], &endptr),      if (argc > 2 && (temp = get_value((pcre_uint8 *)argv[op+1], &endptr),
3107                       *endptr == 0))                       *endptr == 0))
3108        {        {
# Line 3447  while (!done) Line 3447  while (!done)
3447    p = buffer;    p = buffer;
3448    while (isspace(*p)) p++;    while (isspace(*p)) p++;
3449    if (*p == 0) continue;    if (*p == 0) continue;
3450    
3451    /* Handle option lock-out setting */    /* Handle option lock-out setting */
3452    
3453    if (*p == '<' && p[1] == ' ')    if (*p == '<' && p[1] == ' ')
3454      {      {
3455      p += 2;      p += 2;
# Line 3458  while (!done) Line 3458  while (!done)
3458        {        {
3459        p += 7;        p += 7;
3460        while (isspace(*p)) p++;        while (isspace(*p)) p++;
3461        pp = lockout;        pp = lockout;
3462        while (!isspace(*p) && pp < lockout + sizeof(lockout) - 1)        while (!isspace(*p) && pp < lockout + sizeof(lockout) - 1)
3463          *pp++ = *p++;          *pp++ = *p++;
3464        *pp = 0;        *pp = 0;
3465        }        }
3466      else      else
3467        {        {
3468        printf("** Unrecognized special command '%s'\n", p);        printf("** Unrecognized special command '%s'\n", p);
3469        yield = 1;        yield = 1;
3470        goto EXIT;        goto EXIT;
3471        }        }
3472      continue;      continue;
3473      }      }
3474    
3475    /* See if the pattern is to be loaded pre-compiled from a file. */    /* See if the pattern is to be loaded pre-compiled from a file. */
3476    
# Line 3660  while (!done) Line 3660  while (!done)
3660    while (*pp != 0)    while (*pp != 0)
3661      {      {
3662      /* Check to see whether this modifier has been locked out for this file.      /* Check to see whether this modifier has been locked out for this file.
3663      This is complicated for the multi-character options that begin with '<'.      This is complicated for the multi-character options that begin with '<'.
3664      If there is no '>' in the lockout string, all multi-character modifiers are      If there is no '>' in the lockout string, all multi-character modifiers are
3665      locked out. */      locked out. */
3666    
3667      if (strchr((char *)lockout, *pp) != NULL)      if (strchr((char *)lockout, *pp) != NULL)
3668        {        {
3669        if (*pp == '<' && strchr((char *)lockout, '>') != NULL)        if (*pp == '<' && strchr((char *)lockout, '>') != NULL)
3670          {          {
3671          int x = check_mc_option(pp+1, outfile, FALSE, "modifier");          int x = check_mc_option(pp+1, outfile, FALSE, "modifier");
3672          if (x == 0) goto SKIP_DATA;          if (x == 0) goto SKIP_DATA;
3673    
3674          for (ppp = lockout; *ppp != 0; ppp++)          for (ppp = lockout; *ppp != 0; ppp++)
3675            {            {
3676            if (*ppp == '<')            if (*ppp == '<')
# Line 3680  while (!done) Line 3680  while (!done)
3680                {                {
3681                printf("** Error in modifier forbid data - giving up.\n");                printf("** Error in modifier forbid data - giving up.\n");
3682                yield = 1;                yield = 1;
3683                goto EXIT;                goto EXIT;
3684                }                }
3685              if (x == y)              if (x == y)
3686                {                {
3687                ppp = pp;                ppp = pp;
3688                while (*ppp != '>') ppp++;                while (*ppp != '>') ppp++;
3689                printf("** The %.*s modifier is locked out - giving up.\n",                printf("** The %.*s modifier is locked out - giving up.\n",
3690                  (int)(ppp - pp + 1), pp);                  (int)(ppp - pp + 1), pp);
3691                yield = 1;                yield = 1;
3692                goto EXIT;                goto EXIT;
3693                }                }
3694              }              }
3695            }            }
3696          }          }
3697    
3698        /* The single-character modifiers are straightforward. */        /* The single-character modifiers are straightforward. */
3699    
3700        else        else
3701          {          {
3702          printf("** The /%c modifier is locked out - giving up.\n", *pp);          printf("** The /%c modifier is locked out - giving up.\n", *pp);
3703          yield = 1;          yield = 1;
3704          goto EXIT;          goto EXIT;
3705          }          }
3706        }        }
3707    
3708      /* The modifier is not locked out; handle it. */      /* The modifier is not locked out; handle it. */
3709    
3710      switch (*pp++)      switch (*pp++)
3711        {        {
3712        case 'f': options |= PCRE_FIRSTLINE; break;        case 'f': options |= PCRE_FIRSTLINE; break;
# Line 4572  while (!done) Line 4572  while (!done)
4572          while (i++ < 2 && isdigit(*p) && *p != '8' && *p != '9')          while (i++ < 2 && isdigit(*p) && *p != '8' && *p != '9')
4573            c = c * 8 + *p++ - '0';            c = c * 8 + *p++ - '0';
4574          break;          break;
4575    
4576          case 'o':          case 'o':
4577          if (*p == '{')          if (*p == '{')
4578            {            {
# Line 4586  while (!done) Line 4586  while (!done)
4586              else c = c * 8 + *pt - '0';              else c = c * 8 + *pt - '0';
4587              }              }
4588            if (*pt == '}') p = pt + 1;            if (*pt == '}') p = pt + 1;
4589              else fprintf(outfile, "** Missing } after \\o{ (assumed)\n");              else fprintf(outfile, "** Missing } after \\o{ (assumed)\n");
4590            }            }
4591          break;          break;
4592    
4593          case 'x':          case 'x':
4594          if (*p == '{')          if (*p == '{')

Legend:
Removed from v.1403  
changed lines
  Added in v.1404

  ViewVC Help
Powered by ViewVC 1.1.5