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
|
@@ -42,9 +42,8 @@ class BitState {
|
|
|
42
42
|
|
|
43
43
|
// The usual Search prototype.
|
|
44
44
|
// Can only call Search once per BitState.
|
|
45
|
-
bool Search(
|
|
46
|
-
bool
|
|
47
|
-
StringPiece* submatch, int nsubmatch);
|
|
45
|
+
bool Search(absl::string_view text, absl::string_view context, bool anchored,
|
|
46
|
+
bool longest, absl::string_view* submatch, int nsubmatch);
|
|
48
47
|
|
|
49
48
|
private:
|
|
50
49
|
inline bool ShouldVisit(int id, const char* p);
|
|
@@ -53,14 +52,14 @@ class BitState {
|
|
|
53
52
|
bool TrySearch(int id, const char* p);
|
|
54
53
|
|
|
55
54
|
// Search parameters
|
|
56
|
-
Prog* prog_;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
bool anchored_;
|
|
60
|
-
bool longest_;
|
|
61
|
-
bool endmatch_;
|
|
62
|
-
|
|
63
|
-
int nsubmatch_;
|
|
55
|
+
Prog* prog_; // program being run
|
|
56
|
+
absl::string_view text_; // text being searched
|
|
57
|
+
absl::string_view context_; // greater context of text being searched
|
|
58
|
+
bool anchored_; // whether search is anchored at text.begin()
|
|
59
|
+
bool longest_; // whether search wants leftmost-longest match
|
|
60
|
+
bool endmatch_; // whether match must end at text.end()
|
|
61
|
+
absl::string_view* submatch_; // submatches to fill in
|
|
62
|
+
int nsubmatch_; // # of submatches to fill in
|
|
64
63
|
|
|
65
64
|
// Search state
|
|
66
65
|
static constexpr int kVisitedBits = 64;
|
|
@@ -256,9 +255,9 @@ bool BitState::TrySearch(int id0, const char* p0) {
|
|
|
256
255
|
if (submatch_[0].data() == NULL ||
|
|
257
256
|
(longest_ && p > submatch_[0].data() + submatch_[0].size())) {
|
|
258
257
|
for (int i = 0; i < nsubmatch_; i++)
|
|
259
|
-
submatch_[i] =
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
submatch_[i] = absl::string_view(
|
|
259
|
+
cap_[2 * i],
|
|
260
|
+
static_cast<size_t>(cap_[2 * i + 1] - cap_[2 * i]));
|
|
262
261
|
}
|
|
263
262
|
|
|
264
263
|
// If going for first match, we're done.
|
|
@@ -285,9 +284,9 @@ bool BitState::TrySearch(int id0, const char* p0) {
|
|
|
285
284
|
}
|
|
286
285
|
|
|
287
286
|
// Search text (within context) for prog_.
|
|
288
|
-
bool BitState::Search(
|
|
289
|
-
bool anchored, bool longest,
|
|
290
|
-
|
|
287
|
+
bool BitState::Search(absl::string_view text, absl::string_view context,
|
|
288
|
+
bool anchored, bool longest, absl::string_view* submatch,
|
|
289
|
+
int nsubmatch) {
|
|
291
290
|
// Search parameters.
|
|
292
291
|
text_ = text;
|
|
293
292
|
context_ = context;
|
|
@@ -303,7 +302,7 @@ bool BitState::Search(const StringPiece& text, const StringPiece& context,
|
|
|
303
302
|
submatch_ = submatch;
|
|
304
303
|
nsubmatch_ = nsubmatch;
|
|
305
304
|
for (int i = 0; i < nsubmatch_; i++)
|
|
306
|
-
submatch_[i] =
|
|
305
|
+
submatch_[i] = absl::string_view();
|
|
307
306
|
|
|
308
307
|
// Allocate scratch space.
|
|
309
308
|
int nvisited = prog_->list_count() * static_cast<int>(text.size()+1);
|
|
@@ -353,16 +352,13 @@ bool BitState::Search(const StringPiece& text, const StringPiece& context,
|
|
|
353
352
|
}
|
|
354
353
|
|
|
355
354
|
// Bit-state search.
|
|
356
|
-
bool Prog::SearchBitState(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
MatchKind kind,
|
|
360
|
-
StringPiece* match,
|
|
361
|
-
int nmatch) {
|
|
355
|
+
bool Prog::SearchBitState(absl::string_view text, absl::string_view context,
|
|
356
|
+
Anchor anchor, MatchKind kind,
|
|
357
|
+
absl::string_view* match, int nmatch) {
|
|
362
358
|
// If full match, we ask for an anchored longest match
|
|
363
359
|
// and then check that match[0] == text.
|
|
364
360
|
// So make sure match[0] exists.
|
|
365
|
-
|
|
361
|
+
absl::string_view sp0;
|
|
366
362
|
if (kind == kFullMatch) {
|
|
367
363
|
anchor = kAnchored;
|
|
368
364
|
if (nmatch < 1) {
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
#include <stdint.h>
|
|
12
12
|
#include <string.h>
|
|
13
|
-
#include <unordered_map>
|
|
14
13
|
#include <utility>
|
|
15
14
|
|
|
15
|
+
#include "absl/base/macros.h"
|
|
16
|
+
#include "absl/container/flat_hash_map.h"
|
|
16
17
|
#include "util/logging.h"
|
|
17
18
|
#include "util/utf.h"
|
|
18
19
|
#include "re2/pod_array.h"
|
|
@@ -211,7 +212,7 @@ class Compiler : public Regexp::Walker<Frag> {
|
|
|
211
212
|
|
|
212
213
|
int64_t max_mem_; // Total memory budget.
|
|
213
214
|
|
|
214
|
-
|
|
215
|
+
absl::flat_hash_map<uint64_t, int> rune_cache_;
|
|
215
216
|
Frag rune_range_;
|
|
216
217
|
|
|
217
218
|
RE2::Anchor anchor_; // anchor mode for RE2::Set
|
|
@@ -478,7 +479,7 @@ static uint64_t MakeRuneCacheKey(uint8_t lo, uint8_t hi, bool foldcase,
|
|
|
478
479
|
int Compiler::CachedRuneByteSuffix(uint8_t lo, uint8_t hi, bool foldcase,
|
|
479
480
|
int next) {
|
|
480
481
|
uint64_t key = MakeRuneCacheKey(lo, hi, foldcase, next);
|
|
481
|
-
|
|
482
|
+
absl::flat_hash_map<uint64_t, int>::const_iterator it = rune_cache_.find(key);
|
|
482
483
|
if (it != rune_cache_.end())
|
|
483
484
|
return it->second;
|
|
484
485
|
int id = UncachedRuneByteSuffix(lo, hi, foldcase, next);
|
|
@@ -1243,7 +1244,7 @@ Prog* Compiler::CompileSet(Regexp* re, RE2::Anchor anchor, int64_t max_mem) {
|
|
|
1243
1244
|
// Make sure DFA has enough memory to operate,
|
|
1244
1245
|
// since we're not going to fall back to the NFA.
|
|
1245
1246
|
bool dfa_failed = false;
|
|
1246
|
-
|
|
1247
|
+
absl::string_view sp = "hello, world";
|
|
1247
1248
|
prog->SearchDFA(sp, sp, Prog::kAnchored, Prog::kManyMatch,
|
|
1248
1249
|
NULL, &dfa_failed, NULL);
|
|
1249
1250
|
if (dfa_failed) {
|