corvus_regex_ecma262 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 83c3d2569dd4d1005c9114dc22939d9ff6fa76f3d65eb115b305b53b54f502c9
4
+ data.tar.gz: '075248c5e276a3a4b641824a97516ff4134e35bd4f2edb558cdfed0b07ff286e'
5
+ SHA512:
6
+ metadata.gz: e810d694c2e413e800ee7b08710a1b32a5a3ef62338baeb4b2d0891adc38d09baded8313e2707c3f8fbb357c2dc1543e9da0c0be140f4801c9b794b25fe564d1
7
+ data.tar.gz: fb03cc0e3789ad3f07ce761b2e649fac5d78a050a71b97379d1ec287b9350422de22f23cd6435923899508f9ed6e3c10df7e9373498b35dbad18b6d851c271f9
data/Cargo.lock ADDED
@@ -0,0 +1,293 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.5"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "bindgen"
16
+ version = "0.72.1"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
19
+ dependencies = [
20
+ "bitflags",
21
+ "cexpr",
22
+ "clang-sys",
23
+ "itertools",
24
+ "proc-macro2",
25
+ "quote",
26
+ "regex",
27
+ "rustc-hash",
28
+ "shlex",
29
+ "syn",
30
+ ]
31
+
32
+ [[package]]
33
+ name = "bitflags"
34
+ version = "2.13.2"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
37
+
38
+ [[package]]
39
+ name = "cexpr"
40
+ version = "0.6.0"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
43
+ dependencies = [
44
+ "nom",
45
+ ]
46
+
47
+ [[package]]
48
+ name = "cfg-if"
49
+ version = "1.0.5"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
52
+
53
+ [[package]]
54
+ name = "clang-sys"
55
+ version = "1.9.1"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
58
+ dependencies = [
59
+ "glob",
60
+ "libc",
61
+ "libloading",
62
+ ]
63
+
64
+ [[package]]
65
+ name = "corvus-regex-ecma262"
66
+ version = "0.1.1"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "771df2c0c5b00de0b3528be8d38fe3ea41eaf44476980460501214930171703e"
69
+ dependencies = [
70
+ "aho-corasick",
71
+ "memchr",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "corvus_regex_ecma262"
76
+ version = "0.1.1"
77
+ dependencies = [
78
+ "corvus-regex-ecma262",
79
+ "magnus",
80
+ "rb-sys",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "either"
85
+ version = "1.19.0"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
88
+
89
+ [[package]]
90
+ name = "glob"
91
+ version = "0.3.4"
92
+ source = "registry+https://github.com/rust-lang/crates.io-index"
93
+ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
94
+
95
+ [[package]]
96
+ name = "itertools"
97
+ version = "0.13.0"
98
+ source = "registry+https://github.com/rust-lang/crates.io-index"
99
+ checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
100
+ dependencies = [
101
+ "either",
102
+ ]
103
+
104
+ [[package]]
105
+ name = "lazy_static"
106
+ version = "1.5.1"
107
+ source = "registry+https://github.com/rust-lang/crates.io-index"
108
+ checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
109
+
110
+ [[package]]
111
+ name = "libc"
112
+ version = "0.2.191"
113
+ source = "registry+https://github.com/rust-lang/crates.io-index"
114
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
115
+
116
+ [[package]]
117
+ name = "libloading"
118
+ version = "0.8.9"
119
+ source = "registry+https://github.com/rust-lang/crates.io-index"
120
+ checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
121
+ dependencies = [
122
+ "cfg-if",
123
+ "windows-link",
124
+ ]
125
+
126
+ [[package]]
127
+ name = "magnus"
128
+ version = "0.9.3"
129
+ source = "registry+https://github.com/rust-lang/crates.io-index"
130
+ checksum = "40ef424404d166cbb71c8b8d19c9c589c748c4547c1afa1928c5504299f6c713"
131
+ dependencies = [
132
+ "magnus-macros",
133
+ "rb-sys",
134
+ "rb-sys-env",
135
+ "seq-macro",
136
+ ]
137
+
138
+ [[package]]
139
+ name = "magnus-macros"
140
+ version = "0.9.1"
141
+ source = "registry+https://github.com/rust-lang/crates.io-index"
142
+ checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
143
+ dependencies = [
144
+ "proc-macro2",
145
+ "quote",
146
+ "syn",
147
+ ]
148
+
149
+ [[package]]
150
+ name = "memchr"
151
+ version = "2.8.3"
152
+ source = "registry+https://github.com/rust-lang/crates.io-index"
153
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
154
+
155
+ [[package]]
156
+ name = "minimal-lexical"
157
+ version = "0.2.1"
158
+ source = "registry+https://github.com/rust-lang/crates.io-index"
159
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
160
+
161
+ [[package]]
162
+ name = "nom"
163
+ version = "7.1.3"
164
+ source = "registry+https://github.com/rust-lang/crates.io-index"
165
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
166
+ dependencies = [
167
+ "memchr",
168
+ "minimal-lexical",
169
+ ]
170
+
171
+ [[package]]
172
+ name = "proc-macro2"
173
+ version = "1.0.107"
174
+ source = "registry+https://github.com/rust-lang/crates.io-index"
175
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
176
+ dependencies = [
177
+ "unicode-ident",
178
+ ]
179
+
180
+ [[package]]
181
+ name = "quote"
182
+ version = "1.0.47"
183
+ source = "registry+https://github.com/rust-lang/crates.io-index"
184
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
185
+ dependencies = [
186
+ "proc-macro2",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "rb-sys"
191
+ version = "0.9.130"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
194
+ dependencies = [
195
+ "rb-sys-build",
196
+ ]
197
+
198
+ [[package]]
199
+ name = "rb-sys-build"
200
+ version = "0.9.130"
201
+ source = "registry+https://github.com/rust-lang/crates.io-index"
202
+ checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
203
+ dependencies = [
204
+ "bindgen",
205
+ "lazy_static",
206
+ "proc-macro2",
207
+ "quote",
208
+ "regex",
209
+ "shell-words",
210
+ "syn",
211
+ ]
212
+
213
+ [[package]]
214
+ name = "rb-sys-env"
215
+ version = "0.2.3"
216
+ source = "registry+https://github.com/rust-lang/crates.io-index"
217
+ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
218
+
219
+ [[package]]
220
+ name = "regex"
221
+ version = "1.13.1"
222
+ source = "registry+https://github.com/rust-lang/crates.io-index"
223
+ checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
224
+ dependencies = [
225
+ "aho-corasick",
226
+ "memchr",
227
+ "regex-automata",
228
+ "regex-syntax",
229
+ ]
230
+
231
+ [[package]]
232
+ name = "regex-automata"
233
+ version = "0.4.18"
234
+ source = "registry+https://github.com/rust-lang/crates.io-index"
235
+ checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
236
+ dependencies = [
237
+ "aho-corasick",
238
+ "memchr",
239
+ "regex-syntax",
240
+ ]
241
+
242
+ [[package]]
243
+ name = "regex-syntax"
244
+ version = "0.8.11"
245
+ source = "registry+https://github.com/rust-lang/crates.io-index"
246
+ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
247
+
248
+ [[package]]
249
+ name = "rustc-hash"
250
+ version = "2.1.3"
251
+ source = "registry+https://github.com/rust-lang/crates.io-index"
252
+ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
253
+
254
+ [[package]]
255
+ name = "seq-macro"
256
+ version = "0.3.6"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
259
+
260
+ [[package]]
261
+ name = "shell-words"
262
+ version = "1.1.1"
263
+ source = "registry+https://github.com/rust-lang/crates.io-index"
264
+ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
265
+
266
+ [[package]]
267
+ name = "shlex"
268
+ version = "1.3.0"
269
+ source = "registry+https://github.com/rust-lang/crates.io-index"
270
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
271
+
272
+ [[package]]
273
+ name = "syn"
274
+ version = "2.0.119"
275
+ source = "registry+https://github.com/rust-lang/crates.io-index"
276
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
277
+ dependencies = [
278
+ "proc-macro2",
279
+ "quote",
280
+ "unicode-ident",
281
+ ]
282
+
283
+ [[package]]
284
+ name = "unicode-ident"
285
+ version = "1.0.27"
286
+ source = "registry+https://github.com/rust-lang/crates.io-index"
287
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
288
+
289
+ [[package]]
290
+ name = "windows-link"
291
+ version = "0.2.1"
292
+ source = "registry+https://github.com/rust-lang/crates.io-index"
293
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
data/Cargo.toml ADDED
@@ -0,0 +1,8 @@
1
+ # The gem's native extension (ext/corvus_regex_ecma262), as rb_sys expects it: a workspace at the gem's root.
2
+ [workspace]
3
+ members = ["ext/corvus_regex_ecma262"]
4
+ resolver = "3"
5
+
6
+ [profile.release]
7
+ codegen-units = 1
8
+ lto = "fat"
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # corvus-regex-ecma262 for Ruby
2
+
3
+ Regular expressions with the grammar and the answers of ECMA-262, the `RegExp` of JavaScript, for Ruby: the
4
+ [corvus-regex-ecma262](https://github.com/corvus-dotnet/corvus-regex-ecma262-rs) Rust crate, as a gem with native
5
+ builds for Linux (glibc and musl), macOS and Windows, x64 and arm64, for Ruby 3.3 and later.
6
+
7
+ - Every flag: `d`, `g`, `i`, `m`, `s`, `u`, `v` and `y`, with the grammar of each. Without `u` or `v` a pattern is
8
+ read by the Annex B grammar and matched by UTF-16 code unit, as ECMA-262 matches it; with them, by code point. The
9
+ `v` flag has nested classes, the difference and the intersection of classes, strings in a class and the properties
10
+ of strings.
11
+ - ECMAScript 2025: lookbehind, named groups (and a name shared between alternatives), modifier groups such as
12
+ `(?i:...)`, and every Unicode property ECMA-262 lists, from Unicode 17 tables the crate carries.
13
+ - UTF-8 strings (and US-ASCII, and binary strings holding UTF-8) and UTF-16LE strings, each matched as it is held.
14
+ A pattern answers as it does in a browser or Node, which Ruby's `Regexp` does not: `^` and `$`, `.`, `\d`, `\w`,
15
+ `\b`, case folding, `\p{...}` and the rest read as JavaScript reads them.
16
+ - A pattern without a backreference is matched in time proportional to its size times the text, and `match` and
17
+ `match?` take a timeout, so neither a pattern nor a text from outside can make a program hang.
18
+
19
+ **Compliance.** Over the [ECMA-262 test data](https://github.com/corvus-dotnet/ecma262-regex-test-data) (what V8 says
20
+ about 109,547 patterns and 5,325,026 texts, `exec`, the global search, `replace` and `split` among them), through this
21
+ gem over UTF-16LE and UTF-8 strings, it gives 23,647,077 right answers and none wrong, refuses no valid pattern,
22
+ accepts no invalid one and reaches no limit. CI runs the whole data through each native gem on its platform.
23
+
24
+ ## Install
25
+
26
+ ```
27
+ gem install corvus_regex_ecma262
28
+ ```
29
+
30
+ ## Getting started
31
+
32
+ ```ruby
33
+ require "corvus_regex_ecma262"
34
+
35
+ # The flags are those of new RegExp(pattern, flags).
36
+ date = CorvusRegexEcma262::Regex.new('(?<year>\d{4})-(?<month>\d{2})', "gu")
37
+
38
+ date.match?("due 2026-10") # => true
39
+ m = date.match("due 2026-10")
40
+ m[:year] # => "2026"
41
+ m.offset # => [4, 11]
42
+
43
+ # Every match of a global search, as matchAll makes it.
44
+ date.each_match("2026-10, 2027-01").map(&:to_s) # => ["2026-10", "2027-01"]
45
+
46
+ # replace replaces every match with the g flag, and the first without it; a block may give each replacement.
47
+ date.replace("2026-10, 2027-01", "$<month>/$1") # => "10/2026, 01/2027"
48
+ date.replace("2026-10") { |m| m[:month] } # => "10"
49
+
50
+ # split splices in what the groups captured; a group that did not take part is nil.
51
+ CorvusRegexEcma262.compile('\s*(;)\s*').split("a ; b;c") # => ["a", ";", "b", ";", "c"]
52
+ ```
53
+
54
+ ## The API
55
+
56
+ | | |
57
+ |---|---|
58
+ | `Regex.new(pattern, flags = "")`, `CorvusRegexEcma262.compile` | Compiles a pattern as `new RegExp(pattern, flags)` does. |
59
+ | `Regex.valid?(pattern, flags = "")` | Whether a pattern is valid, without compiling it. |
60
+ | `match?(string, pos = 0, timeout: nil)` | `RegExp.prototype.test` with `lastIndex` at `pos` (at `pos` alone with `y`). |
61
+ | `match(string, pos = 0, timeout: nil)` | The first match at or after `pos`, as `exec` finds it: a `Match`, or `nil`; with a block, the block's result. |
62
+ | `each_match(string)` | A global search as `matchAll` makes it: yields each `Match`, or returns an `Enumerator`. |
63
+ | `match_count(string)` | The number of matches of a global search, without making them. |
64
+ | `replace(string, replacement)`, `replace(string) { \|m\| ... }` | `String.prototype.replace`: the first match, or every match with `g`. |
65
+ | `replace_all(string, replacement)` | `String.prototype.replaceAll`: every match. |
66
+ | `split(string, limit = nil)` | `String.prototype.split`: an Array of Strings, `nil` for a group that did not take part. |
67
+ | `source`, `flags`, `group_count`, `names` | What the pattern is. |
68
+
69
+ A `Match` is read as a `MatchData` is: `m[g]` (a number, a name or a Symbol), `captures`, `named_captures`, `to_a`,
70
+ `values_at`, `pre_match`, `post_match`, `begin(g)`, `end(g)` and `offset(g)` (nil for a group that did not take part),
71
+ `byte_begin`, `byte_end` and `byteoffset`, `string` and `regexp`.
72
+
73
+ **Positions.** Over a UTF-8 string, `begin`, `end` and `offset` are in characters, as Ruby counts them, and the
74
+ `byte_` forms in bytes; over a UTF-16LE string they are in UTF-16 code units, as JavaScript counts them. Without `u` or
75
+ `v` a pattern is matched by UTF-16 code unit, so a match can take half of a character beyond the Basic Multilingual
76
+ Plane: over UTF-8 its text holds that half as U+FFFD and its character positions are the whole character's (its byte
77
+ positions are the character's start and third byte); over UTF-16LE it is the lone half, as in JavaScript.
78
+
79
+ **Errors.** `InvalidPatternError`, `InvalidFlagsError`, `PatternTooLargeError` and `MatchLimitError` (a match that
80
+ reached its timeout or its cap on backtracking memory) are each a `CorvusRegexEcma262::Error`, a `StandardError`. A
81
+ string that is not valid in its encoding raises `ArgumentError`; one in another encoding, `EncodingError`.
82
+
83
+ **Threads.** A `Regex` is frozen and may be used from any number of threads. A string cannot change while a global
84
+ search walks it.
85
+
86
+ ## Benchmarks
87
+
88
+ The Industry workloads of dotnet/performance, this gem against Ruby's `Regexp` and V8, are on the central page,
89
+ [corvus-oss.org/corvus-regex-ecma262-benchmarks](https://corvus-oss.org/corvus-regex-ecma262-benchmarks/), measured
90
+ nightly on one runner with every other Corvus ECMA-262 engine.
91
+
92
+ ## Repository
93
+
94
+ - `ext/corvus_regex_ecma262`: the native extension (magnus, over the crate); `lib/`: the Ruby API.
95
+ - `test/`: the tests; `tools/dataset.rb`: the test-data runner (`ruby -Ilib tools/dataset.rb <data> wrong.tsv`).
96
+ - `tools/bench`: the benchmark harness and the script the image runs; `Dockerfile`: the image the central page runs.
97
+
98
+ ## Licence
99
+
100
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,16 @@
1
+ [package]
2
+ name = "corvus_regex_ecma262"
3
+ version = "0.1.1"
4
+ edition = "2024"
5
+ rust-version = "1.89"
6
+ description = "The native extension of the corvus_regex_ecma262 gem: the corvus-regex-ecma262 crate over Ruby strings."
7
+ license = "Apache-2.0"
8
+ publish = false
9
+
10
+ [lib]
11
+ crate-type = ["cdylib"]
12
+
13
+ [dependencies]
14
+ corvus-regex-ecma262 = "0.1.1"
15
+ magnus = { version = "0.9.1", features = ["rb-sys"] }
16
+ rb-sys = "0.9.130"
@@ -0,0 +1,2 @@
1
+ # Clippy suggests idioms by the minimum Rust version (rust-version in Cargo.toml).
2
+ msrv = "1.89"
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "mkmf"
4
+ require "rb_sys/mkmf"
5
+
6
+ create_rust_makefile("corvus_regex_ecma262/corvus_regex_ecma262")
@@ -0,0 +1,2 @@
1
+ max_width = 120
2
+ use_small_heuristics = "Max"