bloaty/third_party/re2/re2/testing/null_walker.cc
Go to the documentation of this file.
1 // Copyright 2009 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 #include "util/test.h"
6 #include "util/logging.h"
7 #include "re2/regexp.h"
8 #include "re2/walker-inl.h"
9 
10 namespace re2 {
11 
12 // Null walker. For benchmarking the walker itself.
13 
14 class NullWalker : public Regexp::Walker<bool> {
15  public:
16  NullWalker() { }
17  bool PostVisit(Regexp* re, bool parent_arg, bool pre_arg,
18  bool* child_args, int nchild_args);
19 
20  bool ShortVisit(Regexp* re, bool a) {
21  // Should never be called: we use Walk not WalkExponential.
22  LOG(DFATAL) << "NullWalker::ShortVisit called";
23  return a;
24  }
25 
26  private:
27  NullWalker(const NullWalker&) = delete;
28  NullWalker& operator=(const NullWalker&) = delete;
29 };
30 
31 // Called after visiting re's children. child_args contains the return
32 // value from each of the children's PostVisits (i.e., whether each child
33 // can match an empty string). Returns whether this clause can match an
34 // empty string.
35 bool NullWalker::PostVisit(Regexp* re, bool parent_arg, bool pre_arg,
36  bool* child_args, int nchild_args) {
37  return false;
38 }
39 
40 // Returns whether re can match an empty string.
42  NullWalker w;
43  w.Walk(this, false);
44 }
45 
46 } // namespace re2
re2::Regexp::NullWalk
void NullWalk()
Definition: bloaty/third_party/re2/re2/testing/null_walker.cc:41
re2::Regexp
Definition: bloaty/third_party/re2/re2/regexp.h:274
re2
Definition: bloaty/third_party/re2/re2/bitmap256.h:17
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
re2::NullWalker::ShortVisit
bool ShortVisit(Regexp *re, bool a)
Definition: bloaty/third_party/re2/re2/testing/null_walker.cc:20
re2::Regexp::Walker
Definition: bloaty/third_party/re2/re2/regexp.h:414
LOG
#define LOG(severity)
Definition: bloaty/third_party/re2/util/logging.h:53
re2::Regexp::Walker::Walk
T Walk(Regexp *re, T top_arg)
Definition: bloaty/third_party/re2/re2/walker-inl.h:231
re2::NullWalker
Definition: bloaty/third_party/re2/re2/testing/null_walker.cc:14
re2::NullWalker::operator=
NullWalker & operator=(const NullWalker &)=delete
re2::NullWalker::PostVisit
bool PostVisit(Regexp *re, bool parent_arg, bool pre_arg, bool *child_args, int nchild_args)
Definition: bloaty/third_party/re2/re2/testing/null_walker.cc:35
re2::NullWalker::NullWalker
NullWalker()
Definition: bloaty/third_party/re2/re2/testing/null_walker.cc:16


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:33