re2 1.1.1 → 1.2.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 (4) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +6 -4
  3. data/ext/re2/re2.cc +15 -15
  4. metadata +4 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7ea4e358300d9edcb5f29af82092725e89c47bea
4
- data.tar.gz: 9fcb5fb53e8eb0b1f1e6c57d58df9accb3d49af5
2
+ SHA256:
3
+ metadata.gz: 63b9158e45d56ed6977fe6eb9b897039291faeaeeb310dd980a2e88e5e05778d
4
+ data.tar.gz: ddb04bf5ee1b4e2f4335d816a967c2cc46ae1c39c96d97c6e25c80e4579f8ea4
5
5
  SHA512:
6
- metadata.gz: d8bd5df6de150998c4fc6d8c3d61bc60a6c08170d54defdf3d3b10e70667400948b2c3b0b2c593c3a5fcff6f8e9a1e1da5a6965554eed446ad9ab02bb7065d96
7
- data.tar.gz: bfb6559f5e96a4643001b018ee43c777b12e8a3577cfead518dfc08e496819a31150af9810beb49d75584f320e4bd2c9effefe0ddc3149d255fca56eda94121e
6
+ metadata.gz: 9537a2f75f3e36fd71967ca23a4b2e5bf54847407a6a55b87474403ca2bf3ca5adb93695d445e10d34ba37339eee0d4bbf94914835b6a05b5463a42ae255fde7
7
+ data.tar.gz: 3c3bf9b84398ea8803377fb3224cedb36a185038c74fecb60165a731766a3bffc15893012fe812ebb719c5133d7217f1ec7cbed364dd6281be281b72db3466be
data/README.md CHANGED
@@ -4,7 +4,7 @@ re2 [![Build Status](https://travis-ci.org/mudge/re2.svg?branch=master)](http://
4
4
  A Ruby binding to [re2][], an "efficient, principled regular expression
5
5
  library".
6
6
 
7
- **Current version:** 1.1.1
7
+ **Current version:** 1.2.0
8
8
  **Supported Ruby versions:** 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.0, 2.2, 2.3, Rubinius 3.8
9
9
 
10
10
  Installation
@@ -166,14 +166,16 @@ Contributions
166
166
  -------------
167
167
 
168
168
  * Thanks to [Jason Woods](https://github.com/driskell) who contributed the
169
- original implementations of `RE2::MatchData#begin` and `RE2::MatchData#end`;
169
+ original implementations of `RE2::MatchData#begin` and `RE2::MatchData#end`;
170
170
  * Thanks to [Stefano Rivera](https://github.com/stefanor) who first contributed C++11 support;
171
- * Thanks to [Stan Hu](https://github.com/stanhu) for reporting a bug with empty patterns and `RE2::Regexp#scan`.
171
+ * Thanks to [Stan Hu](https://github.com/stanhu) for reporting a bug with empty patterns and `RE2::Regexp#scan`;
172
+ * Thanks to [Sebastian Reitenbach](https://github.com/buzzdeee) for reporting
173
+ the deprecation and removal of the `utf8` encoding option in re2.
172
174
 
173
175
  Contact
174
176
  -------
175
177
 
176
- All feedback should go to the mailing list: <mailto:ruby.re2@librelist.com>
178
+ All issues and suggestions should go to [GitHub Issues](https://github.com/mudge/re2/issues).
177
179
 
178
180
  [re2]: https://github.com/google/re2
179
181
  [gcc]: http://gcc.gnu.org/
@@ -258,7 +258,7 @@ static VALUE re2_scanner_scan(VALUE self) {
258
258
  } else {
259
259
  rb_ary_push(result, ENCODED_STR_NEW(matches[i].data(),
260
260
  matches[i].size(),
261
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1"));
261
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"));
262
262
  }
263
263
  }
264
264
 
@@ -361,7 +361,7 @@ static VALUE re2_matchdata_begin(VALUE self, VALUE n) {
361
361
  offset = reinterpret_cast<uintptr_t>(match->data()) - reinterpret_cast<uintptr_t>(StringValuePtr(m->text));
362
362
 
363
363
  return ENCODED_STR_SUBLEN(StringValue(m->text), offset,
364
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
364
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
365
365
  }
366
366
  }
367
367
 
@@ -392,7 +392,7 @@ static VALUE re2_matchdata_end(VALUE self, VALUE n) {
392
392
  offset = reinterpret_cast<uintptr_t>(match->data()) - reinterpret_cast<uintptr_t>(StringValuePtr(m->text)) + match->size();
393
393
 
394
394
  return ENCODED_STR_SUBLEN(StringValue(m->text), offset,
395
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
395
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
396
396
  }
397
397
  }
398
398
 
@@ -456,7 +456,7 @@ static VALUE re2_matchdata_to_a(VALUE self) {
456
456
  rb_ary_push(array, Qnil);
457
457
  } else {
458
458
  rb_ary_push(array, ENCODED_STR_NEW(match->data(), match->size(),
459
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1"));
459
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"));
460
460
  }
461
461
  }
462
462
 
@@ -480,7 +480,7 @@ static VALUE re2_matchdata_nth_match(int nth, VALUE self) {
480
480
  return Qnil;
481
481
  } else {
482
482
  return ENCODED_STR_NEW(match->data(), match->size(),
483
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
483
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
484
484
  }
485
485
  }
486
486
  }
@@ -611,7 +611,7 @@ static VALUE re2_matchdata_inspect(VALUE self) {
611
611
  output << ">";
612
612
 
613
613
  result = ENCODED_STR_NEW(output.str().data(), output.str().length(),
614
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
614
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
615
615
 
616
616
  return result;
617
617
  }
@@ -684,7 +684,7 @@ static VALUE re2_regexp_initialize(int argc, VALUE *argv, VALUE self) {
684
684
 
685
685
  utf8 = rb_hash_aref(options, ID2SYM(id_utf8));
686
686
  if (!NIL_P(utf8)) {
687
- re2_options.set_utf8(RTEST(utf8));
687
+ re2_options.set_encoding(RTEST(utf8) ? RE2::Options::EncodingUTF8 : RE2::Options::EncodingLatin1);
688
688
  }
689
689
 
690
690
  posix_syntax = rb_hash_aref(options, ID2SYM(id_posix_syntax));
@@ -767,7 +767,7 @@ static VALUE re2_regexp_inspect(VALUE self) {
767
767
  output << "#<RE2::Regexp /" << p->pattern->pattern() << "/>";
768
768
 
769
769
  result = ENCODED_STR_NEW(output.str().data(), output.str().length(),
770
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
770
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
771
771
 
772
772
  return result;
773
773
  }
@@ -785,7 +785,7 @@ static VALUE re2_regexp_to_s(VALUE self) {
785
785
  Data_Get_Struct(self, re2_pattern, p);
786
786
  return ENCODED_STR_NEW(p->pattern->pattern().data(),
787
787
  p->pattern->pattern().size(),
788
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
788
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
789
789
  }
790
790
 
791
791
  /*
@@ -815,7 +815,7 @@ static VALUE re2_regexp_ok(VALUE self) {
815
815
  static VALUE re2_regexp_utf8(VALUE self) {
816
816
  re2_pattern *p;
817
817
  Data_Get_Struct(self, re2_pattern, p);
818
- return BOOL2RUBY(p->pattern->options().utf8());
818
+ return BOOL2RUBY(p->pattern->options().encoding() == RE2::Options::EncodingUTF8);
819
819
  }
820
820
 
821
821
  /*
@@ -1012,7 +1012,7 @@ static VALUE re2_regexp_error_arg(VALUE self) {
1012
1012
  } else {
1013
1013
  return ENCODED_STR_NEW(p->pattern->error_arg().data(),
1014
1014
  p->pattern->error_arg().size(),
1015
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
1015
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
1016
1016
  }
1017
1017
  }
1018
1018
 
@@ -1043,7 +1043,7 @@ static VALUE re2_regexp_options(VALUE self) {
1043
1043
  options = rb_hash_new();
1044
1044
 
1045
1045
  rb_hash_aset(options, ID2SYM(id_utf8),
1046
- BOOL2RUBY(p->pattern->options().utf8()));
1046
+ BOOL2RUBY(p->pattern->options().encoding() == RE2::Options::EncodingUTF8));
1047
1047
 
1048
1048
  rb_hash_aset(options, ID2SYM(id_posix_syntax),
1049
1049
  BOOL2RUBY(p->pattern->options().posix_syntax()));
@@ -1113,7 +1113,7 @@ static VALUE re2_regexp_named_capturing_groups(VALUE self) {
1113
1113
  for (iterator = groups.begin(); iterator != groups.end(); iterator++) {
1114
1114
  rb_hash_aset(capturing_groups,
1115
1115
  ENCODED_STR_NEW(iterator->first.data(), iterator->first.size(),
1116
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1"),
1116
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"),
1117
1117
  INT2FIX(iterator->second));
1118
1118
  }
1119
1119
 
@@ -1284,7 +1284,7 @@ static VALUE re2_Replace(VALUE self, VALUE str, VALUE pattern,
1284
1284
  RE2::Replace(&str_as_string, *p->pattern, StringValuePtr(rewrite));
1285
1285
 
1286
1286
  return ENCODED_STR_NEW(str_as_string.data(), str_as_string.size(),
1287
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
1287
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
1288
1288
  } else {
1289
1289
  RE2::Replace(&str_as_string, StringValuePtr(pattern),
1290
1290
  StringValuePtr(rewrite));
@@ -1321,7 +1321,7 @@ static VALUE re2_GlobalReplace(VALUE self, VALUE str, VALUE pattern,
1321
1321
  RE2::GlobalReplace(&str_as_string, *p->pattern, StringValuePtr(rewrite));
1322
1322
 
1323
1323
  return ENCODED_STR_NEW(str_as_string.data(), str_as_string.size(),
1324
- p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1");
1324
+ p->pattern->options().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1");
1325
1325
  } else {
1326
1326
  RE2::GlobalReplace(&str_as_string, StringValuePtr(pattern),
1327
1327
  StringValuePtr(rewrite));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: re2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Mucur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-24 00:00:00.000000000 Z
11
+ date: 2020-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.2'
41
41
  description: Ruby bindings to re2, "an efficient, principled regular expression library".
42
- email: ruby.re2@librelist.com
42
+ email:
43
43
  executables: []
44
44
  extensions:
45
45
  - ext/re2/extconf.rb
@@ -79,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubyforge_project:
83
- rubygems_version: 2.6.11
82
+ rubygems_version: 3.1.2
84
83
  signing_key:
85
84
  specification_version: 4
86
85
  summary: Ruby bindings to re2.