re2 2.19.0-arm64-darwin → 2.21.0-arm64-darwin
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.
- checksums.yaml +4 -4
- data/README.md +11 -9
- data/Rakefile +2 -2
- data/dependencies.yml +4 -4
- data/ext/re2/extconf.rb +5 -10
- data/ext/re2/re2.cc +13 -22
- data/ext/re2/recipes.rb +3 -3
- data/lib/3.1/re2.bundle +0 -0
- data/lib/3.2/re2.bundle +0 -0
- data/lib/3.3/re2.bundle +0 -0
- data/lib/3.4/re2.bundle +0 -0
- data/lib/re2/version.rb +1 -1
- data/re2.gemspec +3 -3
- data/spec/re2/match_data_spec.rb +21 -0
- data/spec/re2/scanner_spec.rb +50 -1
- metadata +5 -8
- data/lib/2.6/re2.bundle +0 -0
- data/lib/2.7/re2.bundle +0 -0
- data/lib/3.0/re2.bundle +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd576e129dd44bf28fefa5c64eca375ee9e5fc5f3d1c26ec7fb1b3ddee7b7935
|
|
4
|
+
data.tar.gz: 24f7560f116cd88477f4e55b0429537f549ac419b5c703a913f4c5fb372d89c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e0bf779d544ca7bf5df5bae5c63ec0fc4e74e89d9f9ff992e89c00636d8befd19f2023c8441ee4c2838268c8cd2926c438852f2d166ce68982dec5924209b43
|
|
7
|
+
data.tar.gz: 846c5ac8c95ba69ec5ff01015fb9da9c13471a76b8a5793506d709b881adb59b9c722a180cb9f4dc36fb4c59c29033e7fd1e0abae901b93ee880aee3ce7f6001
|
data/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Python".
|
|
|
6
6
|
|
|
7
7
|
[](https://github.com/mudge/re2/actions)
|
|
8
8
|
|
|
9
|
-
**Current version:** 2.
|
|
10
|
-
**Bundled RE2 version:** libre2.11 (2025-
|
|
9
|
+
**Current version:** 2.21.0
|
|
10
|
+
**Bundled RE2 version:** libre2.11 (2025-11-05)
|
|
11
11
|
|
|
12
12
|
```ruby
|
|
13
13
|
RE2('h.*o').full_match?("hello") #=> true
|
|
@@ -260,21 +260,21 @@ RE2(non_latin1_pattern.encode("ISO-8859-1"), utf8: false).match(non_latin1_text.
|
|
|
260
260
|
|
|
261
261
|
This gem requires the following to run:
|
|
262
262
|
|
|
263
|
-
* [Ruby](https://www.ruby-lang.org/en/)
|
|
263
|
+
* [Ruby](https://www.ruby-lang.org/en/) 3.1 to 3.4
|
|
264
264
|
|
|
265
265
|
It supports the following RE2 ABI versions:
|
|
266
266
|
|
|
267
|
-
* libre2.0 (prior to release 2020-03-02) to libre2.11 (2023-07-01 to 2025-
|
|
267
|
+
* libre2.0 (prior to release 2020-03-02) to libre2.11 (2023-07-01 to 2025-11-05)
|
|
268
268
|
|
|
269
269
|
### Native gems
|
|
270
270
|
|
|
271
271
|
Where possible, a pre-compiled native gem will be provided for the following platforms:
|
|
272
272
|
|
|
273
273
|
* Linux
|
|
274
|
-
* `aarch64-linux`, `arm-linux`,
|
|
274
|
+
* `aarch64-linux`, `arm-linux`, and `x86_64-linux` (requires [glibc](https://www.gnu.org/software/libc/) 2.29+, RubyGems 3.3.22+ and Bundler 2.3.21+)
|
|
275
275
|
* [musl](https://musl.libc.org/)-based systems such as [Alpine](https://alpinelinux.org) are supported with Bundler 2.5.6+
|
|
276
|
-
* macOS `x86_64-darwin` and `arm64-darwin`
|
|
277
|
-
* Windows
|
|
276
|
+
* macOS 10.14+ `x86_64-darwin` and `arm64-darwin`
|
|
277
|
+
* Windows 2022+ `x64-mingw-ucrt`
|
|
278
278
|
|
|
279
279
|
### Verifying the gems
|
|
280
280
|
|
|
@@ -331,8 +331,8 @@ You will need a full compiler toolchain for compiling Ruby C extensions (see
|
|
|
331
331
|
Toolchain"](https://nokogiri.org/tutorials/installing_nokogiri.html#appendix-a-the-compiler-toolchain))
|
|
332
332
|
plus the toolchain required for compiling the vendored version of RE2 and its
|
|
333
333
|
dependency [Abseil][] which includes [CMake](https://cmake.org), a compiler
|
|
334
|
-
with C++
|
|
335
|
-
[gcc](https://gcc.gnu.org/)
|
|
334
|
+
with C++17 support such as [clang](http://clang.llvm.org/) 5 or
|
|
335
|
+
[gcc](https://gcc.gnu.org/) 8 and a recent version of
|
|
336
336
|
[pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). On
|
|
337
337
|
Windows, you'll also need pkgconf 2.1.0+ to avoid [`undefined reference`
|
|
338
338
|
errors](https://github.com/pkgconf/pkgconf/issues/322) when attempting to
|
|
@@ -378,6 +378,8 @@ Alternatively, you can set the `RE2_USE_SYSTEM_LIBRARIES` environment variable i
|
|
|
378
378
|
improvements in 2.4.0.
|
|
379
379
|
* Thanks to [Manuel Jacob](https://github.com/manueljacob) for reporting a bug
|
|
380
380
|
when passing strings with null bytes.
|
|
381
|
+
* Thanks to [Maciej Gajewski](https://github.com/konieczkow) for helping
|
|
382
|
+
confirm issues with GC compaction and mutable strings.
|
|
381
383
|
|
|
382
384
|
## Contact
|
|
383
385
|
|
data/Rakefile
CHANGED
|
@@ -33,7 +33,7 @@ cross_platforms = %w[
|
|
|
33
33
|
x86_64-linux-musl
|
|
34
34
|
].freeze
|
|
35
35
|
|
|
36
|
-
RakeCompilerDock.set_ruby_cc_version("~>
|
|
36
|
+
RakeCompilerDock.set_ruby_cc_version("~> 3.1")
|
|
37
37
|
|
|
38
38
|
Gem::PackageTask.new(re2_gemspec).define
|
|
39
39
|
|
|
@@ -76,7 +76,7 @@ namespace :gem do
|
|
|
76
76
|
sudo apt-get install -y cmake=3.22.2-0kitware1ubuntu20.04.1 cmake-data=3.22.2-0kitware1ubuntu20.04.1 &&
|
|
77
77
|
rbenv shell 3.1.6 &&
|
|
78
78
|
gem install bundler --no-document &&
|
|
79
|
-
bundle &&
|
|
79
|
+
bundle install &&
|
|
80
80
|
bundle exec rake native:#{platform} pkg/#{re2_gemspec.full_name}-#{Gem::Platform.new(platform)}.gem PATH="/usr/local/bin:$PATH"
|
|
81
81
|
SCRIPT
|
|
82
82
|
end
|
data/dependencies.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
libre2:
|
|
3
|
-
version: '2025-
|
|
4
|
-
sha256:
|
|
3
|
+
version: '2025-11-05'
|
|
4
|
+
sha256: 87f6029d2f6de8aa023654240a03ada90e876ce9a4676e258dd01ea4c26ffd67
|
|
5
5
|
abseil:
|
|
6
|
-
version: '
|
|
7
|
-
sha256:
|
|
6
|
+
version: '20250814.1'
|
|
7
|
+
sha256: 1692f77d1739bacf3f94337188b78583cf09bab7e420d2dc6c5605a4f86785a1
|
data/ext/re2/extconf.rb
CHANGED
|
@@ -103,6 +103,8 @@ module RE2
|
|
|
103
103
|
def build_with_vendored_libraries
|
|
104
104
|
message "Building re2 using packaged libraries.\n"
|
|
105
105
|
|
|
106
|
+
ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.14"
|
|
107
|
+
|
|
106
108
|
abseil_recipe, re2_recipe = load_recipes
|
|
107
109
|
|
|
108
110
|
process_recipe(abseil_recipe) do |recipe|
|
|
@@ -129,10 +131,8 @@ module RE2
|
|
|
129
131
|
end
|
|
130
132
|
|
|
131
133
|
def build_extension
|
|
132
|
-
# Enable optional warnings but disable deprecated register warning for Ruby 2.6 support
|
|
133
134
|
$CFLAGS << " -Wall -Wextra -funroll-loops"
|
|
134
135
|
$CXXFLAGS << " -Wall -Wextra -funroll-loops"
|
|
135
|
-
$CPPFLAGS << " -Wno-register"
|
|
136
136
|
|
|
137
137
|
# Pass -x c++ to force gcc to compile the test program
|
|
138
138
|
# as C++ (as it will end in .c by default).
|
|
@@ -140,7 +140,6 @@ module RE2
|
|
|
140
140
|
|
|
141
141
|
have_library("stdc++")
|
|
142
142
|
have_header("stdint.h")
|
|
143
|
-
have_func("rb_gc_mark_movable") # introduced in Ruby 2.7
|
|
144
143
|
|
|
145
144
|
minimal_program = <<~SRC
|
|
146
145
|
#include <re2/re2.h>
|
|
@@ -152,13 +151,9 @@ module RE2
|
|
|
152
151
|
end
|
|
153
152
|
|
|
154
153
|
if re2_requires_version_flag
|
|
155
|
-
# Recent versions of
|
|
156
|
-
# compiler with C++
|
|
157
|
-
|
|
158
|
-
# https://github.com/abseil/abseil-cpp/issues/1431). However, the
|
|
159
|
-
# `std=c++14` flag doesn't appear to suffice; we need at least
|
|
160
|
-
# `std=c++17`.
|
|
161
|
-
abort "Cannot compile re2 with your compiler: recent versions require C++14 support." unless %w[c++20 c++17 c++11 c++0x].any? do |std|
|
|
154
|
+
# Recent versions of RE2 depend directly on Abseil, which requires a
|
|
155
|
+
# compiler with C++17 support.
|
|
156
|
+
abort "Cannot compile re2 with your compiler: recent versions require C++17 support." unless %w[c++20 c++17 c++11 c++0x].any? do |std|
|
|
162
157
|
checking_for("re2 that compiles with #{std} standard") do
|
|
163
158
|
if try_compile(minimal_program, compile_options + " -std=#{std}")
|
|
164
159
|
compile_options << " -std=#{std}"
|
data/ext/re2/re2.cc
CHANGED
|
@@ -125,27 +125,16 @@ static void parse_re2_options(RE2::Options* re2_options, const VALUE options) {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
/* For compatibility with Ruby < 2.7 */
|
|
129
|
-
#ifdef HAVE_RB_GC_MARK_MOVABLE
|
|
130
|
-
#define re2_compact_callback(x) (x),
|
|
131
|
-
#else
|
|
132
|
-
#define rb_gc_mark_movable(x) rb_gc_mark(x)
|
|
133
|
-
#define re2_compact_callback(x)
|
|
134
|
-
#endif
|
|
135
|
-
|
|
136
128
|
static void re2_matchdata_mark(void *ptr) {
|
|
137
129
|
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
|
138
130
|
rb_gc_mark_movable(m->regexp);
|
|
139
|
-
|
|
131
|
+
rb_gc_mark(m->text);
|
|
140
132
|
}
|
|
141
133
|
|
|
142
|
-
#ifdef HAVE_RB_GC_MARK_MOVABLE
|
|
143
134
|
static void re2_matchdata_compact(void *ptr) {
|
|
144
135
|
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
|
145
136
|
m->regexp = rb_gc_location(m->regexp);
|
|
146
|
-
m->text = rb_gc_location(m->text);
|
|
147
137
|
}
|
|
148
|
-
#endif
|
|
149
138
|
|
|
150
139
|
static void re2_matchdata_free(void *ptr) {
|
|
151
140
|
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
|
@@ -171,7 +160,7 @@ static const rb_data_type_t re2_matchdata_data_type = {
|
|
|
171
160
|
re2_matchdata_mark,
|
|
172
161
|
re2_matchdata_free,
|
|
173
162
|
re2_matchdata_memsize,
|
|
174
|
-
|
|
163
|
+
re2_matchdata_compact
|
|
175
164
|
},
|
|
176
165
|
0,
|
|
177
166
|
0,
|
|
@@ -183,16 +172,13 @@ static const rb_data_type_t re2_matchdata_data_type = {
|
|
|
183
172
|
static void re2_scanner_mark(void *ptr) {
|
|
184
173
|
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
|
185
174
|
rb_gc_mark_movable(s->regexp);
|
|
186
|
-
|
|
175
|
+
rb_gc_mark(s->text);
|
|
187
176
|
}
|
|
188
177
|
|
|
189
|
-
#ifdef HAVE_RB_GC_MARK_MOVABLE
|
|
190
178
|
static void re2_scanner_compact(void *ptr) {
|
|
191
179
|
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
|
192
180
|
s->regexp = rb_gc_location(s->regexp);
|
|
193
|
-
s->text = rb_gc_location(s->text);
|
|
194
181
|
}
|
|
195
|
-
#endif
|
|
196
182
|
|
|
197
183
|
static void re2_scanner_free(void *ptr) {
|
|
198
184
|
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
|
@@ -218,7 +204,7 @@ static const rb_data_type_t re2_scanner_data_type = {
|
|
|
218
204
|
re2_scanner_mark,
|
|
219
205
|
re2_scanner_free,
|
|
220
206
|
re2_scanner_memsize,
|
|
221
|
-
|
|
207
|
+
re2_scanner_compact
|
|
222
208
|
},
|
|
223
209
|
0,
|
|
224
210
|
0,
|
|
@@ -290,10 +276,12 @@ static VALUE re2_matchdata_string(const VALUE self) {
|
|
|
290
276
|
}
|
|
291
277
|
|
|
292
278
|
/*
|
|
293
|
-
* Returns the text supplied when incrementally matching with
|
|
279
|
+
* Returns a frozen copy of the text supplied when incrementally matching with
|
|
294
280
|
* {RE2::Regexp#scan}.
|
|
295
281
|
*
|
|
296
|
-
*
|
|
282
|
+
* If the text was already a frozen string, returns the original.
|
|
283
|
+
*
|
|
284
|
+
* @return [String] a frozen string with the text passed to {RE2::Regexp#scan}
|
|
297
285
|
* @example
|
|
298
286
|
* c = RE2::Regexp.new('(\d+)').scan("foo")
|
|
299
287
|
* c.string #=> "foo"
|
|
@@ -1626,10 +1614,13 @@ static VALUE re2_regexp_scan(const VALUE self, VALUE text) {
|
|
|
1626
1614
|
VALUE scanner = rb_class_new_instance(0, 0, re2_cScanner);
|
|
1627
1615
|
TypedData_Get_Struct(scanner, re2_scanner, &re2_scanner_data_type, c);
|
|
1628
1616
|
|
|
1629
|
-
c->input = new(std::nothrow) re2::StringPiece(
|
|
1630
|
-
RSTRING_PTR(text), RSTRING_LEN(text));
|
|
1631
1617
|
RB_OBJ_WRITE(scanner, &c->regexp, self);
|
|
1618
|
+
if (!RTEST(rb_obj_frozen_p(text))) {
|
|
1619
|
+
text = rb_str_freeze(rb_str_dup(text));
|
|
1620
|
+
}
|
|
1632
1621
|
RB_OBJ_WRITE(scanner, &c->text, text);
|
|
1622
|
+
c->input = new(std::nothrow) re2::StringPiece(
|
|
1623
|
+
RSTRING_PTR(text), RSTRING_LEN(text));
|
|
1633
1624
|
|
|
1634
1625
|
if (p->pattern->ok()) {
|
|
1635
1626
|
c->number_of_capturing_groups = p->pattern->NumberOfCapturingGroups();
|
data/ext/re2/recipes.rb
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# Released under the BSD Licence, please see LICENSE.txt
|
|
10
10
|
|
|
11
11
|
PACKAGE_ROOT_DIR = File.expand_path('../..', __dir__)
|
|
12
|
-
REQUIRED_MINI_PORTILE_VERSION = '~> 2.8.
|
|
12
|
+
REQUIRED_MINI_PORTILE_VERSION = '~> 2.8.9' # keep this version in sync with the one in the gemspec
|
|
13
13
|
|
|
14
14
|
def load_recipes
|
|
15
15
|
require 'yaml'
|
|
@@ -40,8 +40,8 @@ def build_recipe(name, version)
|
|
|
40
40
|
MiniPortileCMake.new(name, version).tap do |recipe|
|
|
41
41
|
recipe.target = File.join(PACKAGE_ROOT_DIR, 'ports')
|
|
42
42
|
recipe.configure_options += [
|
|
43
|
-
# abseil needs a C++
|
|
44
|
-
'-DCMAKE_CXX_STANDARD=
|
|
43
|
+
# abseil needs a C++17 compiler
|
|
44
|
+
'-DCMAKE_CXX_STANDARD=17',
|
|
45
45
|
# needed for building the C extension shared library with -fPIC
|
|
46
46
|
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
|
|
47
47
|
# ensures pkg-config and installed libraries will be in lib, not lib64
|
data/lib/3.1/re2.bundle
CHANGED
|
Binary file
|
data/lib/3.2/re2.bundle
CHANGED
|
Binary file
|
data/lib/3.3/re2.bundle
CHANGED
|
Binary file
|
data/lib/3.4/re2.bundle
CHANGED
|
Binary file
|
data/lib/re2/version.rb
CHANGED
data/re2.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
s.homepage = "https://github.com/mudge/re2"
|
|
12
12
|
s.extensions = ["ext/re2/extconf.rb"]
|
|
13
13
|
s.license = "BSD-3-Clause"
|
|
14
|
-
s.required_ruby_version = ">=
|
|
14
|
+
s.required_ruby_version = ">= 3.1.0"
|
|
15
15
|
s.files = [
|
|
16
16
|
"dependencies.yml",
|
|
17
17
|
"ext/re2/extconf.rb",
|
|
@@ -40,8 +40,8 @@ Gem::Specification.new do |s|
|
|
|
40
40
|
"spec/re2/set_spec.rb",
|
|
41
41
|
"spec/re2/scanner_spec.rb"
|
|
42
42
|
]
|
|
43
|
-
s.add_development_dependency("rake-compiler", "~> 1.
|
|
43
|
+
s.add_development_dependency("rake-compiler", "~> 1.3.0")
|
|
44
44
|
s.add_development_dependency("rake-compiler-dock", "~> 1.9.1")
|
|
45
45
|
s.add_development_dependency("rspec", "~> 3.2")
|
|
46
|
-
s.add_runtime_dependency("mini_portile2", "~> 2.8.
|
|
46
|
+
s.add_runtime_dependency("mini_portile2", "~> 2.8.9") # keep version in sync with extconf.rb
|
|
47
47
|
end
|
data/spec/re2/match_data_spec.rb
CHANGED
|
@@ -133,6 +133,13 @@ RSpec.describe RE2::MatchData do
|
|
|
133
133
|
expect(md["name"].encoding.name).to eq("ISO-8859-1")
|
|
134
134
|
expect(md[:name].encoding.name).to eq("ISO-8859-1")
|
|
135
135
|
end
|
|
136
|
+
|
|
137
|
+
it "supports GC compaction" do
|
|
138
|
+
md = RE2::Regexp.new('(wo{2})').match('woohoo' * 5)
|
|
139
|
+
GC.compact
|
|
140
|
+
|
|
141
|
+
expect(md[1]).to eq("woo")
|
|
142
|
+
end
|
|
136
143
|
end
|
|
137
144
|
|
|
138
145
|
describe "#string" do
|
|
@@ -287,6 +294,13 @@ RSpec.describe RE2::MatchData do
|
|
|
287
294
|
|
|
288
295
|
expect { md.begin(nil) }.to raise_error(TypeError)
|
|
289
296
|
end
|
|
297
|
+
|
|
298
|
+
it "supports GC compaction" do
|
|
299
|
+
md = RE2::Regexp.new('(wo{2})').match('woohoo' * 5)
|
|
300
|
+
GC.compact
|
|
301
|
+
|
|
302
|
+
expect(md.string[md.begin(0)..-1]).to eq('woohoo' * 5)
|
|
303
|
+
end
|
|
290
304
|
end
|
|
291
305
|
|
|
292
306
|
describe "#end" do
|
|
@@ -349,6 +363,13 @@ RSpec.describe RE2::MatchData do
|
|
|
349
363
|
|
|
350
364
|
expect { md.end(nil) }.to raise_error(TypeError)
|
|
351
365
|
end
|
|
366
|
+
|
|
367
|
+
it "supports GC compaction" do
|
|
368
|
+
md = RE2::Regexp.new('(wo{2})').match('woohoo' * 5)
|
|
369
|
+
GC.compact
|
|
370
|
+
|
|
371
|
+
expect(md.string[0...md.end(0)]).to eq('woo')
|
|
372
|
+
end
|
|
352
373
|
end
|
|
353
374
|
|
|
354
375
|
describe "#deconstruct" do
|
data/spec/re2/scanner_spec.rb
CHANGED
|
@@ -11,7 +11,39 @@ RSpec.describe RE2::Scanner do
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
describe "#string" do
|
|
14
|
-
it "returns the
|
|
14
|
+
it "returns the text for the scanner" do
|
|
15
|
+
re = RE2::Regexp.new('(\w+)')
|
|
16
|
+
text = "It is a truth"
|
|
17
|
+
scanner = re.scan(text)
|
|
18
|
+
|
|
19
|
+
expect(scanner.string).to eq("It is a truth")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "returns a frozen string" do
|
|
23
|
+
re = RE2::Regexp.new('(\w+)')
|
|
24
|
+
text = "It is a truth"
|
|
25
|
+
scanner = re.scan(text)
|
|
26
|
+
|
|
27
|
+
expect(scanner.string).to be_frozen
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "freezes unfrozen strings" do
|
|
31
|
+
re = RE2::Regexp.new('(\w+)')
|
|
32
|
+
text = +"It is a truth"
|
|
33
|
+
scanner = re.scan(text)
|
|
34
|
+
|
|
35
|
+
expect(scanner.string).to be_frozen
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "copies unfrozen strings" do
|
|
39
|
+
re = RE2::Regexp.new('(\w+)')
|
|
40
|
+
text = +"It is a truth"
|
|
41
|
+
scanner = re.scan(text)
|
|
42
|
+
|
|
43
|
+
expect(scanner.string).to_not equal(text)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "does not copy the string if it was already frozen" do
|
|
15
47
|
re = RE2::Regexp.new('(\w+)')
|
|
16
48
|
text = "It is a truth"
|
|
17
49
|
scanner = re.scan(text)
|
|
@@ -162,6 +194,23 @@ RSpec.describe RE2::Scanner do
|
|
|
162
194
|
expect(scanner.scan).to eq(["world"])
|
|
163
195
|
expect(scanner.scan).to be_nil
|
|
164
196
|
end
|
|
197
|
+
|
|
198
|
+
it "supports GC compaction" do
|
|
199
|
+
r = RE2::Regexp.new('(\w+)')
|
|
200
|
+
scanner = r.scan("Hello world" * 2)
|
|
201
|
+
GC.compact
|
|
202
|
+
|
|
203
|
+
expect(scanner.scan).to eq(["Hello"])
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
it "works even if the original input is mutated" do
|
|
207
|
+
r = RE2::Regexp.new('(\w+)')
|
|
208
|
+
text = +"It is a truth universally acknowledged"
|
|
209
|
+
scanner = r.scan(text)
|
|
210
|
+
text.upcase!
|
|
211
|
+
|
|
212
|
+
expect(scanner.scan).to eq(["It"])
|
|
213
|
+
end
|
|
165
214
|
end
|
|
166
215
|
|
|
167
216
|
it "is enumerable" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: re2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.21.0
|
|
5
5
|
platform: arm64-darwin
|
|
6
6
|
authors:
|
|
7
7
|
- Paul Mucur
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-
|
|
12
|
+
date: 2025-11-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rake-compiler
|
|
@@ -17,14 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - "~>"
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: 1.
|
|
20
|
+
version: 1.3.0
|
|
21
21
|
type: :development
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: 1.
|
|
27
|
+
version: 1.3.0
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: rake-compiler-dock
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -70,9 +70,6 @@ files:
|
|
|
70
70
|
- ext/re2/extconf.rb
|
|
71
71
|
- ext/re2/re2.cc
|
|
72
72
|
- ext/re2/recipes.rb
|
|
73
|
-
- lib/2.6/re2.bundle
|
|
74
|
-
- lib/2.7/re2.bundle
|
|
75
|
-
- lib/3.0/re2.bundle
|
|
76
73
|
- lib/3.1/re2.bundle
|
|
77
74
|
- lib/3.2/re2.bundle
|
|
78
75
|
- lib/3.3/re2.bundle
|
|
@@ -103,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
103
100
|
requirements:
|
|
104
101
|
- - ">="
|
|
105
102
|
- !ruby/object:Gem::Version
|
|
106
|
-
version: '
|
|
103
|
+
version: '3.1'
|
|
107
104
|
- - "<"
|
|
108
105
|
- !ruby/object:Gem::Version
|
|
109
106
|
version: 3.5.dev
|
data/lib/2.6/re2.bundle
DELETED
|
Binary file
|
data/lib/2.7/re2.bundle
DELETED
|
Binary file
|
data/lib/3.0/re2.bundle
DELETED
|
Binary file
|