re2 1.6.0 → 2.0.0.beta1
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/.rspec +2 -0
- data/Gemfile +13 -0
- data/README.md +5 -5
- data/Rakefile +148 -3
- data/dependencies.yml +9 -0
- data/ext/re2/extconf.rb +320 -51
- data/ext/re2/re2.cc +18 -26
- data/ext/re2/recipes.rb +43 -0
- data/lib/re2/string.rb +3 -19
- data/lib/re2/version.rb +5 -0
- data/lib/re2.rb +8 -1
- data/ports/archives/20230125.3.tar.gz +0 -0
- data/ports/archives/re2-2023-07-01.tar.gz +0 -0
- data/re2.gemspec +43 -0
- data/spec/re2/regexp_spec.rb +2 -1
- metadata +48 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6e122dcf14c604d1cea516e7c6839bddc2144ff2a9ea96f90d4dc874e8f9056
|
4
|
+
data.tar.gz: 1a8e2b6444b9b3702c6e995a59069a681a615242fce804e824c9cd009d515745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f8f4ffca57e02a52830c67a2177d509575d435ad1006e2fd5d3b435efecb7412d5507872fde660fb602d1c5cc8416a436719fac31b8d985a263f36e53626955
|
7
|
+
data.tar.gz: 6bc970e290326fb83473e3954e74d4de47a6d23a8200be6eae3a90e6df4a6b671d33cba1be74c456288274a178fa9deebb1aa6de205866bacf4a9ee5436ba5bb
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -4,9 +4,9 @@ re2 [, libre2.1 (2020-03-02), libre2.6 (2020-03-03), libre2.7 (2020-05-01), libre2.8 (2020-07-06), libre2.9 (2020-11-01)
|
7
|
+
**Current version:** 1.7.0
|
8
|
+
**Supported Ruby versions:** 1.8.7, 1.9.3, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2
|
9
|
+
**Supported re2 versions:** libre2.0 (< 2020-03-02), libre2.1 (2020-03-02), libre2.6 (2020-03-03), libre2.7 (2020-05-01), libre2.8 (2020-07-06), libre2.9 (2020-11-01), libre2.10 (2022-12-01), libre2.11 (2023-07-01)
|
10
10
|
|
11
11
|
Installation
|
12
12
|
------------
|
@@ -22,7 +22,7 @@ If you are using Debian, you can install the [libre2-dev][] package like so:
|
|
22
22
|
|
23
23
|
$ sudo apt-get install libre2-dev
|
24
24
|
|
25
|
-
Recent versions of re2 require a compiler with C++
|
25
|
+
Recent versions of re2 require a compiler with C++14 support such as [clang](http://clang.llvm.org/) 3.4 or [gcc](https://gcc.gnu.org/) 5.
|
26
26
|
|
27
27
|
If you are using a packaged Ruby distribution, make sure you also have the
|
28
28
|
Ruby header files installed such as those provided by the [ruby-dev][] package
|
@@ -214,7 +214,7 @@ Contributions
|
|
214
214
|
* Thanks to [Jason Woods](https://github.com/driskell) who contributed the
|
215
215
|
original implementations of `RE2::MatchData#begin` and `RE2::MatchData#end`;
|
216
216
|
* Thanks to [Stefano Rivera](https://github.com/stefanor) who first contributed C++11 support;
|
217
|
-
* Thanks to [Stan Hu](https://github.com/stanhu) for reporting a bug with empty patterns and `RE2::Regexp#scan
|
217
|
+
* Thanks to [Stan Hu](https://github.com/stanhu) for reporting a bug with empty patterns and `RE2::Regexp#scan` and for contributing support for libre2.11 (2023-07-01);
|
218
218
|
* Thanks to [Sebastian Reitenbach](https://github.com/buzzdeee) for reporting
|
219
219
|
the deprecation and removal of the `utf8` encoding option in re2;
|
220
220
|
* Thanks to [Sergio Medina](https://github.com/serch) for reporting a bug when
|
data/Rakefile
CHANGED
@@ -1,10 +1,155 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake/extensiontask'
|
2
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'rake_compiler_dock'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
require_relative 'ext/re2/recipes'
|
9
|
+
|
10
|
+
CLEAN.include FileList['**/*{.o,.so,.dylib,.bundle}'],
|
11
|
+
FileList['**/extconf.h'],
|
12
|
+
FileList['**/Makefile'],
|
13
|
+
FileList['pkg/']
|
14
|
+
|
15
|
+
CLOBBER.include FileList['**/tmp'],
|
16
|
+
FileList['**/*.log'],
|
17
|
+
FileList['doc/**'],
|
18
|
+
FileList['tmp/']
|
19
|
+
CLOBBER.add("ports/*").exclude(%r{ports/archives$})
|
20
|
+
|
21
|
+
RE2_GEM_SPEC = Gem::Specification.load('re2.gemspec')
|
22
|
+
|
23
|
+
task :prepare do
|
24
|
+
puts "Preparing project for gem building..."
|
25
|
+
recipes = load_recipes
|
26
|
+
recipes.each { |recipe| recipe.download }
|
27
|
+
end
|
28
|
+
|
29
|
+
task gem: :prepare
|
3
30
|
|
4
|
-
|
31
|
+
Gem::PackageTask.new(RE2_GEM_SPEC) do |p|
|
32
|
+
p.need_zip = false
|
33
|
+
p.need_tar = false
|
34
|
+
end
|
35
|
+
|
36
|
+
CROSS_RUBY_VERSIONS = %w[3.2.0 3.1.0 3.0.0 2.7.0].join(':')
|
37
|
+
CROSS_RUBY_PLATFORMS = %w[
|
38
|
+
aarch64-linux
|
39
|
+
arm-linux
|
40
|
+
arm64-darwin
|
41
|
+
x64-mingw-ucrt
|
42
|
+
x64-mingw32
|
43
|
+
x86-linux
|
44
|
+
x86-mingw32
|
45
|
+
x86_64-darwin
|
46
|
+
x86_64-linux
|
47
|
+
].freeze
|
48
|
+
|
49
|
+
ENV['RUBY_CC_VERSION'] = CROSS_RUBY_VERSIONS
|
50
|
+
|
51
|
+
Rake::ExtensionTask.new('re2', RE2_GEM_SPEC) do |e|
|
52
|
+
e.cross_compile = true
|
53
|
+
e.cross_config_options << '--enable-cross-build'
|
54
|
+
e.config_options << '--disable-system-libraries'
|
55
|
+
e.cross_platform = CROSS_RUBY_PLATFORMS
|
56
|
+
e.cross_compiling do |spec|
|
57
|
+
spec.files.reject! { |path| File.fnmatch?('ports/*', path) }
|
58
|
+
spec.dependencies.reject! { |dep| dep.name == 'mini_portile2' }
|
59
|
+
end
|
60
|
+
end
|
5
61
|
|
6
62
|
RSpec::Core::RakeTask.new(:spec)
|
7
63
|
|
8
|
-
|
9
|
-
|
64
|
+
namespace 'gem' do
|
65
|
+
def gem_builder(platform)
|
66
|
+
# use Task#invoke because the pkg/*gem task is defined at runtime
|
67
|
+
Rake::Task["native:#{platform}"].invoke
|
68
|
+
Rake::Task["pkg/#{RE2_GEM_SPEC.full_name}-#{Gem::Platform.new(platform)}.gem"].invoke
|
69
|
+
end
|
70
|
+
|
71
|
+
CROSS_RUBY_PLATFORMS.each do |platform|
|
72
|
+
# The Linux x86 image (ghcr.io/rake-compiler/rake-compiler-dock-image:1.3.0-mri-x86_64-linux)
|
73
|
+
# is based on CentOS 7 and has two versions of cmake installed:
|
74
|
+
# a 2.8 version in /usr/bin and a 3.25 in /usr/local/bin. The latter is needed by abseil.
|
75
|
+
cmake =
|
76
|
+
case platform
|
77
|
+
when 'x86_64-linux', 'x86-linux'
|
78
|
+
'/usr/local/bin/cmake'
|
79
|
+
else
|
80
|
+
'cmake'
|
81
|
+
end
|
82
|
+
|
83
|
+
desc "build native gem for #{platform} platform"
|
84
|
+
task platform do
|
85
|
+
RakeCompilerDock.sh <<~SCRIPT, platform: platform, verbose: true
|
86
|
+
gem install bundler --no-document &&
|
87
|
+
bundle &&
|
88
|
+
bundle exec rake gem:#{platform}:builder CMAKE=#{cmake}
|
89
|
+
SCRIPT
|
90
|
+
end
|
91
|
+
|
92
|
+
namespace platform do
|
93
|
+
desc "build native gem for #{platform} platform (guest container)"
|
94
|
+
task 'builder' do
|
95
|
+
gem_builder(platform)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
desc 'build all native gems'
|
101
|
+
multitask 'native' => CROSS_RUBY_PLATFORMS
|
102
|
+
end
|
103
|
+
|
104
|
+
def add_file_to_gem(relative_source_path)
|
105
|
+
dest_path = File.join(gem_build_path, relative_source_path)
|
106
|
+
dest_dir = File.dirname(dest_path)
|
107
|
+
|
108
|
+
mkdir_p dest_dir unless Dir.exist?(dest_dir)
|
109
|
+
rm_f dest_path if File.exist?(dest_path)
|
110
|
+
safe_ln relative_source_path, dest_path
|
111
|
+
|
112
|
+
RE2_GEM_SPEC.files << relative_source_path
|
113
|
+
end
|
114
|
+
|
115
|
+
def gem_build_path
|
116
|
+
File.join 'pkg', RE2_GEM_SPEC.full_name
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_vendored_libraries
|
120
|
+
dependencies = YAML.load_file(File.join(File.dirname(__FILE__), 'dependencies.yml'))
|
121
|
+
abseil_archive = File.join('ports', 'archives', "#{dependencies['abseil']['version']}.tar.gz")
|
122
|
+
libre2_archive = File.join('ports', 'archives', "re2-#{dependencies['libre2']['version']}.tar.gz")
|
123
|
+
|
124
|
+
add_file_to_gem(abseil_archive)
|
125
|
+
add_file_to_gem(libre2_archive)
|
126
|
+
end
|
127
|
+
|
128
|
+
task gem_build_path do
|
129
|
+
add_vendored_libraries
|
130
|
+
end
|
131
|
+
|
132
|
+
desc "Temporarily set VERSION to a unique timestamp"
|
133
|
+
task "set-version-to-timestamp" do
|
134
|
+
# this task is used by bin/test-gem-build
|
135
|
+
# to test building, packaging, and installing a precompiled gem
|
136
|
+
version_constant_re = /^\s*VERSION\s*=\s*["'](.*)["']$/
|
137
|
+
|
138
|
+
version_file_path = File.join(__dir__, "lib/re2/version.rb")
|
139
|
+
version_file_contents = File.read(version_file_path)
|
140
|
+
|
141
|
+
current_version_string = version_constant_re.match(version_file_contents)[1]
|
142
|
+
current_version = Gem::Version.new(current_version_string)
|
143
|
+
|
144
|
+
fake_version = Gem::Version.new(format("%s.test.%s", current_version.bump, Time.now.strftime("%Y.%m%d.%H%M")))
|
145
|
+
|
146
|
+
unless version_file_contents.gsub!(version_constant_re, " VERSION = \"#{fake_version}\"")
|
147
|
+
raise("Could not hack the VERSION constant")
|
148
|
+
end
|
149
|
+
|
150
|
+
File.open(version_file_path, "w") { |f| f.write(version_file_contents) }
|
151
|
+
|
152
|
+
puts "NOTE: wrote version as \"#{fake_version}\""
|
153
|
+
end
|
10
154
|
|
155
|
+
task default: [:compile, :spec]
|
data/dependencies.yml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
libre2:
|
2
|
+
version: "2023-07-01"
|
3
|
+
sha256: "18cf85922e27fad3ed9c96a27733037da445f35eb1a2744c306a37c6d11e95c4"
|
4
|
+
# sha-256 hash provided in https://github.com/google/re2/releases/download/2023-07-01/re2-2023-07-01.tar.gz
|
5
|
+
|
6
|
+
abseil:
|
7
|
+
version: "20230125.3"
|
8
|
+
sha256: 5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36
|
9
|
+
# sha-256 hash provided in https://github.com/abseil/abseil-cpp/archive/refs/tags/20230125.3.tar.gz
|
data/ext/re2/extconf.rb
CHANGED
@@ -5,6 +5,107 @@
|
|
5
5
|
# Released under the BSD Licence, please see LICENSE.txt
|
6
6
|
|
7
7
|
require 'mkmf'
|
8
|
+
require_relative 'recipes'
|
9
|
+
|
10
|
+
RE2_HELP_MESSAGE = <<~HELP
|
11
|
+
USAGE: ruby #{$0} [options]
|
12
|
+
|
13
|
+
Flags that are always valid:
|
14
|
+
|
15
|
+
--enable-system-libraries
|
16
|
+
Use system libraries instead of building and using the packaged libraries.
|
17
|
+
|
18
|
+
--disable-system-libraries
|
19
|
+
Use the packaged libraries, and ignore the system libraries. This is the default.
|
20
|
+
|
21
|
+
|
22
|
+
Flags only used when using system libraries:
|
23
|
+
|
24
|
+
Related to re2 library:
|
25
|
+
|
26
|
+
--with-re2-dir=DIRECTORY
|
27
|
+
Look for re2 headers and library in DIRECTORY.
|
28
|
+
|
29
|
+
|
30
|
+
Flags only used when building and using the packaged libraries:
|
31
|
+
|
32
|
+
--enable-cross-build
|
33
|
+
Enable cross-build mode. (You probably do not want to set this manually.)
|
34
|
+
|
35
|
+
|
36
|
+
Environment variables used:
|
37
|
+
|
38
|
+
CC
|
39
|
+
Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
|
40
|
+
|
41
|
+
CPPFLAGS
|
42
|
+
If this string is accepted by the C preprocessor, add it to the flags passed to the C preprocessor
|
43
|
+
|
44
|
+
CFLAGS
|
45
|
+
If this string is accepted by the compiler, add it to the flags passed to the compiler
|
46
|
+
|
47
|
+
LDFLAGS
|
48
|
+
If this string is accepted by the linker, add it to the flags passed to the linker
|
49
|
+
|
50
|
+
LIBS
|
51
|
+
Add this string to the flags passed to the linker
|
52
|
+
HELP
|
53
|
+
|
54
|
+
#
|
55
|
+
# utility functions
|
56
|
+
#
|
57
|
+
def config_system_libraries?
|
58
|
+
enable_config("system-libraries", ENV.key?('RE2_USE_SYSTEM_LIBRARIES'))
|
59
|
+
end
|
60
|
+
|
61
|
+
def config_cross_build?
|
62
|
+
enable_config("cross-build")
|
63
|
+
end
|
64
|
+
|
65
|
+
def concat_flags(*args)
|
66
|
+
args.compact.join(" ")
|
67
|
+
end
|
68
|
+
|
69
|
+
def do_help
|
70
|
+
print(RE2_HELP_MESSAGE)
|
71
|
+
exit!(0)
|
72
|
+
end
|
73
|
+
|
74
|
+
def darwin?
|
75
|
+
RbConfig::CONFIG["target_os"].include?("darwin")
|
76
|
+
end
|
77
|
+
|
78
|
+
def windows?
|
79
|
+
RbConfig::CONFIG["target_os"].match?(/mingw|mswin/)
|
80
|
+
end
|
81
|
+
|
82
|
+
def freebsd?
|
83
|
+
RbConfig::CONFIG["target_os"].include?("freebsd")
|
84
|
+
end
|
85
|
+
|
86
|
+
def target_host
|
87
|
+
# We use 'host' to set compiler prefix for cross-compiling. Prefer host_alias over host. And
|
88
|
+
# prefer i686 (what external dev tools use) to i386 (what ruby's configure.ac emits).
|
89
|
+
host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
90
|
+
host.gsub(/i386/, "i686")
|
91
|
+
end
|
92
|
+
|
93
|
+
def target_arch
|
94
|
+
RbConfig::CONFIG['arch']
|
95
|
+
end
|
96
|
+
|
97
|
+
def with_temp_dir
|
98
|
+
Dir.mktmpdir do |temp_dir|
|
99
|
+
Dir.chdir(temp_dir) do
|
100
|
+
yield
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# main
|
107
|
+
#
|
108
|
+
do_help if arg_config('--help')
|
8
109
|
|
9
110
|
if ENV["CC"]
|
10
111
|
RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"]
|
@@ -16,62 +117,57 @@ if ENV["CXX"]
|
|
16
117
|
RbConfig::CONFIG["CXX"] = ENV["CXX"]
|
17
118
|
end
|
18
119
|
|
19
|
-
|
20
|
-
"
|
21
|
-
"/opt/homebrew/include",
|
22
|
-
"/usr/include"
|
23
|
-
]
|
24
|
-
|
25
|
-
lib_dirs = [
|
26
|
-
"/usr/local/lib",
|
27
|
-
"/opt/homebrew/lib",
|
28
|
-
"/usr/lib"
|
29
|
-
]
|
30
|
-
|
31
|
-
dir_config("re2", header_dirs, lib_dirs)
|
120
|
+
def build_extension
|
121
|
+
$CFLAGS << " -Wall -Wextra -funroll-loops"
|
32
122
|
|
33
|
-
|
123
|
+
# Pass -x c++ to force gcc to compile the test program
|
124
|
+
# as C++ (as it will end in .c by default).
|
125
|
+
compile_options = "-x c++"
|
34
126
|
|
35
|
-
|
36
|
-
|
37
|
-
|
127
|
+
have_library("stdc++")
|
128
|
+
have_header("stdint.h")
|
129
|
+
have_func("rb_str_sublen")
|
38
130
|
|
39
|
-
have_library("
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
unless have_library("re2")
|
44
|
-
abort "You must have re2 installed and specified with --with-re2-dir, please see https://github.com/google/re2/wiki/Install"
|
45
|
-
end
|
131
|
+
unless have_library("re2")
|
132
|
+
abort "You must have re2 installed and specified with --with-re2-dir, please see https://github.com/google/re2/wiki/Install"
|
133
|
+
end
|
46
134
|
|
47
|
-
# Recent versions of re2 now require a compiler with C++11 support
|
48
|
-
checking_for("re2 requires C++11 compiler") do
|
49
135
|
minimal_program = <<SRC
|
50
136
|
#include <re2/re2.h>
|
51
137
|
int main() { return 0; }
|
52
138
|
SRC
|
53
139
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
140
|
+
re2_requires_version_flag = checking_for("re2 that requires explicit C++ version flag") do
|
141
|
+
!try_compile(minimal_program, compile_options)
|
142
|
+
end
|
143
|
+
|
144
|
+
if re2_requires_version_flag
|
145
|
+
# Recent versions of re2 depend directly on abseil, which requires a
|
146
|
+
# compiler with C++14 support (see
|
147
|
+
# https://github.com/abseil/abseil-cpp/issues/1127 and
|
148
|
+
# https://github.com/abseil/abseil-cpp/issues/1431). However, the
|
149
|
+
# `std=c++14` flag doesn't appear to suffice; we need at least
|
150
|
+
# `std=c++17`.
|
151
|
+
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|
|
152
|
+
checking_for("re2 that compiles with #{std} standard") do
|
153
|
+
if try_compile(minimal_program, compile_options + " -std=#{std}")
|
154
|
+
compile_options << " -std=#{std}"
|
155
|
+
$CPPFLAGS << " -std=#{std}"
|
156
|
+
|
157
|
+
true
|
158
|
+
end
|
159
|
+
end
|
63
160
|
end
|
64
161
|
end
|
65
|
-
end
|
66
162
|
|
67
|
-
# Determine which version of re2 the user has installed.
|
68
|
-
# Revision d9f8806c004d added an `endpos` argument to the
|
69
|
-
# generic Match() function.
|
70
|
-
#
|
71
|
-
# To test for this, try to compile a simple program that uses
|
72
|
-
# the newer form of Match() and set a flag if it is successful.
|
73
|
-
checking_for("RE2::Match() with endpos argument") do
|
74
|
-
|
163
|
+
# Determine which version of re2 the user has installed.
|
164
|
+
# Revision d9f8806c004d added an `endpos` argument to the
|
165
|
+
# generic Match() function.
|
166
|
+
#
|
167
|
+
# To test for this, try to compile a simple program that uses
|
168
|
+
# the newer form of Match() and set a flag if it is successful.
|
169
|
+
checking_for("RE2::Match() with endpos argument") do
|
170
|
+
test_re2_match_signature = <<SRC
|
75
171
|
#include <re2/re2.h>
|
76
172
|
|
77
173
|
int main() {
|
@@ -83,13 +179,13 @@ int main() {
|
|
83
179
|
}
|
84
180
|
SRC
|
85
181
|
|
86
|
-
|
87
|
-
|
182
|
+
if try_compile(test_re2_match_signature, compile_options)
|
183
|
+
$defs.push("-DHAVE_ENDPOS_ARGUMENT")
|
184
|
+
end
|
88
185
|
end
|
89
|
-
end
|
90
186
|
|
91
|
-
checking_for("RE2::Set::Match() with error information") do
|
92
|
-
|
187
|
+
checking_for("RE2::Set::Match() with error information") do
|
188
|
+
test_re2_set_match_signature = <<SRC
|
93
189
|
#include <vector>
|
94
190
|
#include <re2/re2.h>
|
95
191
|
#include <re2/set.h>
|
@@ -107,9 +203,182 @@ int main() {
|
|
107
203
|
}
|
108
204
|
SRC
|
109
205
|
|
110
|
-
|
111
|
-
|
206
|
+
if try_compile(test_re2_set_match_signature, compile_options)
|
207
|
+
$defs.push("-DHAVE_ERROR_INFO_ARGUMENT")
|
208
|
+
end
|
112
209
|
end
|
113
210
|
end
|
114
211
|
|
212
|
+
def process_recipe(recipe)
|
213
|
+
cross_build_p = config_cross_build?
|
214
|
+
message "Cross build is #{cross_build_p ? "enabled" : "disabled"}.\n"
|
215
|
+
|
216
|
+
recipe.host = target_host
|
217
|
+
# Ensure x64-mingw-ucrt and x64-mingw32 use different library paths since the host
|
218
|
+
# is the same (x86_64-w64-mingw32).
|
219
|
+
recipe.target = File.join(recipe.target, target_arch) if cross_build_p
|
220
|
+
|
221
|
+
yield recipe
|
222
|
+
|
223
|
+
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
224
|
+
name = recipe.name
|
225
|
+
version = recipe.version
|
226
|
+
|
227
|
+
if File.exist?(checkpoint)
|
228
|
+
message("Building re2 with a packaged version of #{name}-#{version}.\n")
|
229
|
+
else
|
230
|
+
message(<<~EOM)
|
231
|
+
---------- IMPORTANT NOTICE ----------
|
232
|
+
Building re2 with a packaged version of #{name}-#{version}.
|
233
|
+
Configuration options: #{recipe.configure_options.shelljoin}
|
234
|
+
EOM
|
235
|
+
|
236
|
+
unless recipe.patch_files.empty?
|
237
|
+
message("The following patches are being applied:\n")
|
238
|
+
|
239
|
+
recipe.patch_files.each do |patch|
|
240
|
+
message(" - %s\n" % File.basename(patch))
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# Use a temporary base directory to reduce filename lengths since
|
245
|
+
# Windows can hit a limit of 250 characters (CMAKE_OBJECT_PATH_MAX).
|
246
|
+
with_temp_dir { recipe.cook }
|
247
|
+
|
248
|
+
FileUtils.touch(checkpoint)
|
249
|
+
end
|
250
|
+
|
251
|
+
recipe.activate
|
252
|
+
end
|
253
|
+
|
254
|
+
def build_with_system_libraries
|
255
|
+
header_dirs = [
|
256
|
+
"/usr/local/include",
|
257
|
+
"/opt/homebrew/include",
|
258
|
+
"/usr/include"
|
259
|
+
]
|
260
|
+
|
261
|
+
lib_dirs = [
|
262
|
+
"/usr/local/lib",
|
263
|
+
"/opt/homebrew/lib",
|
264
|
+
"/usr/lib"
|
265
|
+
]
|
266
|
+
|
267
|
+
dir_config("re2", header_dirs, lib_dirs)
|
268
|
+
|
269
|
+
build_extension
|
270
|
+
end
|
271
|
+
|
272
|
+
# pkgconf v1.9.3 on Windows incorrectly sorts the output of `pkg-config
|
273
|
+
# --libs --static`, resulting in build failures: https://github.com/pkgconf/pkgconf/issues/268.
|
274
|
+
# To work around the issue, store the correct order of abseil flags here and add them manually
|
275
|
+
# for Windows.
|
276
|
+
#
|
277
|
+
# Note that `-ldbghelp` is incorrectly added before `-labsl_symbolize` in abseil:
|
278
|
+
# https://github.com/abseil/abseil-cpp/issues/1497
|
279
|
+
ABSL_LDFLAGS = %w[
|
280
|
+
-labsl_flags
|
281
|
+
-labsl_flags_internal
|
282
|
+
-labsl_flags_marshalling
|
283
|
+
-labsl_flags_reflection
|
284
|
+
-labsl_flags_private_handle_accessor
|
285
|
+
-labsl_flags_commandlineflag
|
286
|
+
-labsl_flags_commandlineflag_internal
|
287
|
+
-labsl_flags_config
|
288
|
+
-labsl_flags_program_name
|
289
|
+
-labsl_cord
|
290
|
+
-labsl_cordz_info
|
291
|
+
-labsl_cord_internal
|
292
|
+
-labsl_cordz_functions
|
293
|
+
-labsl_cordz_handle
|
294
|
+
-labsl_crc_cord_state
|
295
|
+
-labsl_crc32c
|
296
|
+
-labsl_crc_internal
|
297
|
+
-labsl_crc_cpu_detect
|
298
|
+
-labsl_hash
|
299
|
+
-labsl_city
|
300
|
+
-labsl_bad_variant_access
|
301
|
+
-labsl_low_level_hash
|
302
|
+
-labsl_raw_hash_set
|
303
|
+
-labsl_hashtablez_sampler
|
304
|
+
-labsl_exponential_biased
|
305
|
+
-labsl_bad_optional_access
|
306
|
+
-labsl_str_format_internal
|
307
|
+
-labsl_synchronization
|
308
|
+
-labsl_graphcycles_internal
|
309
|
+
-labsl_stacktrace
|
310
|
+
-labsl_symbolize
|
311
|
+
-ldbghelp
|
312
|
+
-labsl_debugging_internal
|
313
|
+
-labsl_demangle_internal
|
314
|
+
-labsl_malloc_internal
|
315
|
+
-labsl_time
|
316
|
+
-labsl_civil_time
|
317
|
+
-labsl_strings
|
318
|
+
-labsl_strings_internal
|
319
|
+
-ladvapi32
|
320
|
+
-labsl_base
|
321
|
+
-labsl_spinlock_wait
|
322
|
+
-labsl_int128
|
323
|
+
-labsl_throw_delegate
|
324
|
+
-labsl_raw_logging_internal
|
325
|
+
-labsl_log_severity
|
326
|
+
-labsl_time_zone
|
327
|
+
].freeze
|
328
|
+
|
329
|
+
def add_static_ldflags(flags)
|
330
|
+
static_flags = flags.split
|
331
|
+
|
332
|
+
if MiniPortile.windows?
|
333
|
+
static_flags.each { |flag| append_ldflags(flag) unless ABSL_LDFLAGS.include?(flag) }
|
334
|
+
ABSL_LDFLAGS.each { |flag| append_ldflags(flag) }
|
335
|
+
else
|
336
|
+
static_flags.each { |flag| append_ldflags(flag) }
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
def build_with_vendored_libraries
|
341
|
+
message "Building re2 using packaged libraries.\n"
|
342
|
+
|
343
|
+
abseil_recipe, re2_recipe = load_recipes
|
344
|
+
|
345
|
+
process_recipe(abseil_recipe) do |recipe|
|
346
|
+
recipe.configure_options += ['-DABSL_PROPAGATE_CXX_STD=ON', '-DCMAKE_CXX_VISIBILITY_PRESET=hidden']
|
347
|
+
end
|
348
|
+
|
349
|
+
process_recipe(re2_recipe) do |recipe|
|
350
|
+
recipe.configure_options += ["-DCMAKE_PREFIX_PATH=#{abseil_recipe.path}", '-DCMAKE_CXX_FLAGS=-DNDEBUG',
|
351
|
+
'-DCMAKE_CXX_VISIBILITY_PRESET=hidden']
|
352
|
+
end
|
353
|
+
|
354
|
+
dir_config("re2", File.join(re2_recipe.path, 'include'), File.join(re2_recipe.path, 'lib'))
|
355
|
+
dir_config("abseil", File.join(abseil_recipe.path, 'include'), File.join(abseil_recipe.path, 'lib'))
|
356
|
+
|
357
|
+
pkg_config_paths = [
|
358
|
+
"#{abseil_recipe.path}/lib/pkgconfig",
|
359
|
+
"#{re2_recipe.path}/lib/pkgconfig"
|
360
|
+
].join(File::PATH_SEPARATOR)
|
361
|
+
|
362
|
+
pkg_config_paths = "#{ENV['PKG_CONFIG_PATH']}#{File::PATH_SEPARATOR}#{pkg_config_paths}" if ENV['PKG_CONFIG_PATH']
|
363
|
+
|
364
|
+
ENV['PKG_CONFIG_PATH'] = pkg_config_paths
|
365
|
+
pc_file = File.join(re2_recipe.path, 'lib', 'pkgconfig', 're2.pc')
|
366
|
+
|
367
|
+
raise 'Please install the `pkg-config` utility!' unless find_executable('pkg-config')
|
368
|
+
|
369
|
+
# See https://bugs.ruby-lang.org/issues/18490, broken in Ruby 3.1 but fixed in Ruby 3.2.
|
370
|
+
flags = xpopen(['pkg-config', '--libs', '--static', pc_file], err: %i[child out], &:read)
|
371
|
+
|
372
|
+
raise 'Unable to run pkg-config --libs --static' unless $?.success?
|
373
|
+
|
374
|
+
add_static_ldflags(flags)
|
375
|
+
build_extension
|
376
|
+
end
|
377
|
+
|
378
|
+
if config_system_libraries?
|
379
|
+
build_with_system_libraries
|
380
|
+
else
|
381
|
+
build_with_vendored_libraries
|
382
|
+
end
|
383
|
+
|
115
384
|
create_makefile("re2")
|
data/ext/re2/re2.cc
CHANGED
@@ -393,7 +393,7 @@ re2::StringPiece *re2_matchdata_find_match(VALUE idx, VALUE self) {
|
|
393
393
|
/*
|
394
394
|
* Returns the number of elements in the match array (including nils).
|
395
395
|
*
|
396
|
-
* @return [
|
396
|
+
* @return [Integer] the number of elements
|
397
397
|
* @example
|
398
398
|
* m = RE2::Regexp.new('(\d+)').match("bob 123")
|
399
399
|
* m.size #=> 2
|
@@ -409,8 +409,8 @@ static VALUE re2_matchdata_size(VALUE self) {
|
|
409
409
|
/*
|
410
410
|
* Returns the offset of the start of the nth element of the matchdata.
|
411
411
|
*
|
412
|
-
* @param [
|
413
|
-
* @return [
|
412
|
+
* @param [Integer, String, Symbol] n the name or number of the match
|
413
|
+
* @return [Integer] the offset of the start of the match
|
414
414
|
* @example
|
415
415
|
* m = RE2::Regexp.new('ob (\d+)').match("bob 123")
|
416
416
|
* m.begin(0) #=> 1
|
@@ -439,8 +439,8 @@ static VALUE re2_matchdata_begin(VALUE self, VALUE n) {
|
|
439
439
|
/*
|
440
440
|
* Returns the offset of the character following the end of the nth element of the matchdata.
|
441
441
|
*
|
442
|
-
* @param [
|
443
|
-
* @return [
|
442
|
+
* @param [Integer, String, Symbol] n the name or number of the match
|
443
|
+
* @return [Integer] the offset of the character following the end of the match
|
444
444
|
* @example
|
445
445
|
* m = RE2::Regexp.new('ob (\d+) b').match("bob 123 bob")
|
446
446
|
* m.end(0) #=> 9
|
@@ -584,7 +584,7 @@ static VALUE re2_matchdata_named_match(const char* name, VALUE self) {
|
|
584
584
|
* @overload [](index)
|
585
585
|
* Access a particular match by index.
|
586
586
|
*
|
587
|
-
* @param [
|
587
|
+
* @param [Integer] index the index of the match to fetch
|
588
588
|
* @return [String, nil] the specified match
|
589
589
|
* @example
|
590
590
|
* m = RE2::Regexp.new('(\d+)').match("bob 123")
|
@@ -593,8 +593,8 @@ static VALUE re2_matchdata_named_match(const char* name, VALUE self) {
|
|
593
593
|
* @overload [](start, length)
|
594
594
|
* Access a range of matches by starting index and length.
|
595
595
|
*
|
596
|
-
* @param [
|
597
|
-
* @param [
|
596
|
+
* @param [Integer] start the index from which to start
|
597
|
+
* @param [Integer] length the number of elements to fetch
|
598
598
|
* @return [Array<String, nil>] the specified matches
|
599
599
|
* @example
|
600
600
|
* m = RE2::Regexp.new('(\d+)').match("bob 123")
|
@@ -795,12 +795,9 @@ static VALUE re2_matchdata_deconstruct_keys(VALUE self, VALUE keys) {
|
|
795
795
|
|
796
796
|
/*
|
797
797
|
* Returns a new RE2 object with a compiled version of
|
798
|
-
* +pattern+ stored inside. Equivalent to +RE2.new+.
|
798
|
+
* +pattern+ stored inside. Equivalent to +RE2::Regexp.new+.
|
799
799
|
*
|
800
|
-
* @
|
801
|
-
* @param [String] pattern the pattern to compile
|
802
|
-
* @param [Hash] options the options to compile a regexp with
|
803
|
-
* @see RE2::Regexp.new
|
800
|
+
* @see RE2::Regexp#initialize
|
804
801
|
*
|
805
802
|
*/
|
806
803
|
static VALUE re2_re2(int argc, VALUE *argv, VALUE self) {
|
@@ -833,7 +830,7 @@ static VALUE re2_re2(int argc, VALUE *argv, VALUE self) {
|
|
833
830
|
* @option options [Boolean] :posix_syntax (false) restrict regexps to POSIX egrep syntax
|
834
831
|
* @option options [Boolean] :longest_match (false) search for longest match, not first match
|
835
832
|
* @option options [Boolean] :log_errors (true) log syntax and execution errors to ERROR
|
836
|
-
* @option options [
|
833
|
+
* @option options [Integer] :max_mem approx. max memory footprint of RE2
|
837
834
|
* @option options [Boolean] :literal (false) interpret string as literal, not regexp
|
838
835
|
* @option options [Boolean] :never_nl (false) never match \n, even if it is in regexp
|
839
836
|
* @option options [Boolean] :case_sensitive (true) match is case-sensitive (regexp can override with (?i) unless in posix_syntax mode)
|
@@ -984,7 +981,7 @@ static VALUE re2_regexp_log_errors(VALUE self) {
|
|
984
981
|
* Returns the max_mem setting for the regular expression
|
985
982
|
* +re2+.
|
986
983
|
*
|
987
|
-
* @return [
|
984
|
+
* @return [Integer] the max_mem option
|
988
985
|
* @example
|
989
986
|
* re2 = RE2::Regexp.new("woo?", :max_mem => 1024)
|
990
987
|
* re2.max_mem #=> 1024
|
@@ -1138,7 +1135,7 @@ static VALUE re2_regexp_error_arg(VALUE self) {
|
|
1138
1135
|
* of a regexp's "cost". Larger numbers are more expensive
|
1139
1136
|
* than smaller numbers.
|
1140
1137
|
*
|
1141
|
-
* @return [
|
1138
|
+
* @return [Integer] the regexp "cost"
|
1142
1139
|
*/
|
1143
1140
|
static VALUE re2_regexp_program_size(VALUE self) {
|
1144
1141
|
re2_pattern *p;
|
@@ -1203,7 +1200,7 @@ static VALUE re2_regexp_options(VALUE self) {
|
|
1203
1200
|
* wasn't valid on construction. The overall match ($0) does not
|
1204
1201
|
* count: if the regexp is "(a)(b)", returns 2.
|
1205
1202
|
*
|
1206
|
-
* @return [
|
1203
|
+
* @return [Integer] the number of capturing subpatterns
|
1207
1204
|
*/
|
1208
1205
|
static VALUE re2_regexp_number_of_capturing_groups(VALUE self) {
|
1209
1206
|
re2_pattern *p;
|
@@ -1273,7 +1270,7 @@ static VALUE re2_regexp_named_capturing_groups(VALUE self) {
|
|
1273
1270
|
* matches returned (padded with nils if necessary).
|
1274
1271
|
*
|
1275
1272
|
* @param [String] text the text to search
|
1276
|
-
* @param [
|
1273
|
+
* @param [Integer] number_of_matches the number of matches to return
|
1277
1274
|
* @return [RE2::MatchData] the matches
|
1278
1275
|
* @raise [ArgumentError] if given a negative number of matches
|
1279
1276
|
* @raise [NoMemoryError] if there was not enough memory to allocate the matches
|
@@ -1399,7 +1396,7 @@ static VALUE re2_regexp_scan(VALUE self, VALUE text) {
|
|
1399
1396
|
* @return [String] the resulting string
|
1400
1397
|
* @example
|
1401
1398
|
* RE2.Replace("hello there", "hello", "howdy") #=> "howdy there"
|
1402
|
-
* re2 = RE2.new("hel+o")
|
1399
|
+
* re2 = RE2::Regexp.new("hel+o")
|
1403
1400
|
* RE2.Replace("hello there", re2, "yo") #=> "yo there"
|
1404
1401
|
*/
|
1405
1402
|
static VALUE re2_Replace(VALUE self, VALUE str, VALUE pattern,
|
@@ -1435,7 +1432,7 @@ static VALUE re2_Replace(VALUE self, VALUE str, VALUE pattern,
|
|
1435
1432
|
* @param [String] rewrite the string to replace with
|
1436
1433
|
* @return [String] the resulting string
|
1437
1434
|
* @example
|
1438
|
-
* re2 = RE2.new("oo?")
|
1435
|
+
* re2 = RE2::Regexp.new("oo?")
|
1439
1436
|
* RE2.GlobalReplace("whoops-doops", re2, "e") #=> "wheps-deps"
|
1440
1437
|
* RE2.GlobalReplace("hello there", "e", "i") #=> "hillo thiri"
|
1441
1438
|
*/
|
@@ -1522,7 +1519,7 @@ static VALUE re2_set_allocate(VALUE klass) {
|
|
1522
1519
|
* @option options [Boolean] :posix_syntax (false) restrict regexps to POSIX egrep syntax
|
1523
1520
|
* @option options [Boolean] :longest_match (false) search for longest match, not first match
|
1524
1521
|
* @option options [Boolean] :log_errors (true) log syntax and execution errors to ERROR
|
1525
|
-
* @option options [
|
1522
|
+
* @option options [Integer] :max_mem approx. max memory footprint of RE2
|
1526
1523
|
* @option options [Boolean] :literal (false) interpret string as literal, not regexp
|
1527
1524
|
* @option options [Boolean] :never_nl (false) never match \n, even if it is in regexp
|
1528
1525
|
* @option options [Boolean] :case_sensitive (true) match is case-sensitive (regexp can override with (?i) unless in posix_syntax mode)
|
@@ -1889,9 +1886,4 @@ void Init_re2(void) {
|
|
1889
1886
|
id_anchor_start = rb_intern("anchor_start");
|
1890
1887
|
id_anchor_both = rb_intern("anchor_both");
|
1891
1888
|
id_exception = rb_intern("exception");
|
1892
|
-
|
1893
|
-
#if 0
|
1894
|
-
/* Fake so YARD generates the file. */
|
1895
|
-
rb_mKernel = rb_define_module("Kernel");
|
1896
|
-
#endif
|
1897
1889
|
}
|
data/ext/re2/recipes.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PACKAGE_ROOT_DIR = File.expand_path('../..', __dir__)
|
2
|
+
REQUIRED_MINI_PORTILE_VERSION = '~> 2.8.4' # keep this version in sync with the one in the gemspec
|
3
|
+
|
4
|
+
def build_recipe(name, version)
|
5
|
+
require 'rubygems'
|
6
|
+
gem('mini_portile2', REQUIRED_MINI_PORTILE_VERSION) # gemspec is not respected at install time
|
7
|
+
require 'mini_portile2'
|
8
|
+
|
9
|
+
MiniPortileCMake.new(name, version).tap do |recipe|
|
10
|
+
recipe.target = File.join(PACKAGE_ROOT_DIR, 'ports')
|
11
|
+
recipe.configure_options += [
|
12
|
+
# abseil needs a C++14 compiler
|
13
|
+
'-DCMAKE_CXX_STANDARD=17',
|
14
|
+
# needed for building the C extension shared library with -fPIC
|
15
|
+
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
|
16
|
+
# ensures pkg-config and installed libraries will be in lib, not lib64
|
17
|
+
'-DCMAKE_INSTALL_LIBDIR=lib'
|
18
|
+
]
|
19
|
+
|
20
|
+
yield recipe
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def load_recipes
|
25
|
+
require 'yaml'
|
26
|
+
dependencies = YAML.load_file(File.join(PACKAGE_ROOT_DIR, 'dependencies.yml'))
|
27
|
+
|
28
|
+
abseil_recipe = build_recipe('abseil', dependencies['abseil']['version']) do |recipe|
|
29
|
+
recipe.files = [{
|
30
|
+
url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/#{recipe.version}.tar.gz",
|
31
|
+
sha256: dependencies['abseil']['sha256']
|
32
|
+
}]
|
33
|
+
end
|
34
|
+
|
35
|
+
re2_recipe = build_recipe('libre2', dependencies['libre2']['version']) do |recipe|
|
36
|
+
recipe.files = [{
|
37
|
+
url: "https://github.com/google/re2/releases/download/#{recipe.version}/re2-#{recipe.version}.tar.gz",
|
38
|
+
sha256: dependencies['libre2']['sha256']
|
39
|
+
}]
|
40
|
+
end
|
41
|
+
|
42
|
+
[abseil_recipe, re2_recipe]
|
43
|
+
end
|
data/lib/re2/string.rb
CHANGED
@@ -12,30 +12,14 @@ module RE2
|
|
12
12
|
# Replaces the first occurrence +pattern+ with +rewrite+ and returns a new
|
13
13
|
# string.
|
14
14
|
#
|
15
|
-
# @
|
16
|
-
# @param [String] rewrite the string to replace with
|
17
|
-
# @example
|
18
|
-
# "hello there".re2_sub("hello", "howdy") #=> "howdy there"
|
19
|
-
# re2 = RE2.new("hel+o")
|
20
|
-
# "hello there".re2_sub(re2, "yo") #=> "yo there"
|
21
|
-
# text = "Good morning"
|
22
|
-
# text.re2_sub("morn", "even") #=> "Good evening"
|
23
|
-
# text #=> "Good morning"
|
15
|
+
# @see RE2.Replace
|
24
16
|
def re2_sub(*args)
|
25
17
|
RE2.Replace(self, *args)
|
26
18
|
end
|
27
19
|
|
28
20
|
# Replaces every occurrence of +pattern+ with +rewrite+ and return a new string.
|
29
21
|
#
|
30
|
-
# @
|
31
|
-
# @param [String] rewrite the string to replace with
|
32
|
-
# @example
|
33
|
-
# "hello there".re2_gsub("e", "i") #=> "hillo thiri"
|
34
|
-
# re2 = RE2.new("oo?")
|
35
|
-
# "whoops-doops".re2_gsub(re2, "e") #=> "wheps-deps"
|
36
|
-
# text = "Good morning"
|
37
|
-
# text.re2_gsub("o", "ee") #=> "Geeeed meerning"
|
38
|
-
# text #=> "Good morning"
|
22
|
+
# @see RE2.GlobalReplace
|
39
23
|
def re2_gsub(*args)
|
40
24
|
RE2.GlobalReplace(self, *args)
|
41
25
|
end
|
@@ -74,7 +58,7 @@ module RE2
|
|
74
58
|
# matches returned (padded with nils if necessary).
|
75
59
|
#
|
76
60
|
# @param [String, RE2::Regexp] pattern the regular expression to match
|
77
|
-
# @param [
|
61
|
+
# @param [Integer] number_of_matches the number of matches to return
|
78
62
|
# @return [RE2::MatchData] the matches
|
79
63
|
# @raise [NoMemoryError] if there was not enough memory to allocate the matches
|
80
64
|
# @example
|
data/lib/re2/version.rb
ADDED
data/lib/re2.rb
CHANGED
@@ -3,5 +3,12 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2010-2014, Paul Mucur (http://mudge.name)
|
5
5
|
# Released under the BSD Licence, please see LICENSE.txt
|
6
|
-
|
6
|
+
begin
|
7
|
+
::RUBY_VERSION =~ /(\d+\.\d+)/
|
8
|
+
require_relative "#{Regexp.last_match(1)}/re2.so"
|
9
|
+
rescue LoadError
|
10
|
+
require 're2.so'
|
11
|
+
end
|
12
|
+
|
7
13
|
require "re2/scanner"
|
14
|
+
require "re2/version"
|
Binary file
|
Binary file
|
data/re2.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative 'lib/re2/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "re2"
|
5
|
+
s.summary = "Ruby bindings to re2."
|
6
|
+
s.description = 'Ruby bindings to re2, "an efficient, principled regular expression library".'
|
7
|
+
s.version = RE2::VERSION
|
8
|
+
s.authors = ["Paul Mucur"]
|
9
|
+
s.homepage = "https://github.com/mudge/re2"
|
10
|
+
s.extensions = ["ext/re2/extconf.rb"]
|
11
|
+
s.license = "BSD-3-Clause"
|
12
|
+
s.required_ruby_version = ">= 2.7.0"
|
13
|
+
s.files = [
|
14
|
+
".rspec",
|
15
|
+
"dependencies.yml",
|
16
|
+
"ext/re2/extconf.rb",
|
17
|
+
"ext/re2/re2.cc",
|
18
|
+
"ext/re2/recipes.rb",
|
19
|
+
"Gemfile",
|
20
|
+
"lib/re2.rb",
|
21
|
+
"lib/re2/scanner.rb",
|
22
|
+
"lib/re2/string.rb",
|
23
|
+
"lib/re2/version.rb",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"re2.gemspec"
|
28
|
+
]
|
29
|
+
s.test_files = [
|
30
|
+
"spec/spec_helper.rb",
|
31
|
+
"spec/re2_spec.rb",
|
32
|
+
"spec/kernel_spec.rb",
|
33
|
+
"spec/re2/regexp_spec.rb",
|
34
|
+
"spec/re2/match_data_spec.rb",
|
35
|
+
"spec/re2/string_spec.rb",
|
36
|
+
"spec/re2/set_spec.rb",
|
37
|
+
"spec/re2/scanner_spec.rb"
|
38
|
+
]
|
39
|
+
s.add_development_dependency "rake-compiler", "~> 1.2.1"
|
40
|
+
s.add_development_dependency "rake-compiler-dock", "~> 1.3.0"
|
41
|
+
s.add_development_dependency("rspec", "~> 3.2")
|
42
|
+
s.add_runtime_dependency("mini_portile2", "~> 2.8.4") # keep version in sync with extconf.rb
|
43
|
+
end
|
data/spec/re2/regexp_spec.rb
CHANGED
@@ -91,7 +91,8 @@ RSpec.describe RE2::Regexp do
|
|
91
91
|
describe "#program_size" do
|
92
92
|
it "returns a numeric value" do
|
93
93
|
program_size = RE2::Regexp.new('w(o)(o)').program_size
|
94
|
-
|
94
|
+
|
95
|
+
expect(program_size).to be_an(Integer)
|
95
96
|
end
|
96
97
|
|
97
98
|
it "returns -1 for an invalid pattern" do
|
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:
|
4
|
+
version: 2.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.2.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.2.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake-compiler-dock
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,21 +52,43 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mini_portile2
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.8.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.8.4
|
41
69
|
description: Ruby bindings to re2, "an efficient, principled regular expression library".
|
42
|
-
email:
|
70
|
+
email:
|
43
71
|
executables: []
|
44
72
|
extensions:
|
45
73
|
- ext/re2/extconf.rb
|
46
74
|
extra_rdoc_files: []
|
47
75
|
files:
|
76
|
+
- ".rspec"
|
77
|
+
- Gemfile
|
48
78
|
- LICENSE.txt
|
49
79
|
- README.md
|
50
80
|
- Rakefile
|
81
|
+
- dependencies.yml
|
51
82
|
- ext/re2/extconf.rb
|
52
83
|
- ext/re2/re2.cc
|
84
|
+
- ext/re2/recipes.rb
|
53
85
|
- lib/re2.rb
|
54
86
|
- lib/re2/scanner.rb
|
55
87
|
- lib/re2/string.rb
|
88
|
+
- lib/re2/version.rb
|
89
|
+
- ports/archives/20230125.3.tar.gz
|
90
|
+
- ports/archives/re2-2023-07-01.tar.gz
|
91
|
+
- re2.gemspec
|
56
92
|
- spec/kernel_spec.rb
|
57
93
|
- spec/re2/match_data_spec.rb
|
58
94
|
- spec/re2/regexp_spec.rb
|
@@ -65,7 +101,7 @@ homepage: https://github.com/mudge/re2
|
|
65
101
|
licenses:
|
66
102
|
- BSD-3-Clause
|
67
103
|
metadata: {}
|
68
|
-
post_install_message:
|
104
|
+
post_install_message:
|
69
105
|
rdoc_options: []
|
70
106
|
require_paths:
|
71
107
|
- lib
|
@@ -73,15 +109,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
109
|
requirements:
|
74
110
|
- - ">="
|
75
111
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
112
|
+
version: 2.7.0
|
77
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
114
|
requirements:
|
79
|
-
- - "
|
115
|
+
- - ">"
|
80
116
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
117
|
+
version: 1.3.1
|
82
118
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
84
|
-
signing_key:
|
119
|
+
rubygems_version: 3.4.10
|
120
|
+
signing_key:
|
85
121
|
specification_version: 4
|
86
122
|
summary: Ruby bindings to re2.
|
87
123
|
test_files:
|