Changeset 27419 in webkit for trunk/JavaScriptCore/pcre/pcre_maketables.c
- Timestamp:
- Nov 3, 2007, 10:22:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/pcre/pcre_maketables.c
r26697 r27419 39 39 40 40 41 /* This module contains the external function pcre_maketables(), which builds42 character tables for PCRE in the current locale. The file is compiled on its43 own as part of the PCRE library. However, it is also included in the44 compilation of dftables.c, in which case the macro DFTABLES is defined. */45 46 47 #ifndef DFTABLES48 #include "pcre_internal.h"49 #endif50 51 52 41 /************************************************* 53 42 * Create PCRE character tables * … … 64 53 */ 65 54 66 const unsigned char *55 static const unsigned char * 67 56 pcre_maketables(void) 68 57 { … … 97 86 98 87 memset(p, 0, cbit_length); 99 for (i = 0; i < 256; i++)88 for (i = 0; i < 128; i++) 100 89 { 101 90 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 91 if (isalnum(i)) p[cbit_word + i/8] |= 1 << (i&7); 105 92 if (i == '_') p[cbit_word + i/8] |= 1 << (i&7); 106 93 if (isspace(i)) p[cbit_space + i/8] |= 1 << (i&7); 107 if (isxdigit(i))p[cbit_xdigit + i/8] |= 1 << (i&7);108 if (isgraph(i)) p[cbit_graph + i/8] |= 1 << (i&7);109 if (isprint(i)) p[cbit_print + i/8] |= 1 << (i&7);110 if (ispunct(i)) p[cbit_punct + i/8] |= 1 << (i&7);111 if (iscntrl(i)) p[cbit_cntrl + i/8] |= 1 << (i&7);112 94 } 113 95 p += cbit_length; … … 117 99 within regexes. */ 118 100 119 for (i = 0; i < 256; i++)101 for (i = 0; i < 128; i++) 120 102 { 121 103 int x = 0; 122 if ( 123 #if !JAVASCRIPT 124 *i != 0x0b && 125 #endif 126 isspace(i)) x += ctype_space; 127 if (isalpha(i)) x += ctype_letter; 104 if (isspace(i)) x += ctype_space; 128 105 if (isdigit(i)) x += ctype_digit; 129 106 if (isxdigit(i)) x += ctype_xdigit; 130 107 if (isalnum(i) || i == '_') x += ctype_word; 131 132 /* Note: strchr includes the terminating zero in the characters it considers. 133 In this instance, that is ok because we want binary zero to be flagged as a 134 meta-character, which in this sense is any character that terminates a run 135 of data characters. */ 136 137 if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta; *p++ = x; } 108 *p++ = x; 109 } 138 110 139 111 return yield;
Note:
See TracChangeset
for help on using the changeset viewer.