| 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-2006 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 |
| 60 |
Returns: TRUE if character matches, else FALSE |
Returns: TRUE if character matches, else FALSE |
| 61 |
*/ |
*/ |
| 62 |
|
|
| 63 |
PCRE_EXPORT BOOL |
BOOL |
| 64 |
_pcre_xclass(int c, const uschar *data) |
_pcre_xclass(int c, const uschar *data) |
| 65 |
{ |
{ |
| 66 |
int t; |
int t; |
| 100 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 101 |
else /* XCL_PROP & XCL_NOTPROP */ |
else /* XCL_PROP & XCL_NOTPROP */ |
| 102 |
{ |
{ |
| 103 |
int chartype, othercase; |
int chartype, script; |
| 104 |
int rqdtype = *data++; |
int category = _pcre_ucp_findprop(c, &chartype, &script); |
| 105 |
int category = _pcre_ucp_findchar(c, &chartype, &othercase); |
|
| 106 |
if (rqdtype >= 128) |
switch(*data) |
|
{ |
|
|
if ((rqdtype - 128 == category) == (t == XCL_PROP)) return !negated; |
|
|
} |
|
|
else |
|
| 107 |
{ |
{ |
| 108 |
if ((rqdtype == chartype) == (t == XCL_PROP)) return !negated; |
case PT_ANY: |
| 109 |
|
if (t == XCL_PROP) return !negated; |
| 110 |
|
break; |
| 111 |
|
|
| 112 |
|
case PT_LAMP: |
| 113 |
|
if ((chartype == ucp_Lu || chartype == ucp_Ll || chartype == ucp_Lt) == |
| 114 |
|
(t == XCL_PROP)) return !negated; |
| 115 |
|
break; |
| 116 |
|
|
| 117 |
|
case PT_GC: |
| 118 |
|
if ((data[1] == category) == (t == XCL_PROP)) return !negated; |
| 119 |
|
break; |
| 120 |
|
|
| 121 |
|
case PT_PC: |
| 122 |
|
if ((data[1] == chartype) == (t == XCL_PROP)) return !negated; |
| 123 |
|
break; |
| 124 |
|
|
| 125 |
|
case PT_SC: |
| 126 |
|
if ((data[1] == script) == (t == XCL_PROP)) return !negated; |
| 127 |
|
break; |
| 128 |
|
|
| 129 |
|
/* This should never occur, but compilers may mutter if there is no |
| 130 |
|
default. */ |
| 131 |
|
|
| 132 |
|
default: |
| 133 |
|
return FALSE; |
| 134 |
} |
} |
| 135 |
|
|
| 136 |
|
data += 2; |
| 137 |
} |
} |
| 138 |
#endif /* SUPPORT_UCP */ |
#endif /* SUPPORT_UCP */ |
| 139 |
} |
} |