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

Diff of /code/trunk/pcre_xclass.c

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

revision 85 by nigel, Sat Feb 24 21:41:13 2007 UTC revision 351 by ph10, Fri Jul 4 18:27:16 2008 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2005 University of Cambridge             Copyright (c) 1997-2008 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 43  class (one that contains characters whos Line 43  class (one that contains characters whos
43  pcre_exec() and pcre_def_exec(). */  pcre_exec() and pcre_def_exec(). */
44    
45    
46    #ifdef HAVE_CONFIG_H
47    #include "config.h"
48    #endif
49    
50  #include "pcre_internal.h"  #include "pcre_internal.h"
51    
52    
# Line 60  Arguments: Line 64  Arguments:
64  Returns:      TRUE if character matches, else FALSE  Returns:      TRUE if character matches, else FALSE
65  */  */
66    
67  PCRE_EXPORT BOOL  BOOL
68  _pcre_xclass(int c, const uschar *data)  _pcre_xclass(int c, const uschar *data)
69  {  {
70  int t;  int t;
# Line 100  while ((t = *data++) != XCL_END) Line 104  while ((t = *data++) != XCL_END)
104  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
105    else  /* XCL_PROP & XCL_NOTPROP */    else  /* XCL_PROP & XCL_NOTPROP */
106      {      {
107      int chartype, othercase;      const ucd_record * prop = GET_UCD(c);
108      int rqdtype = *data++;  
109      int category = _pcre_ucp_findchar(c, &chartype, &othercase);      switch(*data)
     if (rqdtype >= 128)  
       {  
       if ((rqdtype - 128 == category) == (t == XCL_PROP)) return !negated;  
       }  
     else  
110        {        {
111        if ((rqdtype == chartype) == (t == XCL_PROP)) return !negated;        case PT_ANY:
112          if (t == XCL_PROP) return !negated;
113          break;
114    
115          case PT_LAMP:
116          if ((prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || prop->chartype == ucp_Lt) ==
117              (t == XCL_PROP)) return !negated;
118          break;
119    
120          case PT_GC:
121          if ((data[1] == _pcre_ucp_gentype[prop->chartype]) == (t == XCL_PROP)) return !negated;
122          break;
123    
124          case PT_PC:
125          if ((data[1] == prop->chartype) == (t == XCL_PROP)) return !negated;
126          break;
127    
128          case PT_SC:
129          if ((data[1] == prop->script) == (t == XCL_PROP)) return !negated;
130          break;
131    
132          /* This should never occur, but compilers may mutter if there is no
133          default. */
134    
135          default:
136          return FALSE;
137        }        }
138    
139        data += 2;
140      }      }
141  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
142    }    }

Legend:
Removed from v.85  
changed lines
  Added in v.351

  ViewVC Help
Powered by ViewVC 1.1.5