@shd101wyy/yo 0.1.5 → 0.1.6
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/README.md +7 -6
- package/out/cjs/index.cjs +508 -503
- package/out/cjs/yo-cli.cjs +619 -612
- package/out/esm/index.mjs +397 -392
- package/out/types/src/codegen/codegen-c.d.ts +2 -0
- package/out/types/src/codegen/functions/context.d.ts +1 -0
- package/out/types/src/codegen/functions/generation.d.ts +10 -0
- package/out/types/src/codegen/utils/index.d.ts +1 -0
- package/out/types/src/env.d.ts +1 -0
- package/out/types/src/evaluator/builtins/build.d.ts +1 -0
- package/out/types/src/evaluator/context.d.ts +1 -0
- package/out/types/src/expr.d.ts +2 -0
- package/out/types/src/target.d.ts +1 -0
- package/out/types/src/value.d.ts +2 -1
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/build.yo +2 -1
- package/std/collections/array_list.yo +133 -1
- package/std/encoding/html.yo +283 -0
- package/std/encoding/html_char_utils.yo +36 -0
- package/std/encoding/html_entities.yo +2262 -0
- package/std/encoding/punycode.yo +366 -0
- package/std/fmt/to_string.yo +5 -4
- package/std/glob/index.yo +2 -2
- package/std/libc/wctype.yo +55 -0
- package/std/path.yo +6 -6
- package/std/prelude.yo +8 -0
- package/std/regex/parser.yo +69 -4
- package/std/regex/vm.yo +18 -31
- package/std/string/string.yo +1388 -1337
- package/std/string/unicode.yo +242 -0
package/std/regex/vm.yo
CHANGED
|
@@ -22,21 +22,18 @@ NfaThread :: object(
|
|
|
22
22
|
impl(NfaThread,
|
|
23
23
|
new : (fn(pc : usize, n_slots : usize) -> Self)({
|
|
24
24
|
s := ArrayList(usize).with_capacity(n_slots);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// usize.MAX signals "unset"
|
|
28
|
-
s.push(usize.MAX);
|
|
29
|
-
};
|
|
25
|
+
// usize.MAX = 0xFF..FF, so memset with 0xFF fills each byte
|
|
26
|
+
s.resize_with_byte(n_slots, int(255));
|
|
30
27
|
Self(pc: pc, slots: s)
|
|
31
28
|
}),
|
|
32
29
|
|
|
33
30
|
// Clone a thread with a new PC
|
|
34
31
|
fork : (fn(self : Self, new_pc : usize) -> Self)({
|
|
35
32
|
new_slots := ArrayList(usize).with_capacity(self.slots.len());
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
match(self.slots.ptr(),
|
|
34
|
+
.Some(src) => new_slots.extend_from_ptr(src, self.slots.len()),
|
|
35
|
+
.None => ()
|
|
36
|
+
);
|
|
40
37
|
Self(pc: new_pc, slots: new_slots)
|
|
41
38
|
})
|
|
42
39
|
);
|
|
@@ -233,14 +230,15 @@ impl(NfaVm,
|
|
|
233
230
|
true => ()
|
|
234
231
|
);
|
|
235
232
|
|
|
236
|
-
|
|
233
|
+
// Already checked bounds above: thread.pc < instructions.len()
|
|
234
|
+
is_seen := seen.*.get_unchecked(thread.pc);
|
|
237
235
|
cond(
|
|
238
236
|
is_seen => { return (); },
|
|
239
237
|
true => ()
|
|
240
238
|
);
|
|
241
|
-
seen.*.
|
|
239
|
+
seen.*.set_unchecked(thread.pc, true);
|
|
242
240
|
|
|
243
|
-
instr := self._program.instructions.
|
|
241
|
+
instr := self._program.instructions.get_unchecked(thread.pc);
|
|
244
242
|
|
|
245
243
|
match(instr.kind,
|
|
246
244
|
.Split => {
|
|
@@ -326,10 +324,7 @@ impl(NfaVm,
|
|
|
326
324
|
sub_next := ArrayList(NfaThread).new();
|
|
327
325
|
|
|
328
326
|
sub_seen := ArrayList(bool).with_capacity(self._program.instructions.len());
|
|
329
|
-
|
|
330
|
-
while (si < self._program.instructions.len()), (si = (si + usize(1))), {
|
|
331
|
-
sub_seen.push(false);
|
|
332
|
-
};
|
|
327
|
+
sub_seen.resize_with_byte(self._program.instructions.len(), int(0));
|
|
333
328
|
|
|
334
329
|
initial := NfaThread.new(sub_start_pc, self._n_slots);
|
|
335
330
|
self._add_thread(&(sub_current), initial, start_byte, &(sub_seen));
|
|
@@ -376,10 +371,7 @@ impl(NfaVm,
|
|
|
376
371
|
sub_blen := decoded.byte_len;
|
|
377
372
|
|
|
378
373
|
// Clear seen
|
|
379
|
-
|
|
380
|
-
while (sj < sub_seen.len()), (sj = (sj + usize(1))), {
|
|
381
|
-
sub_seen.set(sj, false);
|
|
382
|
-
};
|
|
374
|
+
sub_seen.fill_with_byte(int(0));
|
|
383
375
|
|
|
384
376
|
// Process consuming instructions
|
|
385
377
|
st2 := usize(0);
|
|
@@ -446,11 +438,9 @@ impl(NfaVm,
|
|
|
446
438
|
|
|
447
439
|
seen := ArrayList(bool).with_capacity(self._program.instructions.len());
|
|
448
440
|
next_seen := ArrayList(bool).with_capacity(self._program.instructions.len());
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
next_seen.push(false);
|
|
453
|
-
};
|
|
441
|
+
// Fill with false (0x00) using memset
|
|
442
|
+
seen.resize_with_byte(self._program.instructions.len(), int(0));
|
|
443
|
+
next_seen.resize_with_byte(self._program.instructions.len(), int(0));
|
|
454
444
|
|
|
455
445
|
initial := NfaThread.new(usize(0), self._n_slots);
|
|
456
446
|
self._add_thread(&(current), initial, start_byte, &(seen));
|
|
@@ -474,12 +464,9 @@ impl(NfaVm,
|
|
|
474
464
|
true => ()
|
|
475
465
|
);
|
|
476
466
|
|
|
477
|
-
// Clear seen flags for this generation
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
seen.set(j, false);
|
|
481
|
-
next_seen.set(j, false);
|
|
482
|
-
};
|
|
467
|
+
// Clear seen flags for this generation using memset
|
|
468
|
+
seen.fill_with_byte(int(0));
|
|
469
|
+
next_seen.fill_with_byte(int(0));
|
|
483
470
|
|
|
484
471
|
// Process deferred threads targeting this byte_pos
|
|
485
472
|
new_deferred := ArrayList(DeferredThread).new();
|