Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Side by Side Diff: third_party/re2/re2/testing/null_walker.cc

Issue 1544433002: Replace RE2 import with a dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-Added LICENSE and OWNERS file Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 "re2/regexp.h"
7 #include "re2/walker-inl.h"
8
9 namespace re2 {
10
11 // Null walker. For benchmarking the walker itself.
12
13 class NullWalker : public Regexp::Walker<bool> {
14 public:
15 NullWalker() { }
16 bool PostVisit(Regexp* re, bool parent_arg, bool pre_arg,
17 bool* child_args, int nchild_args);
18
19 bool ShortVisit(Regexp* re, bool a) {
20 // Should never be called: we use Walk not WalkExponential.
21 LOG(DFATAL) << "NullWalker::ShortVisit called";
22 return a;
23 }
24
25 private:
26 DISALLOW_COPY_AND_ASSIGN(NullWalker);
27 };
28
29 // Called after visiting re's children. child_args contains the return
30 // value from each of the children's PostVisits (i.e., whether each child
31 // can match an empty string). Returns whether this clause can match an
32 // empty string.
33 bool NullWalker::PostVisit(Regexp* re, bool parent_arg, bool pre_arg,
34 bool* child_args, int nchild_args) {
35 return false;
36 }
37
38 // Returns whether re can match an empty string.
39 void Regexp::NullWalk() {
40 NullWalker w;
41 w.Walk(this, false);
42 }
43
44 } // namespace re2
OLDNEW
« no previous file with comments | « third_party/re2/re2/testing/mimics_pcre_test.cc ('k') | third_party/re2/re2/testing/parse_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698