rregex 1.10.12 → 1.12.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.
- package/lib/cf.d.ts +655 -658
- package/lib/cf.mjs +2 -2
- package/lib/commonjs.cjs +792 -945
- package/lib/commonjs.d.cts +1257 -0
- package/lib/esm.d.ts +621 -628
- package/lib/esm.mjs +794 -946
- package/lib/rregex.wasm +0 -0
- package/lib/rregex.wasm.d.ts +34 -30
- package/lib/standalone.d.ts +653 -656
- package/lib/standalone.js +1011 -1148
- package/lib/types.d.ts +655 -658
- package/lib/web.d.ts +655 -658
- package/lib/web.js +821 -958
- package/package.json +22 -4
- package/lib/commonjs.d.ts +0 -1264
package/lib/esm.mjs
CHANGED
|
@@ -1,51 +1,37 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let heap_next = heap.length;
|
|
9
|
-
|
|
10
|
-
function addHeapObject(obj) {
|
|
11
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
12
|
-
const idx = heap_next;
|
|
13
|
-
heap_next = heap[idx];
|
|
14
|
-
|
|
15
|
-
heap[idx] = obj;
|
|
4
|
+
function addToExternrefTable0(obj) {
|
|
5
|
+
const idx = wasm.__externref_table_alloc();
|
|
6
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
16
7
|
return idx;
|
|
17
8
|
}
|
|
18
9
|
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function takeObject(idx) {
|
|
28
|
-
const ret = getObject(idx);
|
|
29
|
-
dropObject(idx);
|
|
30
|
-
return ret;
|
|
10
|
+
function handleError(f, args) {
|
|
11
|
+
try {
|
|
12
|
+
return f.apply(this, args);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
const idx = addToExternrefTable0(e);
|
|
15
|
+
wasm.__wbindgen_exn_store(idx);
|
|
16
|
+
}
|
|
31
17
|
}
|
|
32
18
|
|
|
33
19
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
34
20
|
|
|
35
21
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
36
22
|
|
|
37
|
-
let
|
|
23
|
+
let cachedUint8ArrayMemory0 = null;
|
|
38
24
|
|
|
39
|
-
function
|
|
40
|
-
if (
|
|
41
|
-
|
|
25
|
+
function getUint8ArrayMemory0() {
|
|
26
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
27
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
42
28
|
}
|
|
43
|
-
return
|
|
29
|
+
return cachedUint8ArrayMemory0;
|
|
44
30
|
}
|
|
45
31
|
|
|
46
32
|
function getStringFromWasm0(ptr, len) {
|
|
47
33
|
ptr = ptr >>> 0;
|
|
48
|
-
return cachedTextDecoder.decode(
|
|
34
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
49
35
|
}
|
|
50
36
|
|
|
51
37
|
let WASM_VECTOR_LEN = 0;
|
|
@@ -61,7 +47,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
61
47
|
if (realloc === undefined) {
|
|
62
48
|
const buf = cachedTextEncoder.encode(arg);
|
|
63
49
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
64
|
-
|
|
50
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
65
51
|
WASM_VECTOR_LEN = buf.length;
|
|
66
52
|
return ptr;
|
|
67
53
|
}
|
|
@@ -69,7 +55,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
69
55
|
let len = arg.length;
|
|
70
56
|
let ptr = malloc(len, 1) >>> 0;
|
|
71
57
|
|
|
72
|
-
const mem =
|
|
58
|
+
const mem = getUint8ArrayMemory0();
|
|
73
59
|
|
|
74
60
|
let offset = 0;
|
|
75
61
|
|
|
@@ -84,7 +70,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
84
70
|
arg = arg.slice(offset);
|
|
85
71
|
}
|
|
86
72
|
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
87
|
-
const view =
|
|
73
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
88
74
|
const ret = encodeString(arg, view);
|
|
89
75
|
|
|
90
76
|
offset += ret.written;
|
|
@@ -99,121 +85,98 @@ function isLikeNone(x) {
|
|
|
99
85
|
return x === undefined || x === null;
|
|
100
86
|
}
|
|
101
87
|
|
|
102
|
-
let
|
|
88
|
+
let cachedDataViewMemory0 = null;
|
|
103
89
|
|
|
104
|
-
function
|
|
105
|
-
if (
|
|
106
|
-
|
|
90
|
+
function getDataViewMemory0() {
|
|
91
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
92
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
107
93
|
}
|
|
108
|
-
return
|
|
94
|
+
return cachedDataViewMemory0;
|
|
109
95
|
}
|
|
110
96
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
|
116
|
-
}
|
|
117
|
-
return cachedUint32Memory0;
|
|
97
|
+
function takeFromExternrefTable0(idx) {
|
|
98
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
99
|
+
wasm.__externref_table_dealloc(idx);
|
|
100
|
+
return value;
|
|
118
101
|
}
|
|
119
102
|
|
|
120
103
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
121
104
|
ptr = ptr >>> 0;
|
|
122
|
-
const mem =
|
|
123
|
-
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
|
105
|
+
const mem = getDataViewMemory0();
|
|
124
106
|
const result = [];
|
|
125
|
-
for (let i =
|
|
126
|
-
result.push(
|
|
107
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
108
|
+
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
127
109
|
}
|
|
110
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
128
111
|
return result;
|
|
129
112
|
}
|
|
130
|
-
|
|
131
|
-
let stack_pointer = 128;
|
|
132
|
-
|
|
133
|
-
function addBorrowedObject(obj) {
|
|
134
|
-
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
135
|
-
heap[--stack_pointer] = obj;
|
|
136
|
-
return stack_pointer;
|
|
137
|
-
}
|
|
138
113
|
/**
|
|
139
|
-
* Escapes all regular expression meta characters in `text`.
|
|
140
|
-
*
|
|
141
|
-
* The string returned may be safely used as a literal in a regular
|
|
142
|
-
* expression.
|
|
143
|
-
* @param {string} text
|
|
144
|
-
* @returns {string}
|
|
145
|
-
*/
|
|
114
|
+
* Escapes all regular expression meta characters in `text`.
|
|
115
|
+
*
|
|
116
|
+
* The string returned may be safely used as a literal in a regular
|
|
117
|
+
* expression.
|
|
118
|
+
* @param {string} text
|
|
119
|
+
* @returns {string}
|
|
120
|
+
*/
|
|
146
121
|
export function escape(text) {
|
|
147
122
|
let deferred2_0;
|
|
148
123
|
let deferred2_1;
|
|
149
124
|
try {
|
|
150
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
151
125
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
152
126
|
const len0 = WASM_VECTOR_LEN;
|
|
153
|
-
wasm.escape(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
deferred2_1 = r1;
|
|
158
|
-
return getStringFromWasm0(r0, r1);
|
|
127
|
+
const ret = wasm.escape(ptr0, len0);
|
|
128
|
+
deferred2_0 = ret[0];
|
|
129
|
+
deferred2_1 = ret[1];
|
|
130
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
159
131
|
} finally {
|
|
160
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
161
132
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
162
133
|
}
|
|
163
134
|
}
|
|
164
135
|
|
|
165
|
-
function handleError(f, args) {
|
|
166
|
-
try {
|
|
167
|
-
return f.apply(this, args);
|
|
168
|
-
} catch (e) {
|
|
169
|
-
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
136
|
const RRegexFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
174
137
|
? { register: () => {}, unregister: () => {} }
|
|
175
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_rregex_free(ptr >>> 0));
|
|
138
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_rregex_free(ptr >>> 0, 1));
|
|
176
139
|
/**
|
|
177
|
-
* A compiled regular expression for matching Unicode strings.
|
|
178
|
-
*
|
|
179
|
-
* A `RRegex` can be used to search haystacks, split haystacks into substrings
|
|
180
|
-
* or replace substrings in a haystack with a different substring. All
|
|
181
|
-
* searching is done with an implicit `(?s:.)*?` at the beginning and end of
|
|
182
|
-
* an pattern. To force an expression to match the whole string (or a prefix
|
|
183
|
-
* or a suffix), you must use an anchor like `^` or `$` (or `\A` and `\z`).
|
|
184
|
-
*
|
|
185
|
-
* While this library will handle Unicode strings (whether in the regular
|
|
186
|
-
* expression or in the haystack), all positions returned are **byte
|
|
187
|
-
* offsets**. Every byte offset is guaranteed to be at a Unicode code point
|
|
188
|
-
* boundary. That is, all offsets returned by the `RRegex` API are guaranteed
|
|
189
|
-
* to be ranges that can slice an `Uint8Array` created with a TextEncoder.
|
|
190
|
-
*
|
|
191
|
-
* # Example: slicing over UTF strings
|
|
192
|
-
*
|
|
193
|
-
* ```typescript
|
|
194
|
-
* import { RRegex } from "rregex"
|
|
195
|
-
*
|
|
196
|
-
* const re = new RRegex("ä")
|
|
197
|
-
* const m = re.find("äöü") // { start: 0, end: 2 }
|
|
198
|
-
*
|
|
199
|
-
* const buff = new TextEncoder().encode("äöü")
|
|
200
|
-
* const slice = buff.slice(m.start, m.end)
|
|
201
|
-
* expect(new TextDecoder().decode(slice)).toBe("ä")
|
|
202
|
-
* ```
|
|
203
|
-
*
|
|
204
|
-
* # Example: find the offsets of a US phone number:
|
|
205
|
-
*
|
|
206
|
-
* ```typescript
|
|
207
|
-
* import { RRegex } from "rregex"
|
|
208
|
-
*
|
|
209
|
-
* const re = new RRegex("[0-9]{3}-[0-9]{3}-[0-9]{4}");
|
|
210
|
-
* const m = re.find("phone: 111-222-3333");
|
|
211
|
-
* expect(m.start).toBe(7);
|
|
212
|
-
* expect(m.end).toBe(19);
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
|
-
* @see https://docs.rs/regex/latest/regex/
|
|
216
|
-
*/
|
|
140
|
+
* A compiled regular expression for matching Unicode strings.
|
|
141
|
+
*
|
|
142
|
+
* A `RRegex` can be used to search haystacks, split haystacks into substrings
|
|
143
|
+
* or replace substrings in a haystack with a different substring. All
|
|
144
|
+
* searching is done with an implicit `(?s:.)*?` at the beginning and end of
|
|
145
|
+
* an pattern. To force an expression to match the whole string (or a prefix
|
|
146
|
+
* or a suffix), you must use an anchor like `^` or `$` (or `\A` and `\z`).
|
|
147
|
+
*
|
|
148
|
+
* While this library will handle Unicode strings (whether in the regular
|
|
149
|
+
* expression or in the haystack), all positions returned are **byte
|
|
150
|
+
* offsets**. Every byte offset is guaranteed to be at a Unicode code point
|
|
151
|
+
* boundary. That is, all offsets returned by the `RRegex` API are guaranteed
|
|
152
|
+
* to be ranges that can slice an `Uint8Array` created with a TextEncoder.
|
|
153
|
+
*
|
|
154
|
+
* # Example: slicing over UTF strings
|
|
155
|
+
*
|
|
156
|
+
* ```typescript
|
|
157
|
+
* import { RRegex } from "rregex"
|
|
158
|
+
*
|
|
159
|
+
* const re = new RRegex("ä")
|
|
160
|
+
* const m = re.find("äöü") // { start: 0, end: 2 }
|
|
161
|
+
*
|
|
162
|
+
* const buff = new TextEncoder().encode("äöü")
|
|
163
|
+
* const slice = buff.slice(m.start, m.end)
|
|
164
|
+
* expect(new TextDecoder().decode(slice)).toBe("ä")
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* # Example: find the offsets of a US phone number:
|
|
168
|
+
*
|
|
169
|
+
* ```typescript
|
|
170
|
+
* import { RRegex } from "rregex"
|
|
171
|
+
*
|
|
172
|
+
* const re = new RRegex("[0-9]{3}-[0-9]{3}-[0-9]{4}");
|
|
173
|
+
* const m = re.find("phone: 111-222-3333");
|
|
174
|
+
* expect(m.start).toBe(7);
|
|
175
|
+
* expect(m.end).toBe(19);
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @see https://docs.rs/regex/latest/regex/
|
|
179
|
+
*/
|
|
217
180
|
export class RRegex {
|
|
218
181
|
|
|
219
182
|
__destroy_into_raw() {
|
|
@@ -225,74 +188,19 @@ export class RRegex {
|
|
|
225
188
|
|
|
226
189
|
free() {
|
|
227
190
|
const ptr = this.__destroy_into_raw();
|
|
228
|
-
wasm.__wbg_rregex_free(ptr);
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Compiles a regular expression. Once compiled, it can be used repeatedly
|
|
232
|
-
* to search, split or replace text in a string.
|
|
233
|
-
*
|
|
234
|
-
* If an invalid expression is given, then an error is returned.
|
|
235
|
-
* @param {string} re
|
|
236
|
-
*/
|
|
237
|
-
constructor(re) {
|
|
238
|
-
try {
|
|
239
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
240
|
-
const ptr0 = passStringToWasm0(re, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
241
|
-
const len0 = WASM_VECTOR_LEN;
|
|
242
|
-
wasm.rregex_new(retptr, ptr0, len0);
|
|
243
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
244
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
245
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
246
|
-
if (r2) {
|
|
247
|
-
throw takeObject(r1);
|
|
248
|
-
}
|
|
249
|
-
this.__wbg_ptr = r0 >>> 0;
|
|
250
|
-
return this;
|
|
251
|
-
} finally {
|
|
252
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Returns true if and only if there is a match for the regex in the
|
|
257
|
-
* string given.
|
|
258
|
-
*
|
|
259
|
-
* It is recommended to use this method if all you need to do is test
|
|
260
|
-
* a match, since the underlying matching engine may be able to do less
|
|
261
|
-
* work.
|
|
262
|
-
*
|
|
263
|
-
* # Example
|
|
264
|
-
*
|
|
265
|
-
* Test if some text contains at least one word with exactly 13
|
|
266
|
-
* Unicode word characters:
|
|
267
|
-
*
|
|
268
|
-
* ```typescript
|
|
269
|
-
* import { RRegex } from "rregex"
|
|
270
|
-
*
|
|
271
|
-
* const text = "I categorically deny having triskaidekaphobia."
|
|
272
|
-
* expect(new RRegex("\b\w{13}\b").is_match(text)).toBe(true)
|
|
273
|
-
* ```
|
|
274
|
-
*
|
|
275
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
|
|
276
|
-
* @param {string} text - The string against which to match the regular expression
|
|
277
|
-
* @return {boolean}
|
|
278
|
-
*/
|
|
279
|
-
isMatch(text) {
|
|
280
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
281
|
-
const len0 = WASM_VECTOR_LEN;
|
|
282
|
-
const ret = wasm.rregex_isMatch(this.__wbg_ptr, ptr0, len0);
|
|
283
|
-
return ret !== 0;
|
|
191
|
+
wasm.__wbg_rregex_free(ptr, 0);
|
|
284
192
|
}
|
|
285
193
|
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
194
|
+
* Returns the same as is_match, but starts the search at the given offset.
|
|
195
|
+
* The significance of the starting point is that it takes the surrounding
|
|
196
|
+
* context into consideration. For example, the `\A` anchor can only match
|
|
197
|
+
* when `start == 0`.
|
|
198
|
+
*
|
|
199
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
|
|
200
|
+
* @param {string} text - The string against which to match the regular expression
|
|
201
|
+
* @param {number} start - Zero-based index at which to start matching
|
|
202
|
+
* @return {boolean}
|
|
203
|
+
*/
|
|
296
204
|
isMatchAt(text, start) {
|
|
297
205
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
298
206
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -300,631 +208,580 @@ export class RRegex {
|
|
|
300
208
|
return ret !== 0;
|
|
301
209
|
}
|
|
302
210
|
/**
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
* const m = new RRegex("\b\w{13}\b").find(text)
|
|
320
|
-
* expect(m.start).toBe(2)
|
|
321
|
-
* expect(m.end).toBe(15)
|
|
322
|
-
* ```
|
|
323
|
-
*
|
|
324
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
|
|
325
|
-
* @param {string} text - The string against which to match the regular expression
|
|
326
|
-
* @return {Match}
|
|
327
|
-
*/
|
|
328
|
-
find(text) {
|
|
211
|
+
* Replaces all non-overlapping matches in `text` with the replacement
|
|
212
|
+
* provided. This is the same as calling `replacen` with `limit` set to
|
|
213
|
+
* `0`.
|
|
214
|
+
*
|
|
215
|
+
* See the documentation for `replace` for details on how to access
|
|
216
|
+
* capturing group matches in the replacement string.
|
|
217
|
+
*
|
|
218
|
+
* See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
|
|
219
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
|
|
220
|
+
* @param {string} text - The string against which to match the regular expression
|
|
221
|
+
* @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
|
|
222
|
+
* @returns {string}
|
|
223
|
+
*/
|
|
224
|
+
replaceAll(text, rep) {
|
|
225
|
+
let deferred3_0;
|
|
226
|
+
let deferred3_1;
|
|
329
227
|
try {
|
|
330
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
331
228
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
332
229
|
const len0 = WASM_VECTOR_LEN;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
return takeObject(r0);
|
|
230
|
+
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
231
|
+
const len1 = WASM_VECTOR_LEN;
|
|
232
|
+
const ret = wasm.rregex_replaceAll(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
233
|
+
deferred3_0 = ret[0];
|
|
234
|
+
deferred3_1 = ret[1];
|
|
235
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
341
236
|
} finally {
|
|
342
|
-
wasm.
|
|
237
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
343
238
|
}
|
|
344
239
|
}
|
|
345
240
|
/**
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
241
|
+
* Returns a list with all the non-overlapping capture groups matched
|
|
242
|
+
* in `text`. This is operationally the same as `findAll`, except it
|
|
243
|
+
* returns information about capturing group matches.
|
|
244
|
+
*
|
|
245
|
+
* # Example
|
|
246
|
+
*
|
|
247
|
+
* We can use this to find all movie titles and their release years in
|
|
248
|
+
* some text, where the movie is formatted like "'Title' (xxxx)":
|
|
249
|
+
*
|
|
250
|
+
* ```typescript
|
|
251
|
+
* import { RRegex } from "rregex"
|
|
252
|
+
*
|
|
253
|
+
* const re = new RRegex("'(?P<title>[^']+)'\s+\((?P<year>\d{4})\)")
|
|
254
|
+
* const text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."
|
|
255
|
+
* for caps of re.captures_iter(text) {
|
|
256
|
+
* console.log(
|
|
257
|
+
* "Movie:", caps.name["title"].value, ","
|
|
258
|
+
* "Released:", caps.name["year"].value
|
|
259
|
+
* );
|
|
260
|
+
* }
|
|
261
|
+
* // Output:
|
|
262
|
+
* // Movie: Citizen Kane, Released: 1941
|
|
263
|
+
* // Movie: The Wizard of Oz, Released: 1939
|
|
264
|
+
* // Movie: M, Released: 1931
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_iter
|
|
268
|
+
* @param {string} text - The string against which to match the regular expression
|
|
269
|
+
* @returns {Captures[]}
|
|
270
|
+
*/
|
|
271
|
+
capturesAll(text) {
|
|
272
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
273
|
+
const len0 = WASM_VECTOR_LEN;
|
|
274
|
+
const ret = wasm.rregex_capturesAll(this.__wbg_ptr, ptr0, len0);
|
|
275
|
+
if (ret[2]) {
|
|
276
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
373
277
|
}
|
|
278
|
+
return takeFromExternrefTable0(ret[0]);
|
|
374
279
|
}
|
|
375
280
|
/**
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
281
|
+
* Returns the number of captures.
|
|
282
|
+
*
|
|
283
|
+
* This includes all named and unnamed groups, including the implicit
|
|
284
|
+
* unnamed group that is always present and corresponds to the entire match.
|
|
285
|
+
*
|
|
286
|
+
* Since the implicit unnamed group is always included in this length, the
|
|
287
|
+
* length returned is guaranteed to be greater than zero.
|
|
288
|
+
*
|
|
289
|
+
* ## Example
|
|
290
|
+
*
|
|
291
|
+
* ```typescript
|
|
292
|
+
* import { RRegex } from "rregex"
|
|
293
|
+
*
|
|
294
|
+
* const re1 = new RRegex("(?P<y>\d{4})-(?P<m>\d{2})-(?P<d>\d{2})")
|
|
295
|
+
* expect(re1.capturesLength()).toEqual(4)
|
|
296
|
+
*
|
|
297
|
+
* const re2 = new RRegex("foo")
|
|
298
|
+
* expect(re2.capturesLength()).toEqual(1)
|
|
299
|
+
*
|
|
300
|
+
* const re3 = new RRegex("(foo)")
|
|
301
|
+
* expect(re3.capturesLength()).toEqual(2)
|
|
302
|
+
*
|
|
303
|
+
* const re4 = new RRegex("(?<a>.(?<b>.))(.)(?:.)(?<c>.)")
|
|
304
|
+
* expect(re4.capturesLength()).toEqual(5)
|
|
305
|
+
*
|
|
306
|
+
* const re5 = new RRegex("[a&&b]")
|
|
307
|
+
* expect(re5.capturesLength()).toEqual(1)
|
|
308
|
+
* ```
|
|
309
|
+
*
|
|
310
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_len
|
|
311
|
+
* @returns {number}
|
|
312
|
+
*/
|
|
313
|
+
capturesLength() {
|
|
314
|
+
const ret = wasm.rregex_capturesLength(this.__wbg_ptr);
|
|
315
|
+
return ret >>> 0;
|
|
411
316
|
}
|
|
412
317
|
/**
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
318
|
+
* Returns a list of the capture names in this regex.
|
|
319
|
+
*
|
|
320
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.capture_names
|
|
321
|
+
*/
|
|
417
322
|
captureNames() {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
423
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
424
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
425
|
-
return v1;
|
|
426
|
-
} finally {
|
|
427
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
428
|
-
}
|
|
323
|
+
const ret = wasm.rregex_captureNames(this.__wbg_ptr);
|
|
324
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
325
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
326
|
+
return v1;
|
|
429
327
|
}
|
|
430
328
|
/**
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
329
|
+
* Returns the end location of a match in the text given.
|
|
330
|
+
*
|
|
331
|
+
* This method may have the same performance characteristics as
|
|
332
|
+
* `isMatch`, except it provides an end location for a match. In
|
|
333
|
+
* particular, the location returned *may be shorter* than the proper end
|
|
334
|
+
* of the leftmost-first match that you would find via `Regex.find`.
|
|
335
|
+
*
|
|
336
|
+
* Note that it is not guaranteed that this routine finds the shortest or
|
|
337
|
+
* "earliest" possible match. Instead, the main idea of this API is that
|
|
338
|
+
* it returns the offset at the point at which the internal regex engine
|
|
339
|
+
* has determined that a match has occurred. This may vary depending on
|
|
340
|
+
* which internal regex engine is used, and thus, the offset itself may
|
|
341
|
+
* change.
|
|
342
|
+
*
|
|
343
|
+
* # Example
|
|
344
|
+
*
|
|
345
|
+
* Typically, `a+` would match the entire first sequence of `a` in some
|
|
346
|
+
* text, but `shortest_match` can give up as soon as it sees the first
|
|
347
|
+
* `a`.
|
|
348
|
+
*
|
|
349
|
+
* ```typescript
|
|
350
|
+
* import { RRegex } from "rregex"
|
|
351
|
+
*
|
|
352
|
+
* const text = "aaaaa"
|
|
353
|
+
* const = new RRegex("a+").shortest_match(text)
|
|
354
|
+
* expect(pos).toBe(1)
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
|
|
358
|
+
* @param {string} text - The string against which to match the regular expression
|
|
359
|
+
* @returns {number|undefined}
|
|
360
|
+
*/
|
|
361
|
+
shortestMatch(text) {
|
|
362
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
363
|
+
const len0 = WASM_VECTOR_LEN;
|
|
364
|
+
const ret = wasm.rregex_shortestMatch(this.__wbg_ptr, ptr0, len0);
|
|
365
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Returns the same as `shortest_match`, but starts the search at the
|
|
369
|
+
* given offset.
|
|
370
|
+
*
|
|
371
|
+
* The significance of the starting point is that it takes the surrounding
|
|
372
|
+
* context into consideration. For example, the `\A` anchor can only match
|
|
373
|
+
* when `start == 0`.
|
|
374
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
|
|
375
|
+
* @param {string} text - The string against which to match the regular expression
|
|
376
|
+
* @param {number} start - Zero-based index at which to start matching
|
|
377
|
+
* @returns {number|undefined}
|
|
378
|
+
*/
|
|
379
|
+
shortestMatchAt(text, start) {
|
|
380
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
381
|
+
const len0 = WASM_VECTOR_LEN;
|
|
382
|
+
const ret = wasm.rregex_shortestMatchAt(this.__wbg_ptr, ptr0, len0, start);
|
|
383
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Compiles a regular expression. Once compiled, it can be used repeatedly
|
|
387
|
+
* to search, split or replace text in a string.
|
|
388
|
+
*
|
|
389
|
+
* If an invalid expression is given, then an error is returned.
|
|
390
|
+
* @param {string} re
|
|
391
|
+
*/
|
|
392
|
+
constructor(re) {
|
|
393
|
+
const ptr0 = passStringToWasm0(re, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
394
|
+
const len0 = WASM_VECTOR_LEN;
|
|
395
|
+
const ret = wasm.rregex_new(ptr0, len0);
|
|
396
|
+
if (ret[2]) {
|
|
397
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
492
398
|
}
|
|
399
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
400
|
+
RRegexFinalization.register(this, this.__wbg_ptr, this);
|
|
401
|
+
return this;
|
|
493
402
|
}
|
|
494
403
|
/**
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
try {
|
|
527
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
528
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
529
|
-
const len0 = WASM_VECTOR_LEN;
|
|
530
|
-
wasm.rregex_capturesAll(retptr, this.__wbg_ptr, ptr0, len0);
|
|
531
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
532
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
533
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
534
|
-
if (r2) {
|
|
535
|
-
throw takeObject(r1);
|
|
536
|
-
}
|
|
537
|
-
return takeObject(r0);
|
|
538
|
-
} finally {
|
|
539
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
404
|
+
* Returns the start and end byte range of the leftmost-first match in
|
|
405
|
+
* `text`. If no match exists, then `undefined` is returned.
|
|
406
|
+
*
|
|
407
|
+
* Note that this should only be used if you want to discover the position
|
|
408
|
+
* of the match. Testing the existence of a match is faster if you use
|
|
409
|
+
* `isMatch`.
|
|
410
|
+
*
|
|
411
|
+
* # Example
|
|
412
|
+
*
|
|
413
|
+
* Find the start and end location of the first word with exactly 13
|
|
414
|
+
* Unicode word characters:
|
|
415
|
+
*
|
|
416
|
+
* ```typescript
|
|
417
|
+
* import { RRegex } from "rregex"
|
|
418
|
+
*
|
|
419
|
+
* const text = "I categorically deny having triskaidekaphobia."
|
|
420
|
+
* const m = new RRegex("\b\w{13}\b").find(text)
|
|
421
|
+
* expect(m.start).toBe(2)
|
|
422
|
+
* expect(m.end).toBe(15)
|
|
423
|
+
* ```
|
|
424
|
+
*
|
|
425
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
|
|
426
|
+
* @param {string} text - The string against which to match the regular expression
|
|
427
|
+
* @return {Match}
|
|
428
|
+
*/
|
|
429
|
+
find(text) {
|
|
430
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
431
|
+
const len0 = WASM_VECTOR_LEN;
|
|
432
|
+
const ret = wasm.rregex_find(this.__wbg_ptr, ptr0, len0);
|
|
433
|
+
if (ret[2]) {
|
|
434
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
540
435
|
}
|
|
436
|
+
return takeFromExternrefTable0(ret[0]);
|
|
541
437
|
}
|
|
542
438
|
/**
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_len
|
|
573
|
-
* @returns {number}
|
|
574
|
-
*/
|
|
575
|
-
capturesLength() {
|
|
576
|
-
const ret = wasm.rregex_capturesLength(this.__wbg_ptr);
|
|
577
|
-
return ret >>> 0;
|
|
439
|
+
* Returns an iterator of substrings of `text` delimited by a match of the
|
|
440
|
+
* regular expression. Namely, each element of the iterator corresponds to
|
|
441
|
+
* text that *isn't* matched by the regular expression.
|
|
442
|
+
*
|
|
443
|
+
* This method will *not* copy the text given.
|
|
444
|
+
*
|
|
445
|
+
* # Example
|
|
446
|
+
*
|
|
447
|
+
* To split a string delimited by arbitrary amounts of spaces or tabs:
|
|
448
|
+
*
|
|
449
|
+
* ```typescript
|
|
450
|
+
* import { RRegex } from "rregex"
|
|
451
|
+
*
|
|
452
|
+
* const re = new RRegex(r"[ \t]+")
|
|
453
|
+
* const fields = re.split("a b c d e")
|
|
454
|
+
* expect(fields).toEqual(["a", "b", "c", "d", "e"])
|
|
455
|
+
* ```
|
|
456
|
+
*
|
|
457
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
|
|
458
|
+
* @param {string} text - The string against which to match the regular expression
|
|
459
|
+
* @returns {string[]}
|
|
460
|
+
*/
|
|
461
|
+
split(text) {
|
|
462
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
463
|
+
const len0 = WASM_VECTOR_LEN;
|
|
464
|
+
const ret = wasm.rregex_split(this.__wbg_ptr, ptr0, len0);
|
|
465
|
+
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
466
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
467
|
+
return v2;
|
|
578
468
|
}
|
|
579
469
|
/**
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
* ```typescript
|
|
622
|
-
* import { RRegex } from "rregex"
|
|
623
|
-
*
|
|
624
|
-
* const re = new RRegex("(?P<last>[^,\s]+),\s+(?P<first>\S+)")
|
|
625
|
-
* const result = re.replace("Springsteen, Bruce", "$first $last")
|
|
626
|
-
* expect(result).toBe("Bruce Springsteen")
|
|
627
|
-
* ```
|
|
628
|
-
*
|
|
629
|
-
* Note that using `$2` instead of `$first` or `$1` instead of `$last`
|
|
630
|
-
* would produce the same result. To write a literal `$` use `$$`.
|
|
631
|
-
*
|
|
632
|
-
* Sometimes the replacement string requires use of curly braces to
|
|
633
|
-
* delineate a capture group replacement and surrounding literal text.
|
|
634
|
-
* For example, if we wanted to join two words together with an
|
|
635
|
-
* underscore:
|
|
636
|
-
*
|
|
637
|
-
* ```typescript
|
|
638
|
-
* import { RRegex } from "rregex"
|
|
639
|
-
*
|
|
640
|
-
* const re = new RRegex("(?P<first>\w+)\s+(?P<second>\w+)")
|
|
641
|
-
* const result = re.replace("deep fried", "${first}_$second")
|
|
642
|
-
* expect(result).toBe("deep_fried")
|
|
643
|
-
* ```
|
|
644
|
-
*
|
|
645
|
-
* Without the curly braces, the capture group name `first_` would be
|
|
646
|
-
* used, and since it doesn't exist, it would be replaced with the empty
|
|
647
|
-
* string.
|
|
648
|
-
*
|
|
649
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
|
|
650
|
-
* @param {string} text - The string against which to match the regular expression
|
|
651
|
-
* @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
|
|
652
|
-
* @returns {string}
|
|
653
|
-
*/
|
|
654
|
-
replace(text, rep) {
|
|
655
|
-
let deferred3_0;
|
|
656
|
-
let deferred3_1;
|
|
657
|
-
try {
|
|
658
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
659
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
660
|
-
const len0 = WASM_VECTOR_LEN;
|
|
661
|
-
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
662
|
-
const len1 = WASM_VECTOR_LEN;
|
|
663
|
-
wasm.rregex_replace(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
664
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
665
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
666
|
-
deferred3_0 = r0;
|
|
667
|
-
deferred3_1 = r1;
|
|
668
|
-
return getStringFromWasm0(r0, r1);
|
|
669
|
-
} finally {
|
|
670
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
671
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
470
|
+
* Returns an iterator of at most `limit` substrings of `text` delimited
|
|
471
|
+
* by a match of the regular expression. (A `limit` of `0` will return no
|
|
472
|
+
* substrings.) Namely, each element of the iterator corresponds to text
|
|
473
|
+
* that *isn't* matched by the regular expression. The remainder of the
|
|
474
|
+
* string that is not split will be the last element in the iterator.
|
|
475
|
+
*
|
|
476
|
+
* This method will *not* copy the text given.
|
|
477
|
+
*
|
|
478
|
+
* # Example
|
|
479
|
+
*
|
|
480
|
+
* Get the first two words in some text:
|
|
481
|
+
*
|
|
482
|
+
* ```typescript
|
|
483
|
+
* import { RRegex } from "rregex"
|
|
484
|
+
*
|
|
485
|
+
* const re = new RRegex(r"\W+")
|
|
486
|
+
* const fields = re.splitn("Hey! How are you?", 3)
|
|
487
|
+
* expect(fields).toEqual(["Hey", "How", "are you?"])
|
|
488
|
+
* ```
|
|
489
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
|
|
490
|
+
* @param {string} text - The string against which to match the regular expression
|
|
491
|
+
* @param {number} limit - Max number result elements
|
|
492
|
+
* @returns {string[]}
|
|
493
|
+
*/
|
|
494
|
+
splitn(text, limit) {
|
|
495
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
496
|
+
const len0 = WASM_VECTOR_LEN;
|
|
497
|
+
const ret = wasm.rregex_splitn(this.__wbg_ptr, ptr0, len0, limit);
|
|
498
|
+
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
499
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
500
|
+
return v2;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Returns the regular expression into a high level intermediate
|
|
504
|
+
* representation.
|
|
505
|
+
* @returns {any}
|
|
506
|
+
*/
|
|
507
|
+
syntax() {
|
|
508
|
+
const ret = wasm.rregex_syntax(this.__wbg_ptr);
|
|
509
|
+
if (ret[2]) {
|
|
510
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
672
511
|
}
|
|
512
|
+
return takeFromExternrefTable0(ret[0]);
|
|
673
513
|
}
|
|
674
514
|
/**
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
694
|
-
const len0 = WASM_VECTOR_LEN;
|
|
695
|
-
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
696
|
-
const len1 = WASM_VECTOR_LEN;
|
|
697
|
-
wasm.rregex_replacen(retptr, this.__wbg_ptr, ptr0, len0, limit, ptr1, len1);
|
|
698
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
699
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
700
|
-
deferred3_0 = r0;
|
|
701
|
-
deferred3_1 = r1;
|
|
702
|
-
return getStringFromWasm0(r0, r1);
|
|
703
|
-
} finally {
|
|
704
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
705
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
515
|
+
* Returns the same as find, but starts the search at the given
|
|
516
|
+
* offset.
|
|
517
|
+
*
|
|
518
|
+
* The significance of the starting point is that it takes the surrounding
|
|
519
|
+
* context into consideration. For example, the `\A` anchor can only
|
|
520
|
+
* match when `start == 0`.
|
|
521
|
+
*
|
|
522
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
|
|
523
|
+
* @param {string} text - The string against which to match the regular expression
|
|
524
|
+
* @param {number} start - Zero-based index at which to start matching
|
|
525
|
+
* @returns {Match}
|
|
526
|
+
*/
|
|
527
|
+
findAt(text, start) {
|
|
528
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
529
|
+
const len0 = WASM_VECTOR_LEN;
|
|
530
|
+
const ret = wasm.rregex_findAt(this.__wbg_ptr, ptr0, len0, start);
|
|
531
|
+
if (ret[2]) {
|
|
532
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
706
533
|
}
|
|
534
|
+
return takeFromExternrefTable0(ret[0]);
|
|
707
535
|
}
|
|
708
536
|
/**
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
537
|
+
* Replaces the leftmost-first match with the replacement provided.
|
|
538
|
+
* The replacement can be a regular string (where `$N` and `$name` are
|
|
539
|
+
* expanded to match capture groups) or a function that takes the matches'
|
|
540
|
+
* `Captures` and returns the replaced string.
|
|
541
|
+
*
|
|
542
|
+
* If no match is found, then a copy of the string is returned unchanged.
|
|
543
|
+
*
|
|
544
|
+
* # Replacement string syntax
|
|
545
|
+
*
|
|
546
|
+
* All instances of `$name` in the replacement text is replaced with the
|
|
547
|
+
* corresponding capture group `name`.
|
|
548
|
+
*
|
|
549
|
+
* `name` may be an integer corresponding to the index of the
|
|
550
|
+
* capture group (counted by order of opening parenthesis where `0` is the
|
|
551
|
+
* entire match) or it can be a name (consisting of letters, digits or
|
|
552
|
+
* underscores) corresponding to a named capture group.
|
|
553
|
+
*
|
|
554
|
+
* If `name` isn't a valid capture group (whether the name doesn't exist
|
|
555
|
+
* or isn't a valid index), then it is replaced with the empty string.
|
|
556
|
+
*
|
|
557
|
+
* The longest possible name is used. e.g., `$1a` looks up the capture
|
|
558
|
+
* group named `1a` and not the capture group at index `1`. To exert more
|
|
559
|
+
* precise control over the name, use braces, e.g., `${1}a`.
|
|
560
|
+
*
|
|
561
|
+
* To write a literal `$` use `$$`.
|
|
562
|
+
*
|
|
563
|
+
* # Examples
|
|
564
|
+
*
|
|
565
|
+
* Note that this function is polymorphic with respect to the replacement.
|
|
566
|
+
* In typical usage, this can just be a normal string:
|
|
567
|
+
*
|
|
568
|
+
* ```typescript
|
|
569
|
+
* import { RRegex } from "rregex"
|
|
570
|
+
*
|
|
571
|
+
* const re = new RRegex("[^01]+")
|
|
572
|
+
* expect(re.replace("1078910", "").toBe("1010")
|
|
573
|
+
* ```
|
|
574
|
+
*
|
|
575
|
+
* Here's the example using this expansion technique with named capture
|
|
576
|
+
* groups:
|
|
577
|
+
*
|
|
578
|
+
* ```typescript
|
|
579
|
+
* import { RRegex } from "rregex"
|
|
580
|
+
*
|
|
581
|
+
* const re = new RRegex("(?P<last>[^,\s]+),\s+(?P<first>\S+)")
|
|
582
|
+
* const result = re.replace("Springsteen, Bruce", "$first $last")
|
|
583
|
+
* expect(result).toBe("Bruce Springsteen")
|
|
584
|
+
* ```
|
|
585
|
+
*
|
|
586
|
+
* Note that using `$2` instead of `$first` or `$1` instead of `$last`
|
|
587
|
+
* would produce the same result. To write a literal `$` use `$$`.
|
|
588
|
+
*
|
|
589
|
+
* Sometimes the replacement string requires use of curly braces to
|
|
590
|
+
* delineate a capture group replacement and surrounding literal text.
|
|
591
|
+
* For example, if we wanted to join two words together with an
|
|
592
|
+
* underscore:
|
|
593
|
+
*
|
|
594
|
+
* ```typescript
|
|
595
|
+
* import { RRegex } from "rregex"
|
|
596
|
+
*
|
|
597
|
+
* const re = new RRegex("(?P<first>\w+)\s+(?P<second>\w+)")
|
|
598
|
+
* const result = re.replace("deep fried", "${first}_$second")
|
|
599
|
+
* expect(result).toBe("deep_fried")
|
|
600
|
+
* ```
|
|
601
|
+
*
|
|
602
|
+
* Without the curly braces, the capture group name `first_` would be
|
|
603
|
+
* used, and since it doesn't exist, it would be replaced with the empty
|
|
604
|
+
* string.
|
|
605
|
+
*
|
|
606
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
|
|
607
|
+
* @param {string} text - The string against which to match the regular expression
|
|
608
|
+
* @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
|
|
609
|
+
* @returns {string}
|
|
610
|
+
*/
|
|
611
|
+
replace(text, rep) {
|
|
723
612
|
let deferred3_0;
|
|
724
613
|
let deferred3_1;
|
|
725
614
|
try {
|
|
726
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
727
615
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
728
616
|
const len0 = WASM_VECTOR_LEN;
|
|
729
617
|
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
730
618
|
const len1 = WASM_VECTOR_LEN;
|
|
731
|
-
wasm.
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
deferred3_1 = r1;
|
|
736
|
-
return getStringFromWasm0(r0, r1);
|
|
619
|
+
const ret = wasm.rregex_replace(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
620
|
+
deferred3_0 = ret[0];
|
|
621
|
+
deferred3_1 = ret[1];
|
|
622
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
737
623
|
} finally {
|
|
738
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
739
624
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
740
625
|
}
|
|
741
626
|
}
|
|
742
627
|
/**
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
628
|
+
* Returns the capture groups corresponding to the leftmost-first
|
|
629
|
+
* match in `text`. Capture group `0` always corresponds to the entire
|
|
630
|
+
* match. If no match is found, then `undefined` is returned.
|
|
631
|
+
*
|
|
632
|
+
* You should only use `captures` if you need access to the location of
|
|
633
|
+
* capturing group matches. Otherwise, `find` is faster for discovering
|
|
634
|
+
* the location of the overall match.
|
|
635
|
+
*
|
|
636
|
+
* # Examples
|
|
637
|
+
*
|
|
638
|
+
* Say you have some text with movie names and their release years,
|
|
639
|
+
* like "'Citizen Kane' (1941)". It'd be nice if we could search for text
|
|
640
|
+
* looking like that, while also extracting the movie name and its release
|
|
641
|
+
* year separately.
|
|
642
|
+
*
|
|
643
|
+
* ```typescript
|
|
644
|
+
* import { RRegex } from "rregex"
|
|
645
|
+
*
|
|
646
|
+
* const re = new RRegex("'([^']+)'\s+\((\d{4})\)")
|
|
647
|
+
* const text = "Not my favorite movie: 'Citizen Kane' (1941)."
|
|
648
|
+
* const caps = re.captures(text)
|
|
649
|
+
* expect(caps.get[1].value).toBe("Citizen Kane")
|
|
650
|
+
* expect(caps.get[2].value).toBe("1941")
|
|
651
|
+
* expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
|
|
652
|
+
* ```
|
|
653
|
+
*
|
|
654
|
+
* Note that the full match is at capture group `0`. Each subsequent
|
|
655
|
+
* capture group is indexed by the order of its opening `(`.
|
|
656
|
+
*
|
|
657
|
+
* We can make this example a bit clearer by using *named* capture groups:
|
|
658
|
+
*
|
|
659
|
+
* ```typescript
|
|
660
|
+
* import { RRegex } from "rregex"
|
|
661
|
+
*
|
|
662
|
+
* const re = new RRegex("'(?P<title>[^']+)'\s+\((?P<year>\d{4})\)")
|
|
663
|
+
* const text = "Not my favorite movie: 'Citizen Kane' (1941)."
|
|
664
|
+
* const caps = re.captures(text)
|
|
665
|
+
* expect(caps.name["title"].value).toBe("Citizen Kane")
|
|
666
|
+
* expect(caps.name["year"].value).toBe("1941")
|
|
667
|
+
* expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
|
|
668
|
+
* ```
|
|
669
|
+
*
|
|
670
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures
|
|
671
|
+
* @param {string} text - The string against which to match the regular expression
|
|
672
|
+
* @returns {Captures|undefined}
|
|
673
|
+
*/
|
|
674
|
+
captures(text) {
|
|
675
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
676
|
+
const len0 = WASM_VECTOR_LEN;
|
|
677
|
+
const ret = wasm.rregex_captures(this.__wbg_ptr, ptr0, len0);
|
|
678
|
+
if (ret[2]) {
|
|
679
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
778
680
|
}
|
|
681
|
+
return takeFromExternrefTable0(ret[0]);
|
|
779
682
|
}
|
|
780
683
|
/**
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
try {
|
|
807
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
808
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
809
|
-
const len0 = WASM_VECTOR_LEN;
|
|
810
|
-
wasm.rregex_splitn(retptr, this.__wbg_ptr, ptr0, len0, limit);
|
|
811
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
812
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
813
|
-
var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
814
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
815
|
-
return v2;
|
|
816
|
-
} finally {
|
|
817
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
684
|
+
* Returns an array for each successive non-overlapping match in `text``,
|
|
685
|
+
* returning the start and end byte indices with respect to `text`.
|
|
686
|
+
*
|
|
687
|
+
* # Example
|
|
688
|
+
*
|
|
689
|
+
* Find the start and end location of every word with exactly 13 Unicode
|
|
690
|
+
* word characters:
|
|
691
|
+
*
|
|
692
|
+
* ```typescript
|
|
693
|
+
* import { RRegex } from "rregex"
|
|
694
|
+
*
|
|
695
|
+
* const text = "Retroactively relinquishing remunerations is reprehensible."
|
|
696
|
+
* const matches = new RRegex("\b\w{13}\b").findAll(text)
|
|
697
|
+
* ```
|
|
698
|
+
*
|
|
699
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
|
|
700
|
+
* @param {string} text - The string against which to match the regular expression
|
|
701
|
+
* @returns {Match}
|
|
702
|
+
*/
|
|
703
|
+
findAll(text) {
|
|
704
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
705
|
+
const len0 = WASM_VECTOR_LEN;
|
|
706
|
+
const ret = wasm.rregex_findAll(this.__wbg_ptr, ptr0, len0);
|
|
707
|
+
if (ret[2]) {
|
|
708
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
818
709
|
}
|
|
710
|
+
return takeFromExternrefTable0(ret[0]);
|
|
819
711
|
}
|
|
820
712
|
/**
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
|
|
850
|
-
* @param {string} text - The string against which to match the regular expression
|
|
851
|
-
* @returns {number|undefined}
|
|
852
|
-
*/
|
|
853
|
-
shortestMatch(text) {
|
|
854
|
-
try {
|
|
855
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
856
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
857
|
-
const len0 = WASM_VECTOR_LEN;
|
|
858
|
-
wasm.rregex_shortestMatch(retptr, this.__wbg_ptr, ptr0, len0);
|
|
859
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
860
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
861
|
-
return r0 === 0 ? undefined : r1 >>> 0;
|
|
862
|
-
} finally {
|
|
863
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
864
|
-
}
|
|
713
|
+
* Returns true if and only if there is a match for the regex in the
|
|
714
|
+
* string given.
|
|
715
|
+
*
|
|
716
|
+
* It is recommended to use this method if all you need to do is test
|
|
717
|
+
* a match, since the underlying matching engine may be able to do less
|
|
718
|
+
* work.
|
|
719
|
+
*
|
|
720
|
+
* # Example
|
|
721
|
+
*
|
|
722
|
+
* Test if some text contains at least one word with exactly 13
|
|
723
|
+
* Unicode word characters:
|
|
724
|
+
*
|
|
725
|
+
* ```typescript
|
|
726
|
+
* import { RRegex } from "rregex"
|
|
727
|
+
*
|
|
728
|
+
* const text = "I categorically deny having triskaidekaphobia."
|
|
729
|
+
* expect(new RRegex("\b\w{13}\b").is_match(text)).toBe(true)
|
|
730
|
+
* ```
|
|
731
|
+
*
|
|
732
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
|
|
733
|
+
* @param {string} text - The string against which to match the regular expression
|
|
734
|
+
* @return {boolean}
|
|
735
|
+
*/
|
|
736
|
+
isMatch(text) {
|
|
737
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
738
|
+
const len0 = WASM_VECTOR_LEN;
|
|
739
|
+
const ret = wasm.rregex_isMatch(this.__wbg_ptr, ptr0, len0);
|
|
740
|
+
return ret !== 0;
|
|
865
741
|
}
|
|
866
742
|
/**
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
743
|
+
* Replaces at most `limit` non-overlapping matches in `text` with the
|
|
744
|
+
* replacement provided. If `limit` is 0, then all non-overlapping matches
|
|
745
|
+
* are replaced.
|
|
746
|
+
*
|
|
747
|
+
* See the documentation for `replace` for details on how to access
|
|
748
|
+
* capturing group matches in the replacement string.
|
|
749
|
+
*
|
|
750
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
|
|
751
|
+
* @param {string} text - The string against which to match the regular expression
|
|
752
|
+
* @param {number} limit - Max number of replacement
|
|
753
|
+
* @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
|
|
754
|
+
* @returns {string}
|
|
755
|
+
*/
|
|
756
|
+
replacen(text, limit, rep) {
|
|
757
|
+
let deferred3_0;
|
|
758
|
+
let deferred3_1;
|
|
879
759
|
try {
|
|
880
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
881
760
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
882
761
|
const len0 = WASM_VECTOR_LEN;
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Returns the regular expression into a high level intermediate
|
|
893
|
-
* representation.
|
|
894
|
-
* @returns {any}
|
|
895
|
-
*/
|
|
896
|
-
syntax() {
|
|
897
|
-
try {
|
|
898
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
899
|
-
wasm.rregex_syntax(retptr, this.__wbg_ptr);
|
|
900
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
901
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
902
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
903
|
-
if (r2) {
|
|
904
|
-
throw takeObject(r1);
|
|
905
|
-
}
|
|
906
|
-
return takeObject(r0);
|
|
762
|
+
const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
763
|
+
const len1 = WASM_VECTOR_LEN;
|
|
764
|
+
const ret = wasm.rregex_replacen(this.__wbg_ptr, ptr0, len0, limit, ptr1, len1);
|
|
765
|
+
deferred3_0 = ret[0];
|
|
766
|
+
deferred3_1 = ret[1];
|
|
767
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
907
768
|
} finally {
|
|
908
|
-
wasm.
|
|
769
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
909
770
|
}
|
|
910
771
|
}
|
|
911
772
|
/**
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
773
|
+
* Returns a string representing the regular expression
|
|
774
|
+
* @returns {string}
|
|
775
|
+
*/
|
|
915
776
|
toString() {
|
|
916
777
|
let deferred1_0;
|
|
917
778
|
let deferred1_1;
|
|
918
779
|
try {
|
|
919
|
-
const
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
deferred1_0 = r0;
|
|
924
|
-
deferred1_1 = r1;
|
|
925
|
-
return getStringFromWasm0(r0, r1);
|
|
780
|
+
const ret = wasm.rregex_toString(this.__wbg_ptr);
|
|
781
|
+
deferred1_0 = ret[0];
|
|
782
|
+
deferred1_1 = ret[1];
|
|
783
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
926
784
|
} finally {
|
|
927
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
928
785
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
929
786
|
}
|
|
930
787
|
}
|
|
@@ -932,19 +789,19 @@ export class RRegex {
|
|
|
932
789
|
|
|
933
790
|
const RRegexSetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
934
791
|
? { register: () => {}, unregister: () => {} }
|
|
935
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_rregexset_free(ptr >>> 0));
|
|
792
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_rregexset_free(ptr >>> 0, 1));
|
|
936
793
|
/**
|
|
937
|
-
* Match multiple (possibly overlapping) regular expressions in a single scan.
|
|
938
|
-
* A regex set corresponds to the union of two or more regular expressions.
|
|
939
|
-
*
|
|
940
|
-
* That is, a regex set will match text where at least one of its constituent
|
|
941
|
-
* regular expressions matches. A regex set as its formulated here provides a
|
|
942
|
-
* touch more power: it will also report which regular expressions in the set match.
|
|
943
|
-
* Indeed, this is the key difference between regex sets and a single `Regex`
|
|
944
|
-
* with many alternates, since only one alternate can match at a time.
|
|
945
|
-
*
|
|
946
|
-
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
|
|
947
|
-
*/
|
|
794
|
+
* Match multiple (possibly overlapping) regular expressions in a single scan.
|
|
795
|
+
* A regex set corresponds to the union of two or more regular expressions.
|
|
796
|
+
*
|
|
797
|
+
* That is, a regex set will match text where at least one of its constituent
|
|
798
|
+
* regular expressions matches. A regex set as its formulated here provides a
|
|
799
|
+
* touch more power: it will also report which regular expressions in the set match.
|
|
800
|
+
* Indeed, this is the key difference between regex sets and a single `Regex`
|
|
801
|
+
* with many alternates, since only one alternate can match at a time.
|
|
802
|
+
*
|
|
803
|
+
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
|
|
804
|
+
*/
|
|
948
805
|
export class RRegexSet {
|
|
949
806
|
|
|
950
807
|
__destroy_into_raw() {
|
|
@@ -956,225 +813,213 @@ export class RRegexSet {
|
|
|
956
813
|
|
|
957
814
|
free() {
|
|
958
815
|
const ptr = this.__destroy_into_raw();
|
|
959
|
-
wasm.__wbg_rregexset_free(ptr);
|
|
816
|
+
wasm.__wbg_rregexset_free(ptr, 0);
|
|
960
817
|
}
|
|
961
818
|
/**
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
819
|
+
* Create a new regex set with the given regular expressions.
|
|
820
|
+
*
|
|
821
|
+
* This takes an of strings, if any item in the list is not a valid regular
|
|
822
|
+
* expressions, then an error is returned.
|
|
823
|
+
*
|
|
824
|
+
* # Example
|
|
825
|
+
*
|
|
826
|
+
* Create a new regex set from an iterator of strings:
|
|
827
|
+
*
|
|
828
|
+
* ```typescript
|
|
829
|
+
* import { RegexSet } from "rregex"
|
|
830
|
+
*
|
|
831
|
+
* const set = new RegexSet(["\w+", "\d+"])
|
|
832
|
+
* expect(set.is_match("foo")).toBe(true)
|
|
833
|
+
* ```
|
|
834
|
+
* @param {Array<any>} list
|
|
835
|
+
*/
|
|
979
836
|
constructor(list) {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
984
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
985
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
986
|
-
if (r2) {
|
|
987
|
-
throw takeObject(r1);
|
|
988
|
-
}
|
|
989
|
-
this.__wbg_ptr = r0 >>> 0;
|
|
990
|
-
return this;
|
|
991
|
-
} finally {
|
|
992
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
993
|
-
heap[stack_pointer++] = undefined;
|
|
837
|
+
const ret = wasm.rregexset_new(list);
|
|
838
|
+
if (ret[2]) {
|
|
839
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
994
840
|
}
|
|
841
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
842
|
+
RRegexSetFinalization.register(this, this.__wbg_ptr, this);
|
|
843
|
+
return this;
|
|
995
844
|
}
|
|
996
845
|
/**
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
846
|
+
* Returns the set of regular expressions that match in the given text.
|
|
847
|
+
*
|
|
848
|
+
* The set returned contains the index of each regular expression that
|
|
849
|
+
* matches in the given text. The index is in correspondence with the
|
|
850
|
+
* order of regular expressions given to `RegexSet`'s constructor.
|
|
851
|
+
*
|
|
852
|
+
* The set can also be used to iterate over the matched indices.
|
|
853
|
+
*
|
|
854
|
+
* Note that as with searches using `Regex`, the expression is unanchored
|
|
855
|
+
* by default. That is, if the regex does not start with `^` or `\A`, or
|
|
856
|
+
* end with `$` or `\z`, then it is permitted to match anywhere in the
|
|
857
|
+
* text.
|
|
858
|
+
*
|
|
859
|
+
* # Example
|
|
860
|
+
*
|
|
861
|
+
* Tests which regular expressions match the given text:
|
|
862
|
+
*
|
|
863
|
+
* ```typescript
|
|
864
|
+
* import { RegexSet } from "rregex"
|
|
865
|
+
*
|
|
866
|
+
* const set = new RegexSet([
|
|
867
|
+
* "\w+",
|
|
868
|
+
* "\d+",
|
|
869
|
+
* "\pL+",
|
|
870
|
+
* "foo",
|
|
871
|
+
* "bar",
|
|
872
|
+
* "barfoo",
|
|
873
|
+
* "foobar",
|
|
874
|
+
* ])
|
|
875
|
+
* const matches = set.matches("foobar")
|
|
876
|
+
* expect(matches).toBe([0, 2, 3, 4, 6])
|
|
877
|
+
* ```
|
|
878
|
+
*
|
|
879
|
+
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.matches
|
|
880
|
+
* @param {string} text - The string against which to match the regular expression
|
|
881
|
+
* @return {number[]}
|
|
882
|
+
*/
|
|
883
|
+
matches(text) {
|
|
884
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
885
|
+
const len0 = WASM_VECTOR_LEN;
|
|
886
|
+
const ret = wasm.rregexset_matches(this.__wbg_ptr, ptr0, len0);
|
|
887
|
+
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
888
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
889
|
+
return v2;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Returns true if and only if one of the regexes in this set matches
|
|
893
|
+
* the text given.
|
|
894
|
+
*
|
|
895
|
+
* This method should be preferred if you only need to test whether any
|
|
896
|
+
* of the regexes in the set should match, but don't care about *which*
|
|
897
|
+
* regexes matched. This is because the underlying matching engine will
|
|
898
|
+
* quit immediately after seeing the first match instead of continuing to
|
|
899
|
+
* find all matches.
|
|
900
|
+
*
|
|
901
|
+
* Note that as with searches using `Regex`, the expression is unanchored
|
|
902
|
+
* by default. That is, if the regex does not start with `^` or `\A`, or
|
|
903
|
+
* end with `$` or `\z`, then it is permitted to match anywhere in the
|
|
904
|
+
* text.
|
|
905
|
+
*
|
|
906
|
+
* # Example
|
|
907
|
+
*
|
|
908
|
+
* Tests whether a set matches some text:
|
|
909
|
+
*
|
|
910
|
+
* ```typescript
|
|
911
|
+
* import { RegexSet } from "rregex"
|
|
912
|
+
*
|
|
913
|
+
* const set = new RegexSet(["\w+", "\d+"])
|
|
914
|
+
* expect(set.is_match("foo")).toBe(true)
|
|
915
|
+
* expect(!set.is_match("☃")).toBe(false)
|
|
916
|
+
* ```
|
|
917
|
+
*
|
|
918
|
+
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
|
|
919
|
+
* @param {string} text - The string against which to match the regular expression
|
|
920
|
+
* @return {boolean}
|
|
921
|
+
*/
|
|
1027
922
|
isMatch(text) {
|
|
1028
923
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1029
924
|
const len0 = WASM_VECTOR_LEN;
|
|
1030
925
|
const ret = wasm.rregexset_isMatch(this.__wbg_ptr, ptr0, len0);
|
|
1031
926
|
return ret !== 0;
|
|
1032
927
|
}
|
|
1033
|
-
/**
|
|
1034
|
-
* Returns the set of regular expressions that match in the given text.
|
|
1035
|
-
*
|
|
1036
|
-
* The set returned contains the index of each regular expression that
|
|
1037
|
-
* matches in the given text. The index is in correspondence with the
|
|
1038
|
-
* order of regular expressions given to `RegexSet`'s constructor.
|
|
1039
|
-
*
|
|
1040
|
-
* The set can also be used to iterate over the matched indices.
|
|
1041
|
-
*
|
|
1042
|
-
* Note that as with searches using `Regex`, the expression is unanchored
|
|
1043
|
-
* by default. That is, if the regex does not start with `^` or `\A`, or
|
|
1044
|
-
* end with `$` or `\z`, then it is permitted to match anywhere in the
|
|
1045
|
-
* text.
|
|
1046
|
-
*
|
|
1047
|
-
* # Example
|
|
1048
|
-
*
|
|
1049
|
-
* Tests which regular expressions match the given text:
|
|
1050
|
-
*
|
|
1051
|
-
* ```typescript
|
|
1052
|
-
* import { RegexSet } from "rregex"
|
|
1053
|
-
*
|
|
1054
|
-
* const set = new RegexSet([
|
|
1055
|
-
* "\w+",
|
|
1056
|
-
* "\d+",
|
|
1057
|
-
* "\pL+",
|
|
1058
|
-
* "foo",
|
|
1059
|
-
* "bar",
|
|
1060
|
-
* "barfoo",
|
|
1061
|
-
* "foobar",
|
|
1062
|
-
* ])
|
|
1063
|
-
* const matches = set.matches("foobar")
|
|
1064
|
-
* expect(matches).toBe([0, 2, 3, 4, 6])
|
|
1065
|
-
* ```
|
|
1066
|
-
*
|
|
1067
|
-
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.matches
|
|
1068
|
-
* @param {string} text - The string against which to match the regular expression
|
|
1069
|
-
* @return {number[]}
|
|
1070
|
-
*/
|
|
1071
|
-
matches(text) {
|
|
1072
|
-
try {
|
|
1073
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1074
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1075
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1076
|
-
wasm.rregexset_matches(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1077
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1078
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1079
|
-
var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1080
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1081
|
-
return v2;
|
|
1082
|
-
} finally {
|
|
1083
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
928
|
}
|
|
1087
929
|
|
|
1088
930
|
const imports = {
|
|
1089
931
|
wbg: {
|
|
1090
|
-
|
|
1091
|
-
const ret = arg0;
|
|
1092
|
-
return
|
|
1093
|
-
},
|
|
1094
|
-
__wbindgen_object_drop_ref: function(arg0) {
|
|
1095
|
-
takeObject(arg0);
|
|
932
|
+
__wbg_buffer_609cc3eee51ed158: function(arg0) {
|
|
933
|
+
const ret = arg0.buffer;
|
|
934
|
+
return ret;
|
|
1096
935
|
},
|
|
1097
|
-
|
|
1098
|
-
const ret =
|
|
1099
|
-
return
|
|
936
|
+
__wbg_fromCodePoint_f37c25c172f2e8b5: function() { return handleError(function (arg0) {
|
|
937
|
+
const ret = String.fromCodePoint(arg0 >>> 0);
|
|
938
|
+
return ret;
|
|
939
|
+
}, arguments) },
|
|
940
|
+
__wbg_from_2a5d3e218e67aa85: function(arg0) {
|
|
941
|
+
const ret = Array.from(arg0);
|
|
942
|
+
return ret;
|
|
1100
943
|
},
|
|
1101
|
-
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1105
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1106
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
1107
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
944
|
+
__wbg_get_b9b93047fe3cf45b: function(arg0, arg1) {
|
|
945
|
+
const ret = arg0[arg1 >>> 0];
|
|
946
|
+
return ret;
|
|
1108
947
|
},
|
|
1109
|
-
|
|
1110
|
-
const ret =
|
|
1111
|
-
return
|
|
948
|
+
__wbg_length_e2d2a49132c1b256: function(arg0) {
|
|
949
|
+
const ret = arg0.length;
|
|
950
|
+
return ret;
|
|
1112
951
|
},
|
|
1113
|
-
|
|
1114
|
-
const ret =
|
|
1115
|
-
return
|
|
952
|
+
__wbg_new_405e22f390576ce2: function() {
|
|
953
|
+
const ret = new Object();
|
|
954
|
+
return ret;
|
|
1116
955
|
},
|
|
1117
|
-
|
|
1118
|
-
|
|
956
|
+
__wbg_new_78feb108b6472713: function() {
|
|
957
|
+
const ret = new Array();
|
|
958
|
+
return ret;
|
|
1119
959
|
},
|
|
1120
|
-
|
|
1121
|
-
const ret =
|
|
1122
|
-
return
|
|
960
|
+
__wbg_new_a12002a7f91c75be: function(arg0) {
|
|
961
|
+
const ret = new Uint8Array(arg0);
|
|
962
|
+
return ret;
|
|
1123
963
|
},
|
|
1124
|
-
|
|
1125
|
-
const ret =
|
|
1126
|
-
return
|
|
964
|
+
__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a: function(arg0, arg1, arg2) {
|
|
965
|
+
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
966
|
+
return ret;
|
|
1127
967
|
},
|
|
1128
|
-
|
|
1129
|
-
const ret =
|
|
968
|
+
__wbg_push_737cfc8c1432c2c6: function(arg0, arg1) {
|
|
969
|
+
const ret = arg0.push(arg1);
|
|
1130
970
|
return ret;
|
|
1131
971
|
},
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
return addHeapObject(ret);
|
|
972
|
+
__wbg_set_37837023f3d740e8: function(arg0, arg1, arg2) {
|
|
973
|
+
arg0[arg1 >>> 0] = arg2;
|
|
1135
974
|
},
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
return addHeapObject(ret);
|
|
975
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
976
|
+
arg0[arg1] = arg2;
|
|
1139
977
|
},
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
978
|
+
__wbg_set_bb8cecf6a62b9f46: function() { return handleError(function (arg0, arg1, arg2) {
|
|
979
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
980
|
+
return ret;
|
|
981
|
+
}, arguments) },
|
|
982
|
+
__wbindgen_bigint_from_u64: function(arg0) {
|
|
983
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
984
|
+
return ret;
|
|
1146
985
|
},
|
|
1147
|
-
|
|
1148
|
-
const ret =
|
|
986
|
+
__wbindgen_error_new: function(arg0, arg1) {
|
|
987
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
1149
988
|
return ret;
|
|
1150
989
|
},
|
|
1151
|
-
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
990
|
+
__wbindgen_init_externref_table: function() {
|
|
991
|
+
const table = wasm.__wbindgen_export_2;
|
|
992
|
+
const offset = table.grow(4);
|
|
993
|
+
table.set(0, undefined);
|
|
994
|
+
table.set(offset + 0, undefined);
|
|
995
|
+
table.set(offset + 1, null);
|
|
996
|
+
table.set(offset + 2, true);
|
|
997
|
+
table.set(offset + 3, false);
|
|
998
|
+
;
|
|
1158
999
|
},
|
|
1159
|
-
|
|
1160
|
-
const ret =
|
|
1161
|
-
return
|
|
1000
|
+
__wbindgen_memory: function() {
|
|
1001
|
+
const ret = wasm.memory;
|
|
1002
|
+
return ret;
|
|
1162
1003
|
},
|
|
1163
|
-
|
|
1164
|
-
const ret =
|
|
1165
|
-
return
|
|
1004
|
+
__wbindgen_number_new: function(arg0) {
|
|
1005
|
+
const ret = arg0;
|
|
1006
|
+
return ret;
|
|
1166
1007
|
},
|
|
1167
|
-
|
|
1168
|
-
const
|
|
1008
|
+
__wbindgen_string_get: function(arg0, arg1) {
|
|
1009
|
+
const obj = arg1;
|
|
1010
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1011
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1012
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1013
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1014
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1015
|
+
},
|
|
1016
|
+
__wbindgen_string_new: function(arg0, arg1) {
|
|
1017
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1169
1018
|
return ret;
|
|
1170
|
-
},
|
|
1019
|
+
},
|
|
1171
1020
|
__wbindgen_throw: function(arg0, arg1) {
|
|
1172
1021
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1173
1022
|
},
|
|
1174
|
-
__wbindgen_memory: function() {
|
|
1175
|
-
const ret = wasm.memory;
|
|
1176
|
-
return addHeapObject(ret);
|
|
1177
|
-
},
|
|
1178
1023
|
},
|
|
1179
1024
|
|
|
1180
1025
|
};
|
|
@@ -1195,6 +1040,9 @@ switch (wasm_url.protocol) {
|
|
|
1195
1040
|
|
|
1196
1041
|
const wasmInstance = (await WebAssembly.instantiate(wasmCode, imports)).instance;
|
|
1197
1042
|
const wasm = wasmInstance.exports;
|
|
1043
|
+
export const __wasm = wasm;
|
|
1044
|
+
|
|
1045
|
+
wasm.__wbindgen_start();
|
|
1198
1046
|
|
|
1199
1047
|
|
|
1200
1048
|
/** Build metadata */
|
|
@@ -1206,6 +1054,6 @@ export const metadata = {
|
|
|
1206
1054
|
],
|
|
1207
1055
|
"homepage": "http://rregex.dev",
|
|
1208
1056
|
"repository": "https://github.com/2fd/rregex",
|
|
1209
|
-
"regex": "1.
|
|
1210
|
-
"regex-syntax": "0.8.
|
|
1057
|
+
"regex": "1.12.4",
|
|
1058
|
+
"regex-syntax": "0.8.11"
|
|
1211
1059
|
}
|