bloaty/third_party/re2/re2/testing/tester.cc
Go to the documentation of this file.
1 // Copyright 2008 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4 
5 // Regular expression engine tester -- test all the implementations against each other.
6 
7 #include <stddef.h>
8 #include <stdint.h>
9 #include <string.h>
10 #include <string>
11 
12 #include "util/util.h"
13 #include "util/flags.h"
14 #include "util/logging.h"
15 #include "util/strutil.h"
16 #include "re2/testing/tester.h"
17 #include "re2/prog.h"
18 #include "re2/re2.h"
19 #include "re2/regexp.h"
20 
21 DEFINE_bool(dump_prog, false, "dump regexp program");
22 DEFINE_bool(log_okay, false, "log successful runs");
23 DEFINE_bool(dump_rprog, false, "dump reversed regexp program");
24 
25 DEFINE_int32(max_regexp_failures, 100,
26  "maximum number of regexp test failures (-1 = unlimited)");
27 
28 DEFINE_string(regexp_engines, "", "pattern to select regexp engines to test");
29 
30 namespace re2 {
31 
32 enum {
33  kMaxSubmatch = 1+16, // $0...$16
34 };
35 
36 const char* engine_names[kEngineMax] = {
37  "Backtrack",
38  "NFA",
39  "DFA",
40  "DFA1",
41  "OnePass",
42  "BitState",
43  "RE2",
44  "RE2a",
45  "RE2b",
46  "PCRE",
47 };
48 
49 // Returns the name of the engine.
50 static const char* EngineName(Engine e) {
51  CHECK_GE(e, 0);
53  CHECK(engine_names[e] != NULL);
54  return engine_names[e];
55 }
56 
57 // Returns bit mask of engines to use.
58 static uint32_t Engines() {
59  static bool did_parse = false;
60  static uint32_t cached_engines = 0;
61 
62  if (did_parse)
63  return cached_engines;
64 
65  if (FLAGS_regexp_engines.empty()) {
66  cached_engines = ~0;
67  } else {
68  for (Engine i = static_cast<Engine>(0); i < kEngineMax; i++)
69  if (FLAGS_regexp_engines.find(EngineName(i)) != std::string::npos)
70  cached_engines |= 1<<i;
71  }
72 
73  if (cached_engines == 0)
74  LOG(INFO) << "Warning: no engines enabled.";
75  if (!UsingPCRE)
76  cached_engines &= ~(1<<kEnginePCRE);
77  for (Engine i = static_cast<Engine>(0); i < kEngineMax; i++) {
78  if (cached_engines & (1<<i))
79  LOG(INFO) << EngineName(i) << " enabled";
80  }
81 
82  did_parse = true;
83  return cached_engines;
84 }
85 
86 // The result of running a match.
88  bool skipped; // test skipped: wasn't applicable
89  bool matched; // found a match
90  bool untrusted; // don't really trust the answer
91  bool have_submatch; // computed all submatch info
92  bool have_submatch0; // computed just submatch[0]
94 };
95 
97 
98 // Formats a single capture range s in text in the form (a,b)
99 // where a and b are the starting and ending offsets of s in text.
101  const StringPiece& s) {
102  if (s.data() == NULL)
103  return "(?,?)";
104  return StringPrintf("(%td,%td)",
105  s.begin() - text.begin(), s.end() - text.begin());
106 }
107 
108 // Returns whether text contains non-ASCII (>= 0x80) bytes.
109 static bool NonASCII(const StringPiece& text) {
110  for (size_t i = 0; i < text.size(); i++)
111  if ((uint8_t)text[i] >= 0x80)
112  return true;
113  return false;
114 }
115 
116 // Returns string representation of match kind.
118  switch (kind) {
119  case Prog::kFullMatch:
120  return "full match";
121  case Prog::kLongestMatch:
122  return "longest match";
123  case Prog::kFirstMatch:
124  return "first match";
125  case Prog::kManyMatch:
126  return "many match";
127  }
128  return "???";
129 }
130 
131 // Returns string representation of anchor kind.
133  switch (anchor) {
134  case Prog::kAnchored:
135  return "anchored";
136  case Prog::kUnanchored:
137  return "unanchored";
138  }
139  return "???";
140 }
141 
142 struct ParseMode {
145 };
146 
150  static_cast<Regexp::ParseFlags>(Regexp::LikePerl & ~Regexp::OneLine);
151 
152 static ParseMode parse_modes[] = {
153  { single_line, "single-line" },
154  { single_line|Regexp::Latin1, "single-line, latin1" },
155  { multi_line, "multiline" },
156  { multi_line|Regexp::NonGreedy, "multiline, nongreedy" },
157  { multi_line|Regexp::Latin1, "multiline, latin1" },
158 };
159 
161  for (size_t i = 0; i < arraysize(parse_modes); i++)
162  if (parse_modes[i].parse_flags == flags)
163  return parse_modes[i].desc;
164  return StringPrintf("%#x", static_cast<uint32_t>(flags));
165 }
166 
167 // Constructs and saves all the matching engines that
168 // will be required for the given tests.
171  : regexp_str_(regexp_str),
172  kind_(kind),
173  flags_(flags),
174  error_(false),
175  regexp_(NULL),
176  num_captures_(0),
177  prog_(NULL),
178  rprog_(NULL),
179  re_(NULL),
180  re2_(NULL) {
181 
182  VLOG(1) << CEscape(regexp_str);
183 
184  // Compile regexp to prog.
185  // Always required - needed for backtracking (reference implementation).
187  regexp_ = Regexp::Parse(regexp_str, flags, &status);
188  if (regexp_ == NULL) {
189  LOG(INFO) << "Cannot parse: " << CEscape(regexp_str_)
190  << " mode: " << FormatMode(flags);
191  error_ = true;
192  return;
193  }
196  if (prog_ == NULL) {
197  LOG(INFO) << "Cannot compile: " << CEscape(regexp_str_);
198  error_ = true;
199  return;
200  }
201  if (FLAGS_dump_prog) {
202  LOG(INFO) << "Prog for "
203  << " regexp "
204  << CEscape(regexp_str_)
205  << " (" << FormatKind(kind_)
206  << ", " << FormatMode(flags_)
207  << ")\n"
208  << prog_->Dump();
209  }
210 
211  // Compile regexp to reversed prog. Only needed for DFA engines.
212  if (Engines() & ((1<<kEngineDFA)|(1<<kEngineDFA1))) {
214  if (rprog_ == NULL) {
215  LOG(INFO) << "Cannot reverse compile: " << CEscape(regexp_str_);
216  error_ = true;
217  return;
218  }
219  if (FLAGS_dump_rprog)
220  LOG(INFO) << rprog_->Dump();
221  }
222 
223  // Create re string that will be used for RE and RE2.
224  std::string re = std::string(regexp_str);
225  // Accomodate flags.
226  // Regexp::Latin1 will be accomodated below.
227  if (!(flags & Regexp::OneLine))
228  re = "(?m)" + re;
229  if (flags & Regexp::NonGreedy)
230  re = "(?U)" + re;
231  if (flags & Regexp::DotNL)
232  re = "(?s)" + re;
233 
234  // Compile regexp to RE2.
235  if (Engines() & ((1<<kEngineRE2)|(1<<kEngineRE2a)|(1<<kEngineRE2b))) {
237  if (flags & Regexp::Latin1)
239  if (kind_ == Prog::kLongestMatch)
240  options.set_longest_match(true);
241  re2_ = new RE2(re, options);
242  if (!re2_->error().empty()) {
243  LOG(INFO) << "Cannot RE2: " << CEscape(re);
244  error_ = true;
245  return;
246  }
247  }
248 
249  // Compile regexp to RE.
250  // PCRE as exposed by the RE interface isn't always usable.
251  // 1. It disagrees about handling of empty-string reptitions
252  // like matching (a*)* against "b". PCRE treats the (a*) as
253  // occurring once, while we treat it as occurring not at all.
254  // 2. It treats $ as this weird thing meaning end of string
255  // or before the \n at the end of the string.
256  // 3. It doesn't implement POSIX leftmost-longest matching.
257  // 4. It lets \s match vertical tab.
258  // MimicsPCRE() detects 1 and 2.
259  if ((Engines() & (1<<kEnginePCRE)) && regexp_->MimicsPCRE() &&
261  PCRE_Options o;
262  o.set_option(PCRE::UTF8);
263  if (flags & Regexp::Latin1)
264  o.set_option(PCRE::None);
265  // PCRE has interface bug keeping us from finding $0, so
266  // add one more layer of parens.
267  re_ = new PCRE("("+re+")", o);
268  if (!re_->error().empty()) {
269  LOG(INFO) << "Cannot PCRE: " << CEscape(re);
270  error_ = true;
271  return;
272  }
273  }
274 }
275 
277  if (regexp_)
278  regexp_->Decref();
279  delete prog_;
280  delete rprog_;
281  delete re_;
282  delete re2_;
283 }
284 
285 // Runs a single search using the named engine type.
286 // This interface hides all the irregularities of the various
287 // engine interfaces from the rest of this file.
289  const StringPiece& orig_text,
290  const StringPiece& orig_context,
291  Prog::Anchor anchor,
292  Result* result) {
293  // Result is not trivial, so we cannot freely clear it with memset(3),
294  // but zeroing objects like so is safe and expedient for our purposes.
295  memset(reinterpret_cast<void*>(result), 0, sizeof *result);
296  if (regexp_ == NULL) {
297  result->skipped = true;
298  return;
299  }
300  int nsubmatch = 1 + num_captures_; // NumCaptures doesn't count $0
301  if (nsubmatch > kMaxSubmatch)
302  nsubmatch = kMaxSubmatch;
303 
304  StringPiece text = orig_text;
305  StringPiece context = orig_context;
306 
307  switch (type) {
308  default:
309  LOG(FATAL) << "Bad RunSearch type: " << (int)type;
310 
311  case kEngineBacktrack:
312  if (prog_ == NULL) {
313  result->skipped = true;
314  break;
315  }
316  result->matched =
318  result->submatch, nsubmatch);
319  result->have_submatch = true;
320  break;
321 
322  case kEngineNFA:
323  if (prog_ == NULL) {
324  result->skipped = true;
325  break;
326  }
327  result->matched =
328  prog_->SearchNFA(text, context, anchor, kind_,
329  result->submatch, nsubmatch);
330  result->have_submatch = true;
331  break;
332 
333  case kEngineDFA:
334  if (prog_ == NULL) {
335  result->skipped = true;
336  break;
337  }
338  result->matched = prog_->SearchDFA(text, context, anchor, kind_, NULL,
339  &result->skipped, NULL);
340  break;
341 
342  case kEngineDFA1:
343  if (prog_ == NULL || rprog_ == NULL) {
344  result->skipped = true;
345  break;
346  }
347  result->matched =
348  prog_->SearchDFA(text, context, anchor, kind_, result->submatch,
349  &result->skipped, NULL);
350  // If anchored, no need for second run,
351  // but do it anyway to find more bugs.
352  if (result->matched) {
353  if (!rprog_->SearchDFA(result->submatch[0], context,
355  result->submatch,
356  &result->skipped, NULL)) {
357  LOG(ERROR) << "Reverse DFA inconsistency: "
358  << CEscape(regexp_str_)
359  << " on " << CEscape(text);
360  result->matched = false;
361  }
362  }
363  result->have_submatch0 = true;
364  break;
365 
366  case kEngineOnePass:
367  if (prog_ == NULL ||
368  !prog_->IsOnePass() ||
369  anchor == Prog::kUnanchored ||
370  nsubmatch > Prog::kMaxOnePassCapture) {
371  result->skipped = true;
372  break;
373  }
374  result->matched = prog_->SearchOnePass(text, context, anchor, kind_,
375  result->submatch, nsubmatch);
376  result->have_submatch = true;
377  break;
378 
379  case kEngineBitState:
380  if (prog_ == NULL ||
381  !prog_->CanBitState()) {
382  result->skipped = true;
383  break;
384  }
385  result->matched = prog_->SearchBitState(text, context, anchor, kind_,
386  result->submatch, nsubmatch);
387  result->have_submatch = true;
388  break;
389 
390  case kEngineRE2:
391  case kEngineRE2a:
392  case kEngineRE2b: {
393  if (!re2_ || text.end() != context.end()) {
394  result->skipped = true;
395  break;
396  }
397 
398  RE2::Anchor re_anchor;
399  if (anchor == Prog::kAnchored)
400  re_anchor = RE2::ANCHOR_START;
401  else
402  re_anchor = RE2::UNANCHORED;
403  if (kind_ == Prog::kFullMatch)
404  re_anchor = RE2::ANCHOR_BOTH;
405 
406  result->matched = re2_->Match(
407  context,
408  static_cast<size_t>(text.begin() - context.begin()),
409  static_cast<size_t>(text.end() - context.begin()),
410  re_anchor,
411  result->submatch,
412  nsubmatch);
413  result->have_submatch = nsubmatch > 0;
414  break;
415  }
416 
417  case kEnginePCRE: {
418  if (!re_ || text.begin() != context.begin() ||
419  text.end() != context.end()) {
420  result->skipped = true;
421  break;
422  }
423 
424  // In Perl/PCRE, \v matches any character considered vertical
425  // whitespace, not just vertical tab. Regexp::MimicsPCRE() is
426  // unable to handle all cases of this, unfortunately, so just
427  // catch them here. :(
428  if (regexp_str_.find("\\v") != StringPiece::npos &&
429  (text.find('\n') != StringPiece::npos ||
430  text.find('\f') != StringPiece::npos ||
431  text.find('\r') != StringPiece::npos)) {
432  result->skipped = true;
433  break;
434  }
435 
436  // PCRE 8.34 or so started allowing vertical tab to match \s,
437  // following a change made in Perl 5.18. RE2 does not.
438  if ((regexp_str_.find("\\s") != StringPiece::npos ||
439  regexp_str_.find("\\S") != StringPiece::npos) &&
440  text.find('\v') != StringPiece::npos) {
441  result->skipped = true;
442  break;
443  }
444 
445  const PCRE::Arg **argptr = new const PCRE::Arg*[nsubmatch];
446  PCRE::Arg *a = new PCRE::Arg[nsubmatch];
447  for (int i = 0; i < nsubmatch; i++) {
448  a[i] = PCRE::Arg(&result->submatch[i]);
449  argptr[i] = &a[i];
450  }
451  size_t consumed;
452  PCRE::Anchor pcre_anchor;
453  if (anchor == Prog::kAnchored)
454  pcre_anchor = PCRE::ANCHOR_START;
455  else
456  pcre_anchor = PCRE::UNANCHORED;
457  if (kind_ == Prog::kFullMatch)
458  pcre_anchor = PCRE::ANCHOR_BOTH;
459  re_->ClearHitLimit();
460  result->matched =
461  re_->DoMatch(text,
462  pcre_anchor,
463  &consumed,
464  argptr, nsubmatch);
465  if (re_->HitLimit()) {
466  result->untrusted = true;
467  delete[] argptr;
468  delete[] a;
469  break;
470  }
471  result->have_submatch = true;
472  delete[] argptr;
473  delete[] a;
474  break;
475  }
476  }
477 
478  if (!result->matched)
479  memset(result->submatch, 0, sizeof result->submatch);
480 }
481 
482 // Checks whether r is okay given that correct is the right answer.
483 // Specifically, r's answers have to match (but it doesn't have to
484 // claim to have all the answers).
485 static bool ResultOkay(const Result& r, const Result& correct) {
486  if (r.skipped)
487  return true;
488  if (r.matched != correct.matched)
489  return false;
490  if (r.have_submatch || r.have_submatch0) {
491  for (int i = 0; i < kMaxSubmatch; i++) {
492  if (correct.submatch[i].data() != r.submatch[i].data() ||
493  correct.submatch[i].size() != r.submatch[i].size())
494  return false;
495  if (!r.have_submatch)
496  break;
497  }
498  }
499  return true;
500 }
501 
502 // Runs a single test.
504  Prog::Anchor anchor) {
505  // Backtracking is the gold standard.
506  Result correct;
507  RunSearch(kEngineBacktrack, text, context, anchor, &correct);
508  if (correct.skipped) {
509  if (regexp_ == NULL)
510  return true;
511  LOG(ERROR) << "Skipped backtracking! " << CEscape(regexp_str_)
512  << " " << FormatMode(flags_);
513  return false;
514  }
515  VLOG(1) << "Try: regexp " << CEscape(regexp_str_)
516  << " text " << CEscape(text)
517  << " (" << FormatKind(kind_)
518  << ", " << FormatAnchor(anchor)
519  << ", " << FormatMode(flags_)
520  << ")";
521 
522  // Compare the others.
523  bool all_okay = true;
524  for (Engine i = kEngineBacktrack+1; i < kEngineMax; i++) {
525  if (!(Engines() & (1<<i)))
526  continue;
527 
528  Result r;
529  RunSearch(i, text, context, anchor, &r);
530  if (ResultOkay(r, correct)) {
531  if (FLAGS_log_okay)
532  LogMatch(r.skipped ? "Skipped: " : "Okay: ", i, text, context, anchor);
533  continue;
534  }
535 
536  // We disagree with PCRE on the meaning of some Unicode matches.
537  // In particular, we treat non-ASCII UTF-8 as non-word characters.
538  // We also treat "empty" character sets like [^\w\W] as being
539  // impossible to match, while PCRE apparently excludes some code
540  // points (e.g., 0x0080) from both \w and \W.
541  if (i == kEnginePCRE && NonASCII(text))
542  continue;
543 
544  if (!r.untrusted)
545  all_okay = false;
546 
547  LogMatch(r.untrusted ? "(Untrusted) Mismatch: " : "Mismatch: ", i, text,
548  context, anchor);
549  if (r.matched != correct.matched) {
550  if (r.matched) {
551  LOG(INFO) << " Should not match (but does).";
552  } else {
553  LOG(INFO) << " Should match (but does not).";
554  continue;
555  }
556  }
557  for (int i = 0; i < 1+num_captures_; i++) {
558  if (r.submatch[i].data() != correct.submatch[i].data() ||
559  r.submatch[i].size() != correct.submatch[i].size()) {
560  LOG(INFO) <<
561  StringPrintf(" $%d: should be %s is %s",
562  i,
563  FormatCapture(text, correct.submatch[i]).c_str(),
564  FormatCapture(text, r.submatch[i]).c_str());
565  } else {
566  LOG(INFO) <<
567  StringPrintf(" $%d: %s ok", i,
568  FormatCapture(text, r.submatch[i]).c_str());
569  }
570  }
571  }
572 
573  if (!all_okay) {
574  if (FLAGS_max_regexp_failures > 0 && --FLAGS_max_regexp_failures == 0)
575  LOG(QFATAL) << "Too many regexp failures.";
576  }
577 
578  return all_okay;
579 }
580 
582  const StringPiece& text, const StringPiece& context,
583  Prog::Anchor anchor) {
584  LOG(INFO) << prefix
585  << EngineName(e)
586  << " regexp "
587  << CEscape(regexp_str_)
588  << " "
589  << CEscape(regexp_->ToString())
590  << " text "
591  << CEscape(text)
592  << " ("
593  << text.begin() - context.begin()
594  << ","
595  << text.end() - context.begin()
596  << ") of context "
597  << CEscape(context)
598  << " (" << FormatKind(kind_)
599  << ", " << FormatAnchor(anchor)
600  << ", " << FormatMode(flags_)
601  << ")";
602 }
603 
604 static Prog::MatchKind kinds[] = {
608 };
609 
610 // Test all possible match kinds and parse modes.
611 Tester::Tester(const StringPiece& regexp) {
612  error_ = false;
613  for (size_t i = 0; i < arraysize(kinds); i++) {
614  for (size_t j = 0; j < arraysize(parse_modes); j++) {
615  TestInstance* t = new TestInstance(regexp, kinds[i],
616  parse_modes[j].parse_flags);
617  error_ |= t->error();
618  v_.push_back(t);
619  }
620  }
621 }
622 
624  for (size_t i = 0; i < v_.size(); i++)
625  delete v_[i];
626 }
627 
629  Prog::Anchor anchor) {
630  bool okay = true;
631  for (size_t i = 0; i < v_.size(); i++)
632  okay &= (!v_[i]->error() && v_[i]->RunCase(text, context, anchor));
633  return okay;
634 }
635 
636 static Prog::Anchor anchors[] = {
639 };
640 
642  bool okay = TestInputInContext(text, text);
643  if (text.size() > 0) {
644  StringPiece sp;
645  sp = text;
646  sp.remove_prefix(1);
647  okay &= TestInputInContext(sp, text);
648  sp = text;
649  sp.remove_suffix(1);
650  okay &= TestInputInContext(sp, text);
651  }
652  return okay;
653 }
654 
656  const StringPiece& context) {
657  bool okay = true;
658  for (size_t i = 0; i < arraysize(anchors); i++)
659  okay &= TestCase(text, context, anchors[i]);
660  return okay;
661 }
662 
663 bool TestRegexpOnText(const StringPiece& regexp,
664  const StringPiece& text) {
665  Tester t(regexp);
666  return t.TestInput(text);
667 }
668 
669 } // namespace re2
re2::kEngineDFA
@ kEngineDFA
Definition: bloaty/third_party/re2/re2/testing/tester.h:25
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
re2::TestInstance::regexp_
Regexp * regexp_
Definition: bloaty/third_party/re2/re2/testing/tester.h:80
re2::Regexp::DotNL
@ DotNL
Definition: bloaty/third_party/re2/re2/regexp.h:284
DEFINE_string
DEFINE_string(regexp_engines, "", "pattern to select regexp engines to test")
re2::TestInstance::re2_
RE2 * re2_
Definition: bloaty/third_party/re2/re2/testing/tester.h:85
re2::Regexp::Decref
void Decref()
Definition: bloaty/third_party/re2/re2/regexp.cc:115
re2::Prog::SearchOnePass
bool SearchOnePass(const StringPiece &text, const StringPiece &context, Anchor anchor, MatchKind kind, StringPiece *match, int nmatch)
Definition: bloaty/third_party/re2/re2/onepass.cc:214
re2::StringPiece::remove_prefix
void remove_prefix(size_type n)
Definition: bloaty/third_party/re2/re2/stringpiece.h:87
memset
return memset(p, 0, total)
re2::PCRE_Options
Definition: bloaty/third_party/re2/util/pcre.h:521
re2::UsingPCRE
const bool UsingPCRE
Definition: bloaty/third_party/re2/util/pcre.h:175
VLOG
#define VLOG(x)
Definition: third_party/bloaty/third_party/protobuf/third_party/benchmark/src/log.h:69
re2::TestInstance::RunSearch
void RunSearch(Engine type, const StringPiece &text, const StringPiece &context, Prog::Anchor anchor, Result *result)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:288
false
#define false
Definition: setup_once.h:323
re2::Tester::error_
bool error_
Definition: bloaty/third_party/re2/re2/testing/tester.h:111
re2::Prog::kFullMatch
@ kFullMatch
Definition: bloaty/third_party/re2/re2/prog.h:195
re2::StringPiece::remove_suffix
void remove_suffix(size_type n)
Definition: bloaty/third_party/re2/re2/stringpiece.h:92
re2::kEngineRE2
@ kEngineRE2
Definition: bloaty/third_party/re2/re2/testing/tester.h:29
re2::ParseMode
Definition: bloaty/third_party/re2/re2/testing/tester.cc:142
re2::Prog::Anchor
Anchor
Definition: bloaty/third_party/re2/re2/prog.h:175
re2::TestInstance::error_
bool error_
Definition: bloaty/third_party/re2/re2/testing/tester.h:78
re2::TestRegexpOnText
bool TestRegexpOnText(const StringPiece &regexp, const StringPiece &text)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:663
string.h
options
double_dict options[]
Definition: capstone_test.c:55
re2::Regexp
Definition: bloaty/third_party/re2/re2/regexp.h:274
re2::StringPiece::size
size_type size() const
Definition: bloaty/third_party/re2/re2/stringpiece.h:80
re2::PCRE::Anchor
Anchor
Definition: bloaty/third_party/re2/util/pcre.h:436
DEFINE_int32
DEFINE_int32(max_regexp_failures, 100, "maximum number of regexp test failures (-1 = unlimited)")
re2::Tester::v_
std::vector< TestInstance * > v_
Definition: bloaty/third_party/re2/re2/testing/tester.h:112
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
re2::StringPiece::npos
static const size_type npos
Definition: bloaty/third_party/re2/re2/stringpiece.h:53
re2::kMaxSubmatch
@ kMaxSubmatch
Definition: bloaty/third_party/re2/re2/testing/tester.cc:33
re2::kEngineNFA
@ kEngineNFA
Definition: bloaty/third_party/re2/re2/testing/tester.h:24
re2::RE2::ANCHOR_BOTH
@ ANCHOR_BOTH
Definition: bloaty/third_party/re2/re2/re2.h:475
re2::TestInstance::TestInstance
TestInstance(const StringPiece &regexp, Prog::MatchKind kind, Regexp::ParseFlags flags)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:169
re2::RE2::UNANCHORED
@ UNANCHORED
Definition: bloaty/third_party/re2/re2/re2.h:473
re2::PCRE::error
const std::string & error() const
Definition: bloaty/third_party/re2/util/pcre.h:229
status
absl::Status status
Definition: rls.cc:251
re2::RE2::error
const std::string & error() const
Definition: bloaty/third_party/re2/re2/re2.h:275
re2
Definition: bloaty/third_party/re2/re2/bitmap256.h:17
re2::RegexpStatus
Definition: bloaty/third_party/re2/re2/regexp.h:190
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
re2::TestInstance::re_
PCRE * re_
Definition: bloaty/third_party/re2/re2/testing/tester.h:84
re2::FormatCapture
static std::string FormatCapture(const StringPiece &text, const StringPiece &s)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:100
re2::Regexp::CompileToProg
Prog * CompileToProg(int64_t max_mem)
Definition: bloaty/third_party/re2/re2/compile.cc:1220
re2::TestInstance::prog_
Prog * prog_
Definition: bloaty/third_party/re2/re2/testing/tester.h:82
Arg
Arg(64) -> Arg(128) ->Arg(256) ->Arg(512) ->Arg(1024) ->Arg(1536) ->Arg(2048) ->Arg(3072) ->Arg(4096) ->Arg(5120) ->Arg(6144) ->Arg(7168)
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
re2::Regexp::OneLine
@ OneLine
Definition: bloaty/third_party/re2/re2/regexp.h:286
re2::RE2::ANCHOR_START
@ ANCHOR_START
Definition: bloaty/third_party/re2/re2/re2.h:474
re2::Regexp::Latin1
@ Latin1
Definition: bloaty/third_party/re2/re2/regexp.h:289
re2::Prog::CanBitState
bool CanBitState()
Definition: bloaty/third_party/re2/re2/prog.h:317
re2::FormatMode
static std::string FormatMode(Regexp::ParseFlags flags)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:160
re2::Tester::TestInput
bool TestInput(const StringPiece &text)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:641
re2::Prog::MatchKind
MatchKind
Definition: bloaty/third_party/re2/re2/prog.h:192
o
UnboundConversion o
Definition: third_party/abseil-cpp/absl/strings/internal/str_format/parser_test.cc:97
re2::TestInstance::flags_
Regexp::ParseFlags flags_
Definition: bloaty/third_party/re2/re2/testing/tester.h:77
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
re2::Tester
Definition: bloaty/third_party/re2/re2/testing/tester.h:92
re2::TestInstance::Result::submatch
StringPiece submatch[kMaxSubmatch]
Definition: bloaty/third_party/re2/re2/testing/tester.cc:93
re2::TestInstance::kind_
Prog::MatchKind kind_
Definition: bloaty/third_party/re2/re2/testing/tester.h:76
re2::Regexp::ToString
std::string ToString()
Definition: bloaty/third_party/re2/re2/tostring.cc:55
gen_server_registered_method_bad_client_test_body.text
def text
Definition: gen_server_registered_method_bad_client_test_body.py:50
re2::Regexp::NumCaptures
int NumCaptures()
Definition: bloaty/third_party/re2/re2/regexp.cc:560
xds_interop_client.int
int
Definition: xds_interop_client.py:113
re2::TestInstance::Result::have_submatch
bool have_submatch
Definition: bloaty/third_party/re2/re2/testing/tester.cc:91
re2::TestInstance::Result::skipped
bool skipped
Definition: bloaty/third_party/re2/re2/testing/tester.cc:88
re2::Result
TestInstance::Result Result
Definition: bloaty/third_party/re2/re2/testing/tester.cc:96
python_utils.jobset.INFO
INFO
Definition: jobset.py:111
LOG
#define LOG(severity)
Definition: bloaty/third_party/re2/util/logging.h:53
re2::multi_line
static const Regexp::ParseFlags multi_line
Definition: bloaty/third_party/re2/re2/testing/tester.cc:149
re2::ResultOkay
static bool ResultOkay(const Result &r, const Result &correct)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:485
re2::Prog::SearchBitState
bool SearchBitState(const StringPiece &text, const StringPiece &context, Anchor anchor, MatchKind kind, StringPiece *match, int nmatch)
Definition: bloaty/third_party/re2/re2/bitstate.cc:350
re2::Regexp::MimicsPCRE
bool MimicsPCRE()
Definition: bloaty/third_party/re2/re2/mimics_pcre.cc:102
re2::TestInstance::Result::untrusted
bool untrusted
Definition: bloaty/third_party/re2/re2/testing/tester.cc:90
re2::EngineName
static const char * EngineName(Engine e)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:50
re2::PCRE::UTF8
@ UTF8
Definition: bloaty/third_party/re2/util/pcre.h:206
re2::StringPrintf
std::string StringPrintf(const char *format,...)
Definition: bloaty/third_party/re2/util/strutil.cc:140
re2::parse_modes
static ParseMode parse_modes[]
Definition: bloaty/third_party/re2/re2/testing/tester.cc:152
re2::Regexp::Parse
static Regexp * Parse(const StringPiece &s, ParseFlags flags, RegexpStatus *status)
Definition: bloaty/third_party/re2/re2/parse.cc:2200
CHECK
#define CHECK(x)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:8085
re2::anchors
static Prog::Anchor anchors[]
Definition: bloaty/third_party/re2/re2/testing/tester.cc:636
re2::Prog::kAnchored
@ kAnchored
Definition: bloaty/third_party/re2/re2/prog.h:177
re2::kEngineBitState
@ kEngineBitState
Definition: bloaty/third_party/re2/re2/testing/tester.h:28
re2::TestInstance::num_captures_
int num_captures_
Definition: bloaty/third_party/re2/re2/testing/tester.h:81
re2::TestInstance::regexp_str_
const StringPiece regexp_str_
Definition: bloaty/third_party/re2/re2/testing/tester.h:75
re2::TestInstance::Result
Definition: bloaty/third_party/re2/re2/testing/tester.cc:87
re2::StringPiece::find
size_type find(const StringPiece &s, size_type pos=0) const
Definition: bloaty/third_party/re2/re2/stringpiece.cc:28
re2::FormatKind
static std::string FormatKind(Prog::MatchKind kind)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:117
re2::RE2
Definition: bloaty/third_party/re2/re2/re2.h:211
re2::Tester::error
bool error()
Definition: bloaty/third_party/re2/re2/testing/tester.h:97
re2::Prog::kManyMatch
@ kManyMatch
Definition: bloaty/third_party/re2/re2/prog.h:196
re2::PCRE::ANCHOR_BOTH
@ ANCHOR_BOTH
Definition: bloaty/third_party/re2/util/pcre.h:439
re2::TestInstance
Definition: bloaty/third_party/re2/re2/testing/tester.h:50
re2::Regexp::ParseFlags
ParseFlags
Definition: bloaty/third_party/re2/re2/regexp.h:278
google::protobuf::ERROR
static const LogLevel ERROR
Definition: bloaty/third_party/protobuf/src/google/protobuf/testing/googletest.h:70
stdint.h
CHECK_GE
#define CHECK_GE(a, b)
Definition: bloaty/third_party/protobuf/third_party/benchmark/src/check.h:67
re2::TestInstance::rprog_
Prog * rprog_
Definition: bloaty/third_party/re2/re2/testing/tester.h:83
re2::PCRE::DoMatch
bool DoMatch(const StringPiece &text, Anchor anchor, size_t *consumed, const Arg *const *args, int n) const
arraysize
#define arraysize(array)
Definition: benchmark/src/arraysize.h:28
re2::Regexp::CompileToReverseProg
Prog * CompileToReverseProg(int64_t max_mem)
Definition: bloaty/third_party/re2/re2/compile.cc:1224
re2::Prog::SearchDFA
bool SearchDFA(const StringPiece &text, const StringPiece &context, Anchor anchor, MatchKind kind, StringPiece *match0, bool *failed, SparseSet *matches)
Definition: bloaty/third_party/re2/re2/dfa.cc:1861
re2::RE2::Match
bool Match(const StringPiece &text, size_t startpos, size_t endpos, Anchor re_anchor, StringPiece *submatch, int nsubmatch) const
Definition: bloaty/third_party/re2/re2/re2.cc:572
re2::PCRE::UNANCHORED
@ UNANCHORED
Definition: bloaty/third_party/re2/util/pcre.h:437
re2::Prog::IsOnePass
bool IsOnePass()
Definition: bloaty/third_party/re2/re2/onepass.cc:384
re2::ParseMode::desc
std::string desc
Definition: bloaty/third_party/re2/re2/testing/tester.cc:144
re2::StringPiece::data
const_pointer data() const
Definition: bloaty/third_party/re2/re2/stringpiece.h:85
FATAL
#define FATAL(msg)
Definition: task.h:88
CHECK_LT
#define CHECK_LT(a, b)
Definition: bloaty/third_party/protobuf/third_party/benchmark/src/check.h:70
re2::Prog::kMaxOnePassCapture
static const int kMaxOnePassCapture
Definition: bloaty/third_party/re2/re2/prog.h:322
re2::TestInstance::LogMatch
void LogMatch(const char *prefix, Engine e, const StringPiece &text, const StringPiece &context, Prog::Anchor anchor)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:581
re2::PCRE::ANCHOR_START
@ ANCHOR_START
Definition: bloaty/third_party/re2/util/pcre.h:438
re2::PCRE::HitLimit
bool HitLimit()
Definition: bloaty/third_party/re2/util/pcre.cc:504
re2::ParseMode::parse_flags
Regexp::ParseFlags parse_flags
Definition: bloaty/third_party/re2/re2/testing/tester.cc:143
re2::RE2::Options
Definition: bloaty/third_party/re2/re2/re2.h:548
re2::kEngineRE2b
@ kEngineRE2b
Definition: bloaty/third_party/re2/re2/testing/tester.h:31
re2::Regexp::NonGreedy
@ NonGreedy
Definition: bloaty/third_party/re2/re2/regexp.h:290
absl::flags_internal
Definition: abseil-cpp/absl/flags/commandlineflag.h:40
re2::PCRE
Definition: bloaty/third_party/re2/util/pcre.h:186
re2::Tester::~Tester
~Tester()
Definition: bloaty/third_party/re2/re2/testing/tester.cc:623
re2::CEscape
std::string CEscape(const StringPiece &src)
Definition: bloaty/third_party/re2/util/strutil.cc:68
re2::Tester::TestInputInContext
bool TestInputInContext(const StringPiece &text, const StringPiece &context)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:655
re2::kinds
static Prog::MatchKind kinds[]
Definition: bloaty/third_party/re2/re2/testing/tester.cc:604
DEFINE_bool
DEFINE_bool(dump_prog, false, "dump regexp program")
re2::TestInstance::RunCase
bool RunCase(const StringPiece &text, const StringPiece &context, Prog::Anchor anchor)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:503
fix_build_deps.r
r
Definition: fix_build_deps.py:491
prefix
static const char prefix[]
Definition: head_of_line_blocking.cc:28
re2::FormatAnchor
static std::string FormatAnchor(Prog::Anchor anchor)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:132
re2::Engine
Engine
Definition: bloaty/third_party/re2/re2/testing/tester.h:22
re2::kEnginePCRE
@ kEnginePCRE
Definition: bloaty/third_party/re2/re2/testing/tester.h:32
re2::RE2::Options::EncodingLatin1
@ EncodingLatin1
Definition: bloaty/third_party/re2/re2/re2.h:605
re2::Prog::kUnanchored
@ kUnanchored
Definition: bloaty/third_party/re2/re2/prog.h:176
re2::TestInstance::Result::matched
bool matched
Definition: bloaty/third_party/re2/re2/testing/tester.cc:89
re2::engine_names
const char * engine_names[kEngineMax]
Definition: bloaty/third_party/re2/re2/testing/tester.cc:36
re2::Tester::TestCase
bool TestCase(const StringPiece &text, const StringPiece &context, Prog::Anchor anchor)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:628
re2::NonASCII
static bool NonASCII(const StringPiece &text)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:109
re2::PCRE::ClearHitLimit
void ClearHitLimit()
Definition: bloaty/third_party/re2/util/pcre.cc:508
re2::Prog::kFirstMatch
@ kFirstMatch
Definition: bloaty/third_party/re2/re2/prog.h:193
re2::Prog::UnsafeSearchBacktrack
bool UnsafeSearchBacktrack(const StringPiece &text, const StringPiece &context, Anchor anchor, MatchKind kind, StringPiece *match, int nmatch)
Definition: bloaty/third_party/re2/re2/testing/backtrack.cc:245
re2::TestInstance::~TestInstance
~TestInstance()
Definition: bloaty/third_party/re2/re2/testing/tester.cc:276
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
re2::PCRE::Arg
Definition: bloaty/third_party/re2/util/pcre.h:568
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
re2::single_line
static const Regexp::ParseFlags single_line
Definition: bloaty/third_party/re2/re2/testing/tester.cc:147
re2::RE2::Anchor
Anchor
Definition: bloaty/third_party/re2/re2/re2.h:472
re2::kEngineOnePass
@ kEngineOnePass
Definition: bloaty/third_party/re2/re2/testing/tester.h:27
error_
grpc_error_handle error_
Definition: message_decompress_filter.cc:112
re2::kEngineMax
@ kEngineMax
Definition: bloaty/third_party/re2/re2/testing/tester.h:34
re2::kEngineDFA1
@ kEngineDFA1
Definition: bloaty/third_party/re2/re2/testing/tester.h:26
re2::StringPiece
Definition: bloaty/third_party/re2/re2/stringpiece.h:39
re2::kEngineBacktrack
@ kEngineBacktrack
Definition: bloaty/third_party/re2/re2/testing/tester.h:23
re2::kEngineRE2a
@ kEngineRE2a
Definition: bloaty/third_party/re2/re2/testing/tester.h:30
re2::PCRE::None
@ None
Definition: bloaty/third_party/re2/util/pcre.h:205
re2::Engines
static uint32_t Engines()
Definition: bloaty/third_party/re2/re2/testing/tester.cc:58
re2::TestInstance::Result::have_submatch0
bool have_submatch0
Definition: bloaty/third_party/re2/re2/testing/tester.cc:92
re2::Prog::kLongestMatch
@ kLongestMatch
Definition: bloaty/third_party/re2/re2/prog.h:194
re2::Tester::Tester
Tester(const StringPiece &regexp)
Definition: bloaty/third_party/re2/re2/testing/tester.cc:611
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
re2::Regexp::LikePerl
@ LikePerl
Definition: bloaty/third_party/re2/re2/regexp.h:312
re2::Prog::Dump
std::string Dump()
Definition: bloaty/third_party/re2/re2/prog.cc:157
re2::Prog::SearchNFA
bool SearchNFA(const StringPiece &text, const StringPiece &context, Anchor anchor, MatchKind kind, StringPiece *match, int nmatch)
Definition: bloaty/third_party/re2/re2/nfa.cc:677


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:32