functionalscript 0.1.594 → 0.1.597

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 (167) hide show
  1. package/.github/workflows/npm-publish.yml +2 -1
  2. package/com/cpp/module.f.d.mts +8 -0
  3. package/com/cpp/module.f.mjs +18 -18
  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/module.f.mjs +1 -1
  8. package/com/cs/test.f.d.mts +2 -0
  9. package/com/cs/testlib.f.d.mts +2 -0
  10. package/com/rust/module.f.d.mts +28 -0
  11. package/com/rust/module.f.mjs +30 -30
  12. package/com/rust/test.f.d.mts +2 -0
  13. package/com/rust/testlib.f.d.mts +2 -0
  14. package/com/test/build.d.mts +1 -0
  15. package/com/test/build.f.d.mts +26 -0
  16. package/com/test/build.mjs +2 -2
  17. package/com/types/module.f.d.mts +28 -0
  18. package/com/types/module.f.mjs +1 -1
  19. package/com/types/testlib.f.d.mts +44 -0
  20. package/commonjs/build/module.f.d.mts +24 -0
  21. package/commonjs/build/test.f.d.mts +3 -0
  22. package/commonjs/module/function/module.f.d.mts +7 -0
  23. package/commonjs/module/module.f.d.mts +57 -0
  24. package/commonjs/module/module.f.mjs +1 -1
  25. package/commonjs/module.d.mts +7 -0
  26. package/commonjs/module.f.d.mts +4 -0
  27. package/commonjs/package/dependencies/module.f.d.mts +10 -0
  28. package/commonjs/package/dependencies/module.f.mjs +3 -3
  29. package/commonjs/package/dependencies/test.f.d.mts +2 -0
  30. package/commonjs/package/module.f.d.mts +27 -0
  31. package/commonjs/package/module.f.mjs +4 -4
  32. package/commonjs/package/test.f.d.mts +2 -0
  33. package/commonjs/path/module.f.d.mts +67 -0
  34. package/commonjs/path/module.f.mjs +5 -5
  35. package/commonjs/path/test.f.d.mts +25 -0
  36. package/commonjs/path/test.f.mjs +7 -7
  37. package/commonjs/test.d.mts +8 -0
  38. package/commonjs/test.mjs +2 -2
  39. package/dev/index.d.mts +1 -0
  40. package/dev/module.d.mts +26 -0
  41. package/dev/module.f.d.mts +4 -0
  42. package/dev/test/module.f.d.mts +26 -0
  43. package/dev/test.d.mts +3 -0
  44. package/dev/test.f.d.mts +9 -0
  45. package/djs/module.f.d.mts +25 -0
  46. package/djs/module.f.mjs +1 -1
  47. package/djs/parser/module.f.d.mts +40 -0
  48. package/djs/parser/test.f.d.mts +8 -0
  49. package/djs/test.f.d.mts +12 -0
  50. package/djs/tokenizer/module.f.d.mts +17 -0
  51. package/djs/tokenizer/module.f.mjs +1 -1
  52. package/djs/tokenizer/test.f.d.mts +6 -0
  53. package/djs/tokenizer/test.f.mjs +1 -1
  54. package/fsc/module.f.d.mts +12 -0
  55. package/fsc/test.f.d.mts +4 -0
  56. package/fsm/module.f.d.mts +21 -0
  57. package/fsm/test.f.d.mts +5 -0
  58. package/html/module.f.d.mts +20 -0
  59. package/html/module.f.mjs +1 -1
  60. package/html/test.f.d.mts +10 -0
  61. package/index.f.d.mts +83 -0
  62. package/js/tokenizer/module.f.d.mts +150 -0
  63. package/js/tokenizer/test.f.d.mts +8 -0
  64. package/js/tokenizer/test.f.mjs +3 -3
  65. package/json/module.f.d.mts +41 -0
  66. package/json/parser/module.f.d.mts +36 -0
  67. package/json/parser/module.f.mjs +12 -12
  68. package/json/parser/test.f.d.mts +5 -0
  69. package/json/parser/test.f.mjs +2 -2
  70. package/json/serializer/module.f.d.mts +45 -0
  71. package/json/serializer/module.f.mjs +2 -2
  72. package/json/serializer/test.f.d.mts +8 -0
  73. package/json/test.f.d.mts +8 -0
  74. package/json/tokenizer/module.f.d.mts +17 -0
  75. package/json/tokenizer/module.f.mjs +7 -7
  76. package/json/tokenizer/test.f.d.mts +6 -0
  77. package/json/tokenizer/test.f.mjs +3 -3
  78. package/jsr.json +1 -1
  79. package/nodejs/version/main.d.mts +1 -0
  80. package/nodejs/version/module.f.d.mts +18 -0
  81. package/nodejs/version/test.f.d.mts +2 -0
  82. package/package.json +2 -1
  83. package/prime_field/module.f.d.mts +44 -0
  84. package/prime_field/test.f.d.mts +12 -0
  85. package/secp/module.f.d.mts +49 -0
  86. package/secp/module.f.mjs +6 -6
  87. package/secp/test.f.d.mts +4 -0
  88. package/secp/test.f.mjs +5 -5
  89. package/sha2/module.f.d.mts +23 -0
  90. package/sha2/module.f.mjs +1 -1
  91. package/sha2/test.f.d.mts +10 -0
  92. package/sha2/test.f.mjs +0 -1
  93. package/text/ascii/module.f.d.mts +73 -0
  94. package/text/ascii/test.f.d.mts +4 -0
  95. package/text/module.f.d.mts +18 -0
  96. package/text/sgr/module.f.d.mts +14 -0
  97. package/text/test.f.d.mts +2 -0
  98. package/text/utf16/module.f.d.mts +19 -0
  99. package/text/utf16/test.f.d.mts +6 -0
  100. package/text/utf16/test.f.mjs +2 -2
  101. package/text/utf8/module.f.d.mts +15 -0
  102. package/text/utf8/module.f.mjs +2 -2
  103. package/text/utf8/test.f.d.mts +6 -0
  104. package/types/array/module.f.d.mts +41 -0
  105. package/types/array/test.f.d.mts +10 -0
  106. package/types/bigfloat/module.f.d.mts +11 -0
  107. package/types/bigfloat/test.f.d.mts +6 -0
  108. package/types/bigint/module.f.d.mts +77 -0
  109. package/types/bigint/module.f.mjs +5 -5
  110. package/types/bigint/test.f.d.mts +16 -0
  111. package/types/btree/find/module.f.d.mts +42 -0
  112. package/types/btree/find/module.f.mjs +4 -4
  113. package/types/btree/find/test.f.d.mts +2 -0
  114. package/types/btree/find/test.f.mjs +2 -2
  115. package/types/btree/module.f.d.mts +9 -0
  116. package/types/btree/remove/module.f.d.mts +19 -0
  117. package/types/btree/remove/module.f.mjs +12 -12
  118. package/types/btree/remove/test.f.d.mts +7 -0
  119. package/types/btree/remove/test.f.mjs +5 -5
  120. package/types/btree/set/module.f.d.mts +9 -0
  121. package/types/btree/set/module.f.mjs +6 -6
  122. package/types/btree/set/test.f.d.mts +2 -0
  123. package/types/btree/set/test.f.mjs +32 -32
  124. package/types/btree/test.f.d.mts +13 -0
  125. package/types/btree/test.f.mjs +7 -11
  126. package/types/btree/types/module.f.d.mts +16 -0
  127. package/types/byte_set/module.f.d.mts +38 -0
  128. package/types/byte_set/module.f.mjs +2 -2
  129. package/types/byte_set/test.f.d.mts +13 -0
  130. package/types/byte_set/test.f.mjs +3 -3
  131. package/types/function/compare/module.f.d.mts +29 -0
  132. package/types/function/compare/module.f.mjs +4 -4
  133. package/types/function/compare/test.f.d.mts +2 -0
  134. package/types/function/module.f.d.mts +36 -0
  135. package/types/function/operator/module.f.d.mts +75 -0
  136. package/types/function/test.f.d.mts +2 -0
  137. package/types/list/module.f.d.mts +117 -0
  138. package/types/list/test.f.d.mts +38 -0
  139. package/types/map/module.f.d.mts +30 -0
  140. package/types/map/module.f.mjs +4 -4
  141. package/types/map/test.f.d.mts +5 -0
  142. package/types/nibble_set/module.f.d.mts +26 -0
  143. package/types/nibble_set/test.f.d.mts +13 -0
  144. package/types/nullable/module.f.d.mts +14 -0
  145. package/types/nullable/test.f.d.mts +2 -0
  146. package/types/number/module.f.d.mts +13 -0
  147. package/types/number/test.f.d.mts +11 -0
  148. package/types/object/module.f.d.mts +29 -0
  149. package/types/object/test.f.d.mts +5 -0
  150. package/types/range/module.f.d.mts +11 -0
  151. package/types/range/test.f.d.mts +2 -0
  152. package/types/range_map/module.f.d.mts +25 -0
  153. package/types/range_map/module.f.mjs +5 -5
  154. package/types/range_map/test.f.d.mts +6 -0
  155. package/types/range_map/test.f.mjs +2 -2
  156. package/types/result/module.d.mts +7 -0
  157. package/types/result/module.f.d.mts +28 -0
  158. package/types/sorted_list/module.f.d.mts +59 -0
  159. package/types/sorted_list/test.f.d.mts +5 -0
  160. package/types/sorted_list/test.f.mjs +2 -2
  161. package/types/sorted_set/module.f.d.mts +25 -0
  162. package/types/sorted_set/test.f.d.mts +6 -0
  163. package/types/sorted_set/test.f.mjs +1 -1
  164. package/types/string/module.f.d.mts +15 -0
  165. package/types/string/test.f.d.mts +15 -0
  166. package/types/string_set/module.f.d.mts +21 -0
  167. package/types/string_set/test.f.d.mts +5 -0
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;
@@ -1,12 +1,12 @@
1
- import tokenizer, * as tokenizerT from './module.f.mjs'
1
+ import tokenizer, * as Tokenizer from './module.f.mjs'
2
2
  import list from '../../types/list/module.f.mjs'
