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-2006 University of Cambridge |
Copyright (c) 1997-2007 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 |
299 |
int Xprop_category; |
int Xprop_category; |
300 |
int Xprop_chartype; |
int Xprop_chartype; |
301 |
int Xprop_script; |
int Xprop_script; |
302 |
|
int Xoclength; |
303 |
|
uschar Xocchars[8]; |
304 |
#endif |
#endif |
305 |
|
|
306 |
int Xctype; |
int Xctype; |
443 |
#define prop_category frame->Xprop_category |
#define prop_category frame->Xprop_category |
444 |
#define prop_chartype frame->Xprop_chartype |
#define prop_chartype frame->Xprop_chartype |
445 |
#define prop_script frame->Xprop_script |
#define prop_script frame->Xprop_script |
446 |
|
#define oclength frame->Xoclength |
447 |
|
#define occhars frame->Xocchars |
448 |
#endif |
#endif |
449 |
|
|
450 |
#define ctype frame->Xctype |
#define ctype frame->Xctype |
498 |
int prop_category; |
int prop_category; |
499 |
int prop_chartype; |
int prop_chartype; |
500 |
int prop_script; |
int prop_script; |
501 |
|
int oclength; |
502 |
|
uschar occhars[8]; |
503 |
#endif |
#endif |
504 |
|
|
505 |
int ctype; |
int ctype; |
2051 |
|
|
2052 |
if (length > 1) |
if (length > 1) |
2053 |
{ |
{ |
|
int oclength = 0; |
|
|
uschar occhars[8]; |
|
|
|
|
2054 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
2055 |
unsigned int othercase; |
unsigned int othercase; |
2056 |
if ((ims & PCRE_CASELESS) != 0 && |
if ((ims & PCRE_CASELESS) != 0 && |
2057 |
(othercase = _pcre_ucp_othercase(fc)) != NOTACHAR) |
(othercase = _pcre_ucp_othercase(fc)) != NOTACHAR) |
2058 |
oclength = _pcre_ord2utf8(othercase, occhars); |
oclength = _pcre_ord2utf8(othercase, occhars); |
2059 |
|
else oclength = 0; |
2060 |
#endif /* SUPPORT_UCP */ |
#endif /* SUPPORT_UCP */ |
2061 |
|
|
2062 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
2063 |
{ |
{ |
2064 |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
2065 |
|
#ifdef SUPPORT_UCP |
2066 |
/* Need braces because of following else */ |
/* Need braces because of following else */ |
2067 |
else if (oclength == 0) { RRETURN(MATCH_NOMATCH); } |
else if (oclength == 0) { RRETURN(MATCH_NOMATCH); } |
2068 |
else |
else |
2070 |
if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH); |
if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH); |
2071 |
eptr += oclength; |
eptr += oclength; |
2072 |
} |
} |
2073 |
|
#else /* without SUPPORT_UCP */ |
2074 |
|
else { RRETURN(MATCH_NOMATCH); } |
2075 |
|
#endif /* SUPPORT_UCP */ |
2076 |
} |
} |
2077 |
|
|
2078 |
if (min == max) continue; |
if (min == max) continue; |
2085 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
2086 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
2087 |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
2088 |
|
#ifdef SUPPORT_UCP |
2089 |
/* Need braces because of following else */ |
/* Need braces because of following else */ |
2090 |
else if (oclength == 0) { RRETURN(MATCH_NOMATCH); } |
else if (oclength == 0) { RRETURN(MATCH_NOMATCH); } |
2091 |
else |
else |
2093 |
if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH); |
if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH); |
2094 |
eptr += oclength; |
eptr += oclength; |
2095 |
} |
} |
2096 |
|
#else /* without SUPPORT_UCP */ |
2097 |
|
else { RRETURN (MATCH_NOMATCH); } |
2098 |
|
#endif /* SUPPORT_UCP */ |
2099 |
} |
} |
2100 |
/* Control never gets here */ |
/* Control never gets here */ |
2101 |
} |
} |
2107 |
{ |
{ |
2108 |
if (eptr > md->end_subject - length) break; |
if (eptr > md->end_subject - length) break; |
2109 |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
2110 |
|
#ifdef SUPPORT_UCP |
2111 |
else if (oclength == 0) break; |
else if (oclength == 0) break; |
2112 |
else |
else |
2113 |
{ |
{ |
2114 |
if (memcmp(eptr, occhars, oclength) != 0) break; |
if (memcmp(eptr, occhars, oclength) != 0) break; |
2115 |
eptr += oclength; |
eptr += oclength; |
2116 |
} |
} |
2117 |
|
#else /* without SUPPORT_UCP */ |
2118 |
|
else break; |
2119 |
|
#endif /* SUPPORT_UCP */ |
2120 |
} |
} |
2121 |
|
|
2122 |
if (possessive) continue; |
if (possessive) continue; |
2124 |
{ |
{ |
2125 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
2126 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
2127 |
|
#ifdef SUPPORT_UCP |
2128 |
|
eptr--; |
2129 |
|
BACKCHAR(eptr); |
2130 |
|
#else /* without SUPPORT_UCP */ |
2131 |
eptr -= length; |
eptr -= length; |
2132 |
|
#endif /* SUPPORT_UCP */ |
2133 |
} |
} |
2134 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
2135 |
} |
} |