toilscript 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +94 -0
- package/README.md +114 -0
- package/bin/asc.js +35 -0
- package/bin/asinit.js +468 -0
- package/dist/asc.d.ts +4 -0
- package/dist/toilscript.d.ts +4 -0
- package/dist/transform.cjs +1 -0
- package/dist/transform.d.ts +1 -0
- package/dist/transform.js +1 -0
- package/lib/binaryen.d.ts +2 -0
- package/lib/binaryen.js +2 -0
- package/package.json +114 -0
- package/std/README.md +6 -0
- package/std/assembly/array.ts +550 -0
- package/std/assembly/arraybuffer.ts +77 -0
- package/std/assembly/atomics.ts +127 -0
- package/std/assembly/bindings/asyncify.ts +16 -0
- package/std/assembly/bindings/dom.ts +291 -0
- package/std/assembly/bindings/node.ts +6 -0
- package/std/assembly/bitflags.ts +53 -0
- package/std/assembly/builtins.ts +2650 -0
- package/std/assembly/byteslice.ts +177 -0
- package/std/assembly/compat.ts +2 -0
- package/std/assembly/console.ts +42 -0
- package/std/assembly/crypto.ts +9 -0
- package/std/assembly/dataview.ts +181 -0
- package/std/assembly/date.ts +375 -0
- package/std/assembly/diagnostics.ts +11 -0
- package/std/assembly/encoding.ts +151 -0
- package/std/assembly/endian.ts +45 -0
- package/std/assembly/error.ts +44 -0
- package/std/assembly/fixedarray.ts +173 -0
- package/std/assembly/fixedmap.ts +326 -0
- package/std/assembly/fixedset.ts +275 -0
- package/std/assembly/function.ts +42 -0
- package/std/assembly/index.d.ts +2891 -0
- package/std/assembly/iterator.ts +35 -0
- package/std/assembly/map.ts +269 -0
- package/std/assembly/math.ts +3289 -0
- package/std/assembly/memory.ts +123 -0
- package/std/assembly/number.ts +388 -0
- package/std/assembly/object.ts +36 -0
- package/std/assembly/performance.ts +9 -0
- package/std/assembly/pointer.ts +80 -0
- package/std/assembly/polyfills.ts +27 -0
- package/std/assembly/process.ts +50 -0
- package/std/assembly/reference.ts +48 -0
- package/std/assembly/regexp.ts +12 -0
- package/std/assembly/rt/README.md +83 -0
- package/std/assembly/rt/common.ts +81 -0
- package/std/assembly/rt/index-incremental.ts +2 -0
- package/std/assembly/rt/index-memory.ts +1 -0
- package/std/assembly/rt/index-minimal.ts +2 -0
- package/std/assembly/rt/index-stub.ts +1 -0
- package/std/assembly/rt/index.d.ts +37 -0
- package/std/assembly/rt/itcms.ts +419 -0
- package/std/assembly/rt/memory-runtime.ts +94 -0
- package/std/assembly/rt/rtrace.ts +15 -0
- package/std/assembly/rt/stub.ts +133 -0
- package/std/assembly/rt/tcms.ts +254 -0
- package/std/assembly/rt/tlsf.ts +592 -0
- package/std/assembly/rt.ts +90 -0
- package/std/assembly/set.ts +225 -0
- package/std/assembly/shared/feature.ts +68 -0
- package/std/assembly/shared/runtime.ts +13 -0
- package/std/assembly/shared/target.ts +11 -0
- package/std/assembly/shared/tsconfig.json +11 -0
- package/std/assembly/shared/typeinfo.ts +72 -0
- package/std/assembly/staticarray.ts +423 -0
- package/std/assembly/string.ts +850 -0
- package/std/assembly/symbol.ts +114 -0
- package/std/assembly/table.ts +16 -0
- package/std/assembly/tsconfig.json +6 -0
- package/std/assembly/typedarray.ts +1954 -0
- package/std/assembly/uri.ts +17 -0
- package/std/assembly/util/bytes.ts +107 -0
- package/std/assembly/util/casemap.ts +497 -0
- package/std/assembly/util/error.ts +58 -0
- package/std/assembly/util/hash.ts +117 -0
- package/std/assembly/util/math.ts +1922 -0
- package/std/assembly/util/memory.ts +290 -0
- package/std/assembly/util/number.ts +873 -0
- package/std/assembly/util/sort.ts +313 -0
- package/std/assembly/util/string.ts +1202 -0
- package/std/assembly/util/uri.ts +275 -0
- package/std/assembly/vector.ts +4 -0
- package/std/assembly.json +16 -0
- package/std/portable/index.d.ts +461 -0
- package/std/portable/index.js +416 -0
- package/std/portable.json +11 -0
- package/std/types/assembly/index.d.ts +1 -0
- package/std/types/assembly/package.json +3 -0
- package/std/types/portable/index.d.ts +1 -0
- package/std/types/portable/package.json +3 -0
- package/tsconfig-base.json +13 -0
- package/util/README.md +23 -0
- package/util/browser/fs.js +1 -0
- package/util/browser/module.js +5 -0
- package/util/browser/path.js +520 -0
- package/util/browser/process.js +59 -0
- package/util/browser/url.js +23 -0
- package/util/cpu.d.ts +9 -0
- package/util/cpu.js +42 -0
- package/util/find.d.ts +6 -0
- package/util/find.js +20 -0
- package/util/node.d.ts +21 -0
- package/util/node.js +34 -0
- package/util/options.d.ts +70 -0
- package/util/options.js +262 -0
- package/util/terminal.d.ts +52 -0
- package/util/terminal.js +35 -0
- package/util/text.d.ts +26 -0
- package/util/text.js +114 -0
- package/util/tsconfig.json +9 -0
- package/util/web.d.ts +11 -0
- package/util/web.js +33 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { encode, decode, URI_UNSAFE, URL_UNSAFE } from "./util/uri";
|
|
2
|
+
|
|
3
|
+
export function encodeURI(str: string): string {
|
|
4
|
+
return changetype<string>(encode(changetype<usize>(str), str.length, URI_UNSAFE));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function decodeURI(str: string): string {
|
|
8
|
+
return changetype<string>(decode(changetype<usize>(str), str.length, false));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function encodeURIComponent(str: string): string {
|
|
12
|
+
return changetype<string>(encode(changetype<usize>(str), str.length, URL_UNSAFE));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function decodeURIComponent(str: string): string {
|
|
16
|
+
return changetype<string>(decode(changetype<usize>(str), str.length, true));
|
|
17
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export function REVERSE<T>(ptr: usize, len: usize): void {
|
|
2
|
+
if (len > 1) {
|
|
3
|
+
let
|
|
4
|
+
i: usize = 0,
|
|
5
|
+
tail: usize,
|
|
6
|
+
hlen: usize = len >> 1;
|
|
7
|
+
|
|
8
|
+
if (ASC_SHRINK_LEVEL < 1) {
|
|
9
|
+
if (sizeof<T>() == 1) {
|
|
10
|
+
// TODO: Decide later: Does we need this fast path cases?
|
|
11
|
+
//
|
|
12
|
+
// if (len == 4) {
|
|
13
|
+
// store<u32>(ptr, bswap(load<u32>(ptr)));
|
|
14
|
+
// return;
|
|
15
|
+
// }
|
|
16
|
+
// if (len == 8) {
|
|
17
|
+
// store<u64>(ptr, bswap(load<u64>(ptr)));
|
|
18
|
+
// return;
|
|
19
|
+
// }
|
|
20
|
+
tail = len - 8;
|
|
21
|
+
while (i + 7 < hlen) {
|
|
22
|
+
let front = ptr + i;
|
|
23
|
+
let back = ptr + tail - i;
|
|
24
|
+
let temp = bswap(load<u64>(front));
|
|
25
|
+
store<u64>(front, bswap(load<u64>(back)));
|
|
26
|
+
store<u64>(back, temp);
|
|
27
|
+
i += 8;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (sizeof<T>() == 2) {
|
|
32
|
+
tail = len - 2;
|
|
33
|
+
while (i + 1 < hlen) {
|
|
34
|
+
let front = ptr + (i << 1);
|
|
35
|
+
let back = ptr + (tail - i << 1);
|
|
36
|
+
let temp = rotr(load<u32>(back), 16);
|
|
37
|
+
store<u32>(back, rotr(load<u32>(front), 16));
|
|
38
|
+
store<u32>(front, temp);
|
|
39
|
+
i += 2;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
tail = len - 1;
|
|
45
|
+
while (i < hlen) {
|
|
46
|
+
let front = ptr + (i << alignof<T>());
|
|
47
|
+
let back = ptr + (tail - i << alignof<T>());
|
|
48
|
+
let temp = load<T>(front);
|
|
49
|
+
store<T>(front, load<T>(back));
|
|
50
|
+
store<T>(back, temp);
|
|
51
|
+
i++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function FILL<T>(
|
|
57
|
+
ptr: usize,
|
|
58
|
+
len: usize,
|
|
59
|
+
value: T,
|
|
60
|
+
start: isize,
|
|
61
|
+
end: isize
|
|
62
|
+
): void {
|
|
63
|
+
start = start < 0 ? max(len + start, 0) : min(start, len);
|
|
64
|
+
end = end < 0 ? max(len + end, 0) : min(end, len);
|
|
65
|
+
|
|
66
|
+
if (sizeof<T>() == 1) {
|
|
67
|
+
if (start < end) {
|
|
68
|
+
memory.fill(
|
|
69
|
+
ptr + <usize>start,
|
|
70
|
+
u8(value),
|
|
71
|
+
<usize>(end - start)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
if (ASC_SHRINK_LEVEL <= 1) {
|
|
76
|
+
if (isInteger<T>()) {
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
if (value == <T>0 | value == <T>-1) {
|
|
79
|
+
if (start < end) {
|
|
80
|
+
memory.fill(
|
|
81
|
+
ptr + (<usize>start << alignof<T>()),
|
|
82
|
+
u8(value),
|
|
83
|
+
<usize>(end - start) << alignof<T>()
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
} else if (isFloat<T>()) {
|
|
89
|
+
// for floating non-negative zeros we can use fast memory.fill
|
|
90
|
+
if ((sizeof<T>() == 4 && reinterpret<u32>(f32(value)) == 0) ||
|
|
91
|
+
(sizeof<T>() == 8 && reinterpret<u64>(f64(value)) == 0)) {
|
|
92
|
+
if (start < end) {
|
|
93
|
+
memory.fill(
|
|
94
|
+
ptr + (<usize>start << alignof<T>()),
|
|
95
|
+
0,
|
|
96
|
+
<usize>(end - start) << alignof<T>()
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (; start < end; ++start) {
|
|
104
|
+
store<T>(ptr + (<usize>start << alignof<T>()), value);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
// Total tables size: ~5 kb (usually compressed to ~4 kb)
|
|
2
|
+
// See: https://git.musl-libc.org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0, 0, 0, 0,
|
|
40
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
41
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
42
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
43
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
44
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36,
|
|
45
|
+
43, 43, 43, 43, 43, 43, 43, 43, 1, 0, 84, 86, 86, 86, 86, 86,
|
|
46
|
+
86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
47
|
+
0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 43, 43, 43, 43, 43, 43,
|
|
48
|
+
43, 7, 43, 43, 91, 86, 86, 86, 86, 86, 86, 86, 74, 86, 86, 5,
|
|
49
|
+
49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
|
|
50
|
+
36, 80, 121, 49, 80, 49, 80, 49, 56, 80, 49, 80, 49, 80, 49, 80,
|
|
51
|
+
49, 80, 49, 80, 49, 80, 49, 80, 78, 49, 2, 78, 13, 13, 78, 3,
|
|
52
|
+
78, 0, 36, 110, 0, 78, 49, 38, 110, 81, 78, 36, 80, 78, 57, 20,
|
|
53
|
+
129, 27, 29, 29, 83, 49, 80, 49, 80, 13, 49, 80, 49, 80, 49, 80,
|
|
54
|
+
27, 83, 36, 80, 49, 2, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123,
|
|
55
|
+
20, 121, 92, 123, 92, 123, 92, 45, 43, 73, 3, 72, 3, 120, 92, 123,
|
|
56
|
+
20, 0, 150, 10, 1, 43, 40, 6, 6, 0, 42, 6, 42, 42, 43, 7,
|
|
57
|
+
187, 181, 43, 30, 0, 43, 7, 43, 43, 43, 1, 43, 43, 43, 43, 43,
|
|
58
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
59
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43,
|
|
60
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
61
|
+
43, 43, 43, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
62
|
+
43, 205, 70, 205, 43, 0, 37, 43, 7, 1, 6, 1, 85, 86, 86, 86,
|
|
63
|
+
86, 86, 85, 86, 86, 2, 36, 129, 129, 129, 129, 129, 21, 129, 129, 129,
|
|
64
|
+
0, 0, 43, 0, 178, 209, 178, 209, 178, 209, 178, 209, 0, 0, 205, 204,
|
|
65
|
+
1, 0, 215, 215, 215, 215, 215, 131, 129, 129, 129, 129, 129, 129, 129, 129,
|
|
66
|
+
129, 129, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 28, 0, 0, 0,
|
|
67
|
+
0, 0, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 2, 0, 0,
|
|
68
|
+
49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
|
|
69
|
+
49, 80, 78, 49, 80, 49, 80, 78, 49, 80, 49, 80, 49, 80, 49, 80,
|
|
70
|
+
49, 80, 49, 80, 49, 80, 49, 2, 135, 166, 135, 166, 135, 166, 135, 166,
|
|
71
|
+
135, 166, 135, 166, 135, 166, 135, 166, 42, 43, 43, 43, 43, 43, 43, 43,
|
|
72
|
+
43, 43, 43, 43, 43, 0, 0, 0, 84, 86, 86, 86, 86, 86, 86, 86,
|
|
73
|
+
86, 86, 86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
74
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
75
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
76
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
77
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
78
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
79
|
+
0, 0, 0, 84, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
|
|
80
|
+
12, 0, 12, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
81
|
+
43, 7, 42, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
82
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
83
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
84
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43,
|
|
85
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
86
|
+
43, 43, 43, 43, 86, 86, 108, 129, 21, 0, 43, 43, 43, 43, 43, 43,
|
|
87
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
88
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
89
|
+
43, 43, 43, 43, 7, 108, 3, 65, 43, 43, 86, 86, 86, 86, 86, 86,
|
|
90
|
+
86, 86, 86, 86, 86, 86, 86, 86, 44, 86, 43, 43, 43, 43, 43, 43,
|
|
91
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1,
|
|
92
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
93
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
94
|
+
0, 0, 0, 0, 0, 0, 0, 0, 12, 108, 0, 0, 0, 0, 0, 6,
|
|
95
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
96
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
97
|
+
0, 0, 0, 0, 0, 0, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37,
|
|
98
|
+
6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37,
|
|
99
|
+
6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37,
|
|
100
|
+
6, 37, 6, 37, 6, 37, 6, 37, 86, 122, 158, 38, 6, 37, 6, 37,
|
|
101
|
+
6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37,
|
|
102
|
+
6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 1, 43, 43, 79, 86,
|
|
103
|
+
86, 44, 43, 127, 86, 86, 57, 43, 43, 85, 86, 86, 43, 43, 79, 86,
|
|
104
|
+
86, 44, 43, 127, 86, 86, 129, 55, 117, 91, 123, 92, 43, 43, 79, 86,
|
|
105
|
+
86, 2, 172, 4, 0, 0, 57, 43, 43, 85, 86, 86, 43, 43, 79, 86,
|
|
106
|
+
86, 44, 43, 43, 86, 86, 50, 19, 129, 87, 0, 111, 129, 126, 201, 215,
|
|
107
|
+
126, 45, 129, 129, 14, 126, 57, 127, 111, 87, 0, 129, 129, 126, 21, 0,
|
|
108
|
+
126, 3, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 43,
|
|
109
|
+
36, 43, 151, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 43, 43, 43,
|
|
110
|
+
43, 43, 86, 86, 86, 86, 86, 128, 129, 129, 129, 129, 57, 187, 42, 43,
|
|
111
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
112
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
113
|
+
43, 43, 43, 43, 43, 43, 43, 1, 129, 129, 129, 129, 129, 129, 129, 129,
|
|
114
|
+
129, 129, 129, 129, 129, 129, 129, 201, 172, 172, 172, 172, 172, 172, 172, 172,
|
|
115
|
+
172, 172, 172, 172, 172, 172, 172, 208, 13, 0, 78, 49, 2, 180, 193, 193,
|
|
116
|
+
215, 215, 36, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
|
|
117
|
+
49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
|
|
118
|
+
49, 80, 49, 80, 215, 215, 83, 193, 71, 212, 215, 215, 215, 5, 43, 43,
|
|
119
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 1, 0, 1, 0, 0,
|
|
120
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
121
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
122
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
123
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
124
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
125
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 49, 80, 49, 80, 49, 80,
|
|
126
|
+
49, 80, 49, 80, 49, 80, 49, 80, 13, 0, 0, 0, 0, 0, 36, 80,
|
|
127
|
+
49, 80, 49, 80, 49, 80, 49, 80, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
128
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
129
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 43,
|
|
130
|
+
43, 43, 43, 43, 43, 121, 92, 123, 92, 123, 79, 123, 92, 123, 92, 123,
|
|
131
|
+
92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 45,
|
|
132
|
+
43, 43, 121, 20, 92, 123, 92, 45, 121, 42, 92, 39, 92, 123, 92, 123,
|
|
133
|
+
92, 123, 164, 0, 10, 180, 92, 123, 92, 123, 79, 3, 120, 56, 43, 43,
|
|
134
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 79, 45, 43, 43, 1,
|
|
135
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
136
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0,
|
|
137
|
+
0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
138
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
139
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
140
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
141
|
+
0, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 72, 86, 86, 86, 86,
|
|
142
|
+
86, 86, 86, 86, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
143
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
144
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
145
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43,
|
|
146
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 85, 86, 86, 86, 86, 86, 86,
|
|
147
|
+
86, 86, 86, 86, 86, 86, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
148
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
149
|
+
0, 0, 0, 0, 0, 0, 36, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
|
150
|
+
43, 43, 7, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
|
|
151
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
152
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
153
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 43, 43, 43,
|
|
154
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 0,
|
|
155
|
+
0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
|
|
156
|
+
86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
157
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
158
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
159
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43,
|
|
160
|
+
43, 43, 43, 43, 43, 43, 43, 43, 86, 86, 86, 86, 86, 86, 86, 86,
|
|
161
|
+
86, 86, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
162
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
163
|
+
0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 86, 86,
|
|
164
|
+
86, 86, 86, 86, 86, 86, 86, 86, 14, 0, 0, 0, 0, 0, 0, 0,
|
|
165
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
166
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
167
|
+
0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 85,
|
|
168
|
+
86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 14, 0, 0, 0, 0, 0,
|
|
169
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
170
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
171
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
172
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
173
|
+
]);
|
|
174
|
+
|
|
175
|
+
// @ts-ignore: decorator
|
|
176
|
+
@lazy @inline const RULES = memory.data<i32>([
|
|
177
|
+
0x0, 0x2001, -0x2000, 0x1dbf00, 0x2e700, 0x7900,
|
|
178
|
+
0x2402, 0x101, -0x100, 0x0, 0x201, -0x200,
|
|
179
|
+
-0xc6ff, -0xe800, -0x78ff, -0x12c00, 0xc300, 0xd201,
|
|
180
|
+
0xce01, 0xcd01, 0x4f01, 0xca01, 0xcb01, 0xcf01,
|
|
181
|
+
0x6100, 0xd301, 0xd101, 0xa300, 0xd501, 0x8200,
|
|
182
|
+
0xd601, 0xda01, 0xd901, 0xdb01, 0x3800, 0x3,
|
|
183
|
+
-0x4f00, -0x60ff, -0x37ff, 0x242802, 0x0, 0x101,
|
|
184
|
+
-0x100, -0xcd00, -0xda00, -0x81ff, 0x2a2b01, -0xa2ff,
|
|
185
|
+
0x2a2801, 0x2a3f00, -0xc2ff, 0x4501, 0x4701, 0x2a1f00,
|
|
186
|
+
0x2a1c00, 0x2a1e00, -0xd200, -0xce00, -0xca00, -0xcb00,
|
|
187
|
+
0xa54f00, 0xa54b00, -0xcf00, 0xa52800, 0xa54400, -0xd100,
|
|
188
|
+
-0xd300, 0x29f700, 0xa54100, 0x29fd00, -0xd500, -0xd600,
|
|
189
|
+
0x29e700, 0xa54300, 0xa52a00, -0x4500, -0xd900, -0x4700,
|
|
190
|
+
-0xdb00, 0xa51500, 0xa51200, 0x4c2402, 0x0, 0x2001,
|
|
191
|
+
-0x2000, 0x101, -0x100, 0x5400, 0x7401, 0x2601,
|
|
192
|
+
0x2501, 0x4001, 0x3f01, -0x2600, -0x2500, -0x1f00,
|
|
193
|
+
-0x4000, -0x3f00, 0x801, -0x3e00, -0x3900, -0x2f00,
|
|
194
|
+
-0x3600, -0x800, -0x5600, -0x5000, 0x700, -0x7400,
|
|
195
|
+
-0x3bff, -0x6000, -0x6ff, 0x701a02, 0x101, -0x100,
|
|
196
|
+
0x2001, -0x2000, 0x5001, 0xf01, -0xf00, 0x0,
|
|
197
|
+
0x3001, -0x3000, 0x101, -0x100, 0x0, 0xbc000,
|
|
198
|
+
0x1c6001, 0x0, 0x97d001, 0x801, -0x800, 0x8a0502,
|
|
199
|
+
0x0, -0xbbfff, -0x186200, 0x89c200, -0x182500, -0x186e00,
|
|
200
|
+
-0x186d00, -0x186400, -0x186300, -0x185c00, 0x0, 0x8a3800,
|
|
201
|
+
0x8a0400, 0xee600, 0x101, -0x100, 0x0, -0x3b00,
|
|
202
|
+
-0x1dbeff, 0x8f1d02, 0x800, -0x7ff, 0x0, 0x5600,
|
|
203
|
+
-0x55ff, 0x4a00, 0x6400, 0x8000, 0x7000, 0x7e00,
|
|
204
|
+
0x900, -0x49ff, -0x8ff, -0x1c2500, -0x63ff, -0x6fff,
|
|
205
|
+
-0x7fff, -0x7dff, 0xac0502, 0x0, 0x1001, -0x1000,
|
|
206
|
+
0x1c01, 0x101, -0x1d5cff, -0x20beff, -0x2045ff, -0x1c00,
|
|
207
|
+
0xb10b02, 0x101, -0x100, 0x3001, -0x3000, 0x0,
|
|
208
|
+
-0x29f6ff, -0xee5ff, -0x29e6ff, -0x2a2b00, -0x2a2800, -0x2a1bff,
|
|
209
|
+
-0x29fcff, -0x2a1eff, -0x2a1dff, -0x2a3eff, 0x0, -0x1c6000,
|
|
210
|
+
0x0, 0x101, -0x100, 0xbc0c02, 0x0, 0x101,
|
|
211
|
+
-0x100, -0xa543ff, 0x3a001, -0x8a03ff, -0xa527ff, 0x3000,
|
|
212
|
+
-0xa54eff, -0xa54aff, -0xa540ff, -0xa511ff, -0xa529ff, -0xa514ff,
|
|
213
|
+
-0x2fff, -0xa542ff, -0x8a37ff, 0x0, -0x97d000, -0x3a000,
|
|
214
|
+
0x0, 0x2001, -0x2000, 0x0, 0x2801, -0x2800,
|
|
215
|
+
0x0, 0x4001, -0x4000, 0x0, 0x2001, -0x2000,
|
|
216
|
+
0x0, 0x2001, -0x2000, 0x0, 0x2201, -0x2200
|
|
217
|
+
]);
|
|
218
|
+
|
|
219
|
+
// @ts-ignore: decorator
|
|
220
|
+
@lazy @inline const RULE_BASES = memory.data<u8>([
|
|
221
|
+
0, 6, 39, 81, 111, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
222
|
+
124, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 131, 142, 146, 151,
|
|
223
|
+
0, 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, 196, 0, 0,
|
|
224
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
225
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
226
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
227
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
246
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
247
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
248
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
249
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
250
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
251
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 237, 0, 0, 0, 0, 0, 0,
|
|
252
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
253
|
+
]);
|
|
254
|
+
|
|
255
|
+
// @ts-ignore: decorator
|
|
256
|
+
@lazy @inline const EXCEPTIONS = memory.data<u8>([
|
|
257
|
+
48, 12, 49, 13, 120, 14, 127, 15,
|
|
258
|
+
128, 16, 129, 17, 134, 18, 137, 19,
|
|
259
|
+
138, 19, 142, 20, 143, 21, 144, 22,
|
|
260
|
+
147, 19, 148, 23, 149, 24, 150, 25,
|
|
261
|
+
151, 26, 154, 27, 156, 25, 157, 28,
|
|
262
|
+
158, 29, 159, 30, 166, 31, 169, 31,
|
|
263
|
+
174, 31, 177, 32, 178, 32, 183, 33,
|
|
264
|
+
191, 34, 197, 35, 200, 35, 203, 35,
|
|
265
|
+
221, 36, 242, 35, 246, 37, 247, 38,
|
|
266
|
+
32, 45, 58, 46, 61, 47, 62, 48,
|
|
267
|
+
63, 49, 64, 49, 67, 50, 68, 51,
|
|
268
|
+
69, 52, 80, 53, 81, 54, 82, 55,
|
|
269
|
+
83, 56, 84, 57, 89, 58, 91, 59,
|
|
270
|
+
92, 60, 97, 61, 99, 62, 101, 63,
|
|
271
|
+
102, 64, 104, 65, 105, 66, 106, 64,
|
|
272
|
+
107, 67, 108, 68, 111, 66, 113, 69,
|
|
273
|
+
114, 70, 117, 71, 125, 72, 130, 73,
|
|
274
|
+
135, 74, 137, 75, 138, 76, 139, 76,
|
|
275
|
+
140, 77, 146, 78, 157, 79, 158, 80,
|
|
276
|
+
69, 87, 123, 29, 124, 29, 125, 29,
|
|
277
|
+
127, 88, 134, 89, 136, 90, 137, 90,
|
|
278
|
+
138, 90, 140, 91, 142, 92, 143, 92,
|
|
279
|
+
172, 93, 173, 94, 174, 94, 175, 94,
|
|
280
|
+
194, 95, 204, 96, 205, 97, 206, 97,
|
|
281
|
+
207, 98, 208, 99, 209, 100, 213, 101,
|
|
282
|
+
214, 102, 215, 103, 240, 104, 241, 105,
|
|
283
|
+
242, 106, 243, 107, 244, 108, 245, 109,
|
|
284
|
+
249, 110, 253, 45, 254, 45, 255, 45,
|
|
285
|
+
80, 105, 81, 105, 82, 105, 83, 105,
|
|
286
|
+
84, 105, 85, 105, 86, 105, 87, 105,
|
|
287
|
+
88, 105, 89, 105, 90, 105, 91, 105,
|
|
288
|
+
92, 105, 93, 105, 94, 105, 95, 105,
|
|
289
|
+
130, 0, 131, 0, 132, 0, 133, 0,
|
|
290
|
+
134, 0, 135, 0, 136, 0, 137, 0,
|
|
291
|
+
192, 117, 207, 118, 128, 137, 129, 138,
|
|
292
|
+
130, 139, 133, 140, 134, 141, 112, 157,
|
|
293
|
+
113, 157, 118, 158, 119, 158, 120, 159,
|
|
294
|
+
121, 159, 122, 160, 123, 160, 124, 161,
|
|
295
|
+
125, 161, 179, 162, 186, 163, 187, 163,
|
|
296
|
+
188, 164, 190, 165, 195, 162, 204, 164,
|
|
297
|
+
218, 166, 219, 166, 229, 106, 234, 167,
|
|
298
|
+
235, 167, 236, 110, 243, 162, 248, 168,
|
|
299
|
+
249, 168, 250, 169, 251, 169, 252, 164,
|
|
300
|
+
38, 176, 42, 177, 43, 178, 78, 179,
|
|
301
|
+
132, 8, 98, 186, 99, 187, 100, 188,
|
|
302
|
+
101, 189, 102, 190, 109, 191, 110, 192,
|
|
303
|
+
111, 193, 112, 194, 126, 195, 127, 195,
|
|
304
|
+
125, 207, 141, 208, 148, 209, 171, 210,
|
|
305
|
+
172, 211, 173, 212, 176, 213, 177, 214,
|
|
306
|
+
178, 215, 196, 216, 197, 217, 198, 218
|
|
307
|
+
]);
|
|
308
|
+
|
|
309
|
+
/* Special Case Mappings
|
|
310
|
+
* See: https://unicode.org/Public/UNIDATA/SpecialCasing.txt
|
|
311
|
+
*/
|
|
312
|
+
|
|
313
|
+
/*
|
|
314
|
+
@lazy @inline
|
|
315
|
+
const SPECIALS_LOWER: StaticArray<u16> = [
|
|
316
|
+
0x0130, 0x0069, 0x0307, 0x0000,
|
|
317
|
+
];
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
// @ts-ignore: decorator
|
|
321
|
+
@lazy @inlne
|
|
322
|
+
export const SPECIALS_UPPER: StaticArray<u16> = [
|
|
323
|
+
// String#toUpperCase needs .length
|
|
324
|
+
0x00DF, 0x0053, 0x0053, 0x0000,
|
|
325
|
+
0x0149, 0x02BC, 0x004E, 0x0000,
|
|
326
|
+
0x01F0, 0x004A, 0x030C, 0x0000,
|
|
327
|
+
0x0390, 0x0399, 0x0308, 0x0301,
|
|
328
|
+
0x03B0, 0x03A5, 0x0308, 0x0301,
|
|
329
|
+
0x0587, 0x0535, 0x0552, 0x0000,
|
|
330
|
+
0x1E96, 0x0048, 0x0331, 0x0000,
|
|
331
|
+
0x1E97, 0x0054, 0x0308, 0x0000,
|
|
332
|
+
0x1E98, 0x0057, 0x030A, 0x0000,
|
|
333
|
+
0x1E99, 0x0059, 0x030A, 0x0000,
|
|
334
|
+
0x1E9A, 0x0041, 0x02BE, 0x0000,
|
|
335
|
+
0x1F50, 0x03A5, 0x0313, 0x0000,
|
|
336
|
+
0x1F52, 0x03A5, 0x0313, 0x0300,
|
|
337
|
+
0x1F54, 0x03A5, 0x0313, 0x0301,
|
|
338
|
+
0x1F56, 0x03A5, 0x0313, 0x0342,
|
|
339
|
+
0x1F80, 0x1F08, 0x0399, 0x0000,
|
|
340
|
+
0x1F81, 0x1F09, 0x0399, 0x0000,
|
|
341
|
+
0x1F82, 0x1F0A, 0x0399, 0x0000,
|
|
342
|
+
0x1F83, 0x1F0B, 0x0399, 0x0000,
|
|
343
|
+
0x1F84, 0x1F0C, 0x0399, 0x0000,
|
|
344
|
+
0x1F85, 0x1F0D, 0x0399, 0x0000,
|
|
345
|
+
0x1F86, 0x1F0E, 0x0399, 0x0000,
|
|
346
|
+
0x1F87, 0x1F0F, 0x0399, 0x0000,
|
|
347
|
+
0x1F88, 0x1F08, 0x0399, 0x0000,
|
|
348
|
+
0x1F89, 0x1F09, 0x0399, 0x0000,
|
|
349
|
+
0x1F8A, 0x1F0A, 0x0399, 0x0000,
|
|
350
|
+
0x1F8B, 0x1F0B, 0x0399, 0x0000,
|
|
351
|
+
0x1F8C, 0x1F0C, 0x0399, 0x0000,
|
|
352
|
+
0x1F8D, 0x1F0D, 0x0399, 0x0000,
|
|
353
|
+
0x1F8E, 0x1F0E, 0x0399, 0x0000,
|
|
354
|
+
0x1F8F, 0x1F0F, 0x0399, 0x0000,
|
|
355
|
+
0x1F90, 0x1F28, 0x0399, 0x0000,
|
|
356
|
+
0x1F91, 0x1F29, 0x0399, 0x0000,
|
|
357
|
+
0x1F92, 0x1F2A, 0x0399, 0x0000,
|
|
358
|
+
0x1F93, 0x1F2B, 0x0399, 0x0000,
|
|
359
|
+
0x1F94, 0x1F2C, 0x0399, 0x0000,
|
|
360
|
+
0x1F95, 0x1F2D, 0x0399, 0x0000,
|
|
361
|
+
0x1F96, 0x1F2E, 0x0399, 0x0000,
|
|
362
|
+
0x1F97, 0x1F2F, 0x0399, 0x0000,
|
|
363
|
+
0x1F98, 0x1F28, 0x0399, 0x0000,
|
|
364
|
+
0x1F99, 0x1F29, 0x0399, 0x0000,
|
|
365
|
+
0x1F9A, 0x1F2A, 0x0399, 0x0000,
|
|
366
|
+
0x1F9B, 0x1F2B, 0x0399, 0x0000,
|
|
367
|
+
0x1F9C, 0x1F2C, 0x0399, 0x0000,
|
|
368
|
+
0x1F9D, 0x1F2D, 0x0399, 0x0000,
|
|
369
|
+
0x1F9E, 0x1F2E, 0x0399, 0x0000,
|
|
370
|
+
0x1F9F, 0x1F2F, 0x0399, 0x0000,
|
|
371
|
+
0x1FA0, 0x1F68, 0x0399, 0x0000,
|
|
372
|
+
0x1FA1, 0x1F69, 0x0399, 0x0000,
|
|
373
|
+
0x1FA2, 0x1F6A, 0x0399, 0x0000,
|
|
374
|
+
0x1FA3, 0x1F6B, 0x0399, 0x0000,
|
|
375
|
+
0x1FA4, 0x1F6C, 0x0399, 0x0000,
|
|
376
|
+
0x1FA5, 0x1F6D, 0x0399, 0x0000,
|
|
377
|
+
0x1FA6, 0x1F6E, 0x0399, 0x0000,
|
|
378
|
+
0x1FA7, 0x1F6F, 0x0399, 0x0000,
|
|
379
|
+
0x1FA8, 0x1F68, 0x0399, 0x0000,
|
|
380
|
+
0x1FA9, 0x1F69, 0x0399, 0x0000,
|
|
381
|
+
0x1FAA, 0x1F6A, 0x0399, 0x0000,
|
|
382
|
+
0x1FAB, 0x1F6B, 0x0399, 0x0000,
|
|
383
|
+
0x1FAC, 0x1F6C, 0x0399, 0x0000,
|
|
384
|
+
0x1FAD, 0x1F6D, 0x0399, 0x0000,
|
|
385
|
+
0x1FAE, 0x1F6E, 0x0399, 0x0000,
|
|
386
|
+
0x1FAF, 0x1F6F, 0x0399, 0x0000,
|
|
387
|
+
0x1FB2, 0x1FBA, 0x0399, 0x0000,
|
|
388
|
+
0x1FB3, 0x0391, 0x0399, 0x0000,
|
|
389
|
+
0x1FB4, 0x0386, 0x0399, 0x0000,
|
|
390
|
+
0x1FB6, 0x0391, 0x0342, 0x0000,
|
|
391
|
+
0x1FB7, 0x0391, 0x0342, 0x0399,
|
|
392
|
+
0x1FBC, 0x0391, 0x0399, 0x0000,
|
|
393
|
+
0x1FC2, 0x1FCA, 0x0399, 0x0000,
|
|
394
|
+
0x1FC3, 0x0397, 0x0399, 0x0000,
|
|
395
|
+
0x1FC4, 0x0389, 0x0399, 0x0000,
|
|
396
|
+
0x1FC6, 0x0397, 0x0342, 0x0000,
|
|
397
|
+
0x1FC7, 0x0397, 0x0342, 0x0399,
|
|
398
|
+
0x1FCC, 0x0397, 0x0399, 0x0000,
|
|
399
|
+
0x1FD2, 0x0399, 0x0308, 0x0300,
|
|
400
|
+
0x1FD3, 0x0399, 0x0308, 0x0301,
|
|
401
|
+
0x1FD6, 0x0399, 0x0342, 0x0000,
|
|
402
|
+
0x1FD7, 0x0399, 0x0308, 0x0342,
|
|
403
|
+
0x1FE2, 0x03A5, 0x0308, 0x0300,
|
|
404
|
+
0x1FE3, 0x03A5, 0x0308, 0x0301,
|
|
405
|
+
0x1FE4, 0x03A1, 0x0313, 0x0000,
|
|
406
|
+
0x1FE6, 0x03A5, 0x0342, 0x0000,
|
|
407
|
+
0x1FE7, 0x03A5, 0x0308, 0x0342,
|
|
408
|
+
0x1FF2, 0x1FFA, 0x0399, 0x0000,
|
|
409
|
+
0x1FF3, 0x03A9, 0x0399, 0x0000,
|
|
410
|
+
0x1FF4, 0x038F, 0x0399, 0x0000,
|
|
411
|
+
0x1FF6, 0x03A9, 0x0342, 0x0000,
|
|
412
|
+
0x1FF7, 0x03A9, 0x0342, 0x0399,
|
|
413
|
+
0x1FFC, 0x03A9, 0x0399, 0x0000,
|
|
414
|
+
0xFB00, 0x0046, 0x0046, 0x0000,
|
|
415
|
+
0xFB01, 0x0046, 0x0049, 0x0000,
|
|
416
|
+
0xFB02, 0x0046, 0x004C, 0x0000,
|
|
417
|
+
0xFB03, 0x0046, 0x0046, 0x0049,
|
|
418
|
+
0xFB04, 0x0046, 0x0046, 0x004C,
|
|
419
|
+
0xFB05, 0x0053, 0x0054, 0x0000,
|
|
420
|
+
0xFB06, 0x0053, 0x0054, 0x0000,
|
|
421
|
+
0xFB13, 0x0544, 0x0546, 0x0000,
|
|
422
|
+
0xFB14, 0x0544, 0x0535, 0x0000,
|
|
423
|
+
0xFB15, 0x0544, 0x053B, 0x0000,
|
|
424
|
+
0xFB16, 0x054E, 0x0546, 0x0000,
|
|
425
|
+
0xFB17, 0x0544, 0x053D, 0x0000
|
|
426
|
+
];
|
|
427
|
+
|
|
428
|
+
// @ts-ignore: decorator
|
|
429
|
+
@lazy @inline const MT = memory.data<i32>([
|
|
430
|
+
2048, 342, 57
|
|
431
|
+
]);
|
|
432
|
+
|
|
433
|
+
// Special binary search routine for Special Casing Tables
|
|
434
|
+
// @ts-ignore: decorator
|
|
435
|
+
@inline
|
|
436
|
+
export function bsearch(key: u32, ptr: usize, max: i32): i32 {
|
|
437
|
+
let min = 0;
|
|
438
|
+
while (min <= max) {
|
|
439
|
+
let mid = (min + max) >>> 3 << 2;
|
|
440
|
+
let cmp = load<u16>(ptr + (mid << alignof<u16>())) - key;
|
|
441
|
+
if (cmp == 0) return mid; // found
|
|
442
|
+
else if (cmp >>> 31) min = mid + 4; // < 0
|
|
443
|
+
else max = mid - 4; // > 0
|
|
444
|
+
}
|
|
445
|
+
return -1; // not found
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// See: https://git.musl-libc.org/cgit/musl/tree/src/ctype/towctrans.c
|
|
449
|
+
export function casemap(c: u32, dir: i32): i32 {
|
|
450
|
+
// if (c >= 0x20000) return c;
|
|
451
|
+
let c0 = c as i32;
|
|
452
|
+
let b = c >> 8;
|
|
453
|
+
c &= 255;
|
|
454
|
+
|
|
455
|
+
let x = c / 3;
|
|
456
|
+
let y = c % 3;
|
|
457
|
+
|
|
458
|
+
/* lookup entry in two-level base-6 table */
|
|
459
|
+
// v = tab[(tab[b] as i32) * 86 + x] as u32;
|
|
460
|
+
let v = <usize>load<u8>(TAB + <usize>load<u8>(TAB + b) * 86 + x);
|
|
461
|
+
// v = (v * mt[y] >> 11) % 6;
|
|
462
|
+
v = (v * load<i32>(MT + (y << alignof<i32>())) >> 11) % 6;
|
|
463
|
+
/* use the bit vector out of the tables as an index into
|
|
464
|
+
* a block-specific set of rules and decode the rule into
|
|
465
|
+
* a type and a case-mapping delta. */
|
|
466
|
+
// r = rules[(ruleBases[b] as u32) + v];
|
|
467
|
+
let r = load<i32>(RULES + ((<usize>load<u8>(RULE_BASES + b) + v) << alignof<i32>()));
|
|
468
|
+
let rt: u32 = r & 255;
|
|
469
|
+
let rd: i32 = r >> 8;
|
|
470
|
+
/* rules 0/1 are simple lower/upper case with a delta.
|
|
471
|
+
* apply according to desired mapping direction. */
|
|
472
|
+
if (rt < 2) return c0 + (rd & -(rt ^ dir));
|
|
473
|
+
/* binary search. endpoints of the binary search for
|
|
474
|
+
* this block are stored in the rule delta field. */
|
|
475
|
+
let xn: u32 = rd & 0xff;
|
|
476
|
+
let xb: u32 = rd >>> 8;
|
|
477
|
+
while (xn) {
|
|
478
|
+
let h = xn >> 1;
|
|
479
|
+
// let t = exceptions[(xb + h) * 2 + 0] as u32;
|
|
480
|
+
let t = <u32>load<u8>(EXCEPTIONS + (xb + h) * 2, 0);
|
|
481
|
+
if (t == c) {
|
|
482
|
+
// r = rules[exceptions[(xb + h) * 2 + 1]];
|
|
483
|
+
r = load<i32>(RULES + <usize>(load<u8>(EXCEPTIONS + (xb + h) * 2, 1) << alignof<i32>()));
|
|
484
|
+
rt = r & 255;
|
|
485
|
+
rd = r >> 8;
|
|
486
|
+
if (rt < 2) return c0 + (rd & -(rt ^ dir));
|
|
487
|
+
/* Hard-coded for the four exceptional titlecase */
|
|
488
|
+
return c0 + 1 - (dir << 1); // (dir ? -1 : 1);
|
|
489
|
+
} else if (t > c) {
|
|
490
|
+
xn = h;
|
|
491
|
+
} else {
|
|
492
|
+
xb += h;
|
|
493
|
+
xn -= h;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return c0;
|
|
497
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Common error messages for use across the standard library. Keeping error messages compact
|
|
2
|
+
// and reusing them where possible ensures minimal static data in binaries.
|
|
3
|
+
|
|
4
|
+
// @ts-ignore: decorator
|
|
5
|
+
@lazy @inline
|
|
6
|
+
export const E_INDEXOUTOFRANGE: string = "Index out of range";
|
|
7
|
+
|
|
8
|
+
// @ts-ignore: decorator
|
|
9
|
+
@lazy @inline
|
|
10
|
+
export const E_VALUEOUTOFRANGE: string = "Value out of range";
|
|
11
|
+
|
|
12
|
+
// @ts-ignore: decorator
|
|
13
|
+
@lazy @inline
|
|
14
|
+
export const E_INVALIDLENGTH: string = "Invalid length";
|
|
15
|
+
|
|
16
|
+
// @ts-ignore: decorator
|
|
17
|
+
@lazy @inline
|
|
18
|
+
export const E_EMPTYARRAY: string = "Array is empty";
|
|
19
|
+
|
|
20
|
+
// @ts-ignore: decorator
|
|
21
|
+
@lazy @inline
|
|
22
|
+
export const E_HOLEYARRAY: string = "Element type must be nullable if array is holey";
|
|
23
|
+
|
|
24
|
+
// @ts-ignore: decorator
|
|
25
|
+
@lazy @inline
|
|
26
|
+
export const E_NOTIMPLEMENTED: string = "Not implemented";
|
|
27
|
+
|
|
28
|
+
// @ts-ignore: decorator
|
|
29
|
+
@lazy @inline
|
|
30
|
+
export const E_KEYNOTFOUND: string = "Key does not exist";
|
|
31
|
+
|
|
32
|
+
// @ts-ignore: decorator
|
|
33
|
+
@lazy @inline
|
|
34
|
+
export const E_ALLOCATION_TOO_LARGE: string = "Allocation too large";
|
|
35
|
+
|
|
36
|
+
// @ts-ignore: decorator
|
|
37
|
+
@lazy @inline
|
|
38
|
+
export const E_ALREADY_PINNED: string = "Object already pinned";
|
|
39
|
+
|
|
40
|
+
// @ts-ignore: decorator
|
|
41
|
+
@lazy @inline
|
|
42
|
+
export const E_NOT_PINNED: string = "Object is not pinned";
|
|
43
|
+
|
|
44
|
+
// @ts-ignore: decorator
|
|
45
|
+
@lazy @inline
|
|
46
|
+
export const E_URI_MALFORMED: string = "URI malformed";
|
|
47
|
+
|
|
48
|
+
// @ts-ignore: decorator
|
|
49
|
+
@lazy @inline
|
|
50
|
+
export const E_INVALIDDATE: string = "Invalid Date";
|
|
51
|
+
|
|
52
|
+
// @ts-ignore: decorator
|
|
53
|
+
@lazy @inline
|
|
54
|
+
export const E_UNPAIRED_SURROGATE: string = "Unpaired surrogate";
|
|
55
|
+
|
|
56
|
+
// @ts-ignore: decorator
|
|
57
|
+
@lazy @inline
|
|
58
|
+
export const E_CAPACITYEXCEEDED: string = "Capacity exceeded";
|