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.
Files changed (114) hide show
  1. package/bnf/data/module.f.d.ts +6 -0
  2. package/bnf/data/module.f.js +57 -4
  3. package/bnf/data/test.f.d.ts +1 -0
  4. package/bnf/data/test.f.js +67 -1
  5. package/ci/module.f.d.ts +3 -0
  6. package/ci/module.f.js +169 -0
  7. package/ci/module.js +3 -0
  8. package/crypto/hmac/module.f.d.ts +5 -4
  9. package/crypto/hmac/module.f.js +9 -18
  10. package/crypto/hmac/test.f.d.ts +1 -0
  11. package/crypto/hmac/test.f.js +16 -8
  12. package/crypto/secp/module.f.d.ts +14 -11
  13. package/crypto/secp/module.f.js +33 -13
  14. package/crypto/secp/test.f.js +12 -13
  15. package/crypto/sha2/module.f.d.ts +11 -5
  16. package/crypto/sha2/module.f.js +4 -3
  17. package/crypto/sha2/test.f.d.ts +4 -1
  18. package/crypto/sha2/test.f.js +41 -31
  19. package/crypto/sign/module.f.d.ts +17 -4
  20. package/crypto/sign/module.f.js +141 -46
  21. package/crypto/sign/test.f.d.ts +11 -1
  22. package/crypto/sign/test.f.js +631 -1
  23. package/dev/tf/all.test.js +9 -1
  24. package/djs/ast/module.f.d.ts +3 -3
  25. package/djs/ast/test.f.js +7 -8
  26. package/djs/parser/module.f.d.ts +3 -3
  27. package/djs/parser/module.f.js +4 -4
  28. package/djs/parser/test.f.js +76 -77
  29. package/djs/serializer/module.f.d.ts +8 -8
  30. package/djs/serializer/module.f.js +4 -7
  31. package/djs/serializer/test.f.js +8 -9
  32. package/djs/tokenizer/module.f.d.ts +2 -2
  33. package/djs/tokenizer/module.f.js +3 -5
  34. package/djs/tokenizer/test.f.js +8 -10
  35. package/djs/transpiler/module.f.d.ts +3 -3
  36. package/djs/transpiler/module.f.js +2 -0
  37. package/fsc/bnf.f.d.ts +1 -1
  38. package/fsc/bnf.f.js +39 -51
  39. package/fsc/json.f.d.ts +1 -1
  40. package/fsc/json.f.js +56 -81
  41. package/fsc/test.f.js +4 -6
  42. package/fsm/module.f.js +3 -3
  43. package/fsm/test.f.js +21 -25
  44. package/html/module.f.js +17 -4
  45. package/html/test.f.d.ts +7 -0
  46. package/html/test.f.js +37 -0
  47. package/issues/031-json.f.d.ts +1 -0
  48. package/js/tokenizer/module.f.d.ts +4 -4
  49. package/js/tokenizer/module.f.js +12 -17
  50. package/js/tokenizer/test.f.js +9 -11
  51. package/json/module.f.d.ts +6 -6
  52. package/json/module.f.js +5 -10
  53. package/json/parser/module.f.d.ts +4 -4
  54. package/json/parser/module.f.js +7 -4
  55. package/json/parser/test.f.js +47 -49
  56. package/json/serializer/module.f.d.ts +6 -6
  57. package/json/serializer/module.f.js +3 -2
  58. package/json/serializer/test.f.js +13 -13
  59. package/json/test.f.js +13 -15
  60. package/json/tokenizer/module.f.d.ts +4 -4
  61. package/json/tokenizer/module.f.js +6 -7
  62. package/json/tokenizer/test.f.js +7 -9
  63. package/nanvm-lib/tests/vm/test.f.js +1 -1
  64. package/package.json +5 -5
  65. package/path/module.f.d.ts +3 -2
  66. package/text/ascii/test.f.js +2 -2
  67. package/text/module.f.d.ts +3 -2
  68. package/text/module.f.js +2 -2
  69. package/text/test.f.js +3 -3
  70. package/text/utf16/test.f.js +2 -2
  71. package/text/utf8/test.f.js +2 -2
  72. package/types/array/test.f.js +2 -2
  73. package/types/bigint/module.f.d.ts +6 -3
  74. package/types/bigint/module.f.js +12 -11
  75. package/types/bigint/test.f.d.ts +2 -0
  76. package/types/bigint/test.f.js +21 -2
  77. package/types/bit_vec/module.f.d.ts +66 -34
  78. package/types/bit_vec/module.f.js +97 -32
  79. package/types/bit_vec/test.f.d.ts +7 -0
  80. package/types/bit_vec/test.f.js +283 -62
  81. package/types/btree/find/test.f.js +9 -8
  82. package/types/btree/remove/test.f.js +4 -4
  83. package/types/btree/set/test.f.js +4 -4
  84. package/types/btree/test.f.js +7 -7
  85. package/types/byte_set/test.f.js +2 -2
  86. package/types/function/compare/module.f.d.ts +15 -1
  87. package/types/function/compare/module.f.js +1 -1
  88. package/types/function/compare/test.f.js +37 -4
  89. package/types/list/test.f.js +93 -93
  90. package/types/monoid/module.f.d.ts +4 -4
  91. package/types/monoid/module.f.js +3 -3
  92. package/types/monoid/test.f.js +3 -3
  93. package/types/nominal/module.f.d.ts +5 -0
  94. package/types/nominal/module.f.js +4 -0
  95. package/types/nominal/test.f.d.ts +5 -0
  96. package/types/nominal/test.f.js +53 -0
  97. package/types/number/module.f.js +2 -2
  98. package/{crypto → types}/prime_field/module.f.d.ts +2 -2
  99. package/{crypto → types}/prime_field/module.f.js +5 -4
  100. package/{crypto → types}/prime_field/test.f.js +13 -13
  101. package/types/range_map/test.f.js +21 -21
  102. package/types/sorted_list/test.f.js +10 -10
  103. package/types/sorted_set/test.f.js +14 -14
  104. package/types/string/module.f.js +2 -2
  105. package/types/string_set/module.f.js +3 -3
  106. package/bnf/func/module.f.d.ts +0 -148
  107. package/bnf/func/module.f.js +0 -132
  108. package/bnf/func/test.f.d.ts +0 -12
  109. package/bnf/func/test.f.js +0 -171
  110. package/bnf/func/testlib.f.d.ts +0 -25
  111. package/bnf/func/testlib.f.js +0 -150
  112. /package/{issues/31-json.f.d.ts → ci/module.d.ts} +0 -0
  113. /package/issues/{31-json.f.js → 031-json.f.js} +0 -0
  114. /package/{crypto → types}/prime_field/test.f.d.ts +0 -0
