functionalscript 0.0.566 → 0.0.567
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/.github/workflows/ci.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functionalscript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.567",
|
|
4
4
|
"description": "FunctionalScript is a functional subset of JavaScript",
|
|
5
5
|
"main": "module.f.cjs",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/functionalscript/functionalscript#readme",
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/node": "^22.9.
|
|
33
|
+
"@types/node": "^22.9.1",
|
|
34
34
|
"typescript": "^5.6.3"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/text/utf8/module.f.cjs
CHANGED
|
@@ -34,15 +34,28 @@ const fromCodePointList = flatMap(codePointToUtf8)
|
|
|
34
34
|
|
|
35
35
|
/** @type {(state: Utf8NonEmptyState) => i32}*/
|
|
36
36
|
const utf8StateToError = state => {
|
|
37
|
+
let x
|
|
37
38
|
switch (state.length) {
|
|
38
|
-
case 1:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
case 1: {
|
|
40
|
+
[x] = state
|
|
41
|
+
break
|
|
42
|
+
}
|
|
43
|
+
case 2: {
|
|
44
|
+
const [s0, s1] = state
|
|
45
|
+
x = s0 < 0b1111_0000
|
|
46
|
+
? ((s0 & 0b0000_1111) << 6) + (s1 & 0b0011_1111) + 0b0000_0100_0000_0000
|
|
47
|
+
: ((s0 & 0b0000_0111) << 6) + (s1 & 0b0011_1111) + 0b0000_0010_0000_0000
|
|
48
|
+
break
|
|
49
|
+
}
|
|
50
|
+
case 3: {
|
|
51
|
+
const [s0, s1, s2] = state
|
|
52
|
+
x = ((s0 & 0b0000_0111) << 12) + ((s1 & 0b0011_1111) << 6) + (s2 & 0b0011_1111) + 0b1000_0000_0000_0000
|
|
53
|
+
break
|
|
54
|
+
}
|
|
55
|
+
default:
|
|
56
|
+
throw 'invalid state'
|
|
45
57
|
}
|
|
58
|
+
return x | errorMask
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
/** @type {operator.StateScan<number, Utf8State, list.List<i32>>} */
|
|
@@ -57,16 +70,22 @@ const utf8ByteToCodePointOp = state => byte => {
|
|
|
57
70
|
}
|
|
58
71
|
if (byte >= 0b1000_0000 && byte < 0b1100_0000) {
|
|
59
72
|
switch (state.length) {
|
|
60
|
-
case 1:
|
|
61
|
-
|
|
62
|
-
if (
|
|
73
|
+
case 1: {
|
|
74
|
+
const [s0] = state
|
|
75
|
+
if (s0 < 0b1110_0000) { return [[((s0 & 0b0001_1111) << 6) + (byte & 0b0011_1111)], null] }
|
|
76
|
+
if (s0 < 0b1111_1000) { return [[], [s0, byte]] }
|
|
63
77
|
break
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
}
|
|
79
|
+
case 2: {
|
|
80
|
+
const [s0, s1] = state
|
|
81
|
+
if (s0 < 0b1111_0000) { return [[((s0 & 0b0000_1111) << 12) + ((s1 & 0b0011_1111) << 6) + (byte & 0b0011_1111)], null] }
|
|
82
|
+
if (s0 < 0b1111_1000) { return [[], [s0, s1, byte]] }
|
|
67
83
|
break
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
}
|
|
85
|
+
case 3: {
|
|
86
|
+
const [s0, s1, s2] = state
|
|
87
|
+
return [[((s0 & 0b0000_0111) << 18) + ((s1 & 0b0011_1111) << 12) + ((s2 & 0b0011_1111) << 6) + (byte & 0b0011_1111)], null]
|
|
88
|
+
}
|
|
70
89
|
}
|
|
71
90
|
}
|
|
72
91
|
const error = utf8StateToError(state)
|
|
@@ -76,10 +95,8 @@ const utf8ByteToCodePointOp = state => byte => {
|
|
|
76
95
|
}
|
|
77
96
|
|
|
78
97
|
/** @type {(state: Utf8State) => readonly[list.List<i32>, Utf8State]} */
|
|
79
|
-
const utf8EofToCodePointOp = state =>
|
|
80
|
-
|
|
81
|
-
return [[utf8StateToError(state)], null]
|
|
82
|
-
}
|
|
98
|
+
const utf8EofToCodePointOp = state =>
|
|
99
|
+
[state === null ? null : [utf8StateToError(state)], null]
|
|
83
100
|
|
|
84
101
|
/** @type {operator.StateScan<ByteOrEof, Utf8State, list.List<i32>>} */
|
|
85
102
|
const utf8ByteOrEofToCodePointOp = state => input => input === null ? utf8EofToCodePointOp(state) : utf8ByteToCodePointOp(state)(input)
|
|
@@ -7,7 +7,7 @@ const { list } = require('../module.f.cjs')
|
|
|
7
7
|
const operator = require("../function/operator/module.f.cjs")
|
|
8
8
|
|
|
9
9
|
/** @type {(a: readonly json.Unknown[]) => string} */
|
|
10
|
-
const stringify =
|
|
10
|
+
const stringify = json.stringify(sort)
|
|
11
11
|
|
|
12
12
|
/** @type {_.Operators<sortedSet.SortedSet<string>>} */
|
|
13
13
|
const op = { union: sortedSet.union(unsafeCmp), equal: list.equal(operator.strictEqual) }
|