Changeset 28148 in webkit for trunk/JavaScriptCore/pcre/pcre_exec.cpp
- Timestamp:
- Nov 29, 2007, 3:13:33 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/pcre/pcre_exec.cpp
r28144 r28148 118 118 doing traditional NFA matching, so that they are thread-safe. */ 119 119 120 typedef struct match_data {120 struct MatchData { 121 121 unsigned long int match_call_count; /* As it says */ 122 int *offset_vector; /* Offset vector */122 int* offset_vector; /* Offset vector */ 123 123 int offset_end; /* One past the end */ 124 124 int offset_max; /* The maximum usable for return data */ 125 const uschar *lcc; /* Points to lower casing table */126 const uschar *ctypes; /* Points to table of type maps */125 const uschar* lcc; /* Points to lower casing table */ 126 const uschar* ctypes; /* Points to table of type maps */ 127 127 bool offset_overflow; /* Set if too many extractions */ 128 128 UChar* start_subject; /* Start of the subject string */ … … 132 132 bool multiline; 133 133 bool caseless; 134 } match_data;134 }; 135 135 136 136 #define match_isgroup true /* Set if start of bracketed group */ … … 166 166 */ 167 167 168 static void 169 pchars(const UChar* p, int length, bool is_subject, match_data *md) 168 static void pchars(const UChar* p, int length, bool is_subject, MatchData *md) 170 169 { 171 int c; 172 if (is_subject && length > md->end_subject - p) length = md->end_subject - p; 173 while (length-- > 0) 174 if (isprint(c = *(p++))) printf("%c", c); 175 else if (c < 256) printf("\\x%02x", c); 176 else printf("\\x{%x}", c); 170 if (is_subject && length > md->end_subject - p) 171 length = md->end_subject - p; 172 while (length-- > 0) { 173 int c; 174 if (isprint(c = *(p++))) 175 printf("%c", c); 176 else if (c < 256) 177 printf("\\x%02x", c); 178 else 179 printf("\\x{%x}", c); 180 } 177 181 } 178 182 #endif … … 197 201 198 202 static bool 199 match_ref(int offset, UChar* eptr, int length, match_data *md)203 match_ref(int offset, UChar* eptr, int length, MatchData *md) 200 204 { 201 205 UChar* p = md->start_subject + md->offset_vector[offset]; … … 404 408 } 405 409 406 static int match(UChar* eptr, const uschar* ecode, int offset_top, match_data* md)410 static int match(UChar* eptr, const uschar* ecode, int offset_top, MatchData* md) 407 411 { 408 412 int is_match = false; … … 2068 2072 ASSERT(offsets || offsetcount == 0); 2069 2073 2070 match_data match_block;2074 MatchData match_block; 2071 2075 match_block.start_subject = (UChar*)subject; 2072 2076 match_block.end_subject = match_block.start_subject + length; … … 2076 2080 match_block.ctypes = _pcre_default_tables + ctypes_offset; 2077 2081 2078 match_block.multiline = (re->options & PCRE_MULTILINE) != 0;2079 match_block.caseless = (re->options & PCRE_CASELESS) != 0;2082 match_block.multiline = (re->options & PCRE_MULTILINE); 2083 match_block.caseless = (re->options & PCRE_CASELESS); 2080 2084 2081 2085 /* If the expression has got more back references than the offsets supplied can … … 2150 2154 UChar* start_match = (UChar*)subject + start_offset; 2151 2155 UChar* req_byte_ptr = start_match - 1; 2152 bool startline = re->options & PCRE_STARTLINE;2156 bool useMultiLineFirstCharOptimization = re->options & OptionUseMultiLineFirstCharOptimization; 2153 2157 2154 2158 do { … … 2189 2193 2190 2194 /* Or to just after \n for a multiline match if possible */ 2191 2192 else if (startline) { 2195 else if (useMultiLineFirstCharOptimization) { 2193 2196 if (start_match > match_block.start_subject + start_offset) { 2194 2197 while (start_match < end_subject && !isNewline(start_match[-1]))
Note:
See TracChangeset
for help on using the changeset viewer.