functionalscript 0.8.0 → 0.8.2
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/bnf/data/module.f.d.ts +6 -0
- package/bnf/data/module.f.js +57 -4
- package/bnf/data/test.f.d.ts +1 -0
- package/bnf/data/test.f.js +67 -1
- package/ci/module.f.d.ts +3 -0
- package/ci/module.f.js +169 -0
- package/ci/module.js +3 -0
- package/crypto/hmac/module.f.d.ts +5 -4
- package/crypto/hmac/module.f.js +9 -18
- package/crypto/hmac/test.f.d.ts +1 -0
- package/crypto/hmac/test.f.js +16 -8
- package/crypto/secp/module.f.d.ts +14 -11
- package/crypto/secp/module.f.js +33 -13
- package/crypto/secp/test.f.js +12 -13
- package/crypto/sha2/module.f.d.ts +11 -5
- package/crypto/sha2/module.f.js +4 -3
- package/crypto/sha2/test.f.d.ts +4 -1
- package/crypto/sha2/test.f.js +41 -31
- package/crypto/sign/module.f.d.ts +17 -4
- package/crypto/sign/module.f.js +141 -46
- package/crypto/sign/test.f.d.ts +11 -1
- package/crypto/sign/test.f.js +631 -1
- package/dev/tf/all.test.js +9 -1
- package/djs/ast/module.f.d.ts +3 -3
- package/djs/ast/test.f.js +7 -8
- package/djs/parser/module.f.d.ts +3 -3
- package/djs/parser/module.f.js +4 -4
- package/djs/parser/test.f.js +76 -77
- package/djs/serializer/module.f.d.ts +8 -8
- package/djs/serializer/module.f.js +4 -7
- package/djs/serializer/test.f.js +8 -9
- package/djs/tokenizer/module.f.d.ts +2 -2
- package/djs/tokenizer/module.f.js +3 -5
- package/djs/tokenizer/test.f.js +8 -10
- package/djs/transpiler/module.f.d.ts +3 -3
- package/djs/transpiler/module.f.js +2 -0
- package/fsc/bnf.f.d.ts +1 -1
- package/fsc/bnf.f.js +39 -51
- package/fsc/json.f.d.ts +1 -1
- package/fsc/json.f.js +56 -81
- package/fsc/test.f.js +4 -6
- package/fsm/module.f.js +3 -3
- package/fsm/test.f.js +21 -25
- package/html/module.f.js +17 -4
- package/html/test.f.d.ts +7 -0
- package/html/test.f.js +37 -0
- package/issues/031-json.f.d.ts +1 -0
- package/js/tokenizer/module.f.d.ts +4 -4
- package/js/tokenizer/module.f.js +12 -17
- package/js/tokenizer/test.f.js +9 -11
- package/json/module.f.d.ts +6 -6
- package/json/module.f.js +5 -10
- package/json/parser/module.f.d.ts +4 -4
- package/json/parser/module.f.js +7 -4
- package/json/parser/test.f.js +47 -49
- package/json/serializer/module.f.d.ts +6 -6
- package/json/serializer/module.f.js +3 -2
- package/json/serializer/test.f.js +13 -13
- package/json/test.f.js +13 -15
- package/json/tokenizer/module.f.d.ts +4 -4
- package/json/tokenizer/module.f.js +6 -7
- package/json/tokenizer/test.f.js +7 -9
- package/nanvm-lib/tests/vm/test.f.js +1 -1
- package/package.json +5 -5
- package/path/module.f.d.ts +3 -2
- package/text/ascii/test.f.js +2 -2
- package/text/module.f.d.ts +3 -2
- package/text/module.f.js +2 -2
- package/text/test.f.js +3 -3
- package/text/utf16/test.f.js +2 -2
- package/text/utf8/test.f.js +2 -2
- package/types/array/test.f.js +2 -2
- package/types/bigint/module.f.d.ts +6 -3
- package/types/bigint/module.f.js +12 -11
- package/types/bigint/test.f.d.ts +2 -0
- package/types/bigint/test.f.js +21 -2
- package/types/bit_vec/module.f.d.ts +66 -34
- package/types/bit_vec/module.f.js +97 -32
- package/types/bit_vec/test.f.d.ts +7 -0
- package/types/bit_vec/test.f.js +283 -62
- package/types/btree/find/test.f.js +9 -8
- package/types/btree/remove/test.f.js +4 -4
- package/types/btree/set/test.f.js +4 -4
- package/types/btree/test.f.js +7 -7
- package/types/byte_set/test.f.js +2 -2
- package/types/function/compare/module.f.d.ts +15 -1
- package/types/function/compare/module.f.js +1 -1
- package/types/function/compare/test.f.js +37 -4
- package/types/list/test.f.js +93 -93
- package/types/monoid/module.f.d.ts +4 -4
- package/types/monoid/module.f.js +3 -3
- package/types/monoid/test.f.js +3 -3
- package/types/nominal/module.f.d.ts +5 -0
- package/types/nominal/module.f.js +4 -0
- package/types/nominal/test.f.d.ts +5 -0
- package/types/nominal/test.f.js +53 -0
- package/types/number/module.f.js +2 -2
- package/{crypto → types}/prime_field/module.f.d.ts +2 -2
- package/{crypto → types}/prime_field/module.f.js +5 -4
- package/{crypto → types}/prime_field/test.f.js +13 -13
- package/types/range_map/test.f.js +21 -21
- package/types/sorted_list/test.f.js +10 -10
- package/types/sorted_set/test.f.js +14 -14
- package/types/string/module.f.js +2 -2
- package/types/string_set/module.f.js +3 -3
- package/bnf/func/module.f.d.ts +0 -148
- package/bnf/func/module.f.js +0 -132
- package/bnf/func/test.f.d.ts +0 -12
- package/bnf/func/test.f.js +0 -171
- package/bnf/func/testlib.f.d.ts +0 -25
- package/bnf/func/testlib.f.js +0 -150
- /package/{issues/31-json.f.d.ts → ci/module.d.ts} +0 -0
- /package/issues/{31-json.f.js → 031-json.f.js} +0 -0
- /package/{crypto → types}/prime_field/test.f.d.ts +0 -0
package/djs/ast/test.f.js
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import * as shared from "./module.f.js";
|
|
1
|
+
import { sort } from "../../types/object/module.f.js";
|
|
2
|
+
import { run } from "./module.f.js";
|
|
4
3
|
import { stringifyAsTree } from "../serializer/module.f.js";
|
|
5
4
|
export default {
|
|
6
5
|
test: () => {
|
|
7
|
-
const djs =
|
|
6
|
+
const djs = run([1])([]);
|
|
8
7
|
const result = stringifyAsTree(sort)(djs);
|
|
9
8
|
if (result !== '1') {
|
|
10
9
|
throw result;
|
|
11
10
|
}
|
|
12
11
|
},
|
|
13
12
|
testCref: () => {
|
|
14
|
-
const djs =
|
|
13
|
+
const djs = run([1, 2, 3, 4, 5, ['cref', 3]])([11, 12, 13, 14, 15]);
|
|
15
14
|
const result = stringifyAsTree(sort)(djs);
|
|
16
15
|
if (result !== '4') {
|
|
17
16
|
throw result;
|
|
18
17
|
}
|
|
19
18
|
},
|
|
20
19
|
testAref: () => {
|
|
21
|
-
const djs =
|
|
20
|
+
const djs = run([1, 2, 3, 4, 5, ['aref', 3]])([11, 12, 13, 14, 15]);
|
|
22
21
|
const result = stringifyAsTree(sort)(djs);
|
|
23
22
|
if (result !== '14') {
|
|
24
23
|
throw result;
|
|
25
24
|
}
|
|
26
25
|
},
|
|
27
26
|
testArray: () => {
|
|
28
|
-
const djs =
|
|
27
|
+
const djs = run([1, 2, 3, 4, 5, ['array', [['aref', 3], ['cref', 3]]]])([11, 12, 13, 14, 15]);
|
|
29
28
|
const result = stringifyAsTree(sort)(djs);
|
|
30
29
|
if (result !== '[14,4]') {
|
|
31
30
|
throw result;
|
|
32
31
|
}
|
|
33
32
|
},
|
|
34
33
|
testObj: () => {
|
|
35
|
-
const djs =
|
|
34
|
+
const djs = run([1, 2, 3, 4, 5, { "key": { "key2": ['array', [['aref', 3], ['cref', 3]]] } }])([11, 12, 13, 14, 15]);
|
|
36
35
|
const result = stringifyAsTree(sort)(djs);
|
|
37
36
|
if (result !== '{"key":{"key2":[14,4]}}') {
|
|
38
37
|
throw result;
|
package/djs/parser/module.f.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Result } from '../../types/result/module.f.ts';
|
|
2
2
|
import { type List } from '../../types/list/module.f.ts';
|
|
3
3
|
import type { DjsTokenWithMetadata } from '../tokenizer/module.f.ts';
|
|
4
4
|
import { type OrderedMap } from '../../types/ordered_map/module.f.ts';
|
|
@@ -7,11 +7,11 @@ import type { AstModule } from '../ast/module.f.ts';
|
|
|
7
7
|
import type { TokenMetadata } from '../../js/tokenizer/module.f.ts';
|
|
8
8
|
export type ParseContext = {
|
|
9
9
|
readonly fs: Fs;
|
|
10
|
-
readonly complete: OrderedMap<
|
|
10
|
+
readonly complete: OrderedMap<Result<AstModule, string>>;
|
|
11
11
|
readonly stack: List<string>;
|
|
12
12
|
};
|
|
13
13
|
export type ParseError = {
|
|
14
14
|
readonly message: string;
|
|
15
15
|
readonly metadata: TokenMetadata | null;
|
|
16
16
|
};
|
|
17
|
-
export declare const parseFromTokens: (tokenList: List<DjsTokenWithMetadata>) =>
|
|
17
|
+
export declare const parseFromTokens: (tokenList: List<DjsTokenWithMetadata>) => Result<AstModule, ParseError>;
|
package/djs/parser/module.f.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { error, ok } from "../../types/result/module.f.js";
|
|
2
2
|
import { fold, first, drop, toArray, length, concat } from "../../types/list/module.f.js";
|
|
3
3
|
import { setReplace, at } from "../../types/ordered_map/module.f.js";
|
|
4
4
|
import { fromMap } from "../../types/object/module.f.js";
|
|
@@ -351,8 +351,8 @@ const foldOp = token => state => {
|
|
|
351
351
|
export const parseFromTokens = (tokenList) => {
|
|
352
352
|
const state = fold(foldOp)({ state: '', module: { refs: null, modules: null, consts: null } })(tokenList);
|
|
353
353
|
switch (state.state) {
|
|
354
|
-
case 'result': return
|
|
355
|
-
case 'error': return
|
|
356
|
-
default: return
|
|
354
|
+
case 'result': return ok([toArray(state.module.modules), toArray(state.module.consts)]);
|
|
355
|
+
case 'error': return error(state.error);
|
|
356
|
+
default: return error({ message: 'unexpected end', metadata: null });
|
|
357
357
|
}
|
|
358
358
|
};
|