MCPcopy Create free account
hub / github.com/apache/trafficserver / parse

Method parse

plugins/experimental/txn_box/plugin/src/Rxp.cc:34–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32using swoc::Rv;
33
34Rv<Rxp>
35Rxp::parse(TextView const &str, Options const &options)
36{
37 int errc = 0;
38 size_t err_off = 0;
39 uint32_t rxp_opt = 0;
40 if (options.f.nc) {
41 rxp_opt = PCRE2_CASELESS;
42 }
43 auto result = pcre2_compile(reinterpret_cast<unsigned const char *>(str.data()), str.size(), rxp_opt, &errc, &err_off, nullptr);
44 if (nullptr == result) {
45 PCRE2_UCHAR err_buff[128];
46 auto err_size = pcre2_get_error_message(errc, err_buff, sizeof(err_buff));
47 return Errata(S_ERROR, R"(Failed to parse regular expression - error "{}" [{}] at offset {} in "{}".)",
48 TextView(reinterpret_cast<char const *>(err_buff), err_size), errc, err_off, str);
49 }
50 return {result};
51};
52
53int
54Rxp::operator()(swoc::TextView text, pcre2_match_data *match) const

Callers 1

parse_unquoted_exprMethod · 0.45

Calls 4

ErrataClass · 0.85
TextViewClass · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected