grpc
third_party
re2
re2
testing
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
18
virtual
bool
PostVisit
(
Regexp
* re,
bool
parent_arg,
bool
pre_arg,
19
bool
* child_args,
int
nchild_args);
20
21
virtual
bool
ShortVisit
(
Regexp
* re,
bool
a) {
22
// Should never be called: we use Walk(), not WalkExponential().
23
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
24
LOG
(DFATAL) <<
"NullWalker::ShortVisit called"
;
25
#endif
26
return
a
;
27
}
28
29
private
:
30
NullWalker
(
const
NullWalker
&) =
delete
;
31
NullWalker
&
operator=
(
const
NullWalker
&) =
delete
;
32
};
33
34
// Called after visiting re's children. child_args contains the return
35
// value from each of the children's PostVisits (i.e., whether each child
36
// can match an empty string). Returns whether this clause can match an
37
// empty string.
38
bool
NullWalker::PostVisit
(Regexp* re,
bool
parent_arg,
bool
pre_arg,
39
bool
* child_args,
int
nchild_args) {
40
return
false
;
41
}
42
43
// Returns whether re can match an empty string.
44
void
Regexp::NullWalk
() {
45
NullWalker w;
46
w.Walk(
this
,
false
);
47
}
48
49
}
// 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
virtual bool ShortVisit(Regexp *re, bool a)
Definition:
re2/re2/testing/null_walker.cc:21
LOG
#define LOG(severity)
Definition:
bloaty/third_party/re2/util/logging.h:53
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:
re2/re2/testing/null_walker.cc:16
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:33