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.
Files changed (151) hide show
  1. package/.github/actions/linux-alpine-node-16/Dockerfile +1 -1
  2. package/.github/actions/linux-alpine-node-18/Dockerfile +1 -1
  3. package/.github/actions/linux-alpine-node-20/Dockerfile +1 -1
  4. package/.gitmodules +5 -2
  5. package/README.md +1 -0
  6. package/binding.gyp +82 -25
  7. package/lib/replace.cc +4 -4
  8. package/package.json +1 -1
  9. package/tsconfig.json +2 -1
  10. package/vendor/re2/.bazelrc +16 -0
  11. package/vendor/re2/.github/bazel.sh +24 -0
  12. package/vendor/re2/.github/cmake.sh +12 -0
  13. package/vendor/re2/.github/workflows/ci-bazel.yml +17 -0
  14. package/vendor/re2/.github/workflows/ci-cmake.yml +108 -0
  15. package/vendor/re2/.github/workflows/ci.yml +89 -0
  16. package/vendor/re2/.github/workflows/pr.yml +26 -0
  17. package/vendor/re2/.github/workflows/python.yml +185 -0
  18. package/vendor/re2/AUTHORS +13 -0
  19. package/vendor/re2/BUILD.bazel +280 -0
  20. package/vendor/re2/CMakeLists.txt +268 -0
  21. package/vendor/re2/CONTRIBUTING.md +2 -0
  22. package/vendor/re2/CONTRIBUTORS +41 -0
  23. package/vendor/re2/Makefile +400 -0
  24. package/vendor/{README → re2/README} +5 -0
  25. package/vendor/re2/SECURITY.md +4 -0
  26. package/vendor/re2/WORKSPACE.bazel +62 -0
  27. package/vendor/re2/app/BUILD.bazel +19 -0
  28. package/vendor/re2/app/_re2.cc +94 -0
  29. package/vendor/re2/app/_re2.d.ts +23 -0
  30. package/vendor/re2/app/app.ts +111 -0
  31. package/vendor/re2/app/build.sh +50 -0
  32. package/vendor/re2/app/index.html +5 -0
  33. package/vendor/re2/app/package.json +14 -0
  34. package/vendor/re2/app/rollup.config.js +28 -0
  35. package/vendor/re2/app/tsconfig.json +17 -0
  36. package/vendor/re2/benchlog/benchplot.py +98 -0
  37. package/vendor/re2/benchlog/mktable +155 -0
  38. package/vendor/re2/doc/mksyntaxgo +42 -0
  39. package/vendor/re2/doc/mksyntaxhtml +42 -0
  40. package/vendor/re2/doc/mksyntaxwiki +36 -0
  41. package/vendor/re2/doc/syntax.html +477 -0
  42. package/vendor/re2/doc/syntax.txt +463 -0
  43. package/vendor/re2/lib/git/commit-msg.hook +104 -0
  44. package/vendor/re2/libre2.symbols +19 -0
  45. package/vendor/re2/libre2.symbols.darwin +15 -0
  46. package/vendor/re2/python/BUILD.bazel +36 -0
  47. package/vendor/re2/python/README +1 -0
  48. package/vendor/re2/python/_re2.cc +338 -0
  49. package/vendor/re2/python/re2.py +582 -0
  50. package/vendor/re2/python/re2_test.py +482 -0
  51. package/vendor/re2/python/setup.py +105 -0
  52. package/vendor/re2/{bitmap256.cc → re2/bitmap256.cc} +4 -4
  53. package/vendor/re2/{bitstate.cc → re2/bitstate.cc} +21 -25
  54. package/vendor/re2/{compile.cc → re2/compile.cc} +5 -4
  55. package/vendor/re2/{dfa.cc → re2/dfa.cc} +120 -101
  56. package/vendor/re2/{filtered_re2.cc → re2/filtered_re2.cc} +8 -11
  57. package/vendor/re2/{filtered_re2.h → re2/filtered_re2.h} +5 -4
  58. package/vendor/re2/{fuzzing → re2/fuzzing}/re2_fuzzer.cc +4 -6
  59. package/vendor/re2/{mimics_pcre.cc → re2/mimics_pcre.cc} +0 -1
  60. package/vendor/re2/{nfa.cc → re2/nfa.cc} +34 -37
  61. package/vendor/re2/{onepass.cc → re2/onepass.cc} +25 -27
  62. package/vendor/re2/{parse.cc → re2/parse.cc} +118 -121
  63. package/vendor/re2/{prefilter.cc → re2/prefilter.cc} +2 -3
  64. package/vendor/re2/{prefilter.h → re2/prefilter.h} +0 -1
  65. package/vendor/re2/{prefilter_tree.cc → re2/prefilter_tree.cc} +4 -5
  66. package/vendor/re2/{prefilter_tree.h → re2/prefilter_tree.h} +1 -2
  67. package/vendor/re2/{prog.cc → re2/prog.cc} +20 -21
  68. package/vendor/re2/{prog.h → re2/prog.h} +21 -22
  69. package/vendor/re2/{re2.cc → re2/re2.cc} +51 -62
  70. package/vendor/re2/{re2.h → re2/re2.h} +78 -40
  71. package/vendor/re2/{regexp.cc → re2/regexp.cc} +11 -12
  72. package/vendor/re2/{regexp.h → re2/regexp.h} +9 -10
  73. package/vendor/re2/{set.cc → re2/set.cc} +3 -5
  74. package/vendor/re2/{set.h → re2/set.h} +4 -3
  75. package/vendor/re2/{simplify.cc → re2/simplify.cc} +1 -2
  76. package/vendor/re2/re2/stringpiece.h +24 -0
  77. package/vendor/re2/{testing → re2/testing}/backtrack.cc +22 -25
  78. package/vendor/re2/{testing → re2/testing}/charclass_test.cc +23 -21
  79. package/vendor/re2/{testing → re2/testing}/compile_test.cc +5 -4
  80. package/vendor/re2/{testing → re2/testing}/dfa_test.cc +36 -30
  81. package/vendor/re2/{testing → re2/testing}/dump.cc +8 -8
  82. package/vendor/re2/{testing → re2/testing}/exhaustive1_test.cc +1 -1
  83. package/vendor/re2/{testing → re2/testing}/exhaustive2_test.cc +1 -1
  84. package/vendor/re2/{testing → re2/testing}/exhaustive3_test.cc +1 -1
  85. package/vendor/re2/{testing → re2/testing}/exhaustive_test.cc +1 -1
  86. package/vendor/re2/{testing → re2/testing}/exhaustive_tester.cc +36 -32
  87. package/vendor/re2/{testing → re2/testing}/exhaustive_tester.h +0 -1
  88. package/vendor/re2/{testing → re2/testing}/filtered_re2_test.cc +9 -8
  89. package/vendor/re2/{testing → re2/testing}/mimics_pcre_test.cc +3 -2
  90. package/vendor/re2/{testing → re2/testing}/null_walker.cc +1 -1
  91. package/vendor/re2/{testing → re2/testing}/parse_test.cc +13 -12
  92. package/vendor/re2/{testing → re2/testing}/possible_match_test.cc +15 -14
  93. package/vendor/re2/{testing → re2/testing}/random_test.cc +13 -12
  94. package/vendor/re2/{testing → re2/testing}/re2_arg_test.cc +25 -2
  95. package/vendor/re2/{testing → re2/testing}/re2_test.cc +49 -47
  96. package/vendor/re2/{testing → re2/testing}/regexp_benchmark.cc +144 -145
  97. package/vendor/re2/{testing → re2/testing}/regexp_generator.cc +18 -14
  98. package/vendor/re2/{testing → re2/testing}/regexp_generator.h +3 -4
  99. package/vendor/re2/{testing → re2/testing}/regexp_test.cc +1 -1
  100. package/vendor/re2/{testing → re2/testing}/required_prefix_test.cc +5 -4
  101. package/vendor/re2/{testing → re2/testing}/search_test.cc +3 -2
  102. package/vendor/re2/{testing → re2/testing}/set_test.cc +1 -1
  103. package/vendor/re2/{testing → re2/testing}/simplify_test.cc +3 -2
  104. package/vendor/re2/{testing → re2/testing}/string_generator.cc +3 -3
  105. package/vendor/re2/{testing → re2/testing}/string_generator.h +5 -6
  106. package/vendor/re2/{testing → re2/testing}/string_generator_test.cc +2 -2
  107. package/vendor/re2/{testing → re2/testing}/tester.cc +77 -78
  108. package/vendor/re2/{testing → re2/testing}/tester.h +13 -15
  109. package/vendor/re2/{tostring.cc → re2/tostring.cc} +7 -8
  110. package/vendor/re2/{unicode_casefold.h → re2/unicode_casefold.h} +0 -1
  111. package/vendor/re2/{unicode_groups.h → re2/unicode_groups.h} +0 -1
  112. package/vendor/re2/{walker-inl.h → re2/walker-inl.h} +2 -1
  113. package/vendor/re2/re2.pc.in +9 -0
  114. package/vendor/re2/re2Config.cmake.in +28 -0
  115. package/vendor/re2/runtests +33 -0
  116. package/vendor/re2/testinstall.cc +27 -0
  117. package/vendor/re2/ucs2.diff +567 -0
  118. package/vendor/{util → re2/util}/logging.h +2 -2
  119. package/vendor/{util → re2/util}/pcre.cc +47 -116
  120. package/vendor/{util → re2/util}/pcre.h +53 -63
  121. package/vendor/re2/util/strutil.cc +26 -0
  122. package/vendor/{util → re2/util}/strutil.h +0 -5
  123. package/vendor/re2/stringpiece.cc +0 -65
  124. package/vendor/re2/stringpiece.h +0 -213
  125. package/vendor/util/benchmark.cc +0 -131
  126. package/vendor/util/benchmark.h +0 -156
  127. package/vendor/util/flags.h +0 -26
  128. package/vendor/util/mix.h +0 -41
  129. package/vendor/util/mutex.h +0 -164
  130. package/vendor/util/strutil.cc +0 -149
  131. package/vendor/util/test.cc +0 -34
  132. package/vendor/util/test.h +0 -50
  133. package/vendor/util/util.h +0 -42
  134. /package/vendor/{LICENSE → re2/LICENSE} +0 -0
  135. /package/vendor/re2/{bitmap256.h → re2/bitmap256.h} +0 -0
  136. /package/vendor/re2/{fuzzing → re2/fuzzing}/compiler-rt/LICENSE +0 -0
  137. /package/vendor/re2/{fuzzing → re2/fuzzing}/compiler-rt/include/fuzzer/FuzzedDataProvider.h +0 -0
  138. /package/vendor/re2/{make_perl_groups.pl → re2/make_perl_groups.pl} +0 -0
  139. /package/vendor/re2/{make_unicode_casefold.py → re2/make_unicode_casefold.py} +0 -0
  140. /package/vendor/re2/{make_unicode_groups.py → re2/make_unicode_groups.py} +0 -0
  141. /package/vendor/re2/{perl_groups.cc → re2/perl_groups.cc} +0 -0
  142. /package/vendor/re2/{pod_array.h → re2/pod_array.h} +0 -0
  143. /package/vendor/re2/{sparse_array.h → re2/sparse_array.h} +0 -0
  144. /package/vendor/re2/{sparse_set.h → re2/sparse_set.h} +0 -0
  145. /package/vendor/re2/{unicode.py → re2/unicode.py} +0 -0
  146. /package/vendor/re2/{unicode_casefold.cc → re2/unicode_casefold.cc} +0 -0
  147. /package/vendor/re2/{unicode_groups.cc → re2/unicode_groups.cc} +0 -0
  148. /package/vendor/{util → re2/util}/fuzz.cc +0 -0
  149. /package/vendor/{util → re2/util}/malloc_counter.h +0 -0
  150. /package/vendor/{util → re2/util}/rune.cc +0 -0
  151. /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(const StringPiece& text, const StringPiece& context,
46
- bool anchored, bool longest,
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_; // program being run
57
- StringPiece text_; // text being searched
58
- StringPiece context_; // greater context of text being searched
59
- bool anchored_; // whether search is anchored at text.begin()
60
- bool longest_; // whether search wants leftmost-longest match
61
- bool endmatch_; // whether match must end at text.end()
62
- StringPiece* submatch_; // submatches to fill in
63
- int nsubmatch_; // # of submatches to fill in
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
- StringPiece(cap_[2 * i],
261
- static_cast<size_t>(cap_[2 * i + 1] - cap_[2 * i]));
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(const StringPiece& text, const StringPiece& context,
289
- bool anchored, bool longest,
290
- StringPiece* submatch, int nsubmatch) {
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] = StringPiece();
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(const StringPiece& text,
357
- const StringPiece& context,
358
- Anchor anchor,
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
- StringPiece sp0;
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
- std::unordered_map<uint64_t, int> rune_cache_;
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
- std::unordered_map<uint64_t, int>::const_iterator it = rune_cache_.find(key);
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
- StringPiece sp = "hello, world";
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) {