re2 2.18.0 → 2.19.1
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 +10 -10
- data/Rakefile +5 -1
- data/dependencies.yml +2 -2
- data/ext/re2/re2.cc +9 -12
- data/lib/re2/version.rb +1 -1
- data/ports/archives/re2-2025-08-05.tar.gz +0 -0
- data/spec/re2/scanner_spec.rb +42 -1
- metadata +2 -2
- data/ports/archives/re2-2025-07-22.tar.gz +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 687a91fb04d7c8f6d5082fd85a53b8cc08d57207dc2dd73a9d2de7ddc5700094
|
|
4
|
+
data.tar.gz: 0f2be0a7f418f1dc21bec364b8464b1e7afbd849ef51dd6fcbbdf9795afad302
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c084f2d6e64dece6fa322d22217bc40cfc82ce9f25360c0e69accf1c22e633a072d8d162698d98f1cc8e5caa6f23bed5843dfbe3f1e0d88f3fe5b92df68edaf3
|
|
7
|
+
data.tar.gz: ab17cd9b2443fb6717d8f6995254cf1547af83914ef9e0ce7c34e5babb8639f04157d6c6239da45b59e5b30a1b014b136dc4945a6ce5a4fe02112e691c159e51
|
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.19.1
|
|
10
|
+
**Bundled RE2 version:** libre2.11 (2025-08-05)
|
|
11
11
|
|
|
12
12
|
```ruby
|
|
13
13
|
RE2('h.*o').full_match?("hello") #=> true
|
|
@@ -264,7 +264,7 @@ This gem requires the following to run:
|
|
|
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-08-05)
|
|
268
268
|
|
|
269
269
|
### Native gems
|
|
270
270
|
|
|
@@ -281,18 +281,18 @@ Where possible, a pre-compiled native gem will be provided for the following pla
|
|
|
281
281
|
SHA256 checksums are included in the [release notes](https://github.com/mudge/re2/releases) for each version and can be checked with `sha256sum`, e.g.
|
|
282
282
|
|
|
283
283
|
```console
|
|
284
|
-
$ gem fetch re2 -v 2.
|
|
285
|
-
Fetching re2-2.
|
|
286
|
-
Downloaded re2-2.
|
|
287
|
-
$ sha256sum re2-2.
|
|
288
|
-
|
|
284
|
+
$ gem fetch re2 -v 2.18.0
|
|
285
|
+
Fetching re2-2.18.0-arm64-darwin.gem
|
|
286
|
+
Downloaded re2-2.18.0-arm64-darwin
|
|
287
|
+
$ sha256sum re2-2.18.0-arm64-darwin.gem
|
|
288
|
+
953063f0491420163d3484ed256fe2ff616c777ec66ee20aa5ec1a1a1fc39ff5 re2-2.18.0-arm64-darwin.gem
|
|
289
289
|
```
|
|
290
290
|
|
|
291
291
|
[GPG](https://www.gnupg.org/) signatures are attached to each release (the assets ending in `.sig`) and can be verified if you import [our signing key `0x39AC3530070E0F75`](https://mudge.name/39AC3530070E0F75.asc) (or fetch it from a public keyserver, e.g. `gpg --keyserver keyserver.ubuntu.com --recv-key 0x39AC3530070E0F75`):
|
|
292
292
|
|
|
293
293
|
```console
|
|
294
|
-
$ gpg --verify re2-2.
|
|
295
|
-
gpg: Signature made
|
|
294
|
+
$ gpg --verify re2-2.18.0-arm64-darwin.gem.sig re2-2.18.0-arm64-darwin.gem
|
|
295
|
+
gpg: Signature made Sun 3 Aug 11:02:26 2025 BST
|
|
296
296
|
gpg: using RSA key 702609D9C790F45B577D7BEC39AC3530070E0F75
|
|
297
297
|
gpg: Good signature from "Paul Mucur <mudge@mudge.name>" [unknown]
|
|
298
298
|
gpg: aka "Paul Mucur <paul@ghostcassette.com>" [unknown]
|
data/Rakefile
CHANGED
|
@@ -70,9 +70,13 @@ namespace :gem do
|
|
|
70
70
|
desc "Compile and build native gem for #{platform} platform"
|
|
71
71
|
task platform do
|
|
72
72
|
RakeCompilerDock.sh <<~SCRIPT, platform: platform, verbose: true
|
|
73
|
+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null &&
|
|
74
|
+
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null &&
|
|
75
|
+
sudo apt-get update &&
|
|
76
|
+
sudo apt-get install -y cmake=3.22.2-0kitware1ubuntu20.04.1 cmake-data=3.22.2-0kitware1ubuntu20.04.1 &&
|
|
73
77
|
rbenv shell 3.1.6 &&
|
|
74
78
|
gem install bundler --no-document &&
|
|
75
|
-
bundle &&
|
|
79
|
+
bundle install &&
|
|
76
80
|
bundle exec rake native:#{platform} pkg/#{re2_gemspec.full_name}-#{Gem::Platform.new(platform)}.gem PATH="/usr/local/bin:$PATH"
|
|
77
81
|
SCRIPT
|
|
78
82
|
end
|
data/dependencies.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
libre2:
|
|
3
|
-
version: '2025-
|
|
4
|
-
sha256:
|
|
3
|
+
version: '2025-08-05'
|
|
4
|
+
sha256: b5708d8388110624c85f300e7e9b39c4ed5469891eb1127dd7f9d61272d04907
|
|
5
5
|
abseil:
|
|
6
6
|
version: '20250127.1'
|
|
7
7
|
sha256: b396401fd29e2e679cace77867481d388c807671dc2acc602a0259eeb79b7811
|
data/ext/re2/re2.cc
CHANGED
|
@@ -136,14 +136,13 @@ static void parse_re2_options(RE2::Options* re2_options, const VALUE options) {
|
|
|
136
136
|
static void re2_matchdata_mark(void *ptr) {
|
|
137
137
|
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
|
138
138
|
rb_gc_mark_movable(m->regexp);
|
|
139
|
-
|
|
139
|
+
rb_gc_mark(m->text);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
#ifdef HAVE_RB_GC_MARK_MOVABLE
|
|
143
143
|
static void re2_matchdata_compact(void *ptr) {
|
|
144
144
|
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
|
145
145
|
m->regexp = rb_gc_location(m->regexp);
|
|
146
|
-
m->text = rb_gc_location(m->text);
|
|
147
146
|
}
|
|
148
147
|
#endif
|
|
149
148
|
|
|
@@ -183,14 +182,13 @@ static const rb_data_type_t re2_matchdata_data_type = {
|
|
|
183
182
|
static void re2_scanner_mark(void *ptr) {
|
|
184
183
|
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
|
185
184
|
rb_gc_mark_movable(s->regexp);
|
|
186
|
-
|
|
185
|
+
rb_gc_mark(s->text);
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
#ifdef HAVE_RB_GC_MARK_MOVABLE
|
|
190
189
|
static void re2_scanner_compact(void *ptr) {
|
|
191
190
|
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
|
192
191
|
s->regexp = rb_gc_location(s->regexp);
|
|
193
|
-
s->text = rb_gc_location(s->text);
|
|
194
192
|
}
|
|
195
193
|
#endif
|
|
196
194
|
|
|
@@ -290,9 +288,11 @@ static VALUE re2_matchdata_string(const VALUE self) {
|
|
|
290
288
|
}
|
|
291
289
|
|
|
292
290
|
/*
|
|
293
|
-
* Returns the text supplied when incrementally matching with
|
|
291
|
+
* Returns a frozen copy of the text supplied when incrementally matching with
|
|
294
292
|
* {RE2::Regexp#scan}.
|
|
295
293
|
*
|
|
294
|
+
* If the text was already a frozen string, returns the original.
|
|
295
|
+
*
|
|
296
296
|
* @return [String] the original string passed to {RE2::Regexp#scan}
|
|
297
297
|
* @example
|
|
298
298
|
* c = RE2::Regexp.new('(\d+)').scan("foo")
|
|
@@ -1534,10 +1534,7 @@ static VALUE re2_regexp_match(int argc, VALUE *argv, const VALUE self) {
|
|
|
1534
1534
|
TypedData_Get_Struct(matchdata, re2_matchdata, &re2_matchdata_data_type, m);
|
|
1535
1535
|
m->matches = new(std::nothrow) re2::StringPiece[n];
|
|
1536
1536
|
RB_OBJ_WRITE(matchdata, &m->regexp, self);
|
|
1537
|
-
|
|
1538
|
-
text = rb_str_freeze(rb_str_dup(text));
|
|
1539
|
-
}
|
|
1540
|
-
RB_OBJ_WRITE(matchdata, &m->text, text);
|
|
1537
|
+
RB_OBJ_WRITE(matchdata, &m->text, rb_str_new_frozen(text));
|
|
1541
1538
|
|
|
1542
1539
|
if (m->matches == 0) {
|
|
1543
1540
|
rb_raise(rb_eNoMemError,
|
|
@@ -1626,10 +1623,10 @@ static VALUE re2_regexp_scan(const VALUE self, VALUE text) {
|
|
|
1626
1623
|
VALUE scanner = rb_class_new_instance(0, 0, re2_cScanner);
|
|
1627
1624
|
TypedData_Get_Struct(scanner, re2_scanner, &re2_scanner_data_type, c);
|
|
1628
1625
|
|
|
1629
|
-
c->input = new(std::nothrow) re2::StringPiece(
|
|
1630
|
-
RSTRING_PTR(text), RSTRING_LEN(text));
|
|
1631
1626
|
RB_OBJ_WRITE(scanner, &c->regexp, self);
|
|
1632
|
-
RB_OBJ_WRITE(scanner, &c->text, text);
|
|
1627
|
+
RB_OBJ_WRITE(scanner, &c->text, rb_str_new_frozen(text));
|
|
1628
|
+
c->input = new(std::nothrow) re2::StringPiece(
|
|
1629
|
+
RSTRING_PTR(c->text), RSTRING_LEN(c->text));
|
|
1633
1630
|
|
|
1634
1631
|
if (p->pattern->ok()) {
|
|
1635
1632
|
c->number_of_capturing_groups = p->pattern->NumberOfCapturingGroups();
|
data/lib/re2/version.rb
CHANGED
|
Binary file
|
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,15 @@ 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 "works even if the original input is mutated" do
|
|
199
|
+
r = RE2::Regexp.new('(\w+)')
|
|
200
|
+
text = +"It is a truth universally acknowledged"
|
|
201
|
+
scanner = r.scan(text)
|
|
202
|
+
text.upcase!
|
|
203
|
+
|
|
204
|
+
expect(scanner.scan).to eq(["It"])
|
|
205
|
+
end
|
|
165
206
|
end
|
|
166
207
|
|
|
167
208
|
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.19.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paul Mucur
|
|
@@ -89,7 +89,7 @@ files:
|
|
|
89
89
|
- lib/re2/string.rb
|
|
90
90
|
- lib/re2/version.rb
|
|
91
91
|
- ports/archives/20250127.1.tar.gz
|
|
92
|
-
- ports/archives/re2-2025-
|
|
92
|
+
- ports/archives/re2-2025-08-05.tar.gz
|
|
93
93
|
- re2.gemspec
|
|
94
94
|
- spec/kernel_spec.rb
|
|
95
95
|
- spec/re2/match_data_spec.rb
|
|
Binary file
|