Changeset 26697 in webkit for trunk/JavaScriptCore/pcre/pcre_maketables.c
- Timestamp:
- Oct 16, 2007, 10:38:39 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/pcre/pcre_maketables.c
r11962 r26697 7 7 8 8 Written by Philip Hazel 9 Copyright (c) 1997-200 5University of Cambridge9 Copyright (c) 1997-2006 University of Cambridge 10 10 11 11 ----------------------------------------------------------------------------- … … 87 87 for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i); 88 88 89 /* Then the character class tables. Don't try to be clever and save effort 90 on exclusive ones - in some locales things may be different. Note that the 91 table for "space" includes everything "isspace" gives, including VT in the 92 default locale. This makes it work for the POSIX class [:space:]. */ 89 /* Then the character class tables. Don't try to be clever and save effort on 90 exclusive ones - in some locales things may be different. Note that the table 91 for "space" includes everything "isspace" gives, including VT in the default 92 locale. This makes it work for the POSIX class [:space:]. Note also that it is 93 possible for a character to be alnum or alpha without being lower or upper, 94 such as "male and female ordinals" (\xAA and \xBA) in the fr_FR locale (at 95 least under Debian Linux's locales as of 12/2005). So we must test for alnum 96 specially. */ 93 97 94 98 memset(p, 0, cbit_length); 95 99 for (i = 0; i < 256; i++) 96 100 { 97 if (isdigit(i)) 98 { 99 p[cbit_digit + i/8] |= 1 << (i&7); 100 p[cbit_word + i/8] |= 1 << (i&7); 101 } 102 if (isupper(i)) 103 { 104 p[cbit_upper + i/8] |= 1 << (i&7); 105 p[cbit_word + i/8] |= 1 << (i&7); 106 } 107 if (islower(i)) 108 { 109 p[cbit_lower + i/8] |= 1 << (i&7); 110 p[cbit_word + i/8] |= 1 << (i&7); 111 } 101 if (isdigit(i)) p[cbit_digit + i/8] |= 1 << (i&7); 102 if (isupper(i)) p[cbit_upper + i/8] |= 1 << (i&7); 103 if (islower(i)) p[cbit_lower + i/8] |= 1 << (i&7); 104 if (isalnum(i)) p[cbit_word + i/8] |= 1 << (i&7); 112 105 if (i == '_') p[cbit_word + i/8] |= 1 << (i&7); 113 106 if (isspace(i)) p[cbit_space + i/8] |= 1 << (i&7); … … 123 116 space chars, because Perl doesn't recognize it as such for \s and for comments 124 117 within regexes. */ 125 /* But no, in JavaScriptCore we don't, so that's commented out below. */126 118 127 119 for (i = 0; i < 256; i++) 128 120 { 129 121 int x = 0; 130 if (/*i != 0x0b && */ isspace(i)) x += ctype_space; 122 if ( 123 #if !JAVASCRIPT 124 *i != 0x0b && 125 #endif 126 isspace(i)) x += ctype_space; 131 127 if (isalpha(i)) x += ctype_letter; 132 128 if (isdigit(i)) x += ctype_digit;
Note:
See TracChangeset
for help on using the changeset viewer.