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.
6 #include "re2/regexp.h"
7 #include "re2/walker-inl.h"
11 // Null walker. For benchmarking the walker itself.
13 class NullWalker : public Regexp::Walker<bool> {
16 bool PostVisit(Regexp* re, bool parent_arg, bool pre_arg,
17 bool* child_args, int nchild_args);
19 bool ShortVisit(Regexp* re, bool a) {
20 // Should never be called: we use Walk not WalkExponential.
21 LOG(DFATAL) << "NullWalker::ShortVisit called";
26 DISALLOW_EVIL_CONSTRUCTORS(NullWalker);
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
33 bool NullWalker::PostVisit(Regexp* re, bool parent_arg, bool pre_arg,
34 bool* child_args, int nchild_args) {
38 // Returns whether re can match an empty string.
39 void Regexp::NullWalk() {