re2 2.20.0-arm-linux-gnu → 2.21.0-arm-linux-gnu
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 +5 -3
- data/Rakefile +1 -1
- data/dependencies.yml +2 -2
- data/ext/re2/re2.cc +11 -8
- data/lib/3.1/re2.so +0 -0
- data/lib/3.2/re2.so +0 -0
- data/lib/3.3/re2.so +0 -0
- data/lib/3.4/re2.so +0 -0
- data/lib/re2/version.rb +1 -1
- data/spec/re2/match_data_spec.rb +21 -0
- data/spec/re2/scanner_spec.rb +50 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dbdd9a1a46ac6e196b2bbf90e31684c9559f87d9ab4febad73a5f4cf34c9ed77
|
|
4
|
+
data.tar.gz: 44e9874ed9f6e4454d5707144553d1abd79be711fdfcea9727bb2480179d9924
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 283e6f9ae2614b8ac86d0dda2fcb8b3f24f52ea4a0bfd1a0abfef467a5aed358408adc8718ae35357c885b39e8e197a39129556d9e07bc69c1d9ff19b05a2ecf
|
|
7
|
+
data.tar.gz: 6b98326df023569622d7906f1a4b7e83a2a8c0038413aaad6cc9ea2f1200f6340adb927313818c600bbe84ebcae3a7d2819cc7d773e9c82a9458993c00aad437
|
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
|
|
@@ -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-11-05)
|
|
268
268
|
|
|
269
269
|
### Native gems
|
|
270
270
|
|
|
@@ -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
|
@@ -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
6
|
version: '20250814.1'
|
|
7
7
|
sha256: 1692f77d1739bacf3f94337188b78583cf09bab7e420d2dc6c5605a4f86785a1
|
data/ext/re2/re2.cc
CHANGED
|
@@ -128,13 +128,12 @@ static void parse_re2_options(RE2::Options* re2_options, const VALUE options) {
|
|
|
128
128
|
static void re2_matchdata_mark(void *ptr) {
|
|
129
129
|
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
|
130
130
|
rb_gc_mark_movable(m->regexp);
|
|
131
|
-
|
|
131
|
+
rb_gc_mark(m->text);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
static void re2_matchdata_compact(void *ptr) {
|
|
135
135
|
re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
|
|
136
136
|
m->regexp = rb_gc_location(m->regexp);
|
|
137
|
-
m->text = rb_gc_location(m->text);
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
static void re2_matchdata_free(void *ptr) {
|
|
@@ -173,13 +172,12 @@ static const rb_data_type_t re2_matchdata_data_type = {
|
|
|
173
172
|
static void re2_scanner_mark(void *ptr) {
|
|
174
173
|
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
|
175
174
|
rb_gc_mark_movable(s->regexp);
|
|
176
|
-
|
|
175
|
+
rb_gc_mark(s->text);
|
|
177
176
|
}
|
|
178
177
|
|
|
179
178
|
static void re2_scanner_compact(void *ptr) {
|
|
180
179
|
re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
|
|
181
180
|
s->regexp = rb_gc_location(s->regexp);
|
|
182
|
-
s->text = rb_gc_location(s->text);
|
|
183
181
|
}
|
|
184
182
|
|
|
185
183
|
static void re2_scanner_free(void *ptr) {
|
|
@@ -278,10 +276,12 @@ static VALUE re2_matchdata_string(const VALUE self) {
|
|
|
278
276
|
}
|
|
279
277
|
|
|
280
278
|
/*
|
|
281
|
-
* Returns the text supplied when incrementally matching with
|
|
279
|
+
* Returns a frozen copy of the text supplied when incrementally matching with
|
|
282
280
|
* {RE2::Regexp#scan}.
|
|
283
281
|
*
|
|
284
|
-
*
|
|
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}
|
|
285
285
|
* @example
|
|
286
286
|
* c = RE2::Regexp.new('(\d+)').scan("foo")
|
|
287
287
|
* c.string #=> "foo"
|
|
@@ -1614,10 +1614,13 @@ static VALUE re2_regexp_scan(const VALUE self, VALUE text) {
|
|
|
1614
1614
|
VALUE scanner = rb_class_new_instance(0, 0, re2_cScanner);
|
|
1615
1615
|
TypedData_Get_Struct(scanner, re2_scanner, &re2_scanner_data_type, c);
|
|
1616
1616
|
|
|
1617
|
-
c->input = new(std::nothrow) re2::StringPiece(
|
|
1618
|
-
RSTRING_PTR(text), RSTRING_LEN(text));
|
|
1619
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
|
+
}
|
|
1620
1621
|
RB_OBJ_WRITE(scanner, &c->text, text);
|
|
1622
|
+
c->input = new(std::nothrow) re2::StringPiece(
|
|
1623
|
+
RSTRING_PTR(text), RSTRING_LEN(text));
|
|
1621
1624
|
|
|
1622
1625
|
if (p->pattern->ok()) {
|
|
1623
1626
|
c->number_of_capturing_groups = p->pattern->NumberOfCapturingGroups();
|
data/lib/3.1/re2.so
CHANGED
|
Binary file
|
data/lib/3.2/re2.so
CHANGED
|
Binary file
|
data/lib/3.3/re2.so
CHANGED
|
Binary file
|
data/lib/3.4/re2.so
CHANGED
|
Binary file
|
data/lib/re2/version.rb
CHANGED
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: arm-linux-gnu
|
|
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
|