functionalscript 0.1.593 → 0.1.596

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 (125) hide show
  1. package/.github/workflows/npm-publish.yml +2 -1
  2. package/README.md +1 -0
  3. package/com/cpp/module.f.d.mts +8 -0
  4. package/com/cpp/test.f.d.mts +2 -0
  5. package/com/cpp/testlib.f.d.mts +2 -0
  6. package/com/cs/module.f.d.mts +8 -0
  7. package/com/cs/test.f.d.mts +2 -0
  8. package/com/cs/testlib.f.d.mts +2 -0
  9. package/com/rust/module.f.d.mts +28 -0
  10. package/com/rust/test.f.d.mts +2 -0
  11. package/com/rust/testlib.f.d.mts +2 -0
  12. package/com/test/build.d.mts +1 -0
  13. package/com/test/build.f.d.mts +26 -0
  14. package/com/types/module.f.d.mts +28 -0
  15. package/com/types/testlib.f.d.mts +44 -0
  16. package/commonjs/build/module.f.d.mts +24 -0
  17. package/commonjs/build/test.f.d.mts +3 -0
  18. package/commonjs/module/function/module.f.d.mts +7 -0
  19. package/commonjs/module/module.f.d.mts +57 -0
  20. package/commonjs/module.d.mts +7 -0
  21. package/commonjs/module.f.d.mts +4 -0
  22. package/commonjs/package/dependencies/module.f.d.mts +10 -0
  23. package/commonjs/package/dependencies/test.f.d.mts +2 -0
  24. package/commonjs/package/module.f.d.mts +27 -0
  25. package/commonjs/package/test.f.d.mts +2 -0
  26. package/commonjs/path/module.f.d.mts +67 -0
  27. package/commonjs/path/test.f.d.mts +25 -0
  28. package/commonjs/test.d.mts +8 -0
  29. package/dev/index.d.mts +1 -0
  30. package/dev/module.d.mts +26 -0
  31. package/dev/module.f.d.mts +4 -0
  32. package/dev/test/module.f.d.mts +26 -0
  33. package/dev/test.d.mts +3 -0
  34. package/dev/test.f.d.mts +9 -0
  35. package/djs/module.f.d.mts +25 -0
  36. package/djs/parser/module.f.d.mts +40 -0
  37. package/djs/parser/test.f.d.mts +8 -0
  38. package/djs/test.f.d.mts +12 -0
  39. package/djs/tokenizer/module.f.d.mts +17 -0
  40. package/djs/tokenizer/test.f.d.mts +6 -0
  41. package/fsc/module.f.d.mts +12 -0
  42. package/fsc/test.f.d.mts +4 -0
  43. package/fsm/module.f.d.mts +21 -0
  44. package/fsm/test.f.d.mts +5 -0
  45. package/html/module.f.d.mts +20 -0
  46. package/html/test.f.d.mts +10 -0
  47. package/index.f.d.mts +83 -0
  48. package/js/tokenizer/module.f.d.mts +150 -0
  49. package/js/tokenizer/test.f.d.mts +8 -0
  50. package/json/module.f.d.mts +41 -0
  51. package/json/parser/module.f.d.mts +36 -0
  52. package/json/parser/test.f.d.mts +5 -0
  53. package/json/serializer/module.f.d.mts +45 -0
  54. package/json/serializer/test.f.d.mts +8 -0
  55. package/json/test.f.d.mts +8 -0
  56. package/json/tokenizer/module.f.d.mts +17 -0
  57. package/json/tokenizer/test.f.d.mts +6 -0
  58. package/jsr.json +1 -1
  59. package/nodejs/version/main.d.mts +1 -0
  60. package/nodejs/version/module.f.d.mts +18 -0
  61. package/nodejs/version/test.f.d.mts +2 -0
  62. package/package.json +2 -1
  63. package/prime_field/module.f.d.mts +44 -0
  64. package/prime_field/test.f.d.mts +12 -0
  65. package/secp/module.f.d.mts +49 -0
  66. package/secp/test.f.d.mts +4 -0
  67. package/sha2/module.f.d.mts +23 -0
  68. package/sha2/test.f.d.mts +10 -0
  69. package/text/ascii/module.f.d.mts +73 -0
  70. package/text/ascii/test.f.d.mts +4 -0
  71. package/text/module.f.d.mts +18 -0
  72. package/text/sgr/module.f.d.mts +14 -0
  73. package/text/test.f.d.mts +2 -0
  74. package/text/utf16/module.f.d.mts +19 -0
  75. package/text/utf16/test.f.d.mts +6 -0
  76. package/text/utf8/module.f.d.mts +15 -0
  77. package/text/utf8/test.f.d.mts +6 -0
  78. package/types/array/module.f.d.mts +41 -0
  79. package/types/array/test.f.d.mts +10 -0
  80. package/types/bigfloat/module.f.d.mts +11 -0
  81. package/types/bigfloat/test.f.d.mts +6 -0
  82. package/types/bigint/module.f.d.mts +77 -0
  83. package/types/bigint/test.f.d.mts +16 -0
  84. package/types/btree/find/module.f.d.mts +42 -0
  85. package/types/btree/find/test.f.d.mts +2 -0
  86. package/types/btree/module.f.d.mts +9 -0
  87. package/types/btree/remove/module.f.d.mts +19 -0
  88. package/types/btree/remove/test.f.d.mts +7 -0
  89. package/types/btree/set/module.f.d.mts +9 -0
  90. package/types/btree/set/test.f.d.mts +2 -0
  91. package/types/btree/test.f.d.mts +13 -0
  92. package/types/btree/types/module.f.d.mts +16 -0
  93. package/types/byte_set/module.f.d.mts +38 -0
  94. package/types/byte_set/test.f.d.mts +13 -0
  95. package/types/function/compare/module.f.d.mts +29 -0
  96. package/types/function/compare/test.f.d.mts +2 -0
  97. package/types/function/module.f.d.mts +36 -0
  98. package/types/function/operator/module.f.d.mts +75 -0
  99. package/types/function/test.f.d.mts +2 -0
  100. package/types/list/module.f.d.mts +117 -0
  101. package/types/list/test.f.d.mts +38 -0
  102. package/types/map/module.f.d.mts +30 -0
  103. package/types/map/test.f.d.mts +5 -0
  104. package/types/nibble_set/module.f.d.mts +26 -0
  105. package/types/nibble_set/test.f.d.mts +13 -0
  106. package/types/nullable/module.f.d.mts +14 -0
  107. package/types/nullable/test.f.d.mts +2 -0
  108. package/types/number/module.f.d.mts +13 -0
  109. package/types/number/test.f.d.mts +11 -0
  110. package/types/object/module.f.d.mts +29 -0
  111. package/types/object/test.f.d.mts +5 -0
  112. package/types/range/module.f.d.mts +11 -0
  113. package/types/range/test.f.d.mts +2 -0
  114. package/types/range_map/module.f.d.mts +25 -0
  115. package/types/range_map/test.f.d.mts +6 -0
  116. package/types/result/module.d.mts +7 -0
  117. package/types/result/module.f.d.mts +28 -0
  118. package/types/sorted_list/module.f.d.mts +59 -0
  119. package/types/sorted_list/test.f.d.mts +5 -0
  120. package/types/sorted_set/module.f.d.mts +25 -0
  121. package/types/sorted_set/test.f.d.mts +6 -0
  122. package/types/string/module.f.d.mts +15 -0
  123. package/types/string/test.f.d.mts +15 -0
  124. package/types/string_set/module.f.d.mts +21 -0
  125. package/types/string_set/test.f.d.mts +5 -0