package/djs/ast/test.f.js CHANGED
@@ -1,38 +1,37 @@
1
- import * as list from "../../types/object/module.f.js";
2
- const { sort } = list;
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 = shared.run([1])([]);
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 = shared.run([1, 2, 3, 4, 5, ['cref', 3]])([11, 12, 13, 14, 15]);
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 = shared.run([1, 2, 3, 4, 5, ['aref', 3]])([11, 12, 13, 14, 15]);
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 = shared.run([1, 2, 3, 4, 5, ['array', [['aref', 3], ['cref', 3]]]])([11, 12, 13, 14, 15]);
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 = shared.run([1, 2, 3, 4, 5, { "key": { "key2": ['array', [['aref', 3], ['cref', 3]]] } }])([11, 12, 13, 14, 15]);
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;
@@ -1,4 +1,4 @@
1
- import * as result from '../../types/result/module.f.ts';
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<result.Result<AstModule, string>>;
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>) => result.Result<AstModule, ParseError>;
17
+ export declare const parseFromTokens: (tokenList: List<DjsTokenWithMetadata>) => Result<AstModule, ParseError>;
@@ -1,4 +1,4 @@
1
- import * as result from "../../types/result/module.f.js";
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 result.ok([toArray(state.module.modules), toArray(state.module.consts)]);
355
- case 'error': return result.error(state.error);
356
- default: return result.error({ message: 'unexpected end', metadata: null });
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
  };