| 44 | } |
| 45 | |
| 46 | void |
| 47 | Matcher::PCRE::Add(cripts::string_view regex, uint32_t options, bool jit) |
| 48 | { |
| 49 | int errorcode = 0; |
| 50 | PCRE2_SIZE erroroffset = 0; |
| 51 | pcre2_code *re = |
| 52 | pcre2_compile(reinterpret_cast<PCRE2_SPTR>(regex.data()), regex.length(), options, &errorcode, &erroroffset, nullptr); |
| 53 | |
| 54 | if (!re) { |
| 55 | PCRE2_UCHAR error[256]; |
| 56 | |
| 57 | pcre2_get_error_message(errorcode, error, sizeof(error)); |
| 58 | CFatal("[Matcher::PCRE]: PCRE compile error `%s': %.*s", error, static_cast<int>(regex.length()), regex.data()); |
| 59 | } else { |
| 60 | if (jit) { |
| 61 | if (0 != pcre2_jit_compile(re, PCRE2_JIT_COMPLETE)) { |
| 62 | CFatal("[Matcher::PCRE]: PCRE JIT compile error: %.*s", static_cast<int>(regex.length()), regex.data()); |
| 63 | } |
| 64 | } |
| 65 | _regexes.emplace_back(regex, re); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | Matcher::PCRE::Result |
| 70 | Matcher::PCRE::Contains(cripts::string_view subject, PCRE2_SIZE offset, uint32_t options) |
nothing calls this directly
no test coverage detected