diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2013-10-05 15:45:11 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2013-10-05 15:45:11 +0000 |
commit | c728cbfd976748abdf0511801e805ff0c846cdf2 (patch) | |
tree | 20ecb1e9a1033c7a223740b78e5036ab7fc75750 /pcre_maketables.c | |
parent | 5f42224005b7d9a503903e3342ec7ada75590b07 (diff) | |
download | pcre-c728cbfd976748abdf0511801e805ff0c846cdf2.tar.gz |
Add VT to the set of characters recognized as white space.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1364 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_maketables.c')
-rw-r--r-- | pcre_maketables.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/pcre_maketables.c b/pcre_maketables.c index 610a669..3a5f6ef 100644 --- a/pcre_maketables.c +++ b/pcre_maketables.c @@ -98,13 +98,17 @@ for (i = 0; i < 256; i++) *p++ = tolower(i); for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i); /* Then the character class tables. Don't try to be clever and save effort on -exclusive ones - in some locales things may be different. Note that the table -for "space" includes everything "isspace" gives, including VT in the default -locale. This makes it work for the POSIX class [:space:]. Note also that it is -possible for a character to be alnum or alpha without being lower or upper, -such as "male and female ordinals" (\xAA and \xBA) in the fr_FR locale (at -least under Debian Linux's locales as of 12/2005). So we must test for alnum -specially. */ +exclusive ones - in some locales things may be different. + +Note that the table for "space" includes everything "isspace" gives, including +VT in the default locale. This makes it work for the POSIX class [:space:]. +From release 8.34 is is also correct for Perl space, because Perl added VT at +release 5.18. + +Note also that it is possible for a character to be alnum or alpha without +being lower or upper, such as "male and female ordinals" (\xAA and \xBA) in the +fr_FR locale (at least under Debian Linux's locales as of 12/2005). So we must +test for alnum specially. */ memset(p, 0, cbit_length); for (i = 0; i < 256; i++) @@ -123,14 +127,15 @@ for (i = 0; i < 256; i++) } p += cbit_length; -/* Finally, the character type table. In this, we exclude VT from the white -space chars, because Perl doesn't recognize it as such for \s and for comments -within regexes. */ +/* Finally, the character type table. In this, we used to exclude VT from the +white space chars, because Perl didn't recognize it as such for \s and for +comments within regexes. However, Perl changed at release 5.18, so PCRE changed +at release 8.34. */ for (i = 0; i < 256; i++) { int x = 0; - if (i != CHAR_VT && isspace(i)) x += ctype_space; + if (isspace(i)) x += ctype_space; if (isalpha(i)) x += ctype_letter; if (isdigit(i)) x += ctype_digit; if (isxdigit(i)) x += ctype_xdigit; |