- Timestamp:
- Jun 14, 2010, 4:05:02 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/utility.cc
r1098 r1101 279 279 } 280 280 return regexp__(first1+1, last1, first2+1, last2, item+1); 281 /*282 while (*first2 != ']') {283 if (*first2==*first1) {284 found = true;285 vec.back() = *first1;286 vec.push_back("");287 }288 ++first2;289 assert(first2!=last2);290 }291 if (!found)292 return false;293 return regexp(first1+1, last1, first2+1, last2, vec);294 */295 281 } 296 282 … … 300 286 return false; 301 287 return regexp__(first1+1, last1, first2+1, last2, item); 302 303 /*304 305 306 307 if (first1==last1)308 return false;309 if (*first1 != *first2)310 return false;311 return regexp(first1+1, last1, first2+1, last2, vec);312 313 /// hm314 if (first1==last1 || first2==last2)315 return false;316 317 // then we take care of the real stuff318 if (*first2 == '*'){319 // trying '*' to consume another character320 vec.back().append(1, *first1);321 if (regexp(first1+1, last1, first2, last2, vec) )322 return true;323 assert(vec.back().size());324 vec.back().resize(vec.back().size()-1);325 326 // stepping away from the '*'327 vec.push_back("");328 if (regexp(first1, last1, first2+1, last2, vec))329 return true;330 vec.pop_back();331 return false;332 }333 else if (*first2 == '?'){334 // eating a character335 vec.back() = std::string(first1, first1+1);336 vec.push_back("");337 if (regexp(first1+1, last1, first2+1, last2, vec) )338 return true;339 vec.pop_back();340 // ? interpreted as zero characters341 vec.back() = "";342 vec.push_back("");343 if (regexp(first1, last1, first2+1, last2, vec) )344 return true;345 vec.pop_back();346 return false;347 }348 if (*first1 != *first2)349 return false;350 return regexp(++first1, last1, ++first2, last2, vec);351 */352 288 } 353 289
Note: See TracChangeset
for help on using the changeset viewer.