grex_ruby 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4a2dd5cd77e2c7169182cc883204cf332f79822fb906c459644b982f8a882614
4
+ data.tar.gz: e8dfeb8f839b02283c62e2f0fc4c25d54dc505c8e10952d4405113fb9a898094
5
+ SHA512:
6
+ metadata.gz: 695f7ea72cf70580dae52d2d755281e408cc357e6ca772fde12b10fca2aa4efbcd9d88933f2395e26fb5c25d126daa5775470aa28fa6ccb70bd910d6f507baa9
7
+ data.tar.gz: 1b1789d8ec092b42df5ecfd98fa8128412a22193c0e26c2890cf50ac325f4ca7bef79c7bd43ced3fc1121052ab783b1f272b207f4096104130e705d798aedb44
@@ -0,0 +1,26 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: ["3.2", "3.3", "3.4", "4.0"]
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby }}
17
+ bundler-cache: true
18
+ - uses: dtolnay/rust-toolchain@stable
19
+
20
+ - name: Install libclang
21
+ run: |
22
+ sudo apt-get update
23
+ sudo apt-get install -y libclang-dev
24
+
25
+ - name: Run tests
26
+ run: bundle exec rake
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Generate regular expression patterns from arrays of strings.
6
+ - Support digit and repetition conversion.
7
+ - Adapt digit classes for Unicode matching in Ruby.
data/Cargo.lock ADDED
@@ -0,0 +1,733 @@
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 = "anstream"
16
+ version = "1.0.0"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
19
+ dependencies = [
20
+ "anstyle",
21
+ "anstyle-parse",
22
+ "anstyle-query",
23
+ "anstyle-wincon",
24
+ "colorchoice",
25
+ "is_terminal_polyfill",
26
+ "utf8parse",
27
+ ]
28
+
29
+ [[package]]
30
+ name = "anstyle"
31
+ version = "1.0.14"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
34
+
35
+ [[package]]
36
+ name = "anstyle-parse"
37
+ version = "1.0.0"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
40
+ dependencies = [
41
+ "utf8parse",
42
+ ]
43
+
44
+ [[package]]
45
+ name = "anstyle-query"
46
+ version = "1.1.5"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
49
+ dependencies = [
50
+ "windows-sys",
51
+ ]
52
+
53
+ [[package]]
54
+ name = "anstyle-wincon"
55
+ version = "3.0.11"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
58
+ dependencies = [
59
+ "anstyle",
60
+ "once_cell_polyfill",
61
+ "windows-sys",
62
+ ]
63
+
64
+ [[package]]
65
+ name = "autocfg"
66
+ version = "1.5.1"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
69
+
70
+ [[package]]
71
+ name = "bindgen"
72
+ version = "0.72.1"
73
+ source = "registry+https://github.com/rust-lang/crates.io-index"
74
+ checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
75
+ dependencies = [
76
+ "bitflags",
77
+ "cexpr",
78
+ "clang-sys",
79
+ "itertools 0.13.0",
80
+ "proc-macro2",
81
+ "quote",
82
+ "regex",
83
+ "rustc-hash",
84
+ "shlex",
85
+ "syn 2.0.119",
86
+ ]
87
+
88
+ [[package]]
89
+ name = "bitflags"
90
+ version = "2.13.2"
91
+ source = "registry+https://github.com/rust-lang/crates.io-index"
92
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
93
+
94
+ [[package]]
95
+ name = "bumpalo"
96
+ version = "3.20.3"
97
+ source = "registry+https://github.com/rust-lang/crates.io-index"
98
+ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
99
+
100
+ [[package]]
101
+ name = "cexpr"
102
+ version = "0.6.0"
103
+ source = "registry+https://github.com/rust-lang/crates.io-index"
104
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
105
+ dependencies = [
106
+ "nom",
107
+ ]
108
+
109
+ [[package]]
110
+ name = "cfg-if"
111
+ version = "1.0.5"
112
+ source = "registry+https://github.com/rust-lang/crates.io-index"
113
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
114
+
115
+ [[package]]
116
+ name = "clang-sys"
117
+ version = "1.9.1"
118
+ source = "registry+https://github.com/rust-lang/crates.io-index"
119
+ checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
120
+ dependencies = [
121
+ "glob",
122
+ "libc",
123
+ "libloading",
124
+ ]
125
+
126
+ [[package]]
127
+ name = "clap"
128
+ version = "4.6.7"
129
+ source = "registry+https://github.com/rust-lang/crates.io-index"
130
+ checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946"
131
+ dependencies = [
132
+ "clap_builder",
133
+ "clap_derive",
134
+ ]
135
+
136
+ [[package]]
137
+ name = "clap_builder"
138
+ version = "4.6.7"
139
+ source = "registry+https://github.com/rust-lang/crates.io-index"
140
+ checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d"
141
+ dependencies = [
142
+ "anstream",
143
+ "anstyle",
144
+ "clap_lex",
145
+ "strsim",
146
+ "terminal_size",
147
+ ]
148
+
149
+ [[package]]
150
+ name = "clap_derive"
151
+ version = "4.6.7"
152
+ source = "registry+https://github.com/rust-lang/crates.io-index"
153
+ checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0"
154
+ dependencies = [
155
+ "heck",
156
+ "proc-macro2",
157
+ "quote",
158
+ "syn 3.0.9",
159
+ ]
160
+
161
+ [[package]]
162
+ name = "clap_lex"
163
+ version = "1.1.1"
164
+ source = "registry+https://github.com/rust-lang/crates.io-index"
165
+ checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486"
166
+
167
+ [[package]]
168
+ name = "colorchoice"
169
+ version = "1.0.5"
170
+ source = "registry+https://github.com/rust-lang/crates.io-index"
171
+ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
172
+
173
+ [[package]]
174
+ name = "either"
175
+ version = "1.19.0"
176
+ source = "registry+https://github.com/rust-lang/crates.io-index"
177
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
178
+
179
+ [[package]]
180
+ name = "equivalent"
181
+ version = "1.0.3"
182
+ source = "registry+https://github.com/rust-lang/crates.io-index"
183
+ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
184
+
185
+ [[package]]
186
+ name = "errno"
187
+ version = "0.3.14"
188
+ source = "registry+https://github.com/rust-lang/crates.io-index"
189
+ checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
190
+ dependencies = [
191
+ "libc",
192
+ "windows-sys",
193
+ ]
194
+
195
+ [[package]]
196
+ name = "fixedbitset"
197
+ version = "0.5.7"
198
+ source = "registry+https://github.com/rust-lang/crates.io-index"
199
+ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
200
+
201
+ [[package]]
202
+ name = "foldhash"
203
+ version = "0.1.5"
204
+ source = "registry+https://github.com/rust-lang/crates.io-index"
205
+ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
206
+
207
+ [[package]]
208
+ name = "glob"
209
+ version = "0.3.4"
210
+ source = "registry+https://github.com/rust-lang/crates.io-index"
211
+ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
212
+
213
+ [[package]]
214
+ name = "grex"
215
+ version = "1.4.6"
216
+ source = "registry+https://github.com/rust-lang/crates.io-index"
217
+ checksum = "4ada730ccbcaf2eaaf9d254661960b0211e042e031e307ba8fd39821307f46dd"
218
+ dependencies = [
219
+ "clap",
220
+ "itertools 0.14.0",
221
+ "ndarray",
222
+ "petgraph",
223
+ "regex",
224
+ "unicode-general-category",
225
+ "unicode-segmentation",
226
+ "wasm-bindgen",
227
+ ]
228
+
229
+ [[package]]
230
+ name = "grex_ruby"
231
+ version = "0.1.0"
232
+ dependencies = [
233
+ "grex",
234
+ "magnus",
235
+ "rb-sys",
236
+ "rb-sys-env",
237
+ ]
238
+
239
+ [[package]]
240
+ name = "hashbrown"
241
+ version = "0.15.5"
242
+ source = "registry+https://github.com/rust-lang/crates.io-index"
243
+ checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
244
+ dependencies = [
245
+ "foldhash",
246
+ ]
247
+
248
+ [[package]]
249
+ name = "hashbrown"
250
+ version = "0.17.1"
251
+ source = "registry+https://github.com/rust-lang/crates.io-index"
252
+ checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
253
+
254
+ [[package]]
255
+ name = "heck"
256
+ version = "0.5.0"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
259
+
260
+ [[package]]
261
+ name = "indexmap"
262
+ version = "2.14.2"
263
+ source = "registry+https://github.com/rust-lang/crates.io-index"
264
+ checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
265
+ dependencies = [
266
+ "equivalent",
267
+ "hashbrown 0.17.1",
268
+ ]
269
+
270
+ [[package]]
271
+ name = "is_terminal_polyfill"
272
+ version = "1.70.2"
273
+ source = "registry+https://github.com/rust-lang/crates.io-index"
274
+ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
275
+
276
+ [[package]]
277
+ name = "itertools"
278
+ version = "0.13.0"
279
+ source = "registry+https://github.com/rust-lang/crates.io-index"
280
+ checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
281
+ dependencies = [
282
+ "either",
283
+ ]
284
+
285
+ [[package]]
286
+ name = "itertools"
287
+ version = "0.14.0"
288
+ source = "registry+https://github.com/rust-lang/crates.io-index"
289
+ checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
290
+ dependencies = [
291
+ "either",
292
+ ]
293
+
294
+ [[package]]
295
+ name = "lazy_static"
296
+ version = "1.5.1"
297
+ source = "registry+https://github.com/rust-lang/crates.io-index"
298
+ checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
299
+
300
+ [[package]]
301
+ name = "libc"
302
+ version = "0.2.191"
303
+ source = "registry+https://github.com/rust-lang/crates.io-index"
304
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
305
+
306
+ [[package]]
307
+ name = "libloading"
308
+ version = "0.8.9"
309
+ source = "registry+https://github.com/rust-lang/crates.io-index"
310
+ checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
311
+ dependencies = [
312
+ "cfg-if",
313
+ "windows-link",
314
+ ]
315
+
316
+ [[package]]
317
+ name = "linux-raw-sys"
318
+ version = "0.12.1"
319
+ source = "registry+https://github.com/rust-lang/crates.io-index"
320
+ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
321
+
322
+ [[package]]
323
+ name = "magnus"
324
+ version = "0.9.3"
325
+ source = "registry+https://github.com/rust-lang/crates.io-index"
326
+ checksum = "40ef424404d166cbb71c8b8d19c9c589c748c4547c1afa1928c5504299f6c713"
327
+ dependencies = [
328
+ "magnus-macros",
329
+ "rb-sys",
330
+ "rb-sys-env",
331
+ "seq-macro",
332
+ ]
333
+
334
+ [[package]]
335
+ name = "magnus-macros"
336
+ version = "0.9.1"
337
+ source = "registry+https://github.com/rust-lang/crates.io-index"
338
+ checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
339
+ dependencies = [
340
+ "proc-macro2",
341
+ "quote",
342
+ "syn 2.0.119",
343
+ ]
344
+
345
+ [[package]]
346
+ name = "matrixmultiply"
347
+ version = "0.3.11"
348
+ source = "registry+https://github.com/rust-lang/crates.io-index"
349
+ checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
350
+ dependencies = [
351
+ "autocfg",
352
+ "rawpointer",
353
+ ]
354
+
355
+ [[package]]
356
+ name = "memchr"
357
+ version = "2.8.3"
358
+ source = "registry+https://github.com/rust-lang/crates.io-index"
359
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
360
+
361
+ [[package]]
362
+ name = "minimal-lexical"
363
+ version = "0.2.1"
364
+ source = "registry+https://github.com/rust-lang/crates.io-index"
365
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
366
+
367
+ [[package]]
368
+ name = "ndarray"
369
+ version = "0.17.2"
370
+ source = "registry+https://github.com/rust-lang/crates.io-index"
371
+ checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d"
372
+ dependencies = [
373
+ "matrixmultiply",
374
+ "num-complex",
375
+ "num-integer",
376
+ "num-traits",
377
+ "portable-atomic",
378
+ "portable-atomic-util",
379
+ "rawpointer",
380
+ ]
381
+
382
+ [[package]]
383
+ name = "nom"
384
+ version = "7.1.3"
385
+ source = "registry+https://github.com/rust-lang/crates.io-index"
386
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
387
+ dependencies = [
388
+ "memchr",
389
+ "minimal-lexical",
390
+ ]
391
+
392
+ [[package]]
393
+ name = "num-complex"
394
+ version = "0.4.6"
395
+ source = "registry+https://github.com/rust-lang/crates.io-index"
396
+ checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
397
+ dependencies = [
398
+ "num-traits",
399
+ ]
400
+
401
+ [[package]]
402
+ name = "num-integer"
403
+ version = "0.1.47"
404
+ source = "registry+https://github.com/rust-lang/crates.io-index"
405
+ checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
406
+ dependencies = [
407
+ "num-traits",
408
+ ]
409
+
410
+ [[package]]
411
+ name = "num-traits"
412
+ version = "0.2.19"
413
+ source = "registry+https://github.com/rust-lang/crates.io-index"
414
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
415
+ dependencies = [
416
+ "autocfg",
417
+ ]
418
+
419
+ [[package]]
420
+ name = "once_cell"
421
+ version = "1.21.4"
422
+ source = "registry+https://github.com/rust-lang/crates.io-index"
423
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
424
+
425
+ [[package]]
426
+ name = "once_cell_polyfill"
427
+ version = "1.70.2"
428
+ source = "registry+https://github.com/rust-lang/crates.io-index"
429
+ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
430
+
431
+ [[package]]
432
+ name = "petgraph"
433
+ version = "0.8.3"
434
+ source = "registry+https://github.com/rust-lang/crates.io-index"
435
+ checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
436
+ dependencies = [
437
+ "fixedbitset",
438
+ "hashbrown 0.15.5",
439
+ "indexmap",
440
+ "serde",
441
+ ]
442
+
443
+ [[package]]
444
+ name = "portable-atomic"
445
+ version = "1.15.0"
446
+ source = "registry+https://github.com/rust-lang/crates.io-index"
447
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
448
+
449
+ [[package]]
450
+ name = "portable-atomic-util"
451
+ version = "0.2.8"
452
+ source = "registry+https://github.com/rust-lang/crates.io-index"
453
+ checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
454
+ dependencies = [
455
+ "portable-atomic",
456
+ ]
457
+
458
+ [[package]]
459
+ name = "proc-macro2"
460
+ version = "1.0.107"
461
+ source = "registry+https://github.com/rust-lang/crates.io-index"
462
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
463
+ dependencies = [
464
+ "unicode-ident",
465
+ ]
466
+
467
+ [[package]]
468
+ name = "quote"
469
+ version = "1.0.47"
470
+ source = "registry+https://github.com/rust-lang/crates.io-index"
471
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
472
+ dependencies = [
473
+ "proc-macro2",
474
+ ]
475
+
476
+ [[package]]
477
+ name = "rawpointer"
478
+ version = "0.2.1"
479
+ source = "registry+https://github.com/rust-lang/crates.io-index"
480
+ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
481
+
482
+ [[package]]
483
+ name = "rb-sys"
484
+ version = "0.9.130"
485
+ source = "registry+https://github.com/rust-lang/crates.io-index"
486
+ checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
487
+ dependencies = [
488
+ "rb-sys-build",
489
+ ]
490
+
491
+ [[package]]
492
+ name = "rb-sys-build"
493
+ version = "0.9.130"
494
+ source = "registry+https://github.com/rust-lang/crates.io-index"
495
+ checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
496
+ dependencies = [
497
+ "bindgen",
498
+ "lazy_static",
499
+ "proc-macro2",
500
+ "quote",
501
+ "regex",
502
+ "shell-words",
503
+ "syn 2.0.119",
504
+ ]
505
+
506
+ [[package]]
507
+ name = "rb-sys-env"
508
+ version = "0.2.3"
509
+ source = "registry+https://github.com/rust-lang/crates.io-index"
510
+ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
511
+
512
+ [[package]]
513
+ name = "regex"
514
+ version = "1.13.1"
515
+ source = "registry+https://github.com/rust-lang/crates.io-index"
516
+ checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
517
+ dependencies = [
518
+ "aho-corasick",
519
+ "memchr",
520
+ "regex-automata",
521
+ "regex-syntax",
522
+ ]
523
+
524
+ [[package]]
525
+ name = "regex-automata"
526
+ version = "0.4.18"
527
+ source = "registry+https://github.com/rust-lang/crates.io-index"
528
+ checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
529
+ dependencies = [
530
+ "aho-corasick",
531
+ "memchr",
532
+ "regex-syntax",
533
+ ]
534
+
535
+ [[package]]
536
+ name = "regex-syntax"
537
+ version = "0.8.11"
538
+ source = "registry+https://github.com/rust-lang/crates.io-index"
539
+ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
540
+
541
+ [[package]]
542
+ name = "rustc-hash"
543
+ version = "2.1.3"
544
+ source = "registry+https://github.com/rust-lang/crates.io-index"
545
+ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
546
+
547
+ [[package]]
548
+ name = "rustix"
549
+ version = "1.1.6"
550
+ source = "registry+https://github.com/rust-lang/crates.io-index"
551
+ checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"
552
+ dependencies = [
553
+ "bitflags",
554
+ "errno",
555
+ "libc",
556
+ "linux-raw-sys",
557
+ "windows-sys",
558
+ ]
559
+
560
+ [[package]]
561
+ name = "rustversion"
562
+ version = "1.0.23"
563
+ source = "registry+https://github.com/rust-lang/crates.io-index"
564
+ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
565
+
566
+ [[package]]
567
+ name = "seq-macro"
568
+ version = "0.3.6"
569
+ source = "registry+https://github.com/rust-lang/crates.io-index"
570
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
571
+
572
+ [[package]]
573
+ name = "serde"
574
+ version = "1.0.229"
575
+ source = "registry+https://github.com/rust-lang/crates.io-index"
576
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
577
+ dependencies = [
578
+ "serde_core",
579
+ ]
580
+
581
+ [[package]]
582
+ name = "serde_core"
583
+ version = "1.0.229"
584
+ source = "registry+https://github.com/rust-lang/crates.io-index"
585
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
586
+ dependencies = [
587
+ "serde_derive",
588
+ ]
589
+
590
+ [[package]]
591
+ name = "serde_derive"
592
+ version = "1.0.229"
593
+ source = "registry+https://github.com/rust-lang/crates.io-index"
594
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
595
+ dependencies = [
596
+ "proc-macro2",
597
+ "quote",
598
+ "syn 3.0.9",
599
+ ]
600
+
601
+ [[package]]
602
+ name = "shell-words"
603
+ version = "1.1.1"
604
+ source = "registry+https://github.com/rust-lang/crates.io-index"
605
+ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
606
+
607
+ [[package]]
608
+ name = "shlex"
609
+ version = "1.3.0"
610
+ source = "registry+https://github.com/rust-lang/crates.io-index"
611
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
612
+
613
+ [[package]]
614
+ name = "strsim"
615
+ version = "0.11.1"
616
+ source = "registry+https://github.com/rust-lang/crates.io-index"
617
+ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
618
+
619
+ [[package]]
620
+ name = "syn"
621
+ version = "2.0.119"
622
+ source = "registry+https://github.com/rust-lang/crates.io-index"
623
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
624
+ dependencies = [
625
+ "proc-macro2",
626
+ "quote",
627
+ "unicode-ident",
628
+ ]
629
+
630
+ [[package]]
631
+ name = "syn"
632
+ version = "3.0.9"
633
+ source = "registry+https://github.com/rust-lang/crates.io-index"
634
+ checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
635
+ dependencies = [
636
+ "proc-macro2",
637
+ "quote",
638
+ "unicode-ident",
639
+ ]
640
+
641
+ [[package]]
642
+ name = "terminal_size"
643
+ version = "0.4.4"
644
+ source = "registry+https://github.com/rust-lang/crates.io-index"
645
+ checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874"
646
+ dependencies = [
647
+ "rustix",
648
+ "windows-sys",
649
+ ]
650
+
651
+ [[package]]
652
+ name = "unicode-general-category"
653
+ version = "1.1.0"
654
+ source = "registry+https://github.com/rust-lang/crates.io-index"
655
+ checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f"
656
+
657
+ [[package]]
658
+ name = "unicode-ident"
659
+ version = "1.0.27"
660
+ source = "registry+https://github.com/rust-lang/crates.io-index"
661
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
662
+
663
+ [[package]]
664
+ name = "unicode-segmentation"
665
+ version = "1.13.3"
666
+ source = "registry+https://github.com/rust-lang/crates.io-index"
667
+ checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
668
+
669
+ [[package]]
670
+ name = "utf8parse"
671
+ version = "0.2.2"
672
+ source = "registry+https://github.com/rust-lang/crates.io-index"
673
+ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
674
+
675
+ [[package]]
676
+ name = "wasm-bindgen"
677
+ version = "0.2.129"
678
+ source = "registry+https://github.com/rust-lang/crates.io-index"
679
+ checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"
680
+ dependencies = [
681
+ "cfg-if",
682
+ "once_cell",
683
+ "rustversion",
684
+ "wasm-bindgen-macro",
685
+ "wasm-bindgen-shared",
686
+ ]
687
+
688
+ [[package]]
689
+ name = "wasm-bindgen-macro"
690
+ version = "0.2.129"
691
+ source = "registry+https://github.com/rust-lang/crates.io-index"
692
+ checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"
693
+ dependencies = [
694
+ "quote",
695
+ "wasm-bindgen-macro-support",
696
+ ]
697
+
698
+ [[package]]
699
+ name = "wasm-bindgen-macro-support"
700
+ version = "0.2.129"
701
+ source = "registry+https://github.com/rust-lang/crates.io-index"
702
+ checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"
703
+ dependencies = [
704
+ "bumpalo",
705
+ "proc-macro2",
706
+ "quote",
707
+ "syn 3.0.9",
708
+ "wasm-bindgen-shared",
709
+ ]
710
+
711
+ [[package]]
712
+ name = "wasm-bindgen-shared"
713
+ version = "0.2.129"
714
+ source = "registry+https://github.com/rust-lang/crates.io-index"
715
+ checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"
716
+ dependencies = [
717
+ "unicode-ident",
718
+ ]
719
+
720
+ [[package]]
721
+ name = "windows-link"
722
+ version = "0.2.1"
723
+ source = "registry+https://github.com/rust-lang/crates.io-index"
724
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
725
+
726
+ [[package]]
727
+ name = "windows-sys"
728
+ version = "0.61.2"
729
+ source = "registry+https://github.com/rust-lang/crates.io-index"
730
+ checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
731
+ dependencies = [
732
+ "windows-link",
733
+ ]
data/Cargo.toml ADDED
@@ -0,0 +1,13 @@
1
+ # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
+ # a Rust project. Your extensions dependencies should be added to the Cargo.toml
3
+ # in the ext/ directory.
4
+
5
+ [workspace]
6
+ members = ["./ext/grex_ruby"]
7
+ resolver = "2"
8
+
9
+ [profile.release]
10
+ # By default, debug symbols are stripped from the final binary which makes it
11
+ # harder to debug if something goes wrong. It's recommended to keep debug
12
+ # symbols in the release build so that you can debug the final binary if needed.
13
+ debug = true
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nelly Simkova
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # GrexRuby
2
+
3
+ GrexRuby provides Ruby bindings for the Rust library [grex](https://github.com/pemistahl/grex).
4
+ It generates a regular expression pattern from an array of example strings.
5
+
6
+ ## Installation
7
+
8
+ The gem is not published yet. To build it locally, follow the development instructions below.
9
+
10
+ ## Usage
11
+
12
+ `GrexRuby.generate` accepts a non-empty array of strings and returns a Ruby `String`.
13
+
14
+ ```ruby
15
+ require 'grex_ruby'
16
+
17
+ GrexRuby.generate(%w[a aa aaa])
18
+ # => "^a(?:aa?)?$"
19
+
20
+ GrexRuby.generate(%w[cat])
21
+ # => "^cat$"
22
+ ```
23
+
24
+ Both keyword options default to `false`:
25
+
26
+ | Option | Behavior when enabled |
27
+ | --- | --- |
28
+ | `convert_digits` | Generalizes decimal digits to the Unicode digit class `\p{Nd}`. |
29
+ | `convert_repetitions` | Converts repeated substrings to quantifiers such as `{3}`. |
30
+
31
+ ```ruby
32
+ GrexRuby.generate(%w[123])
33
+ # => "^123$"
34
+
35
+ GrexRuby.generate(%w[123], convert_digits: true)
36
+ # => "^\\p{Nd}\\p{Nd}\\p{Nd}$"
37
+
38
+ GrexRuby.generate(['aaa'], convert_repetitions: true)
39
+ # => "^a{3}$"
40
+
41
+ GrexRuby.generate(['111'], convert_digits: true, convert_repetitions: true)
42
+ # => "^\\p{Nd}{3}$"
43
+ ```
44
+
45
+ Digit conversion allows other decimal digits to match too, including non-ASCII
46
+ digits. GrexRuby adapts grex's `\d` tokens to `\p{Nd}` because Ruby's `\d` matches
47
+ only ASCII digits.
48
+
49
+ Pass the returned pattern to `Regexp.new` to match strings. Special characters
50
+ in the examples, such as the dot below, are escaped:
51
+
52
+ ```ruby
53
+ pattern = GrexRuby.generate(['a.b'])
54
+ # => "^a\\.b$"
55
+
56
+ regexp = Regexp.new(pattern)
57
+
58
+ regexp.match?('a.b')
59
+ # => true
60
+
61
+ regexp.match?('axb')
62
+ # => false
63
+ ```
64
+
65
+ An empty array raises `ArgumentError` with the message `samples must not be empty`.
66
+ Passing a string instead of an array, or an array containing an integer, raises
67
+ `TypeError`.
68
+
69
+ ## Development
70
+
71
+ ### Linux
72
+
73
+ Use Ruby 3.2 or newer, Bundler, and a current stable Rust toolchain installed
74
+ via [rustup](https://rustup.rs/). Run the build commands from the project directory.
75
+
76
+ Install a C/C++ compiler, Make, pkg-config, and libclang.
77
+
78
+ On Ubuntu/Debian:
79
+
80
+ ```bash
81
+ sudo apt update
82
+ sudo apt install build-essential pkg-config libclang-dev
83
+ ```
84
+
85
+ On Fedora:
86
+
87
+ ```bash
88
+ sudo dnf install gcc gcc-c++ make pkgconf-pkg-config clang-devel
89
+ ```
90
+
91
+ Ruby's development headers must match the Ruby used to build the extension.
92
+ If using the distribution's Ruby, also install `ruby-dev` on Ubuntu/Debian
93
+ or `ruby-devel` on Fedora. Check `ruby -v`: some distribution releases provide
94
+ a Ruby version older than this gem supports. Ruby installed through a version
95
+ manager usually already includes matching headers.
96
+
97
+ Install Bundler if needed, then install the gem dependencies, compile, and run RSpec:
98
+
99
+ ```bash
100
+ gem install bundler
101
+ bundle install
102
+ bundle exec rake
103
+ ```
104
+
105
+ Use the default native Linux Rust target. The Windows `RUST_TARGET` setting
106
+ and `ridk.cmd` are not needed. With the packages above, libclang should be
107
+ discovered automatically; if it is installed in a custom location, set
108
+ `LIBCLANG_PATH` to the directory containing `libclang.so`.
109
+
110
+ See the [bindgen requirements](https://rust-lang.github.io/rust-bindgen/requirements.html)
111
+ for libclang installation details.
112
+
113
+ ### Windows (64-bit RubyInstaller with UCRT)
114
+
115
+ Install RubyInstaller with Devkit and Rust via rustup before running these commands.
116
+ Run the commands from the project directory in PowerShell.
117
+
118
+ Update the MSYS2 environment used by RubyInstaller:
119
+
120
+ ```powershell
121
+ ridk.cmd exec pacman -Syu
122
+ ```
123
+
124
+ If the update asks you to close the terminal, open a new PowerShell and run the
125
+ same command again to finish updating the remaining packages.
126
+
127
+ Install Clang (including libclang, used to read Ruby's C headers), the Rust GNU
128
+ target matching RubyInstaller, and the Ruby dependencies:
129
+
130
+ ```powershell
131
+ ridk.cmd exec pacman -S mingw-w64-ucrt-x86_64-clang
132
+ rustup target add x86_64-pc-windows-gnu
133
+ bundle install
134
+ ```
135
+
136
+ Set the build environment, then compile the extension and run RSpec:
137
+
138
+ ```powershell
139
+ # Adjust this path if RubyInstaller is installed elsewhere.
140
+ $env:LIBCLANG_PATH = "C:\Ruby40-x64\msys64\ucrt64\bin"
141
+ $env:RUST_TARGET = "x86_64-pc-windows-gnu"
142
+ ridk.cmd exec bundle exec rake
143
+ ```
144
+
145
+ Set these environment variables again when opening a new PowerShell session.
146
+ Use `ridk.cmd exec` to select RubyInstaller's build tools when other MSYS2
147
+ installations, such as devkitPro, are also present.
148
+
149
+ `bundle exec rake` compiles the extension before running the tests;
150
+ `bundle exec rake spec` only runs the tests and requires an existing build.
151
+
152
+ ### Build a local gem
153
+
154
+ ```bash
155
+ bundle exec rake build
156
+ ```
157
+
158
+ The package is written to `pkg/grex_ruby-<version>.gem`. On Windows, run the
159
+ command through `ridk.cmd exec` with the environment variables shown above.
160
+
161
+ ## Contributing
162
+
163
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sk8higher/grex_ruby.
164
+
165
+ ## License
166
+
167
+ GrexRuby is available under the [MIT License](LICENSE.txt).
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rb_sys/extensiontask"
9
+
10
+ task build: :compile
11
+
12
+ GEMSPEC = Gem::Specification.load("grex_ruby.gemspec")
13
+
14
+ RbSys::ExtensionTask.new("grex_ruby", GEMSPEC) do |ext|
15
+ ext.lib_dir = "lib/grex_ruby"
16
+ end
17
+
18
+ task default: %i[compile spec]
@@ -0,0 +1,17 @@
1
+ [package]
2
+ name = "grex_ruby"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ authors = ["Nelly Simkova <sk8high3r@ya.ru>"]
6
+ publish = false
7
+
8
+ [lib]
9
+ crate-type = ["cdylib"]
10
+
11
+ [dependencies]
12
+ magnus = { version = "0.9" }
13
+ rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
14
+ grex = "1.4.6"
15
+
16
+ [build-dependencies]
17
+ rb-sys-env = "0.2.2"
@@ -0,0 +1,5 @@
1
+ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
2
+ let _ = rb_sys_env::activate()?;
3
+
4
+ Ok(())
5
+ }
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "mkmf"
4
+ require "rb_sys/mkmf"
5
+
6
+ create_rust_makefile("grex_ruby/grex_ruby")
@@ -0,0 +1,34 @@
1
+ use grex::RegExpBuilder;
2
+ use magnus::{function, prelude::*, Error, Ruby};
3
+
4
+ pub fn generate(
5
+ ruby: &Ruby,
6
+ samples: Vec<String>,
7
+ convert_digits: bool,
8
+ convert_repetitions: bool,
9
+ ) -> Result<String, Error> {
10
+ if samples.is_empty() {
11
+ return Err(Error::new(
12
+ ruby.exception_arg_error(),
13
+ "samples must not be empty",
14
+ ));
15
+ }
16
+ let mut builder = RegExpBuilder::from(&samples);
17
+
18
+ if convert_digits {
19
+ builder.with_conversion_of_digits();
20
+ }
21
+
22
+ if convert_repetitions {
23
+ builder.with_conversion_of_repetitions();
24
+ }
25
+
26
+ Ok(builder.build())
27
+ }
28
+
29
+ #[magnus::init]
30
+ fn init(ruby: &Ruby) -> Result<(), Error> {
31
+ let module = ruby.define_module("GrexRuby")?;
32
+ module.define_singleton_method("generate_native", function!(generate, 3))?;
33
+ Ok(())
34
+ }
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrexRuby
4
+ VERSION = "0.1.0"
5
+ end
data/lib/grex_ruby.rb ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'grex_ruby/version'
4
+ require 'grex_ruby/grex_ruby'
5
+
6
+ module GrexRuby
7
+ class Error < StandardError; end
8
+
9
+ def self.generate(samples, convert_digits: false, convert_repetitions: false)
10
+ pattern = generate_native(samples, convert_digits, convert_repetitions)
11
+ adapt_pattern(pattern)
12
+ end
13
+
14
+ def self.adapt_pattern(pattern)
15
+ chars = pattern.chars
16
+ result = +''
17
+ index = 0
18
+
19
+ while index < chars.length
20
+ if chars[index] == '\\'
21
+ result << if chars[index + 1] == 'd'
22
+ '\p{Nd}'
23
+ else
24
+ chars[index, 2].join
25
+ end
26
+ index += 2
27
+ else
28
+ result << chars[index]
29
+ index += 1
30
+ end
31
+ end
32
+
33
+ result
34
+ end
35
+
36
+ private_class_method :generate_native, :adapt_pattern
37
+ end
data/sig/grex_ruby.rbs ADDED
@@ -0,0 +1,5 @@
1
+ module GrexRuby
2
+ VERSION: String
3
+
4
+ def self.generate: (Array[String], ?convert_digits: bool, ?convert_repetitions: bool) -> String
5
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grex_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nelly Simkova
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rb_sys
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 0.9.128
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.9.128
26
+ email:
27
+ - sk8high3r@ya.ru
28
+ executables: []
29
+ extensions:
30
+ - ext/grex_ruby/extconf.rb
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".github/workflows/ci.yml"
34
+ - CHANGELOG.md
35
+ - Cargo.lock
36
+ - Cargo.toml
37
+ - LICENSE.txt
38
+ - README.md
39
+ - Rakefile
40
+ - ext/grex_ruby/Cargo.toml
41
+ - ext/grex_ruby/build.rs
42
+ - ext/grex_ruby/extconf.rb
43
+ - ext/grex_ruby/src/lib.rs
44
+ - lib/grex_ruby.rb
45
+ - lib/grex_ruby/version.rb
46
+ - sig/grex_ruby.rbs
47
+ homepage: https://github.com/sk8higher/grex_ruby
48
+ licenses:
49
+ - MIT
50
+ metadata: {}
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 3.2.0
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 4.0.22
66
+ specification_version: 4
67
+ summary: Ruby gem with bindings for Grex Rust library.
68
+ test_files: []