| 36 |
#include <assert.h> |
#include <assert.h> |
| 37 |
#include <errno.h> |
#include <errno.h> |
| 38 |
#include <string> |
#include <string> |
| 39 |
|
#include <algorithm> |
| 40 |
#include "config.h" |
#include "config.h" |
| 41 |
// We need this to compile the proper dll on windows/msys. This is copied |
// We need this to compile the proper dll on windows/msys. This is copied |
| 42 |
// from pcre_internal.h. It would probably be better just to include that. |
// from pcre_internal.h. It would probably be better just to include that. |
| 98 |
pcre* RE::Compile(Anchor anchor) { |
pcre* RE::Compile(Anchor anchor) { |
| 99 |
// First, convert RE_Options into pcre options |
// First, convert RE_Options into pcre options |
| 100 |
int pcre_options = 0; |
int pcre_options = 0; |
| 101 |
if (options_.utf8()) |
pcre_options = options_.all_options(); |
|
pcre_options |= PCRE_UTF8; |
|
| 102 |
|
|
| 103 |
// Special treatment for anchoring. This is needed because at |
// Special treatment for anchoring. This is needed because at |
| 104 |
// runtime pcre only provides an option for anchoring at the |
// runtime pcre only provides an option for anchoring at the |
| 378 |
int matches = TryMatch(text, 0, UNANCHORED, vec, kVecSize); |
int matches = TryMatch(text, 0, UNANCHORED, vec, kVecSize); |
| 379 |
if (matches == 0) |
if (matches == 0) |
| 380 |
return false; |
return false; |
| 381 |
out->clear(); |
out->erase(); |
| 382 |
return Rewrite(out, rewrite, text, vec, matches); |
return Rewrite(out, rewrite, text, vec, matches); |
| 383 |
} |
} |
| 384 |
|
|