re2 1.19.2 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/actions/linux-alpine-node-16/Dockerfile +1 -1
- package/.github/actions/linux-alpine-node-18/Dockerfile +1 -1
- package/.github/actions/linux-alpine-node-20/Dockerfile +1 -1
- package/.gitmodules +5 -2
- package/README.md +1 -0
- package/binding.gyp +82 -25
- package/lib/replace.cc +4 -4
- package/package.json +1 -1
- package/tsconfig.json +2 -1
- package/vendor/re2/.bazelrc +16 -0
- package/vendor/re2/.github/bazel.sh +24 -0
- package/vendor/re2/.github/cmake.sh +12 -0
- package/vendor/re2/.github/workflows/ci-bazel.yml +17 -0
- package/vendor/re2/.github/workflows/ci-cmake.yml +108 -0
- package/vendor/re2/.github/workflows/ci.yml +89 -0
- package/vendor/re2/.github/workflows/pr.yml +26 -0
- package/vendor/re2/.github/workflows/python.yml +185 -0
- package/vendor/re2/AUTHORS +13 -0
- package/vendor/re2/BUILD.bazel +280 -0
- package/vendor/re2/CMakeLists.txt +268 -0
- package/vendor/re2/CONTRIBUTING.md +2 -0
- package/vendor/re2/CONTRIBUTORS +41 -0
- package/vendor/re2/Makefile +400 -0
- package/vendor/{README → re2/README} +5 -0
- package/vendor/re2/SECURITY.md +4 -0
- package/vendor/re2/WORKSPACE.bazel +62 -0
- package/vendor/re2/app/BUILD.bazel +19 -0
- package/vendor/re2/app/_re2.cc +94 -0
- package/vendor/re2/app/_re2.d.ts +23 -0
- package/vendor/re2/app/app.ts +111 -0
- package/vendor/re2/app/build.sh +50 -0
- package/vendor/re2/app/index.html +5 -0
- package/vendor/re2/app/package.json +14 -0
- package/vendor/re2/app/rollup.config.js +28 -0
- package/vendor/re2/app/tsconfig.json +17 -0
- package/vendor/re2/benchlog/benchplot.py +98 -0
- package/vendor/re2/benchlog/mktable +155 -0
- package/vendor/re2/doc/mksyntaxgo +42 -0
- package/vendor/re2/doc/mksyntaxhtml +42 -0
- package/vendor/re2/doc/mksyntaxwiki +36 -0
- package/vendor/re2/doc/syntax.html +477 -0
- package/vendor/re2/doc/syntax.txt +463 -0
- package/vendor/re2/lib/git/commit-msg.hook +104 -0
- package/vendor/re2/libre2.symbols +19 -0
- package/vendor/re2/libre2.symbols.darwin +15 -0
- package/vendor/re2/python/BUILD.bazel +36 -0
- package/vendor/re2/python/README +1 -0
- package/vendor/re2/python/_re2.cc +338 -0
- package/vendor/re2/python/re2.py +582 -0
- package/vendor/re2/python/re2_test.py +482 -0
- package/vendor/re2/python/setup.py +105 -0
- package/vendor/re2/{bitmap256.cc → re2/bitmap256.cc} +4 -4
- package/vendor/re2/{bitstate.cc → re2/bitstate.cc} +21 -25
- package/vendor/re2/{compile.cc → re2/compile.cc} +5 -4
- package/vendor/re2/{dfa.cc → re2/dfa.cc} +120 -101
- package/vendor/re2/{filtered_re2.cc → re2/filtered_re2.cc} +8 -11
- package/vendor/re2/{filtered_re2.h → re2/filtered_re2.h} +5 -4
- package/vendor/re2/{fuzzing → re2/fuzzing}/re2_fuzzer.cc +4 -6
- package/vendor/re2/{mimics_pcre.cc → re2/mimics_pcre.cc} +0 -1
- package/vendor/re2/{nfa.cc → re2/nfa.cc} +34 -37
- package/vendor/re2/{onepass.cc → re2/onepass.cc} +25 -27
- package/vendor/re2/{parse.cc → re2/parse.cc} +118 -121
- package/vendor/re2/{prefilter.cc → re2/prefilter.cc} +2 -3
- package/vendor/re2/{prefilter.h → re2/prefilter.h} +0 -1
- package/vendor/re2/{prefilter_tree.cc → re2/prefilter_tree.cc} +4 -5
- package/vendor/re2/{prefilter_tree.h → re2/prefilter_tree.h} +1 -2
- package/vendor/re2/{prog.cc → re2/prog.cc} +20 -21
- package/vendor/re2/{prog.h → re2/prog.h} +21 -22
- package/vendor/re2/{re2.cc → re2/re2.cc} +51 -62
- package/vendor/re2/{re2.h → re2/re2.h} +78 -40
- package/vendor/re2/{regexp.cc → re2/regexp.cc} +11 -12
- package/vendor/re2/{regexp.h → re2/regexp.h} +9 -10
- package/vendor/re2/{set.cc → re2/set.cc} +3 -5
- package/vendor/re2/{set.h → re2/set.h} +4 -3
- package/vendor/re2/{simplify.cc → re2/simplify.cc} +1 -2
- package/vendor/re2/re2/stringpiece.h +24 -0
- package/vendor/re2/{testing → re2/testing}/backtrack.cc +22 -25
- package/vendor/re2/{testing → re2/testing}/charclass_test.cc +23 -21
- package/vendor/re2/{testing → re2/testing}/compile_test.cc +5 -4
- package/vendor/re2/{testing → re2/testing}/dfa_test.cc +36 -30
- package/vendor/re2/{testing → re2/testing}/dump.cc +8 -8
- package/vendor/re2/{testing → re2/testing}/exhaustive1_test.cc +1 -1
- package/vendor/re2/{testing → re2/testing}/exhaustive2_test.cc +1 -1
- package/vendor/re2/{testing → re2/testing}/exhaustive3_test.cc +1 -1
- package/vendor/re2/{testing → re2/testing}/exhaustive_test.cc +1 -1
- package/vendor/re2/{testing → re2/testing}/exhaustive_tester.cc +36 -32
- package/vendor/re2/{testing → re2/testing}/exhaustive_tester.h +0 -1
- package/vendor/re2/{testing → re2/testing}/filtered_re2_test.cc +9 -8
- package/vendor/re2/{testing → re2/testing}/mimics_pcre_test.cc +3 -2
- package/vendor/re2/{testing → re2/testing}/null_walker.cc +1 -1
- package/vendor/re2/{testing → re2/testing}/parse_test.cc +13 -12
- package/vendor/re2/{testing → re2/testing}/possible_match_test.cc +15 -14
- package/vendor/re2/{testing → re2/testing}/random_test.cc +13 -12
- package/vendor/re2/{testing → re2/testing}/re2_arg_test.cc +25 -2
- package/vendor/re2/{testing → re2/testing}/re2_test.cc +49 -47
- package/vendor/re2/{testing → re2/testing}/regexp_benchmark.cc +144 -145
- package/vendor/re2/{testing → re2/testing}/regexp_generator.cc +18 -14
- package/vendor/re2/{testing → re2/testing}/regexp_generator.h +3 -4
- package/vendor/re2/{testing → re2/testing}/regexp_test.cc +1 -1
- package/vendor/re2/{testing → re2/testing}/required_prefix_test.cc +5 -4
- package/vendor/re2/{testing → re2/testing}/search_test.cc +3 -2
- package/vendor/re2/{testing → re2/testing}/set_test.cc +1 -1
- package/vendor/re2/{testing → re2/testing}/simplify_test.cc +3 -2
- package/vendor/re2/{testing → re2/testing}/string_generator.cc +3 -3
- package/vendor/re2/{testing → re2/testing}/string_generator.h +5 -6
- package/vendor/re2/{testing → re2/testing}/string_generator_test.cc +2 -2
- package/vendor/re2/{testing → re2/testing}/tester.cc +77 -78
- package/vendor/re2/{testing → re2/testing}/tester.h +13 -15
- package/vendor/re2/{tostring.cc → re2/tostring.cc} +7 -8
- package/vendor/re2/{unicode_casefold.h → re2/unicode_casefold.h} +0 -1
- package/vendor/re2/{unicode_groups.h → re2/unicode_groups.h} +0 -1
- package/vendor/re2/{walker-inl.h → re2/walker-inl.h} +2 -1
- package/vendor/re2/re2.pc.in +9 -0
- package/vendor/re2/re2Config.cmake.in +28 -0
- package/vendor/re2/runtests +33 -0
- package/vendor/re2/testinstall.cc +27 -0
- package/vendor/re2/ucs2.diff +567 -0
- package/vendor/{util → re2/util}/logging.h +2 -2
- package/vendor/{util → re2/util}/pcre.cc +47 -116
- package/vendor/{util → re2/util}/pcre.h +53 -63
- package/vendor/re2/util/strutil.cc +26 -0
- package/vendor/{util → re2/util}/strutil.h +0 -5
- package/vendor/re2/stringpiece.cc +0 -65
- package/vendor/re2/stringpiece.h +0 -213
- package/vendor/util/benchmark.cc +0 -131
- package/vendor/util/benchmark.h +0 -156
- package/vendor/util/flags.h +0 -26
- package/vendor/util/mix.h +0 -41
- package/vendor/util/mutex.h +0 -164
- package/vendor/util/strutil.cc +0 -149
- package/vendor/util/test.cc +0 -34
- package/vendor/util/test.h +0 -50
- package/vendor/util/util.h +0 -42
- /package/vendor/{LICENSE → re2/LICENSE} +0 -0
- /package/vendor/re2/{bitmap256.h → re2/bitmap256.h} +0 -0
- /package/vendor/re2/{fuzzing → re2/fuzzing}/compiler-rt/LICENSE +0 -0
- /package/vendor/re2/{fuzzing → re2/fuzzing}/compiler-rt/include/fuzzer/FuzzedDataProvider.h +0 -0
- /package/vendor/re2/{make_perl_groups.pl → re2/make_perl_groups.pl} +0 -0
- /package/vendor/re2/{make_unicode_casefold.py → re2/make_unicode_casefold.py} +0 -0
- /package/vendor/re2/{make_unicode_groups.py → re2/make_unicode_groups.py} +0 -0
- /package/vendor/re2/{perl_groups.cc → re2/perl_groups.cc} +0 -0
- /package/vendor/re2/{pod_array.h → re2/pod_array.h} +0 -0
- /package/vendor/re2/{sparse_array.h → re2/sparse_array.h} +0 -0
- /package/vendor/re2/{sparse_set.h → re2/sparse_set.h} +0 -0
- /package/vendor/re2/{unicode.py → re2/unicode.py} +0 -0
- /package/vendor/re2/{unicode_casefold.cc → re2/unicode_casefold.cc} +0 -0
- /package/vendor/re2/{unicode_groups.cc → re2/unicode_groups.cc} +0 -0
- /package/vendor/{util → re2/util}/fuzz.cc +0 -0
- /package/vendor/{util → re2/util}/malloc_counter.h +0 -0
- /package/vendor/{util → re2/util}/rune.cc +0 -0
- /package/vendor/{util → re2/util}/utf.h +0 -0
|
@@ -29,9 +29,11 @@
|
|
|
29
29
|
#include <string>
|
|
30
30
|
#include <vector>
|
|
31
31
|
|
|
32
|
-
#include "
|
|
32
|
+
#include "absl/base/macros.h"
|
|
33
|
+
#include "absl/strings/escaping.h"
|
|
34
|
+
#include "absl/strings/str_format.h"
|
|
35
|
+
#include "gtest/gtest.h"
|
|
33
36
|
#include "util/logging.h"
|
|
34
|
-
#include "util/strutil.h"
|
|
35
37
|
#include "util/utf.h"
|
|
36
38
|
#include "re2/testing/regexp_generator.h"
|
|
37
39
|
|
|
@@ -47,7 +49,7 @@ const std::vector<std::string>& RegexpGenerator::EgrepOps() {
|
|
|
47
49
|
"%s?",
|
|
48
50
|
"%s\\C*",
|
|
49
51
|
};
|
|
50
|
-
static std::vector<std::string> v(ops, ops +
|
|
52
|
+
static std::vector<std::string> v(ops, ops + ABSL_ARRAYSIZE(ops));
|
|
51
53
|
return v;
|
|
52
54
|
}
|
|
53
55
|
|
|
@@ -199,19 +201,21 @@ void RegexpGenerator::RunPostfix(const std::vector<std::string>& post) {
|
|
|
199
201
|
regexps.push(post[i]);
|
|
200
202
|
break;
|
|
201
203
|
case 1: {
|
|
204
|
+
auto fmt = absl::ParsedFormat<'s'>::New(post[i]);
|
|
205
|
+
CHECK(fmt != nullptr);
|
|
202
206
|
std::string a = regexps.top();
|
|
203
207
|
regexps.pop();
|
|
204
|
-
regexps.push("(?:" +
|
|
208
|
+
regexps.push("(?:" + absl::StrFormat(*fmt, a) + ")");
|
|
205
209
|
break;
|
|
206
210
|
}
|
|
207
211
|
case 2: {
|
|
212
|
+
auto fmt = absl::ParsedFormat<'s', 's'>::New(post[i]);
|
|
213
|
+
CHECK(fmt != nullptr);
|
|
208
214
|
std::string b = regexps.top();
|
|
209
215
|
regexps.pop();
|
|
210
216
|
std::string a = regexps.top();
|
|
211
217
|
regexps.pop();
|
|
212
|
-
regexps.push("(?:" +
|
|
213
|
-
StringPrintf(post[i].c_str(), a.c_str(), b.c_str()) +
|
|
214
|
-
")");
|
|
218
|
+
regexps.push("(?:" + absl::StrFormat(*fmt, a, b) + ")");
|
|
215
219
|
break;
|
|
216
220
|
}
|
|
217
221
|
}
|
|
@@ -219,13 +223,13 @@ void RegexpGenerator::RunPostfix(const std::vector<std::string>& post) {
|
|
|
219
223
|
|
|
220
224
|
if (regexps.size() != 1) {
|
|
221
225
|
// Internal error - should never happen.
|
|
222
|
-
|
|
226
|
+
absl::PrintF("Bad regexp program:\n");
|
|
223
227
|
for (size_t i = 0; i < post.size(); i++) {
|
|
224
|
-
|
|
228
|
+
absl::PrintF(" %s\n", absl::CEscape(post[i]));
|
|
225
229
|
}
|
|
226
|
-
|
|
230
|
+
absl::PrintF("Stack after running program:\n");
|
|
227
231
|
while (!regexps.empty()) {
|
|
228
|
-
|
|
232
|
+
absl::PrintF(" %s\n", absl::CEscape(regexps.top()));
|
|
229
233
|
regexps.pop();
|
|
230
234
|
}
|
|
231
235
|
LOG(FATAL) << "Bad regexp program.";
|
|
@@ -238,7 +242,7 @@ void RegexpGenerator::RunPostfix(const std::vector<std::string>& post) {
|
|
|
238
242
|
}
|
|
239
243
|
|
|
240
244
|
// Split s into an vector of strings, one for each UTF-8 character.
|
|
241
|
-
std::vector<std::string> Explode(
|
|
245
|
+
std::vector<std::string> Explode(absl::string_view s) {
|
|
242
246
|
std::vector<std::string> v;
|
|
243
247
|
|
|
244
248
|
for (const char *q = s.data(); q < s.data() + s.size(); ) {
|
|
@@ -253,7 +257,7 @@ std::vector<std::string> Explode(const StringPiece& s) {
|
|
|
253
257
|
|
|
254
258
|
// Split string everywhere a substring is found, returning
|
|
255
259
|
// vector of pieces.
|
|
256
|
-
std::vector<std::string> Split(
|
|
260
|
+
std::vector<std::string> Split(absl::string_view sep, absl::string_view s) {
|
|
257
261
|
std::vector<std::string> v;
|
|
258
262
|
|
|
259
263
|
if (sep.empty())
|
|
@@ -261,7 +265,7 @@ std::vector<std::string> Split(const StringPiece& sep, const StringPiece& s) {
|
|
|
261
265
|
|
|
262
266
|
const char *p = s.data();
|
|
263
267
|
for (const char *q = s.data(); q + sep.size() <= s.data() + s.size(); q++) {
|
|
264
|
-
if (
|
|
268
|
+
if (absl::string_view(q, sep.size()) == sep) {
|
|
265
269
|
v.push_back(std::string(p, q - p));
|
|
266
270
|
p = q + sep.size();
|
|
267
271
|
q = p - 1; // -1 for ++ in loop
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
#include <string>
|
|
14
14
|
#include <vector>
|
|
15
15
|
|
|
16
|
-
#include "
|
|
17
|
-
#include "re2/stringpiece.h"
|
|
16
|
+
#include "absl/strings/string_view.h"
|
|
18
17
|
|
|
19
18
|
namespace re2 {
|
|
20
19
|
|
|
@@ -66,11 +65,11 @@ class RegexpGenerator {
|
|
|
66
65
|
// Helpers for preparing arguments to RegexpGenerator constructor.
|
|
67
66
|
|
|
68
67
|
// Returns one string for each character in s.
|
|
69
|
-
std::vector<std::string> Explode(
|
|
68
|
+
std::vector<std::string> Explode(absl::string_view s);
|
|
70
69
|
|
|
71
70
|
// Splits string everywhere sep is found, returning
|
|
72
71
|
// vector of pieces.
|
|
73
|
-
std::vector<std::string> Split(
|
|
72
|
+
std::vector<std::string> Split(absl::string_view sep, absl::string_view s);
|
|
74
73
|
|
|
75
74
|
} // namespace re2
|
|
76
75
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
#include <string>
|
|
6
6
|
|
|
7
|
-
#include "
|
|
7
|
+
#include "absl/base/macros.h"
|
|
8
|
+
#include "gtest/gtest.h"
|
|
8
9
|
#include "util/logging.h"
|
|
9
10
|
#include "re2/prog.h"
|
|
10
11
|
#include "re2/regexp.h"
|
|
@@ -44,7 +45,7 @@ static PrefixTest tests[] = {
|
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
TEST(RequiredPrefix, SimpleTests) {
|
|
47
|
-
for (size_t i = 0; i <
|
|
48
|
+
for (size_t i = 0; i < ABSL_ARRAYSIZE(tests); i++) {
|
|
48
49
|
const PrefixTest& t = tests[i];
|
|
49
50
|
for (size_t j = 0; j < 2; j++) {
|
|
50
51
|
Regexp::ParseFlags flags = Regexp::LikePerl;
|
|
@@ -106,7 +107,7 @@ static PrefixTest for_accel_tests[] = {
|
|
|
106
107
|
};
|
|
107
108
|
|
|
108
109
|
TEST(RequiredPrefixForAccel, SimpleTests) {
|
|
109
|
-
for (size_t i = 0; i <
|
|
110
|
+
for (size_t i = 0; i < ABSL_ARRAYSIZE(for_accel_tests); i++) {
|
|
110
111
|
const PrefixTest& t = for_accel_tests[i];
|
|
111
112
|
for (size_t j = 0; j < 2; j++) {
|
|
112
113
|
Regexp::ParseFlags flags = Regexp::LikePerl;
|
|
@@ -171,7 +172,7 @@ static const char* prefix_accel_tests[] = {
|
|
|
171
172
|
};
|
|
172
173
|
|
|
173
174
|
TEST(PrefixAccel, SimpleTests) {
|
|
174
|
-
for (size_t i = 0; i <
|
|
175
|
+
for (size_t i = 0; i < ABSL_ARRAYSIZE(prefix_accel_tests); i++) {
|
|
175
176
|
const char* pattern = prefix_accel_tests[i];
|
|
176
177
|
Regexp* re = Regexp::Parse(pattern, Regexp::LikePerl, NULL);
|
|
177
178
|
ASSERT_TRUE(re != NULL);
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style
|
|
3
3
|
// license that can be found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
#include "
|
|
5
|
+
#include "absl/base/macros.h"
|
|
6
|
+
#include "gtest/gtest.h"
|
|
6
7
|
#include "re2/prog.h"
|
|
7
8
|
#include "re2/regexp.h"
|
|
8
9
|
#include "re2/testing/tester.h"
|
|
@@ -314,7 +315,7 @@ RegexpTest simple_tests[] = {
|
|
|
314
315
|
|
|
315
316
|
TEST(Regexp, SearchTests) {
|
|
316
317
|
int failures = 0;
|
|
317
|
-
for (size_t i = 0; i <
|
|
318
|
+
for (size_t i = 0; i < ABSL_ARRAYSIZE(simple_tests); i++) {
|
|
318
319
|
const RegexpTest& t = simple_tests[i];
|
|
319
320
|
if (!TestRegexpOnText(t.regexp, t.text))
|
|
320
321
|
failures++;
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
#include <string.h>
|
|
8
8
|
#include <string>
|
|
9
9
|
|
|
10
|
-
#include "
|
|
10
|
+
#include "absl/base/macros.h"
|
|
11
|
+
#include "gtest/gtest.h"
|
|
11
12
|
#include "util/logging.h"
|
|
12
13
|
#include "re2/regexp.h"
|
|
13
14
|
|
|
@@ -245,7 +246,7 @@ static Test tests[] = {
|
|
|
245
246
|
};
|
|
246
247
|
|
|
247
248
|
TEST(TestSimplify, SimpleRegexps) {
|
|
248
|
-
for (size_t i = 0; i <
|
|
249
|
+
for (size_t i = 0; i < ABSL_ARRAYSIZE(tests); i++) {
|
|
249
250
|
RegexpStatus status;
|
|
250
251
|
VLOG(1) << "Testing " << tests[i].regexp;
|
|
251
252
|
Regexp* re = Regexp::Parse(tests[i].regexp,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include <string>
|
|
12
12
|
#include <vector>
|
|
13
13
|
|
|
14
|
-
#include "
|
|
14
|
+
#include "gtest/gtest.h"
|
|
15
15
|
#include "util/logging.h"
|
|
16
16
|
#include "re2/testing/string_generator.h"
|
|
17
17
|
|
|
@@ -81,11 +81,11 @@ bool StringGenerator::RandomDigits() {
|
|
|
81
81
|
// currently described by digits_. Calls IncrementDigits
|
|
82
82
|
// after computing the string, so that it knows the answer
|
|
83
83
|
// for subsequent HasNext() calls.
|
|
84
|
-
|
|
84
|
+
absl::string_view StringGenerator::Next() {
|
|
85
85
|
CHECK(hasnext_);
|
|
86
86
|
if (generate_null_) {
|
|
87
87
|
generate_null_ = false;
|
|
88
|
-
sp_ =
|
|
88
|
+
sp_ = absl::string_view();
|
|
89
89
|
return sp_;
|
|
90
90
|
}
|
|
91
91
|
s_.clear();
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
#include <string>
|
|
15
15
|
#include <vector>
|
|
16
16
|
|
|
17
|
-
#include "
|
|
18
|
-
#include "re2/stringpiece.h"
|
|
17
|
+
#include "absl/strings/string_view.h"
|
|
19
18
|
|
|
20
19
|
namespace re2 {
|
|
21
20
|
|
|
@@ -24,7 +23,7 @@ class StringGenerator {
|
|
|
24
23
|
StringGenerator(int maxlen, const std::vector<std::string>& alphabet);
|
|
25
24
|
~StringGenerator() {}
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
absl::string_view Next();
|
|
28
27
|
bool HasNext() { return hasnext_; }
|
|
29
28
|
|
|
30
29
|
// Resets generator to start sequence over.
|
|
@@ -45,11 +44,11 @@ class StringGenerator {
|
|
|
45
44
|
std::vector<std::string> alphabet_; // Alphabet, one string per letter.
|
|
46
45
|
|
|
47
46
|
// Iteration state.
|
|
48
|
-
|
|
49
|
-
std::string s_; // String data in last
|
|
47
|
+
absl::string_view sp_; // Last string_view returned by Next().
|
|
48
|
+
std::string s_; // String data in last string_view returned by Next().
|
|
50
49
|
bool hasnext_; // Whether Next() can be called again.
|
|
51
50
|
std::vector<int> digits_; // Alphabet indices for next string.
|
|
52
|
-
bool generate_null_; // Whether to generate a NULL
|
|
51
|
+
bool generate_null_; // Whether to generate a NULL string_view next.
|
|
53
52
|
bool random_; // Whether generated strings are random.
|
|
54
53
|
int nrandom_; // Number of random strings left to generate.
|
|
55
54
|
std::minstd_rand0 rng_; // Random number generator.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
#include <stdint.h>
|
|
8
8
|
#include <string>
|
|
9
9
|
|
|
10
|
-
#include "
|
|
10
|
+
#include "gtest/gtest.h"
|
|
11
11
|
#include "util/utf.h"
|
|
12
12
|
#include "re2/testing/string_generator.h"
|
|
13
13
|
#include "re2/testing/regexp_generator.h"
|
|
@@ -41,7 +41,7 @@ static void RunTest(int len, const std::string& alphabet, bool donull) {
|
|
|
41
41
|
if (donull) {
|
|
42
42
|
g.GenerateNULL();
|
|
43
43
|
EXPECT_TRUE(g.HasNext());
|
|
44
|
-
|
|
44
|
+
absl::string_view sp = g.Next();
|
|
45
45
|
EXPECT_EQ(sp.data(), static_cast<const char*>(NULL));
|
|
46
46
|
EXPECT_EQ(sp.size(), 0);
|
|
47
47
|
}
|