@@ -0,0 +1,12 @@
1
+ declare namespace _default {
2
+ export { terminal };
3
+ export { init };
4
+ }
5
+ export default _default;
6
+ export type Result = readonly [readonly string[], ToResult];
7
+ export type ToResult = (codePoint: number) => Result;
8
+ export type CreateToResult<T> = (state: T) => ToResult;
9
+ export type State<T> = RM.RangeMapArray<CreateToResult<T>>;
10
+ declare const terminal: -1;
11
+ declare const init: ToResult;
12
+ import * as RM from '../types/range_map/module.f.mjs';
@@ -0,0 +1,4 @@
1
+ declare namespace _default {
2
+ function a(): void;
3
+ }
4
+ export default _default;
@@ -0,0 +1,21 @@
1
+ declare namespace _default {
2
+ export { dfa };
3
+ export { run };
4
+ export { toRange };
5
+ export { toUnion };
6
+ }
7
+ export default _default;
8
+ export type Rule = readonly [string, byteSetT.ByteSet, string];
9
+ export type Grammar = List.List<Rule>;
10
+ export type Dfa = { readonly [state in string]: RM.RangeMapArray<string>; };
11
+ /** @type {(grammar: Grammar) => Dfa} */
12
+ declare const dfa: (grammar: Grammar) => Dfa;
13
+ /** @type {(dfa: Dfa) => (input: List.List<number>) => List.List<string>} */
14
+ declare const run: (dfa: Dfa) => (input: List.List<number>) => List.List<string>;
15
+ /** @type {(s: string) => byteSetT.ByteSet} */
16
+ declare const toRange: (s: string) => byteSetT.ByteSet;
17
+ /** @type {(s: string) => byteSetT.ByteSet} */
18
+ declare const toUnion: (s: string) => byteSetT.ByteSet;
19
+ import * as byteSetT from '../types/byte_set/module.f.mjs';
20
+ import * as List from '../types/list/module.f.mjs';
21
+ import * as RM from '../types/range_map/module.f.mjs';
@@ -0,0 +1,5 @@
1
+ declare namespace _default {
2
+ function dfa(): void;
3
+ let run: (() => void)[];
4
+ }
5
+ export default _default;
@@ -0,0 +1,20 @@
1
+ declare namespace _default {
2
+ export { element };
3
+ export { html };
4
+ export { htmlToString };
5
+ }
6
+ export default _default;
7
+ export type Tag = string;
8
+ export type Element1 = readonly [Tag];
9
+ export type Element2A = readonly [Tag, Attributes];
10
+ export type Element2N = readonly [Tag, readonly Node[]];
11
+ export type Element3 = readonly [Tag, Attributes, Nodes];
12
+ export type Element = Element1 | Element2A | Element2N | Element3;
13
+ export type Attributes = { readonly [k in string]: string; };
14
+ export type Nodes = List.List<Node>;
15
+ export type Node = Element | string;
16
+ /** @type {(element: Element) => List.List<string>} */
17
+ declare const element: (element: Element) => List.List<string>;
18
+ declare const html: import("../types/function/module.f.mjs").Func<Element, List.List<string>>;
19
+ declare const htmlToString: import("../types/function/module.f.mjs").Func<Element, string>;
20
+ import * as List from '../types/list/module.f.mjs';
@@ -0,0 +1,10 @@
1
+ declare namespace _default {
2
+ export function empty(): void;
3
+ export function empty2(): void;
4
+ export function _void(): void;
5
+ export { _void as void };
6
+ export function some(): void;
7
+ export function some2(): void;
8
+ export function someVoid(): void;
9
+ }
10
+ export default _default;
package/index.f.d.mts ADDED
@@ -0,0 +1,83 @@
1
+ declare namespace _default {
2
+ export namespace com {
3
+ export { com$cpp as cpp };
4
+ export { com$cs as cs };
5
+ export { com$rust as rust };
6
+ export { com$types as types };
7
+ }
8
+ export { commonjs };
9
+ export { dev };
10
+ export { djs };
11
+ export { fsc };
12
+ export { fsm };
13
+ export { html };
14
+ export namespace js {
15
+ export { js$tokenizer as tokenizer };
16
+ }
17
+ export { json };
18
+ export namespace nodejs {
19
+ export { nodejs$version as version };
20
+ }
21
+ export { prime_field };
22
+ export { secp };
23
+ export { sha2 };
24
+ export { text };
25
+ export namespace types {
26
+ export { types$array as array };
27
+ export { types$bigfloat as bigfloat };
28
+ export { types$bigint as bigint };
29
+ export { types$btree as btree };
30
+ export { types$byte_set as byte_set };
31
+ export { types$function as function };
32
+ export { types$list as list };
33
+ export { types$map as map };
34
+ export { types$nibble_set as nibble_set };
35
+ export { types$nullable as nullable };
36
+ export { types$number as number };
37
+ export { types$object as object };
38
+ export { types$range as range };
39
+ export { types$range_map as range_map };
40
+ export { types$result as result };
41
+ export { types$sorted_list as sorted_list };
42
+ export { types$sorted_set as sorted_set };
43
+ export { types$string as string };
44
+ export { types$string_set as string_set };
45
+ }
46
+ }
47
+ export default _default;
48
+ import com$cpp from './com/cpp/module.f.mjs';
49
+ import com$cs from './com/cs/module.f.mjs';
50
+ import com$rust from './com/rust/module.f.mjs';
51
+ import com$types from './com/types/module.f.mjs';
52
+ import commonjs from './commonjs/module.f.mjs';
53
+ import dev from './dev/module.f.mjs';
54
+ import djs from './djs/module.f.mjs';
55
+ import fsc from './fsc/module.f.mjs';
56
+ import fsm from './fsm/module.f.mjs';
57
+ import html from './html/module.f.mjs';
58
+ import js$tokenizer from './js/tokenizer/module.f.mjs';
59
+ import json from './json/module.f.mjs';
60
+ import nodejs$version from './nodejs/version/module.f.mjs';
61
+ import prime_field from './prime_field/module.f.mjs';
62
+ import secp from './secp/module.f.mjs';
63
+ import sha2 from './sha2/module.f.mjs';
64
+ import text from './text/module.f.mjs';
65
+ import types$array from './types/array/module.f.mjs';
66
+ import types$bigfloat from './types/bigfloat/module.f.mjs';
67
+ import types$bigint from './types/bigint/module.f.mjs';
68
+ import types$btree from './types/btree/module.f.mjs';
69
+ import types$byte_set from './types/byte_set/module.f.mjs';
70
+ import types$function from './types/function/module.f.mjs';
71
+ import types$list from './types/list/module.f.mjs';
72
+ import types$map from './types/map/module.f.mjs';
73
+ import types$nibble_set from './types/nibble_set/module.f.mjs';
74
+ import types$nullable from './types/nullable/module.f.mjs';
75
+ import types$number from './types/number/module.f.mjs';
76
+ import types$object from './types/object/module.f.mjs';
77
+ import types$range from './types/range/module.f.mjs';
78
+ import types$range_map from './types/range_map/module.f.mjs';
79
+ import types$result from './types/result/module.f.mjs';
80
+ import types$sorted_list from './types/sorted_list/module.f.mjs';
81
+ import types$sorted_set from './types/sorted_set/module.f.mjs';
82
+ import types$string from './types/string/module.f.mjs';
83
+ import types$string_set from './types/string_set/module.f.mjs';
@@ -0,0 +1,150 @@
1
+ declare namespace _default {
2
+ export { tokenize };
3
+ export { isKeywordToken };
4
+ }
5
+ export default _default;
6
+ export type StringToken = {
7
+ readonly kind: "string";
8
+ readonly value: string;
9
+ };
10
+ export type NumberToken = {
11
+ readonly kind: "number";
12
+ readonly value: string;
13
+ readonly bf: bigfloatT.BigFloat;
14
+ };
15
+ export type BigIntToken = {
16
+ readonly kind: "bigint";
17
+ readonly value: bigint;
18
+ };
19
+ export type ErrorToken = {
20
+ readonly kind: "error";
21
+ message: ErrorMessage;
22
+ };
23
+ export type WhitespaceToken = {
24
+ readonly kind: "ws";
25
+ };
26
+ export type TrueToken = {
27
+ readonly kind: "true";
28
+ };
29
+ export type FalseToken = {
30
+ readonly kind: "false";
31
+ };
32
+ export type NullToken = {
33
+ readonly kind: "null";
34
+ };
35
+ export type KeywordToken = {
36
+ readonly kind: "arguments" | "await" | "break" | "case" | "catch" | "class" | "const" | "continue";
37
+ } | {
38
+ readonly kind: "debugger" | "default" | "delete" | "do" | "else" | "enum" | "eval" | "export";
39
+ } | {
40
+ readonly kind: "extends" | "finally" | "for" | "function" | "if" | "implements" | "import" | "in";
41
+ } | {
42
+ readonly kind: "instanceof" | "interface" | "let" | "new" | "package" | "private" | "protected" | "public";
43
+ } | {
44
+ readonly kind: "return" | "static" | "super" | "switch" | "this" | "throw" | "try" | "typeof";
45
+ } | {
46
+ readonly kind: "var" | "void" | "while" | "with" | "yield";
47
+ };
48
+ export type IdToken = {
49
+ readonly kind: "id";
50
+ readonly value: string;
51
+ };
52
+ export type OperatorToken = {
53
+ readonly kind: "{" | "}" | ":" | "," | "[" | "]";
54
+ } | {
55
+ readonly kind: "." | "=";
56
+ } | {
57
+ readonly kind: "(" | ")";
58
+ } | {
59
+ readonly kind: "==" | "!=" | "===" | "!==" | ">" | ">=" | "<" | "<=";
60
+ } | {
61
+ readonly kind: "+" | "-" | "*" | "/" | "%" | "++" | "--" | "**";
62
+ } | {
63
+ readonly kind: "+=" | "-=" | "*=" | "/=" | "%=" | "**=";
64
+ } | {
65
+ readonly kind: "&" | "|" | "^" | "~" | "<<" | ">>" | ">>>";
66
+ } | {
67
+ readonly kind: "&=" | "|=" | "^=" | "<<=" | ">>=" | ">>>=";
68
+ } | {
69
+ readonly kind: "&&" | "||" | "!" | "??";
70
+ } | {
71
+ readonly kind: "&&=" | "||=" | "??=";
72
+ } | {
73
+ readonly kind: "?" | "?." | "=>";
74
+ };
75
+ export type JsToken = KeywordToken | TrueToken | FalseToken | NullToken | WhitespaceToken | StringToken | NumberToken | ErrorToken | IdToken | BigIntToken | OperatorToken;
76
+ export type TokenizerState = InitialState | ParseIdState | ParseStringState | ParseEscapeCharState | ParseUnicodeCharState | ParseNumberState | InvalidNumberState | ParseOperatorState | ParseMinusState | ParseWhitespaceState | EofState;
77
+ export type ErrorMessage = "\" are missing" | "unescaped character" | "invalid hex value" | "unexpected character" | "invalid number" | "invalid token" | "eof";
78
+ export type InitialState = {
79
+ readonly kind: "initial";
80
+ };
81
+ export type ParseIdState = {
82
+ readonly kind: "id";
83
+ readonly value: string;
84
+ };
85
+ export type ParseWhitespaceState = {
86
+ readonly kind: "ws";
87
+ };
88
+ export type ParseStringState = {
89
+ readonly kind: "string";
90
+ readonly value: string;
91
+ };
92
+ export type ParseEscapeCharState = {
93
+ readonly kind: "escapeChar";
94
+ readonly value: string;
95
+ };
96
+ export type ParseOperatorState = {
97
+ readonly kind: "op";
98
+ readonly value: string;
99
+ };
100
+ export type ParseMinusState = {
101
+ readonly kind: "-";
102
+ };
103
+ export type ParseUnicodeCharState = {
104
+ readonly kind: "unicodeChar";
105
+ readonly value: string;
106
+ readonly unicode: number;
107
+ readonly hexIndex: number;
108
+ };
109
+ export type ParseNumberState = {
110
+ readonly kind: "number";
111
+ readonly numberKind: "0" | "int" | "." | "fractional" | "e" | "e+" | "e-" | "expDigits" | "bigint";
112
+ readonly value: string;
113
+ readonly b: ParseNumberBuffer;
114
+ };
115
+ export type ParseNumberBuffer = {
116
+ readonly s: -1n | 1n;
117
+ readonly m: bigint;
118
+ readonly f: number;
119
+ readonly es: -1 | 1;
120
+ readonly e: number;
121
+ };
122
+ export type InvalidNumberState = {
123
+ readonly kind: "invalidNumber";
124
+ };
125
+ export type EofState = {
126
+ readonly kind: "eof";
127
+ };
128
+ export type CharCodeOrEof = number | null;
129
+ export type ToToken = (input: number) => readonly [List.List<JsToken>, TokenizerState];
130
+ /**
131
+ * <T>
132
+ */
133
+ export type CreateToToken<T> = (state: T) => ToToken;
134
+ export type RangeSet = List.List<Range.Range>;
135
+ /**
136
+ * <T>
137
+ */
138
+ export type RangeFunc<T> = (def: CreateToToken<T>) => (RangeMapToToken<T>);
139
+ /**
140
+ * <T>
141
+ */
142
+ export type RangeMapToToken<T> = RangeMap.RangeMapArray<CreateToToken<T>>;
143
+ /** @type {(input: List.List<number>) => List.List<JsToken>} */
144
+ declare const tokenize: (input: List.List<number>) => List.List<JsToken>;
145
+ /** @type {(token: JsToken) => Boolean} */
146
+ declare const isKeywordToken: (token: JsToken) => boolean;
147
+ import * as bigfloatT from '../../types/bigfloat/module.f.mjs';
148
+ import * as List from '../../types/list/module.f.mjs';
149
+ import * as Range from '../../types/range/module.f.mjs';
150
+ import * as RangeMap from '../../types/range_map/module.f.mjs';
@@ -0,0 +1,8 @@
1
+ declare namespace _default {
2
+ let djs: (() => void)[];
3
+ let operators: (() => void)[];
4
+ let ws: (() => void)[];
5
+ let id: (() => void)[];
6
+ let keywords: (() => void)[];
7
+ }
8
+ export default _default;
@@ -0,0 +1,41 @@
1
+ declare namespace _default {
2
+ export { setProperty };
3
+ export { stringify };
4
+ export { serialize };
5
+ export { parse };
6
+ export { isObject };
7
+ }
8
+ export default _default;
9
+ export type Object = { readonly [k in string]: Unknown; };
10
+ export type Array = readonly Unknown[];
11
+ export type Unknown = Object | boolean | string | number | null | Array;
12
+ export type Entry = O.Entry<Unknown>;
13
+ export type Entries = (List.List<Entry>);
14
+ export type MapEntries = (entries: Entries) => Entries;
15
+ /**
16
+ * @typedef {{
17
+ * readonly [k in string]: Unknown
18
+ * }} Object
19
+ */
20
+ /** @typedef {readonly Unknown[]} Array */
21
+ /** @typedef {Object|boolean|string|number|null|Array} Unknown */
22
+ /** @type {(value: Unknown) => (path: List.List<string>) => (src: Unknown) => Unknown} */
23
+ declare const setProperty: (value: Unknown) => (path: List.List<string>) => (src: Unknown) => Unknown;
24
+ /**
25
+ * The standard `JSON.stringify` rules determined by
26
+ * https://262.ecma-international.org/6.0/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys
27
+ *
28
+ * @type {(mapEntries: MapEntries) => (value: Unknown) => string}
29
+ */
30
+ declare const stringify: (mapEntries: MapEntries) => (value: Unknown) => string;
31
+ /** @typedef {O.Entry<Unknown>} Entry*/
32
+ /** @typedef {(List.List<Entry>)} Entries */
33
+ /** @typedef {(entries: Entries) => Entries} MapEntries */
34
+ /** @type {(mapEntries: MapEntries) => (value: Unknown) => List.List<string>} */
35
+ declare const serialize: (mapEntries: MapEntries) => (value: Unknown) => List.List<string>;
36
+ /** @type {(value: string) => Unknown} */
37
+ declare const parse: (value: string) => Unknown;
38
+ /** @type {(value: Unknown) => value is Object} */
39
+ declare const isObject: (value: Unknown) => value is Object;
40
+ import * as O from '../types/object/module.f.mjs';
41
+ import * as List from '../types/list/module.f.mjs';
@@ -0,0 +1,36 @@
1
+ declare namespace _default {
2
+ export { parse };
3
+ }
4
+ export default _default;
5
+ export type JsonObject = {
6
+ readonly kind: "object";
7
+ readonly values: Map.Map<Json.Unknown>;
8
+ readonly key: string;
9
+ };
10
+ export type JsonArray = {
11
+ readonly kind: "array";
12
+ readonly values: List.List<Json.Unknown>;
13
+ };
14
+ export type JsonStackElement = JsonObject | JsonArray;
15
+ export type JsonStack = List.List<JsonStackElement>;
16
+ export type StateParse = {
17
+ readonly status: "" | "[" | "[v" | "[," | "{" | "{k" | "{:" | "{v" | "{,";
18
+ readonly top: JsonStackElement | null;
19
+ readonly stack: JsonStack;
20
+ };
21
+ export type StateResult = {
22
+ readonly status: "result";
23
+ readonly value: Json.Unknown;
24
+ };
25
+ export type StateError = {
26
+ readonly status: "error";
27
+ readonly message: string;
28
+ };
29
+ export type JsonState = StateParse | StateResult | StateError;
30
+ /** @type {(tokenList: List.List<tokenizerT.JsonToken>) => Result.Result<Json.Unknown, string>} */
31
+ declare const parse: (tokenList: List.List<tokenizerT.JsonToken>) => Result.Result<Json.Unknown, string>;
32
+ import * as Map from '../../types/map/module.f.mjs';
33
+ import * as Json from '../module.f.mjs';
34
+ import * as List from '../../types/list/module.f.mjs';
35
+ import * as tokenizerT from '../tokenizer/module.f.mjs';
36
+ import * as Result from '../../types/result/module.f.mjs';
@@ -0,0 +1,5 @@
1
+ declare namespace _default {
2
+ let valid: (() => void)[];
3
+ let invalid: (() => void)[];
4
+ }
5
+ export default _default;
@@ -0,0 +1,45 @@
1
+ declare namespace _default {
2
+ export { objectWrap };
3
+ export { arrayWrap };
4
+ export { stringSerialize };
5
+ export { numberSerialize };
6
+ export { nullSerialize };
7
+ export { boolSerialize };
8
+ }
9
+ export default _default;
10
+ /**
11
+ * <T>
12
+ */
13
+ export type Obj<T> = { readonly [k in string]: Unknown<T>; };
14
+ /**
15
+ * <T>
16
+ */
17
+ export type Arr<T> = readonly Unknown<T>[];
18
+ export type Primitive = boolean | string | number | null;
19
+ /**
20
+ * <T>
21
+ */
22
+ export type Unknown<T> = Arr<T> | Obj<T> | null | T;
23
+ /**
24
+ * <T>
25
+ */
26
+ export type Entry<T> = O.Entry<Unknown<T>>;
27
+ /**
28
+ * <T>
29
+ */
30
+ export type Entries<T> = (List.List<Entry<T>>);
31
+ /**
32
+ * <T>
33
+ */
34
+ export type MapEntries<T> = (entries: Entries<T>) => Entries<T>;
35
+ declare const objectWrap: (input: List.List<List.List<string>>) => List.List<string>;
36
+ declare const arrayWrap: (input: List.List<List.List<string>>) => List.List<string>;
37
+ /** @type {(_: string) => List.List<string>} */
38
+ declare const stringSerialize: (_: string) => List.List<string>;
39
+ /** @type {(_: number) => List.List<string>} */
40
+ declare const numberSerialize: (_: number) => List.List<string>;
41
+ declare const nullSerialize: string[];
42
+ /** @type {(_: boolean) => List.List<string>} */
43
+ declare const boolSerialize: (_: boolean) => List.List<string>;
44
+ import * as O from '../../types/object/module.f.mjs';
45
+ import * as List from '../../types/list/module.f.mjs';
@@ -0,0 +1,8 @@
1
+ declare namespace _default {
2
+ let arrayWrap: (() => void)[];
3
+ let objectWrap: (() => void)[];
4
+ let stringSerialize: (() => void)[];
5
+ let numberSerialize: (() => void)[];
6
+ let boolSerialize: (() => void)[];
7
+ }
8
+ export default _default;
@@ -0,0 +1,8 @@
1
+ declare namespace _default {
2
+ function setProperty(): void;
3
+ let stringify: {
4
+ sort: () => void;
5
+ identity: () => void;
6
+ }[];
7
+ }
8
+ export default _default;
@@ -0,0 +1,17 @@
1
+ declare namespace _default {
2
+ export { tokenize };
3
+ }
4
+ export default _default;
5
+ export type JsonToken = {
6
+ readonly kind: "true" | "false" | "null";
7
+ } | {
8
+ readonly kind: "{" | "}" | ":" | "," | "[" | "]";
9
+ } | jsTokenizerT.StringToken | jsTokenizerT.NumberToken | jsTokenizerT.ErrorToken;
10
+ export type ScanState = {
11
+ readonly kind: "def" | "-";
12
+ };
13
+ export type ScanInput = jsTokenizerT.JsToken | null;
14
+ /** @type {(input: List.List<number>) => List.List<JsonToken>} */
15
+ declare const tokenize: (input: List.List<number>) => List.List<JsonToken>;
16
+ import * as jsTokenizerT from '../../js/tokenizer/module.f.mjs';
17
+ import * as List from '../../types/list/module.f.mjs';
@@ -0,0 +1,6 @@
1
+ declare namespace _default {
2
+ let json: (() => void)[];
3
+ let id: (() => void)[];
4
+ let keywords: (() => void)[];
5
+ }
6
+ export default _default;
package/jsr.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@functionalscript/functionalscript",
3
- "version": "0.1.593",
3
+ "version": "0.1.596",
4
4
  "exports": "./index.f.mjs"
