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

Diff of /code/trunk/pcre_printint.c

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

revision 1045 by ph10, Sun Sep 23 16:50:00 2012 UTC revision 1046 by ph10, Tue Sep 25 16:27:58 2012 UTC
# Line 120  int c = *ptr; Line 120  int c = *ptr;
120    
121  (void)utf;  /* Avoid compiler warning */  (void)utf;  /* Avoid compiler warning */
122  if (PRINTABLE(c)) fprintf(f, "%c", c);  if (PRINTABLE(c)) fprintf(f, "%c", c);
123  else if (c <= 0xff) fprintf(f, "\\x%02x", c);  else if (c <= 0x80) fprintf(f, "\\x%02x", c);
124  else fprintf(f, "\\x{%x}", c);  else fprintf(f, "\\x{%x}", c);
125  return 0;  return 0;
126    
# Line 233  return (ptype == pvalue)? "??" : "??"; Line 233  return (ptype == pvalue)? "??" : "??";
233  }  }
234    
235    
236    /*************************************************
237    *       Print Unicode property value             *
238    *************************************************/
239    
240    /* "Normal" properties can be printed from tables. The PT_CLIST property is a
241    pseudo-property that contains a pointer to a list of case-equivalent
242    characters. This is used only when UCP support is available and UTF mode is
243    selected. It should never occur otherwise, but just in case it does, have
244    something ready to print. */
245    
246    static void
247    print_prop(FILE *f, pcre_uchar *code, const char *before, const char *after)
248    {
249    if (code[1] != PT_CLIST)
250      {
251      fprintf(f, "%s%s %s%s", before, priv_OP_names[*code], get_ucpname(code[1],
252        code[2]), after);
253      }
254    else
255      {
256      const char *not = (*code == OP_PROP)? "" : "not ";
257    #ifndef SUPPORT_UCP
258      fprintf(f, "%s%sclist %d%s", before, not, code[2], after);
259    #else
260      const pcre_uint32 *p = PRIV(ucd_caseless_sets) + code[2];
261      fprintf (f, "%s%sclist", before, not);
262      while (*p < NOTACHAR) fprintf(f, " %04x", *p++);
263      fprintf(f, "%s", after);
264    #endif
265      }
266    }
267    
268    
269    
270    
271  /*************************************************  /*************************************************
272  *         Print compiled regex                   *  *         Print compiled regex                   *
# Line 427  for(;;) Line 461  for(;;)
461      fprintf(f, " %s ", flag);      fprintf(f, " %s ", flag);
462      if (*code >= OP_TYPESTAR)      if (*code >= OP_TYPESTAR)
463        {        {
       fprintf(f, "%s", priv_OP_names[code[1]]);  
464        if (code[1] == OP_PROP || code[1] == OP_NOTPROP)        if (code[1] == OP_PROP || code[1] == OP_NOTPROP)
465          {          {
466          fprintf(f, " %s ", get_ucpname(code[2], code[3]));          print_prop(f, code + 1, "", " ");
467          extra = 2;          extra = 2;
468          }          }
469          else fprintf(f, "%s", priv_OP_names[code[1]]);
470        }        }
471      else extra = print_char(f, code+1, utf);      else extra = print_char(f, code+1, utf);
472      fprintf(f, "%s", priv_OP_names[*code]);      fprintf(f, "%s", priv_OP_names[*code]);
# Line 461  for(;;) Line 495  for(;;)
495      case OP_TYPEUPTO:      case OP_TYPEUPTO:
496      case OP_TYPEMINUPTO:      case OP_TYPEMINUPTO:
497      case OP_TYPEPOSUPTO:      case OP_TYPEPOSUPTO:
     fprintf(f, "    %s", priv_OP_names[code[1 + IMM2_SIZE]]);  
498      if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)      if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)
499        {        {
500        fprintf(f, " %s ", get_ucpname(code[1 + IMM2_SIZE + 1],        print_prop(f, code + IMM2_SIZE + 1, "    ", " ");
         code[1 + IMM2_SIZE + 2]));  
501        extra = 2;        extra = 2;
502        }        }
503        else fprintf(f, "    %s", priv_OP_names[code[1 + IMM2_SIZE]]);
504      fprintf(f, "{");      fprintf(f, "{");
505      if (*code != OP_TYPEEXACT) fprintf(f, "0,");      if (*code != OP_TYPEEXACT) fprintf(f, "0,");
506      fprintf(f, "%d}", GET2(code,1));      fprintf(f, "%d}", GET2(code,1));
# Line 552  for(;;) Line 585  for(;;)
585    
586      case OP_PROP:      case OP_PROP:
587      case OP_NOTPROP:      case OP_NOTPROP:
588      fprintf(f, "    %s %s", priv_OP_names[*code], get_ucpname(code[1], code[2]));      print_prop(f, code, "    ", "");
589      break;      break;
590    
591      /* OP_XCLASS can only occur in UTF or PCRE16 modes. However, there's no      /* OP_XCLASS can only occur in UTF or PCRE16 modes. However, there's no

Legend:
Removed from v.1045  
changed lines
  Added in v.1046

  ViewVC Help
Powered by ViewVC 1.1.5