firefly-compiler 0.4.4
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/.firefly-workspace +1 -0
- package/.vscode/settings.json +5 -0
- package/LICENSE.txt +21 -0
- package/README.md +96 -0
- package/bin/firefly.mjs +2 -0
- package/compiler/.firefly/package.ff +1 -0
- package/compiler/Builder.ff +218 -0
- package/compiler/Compiler.ff +241 -0
- package/compiler/Dependencies.ff +179 -0
- package/compiler/Deriver.ff +647 -0
- package/compiler/Dictionaries.ff +205 -0
- package/compiler/Environment.ff +166 -0
- package/compiler/Inference.ff +1117 -0
- package/compiler/JsEmitter.ff +861 -0
- package/compiler/JsImporter.ff +56 -0
- package/compiler/LspHook.ff +188 -0
- package/compiler/Main.ff +237 -0
- package/compiler/Parser.ff +1383 -0
- package/compiler/Patterns.ff +111 -0
- package/compiler/Resolver.ff +620 -0
- package/compiler/Substitution.ff +178 -0
- package/compiler/Syntax.ff +299 -0
- package/compiler/Token.ff +180 -0
- package/compiler/Tokenizer.ff +278 -0
- package/compiler/Unification.ff +220 -0
- package/compiler/Wildcards.ff +50 -0
- package/compiler/Workspace.ff +88 -0
- package/core/.firefly/package.ff +2 -0
- package/core/Any.ff +30 -0
- package/core/Array.ff +249 -0
- package/core/AssetSystem.ff +61 -0
- package/core/Atomic.ff +64 -0
- package/core/Bool.ff +13 -0
- package/core/BrowserSystem.ff +14 -0
- package/core/Buffer.ff +211 -0
- package/core/BuildSystem.ff +144 -0
- package/core/Channel.ff +131 -0
- package/core/Char.ff +18 -0
- package/core/Core.ff +58 -0
- package/core/Duration.ff +15 -0
- package/core/Equal.ff +52 -0
- package/core/Error.ff +20 -0
- package/core/FileHandle.ff +41 -0
- package/core/Float.ff +41 -0
- package/core/HttpClient.ff +84 -0
- package/core/Instant.ff +9 -0
- package/core/Int.ff +61 -0
- package/core/IntMap.ff +85 -0
- package/core/JsSystem.ff +66 -0
- package/core/JsValue.ff +240 -0
- package/core/List.ff +440 -0
- package/core/Lock.ff +144 -0
- package/core/Log.ff +24 -0
- package/core/Map.ff +126 -0
- package/core/NodeSystem.ff +88 -0
- package/core/Nothing.ff +1 -0
- package/core/Option.ff +133 -0
- package/core/Ordering.ff +157 -0
- package/core/Pair.ff +55 -0
- package/core/Path.ff +393 -0
- package/core/RbMap.ff +216 -0
- package/core/Serializable.ff +173 -0
- package/core/Set.ff +38 -0
- package/core/Show.ff +43 -0
- package/core/Stack.ff +263 -0
- package/core/Stream.ff +406 -0
- package/core/String.ff +175 -0
- package/core/StringMap.ff +85 -0
- package/core/Task.ff +138 -0
- package/core/Try.ff +81 -0
- package/core/Unit.ff +3 -0
- package/experimental/random/AltGeneric.ff +44 -0
- package/experimental/random/Async.ff +68 -0
- package/experimental/random/Buffer2.ff +77 -0
- package/experimental/random/Cat.ff +12 -0
- package/experimental/random/Dictionary.ff +52 -0
- package/experimental/random/Example.ff +46 -0
- package/experimental/random/Generic.ff +102 -0
- package/experimental/random/HappyEyeballs.ff +40 -0
- package/experimental/random/HashMap.ff +72 -0
- package/experimental/random/IfElseUnit.ff +9 -0
- package/experimental/random/InputOutput.ff +23 -0
- package/experimental/random/ListVsArray.ff +45 -0
- package/experimental/random/Main.ff +44 -0
- package/experimental/random/MapTest.ff +67 -0
- package/experimental/random/OldTaskSystem.ff +210 -0
- package/experimental/random/PatternTest.ff +39 -0
- package/experimental/random/Patterns.ff +226 -0
- package/experimental/random/ReadBytesTest.ff +10 -0
- package/experimental/random/RunLength.ff +65 -0
- package/experimental/random/Scrape.ff +51 -0
- package/experimental/random/Serialization.ff +217 -0
- package/experimental/random/SerializationTest.ff +46 -0
- package/experimental/random/Serializer.ff +36 -0
- package/experimental/random/StdInOutErr.ff +4 -0
- package/experimental/random/Symbols.ff +74 -0
- package/experimental/random/Tag.ff +49 -0
- package/experimental/random/Tensor.ff +52 -0
- package/experimental/random/Try.ff +56 -0
- package/experimental/random/Tsv.ff +9 -0
- package/experimental/random/TypesAreModules.ff +87 -0
- package/experimental/random/blueprints/Blueprint.ff +52 -0
- package/experimental/random/blueprints/Main.ff +11 -0
- package/experimental/random/blueprints/Pretty.ff +58 -0
- package/experimental/random/blueprints/User.ff +64 -0
- package/experimental/random/blueprintsystem/BlueprintSystem.ff +48 -0
- package/experimental/random/blueprintsystem/Deserialize.ff +53 -0
- package/experimental/random/blueprintsystem/ReadJs.ff +13 -0
- package/experimental/random/blueprintsystem/User.ff +2 -0
- package/experimental/random/kahrs/Kahrs.ff +112 -0
- package/experimental/random/kahrs/TestKahrs.ff +22 -0
- package/experimental/random/kahrs/TestMap.ff +18 -0
- package/experimental/random/streaming/Gzip.ff +3 -0
- package/experimental/random/streaming/Main.ff +34 -0
- package/experimental/random/streaming/S3Bucket.ff +11 -0
- package/experimental/random/streaming/Tar.ff +5 -0
- package/experimental/rhymeapp/Main.ff +81 -0
- package/experimental/rhymeapp/index.html +14 -0
- package/firefly.sh +5 -0
- package/fireflysite/Main.ff +13 -0
- package/httpserver/.firefly/package.ff +1 -0
- package/httpserver/HttpServer.ff +184 -0
- package/lsp/.firefly/package.ff +1 -0
- package/lsp/CompletionHandler.ff +814 -0
- package/lsp/Handler.ff +551 -0
- package/lsp/HoverHandler.ff +82 -0
- package/lsp/LanguageServer.ff +229 -0
- package/lsp/SignatureHelpHandler.ff +55 -0
- package/lsp/SymbolHandler.ff +167 -0
- package/output/js/ff/compiler/Builder.mjs +483 -0
- package/output/js/ff/compiler/Compiler.mjs +410 -0
- package/output/js/ff/compiler/Dependencies.mjs +388 -0
- package/output/js/ff/compiler/Deriver.mjs +1166 -0
- package/output/js/ff/compiler/Dictionaries.mjs +1305 -0
- package/output/js/ff/compiler/Environment.mjs +1005 -0
- package/output/js/ff/compiler/Inference.mjs +4264 -0
- package/output/js/ff/compiler/JsEmitter.mjs +5353 -0
- package/output/js/ff/compiler/JsImporter.mjs +262 -0
- package/output/js/ff/compiler/LspHook.mjs +789 -0
- package/output/js/ff/compiler/Main.mjs +1695 -0
- package/output/js/ff/compiler/Parser.mjs +4004 -0
- package/output/js/ff/compiler/Patterns.mjs +923 -0
- package/output/js/ff/compiler/Resolver.mjs +2303 -0
- package/output/js/ff/compiler/Substitution.mjs +1146 -0
- package/output/js/ff/compiler/Syntax.mjs +12430 -0
- package/output/js/ff/compiler/Token.mjs +3092 -0
- package/output/js/ff/compiler/Tokenizer.mjs +589 -0
- package/output/js/ff/compiler/Unification.mjs +1748 -0
- package/output/js/ff/compiler/Wildcards.mjs +604 -0
- package/output/js/ff/compiler/Workspace.mjs +683 -0
- package/output/js/ff/core/Any.mjs +139 -0
- package/output/js/ff/core/Array.mjs +594 -0
- package/output/js/ff/core/AssetSystem.mjs +270 -0
- package/output/js/ff/core/Atomic.mjs +186 -0
- package/output/js/ff/core/Bool.mjs +141 -0
- package/output/js/ff/core/BrowserSystem.mjs +122 -0
- package/output/js/ff/core/Buffer.mjs +467 -0
- package/output/js/ff/core/BuildSystem.mjs +320 -0
- package/output/js/ff/core/Channel.mjs +268 -0
- package/output/js/ff/core/Char.mjs +145 -0
- package/output/js/ff/core/Core.mjs +300 -0
- package/output/js/ff/core/Duration.mjs +112 -0
- package/output/js/ff/core/Equal.mjs +175 -0
- package/output/js/ff/core/Error.mjs +138 -0
- package/output/js/ff/core/FileHandle.mjs +164 -0
- package/output/js/ff/core/Float.mjs +214 -0
- package/output/js/ff/core/HttpClient.mjs +210 -0
- package/output/js/ff/core/Instant.mjs +105 -0
- package/output/js/ff/core/Int.mjs +254 -0
- package/output/js/ff/core/IntMap.mjs +282 -0
- package/output/js/ff/core/JsSystem.mjs +234 -0
- package/output/js/ff/core/JsValue.mjs +678 -0
- package/output/js/ff/core/List.mjs +2335 -0
- package/output/js/ff/core/Lock.mjs +322 -0
- package/output/js/ff/core/Log.mjs +159 -0
- package/output/js/ff/core/Map.mjs +358 -0
- package/output/js/ff/core/NodeSystem.mjs +288 -0
- package/output/js/ff/core/Nothing.mjs +100 -0
- package/output/js/ff/core/Option.mjs +1002 -0
- package/output/js/ff/core/Ordering.mjs +734 -0
- package/output/js/ff/core/Pair.mjs +318 -0
- package/output/js/ff/core/Path.mjs +768 -0
- package/output/js/ff/core/RbMap.mjs +1936 -0
- package/output/js/ff/core/Serializable.mjs +434 -0
- package/output/js/ff/core/Set.mjs +250 -0
- package/output/js/ff/core/Show.mjs +201 -0
- package/output/js/ff/core/Stack.mjs +595 -0
- package/output/js/ff/core/Stream.mjs +1300 -0
- package/output/js/ff/core/String.mjs +433 -0
- package/output/js/ff/core/StringMap.mjs +282 -0
- package/output/js/ff/core/Task.mjs +345 -0
- package/output/js/ff/core/Try.mjs +503 -0
- package/output/js/ff/core/Unit.mjs +103 -0
- package/package.json +29 -0
- package/postgresql/.firefly/include/package-lock.json +250 -0
- package/postgresql/.firefly/include/package.json +5 -0
- package/postgresql/.firefly/include/prepare.sh +2 -0
- package/postgresql/.firefly/package.ff +3 -0
- package/postgresql/Pg.ff +530 -0
- package/unsafejs/.firefly/package.ff +1 -0
- package/unsafejs/UnsafeJs.ff +19 -0
- package/vscode/.vscode/launch.json +18 -0
- package/vscode/.vscode/tasks.json +33 -0
- package/vscode/LICENSE.txt +21 -0
- package/vscode/Prepublish.ff +15 -0
- package/vscode/README.md +17 -0
- package/vscode/client/package-lock.json +544 -0
- package/vscode/client/package.json +22 -0
- package/vscode/client/src/extension.ts +64 -0
- package/vscode/client/tsconfig.json +12 -0
- package/vscode/icons/firefly-icon.png +0 -0
- package/vscode/icons/firefly-icon.svg +10 -0
- package/vscode/icons/firefly-logo-notext.png +0 -0
- package/vscode/icons/firefly-logo.png +0 -0
- package/vscode/language-configuration.json +39 -0
- package/vscode/package-lock.json +3623 -0
- package/vscode/package.json +144 -0
- package/vscode/snippets-none.json +1 -0
- package/vscode/snippets.json +241 -0
- package/vscode/syntaxes/firefly.tmLanguage.json +294 -0
- package/vscode/tsconfig.json +20 -0
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import * as ff_core_Any from "../../ff/core/Any.mjs"
|
|
4
|
+
|
|
5
|
+
import * as ff_core_Array from "../../ff/core/Array.mjs"
|
|
6
|
+
|
|
7
|
+
import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
|
|
8
|
+
|
|
9
|
+
import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
|
|
10
|
+
|
|
11
|
+
import * as ff_core_Bool from "../../ff/core/Bool.mjs"
|
|
12
|
+
|
|
13
|
+
import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
|
|
14
|
+
|
|
15
|
+
import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
|
|
16
|
+
|
|
17
|
+
import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
|
|
18
|
+
|
|
19
|
+
import * as ff_core_Channel from "../../ff/core/Channel.mjs"
|
|
20
|
+
|
|
21
|
+
import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
22
|
+
|
|
23
|
+
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
|
+
|
|
25
|
+
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
|
+
|
|
27
|
+
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
28
|
+
|
|
29
|
+
import * as ff_core_Error from "../../ff/core/Error.mjs"
|
|
30
|
+
|
|
31
|
+
import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
|
|
32
|
+
|
|
33
|
+
import * as ff_core_Float from "../../ff/core/Float.mjs"
|
|
34
|
+
|
|
35
|
+
import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
|
|
36
|
+
|
|
37
|
+
import * as ff_core_Instant from "../../ff/core/Instant.mjs"
|
|
38
|
+
|
|
39
|
+
import * as ff_core_Int from "../../ff/core/Int.mjs"
|
|
40
|
+
|
|
41
|
+
import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
|
|
42
|
+
|
|
43
|
+
import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
|
|
44
|
+
|
|
45
|
+
import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
|
|
46
|
+
|
|
47
|
+
import * as ff_core_List from "../../ff/core/List.mjs"
|
|
48
|
+
|
|
49
|
+
import * as ff_core_Lock from "../../ff/core/Lock.mjs"
|
|
50
|
+
|
|
51
|
+
import * as ff_core_Log from "../../ff/core/Log.mjs"
|
|
52
|
+
|
|
53
|
+
import * as ff_core_Map from "../../ff/core/Map.mjs"
|
|
54
|
+
|
|
55
|
+
import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
|
|
56
|
+
|
|
57
|
+
import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
|
|
58
|
+
|
|
59
|
+
import * as ff_core_Option from "../../ff/core/Option.mjs"
|
|
60
|
+
|
|
61
|
+
import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
|
|
62
|
+
|
|
63
|
+
import * as ff_core_Pair from "../../ff/core/Pair.mjs"
|
|
64
|
+
|
|
65
|
+
import * as ff_core_Path from "../../ff/core/Path.mjs"
|
|
66
|
+
|
|
67
|
+
import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
|
|
68
|
+
|
|
69
|
+
import * as ff_core_Set from "../../ff/core/Set.mjs"
|
|
70
|
+
|
|
71
|
+
import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
72
|
+
|
|
73
|
+
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
74
|
+
|
|
75
|
+
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
76
|
+
|
|
77
|
+
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
78
|
+
|
|
79
|
+
import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
|
|
80
|
+
|
|
81
|
+
import * as ff_core_Task from "../../ff/core/Task.mjs"
|
|
82
|
+
|
|
83
|
+
import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
84
|
+
|
|
85
|
+
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
86
|
+
|
|
87
|
+
// type Stack
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
export function make_() {
|
|
93
|
+
return {array: []}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function fill_(size_, value_) {
|
|
97
|
+
|
|
98
|
+
return {array: new Array(size_).fill(value_)};
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function fillBy_(size_, body_) {
|
|
103
|
+
|
|
104
|
+
return {array: Array.from({length: size_}, (_, i) => body_(i))};
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function range_(size_) {
|
|
109
|
+
|
|
110
|
+
return {array: Array.from({length: size_}, (_, i) => i)};
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function sortRange_(stack_, compare_, start_, end_) {
|
|
115
|
+
if(((end_ - start_) < 2)) {
|
|
116
|
+
|
|
117
|
+
} else {
|
|
118
|
+
let middle_ = (start_ + ((end_ - start_) / 2));
|
|
119
|
+
ff_core_Stack.sortRange_(stack_, compare_, start_, middle_);
|
|
120
|
+
ff_core_Stack.sortRange_(stack_, compare_, middle_, end_);
|
|
121
|
+
let i_ = start_;
|
|
122
|
+
let j_ = middle_;
|
|
123
|
+
while(((i_ < middle_) && (j_ < end_))) {
|
|
124
|
+
if((compare_(ff_core_Stack.Stack_grab(stack_, i_), ff_core_Stack.Stack_grab(stack_, j_)) !== ff_core_Ordering.OrderingAfter())) {
|
|
125
|
+
i_ += 1
|
|
126
|
+
} else {
|
|
127
|
+
const value_ = ff_core_Stack.Stack_grab(stack_, j_);
|
|
128
|
+
let k_ = j_;
|
|
129
|
+
while((k_ > i_)) {
|
|
130
|
+
ff_core_Stack.Stack_set(stack_, k_, ff_core_Stack.Stack_grab(stack_, (k_ - 1)));
|
|
131
|
+
k_ -= 1
|
|
132
|
+
};
|
|
133
|
+
ff_core_Stack.Stack_set(stack_, i_, value_);
|
|
134
|
+
i_ += 1;
|
|
135
|
+
middle_ += 1;
|
|
136
|
+
j_ += 1
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export async function make_$($task) {
|
|
143
|
+
throw new Error('Function make is missing on this target in async context.');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export async function fill_$(size_, value_, $task) {
|
|
147
|
+
throw new Error('Function fill is missing on this target in async context.');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export async function fillBy_$(size_, body_, $task) {
|
|
151
|
+
throw new Error('Function fillBy is missing on this target in async context.');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export async function range_$(size_, $task) {
|
|
155
|
+
throw new Error('Function range is missing on this target in async context.');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export async function sortRange_$(stack_, compare_, start_, end_, $task) {
|
|
159
|
+
if(((end_ - start_) < 2)) {
|
|
160
|
+
|
|
161
|
+
} else {
|
|
162
|
+
let middle_ = (start_ + ((end_ - start_) / 2));
|
|
163
|
+
(await ff_core_Stack.sortRange_$(stack_, compare_, start_, middle_, $task));
|
|
164
|
+
(await ff_core_Stack.sortRange_$(stack_, compare_, middle_, end_, $task));
|
|
165
|
+
let i_ = start_;
|
|
166
|
+
let j_ = middle_;
|
|
167
|
+
while(((i_ < middle_) && (j_ < end_))) {
|
|
168
|
+
if(((await compare_(ff_core_Stack.Stack_grab(stack_, i_), ff_core_Stack.Stack_grab(stack_, j_), $task)) !== ff_core_Ordering.OrderingAfter())) {
|
|
169
|
+
i_ += 1
|
|
170
|
+
} else {
|
|
171
|
+
const value_ = ff_core_Stack.Stack_grab(stack_, j_);
|
|
172
|
+
let k_ = j_;
|
|
173
|
+
while((k_ > i_)) {
|
|
174
|
+
ff_core_Stack.Stack_set(stack_, k_, ff_core_Stack.Stack_grab(stack_, (k_ - 1)));
|
|
175
|
+
k_ -= 1
|
|
176
|
+
};
|
|
177
|
+
ff_core_Stack.Stack_set(stack_, i_, value_);
|
|
178
|
+
i_ += 1;
|
|
179
|
+
middle_ += 1;
|
|
180
|
+
j_ += 1
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function Stack_isEmpty(self_) {
|
|
187
|
+
return self_.array.length === 0
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function Stack_size(self_) {
|
|
191
|
+
return self_.array.length
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function Stack_get(self_, index_) {
|
|
195
|
+
|
|
196
|
+
return index_ >= 0 && index_ < self_.array.length
|
|
197
|
+
? ff_core_Option.Some(self_.array[index_])
|
|
198
|
+
: ff_core_Option.None()
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function Stack_grab(self_, index_) {
|
|
203
|
+
|
|
204
|
+
if(index_ < 0 || index_ >= self_.array.length) {
|
|
205
|
+
ff_core_Try.internalThrowGrabException_()
|
|
206
|
+
}
|
|
207
|
+
return self_.array[index_]
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function Stack_grabFirst(self_) {
|
|
212
|
+
return ff_core_Stack.Stack_grab(self_, 0)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function Stack_grabLast(self_) {
|
|
216
|
+
return ff_core_Stack.Stack_grab(self_, (ff_core_Stack.Stack_size(self_) - 1))
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function Stack_first(self_) {
|
|
220
|
+
|
|
221
|
+
return self_.array.length > 0
|
|
222
|
+
? ff_core_Option.Some(self_.array[0])
|
|
223
|
+
: ff_core_Option.None()
|
|
224
|
+
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function Stack_last(self_) {
|
|
228
|
+
|
|
229
|
+
return self_.array.length > 0
|
|
230
|
+
? ff_core_Option.Some(self_.array[self_.array.length - 1])
|
|
231
|
+
: ff_core_Option.None()
|
|
232
|
+
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export function Stack_push(self_, value_) {
|
|
236
|
+
self_.array.push(value_)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function Stack_pushAll(self_, value_) {
|
|
240
|
+
self_.array.push(...value_.array)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export function Stack_pushArray(self_, value_) {
|
|
244
|
+
self_.array.push(...value_)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export function Stack_pop(self_) {
|
|
248
|
+
|
|
249
|
+
return self_.array.length > 0
|
|
250
|
+
? ff_core_Option.Some(self_.array.pop())
|
|
251
|
+
: ff_core_Option.None()
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function Stack_set(self_, index_, value_) {
|
|
256
|
+
|
|
257
|
+
if(index_ < 0 || index_ > self_.array.length) {
|
|
258
|
+
ff_core_Try.internalThrowGrabException_()
|
|
259
|
+
}
|
|
260
|
+
self_.array[index_] = value_
|
|
261
|
+
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function Stack_modify(self_, index_, body_) {
|
|
265
|
+
|
|
266
|
+
if(index_ < 0 || index_ >= self_.array.length) {
|
|
267
|
+
ff_core_Try.internalThrowGrabException_()
|
|
268
|
+
}
|
|
269
|
+
self_.array[index_] = body_(self_.array[index_])
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export function Stack_fill(self_, value_, start_ = 0, end_ = 9007199254740991) {
|
|
274
|
+
|
|
275
|
+
self.array.fill(value_, start, end);
|
|
276
|
+
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export function Stack_copy(self_, target_, start_, end_) {
|
|
280
|
+
|
|
281
|
+
self.array.copyWithin(target, start, end);
|
|
282
|
+
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export function Stack_delete(self_, start_, deleteCount_) {
|
|
286
|
+
|
|
287
|
+
self.array.splice(start, deleteCount_);
|
|
288
|
+
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export function Stack_insert(self_, start_, value_, deleteCount_ = 0) {
|
|
292
|
+
|
|
293
|
+
self.array.splice(start, deleteCount_, value_);
|
|
294
|
+
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export function Stack_insertAll(self_, start_, value_, deleteCount_ = 0) {
|
|
298
|
+
|
|
299
|
+
self.array.splice(start, deleteCount_, ...value_.array);
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export function Stack_insertArray(self_, start_, value_, deleteCount_ = 0) {
|
|
304
|
+
|
|
305
|
+
self.array.splice(start, deleteCount_, ...value_);
|
|
306
|
+
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export function Stack_each(self_, body_) {
|
|
310
|
+
|
|
311
|
+
return self_.array.forEach(body_);
|
|
312
|
+
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export function Stack_eachWhile(self_, body_) {
|
|
316
|
+
for(const value of self_.array) if(!body_(value)) break
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export function Stack_all(self_, body_) {
|
|
320
|
+
let result_ = true;
|
|
321
|
+
ff_core_Stack.Stack_eachWhile(self_, ((x_) => {
|
|
322
|
+
result_ = body_(x_);
|
|
323
|
+
return result_
|
|
324
|
+
}));
|
|
325
|
+
return result_
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export function Stack_any(self_, body_) {
|
|
329
|
+
let result_ = false;
|
|
330
|
+
ff_core_Stack.Stack_eachWhile(self_, ((x_) => {
|
|
331
|
+
result_ = body_(x_);
|
|
332
|
+
return (!result_)
|
|
333
|
+
}));
|
|
334
|
+
return result_
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export function Stack_indexWhere(self_, body_) {
|
|
338
|
+
let i_ = (-1);
|
|
339
|
+
let result_ = false;
|
|
340
|
+
ff_core_Stack.Stack_eachWhile(self_, ((x_) => {
|
|
341
|
+
i_ += 1;
|
|
342
|
+
result_ = body_(x_);
|
|
343
|
+
return (!result_)
|
|
344
|
+
}));
|
|
345
|
+
if(result_) {
|
|
346
|
+
return ff_core_Option.Some(i_)
|
|
347
|
+
} else return ff_core_Option.None()
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export function Stack_drain(self_) {
|
|
351
|
+
const result = self_.array; self_.array = []; return result
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function Stack_toArray(self_, start_ = 0, end_ = 9007199254740991) {
|
|
355
|
+
return self_.array.slice(start_, end_)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export function Stack_toList(self_, start_ = 0, end_ = 9007199254740991) {
|
|
359
|
+
|
|
360
|
+
if(start_ < 0) start_ = self_.array.length + start_
|
|
361
|
+
if(end_ < 0) end_ = self_.array.length + start_
|
|
362
|
+
start_ = Math.max(0, Math.min(start_, self_.array.length))
|
|
363
|
+
end_ = Math.max(0, Math.min(end_, self_.array.length))
|
|
364
|
+
let result = ff_core_List.Empty();
|
|
365
|
+
for(let i = end_ - 1; i >= start_; i--) {
|
|
366
|
+
result = ff_core_List.Link(self_.array[i], result);
|
|
367
|
+
}
|
|
368
|
+
return result;
|
|
369
|
+
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export function Stack_toStream(self_, start_ = 0, end_ = 9007199254740991) {
|
|
373
|
+
return ff_core_Array.Array_toStream(ff_core_Stack.Stack_toArray(self_, start_, end_), false)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export function Stack_reverse(self_) {
|
|
377
|
+
self_.array.reverse()
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export function Stack_sortBy(self_, body_, ff_core_Ordering_Order$S) {
|
|
381
|
+
ff_core_Stack.Stack_sortWith(self_, ((_w1, _w2) => {
|
|
382
|
+
return ff_core_Ordering_Order$S.compare_(body_(_w1), body_(_w2))
|
|
383
|
+
}))
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export function Stack_sortWith(self_, ordering_) {
|
|
387
|
+
self_.array.sort((x, y) => ff_core_Ordering.Ordering_toInt(ordering_(x, y)))
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export async function Stack_isEmpty$(self_, $task) {
|
|
391
|
+
throw new Error('Function Stack_isEmpty is missing on this target in async context.');
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export async function Stack_size$(self_, $task) {
|
|
395
|
+
throw new Error('Function Stack_size is missing on this target in async context.');
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export async function Stack_get$(self_, index_, $task) {
|
|
399
|
+
throw new Error('Function Stack_get is missing on this target in async context.');
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export async function Stack_grab$(self_, index_, $task) {
|
|
403
|
+
throw new Error('Function Stack_grab is missing on this target in async context.');
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export async function Stack_grabFirst$(self_, $task) {
|
|
407
|
+
return ff_core_Stack.Stack_grab(self_, 0)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export async function Stack_grabLast$(self_, $task) {
|
|
411
|
+
return ff_core_Stack.Stack_grab(self_, (ff_core_Stack.Stack_size(self_) - 1))
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export async function Stack_first$(self_, $task) {
|
|
415
|
+
throw new Error('Function Stack_first is missing on this target in async context.');
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export async function Stack_last$(self_, $task) {
|
|
419
|
+
throw new Error('Function Stack_last is missing on this target in async context.');
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export async function Stack_push$(self_, value_, $task) {
|
|
423
|
+
throw new Error('Function Stack_push is missing on this target in async context.');
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export async function Stack_pushAll$(self_, value_, $task) {
|
|
427
|
+
throw new Error('Function Stack_pushAll is missing on this target in async context.');
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export async function Stack_pushArray$(self_, value_, $task) {
|
|
431
|
+
throw new Error('Function Stack_pushArray is missing on this target in async context.');
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export async function Stack_pop$(self_, $task) {
|
|
435
|
+
throw new Error('Function Stack_pop is missing on this target in async context.');
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export async function Stack_set$(self_, index_, value_, $task) {
|
|
439
|
+
throw new Error('Function Stack_set is missing on this target in async context.');
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export async function Stack_modify$(self_, index_, body_, $task) {
|
|
443
|
+
|
|
444
|
+
if(index_ < 0 || index_ >= self_.array.length) {
|
|
445
|
+
ff_core_Try.internalThrowGrabException_()
|
|
446
|
+
}
|
|
447
|
+
self_.array[index_] = await body_(self_.array[index_], $task)
|
|
448
|
+
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export async function Stack_fill$(self_, value_, start_ = 0, end_ = 9007199254740991, $task) {
|
|
452
|
+
throw new Error('Function Stack_fill is missing on this target in async context.');
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export async function Stack_copy$(self_, target_, start_, end_, $task) {
|
|
456
|
+
throw new Error('Function Stack_copy is missing on this target in async context.');
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
export async function Stack_delete$(self_, start_, deleteCount_, $task) {
|
|
460
|
+
throw new Error('Function Stack_delete is missing on this target in async context.');
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export async function Stack_insert$(self_, start_, value_, deleteCount_ = 0, $task) {
|
|
464
|
+
throw new Error('Function Stack_insert is missing on this target in async context.');
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export async function Stack_insertAll$(self_, start_, value_, deleteCount_ = 0, $task) {
|
|
468
|
+
throw new Error('Function Stack_insertAll is missing on this target in async context.');
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export async function Stack_insertArray$(self_, start_, value_, deleteCount_ = 0, $task) {
|
|
472
|
+
throw new Error('Function Stack_insertArray is missing on this target in async context.');
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export async function Stack_each$(self_, body_, $task) {
|
|
476
|
+
|
|
477
|
+
for(let i = 0; i < self_.array.length; i++) {
|
|
478
|
+
await body_(self_.array[i], $task)
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export async function Stack_eachWhile$(self_, body_, $task) {
|
|
484
|
+
for(const value of self_.array) if(!await body_(value, $task)) break
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export async function Stack_all$(self_, body_, $task) {
|
|
488
|
+
let result_ = true;
|
|
489
|
+
(await ff_core_Stack.Stack_eachWhile$(self_, (async (x_, $task) => {
|
|
490
|
+
result_ = (await body_(x_, $task));
|
|
491
|
+
return result_
|
|
492
|
+
}), $task));
|
|
493
|
+
return result_
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export async function Stack_any$(self_, body_, $task) {
|
|
497
|
+
let result_ = false;
|
|
498
|
+
(await ff_core_Stack.Stack_eachWhile$(self_, (async (x_, $task) => {
|
|
499
|
+
result_ = (await body_(x_, $task));
|
|
500
|
+
return (!result_)
|
|
501
|
+
}), $task));
|
|
502
|
+
return result_
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export async function Stack_indexWhere$(self_, body_, $task) {
|
|
506
|
+
let i_ = (-1);
|
|
507
|
+
let result_ = false;
|
|
508
|
+
(await ff_core_Stack.Stack_eachWhile$(self_, (async (x_, $task) => {
|
|
509
|
+
i_ += 1;
|
|
510
|
+
result_ = (await body_(x_, $task));
|
|
511
|
+
return (!result_)
|
|
512
|
+
}), $task));
|
|
513
|
+
if(result_) {
|
|
514
|
+
return ff_core_Option.Some(i_)
|
|
515
|
+
} else return ff_core_Option.None()
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export async function Stack_drain$(self_, $task) {
|
|
519
|
+
throw new Error('Function Stack_drain is missing on this target in async context.');
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export async function Stack_toArray$(self_, start_ = 0, end_ = 9007199254740991, $task) {
|
|
523
|
+
throw new Error('Function Stack_toArray is missing on this target in async context.');
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
export async function Stack_toList$(self_, start_ = 0, end_ = 9007199254740991, $task) {
|
|
527
|
+
throw new Error('Function Stack_toList is missing on this target in async context.');
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export async function Stack_toStream$(self_, start_ = 0, end_ = 9007199254740991, $task) {
|
|
531
|
+
return (await ff_core_Array.Array_toStream$(ff_core_Stack.Stack_toArray(self_, start_, end_), false, $task))
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export async function Stack_reverse$(self_, $task) {
|
|
535
|
+
throw new Error('Function Stack_reverse is missing on this target in async context.');
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export async function Stack_sortBy$(self_, body_, ff_core_Ordering_Order$S, $task) {
|
|
539
|
+
(await ff_core_Stack.Stack_sortWith$(self_, (async (_w1, _w2, $task) => {
|
|
540
|
+
return ff_core_Ordering_Order$S.compare_((await body_(_w1, $task)), (await body_(_w2, $task)))
|
|
541
|
+
}), $task))
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export async function Stack_sortWith$(self_, ordering_, $task) {
|
|
545
|
+
throw new Error('Function Stack_sortWith is missing on this target in async context.');
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export function Stack_sort(self_, ff_core_Ordering_Order$T) {
|
|
549
|
+
ff_core_Stack.Stack_sortWith(self_, ((x_, y_) => {
|
|
550
|
+
return ff_core_Ordering_Order$T.compare_(x_, y_)
|
|
551
|
+
}))
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export async function Stack_sort$(self_, ff_core_Ordering_Order$T, $task) {
|
|
555
|
+
ff_core_Stack.Stack_sortWith(self_, ((x_, y_) => {
|
|
556
|
+
return ff_core_Ordering_Order$T.compare_(x_, y_)
|
|
557
|
+
}))
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export function Stack_join(self_, separator_ = "") {
|
|
561
|
+
return self_.array.join(separator_)
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export async function Stack_join$(self_, separator_ = "", $task) {
|
|
565
|
+
throw new Error('Function Stack_join is missing on this target in async context.');
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export function ff_core_Show_Show$ff_core_Stack_Stack(ff_core_Show_Show$T) { return {
|
|
569
|
+
show_(value_) {
|
|
570
|
+
const stack_ = ff_core_Stack.make_();
|
|
571
|
+
ff_core_Stack.Stack_push(stack_, "[");
|
|
572
|
+
ff_core_Stack.Stack_each(value_, ((x_) => {
|
|
573
|
+
if((ff_core_Stack.Stack_size(stack_) > 1)) {
|
|
574
|
+
ff_core_Stack.Stack_push(stack_, ", ")
|
|
575
|
+
};
|
|
576
|
+
ff_core_Stack.Stack_push(stack_, ff_core_Show_Show$T.show_(x_))
|
|
577
|
+
}));
|
|
578
|
+
ff_core_Stack.Stack_push(stack_, "].toStack()");
|
|
579
|
+
return ff_core_Stack.Stack_join(stack_, "")
|
|
580
|
+
},
|
|
581
|
+
async show_$(value_, $task) {
|
|
582
|
+
const stack_ = ff_core_Stack.make_();
|
|
583
|
+
ff_core_Stack.Stack_push(stack_, "[");
|
|
584
|
+
ff_core_Stack.Stack_each(value_, ((x_) => {
|
|
585
|
+
if((ff_core_Stack.Stack_size(stack_) > 1)) {
|
|
586
|
+
ff_core_Stack.Stack_push(stack_, ", ")
|
|
587
|
+
};
|
|
588
|
+
ff_core_Stack.Stack_push(stack_, ff_core_Show_Show$T.show_(x_))
|
|
589
|
+
}));
|
|
590
|
+
ff_core_Stack.Stack_push(stack_, "].toStack()");
|
|
591
|
+
return ff_core_Stack.Stack_join(stack_, "")
|
|
592
|
+
}
|
|
593
|
+
}}
|
|
594
|
+
|
|
595
|
+
|