5
5
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ declare namespace _default {
2
+ export { version };
3
+ }
4
+ export default _default;
5
+ export type ChildProcess = {
6
+ readonly execSync: (cmd: string) => Buffer;
7
+ };
8
+ export type Buffer = {};
9
+ export type Fs<T> = {
10
+ readonly readFileSync: (name: string) => Buffer;
11
+ readonly writeFileSync: (name: string, content: string) => T;
12
+ };
13
+ export type Node<T> = {
14
+ readonly child_process: ChildProcess;
15
+ readonly fs: Fs<T>;
16
+ };
17
+ /** @type {<T>(node: Node<T>) => readonly[T, T]} */
18
+ declare const version: <T>(node: Node<T>) => readonly [T, T];
@@ -0,0 +1,2 @@
1
+ declare function _default(): void;
2
+ export default _default;
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.1.593",
3
+ "version": "0.1.596",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "index.f.mjs",
6
6
  "scripts": {
7
+ "tscp": "tsc --declaration --emitDeclarationOnly --noEmit false",
7
8
  "tsc": "tsc",
8
9
  "test": "tsc && npm run test-only",
9
10
  "index": "node ./dev/index.mjs",
@@ -0,0 +1,44 @@
1
+ declare namespace _default {
2
+ export { prime_field };
3
+ export let sqrt: (f: PrimeField) => (a: bigint) => bigint | null;
4
+ }
5
+ export default _default;
6
+ export type Reduce = Operator.Reduce<bigint>;
7
+ export type Unary = Operator.Unary<bigint, bigint>;
8
+ export type PrimeField = {
9
+ readonly p: bigint;
10
+ readonly middle: bigint;
11
+ readonly max: bigint;
12
+ readonly neg: Unary;
13
+ readonly sub: Reduce;
14
+ readonly add: Reduce;
15
+ readonly abs: Unary;
16
+ readonly mul: Reduce;
17
+ readonly reciprocal: Unary;
18
+ readonly div: Reduce;
19
+ readonly pow: Reduce;
20
+ readonly pow2: Unary;
21
+ readonly pow3: Unary;
22
+ };
23
+ /** @typedef {Operator.Reduce<bigint>} Reduce */
24
+ /** @typedef {Operator.Unary<bigint, bigint>} Unary*/
25
+ /**
26
+ * @typedef {{
27
+ * readonly p: bigint
28
+ * readonly middle: bigint
29
+ * readonly max: bigint
30
+ * readonly neg: Unary
31
+ * readonly sub: Reduce
32
+ * readonly add: Reduce
33
+ * readonly abs: Unary
34
+ * readonly mul: Reduce
35
+ * readonly reciprocal: Unary
36
+ * readonly div: Reduce
37
+ * readonly pow: Reduce
38
+ * readonly pow2: Unary
39
+ * readonly pow3: Unary
40
+ * }} PrimeField
41
+ */
42
+ /** @type {(p: bigint) => PrimeField} */
43
+ declare const prime_field: (p: bigint) => PrimeField;
44
+ import * as Operator from '../types/function/operator/module.f.mjs';
@@ -0,0 +1,12 @@
1
+ declare namespace _default {
2
+ function prime_field_test(): {
3
+ neg: () => void;
4
+ sub: () => void;
5
+ add: () => void;
6
+ mul: () => void;
7
+ reciprocal: () => void;
8
+ pow: () => void;
9
+ sqrt: () => void;
10
+ };
11
+ }
12
+ export default _default;
@@ -0,0 +1,49 @@
1
+ declare namespace _default {
2
+ export { curve };
3
+ export let eq: (a: Point) => (b: Point) => boolean;
4
+ export let secp256k1: Init;
5
+ export let secp192r1: Init;
6
+ }
7
+ export default _default;
8
+ export type Point2D = readonly [bigint, bigint];
9
+ export type Point = Point2D | null;
10
+ export type Init = {
11
+ readonly p: bigint;
12
+ readonly a: readonly [bigint, bigint];
13
+ readonly g: readonly [bigint, bigint];
14
+ readonly n: bigint;
15
+ };
16
+ export type Curve = {
17
+ readonly pf: pfT.PrimeField;
18
+ readonly nf: pfT.PrimeField;
19
+ readonly y2: (x: bigint) => bigint;
20
+ readonly y: (x: bigint) => bigint | null;
21
+ readonly neg: (a: Point) => Point;
22
+ readonly add: op.Reduce<Point>;
23
+ readonly mul: (a: Point) => (n: bigint) => Point;
24
+ };
25
+ /** @typedef {readonly[bigint, bigint]} Point2D */
26
+ /** @typedef {Point2D|null} Point */
27
+ /**
28
+ * @typedef {{
29
+ * readonly p: bigint
30
+ * readonly a: readonly[bigint, bigint]
31
+ * readonly g: readonly[bigint, bigint]
32
+ * readonly n: bigint
33
+ * }} Init
34
+ */
35
+ /**
36
+ * @typedef {{
37
+ * readonly pf: pfT.PrimeField
38
+ * readonly nf: pfT.PrimeField
39
+ * readonly y2: (x: bigint) => bigint
40
+ * readonly y: (x: bigint) => bigint|null
41
+ * readonly neg: (a: Point) => Point
42
+ * readonly add: op.Reduce<Point>
43
+ * readonly mul: (a: Point) => (n: bigint) => Point
44
+ * }} Curve
45
+ */
46
+ /** @type {(i: Init) => Curve} */
47
+ declare const curve: (i: Init) => Curve;
48
+ import * as pfT from '../prime_field/module.f.mjs';
49
+ import * as op from '../types/function/operator/module.f.mjs';
@@ -0,0 +1,4 @@
1
+ declare namespace _default {
2
+ function test(): void;
3
+ }
4
+ export default _default;