| 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-2007 University of Cambridge |
Copyright (c) 1997-2009 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 |
| 39 |
|
|
| 40 |
|
|
| 41 |
/* This module contains an internal function that is used to match an extended |
/* This module contains an internal function that is used to match an extended |
| 42 |
class (one that contains characters whose values are > 255). It is used by both |
class. It is used by both pcre_exec() and pcre_def_exec(). */ |
|
pcre_exec() and pcre_def_exec(). */ |
|
| 43 |
|
|
| 44 |
|
|
| 45 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
| 54 |
*************************************************/ |
*************************************************/ |
| 55 |
|
|
| 56 |
/* This function is called to match a character against an extended class that |
/* This function is called to match a character against an extended class that |
| 57 |
might contain values > 255. |
might contain values > 255 and/or Unicode properties. |
| 58 |
|
|
| 59 |
Arguments: |
Arguments: |
| 60 |
c the character |
c the character |
| 103 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 104 |
else /* XCL_PROP & XCL_NOTPROP */ |
else /* XCL_PROP & XCL_NOTPROP */ |
| 105 |
{ |
{ |
| 106 |
int chartype, script; |
const ucd_record *prop = GET_UCD(c); |
|
int category = _pcre_ucp_findprop(c, &chartype, &script); |
|
| 107 |
|
|
| 108 |
switch(*data) |
switch(*data) |
| 109 |
{ |
{ |
| 112 |
break; |
break; |
| 113 |
|
|
| 114 |
case PT_LAMP: |
case PT_LAMP: |
| 115 |
if ((chartype == ucp_Lu || chartype == ucp_Ll || chartype == ucp_Lt) == |
if ((prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || prop->chartype == ucp_Lt) == |
| 116 |
(t == XCL_PROP)) return !negated; |
(t == XCL_PROP)) return !negated; |
| 117 |
break; |
break; |
| 118 |
|
|
| 119 |
case PT_GC: |
case PT_GC: |
| 120 |
if ((data[1] == category) == (t == XCL_PROP)) return !negated; |
if ((data[1] == _pcre_ucp_gentype[prop->chartype]) == (t == XCL_PROP)) return !negated; |
| 121 |
break; |
break; |
| 122 |
|
|
| 123 |
case PT_PC: |
case PT_PC: |
| 124 |
if ((data[1] == chartype) == (t == XCL_PROP)) return !negated; |
if ((data[1] == prop->chartype) == (t == XCL_PROP)) return !negated; |
| 125 |
break; |
break; |
| 126 |
|
|
| 127 |
case PT_SC: |
case PT_SC: |
| 128 |
if ((data[1] == script) == (t == XCL_PROP)) return !negated; |
if ((data[1] == prop->script) == (t == XCL_PROP)) return !negated; |
| 129 |
break; |
break; |
| 130 |
|
|
| 131 |
/* This should never occur, but compilers may mutter if there is no |
/* This should never occur, but compilers may mutter if there is no |