diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2010-05-05 10:44:20 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2010-05-05 10:44:20 +0000 |
commit | 85b995f30cc9bf0bb04f5b3b3707a216a56b6bdf (patch) | |
tree | 6410c80d7502e73c04d5eb0fa4f8ae885e6e3449 /pcre_xclass.c | |
parent | 2bcdcbf324bea8939d73f9b32e3625539a4d209e (diff) | |
download | pcre-85b995f30cc9bf0bb04f5b3b3707a216a56b6bdf.tar.gz |
Add new special properties Xan, Xps, Xsp, Xwd to help with \w etc.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@517 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_xclass.c')
-rw-r--r-- | pcre_xclass.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/pcre_xclass.c b/pcre_xclass.c index dc67c23..f392b82 100644 --- a/pcre_xclass.c +++ b/pcre_xclass.c @@ -6,7 +6,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel - Copyright (c) 1997-2009 University of Cambridge + Copyright (c) 1997-2010 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -112,12 +112,13 @@ while ((t = *data++) != XCL_END) break; case PT_LAMP: - if ((prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || prop->chartype == ucp_Lt) == - (t == XCL_PROP)) return !negated; + if ((prop->chartype == ucp_Lu || prop->chartype == ucp_Ll || + prop->chartype == ucp_Lt) == (t == XCL_PROP)) return !negated; break; case PT_GC: - if ((data[1] == _pcre_ucp_gentype[prop->chartype]) == (t == XCL_PROP)) return !negated; + if ((data[1] == _pcre_ucp_gentype[prop->chartype]) == (t == XCL_PROP)) + return !negated; break; case PT_PC: @@ -127,6 +128,33 @@ while ((t = *data++) != XCL_END) case PT_SC: if ((data[1] == prop->script) == (t == XCL_PROP)) return !negated; break; + + case PT_ALNUM: + if ((_pcre_ucp_gentype[prop->chartype] == ucp_L || + _pcre_ucp_gentype[prop->chartype] == ucp_N) == (t == XCL_PROP)) + return !negated; + break; + + case PT_SPACE: /* Perl space */ + if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z || + c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR) + == (t == XCL_PROP)) + return !negated; + break; + + case PT_PXSPACE: /* POSIX space */ + if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z || + c == CHAR_HT || c == CHAR_NL || c == CHAR_VT || + c == CHAR_FF || c == CHAR_CR) == (t == XCL_PROP)) + return !negated; + break; + + case PT_WORD: + if ((_pcre_ucp_gentype[prop->chartype] == ucp_L || + _pcre_ucp_gentype[prop->chartype] == ucp_N || c == CHAR_UNDERSCORE) + == (t == XCL_PROP)) + return !negated; + break; /* This should never occur, but compilers may mutter if there is no default. */ |