3
- const { toArray, countdown } = list
3
+ const { toArray } = list
4
4
  import djs from '../../djs/module.f.mjs'
5
5
  import o from '../../types/object/module.f.mjs'
6
6
  const { sort } = o
7
7
  import encoding from '../../text/utf16/module.f.mjs'
8
8
 
9
- /** @type {(s: string) => readonly tokenizerT.JsToken[]} */
9
+ /** @type {(s: string) => readonly Tokenizer.JsToken[]} */
10
10
  const tokenizeString = s => toArray(tokenizer.tokenize(encoding.stringToList(s)))
11
11
 
12
12
  const stringify = djs.stringify(sort)
@@ -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<Tokenizer.JsonToken>) => Result.Result<Json.Unknown, string>} */
31
+ declare const parse: (tokenList: List.List<Tokenizer.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 Tokenizer from '../tokenizer/module.f.mjs';
36
+ import * as Result from '../../types/result/module.f.mjs';
@@ -2,7 +2,7 @@ import result, * as Result from '../../types/result/module.f.mjs'
2
2
  import list, * as List from '../../types/list/module.f.mjs'
3
3
  const { fold, first, drop, toArray } = list
4
4
  import * as Operator from '../../types/function/operator/module.f.mjs'
5
- import * as tokenizerT from '../tokenizer/module.f.mjs'
5
+ import * as Tokenizer from '../tokenizer/module.f.mjs'
6
6
  import map, * as Map from '../../types/map/module.f.mjs'
7
7
  const { setReplace } = map
8
8
  import * as Json from '../module.f.mjs'
@@ -114,7 +114,7 @@ const endObject = state => {
114
114
  return pushValue(newState)(obj)
115
115
  }
116
116
 
117
- /** @type {(token: tokenizerT.JsonToken) => Json.Unknown} */
117
+ /** @type {(token: Tokenizer.JsonToken) => Json.Unknown} */
118
118
  const tokenToValue = token => {
119
119
  switch (token.kind) {
120
120
  case 'null': return null
@@ -126,7 +126,7 @@ const tokenToValue = token => {
126
126
  }
127
127
  }
128
128
 
129
- /** @type {(token: tokenizerT.JsonToken) => boolean} */
129
+ /** @type {(token: Tokenizer.JsonToken) => boolean} */
130
130
  const isValueToken = token => {
131
131
  switch (token.kind) {
132
132
  case 'null':
@@ -138,7 +138,7 @@ const isValueToken = token => {
138
138
  }
139
139
  }
140
140
 
141
- /** @type {(token: tokenizerT.JsonToken) => (state: StateParse) => JsonState}} */
141
+ /** @type {(token: Tokenizer.JsonToken) => (state: StateParse) => JsonState}} */
142
142
  const parseValueOp = token => state => {
143
143
  if (isValueToken(token)) { return pushValue(state)(tokenToValue(token)) }
144
144
  if (token.kind === '[') { return startArray(state) }
@@ -146,7 +146,7 @@ const parseValueOp = token => state => {
146
146
  return { status: 'error', message: 'unexpected token' }
147
147
  }
148
148
 
149
- /** @type {(token: tokenizerT.JsonToken) => (state: StateParse) => JsonState}} */
149
+ /** @type {(token: Tokenizer.JsonToken) => (state: StateParse) => JsonState}} */
150
150
  const parseArrayStartOp = token => state => {
151
151
  if (isValueToken(token)) { return pushValue(state)(tokenToValue(token)) }
152
152
  if (token.kind === '[') { return startArray(state) }
@@ -155,40 +155,40 @@ const parseArrayStartOp = token => state => {
155
155
  return { status: 'error', message: 'unexpected token' }
156
156
  }
157
157
 
158
- /** @type {(token: tokenizerT.JsonToken) => (state: StateParse) => JsonState}} */
158
+ /** @type {(token: Tokenizer.JsonToken) => (state: StateParse) => JsonState}} */
159
159
  const parseArrayValueOp = token => state => {
160
160
  if (token.kind === ']') { return endArray(state) }
161
161
  if (token.kind === ',') { return { status: '[,', top: state.top, stack: state.stack } }
162
162
  return { status: 'error', message: 'unexpected token' }
163
163
  }
164
164
 
165
- /** @type {(token: tokenizerT.JsonToken) => (state: StateParse) => JsonState}} */
165
+ /** @type {(token: Tokenizer.JsonToken) => (state: StateParse) => JsonState}} */
166
166
  const parseObjectStartOp = token => state => {
167
167
  if (token.kind === 'string') { return pushKey(state)(token.value) }
168
168
  if (token.kind === '}') { return endObject(state) }
169
169
  return { status: 'error', message: 'unexpected token' }
170
170
  }
171
171
 
172
- /** @type {(token: tokenizerT.JsonToken) => (state: StateParse) => JsonState}} */
172
+ /** @type {(token: Tokenizer.JsonToken) => (state: StateParse) => JsonState}} */
173
173
  const parseObjectKeyOp = token => state => {
174
174
  if (token.kind === ':') { return { status: '{:', top: state.top, stack: state.stack } }
175
175
  return { status: 'error', message: 'unexpected token' }
176
176
  }
177
177
 
178
- /** @type {(token: tokenizerT.JsonToken) => (state: StateParse) => JsonState}} */
178
+ /** @type {(token: Tokenizer.JsonToken) => (state: StateParse) => JsonState}} */
179
179
  const parseObjectNextOp = token => state => {
180
180
  if (token.kind === '}') { return endObject(state) }
181
181
  if (token.kind === ',') { return { status: '{,', top: state.top, stack: state.stack } }
182
182
  return { status: 'error', message: 'unexpected token' }
183
183
  }
184
184
 
185
- /** @type {(token: tokenizerT.JsonToken) => (state: StateParse) => JsonState}} */
185
+ /** @type {(token: Tokenizer.JsonToken) => (state: StateParse) => JsonState}} */
186
186
  const parseObjectCommaOp = token => state => {
187
187
  if (token.kind === 'string') { return pushKey(state)(token.value) }
188
188
  return { status: 'error', message: 'unexpected token' }
189
189
  }
190
190
 
191
- /** @type {Operator.Fold<tokenizerT.JsonToken, JsonState>} */
191
+ /** @type {Operator.Fold<Tokenizer.JsonToken, JsonState>} */
192
192
  const foldOp = token => state => {
193
193
  switch (state.status) {
194
194
  case 'result': return { status: 'error', message: 'unexpected token' }
@@ -205,7 +205,7 @@ const foldOp = token => state => {
205
205
  }
206
206
  }
207
207
 
208
- /** @type {(tokenList: List.List<tokenizerT.JsonToken>) => Result.Result<Json.Unknown, string>} */
208
+ /** @type {(tokenList: List.List<Tokenizer.JsonToken>) => Result.Result<Json.Unknown, string>} */
209
209
  const parse = tokenList => {
210
210
  const state = fold(foldOp)({ status: '', top: null, stack: null })(tokenList)
211
211
  switch (state.status) {
@@ -0,0 +1,5 @@
1
+ declare namespace _default {
2
+ let valid: (() => void)[];
3
+ let invalid: (() => void)[];
4
+ }
5
+ export default _default;
@@ -1,5 +1,5 @@
1
1
  import parser from './module.f.mjs'
2
- import tokenizer, * as tokenizerT from '../tokenizer/module.f.mjs'
2
+ import tokenizer, * as Tokenizer from '../tokenizer/module.f.mjs'
3
3
  import list from '../../types/list/module.f.mjs'
4
4
  const { toArray } = list
5
5
  import json from '../module.f.mjs'
@@ -7,7 +7,7 @@ import o from '../../types/object/module.f.mjs'
7
7
  const { sort } = o
8
8
  import encoding from '../../text/utf16/module.f.mjs'
9
9
 
10
- /** @type {(s: string) => readonly tokenizerT.JsonToken[]} */
10
+ /** @type {(s: string) => readonly Tokenizer.JsonToken[]} */
11
11
  const tokenizeString = s => toArray(tokenizer.tokenize(encoding.stringToList(s)))
12
12
 
13
13
  const stringify = json.stringify(sort)
@@ -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';
@@ -1,7 +1,7 @@
1
1
  import list, * as List from '../../types/list/module.f.mjs'
2
2
  const { flat, reduce, empty } = list
3
- import object, * as O from '../../types/object/module.f.mjs'
4
- import operator, * as Operator from '../../types/function/operator/module.f.mjs'
3
+ import * as O from '../../types/object/module.f.mjs'
4
+ import * as Operator from '../../types/function/operator/module.f.mjs'
5
5
 
6
6
  /**
7
7
  * @template T
@@ -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
+ } | JsTokenizer.StringToken | JsTokenizer.NumberToken | JsTokenizer.ErrorToken;
10
+ export type ScanState = {
11
+ readonly kind: "def" | "-";
12
+ };
13
+ export type ScanInput = JsTokenizer.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 JsTokenizer from '../../js/tokenizer/module.f.mjs';
17
+ import * as List from '../../types/list/module.f.mjs';
@@ -1,17 +1,17 @@
1
- import operator, * as Operator from '../../types/function/operator/module.f.mjs'
1
+ import * as Operator from '../../types/function/operator/module.f.mjs'
2
2
  import list, * as List from '../../types/list/module.f.mjs'
3
3
  const { empty, flat, stateScan } = list
4
4
  import bf from '../../types/bigfloat/module.f.mjs'
5
5
  const { multiply } = bf
6
- import jsTokenizer, * as jsTokenizerT from '../../js/tokenizer/module.f.mjs'
6
+ import jsTokenizer, * as JsTokenizer from '../../js/tokenizer/module.f.mjs'
7
7
 
8
8
  /**
9
9
  * @typedef {|
10
10
  * {readonly kind: 'true' | 'false' | 'null' } |
11
11
  * {readonly kind: '{' | '}' | ':' | ',' | '[' | ']' } |
12
- * jsTokenizerT.StringToken |
13
- * jsTokenizerT.NumberToken |
14
- * jsTokenizerT.ErrorToken
12
+ * JsTokenizer.StringToken |
13
+ * JsTokenizer.NumberToken |
14
+ * JsTokenizer.ErrorToken
15
15
  * } JsonToken
16
16
  */
17
17
 
@@ -23,11 +23,11 @@ import jsTokenizer, * as jsTokenizerT from '../../js/tokenizer/module.f.mjs'
23
23
 
24
24
  /**
25
25
  * @typedef {|
26
- * jsTokenizerT.JsToken | null
26
+ * JsTokenizer.JsToken | null
27
27
  * } ScanInput
28
28
  */
29
29
 
30
- /** @type {(input: jsTokenizerT.JsToken) => List.List<JsonToken>} */
30
+ /** @type {(input: JsTokenizer.JsToken) => List.List<JsonToken>} */
31
31
  const mapToken = input =>
32
32
  {
33
33
  switch(input.kind)
@@ -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;
@@ -1,12 +1,12 @@
1
- import tokenizer, * as tokenizerT from './module.f.mjs'
1
+ import tokenizer, * as Tokenizer from './module.f.mjs'
2
2
  import list from '../../types/list/module.f.mjs'
3
- const { toArray, countdown } = list
3
+ const { toArray } = list
4
4
  import djs from '../../djs/module.f.mjs'
5
5
  import o from '../../types/object/module.f.mjs'
6
6
  const { sort } = o
7
7
  import encoding from '../../text/utf16/module.f.mjs'
8
8
 
9
- /** @type {(s: string) => readonly tokenizerT.JsonToken[]} */
9
+ /** @type {(s: string) => readonly Tokenizer.JsonToken[]} */
10
10
  const tokenizeString = s => toArray(tokenizer.tokenize(encoding.stringToList(s)))
11
11
 
12
12
  const stringify = djs.stringify(sort)
package/jsr.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@functionalscript/functionalscript",
3
- "version": "0.1.594",
3
+ "version": "0.1.597",
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;