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.
Files changed (221) hide show
  1. package/.firefly-workspace +1 -0
  2. package/.vscode/settings.json +5 -0
  3. package/LICENSE.txt +21 -0
  4. package/README.md +96 -0
  5. package/bin/firefly.mjs +2 -0
  6. package/compiler/.firefly/package.ff +1 -0
  7. package/compiler/Builder.ff +218 -0
  8. package/compiler/Compiler.ff +241 -0
  9. package/compiler/Dependencies.ff +179 -0
  10. package/compiler/Deriver.ff +647 -0
  11. package/compiler/Dictionaries.ff +205 -0
  12. package/compiler/Environment.ff +166 -0
  13. package/compiler/Inference.ff +1117 -0
  14. package/compiler/JsEmitter.ff +861 -0
  15. package/compiler/JsImporter.ff +56 -0
  16. package/compiler/LspHook.ff +188 -0
  17. package/compiler/Main.ff +237 -0
  18. package/compiler/Parser.ff +1383 -0
  19. package/compiler/Patterns.ff +111 -0
  20. package/compiler/Resolver.ff +620 -0
  21. package/compiler/Substitution.ff +178 -0
  22. package/compiler/Syntax.ff +299 -0
  23. package/compiler/Token.ff +180 -0
  24. package/compiler/Tokenizer.ff +278 -0
  25. package/compiler/Unification.ff +220 -0
  26. package/compiler/Wildcards.ff +50 -0
  27. package/compiler/Workspace.ff +88 -0
  28. package/core/.firefly/package.ff +2 -0
  29. package/core/Any.ff +30 -0
  30. package/core/Array.ff +249 -0
  31. package/core/AssetSystem.ff +61 -0
  32. package/core/Atomic.ff +64 -0
  33. package/core/Bool.ff +13 -0
  34. package/core/BrowserSystem.ff +14 -0
  35. package/core/Buffer.ff +211 -0
  36. package/core/BuildSystem.ff +144 -0
  37. package/core/Channel.ff +131 -0
  38. package/core/Char.ff +18 -0
  39. package/core/Core.ff +58 -0
  40. package/core/Duration.ff +15 -0
  41. package/core/Equal.ff +52 -0
  42. package/core/Error.ff +20 -0
  43. package/core/FileHandle.ff +41 -0
  44. package/core/Float.ff +41 -0
  45. package/core/HttpClient.ff +84 -0
  46. package/core/Instant.ff +9 -0
  47. package/core/Int.ff +61 -0
  48. package/core/IntMap.ff +85 -0
  49. package/core/JsSystem.ff +66 -0
  50. package/core/JsValue.ff +240 -0
  51. package/core/List.ff +440 -0
  52. package/core/Lock.ff +144 -0
  53. package/core/Log.ff +24 -0
  54. package/core/Map.ff +126 -0
  55. package/core/NodeSystem.ff +88 -0
  56. package/core/Nothing.ff +1 -0
  57. package/core/Option.ff +133 -0
  58. package/core/Ordering.ff +157 -0
  59. package/core/Pair.ff +55 -0
  60. package/core/Path.ff +393 -0
  61. package/core/RbMap.ff +216 -0
  62. package/core/Serializable.ff +173 -0
  63. package/core/Set.ff +38 -0
  64. package/core/Show.ff +43 -0
  65. package/core/Stack.ff +263 -0
  66. package/core/Stream.ff +406 -0
  67. package/core/String.ff +175 -0
  68. package/core/StringMap.ff +85 -0
  69. package/core/Task.ff +138 -0
  70. package/core/Try.ff +81 -0
  71. package/core/Unit.ff +3 -0
  72. package/experimental/random/AltGeneric.ff +44 -0
  73. package/experimental/random/Async.ff +68 -0
  74. package/experimental/random/Buffer2.ff +77 -0
  75. package/experimental/random/Cat.ff +12 -0
  76. package/experimental/random/Dictionary.ff +52 -0
  77. package/experimental/random/Example.ff +46 -0
  78. package/experimental/random/Generic.ff +102 -0
  79. package/experimental/random/HappyEyeballs.ff +40 -0
  80. package/experimental/random/HashMap.ff +72 -0
  81. package/experimental/random/IfElseUnit.ff +9 -0
  82. package/experimental/random/InputOutput.ff +23 -0
  83. package/experimental/random/ListVsArray.ff +45 -0
  84. package/experimental/random/Main.ff +44 -0
  85. package/experimental/random/MapTest.ff +67 -0
  86. package/experimental/random/OldTaskSystem.ff +210 -0
  87. package/experimental/random/PatternTest.ff +39 -0
  88. package/experimental/random/Patterns.ff +226 -0
  89. package/experimental/random/ReadBytesTest.ff +10 -0
  90. package/experimental/random/RunLength.ff +65 -0
  91. package/experimental/random/Scrape.ff +51 -0
  92. package/experimental/random/Serialization.ff +217 -0
  93. package/experimental/random/SerializationTest.ff +46 -0
  94. package/experimental/random/Serializer.ff +36 -0
  95. package/experimental/random/StdInOutErr.ff +4 -0
  96. package/experimental/random/Symbols.ff +74 -0
  97. package/experimental/random/Tag.ff +49 -0
  98. package/experimental/random/Tensor.ff +52 -0
  99. package/experimental/random/Try.ff +56 -0
  100. package/experimental/random/Tsv.ff +9 -0
  101. package/experimental/random/TypesAreModules.ff +87 -0
  102. package/experimental/random/blueprints/Blueprint.ff +52 -0
  103. package/experimental/random/blueprints/Main.ff +11 -0
  104. package/experimental/random/blueprints/Pretty.ff +58 -0
  105. package/experimental/random/blueprints/User.ff +64 -0
  106. package/experimental/random/blueprintsystem/BlueprintSystem.ff +48 -0
  107. package/experimental/random/blueprintsystem/Deserialize.ff +53 -0
  108. package/experimental/random/blueprintsystem/ReadJs.ff +13 -0
  109. package/experimental/random/blueprintsystem/User.ff +2 -0
  110. package/experimental/random/kahrs/Kahrs.ff +112 -0
  111. package/experimental/random/kahrs/TestKahrs.ff +22 -0
  112. package/experimental/random/kahrs/TestMap.ff +18 -0
  113. package/experimental/random/streaming/Gzip.ff +3 -0
  114. package/experimental/random/streaming/Main.ff +34 -0
  115. package/experimental/random/streaming/S3Bucket.ff +11 -0
  116. package/experimental/random/streaming/Tar.ff +5 -0
  117. package/experimental/rhymeapp/Main.ff +81 -0
  118. package/experimental/rhymeapp/index.html +14 -0
  119. package/firefly.sh +5 -0
  120. package/fireflysite/Main.ff +13 -0
  121. package/httpserver/.firefly/package.ff +1 -0
  122. package/httpserver/HttpServer.ff +184 -0
  123. package/lsp/.firefly/package.ff +1 -0
  124. package/lsp/CompletionHandler.ff +814 -0
  125. package/lsp/Handler.ff +551 -0
  126. package/lsp/HoverHandler.ff +82 -0
  127. package/lsp/LanguageServer.ff +229 -0
  128. package/lsp/SignatureHelpHandler.ff +55 -0
  129. package/lsp/SymbolHandler.ff +167 -0
  130. package/output/js/ff/compiler/Builder.mjs +483 -0
  131. package/output/js/ff/compiler/Compiler.mjs +410 -0
  132. package/output/js/ff/compiler/Dependencies.mjs +388 -0
  133. package/output/js/ff/compiler/Deriver.mjs +1166 -0
  134. package/output/js/ff/compiler/Dictionaries.mjs +1305 -0
  135. package/output/js/ff/compiler/Environment.mjs +1005 -0
  136. package/output/js/ff/compiler/Inference.mjs +4264 -0
  137. package/output/js/ff/compiler/JsEmitter.mjs +5353 -0
  138. package/output/js/ff/compiler/JsImporter.mjs +262 -0
  139. package/output/js/ff/compiler/LspHook.mjs +789 -0
  140. package/output/js/ff/compiler/Main.mjs +1695 -0
  141. package/output/js/ff/compiler/Parser.mjs +4004 -0
  142. package/output/js/ff/compiler/Patterns.mjs +923 -0
  143. package/output/js/ff/compiler/Resolver.mjs +2303 -0
  144. package/output/js/ff/compiler/Substitution.mjs +1146 -0
  145. package/output/js/ff/compiler/Syntax.mjs +12430 -0
  146. package/output/js/ff/compiler/Token.mjs +3092 -0
  147. package/output/js/ff/compiler/Tokenizer.mjs +589 -0
  148. package/output/js/ff/compiler/Unification.mjs +1748 -0
  149. package/output/js/ff/compiler/Wildcards.mjs +604 -0
  150. package/output/js/ff/compiler/Workspace.mjs +683 -0
  151. package/output/js/ff/core/Any.mjs +139 -0
  152. package/output/js/ff/core/Array.mjs +594 -0
  153. package/output/js/ff/core/AssetSystem.mjs +270 -0
  154. package/output/js/ff/core/Atomic.mjs +186 -0
  155. package/output/js/ff/core/Bool.mjs +141 -0
  156. package/output/js/ff/core/BrowserSystem.mjs +122 -0
  157. package/output/js/ff/core/Buffer.mjs +467 -0
  158. package/output/js/ff/core/BuildSystem.mjs +320 -0
  159. package/output/js/ff/core/Channel.mjs +268 -0
  160. package/output/js/ff/core/Char.mjs +145 -0
  161. package/output/js/ff/core/Core.mjs +300 -0
  162. package/output/js/ff/core/Duration.mjs +112 -0
  163. package/output/js/ff/core/Equal.mjs +175 -0
  164. package/output/js/ff/core/Error.mjs +138 -0
  165. package/output/js/ff/core/FileHandle.mjs +164 -0
  166. package/output/js/ff/core/Float.mjs +214 -0
  167. package/output/js/ff/core/HttpClient.mjs +210 -0
  168. package/output/js/ff/core/Instant.mjs +105 -0
  169. package/output/js/ff/core/Int.mjs +254 -0
  170. package/output/js/ff/core/IntMap.mjs +282 -0
  171. package/output/js/ff/core/JsSystem.mjs +234 -0
  172. package/output/js/ff/core/JsValue.mjs +678 -0
  173. package/output/js/ff/core/List.mjs +2335 -0
  174. package/output/js/ff/core/Lock.mjs +322 -0
  175. package/output/js/ff/core/Log.mjs +159 -0
  176. package/output/js/ff/core/Map.mjs +358 -0
  177. package/output/js/ff/core/NodeSystem.mjs +288 -0
  178. package/output/js/ff/core/Nothing.mjs +100 -0
  179. package/output/js/ff/core/Option.mjs +1002 -0
  180. package/output/js/ff/core/Ordering.mjs +734 -0
  181. package/output/js/ff/core/Pair.mjs +318 -0
  182. package/output/js/ff/core/Path.mjs +768 -0
  183. package/output/js/ff/core/RbMap.mjs +1936 -0
  184. package/output/js/ff/core/Serializable.mjs +434 -0
  185. package/output/js/ff/core/Set.mjs +250 -0
  186. package/output/js/ff/core/Show.mjs +201 -0
  187. package/output/js/ff/core/Stack.mjs +595 -0
  188. package/output/js/ff/core/Stream.mjs +1300 -0
  189. package/output/js/ff/core/String.mjs +433 -0
  190. package/output/js/ff/core/StringMap.mjs +282 -0
  191. package/output/js/ff/core/Task.mjs +345 -0
  192. package/output/js/ff/core/Try.mjs +503 -0
  193. package/output/js/ff/core/Unit.mjs +103 -0
  194. package/package.json +29 -0
  195. package/postgresql/.firefly/include/package-lock.json +250 -0
  196. package/postgresql/.firefly/include/package.json +5 -0
  197. package/postgresql/.firefly/include/prepare.sh +2 -0
  198. package/postgresql/.firefly/package.ff +3 -0
  199. package/postgresql/Pg.ff +530 -0
  200. package/unsafejs/.firefly/package.ff +1 -0
  201. package/unsafejs/UnsafeJs.ff +19 -0
  202. package/vscode/.vscode/launch.json +18 -0
  203. package/vscode/.vscode/tasks.json +33 -0
  204. package/vscode/LICENSE.txt +21 -0
  205. package/vscode/Prepublish.ff +15 -0
  206. package/vscode/README.md +17 -0
  207. package/vscode/client/package-lock.json +544 -0
  208. package/vscode/client/package.json +22 -0
  209. package/vscode/client/src/extension.ts +64 -0
  210. package/vscode/client/tsconfig.json +12 -0
  211. package/vscode/icons/firefly-icon.png +0 -0
  212. package/vscode/icons/firefly-icon.svg +10 -0
  213. package/vscode/icons/firefly-logo-notext.png +0 -0
  214. package/vscode/icons/firefly-logo.png +0 -0
  215. package/vscode/language-configuration.json +39 -0
  216. package/vscode/package-lock.json +3623 -0
  217. package/vscode/package.json +144 -0
  218. package/vscode/snippets-none.json +1 -0
  219. package/vscode/snippets.json +241 -0
  220. package/vscode/syntaxes/firefly.tmLanguage.json +294 -0
  221. package/vscode/tsconfig.json +20 -0
@@ -0,0 +1,4004 @@
1
+
2
+
3
+ import * as ff_compiler_Parser from "../../ff/compiler/Parser.mjs"
4
+
5
+ import * as ff_compiler_LspHook from "../../ff/compiler/LspHook.mjs"
6
+
7
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
8
+
9
+ import * as ff_compiler_Token from "../../ff/compiler/Token.mjs"
10
+
11
+ import * as ff_compiler_Wildcards from "../../ff/compiler/Wildcards.mjs"
12
+
13
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
14
+
15
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
16
+
17
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
18
+
19
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
20
+
21
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
22
+
23
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
24
+
25
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
26
+
27
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
28
+
29
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
30
+
31
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
32
+
33
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
34
+
35
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
36
+
37
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
38
+
39
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
40
+
41
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
42
+
43
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
44
+
45
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
46
+
47
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
48
+
49
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
50
+
51
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
52
+
53
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
54
+
55
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
56
+
57
+ import * as ff_core_List from "../../ff/core/List.mjs"
58
+
59
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
60
+
61
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
62
+
63
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
64
+
65
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
66
+
67
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
68
+
69
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
70
+
71
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
72
+
73
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
74
+
75
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
76
+
77
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
78
+
79
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
80
+
81
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
82
+
83
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
84
+
85
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
86
+
87
+ import * as ff_core_String from "../../ff/core/String.mjs"
88
+
89
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
90
+
91
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
92
+
93
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
94
+
95
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
96
+
97
+ // type Parser
98
+ export function Parser(packagePair_, file_, tokens_, end_, targetIsNode_, lspHook_, lspEmittedArgumentHook_, offset_, nextUnificationVariableIndex_) {
99
+ return {packagePair_, file_, tokens_, end_, targetIsNode_, lspHook_, lspEmittedArgumentHook_, offset_, nextUnificationVariableIndex_};
100
+ }
101
+
102
+ // type Poly
103
+ export function Poly(generics_, constraints_) {
104
+ return {generics_, constraints_};
105
+ }
106
+
107
+ // type ParsedTargets
108
+ export function ParsedTargets(js_, jsSync_, jsAsync_, browser_, browserSync_, browserAsync_, node_, nodeSync_, nodeAsync_) {
109
+ return {js_, jsSync_, jsAsync_, browser_, browserSync_, browserAsync_, node_, nodeSync_, nodeAsync_};
110
+ }
111
+
112
+ export const binaryOperators_ = ff_core_List.List_toArray(ff_core_List.Link(ff_core_List.Link("||", ff_core_List.Empty()), ff_core_List.Link(ff_core_List.Link("&&", ff_core_List.Empty()), ff_core_List.Link(ff_core_List.Link("!=", ff_core_List.Link("==", ff_core_List.Empty())), ff_core_List.Link(ff_core_List.Link("<=", ff_core_List.Link(">=", ff_core_List.Link("<", ff_core_List.Link(">", ff_core_List.Empty())))), ff_core_List.Link(ff_core_List.Link("+", ff_core_List.Link("-", ff_core_List.Empty())), ff_core_List.Link(ff_core_List.Link("*", ff_core_List.Link("/", ff_core_List.Link("%", ff_core_List.Empty()))), ff_core_List.Link(ff_core_List.Link("^", ff_core_List.Empty()), ff_core_List.Empty()))))))));
113
+
114
+ export function make_(packagePair_, file_, tokens_, targetIsNode_, lspHook_) {
115
+ return ff_compiler_Parser.Parser(packagePair_, file_, tokens_, ff_core_Array.Array_grabLast(tokens_), targetIsNode_, lspHook_, false, 0, 1)
116
+ }
117
+
118
+ export function findBestTarget_(targetIsNode_, body_, targets_) {
119
+ const foreignTarget_ = (targetIsNode_
120
+ ? (function() {
121
+ const sync_ = ff_core_Option.Option_orElse(targets_.nodeSync_, (() => {
122
+ return targets_.jsSync_
123
+ }));
124
+ const async_ = ff_core_Option.Option_orElse(targets_.nodeAsync_, (() => {
125
+ return targets_.jsAsync_
126
+ }));
127
+ return ff_compiler_Syntax.ForeignTarget(sync_, async_)
128
+ })()
129
+ : (function() {
130
+ const sync_ = ff_core_Option.Option_orElse(targets_.browserSync_, (() => {
131
+ return targets_.jsSync_
132
+ }));
133
+ const async_ = ff_core_Option.Option_orElse(targets_.browserAsync_, (() => {
134
+ return targets_.jsAsync_
135
+ }));
136
+ return ff_compiler_Syntax.ForeignTarget(sync_, async_)
137
+ })());
138
+ {
139
+ const _1 = foreignTarget_;
140
+ {
141
+ if(_1.ForeignTarget) {
142
+ if(_1.syncCode_.None) {
143
+ if(_1.asyncCode_.None) {
144
+ const _guard1 = targetIsNode_;
145
+ if(_guard1) {
146
+ return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_orElse(targets_.node_, (() => {
147
+ return ff_core_Option.Option_orElse(targets_.js_, (() => {
148
+ return body_
149
+ }))
150
+ })), ((_w1) => {
151
+ return ff_compiler_Syntax.FireflyTarget(_w1)
152
+ })), (() => {
153
+ return foreignTarget_
154
+ }))
155
+ return
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
161
+ {
162
+ if(_1.ForeignTarget) {
163
+ if(_1.syncCode_.None) {
164
+ if(_1.asyncCode_.None) {
165
+ const _guard1 = (!targetIsNode_);
166
+ if(_guard1) {
167
+ return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_orElse(targets_.browser_, (() => {
168
+ return ff_core_Option.Option_orElse(targets_.js_, (() => {
169
+ return body_
170
+ }))
171
+ })), ((_w1) => {
172
+ return ff_compiler_Syntax.FireflyTarget(_w1)
173
+ })), (() => {
174
+ return foreignTarget_
175
+ }))
176
+ return
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ {
183
+ return foreignTarget_
184
+ return
185
+ }
186
+ }
187
+ }
188
+
189
+ export async function make_$(packagePair_, file_, tokens_, targetIsNode_, lspHook_, $task) {
190
+ return ff_compiler_Parser.Parser(packagePair_, file_, tokens_, ff_core_Array.Array_grabLast(tokens_), targetIsNode_, lspHook_, false, 0, 1)
191
+ }
192
+
193
+ export async function findBestTarget_$(targetIsNode_, body_, targets_, $task) {
194
+ const foreignTarget_ = (targetIsNode_
195
+ ? (await (async function() {
196
+ const sync_ = ff_core_Option.Option_orElse(targets_.nodeSync_, (() => {
197
+ return targets_.jsSync_
198
+ }));
199
+ const async_ = ff_core_Option.Option_orElse(targets_.nodeAsync_, (() => {
200
+ return targets_.jsAsync_
201
+ }));
202
+ return ff_compiler_Syntax.ForeignTarget(sync_, async_)
203
+ })())
204
+ : (await (async function() {
205
+ const sync_ = ff_core_Option.Option_orElse(targets_.browserSync_, (() => {
206
+ return targets_.jsSync_
207
+ }));
208
+ const async_ = ff_core_Option.Option_orElse(targets_.browserAsync_, (() => {
209
+ return targets_.jsAsync_
210
+ }));
211
+ return ff_compiler_Syntax.ForeignTarget(sync_, async_)
212
+ })()));
213
+ {
214
+ const _1 = foreignTarget_;
215
+ {
216
+ if(_1.ForeignTarget) {
217
+ if(_1.syncCode_.None) {
218
+ if(_1.asyncCode_.None) {
219
+ const _guard1 = targetIsNode_;
220
+ if(_guard1) {
221
+ return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_orElse(targets_.node_, (() => {
222
+ return ff_core_Option.Option_orElse(targets_.js_, (() => {
223
+ return body_
224
+ }))
225
+ })), ((_w1) => {
226
+ return ff_compiler_Syntax.FireflyTarget(_w1)
227
+ })), (() => {
228
+ return foreignTarget_
229
+ }))
230
+ return
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+ {
237
+ if(_1.ForeignTarget) {
238
+ if(_1.syncCode_.None) {
239
+ if(_1.asyncCode_.None) {
240
+ const _guard1 = (!targetIsNode_);
241
+ if(_guard1) {
242
+ return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_orElse(targets_.browser_, (() => {
243
+ return ff_core_Option.Option_orElse(targets_.js_, (() => {
244
+ return body_
245
+ }))
246
+ })), ((_w1) => {
247
+ return ff_compiler_Syntax.FireflyTarget(_w1)
248
+ })), (() => {
249
+ return foreignTarget_
250
+ }))
251
+ return
252
+ }
253
+ }
254
+ }
255
+ }
256
+ }
257
+ {
258
+ return foreignTarget_
259
+ return
260
+ }
261
+ }
262
+ }
263
+
264
+ export function Parser_fail(self_, at_, message_) {
265
+ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(at_)))
266
+ }
267
+
268
+ export function Parser_behind(self_) {
269
+ if((self_.offset_ === 0)) {
270
+ return ff_compiler_Parser.Parser_current(self_)
271
+ } else {
272
+ if(((self_.offset_ - 1) < ff_core_Array.Array_size(self_.tokens_))) {
273
+ return ff_core_Array.Array_grab(self_.tokens_, (self_.offset_ - 1))
274
+ } else {
275
+ return self_.end_
276
+ }
277
+ }
278
+ }
279
+
280
+ export function Parser_current(self_) {
281
+ if((self_.offset_ < ff_core_Array.Array_size(self_.tokens_))) {
282
+ return ff_core_Array.Array_grab(self_.tokens_, self_.offset_)
283
+ } else {
284
+ return self_.end_
285
+ }
286
+ }
287
+
288
+ export function Parser_ahead(self_) {
289
+ if(((self_.offset_ + 1) < ff_core_Array.Array_size(self_.tokens_))) {
290
+ return ff_core_Array.Array_grab(self_.tokens_, (self_.offset_ + 1))
291
+ } else {
292
+ return self_.end_
293
+ }
294
+ }
295
+
296
+ export function Parser_aheadAhead(self_) {
297
+ if(((self_.offset_ + 2) < ff_core_Array.Array_size(self_.tokens_))) {
298
+ return ff_core_Array.Array_grab(self_.tokens_, (self_.offset_ + 2))
299
+ } else {
300
+ return self_.end_
301
+ }
302
+ }
303
+
304
+ export function Parser_skip(self_, kind_) {
305
+ const c_ = ff_compiler_Parser.Parser_current(self_);
306
+ if(ff_core_Equal.notEquals_(c_.kind_, kind_, ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind)) {
307
+ if(((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(kind_, ff_compiler_Token.LUpper())) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(c_.kind_, ff_compiler_Token.LLower()))) {
308
+
309
+ } else {
310
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(c_), ((("Expected " + ff_compiler_Token.ff_core_Show_Show$ff_compiler_Token_TokenKind.show_(kind_)) + ", got ") + ff_compiler_Token.Token_raw(c_))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
311
+ }
312
+ };
313
+ self_.offset_ += 1;
314
+ return c_
315
+ }
316
+
317
+ export function Parser_rawSkip(self_, kind_, value_) {
318
+ const c_ = ff_compiler_Parser.Parser_current(self_);
319
+ if(ff_core_Equal.notEquals_(c_.kind_, kind_, ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind)) {
320
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (((value_ === ")") || (value_ === "]")) || (value_ === "}")))) {
321
+
322
+ } else {
323
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(c_), ((((("Expected " + ff_compiler_Token.ff_core_Show_Show$ff_compiler_Token_TokenKind.show_(kind_)) + " ") + value_) + ", got ") + ff_compiler_Token.Token_raw(c_))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
324
+ }
325
+ };
326
+ if((!ff_compiler_Token.Token_rawIs(c_, value_))) {
327
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (((value_ === ")") || (value_ === "]")) || (value_ === "}")))) {
328
+ self_.offset_ -= 1
329
+ } else {
330
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(c_), ((("Expected " + value_) + " got ") + ff_compiler_Token.Token_raw(c_))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
331
+ }
332
+ };
333
+ self_.offset_ += 1;
334
+ return c_
335
+ }
336
+
337
+ export function Parser_freshUnificationVariable(self_, at_) {
338
+ const result_ = ff_compiler_Syntax.TVariable(at_, self_.nextUnificationVariableIndex_);
339
+ self_.nextUnificationVariableIndex_ += 3;
340
+ return result_
341
+ }
342
+
343
+ export function Parser_currentIsSeparator(self_, kind_) {
344
+ return (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), kind_) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LSeparator()))
345
+ }
346
+
347
+ export function Parser_skipSeparator(self_, kind_) {
348
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LSeparator())) {
349
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LSeparator())
350
+ } else {
351
+ return ff_compiler_Parser.Parser_skip(self_, kind_)
352
+ }
353
+ }
354
+
355
+ export function Parser_parseModuleWithoutPackageInfo(self_) {
356
+ const moduleWithPackageInfo_ = ff_compiler_Parser.Parser_parseModuleWithPackageInfo(self_);
357
+ ff_core_Option.Option_each(moduleWithPackageInfo_.packageInfo_, ((info_) => {
358
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(info_.package_.at_, "Package and dependencies already declared in package.ff"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
359
+ }));
360
+ return moduleWithPackageInfo_.module_
361
+ }
362
+
363
+ export function Parser_parseModuleWithPackageInfo(self_) {
364
+ const packageInfo_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs3(ff_compiler_Parser.Parser_current(self_), "package", "dependency", "include"))
365
+ ? ff_core_Option.Some(ff_compiler_Parser.Parser_parsePackageInfo(self_))
366
+ : ff_core_Option.None());
367
+ const module_ = ff_compiler_Parser.Parser_parseModule(self_);
368
+ return ff_compiler_Syntax.ModuleWithPackageInfo(packageInfo_, module_)
369
+ }
370
+
371
+ export function Parser_parsePackageInfo(self_) {
372
+ const location_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
373
+ const package_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "package"))
374
+ ? (function() {
375
+ const p_ = ff_compiler_Parser.Parser_parsePackageDefinition(self_);
376
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
377
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
378
+ };
379
+ return p_
380
+ })()
381
+ : ff_compiler_Syntax.DPackage(location_, self_.packagePair_, ff_compiler_Syntax.Version(location_, 0, 0, 0), ff_compiler_Syntax.TargetNames(self_.targetIsNode_, (!self_.targetIsNode_))));
382
+ if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "package"))) {
383
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Duplicate package definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
384
+ };
385
+ const dependencies_ = ff_core_Stack.make_();
386
+ while((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "dependency"))) {
387
+ ff_core_Stack.Stack_push(dependencies_, ff_compiler_Parser.Parser_parseDependencyDefinition(self_, package_.targets_));
388
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
389
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
390
+ }
391
+ };
392
+ const includes_ = ff_core_Stack.make_();
393
+ while((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "include"))) {
394
+ ff_core_Stack.Stack_push(includes_, ff_compiler_Parser.Parser_parseIncludeDefinition(self_));
395
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
396
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
397
+ }
398
+ };
399
+ return ff_compiler_Syntax.PackageInfo(package_, ff_core_Stack.Stack_toList(dependencies_, 0, 9007199254740991), ff_core_Stack.Stack_toList(includes_, 0, 9007199254740991))
400
+ }
401
+
402
+ export function Parser_parseModule(self_) {
403
+ const imports_ = ff_core_Stack.make_();
404
+ const types_ = ff_core_Stack.make_();
405
+ const traits_ = ff_core_Stack.make_();
406
+ const instances_ = ff_core_Stack.make_();
407
+ const extends_ = ff_core_Stack.make_();
408
+ const lets_ = ff_core_Stack.make_();
409
+ const functions_ = ff_core_Stack.make_();
410
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
411
+ if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower()) && (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LAssign()) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LColon())))) {
412
+ ff_core_Stack.Stack_push(lets_, ff_compiler_Parser.Parser_parseLetDefinition(self_))
413
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
414
+ ff_core_Stack.Stack_push(functions_, ff_compiler_Parser.Parser_parseFunctionDefinition(self_, false))
415
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "extend"))) {
416
+ ff_core_Stack.Stack_push(extends_, ff_compiler_Parser.Parser_parseExtendDefinition(self_))
417
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "trait"))) {
418
+ ff_core_Stack.Stack_push(traits_, ff_compiler_Parser.Parser_parseTraitDefinition(self_))
419
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "instance"))) {
420
+ ff_core_Stack.Stack_push(instances_, ff_compiler_Parser.Parser_parseInstanceDefinition(self_))
421
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs4(ff_compiler_Parser.Parser_current(self_), "data", "class", "capability", "newtype"))) {
422
+ ff_core_Stack.Stack_push(types_, ff_compiler_Parser.Parser_parseTypeDefinition(self_))
423
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "import"))) {
424
+ ff_core_Stack.Stack_push(imports_, ff_compiler_Parser.Parser_parseImportDefinition(self_, self_.packagePair_))
425
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "include"))) {
426
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Includes must be at the top of the file or below 'package'"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
427
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "dependency"))) {
428
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Dependencies must be at the top of the file or below 'package'"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
429
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "package"))) {
430
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Package definition must be at the top of the file"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
431
+ } else {
432
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LEnd())
433
+ };
434
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
435
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
436
+ }
437
+ };
438
+ return ff_compiler_Syntax.Module(self_.file_, self_.packagePair_, ff_core_Stack.Stack_toList(imports_, 0, 9007199254740991), ff_core_Stack.Stack_toList(types_, 0, 9007199254740991), ff_core_Stack.Stack_toList(traits_, 0, 9007199254740991), ff_core_Stack.Stack_toList(instances_, 0, 9007199254740991), ff_core_Stack.Stack_toList(extends_, 0, 9007199254740991), ff_core_Stack.Stack_toList(lets_, 0, 9007199254740991), ff_core_Stack.Stack_toList(functions_, 0, 9007199254740991))
439
+ }
440
+
441
+ export function Parser_parseLetDefinition(self_) {
442
+ if(self_.lspHook_.trackSymbols_) {
443
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
444
+ };
445
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
446
+ const variableType_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())
447
+ ? (function() {
448
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
449
+ return ff_compiler_Parser.Parser_parseType(self_)
450
+ })()
451
+ : ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(nameToken_)));
452
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
453
+ const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
454
+ const retult_ = ff_compiler_Syntax.DLet(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), variableType_, value_);
455
+ if(self_.lspHook_.trackSymbols_) {
456
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), 14, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
457
+ };
458
+ return retult_
459
+ }
460
+
461
+ export function Parser_parseFunctionDefinition(self_, member_) {
462
+ if(self_.lspHook_.trackSymbols_) {
463
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
464
+ };
465
+ const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, member_);
466
+ const body_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")
467
+ ? ff_core_Option.Some(ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), false, false))
468
+ : ff_core_Option.None());
469
+ const targets_ = ff_compiler_Parser.Parser_parseTargets(self_, ff_core_List.List_size(signature_.parameters_));
470
+ const bestTarget_ = ff_compiler_Parser.findBestTarget_(self_.targetIsNode_, body_, targets_);
471
+ const result_ = ff_compiler_Syntax.DFunction(signature_.at_, signature_, bestTarget_);
472
+ if(self_.lspHook_.trackSymbols_) {
473
+ const kind_ = (member_
474
+ ? 6
475
+ : 12);
476
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(signature_.name_, kind_, signature_.at_, (((_c) => {
477
+ return ff_compiler_Syntax.Location(_c.file_, _c.line_, (signature_.at_.column_ + ff_core_String.String_size(signature_.name_)))
478
+ }))(signature_.at_), signature_.at_, ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
479
+ };
480
+ return result_
481
+ }
482
+
483
+ export function Parser_parseTargets(self_, parameterCount_) {
484
+ function processCode_(code_) {
485
+ const dropCount_ = (ff_core_String.String_startsWith(code_, "\"\"\"", 0)
486
+ ? 3
487
+ : 1);
488
+ return ff_core_String.String_replace(ff_core_String.String_replace(ff_core_String.String_replace(ff_core_String.String_replace(ff_core_String.String_replace(ff_core_String.String_dropLast(ff_core_String.String_dropFirst(code_, dropCount_), dropCount_), "\\\"", "\""), "\\r", "\r"), "\\n", "\n"), "\\t", "\t"), "\\\\", "\\")
489
+ }
490
+ let targets_ = ff_compiler_Parser.ParsedTargets(ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None());
491
+ while(((ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon()) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LKeyword())) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_ahead(self_), "target"))) {
492
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LSeparator());
493
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
494
+ const target_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
495
+ ? ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()))
496
+ : ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword())));
497
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
498
+ const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, parameterCount_, false, false);
499
+ do {
500
+ const _1 = target_;
501
+ {
502
+ if(_1 == "js") {
503
+ if(ff_core_Equal.notEquals_(targets_.jsSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
504
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
505
+ };
506
+ targets_ = (((_c) => {
507
+ return ff_compiler_Parser.ParsedTargets(ff_core_Option.Some(lambda_), _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
508
+ }))(targets_)
509
+ break
510
+ }
511
+ }
512
+ {
513
+ if(_1 == "browser") {
514
+ if(ff_core_Equal.notEquals_(targets_.browserSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
515
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
516
+ };
517
+ targets_ = (((_c) => {
518
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, ff_core_Option.Some(lambda_), _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
519
+ }))(targets_)
520
+ break
521
+ }
522
+ }
523
+ {
524
+ if(_1 == "node") {
525
+ if(ff_core_Equal.notEquals_(targets_.nodeAsync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
526
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
527
+ };
528
+ targets_ = (((_c) => {
529
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, ff_core_Option.Some(lambda_), _c.nodeSync_, _c.nodeAsync_)
530
+ }))(targets_)
531
+ break
532
+ }
533
+ }
534
+ {
535
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Unknown target"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
536
+ break
537
+ }
538
+ } while(false)
539
+ } else {
540
+ const mode_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
541
+ const code_ = processCode_(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString())));
542
+ do {
543
+ const _1 = ff_core_Pair.Pair(target_, mode_);
544
+ {
545
+ if(_1.first_ == "js") {
546
+ if(_1.second_ == "sync") {
547
+ if(ff_core_Equal.notEquals_(targets_.jsSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
548
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
549
+ };
550
+ targets_ = (((_c) => {
551
+ return ff_compiler_Parser.ParsedTargets(_c.js_, ff_core_Option.Some(code_), _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
552
+ }))(targets_)
553
+ break
554
+ }
555
+ }
556
+ }
557
+ {
558
+ if(_1.first_ == "js") {
559
+ if(_1.second_ == "async") {
560
+ if(ff_core_Equal.notEquals_(targets_.jsAsync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
561
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
562
+ };
563
+ targets_ = (((_c) => {
564
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, ff_core_Option.Some(code_), _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
565
+ }))(targets_)
566
+ break
567
+ }
568
+ }
569
+ }
570
+ {
571
+ if(_1.first_ == "browser") {
572
+ if(_1.second_ == "sync") {
573
+ if(ff_core_Equal.notEquals_(targets_.browserSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
574
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
575
+ };
576
+ targets_ = (((_c) => {
577
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, ff_core_Option.Some(code_), _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
578
+ }))(targets_)
579
+ break
580
+ }
581
+ }
582
+ }
583
+ {
584
+ if(_1.first_ == "browser") {
585
+ if(_1.second_ == "async") {
586
+ if(ff_core_Equal.notEquals_(targets_.browserAsync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
587
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
588
+ };
589
+ targets_ = (((_c) => {
590
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, ff_core_Option.Some(code_), _c.node_, _c.nodeSync_, _c.nodeAsync_)
591
+ }))(targets_)
592
+ break
593
+ }
594
+ }
595
+ }
596
+ {
597
+ if(_1.first_ == "node") {
598
+ if(_1.second_ == "sync") {
599
+ if(ff_core_Equal.notEquals_(targets_.nodeSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
600
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
601
+ };
602
+ targets_ = (((_c) => {
603
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, ff_core_Option.Some(code_), _c.nodeAsync_)
604
+ }))(targets_)
605
+ break
606
+ }
607
+ }
608
+ }
609
+ {
610
+ if(_1.first_ == "node") {
611
+ if(_1.second_ == "async") {
612
+ if(ff_core_Equal.notEquals_(targets_.nodeAsync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
613
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
614
+ };
615
+ targets_ = (((_c) => {
616
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, ff_core_Option.Some(code_))
617
+ }))(targets_)
618
+ break
619
+ }
620
+ }
621
+ }
622
+ {
623
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Unknown target or mode"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
624
+ break
625
+ }
626
+ } while(false)
627
+ }
628
+ };
629
+ return targets_
630
+ }
631
+
632
+ export function Parser_parseSignature(self_, member_) {
633
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
634
+ const poly_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")
635
+ ? ff_compiler_Parser.Parser_parseTypeParameters(self_)
636
+ : ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty()));
637
+ const parameters_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")))
638
+ ? ff_core_List.Empty()
639
+ : ff_compiler_Parser.Parser_parseFunctionParameters(self_, false));
640
+ const returnType_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())
641
+ ? (function() {
642
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
643
+ return ff_compiler_Parser.Parser_parseType(self_)
644
+ })()
645
+ : ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "ff:core/Unit.Unit", ff_core_List.Empty()));
646
+ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(nameToken_), "TemporaryEffect$", ff_core_List.Empty());
647
+ return ff_compiler_Syntax.Signature(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), member_, poly_.generics_, poly_.constraints_, parameters_, returnType_, temporaryEffect_)
648
+ }
649
+
650
+ export function Parser_parseExtendDefinition(self_) {
651
+ if(self_.lspHook_.trackSymbols_) {
652
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
653
+ };
654
+ const extendToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "extend");
655
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
656
+ const poly_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")
657
+ ? ff_compiler_Parser.Parser_parseTypeParameters(self_)
658
+ : ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty()));
659
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
660
+ const type_ = ff_compiler_Parser.Parser_parseType(self_);
661
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
662
+ const methods_ = ff_core_Stack.make_();
663
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
664
+ ff_core_Stack.Stack_push(methods_, ff_compiler_Parser.Parser_parseFunctionDefinition(self_, true));
665
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
666
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
667
+ }
668
+ };
669
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
670
+ if(self_.lspHook_.trackSymbols_) {
671
+ let name_ = ff_compiler_Syntax.Type_show(type_, ff_core_List.Empty());
672
+ ff_core_List.List_each(ff_core_List.List_zip(poly_.generics_, poly_.constraints_), ((_1) => {
673
+ {
674
+ const generic_ = _1.first_;
675
+ const constraint_ = _1.second_;
676
+ name_ = ff_core_String.String_replace(name_, (("[" + generic_) + "]"), (((("[" + generic_) + ": ") + constraint_.name_) + "]"));
677
+ name_ = ff_core_String.String_replace(name_, (("[" + generic_) + ","), (((("[" + generic_) + ": ") + constraint_.name_) + ","));
678
+ name_ = ff_core_String.String_replace(name_, ((", " + generic_) + ","), ((((", " + generic_) + ": ") + constraint_.name_) + ","));
679
+ name_ = ff_core_String.String_replace(name_, ((", " + generic_) + "]"), ((((", " + generic_) + ": ") + constraint_.name_) + "]"))
680
+ return
681
+ }
682
+ }));
683
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(name_, 3, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(extendToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
684
+ };
685
+ return ff_compiler_Syntax.DExtend(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), poly_.generics_, poly_.constraints_, type_, ff_core_Stack.Stack_toList(methods_, 0, 9007199254740991))
686
+ }
687
+
688
+ export function Parser_parseTraitDefinition(self_) {
689
+ if(self_.lspHook_.trackSymbols_) {
690
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
691
+ };
692
+ const traitToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "trait");
693
+ const typeParameterToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
694
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
695
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
696
+ const poly_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
697
+ ? ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty())
698
+ : ff_compiler_Parser.Parser_parseTypeParameters(self_));
699
+ const constraints_ = ff_core_Stack.make_();
700
+ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())) {
701
+ ff_compiler_Parser.Parser_fail(self_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Trait constraints is not yet implemented");
702
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
703
+ const constraint_ = ff_compiler_Parser.Parser_parseConstraint(self_);
704
+ ff_core_Stack.Stack_push(constraints_, (((_c) => {
705
+ return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.Link(ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(typeParameterToken_), ff_compiler_Token.Token_raw(typeParameterToken_), ff_core_List.Empty()), constraint_.generics_))
706
+ }))(constraint_))
707
+ };
708
+ const generatorParameters_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "("))
709
+ ? ff_core_List.Empty()
710
+ : ff_compiler_Parser.Parser_parseFunctionParameters(self_, false));
711
+ const methodGenerators_ = ff_core_Stack.make_();
712
+ const methodDefaults_ = ff_core_Stack.make_();
713
+ const methodSignatures_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{"))
714
+ ? ff_core_List.Empty()
715
+ : (function() {
716
+ const signatures_ = ff_core_Stack.make_();
717
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
718
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
719
+ if(self_.lspHook_.trackSymbols_) {
720
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
721
+ };
722
+ const signatureNameToken_ = ff_compiler_Parser.Parser_current(self_);
723
+ const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, true);
724
+ if(self_.lspHook_.trackSymbols_) {
725
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(signatureNameToken_), 12, ff_compiler_Token.Token_at(signatureNameToken_), ff_compiler_Token.Token_end(signatureNameToken_), ff_compiler_Token.Token_at(signatureNameToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
726
+ };
727
+ ff_core_Stack.Stack_push(signatures_, signature_);
728
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
729
+ const generator_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_ahead(self_), "generate"));
730
+ const body_ = ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), true, false);
731
+ if(generator_) {
732
+ ff_core_Stack.Stack_push(methodGenerators_, ff_core_Pair.Pair(signature_.name_, body_))
733
+ } else {
734
+ ff_core_Stack.Stack_push(methodDefaults_, ff_core_Pair.Pair(signature_.name_, body_))
735
+ }
736
+ };
737
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
738
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
739
+ }
740
+ };
741
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
742
+ return ff_core_Stack.Stack_toList(signatures_, 0, 9007199254740991)
743
+ })());
744
+ if(self_.lspHook_.trackSymbols_) {
745
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), 11, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(traitToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
746
+ };
747
+ return ff_compiler_Syntax.DTrait(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), ff_core_List.Link(ff_compiler_Token.Token_raw(typeParameterToken_), poly_.generics_), ff_core_List.List_addAll(ff_core_Stack.Stack_toList(constraints_, 0, 9007199254740991), poly_.constraints_), generatorParameters_, methodSignatures_, ff_core_Stack.Stack_toList(methodDefaults_, 0, 9007199254740991), ff_core_Stack.Stack_toList(methodGenerators_, 0, 9007199254740991))
748
+ }
749
+
750
+ export function Parser_parseInstanceDefinition(self_) {
751
+ if(self_.lspHook_.trackSymbols_) {
752
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
753
+ };
754
+ const instanceToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "instance");
755
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
756
+ const poly_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
757
+ ? ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty())
758
+ : ff_compiler_Parser.Parser_parseTypeParameters(self_));
759
+ const typeArguments_ = ff_core_Stack.make_();
760
+ ff_core_Stack.Stack_push(typeArguments_, ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_core_List.List_map(poly_.generics_, ((_w1) => {
761
+ return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), _w1, ff_core_List.Empty())
762
+ }))));
763
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
764
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
765
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")) {
766
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "[");
767
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
768
+ ff_core_Stack.Stack_push(typeArguments_, ff_compiler_Parser.Parser_parseType(self_));
769
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
770
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
771
+ }
772
+ };
773
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "]")
774
+ };
775
+ const generatorArguments_ = ff_compiler_Parser.Parser_parseFunctionArguments(self_, ff_compiler_Token.Token_at(nameToken_), false).first_;
776
+ const methods_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{"))
777
+ ? ff_core_List.Empty()
778
+ : (function() {
779
+ const definitions_ = ff_core_Stack.make_();
780
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
781
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
782
+ ff_core_Stack.Stack_push(definitions_, ff_compiler_Parser.Parser_parseFunctionDefinition(self_, false));
783
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
784
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
785
+ }
786
+ };
787
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
788
+ return ff_core_Stack.Stack_toList(definitions_, 0, 9007199254740991)
789
+ })());
790
+ if(self_.lspHook_.trackSymbols_) {
791
+ const name_ = ((ff_compiler_Token.Token_raw(token_) + ": ") + ff_compiler_Token.Token_raw(nameToken_));
792
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(name_, 19, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(instanceToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
793
+ };
794
+ return ff_compiler_Syntax.DInstance(ff_compiler_Token.Token_at(nameToken_), poly_.generics_, poly_.constraints_, ff_compiler_Token.Token_raw(nameToken_), ff_core_Stack.Stack_toList(typeArguments_, 0, 9007199254740991), generatorArguments_, methods_, false)
795
+ }
796
+
797
+ export function Parser_parseTypeDefinition(self_) {
798
+ if(self_.lspHook_.trackSymbols_) {
799
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
800
+ };
801
+ const newtype_ = ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "newtype");
802
+ const effectParameter_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "capability")
803
+ ? ff_core_List.Link("Q$", ff_core_List.Empty())
804
+ : ff_core_List.Empty());
805
+ const allowMutable_ = ff_compiler_Token.Token_rawIs2(ff_compiler_Parser.Parser_current(self_), "class", "capability");
806
+ const kindToken_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "newtype")
807
+ ? ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "newtype")
808
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "data")
809
+ ? ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "data")
810
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "class")
811
+ ? ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "class")
812
+ : ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "capability"));
813
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
814
+ const poly_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
815
+ ? ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty())
816
+ : ff_compiler_Parser.Parser_parseTypeParameters(self_));
817
+ if(((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
818
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{")
819
+ };
820
+ const commonFields_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "("))
821
+ ? ff_core_List.Empty()
822
+ : ff_compiler_Parser.Parser_parseFunctionParameters(self_, true));
823
+ const variants_ = ((newtype_ || (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))
824
+ ? ff_core_List.Link(ff_compiler_Syntax.Variant(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), ff_core_List.Empty()), ff_core_List.Empty())
825
+ : (function() {
826
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
827
+ const variantsBuilder_ = ff_core_Stack.make_();
828
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
829
+ if(self_.lspHook_.trackSymbols_) {
830
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
831
+ };
832
+ const variantNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
833
+ const variantFields_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "("))
834
+ ? ff_core_List.Empty()
835
+ : ff_compiler_Parser.Parser_parseFunctionParameters(self_, true));
836
+ if(((!allowMutable_) && ff_core_List.List_any(variantFields_, ((_w1) => {
837
+ return _w1.mutable_
838
+ })))) {
839
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_Option.Option_grab(ff_core_List.List_find(variantFields_, ((_w1) => {
840
+ return _w1.mutable_
841
+ }))).at_, "Only classes can have mutable fields"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
842
+ };
843
+ ff_core_Stack.Stack_push(variantsBuilder_, ff_compiler_Syntax.Variant(ff_compiler_Token.Token_at(variantNameToken_), ff_compiler_Token.Token_raw(variantNameToken_), variantFields_));
844
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
845
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
846
+ };
847
+ if(self_.lspHook_.trackSymbols_) {
848
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(variantNameToken_), 10, ff_compiler_Token.Token_at(variantNameToken_), ff_compiler_Token.Token_end(variantNameToken_), ff_compiler_Token.Token_at(variantNameToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
849
+ }
850
+ };
851
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
852
+ return ff_core_Stack.Stack_toList(variantsBuilder_, 0, 9007199254740991)
853
+ })());
854
+ if((newtype_ && (ff_core_List.List_size(commonFields_) !== 1))) {
855
+ ff_core_Log.show_(commonFields_, ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Parameter));
856
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(nameToken_), "Newtypes must have exactly one field"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
857
+ };
858
+ if(((!allowMutable_) && ff_core_List.List_any(commonFields_, ((_w1) => {
859
+ return _w1.mutable_
860
+ })))) {
861
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_Option.Option_grab(ff_core_List.List_find(commonFields_, ((_w1) => {
862
+ return _w1.mutable_
863
+ }))).at_, "Only classes and capabilities can have mutable fields"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
864
+ };
865
+ const generics_ = ff_core_List.List_addAll(effectParameter_, poly_.generics_);
866
+ const result_ = ff_compiler_Syntax.DType(ff_compiler_Token.Token_at(nameToken_), newtype_, (!allowMutable_), ff_compiler_Token.Token_raw(nameToken_), generics_, poly_.constraints_, commonFields_, variants_);
867
+ if(self_.lspHook_.trackSymbols_) {
868
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), 5, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(kindToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
869
+ };
870
+ return result_
871
+ }
872
+
873
+ export function Parser_parseImportDefinition(self_, currentPackagePair_) {
874
+ const importToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "import");
875
+ const path_ = ff_core_Stack.make_();
876
+ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
877
+ ff_core_Stack.Stack_push(path_, ff_compiler_Parser.Parser_parseDashedName(self_));
878
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot())
879
+ };
880
+ const fileToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
881
+ const alias_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "as")
882
+ ? (function() {
883
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "as");
884
+ return ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper()))
885
+ })()
886
+ : ff_compiler_Token.Token_raw(fileToken_));
887
+ const packagePair_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "from")
888
+ ? (function() {
889
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "from");
890
+ const userName_ = ff_compiler_Parser.Parser_parseDashedName(self_);
891
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
892
+ const packageName_ = ff_compiler_Parser.Parser_parseDashedName(self_);
893
+ return ff_compiler_Syntax.PackagePair(userName_, packageName_)
894
+ })()
895
+ : currentPackagePair_);
896
+ return ff_compiler_Syntax.DImport(ff_compiler_Token.Token_at(fileToken_), alias_, packagePair_, ff_core_Stack.Stack_toList(path_, 0, 9007199254740991), ff_compiler_Token.Token_raw(fileToken_))
897
+ }
898
+
899
+ export function Parser_parsePackageDefinition(self_) {
900
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
901
+ const user_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()));
902
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
903
+ const name_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()));
904
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
905
+ const version_ = ff_compiler_Parser.Parser_parseVersion(self_);
906
+ const targets_ = ff_compiler_Parser.Parser_parseTargetNames(self_, ff_compiler_Syntax.TargetNames(true, true));
907
+ return ff_compiler_Syntax.DPackage(at_, ff_compiler_Syntax.PackagePair(user_, name_), version_, targets_)
908
+ }
909
+
910
+ export function Parser_parseDependencyDefinition(self_, defaultTargetNames_) {
911
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
912
+ const user_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()));
913
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
914
+ const name_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()));
915
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
916
+ const version_ = ff_compiler_Parser.Parser_parseVersion(self_);
917
+ const safety_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "trusted")
918
+ ? ff_compiler_Syntax.Trusted()
919
+ : (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "unsafe")
920
+ ? ff_compiler_Syntax.Unsafe()
921
+ : ff_compiler_Syntax.Safe()));
922
+ const targets_ = ff_compiler_Parser.Parser_parseTargetNames(self_, defaultTargetNames_);
923
+ return ff_compiler_Syntax.DDependency(at_, ff_compiler_Syntax.PackagePair(user_, name_), version_, safety_, targets_)
924
+ }
925
+
926
+ export function Parser_parseIncludeDefinition(self_) {
927
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
928
+ const path_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString()));
929
+ return ff_compiler_Syntax.DInclude(at_, ff_core_String.String_dropLast(ff_core_String.String_dropFirst(path_, 1), 1))
930
+ }
931
+
932
+ export function Parser_parseTargetNames(self_, defaultTargets_) {
933
+ let targets_ = ff_compiler_Syntax.TargetNames(false, false);
934
+ while(ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword(), ff_compiler_Token.LLower())) {
935
+ const token_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
936
+ ? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())
937
+ : ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
938
+ do {
939
+ const _1 = ff_compiler_Token.Token_raw(token_);
940
+ {
941
+ if(_1 == "node") {
942
+ const _guard1 = targets_.node_;
943
+ if(_guard1) {
944
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(token_), "Duplicate target name"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
945
+ break
946
+ }
947
+ }
948
+ }
949
+ {
950
+ if(_1 == "node") {
951
+ targets_ = (((_c) => {
952
+ return ff_compiler_Syntax.TargetNames(true, _c.browser_)
953
+ }))(targets_)
954
+ break
955
+ }
956
+ }
957
+ {
958
+ if(_1 == "browser") {
959
+ const _guard1 = targets_.browser_;
960
+ if(_guard1) {
961
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(token_), "Duplicate target name"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
962
+ break
963
+ }
964
+ }
965
+ }
966
+ {
967
+ if(_1 == "browser") {
968
+ targets_ = (((_c) => {
969
+ return ff_compiler_Syntax.TargetNames(_c.node_, true)
970
+ }))(targets_)
971
+ break
972
+ }
973
+ }
974
+ {
975
+ const t_ = _1;
976
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(token_), ("Unexpected target: " + t_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
977
+ break
978
+ }
979
+ } while(false)
980
+ };
981
+ if(((!targets_.node_) && (!targets_.browser_))) {
982
+ return defaultTargets_
983
+ } else {
984
+ return targets_
985
+ }
986
+ }
987
+
988
+ export function Parser_parseVersion(self_) {
989
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LFloat())) {
990
+ const majorMinor_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LFloat());
991
+ const parts_ = ff_core_String.String_split(ff_compiler_Token.Token_raw(majorMinor_), 46);
992
+ const patch_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())
993
+ ? (function() {
994
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot());
995
+ return ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt())))
996
+ })()
997
+ : 0);
998
+ return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(majorMinor_), ff_core_String.String_grabInt(ff_core_Array.Array_grab(parts_, 0)), ff_core_String.String_grabInt(ff_core_Array.Array_grab(parts_, 1)), patch_)
999
+ } else {
1000
+ const major_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt());
1001
+ return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(major_), ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(major_)), 0, 0)
1002
+ }
1003
+ }
1004
+
1005
+ export function Parser_parseDashedName(self_) {
1006
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
1007
+ function readPart_() {
1008
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LInt())) {
1009
+ const prefix_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt()));
1010
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
1011
+ return (prefix_ + ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())))
1012
+ } else {
1013
+ return prefix_
1014
+ }
1015
+ } else {
1016
+ return ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()))
1017
+ }
1018
+ }
1019
+ let part_ = readPart_();
1020
+ while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "-")) {
1021
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
1022
+ part_ = ((part_ + "-") + readPart_())
1023
+ };
1024
+ if(ff_core_String.String_any(part_, ((_w1) => {
1025
+ return ff_core_Char.Char_isAsciiUpper(_w1)
1026
+ }))) {
1027
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("Package names and paths must not contain upper case letters: " + part_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1028
+ };
1029
+ if((ff_core_String.String_any(part_, ((_w1) => {
1030
+ return (_w1 === 95)
1031
+ })) || ff_core_String.String_any(part_, ((_w1) => {
1032
+ return (_w1 === 46)
1033
+ })))) {
1034
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("Package names and paths must not contain underscores or dots: " + part_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1035
+ };
1036
+ return part_
1037
+ }
1038
+
1039
+ export function Parser_parseTypeParameters(self_) {
1040
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "[");
1041
+ const parameters_ = ff_core_Stack.make_();
1042
+ const constraints_ = ff_core_Stack.make_();
1043
+ while(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LSemicolon())))) {
1044
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LBracketLeft())) {
1045
+ ff_core_Stack.Stack_push(constraints_, ff_compiler_Parser.Parser_parseConstraint(self_))
1046
+ } else {
1047
+ const parameterNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
1048
+ ff_core_Stack.Stack_push(parameters_, ff_compiler_Token.Token_raw(parameterNameToken_));
1049
+ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())) {
1050
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
1051
+ const constraint_ = ff_compiler_Parser.Parser_parseConstraint(self_);
1052
+ ff_core_Stack.Stack_push(constraints_, (((_c) => {
1053
+ return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.Link(ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_raw(parameterNameToken_), ff_core_List.Empty()), constraint_.generics_))
1054
+ }))(constraint_))
1055
+ }
1056
+ };
1057
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1058
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
1059
+ }
1060
+ };
1061
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "]");
1062
+ return ff_compiler_Parser.Poly(ff_core_Stack.Stack_toList(parameters_, 0, 9007199254740991), ff_core_Stack.Stack_toList(constraints_, 0, 9007199254740991))
1063
+ }
1064
+
1065
+ export function Parser_parseTypeArguments(self_, parenthesis_ = false) {
1066
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), (parenthesis_
1067
+ ? "("
1068
+ : "["));
1069
+ const types_ = ff_core_Stack.make_();
1070
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1071
+ ff_core_Stack.Stack_push(types_, ff_compiler_Parser.Parser_parseType(self_));
1072
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1073
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
1074
+ }
1075
+ };
1076
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), (parenthesis_
1077
+ ? ")"
1078
+ : "]"));
1079
+ return ff_core_Stack.Stack_toList(types_, 0, 9007199254740991)
1080
+ }
1081
+
1082
+ export function Parser_parseFunctionParameters(self_, allowMutable_ = false) {
1083
+ const parameters_ = ff_core_Stack.make_();
1084
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
1085
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1086
+ const lspTrackSymbols_ = (self_.lspHook_.trackSymbols_ && allowMutable_);
1087
+ if(lspTrackSymbols_) {
1088
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
1089
+ };
1090
+ const lspFirst_ = ff_compiler_Parser.Parser_current(self_);
1091
+ const mutable_ = ((allowMutable_ && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword())) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "mutable"));
1092
+ if(mutable_) {
1093
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword())
1094
+ };
1095
+ const parameterNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1096
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())))) {
1097
+ const t_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(parameterNameToken_), "ff:core/Nothing.Nothing", ff_core_List.Empty());
1098
+ ff_core_Stack.Stack_push(parameters_, ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), t_, ff_core_Option.None()));
1099
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1100
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
1101
+ }
1102
+ } else {
1103
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
1104
+ const parameterType_ = ff_compiler_Parser.Parser_parseType(self_);
1105
+ const default_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign()))
1106
+ ? ff_core_Option.None()
1107
+ : (function() {
1108
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
1109
+ return ff_core_Option.Some(ff_compiler_Parser.Parser_parseTerm(self_))
1110
+ })());
1111
+ ff_core_Stack.Stack_push(parameters_, ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), parameterType_, default_));
1112
+ if(lspTrackSymbols_) {
1113
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(parameterNameToken_), 7, ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_end(parameterNameToken_), ff_compiler_Token.Token_at(lspFirst_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
1114
+ };
1115
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1116
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
1117
+ }
1118
+ }
1119
+ };
1120
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
1121
+ return ff_core_Stack.Stack_toList(parameters_, 0, 9007199254740991)
1122
+ }
1123
+
1124
+ export function Parser_parseFunctionArguments(self_, callAt_, trailing_) {
1125
+ const arguments_ = ff_core_Stack.make_();
1126
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
1127
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
1128
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1129
+ const argumentToken_ = ff_compiler_Parser.Parser_current(self_);
1130
+ const nameToken_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower()) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LAssign()))
1131
+ ? (function() {
1132
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1133
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
1134
+ return ff_core_Option.Some(token_)
1135
+ })()
1136
+ : ff_core_Option.None());
1137
+ const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
1138
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
1139
+ if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
1140
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, ff_core_Stack.Stack_size(arguments_), ff_core_Option.Option_map(nameToken_, ((_w1) => {
1141
+ return ff_compiler_Token.Token_raw(_w1)
1142
+ }))));
1143
+ self_.lspEmittedArgumentHook_ = true
1144
+ }
1145
+ };
1146
+ ff_core_Stack.Stack_push(arguments_, ff_compiler_Syntax.Argument(ff_compiler_Token.Token_at(argumentToken_), ff_core_Option.Option_map(nameToken_, ((_w1) => {
1147
+ return ff_compiler_Token.Token_raw(_w1)
1148
+ })), value_));
1149
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1150
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
1151
+ }
1152
+ };
1153
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
1154
+ if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
1155
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, ff_core_Stack.Stack_size(arguments_), ff_core_Option.None()));
1156
+ self_.lspEmittedArgumentHook_ = true
1157
+ }
1158
+ };
1159
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")")
1160
+ };
1161
+ let lastWasCurly_ = false;
1162
+ if(trailing_) {
1163
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower(), ff_compiler_Token.LUpper(), ff_compiler_Token.LString()) || ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LInt(), ff_compiler_Token.LChar(), ff_compiler_Token.LFloat())))) {
1164
+ lastWasCurly_ = true;
1165
+ const term_ = ff_compiler_Parser.Parser_parseTerm(self_);
1166
+ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(term_.at_, "TemporaryEffect$", ff_core_List.Empty());
1167
+ const cases_ = ff_core_List.Link(ff_compiler_Syntax.MatchCase(term_.at_, ff_core_List.Empty(), ff_core_List.Empty(), term_), ff_core_List.Empty());
1168
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
1169
+ if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
1170
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, ff_core_Stack.Stack_size(arguments_), ff_core_Option.None()));
1171
+ self_.lspEmittedArgumentHook_ = true
1172
+ }
1173
+ };
1174
+ ff_core_Stack.Stack_push(arguments_, ff_compiler_Syntax.Argument(term_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(term_.at_, ff_compiler_Syntax.Lambda(term_.at_, temporaryEffect_, cases_))))
1175
+ } else {
1176
+ while((ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{") || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()))) {
1177
+ lastWasCurly_ = ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{");
1178
+ const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, 0, false, true);
1179
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
1180
+ if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
1181
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, ff_core_Stack.Stack_size(arguments_), ff_core_Option.None()));
1182
+ self_.lspEmittedArgumentHook_ = true
1183
+ }
1184
+ };
1185
+ ff_core_Stack.Stack_push(arguments_, ff_compiler_Syntax.Argument(lambda_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(lambda_.at_, lambda_)))
1186
+ }
1187
+ }
1188
+ };
1189
+ return ff_core_Pair.Pair(ff_core_Stack.Stack_toList(arguments_, 0, 9007199254740991), lastWasCurly_)
1190
+ }
1191
+
1192
+ export function Parser_parseLambda(self_, defaultParameterCount_ = 0, ignoreGenerateKeyword_ = false, allowColon_ = false) {
1193
+ const colon_ = (allowColon_ && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()));
1194
+ const token_ = (colon_
1195
+ ? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon())
1196
+ : ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{"));
1197
+ if(((ignoreGenerateKeyword_ && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword())) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "generate"))) {
1198
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword())
1199
+ };
1200
+ const result_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe())
1201
+ ? (function() {
1202
+ const cases_ = ff_core_Stack.make_();
1203
+ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe())) {
1204
+ ff_core_Stack.Stack_push(cases_, ff_compiler_Parser.Parser_parseCase(self_))
1205
+ };
1206
+ return ff_core_Stack.Stack_toList(cases_, 0, 9007199254740991)
1207
+ })()
1208
+ : (ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower(), ff_compiler_Token.LWildcard()) && ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LComma(), ff_compiler_Token.LArrowThick()))
1209
+ ? (function() {
1210
+ const parameters_ = ff_core_Stack.make_();
1211
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick()))) {
1212
+ const isVariable_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower());
1213
+ const parameterToken_ = (isVariable_
1214
+ ? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())
1215
+ : ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard()));
1216
+ ff_core_Stack.Stack_push(parameters_, ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(parameterToken_), (isVariable_
1217
+ ? ff_core_Option.Some(ff_compiler_Token.Token_raw(parameterToken_))
1218
+ : ff_core_Option.None())));
1219
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick()))) {
1220
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
1221
+ }
1222
+ };
1223
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick());
1224
+ const term_ = ff_compiler_Parser.Parser_parseStatements(self_);
1225
+ return ff_core_List.Link(ff_compiler_Syntax.MatchCase(ff_compiler_Token.Token_at(token_), ff_core_Stack.Stack_toList(parameters_, 0, 9007199254740991), ff_core_List.Empty(), term_), ff_core_List.Empty())
1226
+ })()
1227
+ : (function() {
1228
+ const term_ = ff_compiler_Parser.Parser_parseStatements(self_);
1229
+ const wildcards_ = ff_compiler_Wildcards.make_();
1230
+ const e_ = ff_compiler_Wildcards.Wildcards_fixWildcards(wildcards_, term_);
1231
+ const arguments_ = ((wildcards_.seenWildcards_ !== 0)
1232
+ ? ff_core_List.List_map(ff_core_List.range_(wildcards_.seenWildcards_), ((i_) => {
1233
+ return ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(token_), ff_core_Option.Some(("_w" + (i_ + 1))))
1234
+ }))
1235
+ : ff_core_List.List_map(ff_core_List.range_(defaultParameterCount_), ((i_) => {
1236
+ return ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(token_), ff_core_Option.None())
1237
+ })));
1238
+ return ff_core_List.Link(ff_compiler_Syntax.MatchCase(ff_compiler_Token.Token_at(token_), arguments_, ff_core_List.Empty(), e_), ff_core_List.Empty())
1239
+ })());
1240
+ if((!colon_)) {
1241
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}")
1242
+ };
1243
+ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), "TemporaryEffect$", ff_core_List.Empty());
1244
+ return ff_compiler_Syntax.Lambda(ff_compiler_Token.Token_at(token_), temporaryEffect_, result_)
1245
+ }
1246
+
1247
+ export function Parser_parseCase(self_) {
1248
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe());
1249
+ const patterns_ = ff_core_Stack.make_();
1250
+ while(((!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick(), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
1251
+ ff_core_Stack.Stack_push(patterns_, ff_compiler_Parser.Parser_parsePattern(self_));
1252
+ if(((!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick(), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
1253
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
1254
+ }
1255
+ };
1256
+ const guards_ = ff_core_Stack.make_();
1257
+ while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
1258
+ ff_core_Stack.Stack_push(guards_, ff_compiler_Parser.Parser_parseCaseGuard(self_))
1259
+ };
1260
+ if(((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || (!ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())))) {
1261
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick())
1262
+ };
1263
+ const body_ = ff_compiler_Parser.Parser_parseStatements(self_);
1264
+ return ff_compiler_Syntax.MatchCase(ff_compiler_Token.Token_at(token_), ff_core_Stack.Stack_toList(patterns_, 0, 9007199254740991), ff_core_Stack.Stack_toList(guards_, 0, 9007199254740991), body_)
1265
+ }
1266
+
1267
+ export function Parser_parseCaseGuard(self_) {
1268
+ const guardToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LBracketLeft());
1269
+ const term_ = ff_compiler_Parser.Parser_parseStatements(self_);
1270
+ const p_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe()))
1271
+ ? ff_compiler_Syntax.PVariant(ff_compiler_Token.Token_at(guardToken_), "True", ff_core_List.Empty())
1272
+ : (function() {
1273
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe());
1274
+ return ff_compiler_Parser.Parser_parsePattern(self_)
1275
+ })());
1276
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LBracketRight());
1277
+ return ff_compiler_Syntax.MatchGuard(ff_compiler_Token.Token_at(guardToken_), term_, p_)
1278
+ }
1279
+
1280
+ export function Parser_parsePattern(self_) {
1281
+ const pattern_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LWildcard())
1282
+ ? (function() {
1283
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard());
1284
+ return ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(token_), ff_core_Option.None())
1285
+ })()
1286
+ : ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
1287
+ ? (function() {
1288
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1289
+ return ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(token_), ff_core_Option.Some(ff_compiler_Token.Token_raw(token_)))
1290
+ })()
1291
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")
1292
+ ? (function() {
1293
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
1294
+ const pair_ = ff_core_List.List_unzip(ff_compiler_Parser.Parser_parseRecordPattern(self_));
1295
+ return ff_compiler_Syntax.PVariant(at_, ("Record$" + ff_core_List.List_join(pair_.first_, "$")), pair_.second_)
1296
+ })()
1297
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")
1298
+ ? ff_compiler_Parser.Parser_parseListPattern(self_)
1299
+ : ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LString())
1300
+ ? (function() {
1301
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString());
1302
+ return ff_compiler_Syntax.PString(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
1303
+ })()
1304
+ : ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LInt())
1305
+ ? (function() {
1306
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt());
1307
+ return ff_compiler_Syntax.PInt(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
1308
+ })()
1309
+ : ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LChar())
1310
+ ? (function() {
1311
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LChar());
1312
+ return ff_compiler_Syntax.PChar(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
1313
+ })()
1314
+ : (function() {
1315
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
1316
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
1317
+ const patterns_ = ff_core_Stack.make_();
1318
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
1319
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1320
+ const pattern_ = ff_compiler_Parser.Parser_parsePattern(self_);
1321
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
1322
+ if(ff_compiler_LspHook.strictlyBetween_(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
1323
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_), ff_core_Stack.Stack_size(patterns_), ff_core_Option.None()));
1324
+ self_.lspEmittedArgumentHook_ = true
1325
+ }
1326
+ };
1327
+ ff_core_Stack.Stack_push(patterns_, pattern_);
1328
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1329
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
1330
+ }
1331
+ };
1332
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
1333
+ if(ff_compiler_LspHook.strictlyBetween_(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
1334
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_), ff_core_Stack.Stack_size(patterns_), ff_core_Option.None()));
1335
+ self_.lspEmittedArgumentHook_ = true
1336
+ }
1337
+ };
1338
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
1339
+ return ff_compiler_Syntax.PVariant(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_core_Stack.Stack_toList(patterns_, 0, 9007199254740991))
1340
+ } else {
1341
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
1342
+ const asToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1343
+ return ff_compiler_Syntax.PVariantAs(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_compiler_Token.Token_at(asToken_), ff_core_Option.Some(ff_compiler_Token.Token_raw(asToken_)))
1344
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LWildcard())) {
1345
+ const wildcardToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard());
1346
+ return ff_compiler_Syntax.PVariantAs(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_compiler_Token.Token_at(wildcardToken_), ff_core_Option.None())
1347
+ } else {
1348
+ return ff_compiler_Syntax.PVariant(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_core_List.Empty())
1349
+ }
1350
+ }
1351
+ })());
1352
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "@")) {
1353
+ const atToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
1354
+ const asToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1355
+ return ff_compiler_Syntax.PAlias(ff_compiler_Token.Token_at(asToken_), pattern_, ff_compiler_Token.Token_raw(asToken_))
1356
+ } else {
1357
+ return pattern_
1358
+ }
1359
+ }
1360
+
1361
+ export function Parser_parseType(self_) {
1362
+ const leftTypes_ = (((ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(") && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LLower())) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_aheadAhead(self_), ff_compiler_Token.LColon()))
1363
+ ? (function() {
1364
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
1365
+ const pair_ = ff_core_List.List_unzip(ff_compiler_Parser.Parser_parseRecordType(self_));
1366
+ return ff_core_List.Link(ff_compiler_Syntax.TConstructor(at_, ("Record$" + ff_core_List.List_join(pair_.first_, "$")), pair_.second_), ff_core_List.Empty())
1367
+ })()
1368
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")
1369
+ ? ff_compiler_Parser.Parser_parseTypeArguments(self_, true)
1370
+ : (function() {
1371
+ const namespace_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace())
1372
+ ? ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace()))
1373
+ : "");
1374
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
1375
+ const arguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
1376
+ ? ff_core_List.Empty()
1377
+ : ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
1378
+ return ff_core_List.Link(ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), (namespace_ + ff_compiler_Token.Token_raw(token_)), arguments_), ff_core_List.Empty())
1379
+ })());
1380
+ if(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick())) && (ff_core_List.List_size(leftTypes_) === 1))) {
1381
+ return ff_core_List.List_grabFirst(leftTypes_)
1382
+ } else {
1383
+ const arrowToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick());
1384
+ const rightType_ = ff_compiler_Parser.Parser_parseType(self_);
1385
+ return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(arrowToken_), ("Function$" + ff_core_List.List_size(leftTypes_)), ff_core_List.List_addAll(leftTypes_, ff_core_List.Link(rightType_, ff_core_List.Empty())))
1386
+ }
1387
+ }
1388
+
1389
+ export function Parser_parseConstraint(self_) {
1390
+ const namespace_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace())
1391
+ ? ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace()))
1392
+ : "");
1393
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
1394
+ const arguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
1395
+ ? ff_core_List.Empty()
1396
+ : ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
1397
+ return ff_compiler_Syntax.Constraint(ff_compiler_Token.Token_at(token_), (namespace_ + ff_compiler_Token.Token_raw(token_)), arguments_)
1398
+ }
1399
+
1400
+ export function Parser_parseStatements(self_) {
1401
+ if(ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight(), ff_compiler_Token.LPipe())) {
1402
+ return ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Unit", ff_core_List.Empty(), ff_core_Option.None())
1403
+ } else {
1404
+ let result_ = ff_compiler_Parser.Parser_parseStatement(self_);
1405
+ while(ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon())) {
1406
+ const token_ = ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon());
1407
+ result_ = ff_compiler_Syntax.ESequential(ff_compiler_Token.Token_at(token_), result_, ff_compiler_Parser.Parser_parseStatement(self_))
1408
+ };
1409
+ return result_
1410
+ }
1411
+ }
1412
+
1413
+ export function Parser_parseStatement(self_) {
1414
+ if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "let") || ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "mutable")))) {
1415
+ return ff_compiler_Parser.Parser_parseLet(self_)
1416
+ } else {
1417
+ if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "function"))) {
1418
+ return ff_compiler_Parser.Parser_parseFunctions(self_)
1419
+ } else {
1420
+ const term_ = ff_compiler_Parser.Parser_parseTerm(self_);
1421
+ if(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())) && (!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignPlus(), ff_compiler_Token.LAssignMinus(), ff_compiler_Token.LAssignLink())))) {
1422
+ return term_
1423
+ } else {
1424
+ const token_ = ff_core_Core.do_((() => {
1425
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignPlus())) {
1426
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignPlus())
1427
+ } else {
1428
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignMinus())) {
1429
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignMinus())
1430
+ } else {
1431
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignLink())) {
1432
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignLink())
1433
+ } else {
1434
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign())
1435
+ }
1436
+ }
1437
+ }
1438
+ }));
1439
+ const operator_ = ff_core_String.String_dropLast(ff_compiler_Token.Token_raw(token_), 1);
1440
+ const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
1441
+ {
1442
+ const _1 = term_;
1443
+ {
1444
+ if(_1.EVariable) {
1445
+ const at_ = _1.at_;
1446
+ const name_ = _1.name_;
1447
+ return ff_compiler_Syntax.EAssign(at_, operator_, name_, value_)
1448
+ return
1449
+ }
1450
+ }
1451
+ {
1452
+ if(_1.EField) {
1453
+ const e_ = _1;
1454
+ return ff_compiler_Syntax.EAssignField(e_.at_, operator_, e_.record_, e_.field_, value_)
1455
+ return
1456
+ }
1457
+ }
1458
+ {
1459
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(token_), "Only variables and fields are assignable"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1460
+ return
1461
+ }
1462
+ }
1463
+ }
1464
+ }
1465
+ }
1466
+ }
1467
+
1468
+ export function Parser_parseLet(self_) {
1469
+ if(self_.lspHook_.trackSymbols_) {
1470
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
1471
+ };
1472
+ const mutableToken_ = ff_compiler_Parser.Parser_current(self_);
1473
+ const mutable_ = ff_compiler_Token.Token_rawIs(mutableToken_, "mutable");
1474
+ const keywordToken_ = (mutable_
1475
+ ? ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "mutable")
1476
+ : ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "let"));
1477
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1478
+ const valueType_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()))
1479
+ ? ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(nameToken_))
1480
+ : (function() {
1481
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
1482
+ return ff_compiler_Parser.Parser_parseType(self_)
1483
+ })());
1484
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())))) {
1485
+ const unit_ = ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(keywordToken_), "Unit", ff_core_List.Empty(), ff_core_Option.None());
1486
+ return ff_compiler_Syntax.ELet(ff_compiler_Token.Token_at(nameToken_), mutable_, ff_compiler_Token.Token_raw(nameToken_), valueType_, unit_, unit_)
1487
+ } else {
1488
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
1489
+ const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
1490
+ if(self_.lspHook_.trackSymbols_) {
1491
+ const kind_ = (mutable_
1492
+ ? 13
1493
+ : 14);
1494
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), kind_, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(mutableToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
1495
+ };
1496
+ const body_ = (ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon())
1497
+ ? (function() {
1498
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon());
1499
+ return ff_compiler_Parser.Parser_parseStatements(self_)
1500
+ })()
1501
+ : ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(keywordToken_), "Unit", ff_core_List.Empty(), ff_core_Option.None()));
1502
+ return ff_compiler_Syntax.ELet(ff_compiler_Token.Token_at(nameToken_), mutable_, ff_compiler_Token.Token_raw(nameToken_), valueType_, value_, body_)
1503
+ }
1504
+ }
1505
+
1506
+ export function Parser_parseFunctions(self_) {
1507
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
1508
+ const functions_ = ff_core_Stack.make_();
1509
+ while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "function")) {
1510
+ if(self_.lspHook_.trackSymbols_) {
1511
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
1512
+ };
1513
+ const functionAt_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "function"));
1514
+ const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, false);
1515
+ const body_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))
1516
+ ? (function() {
1517
+ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(functionAt_, "TemporaryEffect$", ff_core_List.Empty());
1518
+ return ff_compiler_Syntax.Lambda(functionAt_, temporaryEffect_, ff_core_List.Empty())
1519
+ })()
1520
+ : ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), false, false));
1521
+ ff_core_Stack.Stack_push(functions_, ff_compiler_Syntax.DFunction(signature_.at_, signature_, ff_compiler_Syntax.FireflyTarget(body_)));
1522
+ if(self_.lspHook_.trackSymbols_) {
1523
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(signature_.name_, 12, signature_.at_, (((_c) => {
1524
+ return ff_compiler_Syntax.Location(_c.file_, _c.line_, (signature_.at_.column_ + ff_core_String.String_size(signature_.name_)))
1525
+ }))(signature_.at_), functionAt_, ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
1526
+ };
1527
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon())))) {
1528
+
1529
+ } else {
1530
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
1531
+ }
1532
+ };
1533
+ const body_ = ff_compiler_Parser.Parser_parseStatements(self_);
1534
+ return ff_compiler_Syntax.EFunctions(at_, ff_core_Stack.Stack_toList(functions_, 0, 9007199254740991), body_)
1535
+ }
1536
+
1537
+ export function Parser_parseTerm(self_) {
1538
+ return ff_compiler_Parser.Parser_parseBinary(self_, 0)
1539
+ }
1540
+
1541
+ export function Parser_parseBinary(self_, level_) {
1542
+ if((level_ >= ff_core_Array.Array_size(ff_compiler_Parser.binaryOperators_))) {
1543
+ return ff_compiler_Parser.Parser_parseUnary(self_)
1544
+ } else {
1545
+ const operators_ = ff_core_Array.Array_grab(ff_compiler_Parser.binaryOperators_, level_);
1546
+ let result_ = ff_compiler_Parser.Parser_parseBinary(self_, (level_ + 1));
1547
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LOperator())) {
1548
+ while(ff_core_List.List_any(operators_, ((value_) => {
1549
+ return ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), value_)
1550
+ }))) {
1551
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
1552
+ const right_ = ff_compiler_Parser.Parser_parseBinary(self_, (level_ + 1));
1553
+ const arguments_ = ff_core_List.Link(ff_compiler_Syntax.Argument(result_.at_, ff_core_Option.None(), result_), ff_core_List.Link(ff_compiler_Syntax.Argument(right_.at_, ff_core_Option.None(), right_), ff_core_List.Empty()));
1554
+ const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(token_));
1555
+ const target_ = (((_1) => {
1556
+ {
1557
+ if(_1 == "==") {
1558
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Equal.equals"), false)
1559
+ return
1560
+ }
1561
+ }
1562
+ {
1563
+ if(_1 == "!=") {
1564
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Equal.notEquals"), false)
1565
+ return
1566
+ }
1567
+ }
1568
+ {
1569
+ if(_1 == "<") {
1570
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Ordering.before"), false)
1571
+ return
1572
+ }
1573
+ }
1574
+ {
1575
+ if(_1 == "<=") {
1576
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Ordering.notAfter"), false)
1577
+ return
1578
+ }
1579
+ }
1580
+ {
1581
+ if(_1 == ">") {
1582
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Ordering.after"), false)
1583
+ return
1584
+ }
1585
+ }
1586
+ {
1587
+ if(_1 == ">=") {
1588
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Ordering.notBefore"), false)
1589
+ return
1590
+ }
1591
+ }
1592
+ {
1593
+ const o_ = _1;
1594
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), o_), false)
1595
+ return
1596
+ }
1597
+ }))(ff_compiler_Token.Token_raw(token_));
1598
+ result_ = ff_compiler_Syntax.ECall(ff_compiler_Token.Token_at(token_), target_, effect_, ff_core_List.Empty(), arguments_, ff_core_List.Empty())
1599
+ }
1600
+ };
1601
+ return result_
1602
+ }
1603
+ }
1604
+
1605
+ export function Parser_parseUnary(self_) {
1606
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LOperator())) {
1607
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
1608
+ const term_ = ff_compiler_Parser.Parser_parseUnary(self_);
1609
+ const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(token_));
1610
+ const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_)), false);
1611
+ return ff_compiler_Syntax.ECall(ff_compiler_Token.Token_at(token_), target_, effect_, ff_core_List.Empty(), ff_core_List.Link(ff_compiler_Syntax.Argument(term_.at_, ff_core_Option.None(), term_), ff_core_List.Empty()), ff_core_List.Empty())
1612
+ } else {
1613
+ return ff_compiler_Parser.Parser_parseFieldsAndCalls(self_)
1614
+ }
1615
+ }
1616
+
1617
+ export function Parser_parseFieldsAndCalls(self_) {
1618
+ const tailCall_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "tailcall"))
1619
+ ? (function() {
1620
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword());
1621
+ return true
1622
+ })()
1623
+ : false);
1624
+ let result_ = ff_compiler_Parser.Parser_parseAtom(self_);
1625
+ while(((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketLeft()) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot()))) {
1626
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())) {
1627
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot());
1628
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
1629
+ const term_ = ff_compiler_Parser.Parser_parseAtom(self_);
1630
+ const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, term_.at_);
1631
+ result_ = ff_compiler_Syntax.EPipe(term_.at_, result_, effect_, term_)
1632
+ } else if(ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LUpper(), ff_compiler_Token.LNamespace())) {
1633
+ result_ = ff_compiler_Parser.Parser_parseCopy(self_, result_)
1634
+ } else {
1635
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1636
+ result_ = ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, result_, ff_compiler_Token.Token_raw(token_))
1637
+ }
1638
+ } else {
1639
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
1640
+ const typeArguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
1641
+ ? ff_core_List.Empty()
1642
+ : ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
1643
+ const arguments_ = ff_compiler_Parser.Parser_parseFunctionArguments(self_, result_.at_, true);
1644
+ const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, at_);
1645
+ const target_ = ff_compiler_Syntax.DynamicCall(result_, tailCall_);
1646
+ result_ = ff_compiler_Syntax.ECall(result_.at_, target_, effect_, typeArguments_, arguments_.first_, ff_core_List.Empty());
1647
+ if((arguments_.second_ && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower()))) {
1648
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1649
+ result_ = ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, result_, ff_compiler_Token.Token_raw(token_))
1650
+ }
1651
+ }
1652
+ };
1653
+ return result_
1654
+ }
1655
+
1656
+ export function Parser_parseAtom(self_) {
1657
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LString())) {
1658
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString());
1659
+ return ff_compiler_Syntax.EString(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
1660
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LChar())) {
1661
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LChar());
1662
+ return ff_compiler_Syntax.EChar(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
1663
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LInt())) {
1664
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt());
1665
+ return ff_compiler_Syntax.EInt(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
1666
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LFloat())) {
1667
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LFloat());
1668
+ return ff_compiler_Syntax.EFloat(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
1669
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
1670
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1671
+ return ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
1672
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace())) {
1673
+ const namespaceToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace());
1674
+ const extraNamespace_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace()))
1675
+ ? ff_core_Option.None()
1676
+ : ff_core_Option.Some(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace()))));
1677
+ const prefix_ = (ff_compiler_Token.Token_raw(namespaceToken_) + ff_core_Option.Option_else(extraNamespace_, (() => {
1678
+ return ""
1679
+ })));
1680
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
1681
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1682
+ return ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), (prefix_ + ff_compiler_Token.Token_raw(token_)))
1683
+ } else {
1684
+ return ff_compiler_Parser.Parser_parseVariant(self_, prefix_)
1685
+ }
1686
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LUpper())) {
1687
+ return ff_compiler_Parser.Parser_parseVariant(self_, "")
1688
+ } else if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
1689
+ const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, 0, false, false);
1690
+ return ff_compiler_Syntax.ELambda(lambda_.at_, lambda_)
1691
+ } else if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")) {
1692
+ return ff_compiler_Parser.Parser_parseList(self_)
1693
+ } else if(((ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(") && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LLower())) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_aheadAhead(self_), ff_compiler_Token.LAssign()))) {
1694
+ return ff_compiler_Syntax.ERecord(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), ff_compiler_Parser.Parser_parseRecord(self_, ff_core_Option.None()))
1695
+ } else if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
1696
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
1697
+ const result_ = ff_compiler_Parser.Parser_parseTerm(self_);
1698
+ while((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LComma()))) {
1699
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma());
1700
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1701
+ ff_compiler_Parser.Parser_parseTerm(self_)
1702
+ }
1703
+ };
1704
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
1705
+ return result_
1706
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LWildcard())) {
1707
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard());
1708
+ return ff_compiler_Syntax.EWildcard(ff_compiler_Token.Token_at(token_), 0)
1709
+ } else {
1710
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), ("Expected atom, got " + ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_current(self_)))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1711
+ }
1712
+ }
1713
+
1714
+ export function Parser_parseVariant(self_, prefix_) {
1715
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
1716
+ const name_ = (prefix_ + ff_compiler_Token.Token_raw(token_));
1717
+ const typeArguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
1718
+ ? ff_core_List.Empty()
1719
+ : ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
1720
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "?")) {
1721
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
1722
+ return ff_compiler_Syntax.EVariantIs(ff_compiler_Token.Token_at(token_), name_, typeArguments_)
1723
+ } else {
1724
+ const arguments_ = ff_core_Option.Some(ff_compiler_Parser.Parser_parseFunctionArguments(self_, ff_compiler_Token.Token_at(token_), true));
1725
+ return ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(token_), name_, typeArguments_, ff_core_Option.Option_map(arguments_, ((_w1) => {
1726
+ return _w1.first_
1727
+ })))
1728
+ }
1729
+ }
1730
+
1731
+ export function Parser_parseCopy(self_, record_) {
1732
+ const namespace_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace()))
1733
+ ? ""
1734
+ : ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace())));
1735
+ const extraNamespace_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace()))
1736
+ ? ""
1737
+ : ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace())));
1738
+ const prefix_ = (namespace_ + extraNamespace_);
1739
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
1740
+ const name_ = (prefix_ + ff_compiler_Token.Token_raw(token_));
1741
+ const fields_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")))
1742
+ ? ff_core_List.Empty()
1743
+ : ff_compiler_Parser.Parser_parseRecord(self_, ff_core_Option.Some(ff_compiler_Token.Token_at(token_))));
1744
+ return ff_compiler_Syntax.ECopy(ff_compiler_Token.Token_at(token_), name_, record_, fields_)
1745
+ }
1746
+
1747
+ export function Parser_parseRecord(self_, copyAt_) {
1748
+ const fields_ = ff_core_Stack.make_();
1749
+ const startBracketAt_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "("));
1750
+ const startAt_ = ff_core_Option.Option_else(copyAt_, (() => {
1751
+ return startBracketAt_
1752
+ }));
1753
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1754
+ const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1755
+ const field_ = (((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign()))
1756
+ ? (function() {
1757
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
1758
+ return ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseTerm(self_))
1759
+ })()
1760
+ : ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_))));
1761
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
1762
+ if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
1763
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_, ff_core_Stack.Stack_size(fields_), ff_core_Option.Option_filter(ff_core_Option.Some(field_.name_), ((_w1) => {
1764
+ return (_w1 !== "")
1765
+ }))));
1766
+ self_.lspEmittedArgumentHook_ = true
1767
+ }
1768
+ };
1769
+ ff_core_Stack.Stack_push(fields_, field_);
1770
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1771
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
1772
+ }
1773
+ };
1774
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
1775
+ if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
1776
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_, ff_core_Stack.Stack_size(fields_), ff_core_Option.None()));
1777
+ self_.lspEmittedArgumentHook_ = true
1778
+ }
1779
+ };
1780
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
1781
+ return ff_core_Stack.Stack_toList(fields_, 0, 9007199254740991)
1782
+ }
1783
+
1784
+ export function Parser_parseRecordType(self_) {
1785
+ const fields_ = ff_core_Stack.make_();
1786
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
1787
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1788
+ const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1789
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LColon());
1790
+ ff_core_Stack.Stack_push(fields_, ff_core_Pair.Pair(ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseType(self_)));
1791
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1792
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
1793
+ }
1794
+ };
1795
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
1796
+ return ff_core_List.List_sortBy(ff_core_Stack.Stack_toList(fields_, 0, 9007199254740991), ((_w1) => {
1797
+ return _w1.first_
1798
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
1799
+ }
1800
+
1801
+ export function Parser_parseRecordPattern(self_) {
1802
+ const fields_ = ff_core_Stack.make_();
1803
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
1804
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1805
+ const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
1806
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
1807
+ ff_core_Stack.Stack_push(fields_, ff_core_Pair.Pair(ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parsePattern(self_)));
1808
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
1809
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
1810
+ }
1811
+ };
1812
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
1813
+ return ff_core_List.List_sortBy(ff_core_Stack.Stack_toList(fields_, 0, 9007199254740991), ((_w1) => {
1814
+ return _w1.first_
1815
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
1816
+ }
1817
+
1818
+ export function Parser_parseListPattern(self_) {
1819
+ function convertListPattern_(at_, items_) {
1820
+ {
1821
+ const at_a = at_;
1822
+ const items_a = items_;
1823
+ {
1824
+ if(items_a.Empty) {
1825
+ return ff_compiler_Syntax.PVariant(at_, "ff:core/List.Empty", ff_core_List.Empty())
1826
+ return
1827
+ }
1828
+ }
1829
+ {
1830
+ if(items_a.Link) {
1831
+ const p_ = items_a.head_.first_;
1832
+ if(!items_a.head_.second_) {
1833
+ const ps_ = items_a.tail_;
1834
+ return ff_compiler_Syntax.PVariant(at_, "ff:core/List.Link", ff_core_List.Link(p_, ff_core_List.Link(convertListPattern_(at_, ps_), ff_core_List.Empty())))
1835
+ return
1836
+ }
1837
+ }
1838
+ }
1839
+ {
1840
+ if(items_a.Link) {
1841
+ const p_ = items_a.head_.first_;
1842
+ if(items_a.head_.second_) {
1843
+ if(items_a.tail_.Empty) {
1844
+ return p_
1845
+ return
1846
+ }
1847
+ }
1848
+ }
1849
+ }
1850
+ {
1851
+ if(items_a.Link) {
1852
+ const p_ = items_a.head_.first_;
1853
+ if(items_a.head_.second_) {
1854
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(p_.at_, "Invalid pattern: ... is only allowed for the last element in a list"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1855
+ return
1856
+ }
1857
+ }
1858
+ }
1859
+ }
1860
+ }
1861
+ const items_ = ff_core_Stack.make_();
1862
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "["));
1863
+ while((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
1864
+ const spread_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDotDotDot());
1865
+ if(spread_) {
1866
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDotDotDot())
1867
+ };
1868
+ const pattern_ = ((spread_ && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))
1869
+ ? ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), ff_core_Option.None())
1870
+ : ff_compiler_Parser.Parser_parsePattern(self_));
1871
+ ff_core_Stack.Stack_push(items_, ff_core_Pair.Pair(pattern_, spread_));
1872
+ if((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
1873
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
1874
+ }
1875
+ };
1876
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "]");
1877
+ return convertListPattern_(at_, ff_core_Stack.Stack_toList(items_, 0, 9007199254740991))
1878
+ }
1879
+
1880
+ export function Parser_parseList(self_) {
1881
+ const items_ = ff_core_Stack.make_();
1882
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "["));
1883
+ while((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
1884
+ const spread_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDotDotDot());
1885
+ if(spread_) {
1886
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDotDotDot())
1887
+ };
1888
+ ff_core_Stack.Stack_push(items_, ff_core_Pair.Pair(ff_compiler_Parser.Parser_parseTerm(self_), spread_));
1889
+ if((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
1890
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
1891
+ }
1892
+ };
1893
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "]");
1894
+ return ff_compiler_Syntax.EList(at_, ff_compiler_Parser.Parser_freshUnificationVariable(self_, at_), ff_core_Stack.Stack_toList(items_, 0, 9007199254740991))
1895
+ }
1896
+
1897
+ export async function Parser_fail$(self_, at_, message_, $task) {
1898
+ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(at_)))
1899
+ }
1900
+
1901
+ export async function Parser_behind$(self_, $task) {
1902
+ if((self_.offset_ === 0)) {
1903
+ return ff_compiler_Parser.Parser_current(self_)
1904
+ } else {
1905
+ if(((self_.offset_ - 1) < ff_core_Array.Array_size(self_.tokens_))) {
1906
+ return ff_core_Array.Array_grab(self_.tokens_, (self_.offset_ - 1))
1907
+ } else {
1908
+ return self_.end_
1909
+ }
1910
+ }
1911
+ }
1912
+
1913
+ export async function Parser_current$(self_, $task) {
1914
+ if((self_.offset_ < ff_core_Array.Array_size(self_.tokens_))) {
1915
+ return ff_core_Array.Array_grab(self_.tokens_, self_.offset_)
1916
+ } else {
1917
+ return self_.end_
1918
+ }
1919
+ }
1920
+
1921
+ export async function Parser_ahead$(self_, $task) {
1922
+ if(((self_.offset_ + 1) < ff_core_Array.Array_size(self_.tokens_))) {
1923
+ return ff_core_Array.Array_grab(self_.tokens_, (self_.offset_ + 1))
1924
+ } else {
1925
+ return self_.end_
1926
+ }
1927
+ }
1928
+
1929
+ export async function Parser_aheadAhead$(self_, $task) {
1930
+ if(((self_.offset_ + 2) < ff_core_Array.Array_size(self_.tokens_))) {
1931
+ return ff_core_Array.Array_grab(self_.tokens_, (self_.offset_ + 2))
1932
+ } else {
1933
+ return self_.end_
1934
+ }
1935
+ }
1936
+
1937
+ export async function Parser_skip$(self_, kind_, $task) {
1938
+ const c_ = ff_compiler_Parser.Parser_current(self_);
1939
+ if(ff_core_Equal.notEquals_(c_.kind_, kind_, ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind)) {
1940
+ if(((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(kind_, ff_compiler_Token.LUpper())) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(c_.kind_, ff_compiler_Token.LLower()))) {
1941
+
1942
+ } else {
1943
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(c_), ((("Expected " + ff_compiler_Token.ff_core_Show_Show$ff_compiler_Token_TokenKind.show_(kind_)) + ", got ") + ff_compiler_Token.Token_raw(c_))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1944
+ }
1945
+ };
1946
+ self_.offset_ += 1;
1947
+ return c_
1948
+ }
1949
+
1950
+ export async function Parser_rawSkip$(self_, kind_, value_, $task) {
1951
+ const c_ = ff_compiler_Parser.Parser_current(self_);
1952
+ if(ff_core_Equal.notEquals_(c_.kind_, kind_, ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind)) {
1953
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (((value_ === ")") || (value_ === "]")) || (value_ === "}")))) {
1954
+
1955
+ } else {
1956
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(c_), ((((("Expected " + ff_compiler_Token.ff_core_Show_Show$ff_compiler_Token_TokenKind.show_(kind_)) + " ") + value_) + ", got ") + ff_compiler_Token.Token_raw(c_))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1957
+ }
1958
+ };
1959
+ if((!ff_compiler_Token.Token_rawIs(c_, value_))) {
1960
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (((value_ === ")") || (value_ === "]")) || (value_ === "}")))) {
1961
+ self_.offset_ -= 1
1962
+ } else {
1963
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(c_), ((("Expected " + value_) + " got ") + ff_compiler_Token.Token_raw(c_))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1964
+ }
1965
+ };
1966
+ self_.offset_ += 1;
1967
+ return c_
1968
+ }
1969
+
1970
+ export async function Parser_freshUnificationVariable$(self_, at_, $task) {
1971
+ const result_ = ff_compiler_Syntax.TVariable(at_, self_.nextUnificationVariableIndex_);
1972
+ self_.nextUnificationVariableIndex_ += 3;
1973
+ return result_
1974
+ }
1975
+
1976
+ export async function Parser_currentIsSeparator$(self_, kind_, $task) {
1977
+ return (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), kind_) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LSeparator()))
1978
+ }
1979
+
1980
+ export async function Parser_skipSeparator$(self_, kind_, $task) {
1981
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LSeparator())) {
1982
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LSeparator())
1983
+ } else {
1984
+ return ff_compiler_Parser.Parser_skip(self_, kind_)
1985
+ }
1986
+ }
1987
+
1988
+ export async function Parser_parseModuleWithoutPackageInfo$(self_, $task) {
1989
+ const moduleWithPackageInfo_ = ff_compiler_Parser.Parser_parseModuleWithPackageInfo(self_);
1990
+ ff_core_Option.Option_each(moduleWithPackageInfo_.packageInfo_, ((info_) => {
1991
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(info_.package_.at_, "Package and dependencies already declared in package.ff"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1992
+ }));
1993
+ return moduleWithPackageInfo_.module_
1994
+ }
1995
+
1996
+ export async function Parser_parseModuleWithPackageInfo$(self_, $task) {
1997
+ const packageInfo_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs3(ff_compiler_Parser.Parser_current(self_), "package", "dependency", "include"))
1998
+ ? ff_core_Option.Some(ff_compiler_Parser.Parser_parsePackageInfo(self_))
1999
+ : ff_core_Option.None());
2000
+ const module_ = ff_compiler_Parser.Parser_parseModule(self_);
2001
+ return ff_compiler_Syntax.ModuleWithPackageInfo(packageInfo_, module_)
2002
+ }
2003
+
2004
+ export async function Parser_parsePackageInfo$(self_, $task) {
2005
+ const location_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
2006
+ const package_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "package"))
2007
+ ? (await (async function() {
2008
+ const p_ = ff_compiler_Parser.Parser_parsePackageDefinition(self_);
2009
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
2010
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
2011
+ };
2012
+ return p_
2013
+ })())
2014
+ : ff_compiler_Syntax.DPackage(location_, self_.packagePair_, ff_compiler_Syntax.Version(location_, 0, 0, 0), ff_compiler_Syntax.TargetNames(self_.targetIsNode_, (!self_.targetIsNode_))));
2015
+ if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "package"))) {
2016
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Duplicate package definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2017
+ };
2018
+ const dependencies_ = ff_core_Stack.make_();
2019
+ while((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "dependency"))) {
2020
+ ff_core_Stack.Stack_push(dependencies_, ff_compiler_Parser.Parser_parseDependencyDefinition(self_, package_.targets_));
2021
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
2022
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
2023
+ }
2024
+ };
2025
+ const includes_ = ff_core_Stack.make_();
2026
+ while((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "include"))) {
2027
+ ff_core_Stack.Stack_push(includes_, ff_compiler_Parser.Parser_parseIncludeDefinition(self_));
2028
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
2029
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
2030
+ }
2031
+ };
2032
+ return ff_compiler_Syntax.PackageInfo(package_, ff_core_Stack.Stack_toList(dependencies_, 0, 9007199254740991), ff_core_Stack.Stack_toList(includes_, 0, 9007199254740991))
2033
+ }
2034
+
2035
+ export async function Parser_parseModule$(self_, $task) {
2036
+ const imports_ = ff_core_Stack.make_();
2037
+ const types_ = ff_core_Stack.make_();
2038
+ const traits_ = ff_core_Stack.make_();
2039
+ const instances_ = ff_core_Stack.make_();
2040
+ const extends_ = ff_core_Stack.make_();
2041
+ const lets_ = ff_core_Stack.make_();
2042
+ const functions_ = ff_core_Stack.make_();
2043
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
2044
+ if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower()) && (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LAssign()) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LColon())))) {
2045
+ ff_core_Stack.Stack_push(lets_, ff_compiler_Parser.Parser_parseLetDefinition(self_))
2046
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
2047
+ ff_core_Stack.Stack_push(functions_, ff_compiler_Parser.Parser_parseFunctionDefinition(self_, false))
2048
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "extend"))) {
2049
+ ff_core_Stack.Stack_push(extends_, ff_compiler_Parser.Parser_parseExtendDefinition(self_))
2050
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "trait"))) {
2051
+ ff_core_Stack.Stack_push(traits_, ff_compiler_Parser.Parser_parseTraitDefinition(self_))
2052
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "instance"))) {
2053
+ ff_core_Stack.Stack_push(instances_, ff_compiler_Parser.Parser_parseInstanceDefinition(self_))
2054
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs4(ff_compiler_Parser.Parser_current(self_), "data", "class", "capability", "newtype"))) {
2055
+ ff_core_Stack.Stack_push(types_, ff_compiler_Parser.Parser_parseTypeDefinition(self_))
2056
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "import"))) {
2057
+ ff_core_Stack.Stack_push(imports_, ff_compiler_Parser.Parser_parseImportDefinition(self_, self_.packagePair_))
2058
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "include"))) {
2059
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Includes must be at the top of the file or below 'package'"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2060
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "dependency"))) {
2061
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Dependencies must be at the top of the file or below 'package'"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2062
+ } else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "package"))) {
2063
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Package definition must be at the top of the file"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2064
+ } else {
2065
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LEnd())
2066
+ };
2067
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
2068
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
2069
+ }
2070
+ };
2071
+ return ff_compiler_Syntax.Module(self_.file_, self_.packagePair_, ff_core_Stack.Stack_toList(imports_, 0, 9007199254740991), ff_core_Stack.Stack_toList(types_, 0, 9007199254740991), ff_core_Stack.Stack_toList(traits_, 0, 9007199254740991), ff_core_Stack.Stack_toList(instances_, 0, 9007199254740991), ff_core_Stack.Stack_toList(extends_, 0, 9007199254740991), ff_core_Stack.Stack_toList(lets_, 0, 9007199254740991), ff_core_Stack.Stack_toList(functions_, 0, 9007199254740991))
2072
+ }
2073
+
2074
+ export async function Parser_parseLetDefinition$(self_, $task) {
2075
+ if(self_.lspHook_.trackSymbols_) {
2076
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2077
+ };
2078
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
2079
+ const variableType_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())
2080
+ ? (await (async function() {
2081
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2082
+ return ff_compiler_Parser.Parser_parseType(self_)
2083
+ })())
2084
+ : ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(nameToken_)));
2085
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
2086
+ const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
2087
+ const retult_ = ff_compiler_Syntax.DLet(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), variableType_, value_);
2088
+ if(self_.lspHook_.trackSymbols_) {
2089
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), 14, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2090
+ };
2091
+ return retult_
2092
+ }
2093
+
2094
+ export async function Parser_parseFunctionDefinition$(self_, member_, $task) {
2095
+ if(self_.lspHook_.trackSymbols_) {
2096
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2097
+ };
2098
+ const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, member_);
2099
+ const body_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")
2100
+ ? ff_core_Option.Some(ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), false, false))
2101
+ : ff_core_Option.None());
2102
+ const targets_ = ff_compiler_Parser.Parser_parseTargets(self_, ff_core_List.List_size(signature_.parameters_));
2103
+ const bestTarget_ = ff_compiler_Parser.findBestTarget_(self_.targetIsNode_, body_, targets_);
2104
+ const result_ = ff_compiler_Syntax.DFunction(signature_.at_, signature_, bestTarget_);
2105
+ if(self_.lspHook_.trackSymbols_) {
2106
+ const kind_ = (member_
2107
+ ? 6
2108
+ : 12);
2109
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(signature_.name_, kind_, signature_.at_, (((_c) => {
2110
+ return ff_compiler_Syntax.Location(_c.file_, _c.line_, (signature_.at_.column_ + ff_core_String.String_size(signature_.name_)))
2111
+ }))(signature_.at_), signature_.at_, ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2112
+ };
2113
+ return result_
2114
+ }
2115
+
2116
+ export async function Parser_parseTargets$(self_, parameterCount_, $task) {
2117
+ function processCode_(code_) {
2118
+ const dropCount_ = (ff_core_String.String_startsWith(code_, "\"\"\"", 0)
2119
+ ? 3
2120
+ : 1);
2121
+ return ff_core_String.String_replace(ff_core_String.String_replace(ff_core_String.String_replace(ff_core_String.String_replace(ff_core_String.String_replace(ff_core_String.String_dropLast(ff_core_String.String_dropFirst(code_, dropCount_), dropCount_), "\\\"", "\""), "\\r", "\r"), "\\n", "\n"), "\\t", "\t"), "\\\\", "\\")
2122
+ }
2123
+ let targets_ = ff_compiler_Parser.ParsedTargets(ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None());
2124
+ while(((ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon()) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LKeyword())) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_ahead(self_), "target"))) {
2125
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LSeparator());
2126
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
2127
+ const target_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
2128
+ ? ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()))
2129
+ : ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword())));
2130
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
2131
+ const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, parameterCount_, false, false);
2132
+ do {
2133
+ const _1 = target_;
2134
+ {
2135
+ if(_1 == "js") {
2136
+ if(ff_core_Equal.notEquals_(targets_.jsSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2137
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2138
+ };
2139
+ targets_ = (((_c) => {
2140
+ return ff_compiler_Parser.ParsedTargets(ff_core_Option.Some(lambda_), _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
2141
+ }))(targets_)
2142
+ break
2143
+ }
2144
+ }
2145
+ {
2146
+ if(_1 == "browser") {
2147
+ if(ff_core_Equal.notEquals_(targets_.browserSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2148
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2149
+ };
2150
+ targets_ = (((_c) => {
2151
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, ff_core_Option.Some(lambda_), _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
2152
+ }))(targets_)
2153
+ break
2154
+ }
2155
+ }
2156
+ {
2157
+ if(_1 == "node") {
2158
+ if(ff_core_Equal.notEquals_(targets_.nodeAsync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2159
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2160
+ };
2161
+ targets_ = (((_c) => {
2162
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, ff_core_Option.Some(lambda_), _c.nodeSync_, _c.nodeAsync_)
2163
+ }))(targets_)
2164
+ break
2165
+ }
2166
+ }
2167
+ {
2168
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Unknown target"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2169
+ break
2170
+ }
2171
+ } while(false)
2172
+ } else {
2173
+ const mode_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
2174
+ const code_ = processCode_(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString())));
2175
+ do {
2176
+ const _1 = ff_core_Pair.Pair(target_, mode_);
2177
+ {
2178
+ if(_1.first_ == "js") {
2179
+ if(_1.second_ == "sync") {
2180
+ if(ff_core_Equal.notEquals_(targets_.jsSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2181
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2182
+ };
2183
+ targets_ = (((_c) => {
2184
+ return ff_compiler_Parser.ParsedTargets(_c.js_, ff_core_Option.Some(code_), _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
2185
+ }))(targets_)
2186
+ break
2187
+ }
2188
+ }
2189
+ }
2190
+ {
2191
+ if(_1.first_ == "js") {
2192
+ if(_1.second_ == "async") {
2193
+ if(ff_core_Equal.notEquals_(targets_.jsAsync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2194
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2195
+ };
2196
+ targets_ = (((_c) => {
2197
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, ff_core_Option.Some(code_), _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
2198
+ }))(targets_)
2199
+ break
2200
+ }
2201
+ }
2202
+ }
2203
+ {
2204
+ if(_1.first_ == "browser") {
2205
+ if(_1.second_ == "sync") {
2206
+ if(ff_core_Equal.notEquals_(targets_.browserSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2207
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2208
+ };
2209
+ targets_ = (((_c) => {
2210
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, ff_core_Option.Some(code_), _c.browserAsync_, _c.node_, _c.nodeSync_, _c.nodeAsync_)
2211
+ }))(targets_)
2212
+ break
2213
+ }
2214
+ }
2215
+ }
2216
+ {
2217
+ if(_1.first_ == "browser") {
2218
+ if(_1.second_ == "async") {
2219
+ if(ff_core_Equal.notEquals_(targets_.browserAsync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2220
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2221
+ };
2222
+ targets_ = (((_c) => {
2223
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, ff_core_Option.Some(code_), _c.node_, _c.nodeSync_, _c.nodeAsync_)
2224
+ }))(targets_)
2225
+ break
2226
+ }
2227
+ }
2228
+ }
2229
+ {
2230
+ if(_1.first_ == "node") {
2231
+ if(_1.second_ == "sync") {
2232
+ if(ff_core_Equal.notEquals_(targets_.nodeSync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2233
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2234
+ };
2235
+ targets_ = (((_c) => {
2236
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, ff_core_Option.Some(code_), _c.nodeAsync_)
2237
+ }))(targets_)
2238
+ break
2239
+ }
2240
+ }
2241
+ }
2242
+ {
2243
+ if(_1.first_ == "node") {
2244
+ if(_1.second_ == "async") {
2245
+ if(ff_core_Equal.notEquals_(targets_.nodeAsync_, ff_core_Option.None(), ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
2246
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Duplicate target definition"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2247
+ };
2248
+ targets_ = (((_c) => {
2249
+ return ff_compiler_Parser.ParsedTargets(_c.js_, _c.jsSync_, _c.jsAsync_, _c.browser_, _c.browserSync_, _c.browserAsync_, _c.node_, _c.nodeSync_, ff_core_Option.Some(code_))
2250
+ }))(targets_)
2251
+ break
2252
+ }
2253
+ }
2254
+ }
2255
+ {
2256
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Unknown target or mode"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2257
+ break
2258
+ }
2259
+ } while(false)
2260
+ }
2261
+ };
2262
+ return targets_
2263
+ }
2264
+
2265
+ export async function Parser_parseSignature$(self_, member_, $task) {
2266
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
2267
+ const poly_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")
2268
+ ? ff_compiler_Parser.Parser_parseTypeParameters(self_)
2269
+ : ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty()));
2270
+ const parameters_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")))
2271
+ ? ff_core_List.Empty()
2272
+ : ff_compiler_Parser.Parser_parseFunctionParameters(self_, false));
2273
+ const returnType_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())
2274
+ ? (await (async function() {
2275
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2276
+ return ff_compiler_Parser.Parser_parseType(self_)
2277
+ })())
2278
+ : ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "ff:core/Unit.Unit", ff_core_List.Empty()));
2279
+ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(nameToken_), "TemporaryEffect$", ff_core_List.Empty());
2280
+ return ff_compiler_Syntax.Signature(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), member_, poly_.generics_, poly_.constraints_, parameters_, returnType_, temporaryEffect_)
2281
+ }
2282
+
2283
+ export async function Parser_parseExtendDefinition$(self_, $task) {
2284
+ if(self_.lspHook_.trackSymbols_) {
2285
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2286
+ };
2287
+ const extendToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "extend");
2288
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
2289
+ const poly_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")
2290
+ ? ff_compiler_Parser.Parser_parseTypeParameters(self_)
2291
+ : ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty()));
2292
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2293
+ const type_ = ff_compiler_Parser.Parser_parseType(self_);
2294
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
2295
+ const methods_ = ff_core_Stack.make_();
2296
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2297
+ ff_core_Stack.Stack_push(methods_, ff_compiler_Parser.Parser_parseFunctionDefinition(self_, true));
2298
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2299
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
2300
+ }
2301
+ };
2302
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
2303
+ if(self_.lspHook_.trackSymbols_) {
2304
+ let name_ = ff_compiler_Syntax.Type_show(type_, ff_core_List.Empty());
2305
+ ff_core_List.List_each(ff_core_List.List_zip(poly_.generics_, poly_.constraints_), ((_1) => {
2306
+ {
2307
+ const generic_ = _1.first_;
2308
+ const constraint_ = _1.second_;
2309
+ name_ = ff_core_String.String_replace(name_, (("[" + generic_) + "]"), (((("[" + generic_) + ": ") + constraint_.name_) + "]"));
2310
+ name_ = ff_core_String.String_replace(name_, (("[" + generic_) + ","), (((("[" + generic_) + ": ") + constraint_.name_) + ","));
2311
+ name_ = ff_core_String.String_replace(name_, ((", " + generic_) + ","), ((((", " + generic_) + ": ") + constraint_.name_) + ","));
2312
+ name_ = ff_core_String.String_replace(name_, ((", " + generic_) + "]"), ((((", " + generic_) + ": ") + constraint_.name_) + "]"))
2313
+ return
2314
+ }
2315
+ }));
2316
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(name_, 3, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(extendToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2317
+ };
2318
+ return ff_compiler_Syntax.DExtend(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), poly_.generics_, poly_.constraints_, type_, ff_core_Stack.Stack_toList(methods_, 0, 9007199254740991))
2319
+ }
2320
+
2321
+ export async function Parser_parseTraitDefinition$(self_, $task) {
2322
+ if(self_.lspHook_.trackSymbols_) {
2323
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2324
+ };
2325
+ const traitToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "trait");
2326
+ const typeParameterToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2327
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2328
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2329
+ const poly_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
2330
+ ? ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty())
2331
+ : ff_compiler_Parser.Parser_parseTypeParameters(self_));
2332
+ const constraints_ = ff_core_Stack.make_();
2333
+ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())) {
2334
+ ff_compiler_Parser.Parser_fail(self_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Trait constraints is not yet implemented");
2335
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2336
+ const constraint_ = ff_compiler_Parser.Parser_parseConstraint(self_);
2337
+ ff_core_Stack.Stack_push(constraints_, (((_c) => {
2338
+ return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.Link(ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(typeParameterToken_), ff_compiler_Token.Token_raw(typeParameterToken_), ff_core_List.Empty()), constraint_.generics_))
2339
+ }))(constraint_))
2340
+ };
2341
+ const generatorParameters_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "("))
2342
+ ? ff_core_List.Empty()
2343
+ : ff_compiler_Parser.Parser_parseFunctionParameters(self_, false));
2344
+ const methodGenerators_ = ff_core_Stack.make_();
2345
+ const methodDefaults_ = ff_core_Stack.make_();
2346
+ const methodSignatures_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{"))
2347
+ ? ff_core_List.Empty()
2348
+ : (await (async function() {
2349
+ const signatures_ = ff_core_Stack.make_();
2350
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
2351
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2352
+ if(self_.lspHook_.trackSymbols_) {
2353
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2354
+ };
2355
+ const signatureNameToken_ = ff_compiler_Parser.Parser_current(self_);
2356
+ const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, true);
2357
+ if(self_.lspHook_.trackSymbols_) {
2358
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(signatureNameToken_), 12, ff_compiler_Token.Token_at(signatureNameToken_), ff_compiler_Token.Token_end(signatureNameToken_), ff_compiler_Token.Token_at(signatureNameToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2359
+ };
2360
+ ff_core_Stack.Stack_push(signatures_, signature_);
2361
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
2362
+ const generator_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_ahead(self_), "generate"));
2363
+ const body_ = ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), true, false);
2364
+ if(generator_) {
2365
+ ff_core_Stack.Stack_push(methodGenerators_, ff_core_Pair.Pair(signature_.name_, body_))
2366
+ } else {
2367
+ ff_core_Stack.Stack_push(methodDefaults_, ff_core_Pair.Pair(signature_.name_, body_))
2368
+ }
2369
+ };
2370
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2371
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
2372
+ }
2373
+ };
2374
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
2375
+ return ff_core_Stack.Stack_toList(signatures_, 0, 9007199254740991)
2376
+ })()));
2377
+ if(self_.lspHook_.trackSymbols_) {
2378
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), 11, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(traitToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2379
+ };
2380
+ return ff_compiler_Syntax.DTrait(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), ff_core_List.Link(ff_compiler_Token.Token_raw(typeParameterToken_), poly_.generics_), ff_core_List.List_addAll(ff_core_Stack.Stack_toList(constraints_, 0, 9007199254740991), poly_.constraints_), generatorParameters_, methodSignatures_, ff_core_Stack.Stack_toList(methodDefaults_, 0, 9007199254740991), ff_core_Stack.Stack_toList(methodGenerators_, 0, 9007199254740991))
2381
+ }
2382
+
2383
+ export async function Parser_parseInstanceDefinition$(self_, $task) {
2384
+ if(self_.lspHook_.trackSymbols_) {
2385
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2386
+ };
2387
+ const instanceToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "instance");
2388
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2389
+ const poly_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
2390
+ ? ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty())
2391
+ : ff_compiler_Parser.Parser_parseTypeParameters(self_));
2392
+ const typeArguments_ = ff_core_Stack.make_();
2393
+ ff_core_Stack.Stack_push(typeArguments_, ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_core_List.List_map(poly_.generics_, ((_w1) => {
2394
+ return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), _w1, ff_core_List.Empty())
2395
+ }))));
2396
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2397
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2398
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")) {
2399
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "[");
2400
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2401
+ ff_core_Stack.Stack_push(typeArguments_, ff_compiler_Parser.Parser_parseType(self_));
2402
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2403
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
2404
+ }
2405
+ };
2406
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "]")
2407
+ };
2408
+ const generatorArguments_ = ff_compiler_Parser.Parser_parseFunctionArguments(self_, ff_compiler_Token.Token_at(nameToken_), false).first_;
2409
+ const methods_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{"))
2410
+ ? ff_core_List.Empty()
2411
+ : (await (async function() {
2412
+ const definitions_ = ff_core_Stack.make_();
2413
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
2414
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2415
+ ff_core_Stack.Stack_push(definitions_, ff_compiler_Parser.Parser_parseFunctionDefinition(self_, false));
2416
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2417
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
2418
+ }
2419
+ };
2420
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
2421
+ return ff_core_Stack.Stack_toList(definitions_, 0, 9007199254740991)
2422
+ })()));
2423
+ if(self_.lspHook_.trackSymbols_) {
2424
+ const name_ = ((ff_compiler_Token.Token_raw(token_) + ": ") + ff_compiler_Token.Token_raw(nameToken_));
2425
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(name_, 19, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(instanceToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2426
+ };
2427
+ return ff_compiler_Syntax.DInstance(ff_compiler_Token.Token_at(nameToken_), poly_.generics_, poly_.constraints_, ff_compiler_Token.Token_raw(nameToken_), ff_core_Stack.Stack_toList(typeArguments_, 0, 9007199254740991), generatorArguments_, methods_, false)
2428
+ }
2429
+
2430
+ export async function Parser_parseTypeDefinition$(self_, $task) {
2431
+ if(self_.lspHook_.trackSymbols_) {
2432
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2433
+ };
2434
+ const newtype_ = ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "newtype");
2435
+ const effectParameter_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "capability")
2436
+ ? ff_core_List.Link("Q$", ff_core_List.Empty())
2437
+ : ff_core_List.Empty());
2438
+ const allowMutable_ = ff_compiler_Token.Token_rawIs2(ff_compiler_Parser.Parser_current(self_), "class", "capability");
2439
+ const kindToken_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "newtype")
2440
+ ? ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "newtype")
2441
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "data")
2442
+ ? ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "data")
2443
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "class")
2444
+ ? ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "class")
2445
+ : ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "capability"));
2446
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2447
+ const poly_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
2448
+ ? ff_compiler_Parser.Poly(ff_core_List.Empty(), ff_core_List.Empty())
2449
+ : ff_compiler_Parser.Parser_parseTypeParameters(self_));
2450
+ if(((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
2451
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{")
2452
+ };
2453
+ const commonFields_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "("))
2454
+ ? ff_core_List.Empty()
2455
+ : ff_compiler_Parser.Parser_parseFunctionParameters(self_, true));
2456
+ const variants_ = ((newtype_ || (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))
2457
+ ? ff_core_List.Link(ff_compiler_Syntax.Variant(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), ff_core_List.Empty()), ff_core_List.Empty())
2458
+ : (await (async function() {
2459
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
2460
+ const variantsBuilder_ = ff_core_Stack.make_();
2461
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2462
+ if(self_.lspHook_.trackSymbols_) {
2463
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2464
+ };
2465
+ const variantNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2466
+ const variantFields_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "("))
2467
+ ? ff_core_List.Empty()
2468
+ : ff_compiler_Parser.Parser_parseFunctionParameters(self_, true));
2469
+ if(((!allowMutable_) && ff_core_List.List_any(variantFields_, ((_w1) => {
2470
+ return _w1.mutable_
2471
+ })))) {
2472
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_Option.Option_grab(ff_core_List.List_find(variantFields_, ((_w1) => {
2473
+ return _w1.mutable_
2474
+ }))).at_, "Only classes can have mutable fields"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2475
+ };
2476
+ ff_core_Stack.Stack_push(variantsBuilder_, ff_compiler_Syntax.Variant(ff_compiler_Token.Token_at(variantNameToken_), ff_compiler_Token.Token_raw(variantNameToken_), variantFields_));
2477
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2478
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
2479
+ };
2480
+ if(self_.lspHook_.trackSymbols_) {
2481
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(variantNameToken_), 10, ff_compiler_Token.Token_at(variantNameToken_), ff_compiler_Token.Token_end(variantNameToken_), ff_compiler_Token.Token_at(variantNameToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2482
+ }
2483
+ };
2484
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
2485
+ return ff_core_Stack.Stack_toList(variantsBuilder_, 0, 9007199254740991)
2486
+ })()));
2487
+ if((newtype_ && (ff_core_List.List_size(commonFields_) !== 1))) {
2488
+ ff_core_Log.show_(commonFields_, ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Parameter));
2489
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(nameToken_), "Newtypes must have exactly one field"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2490
+ };
2491
+ if(((!allowMutable_) && ff_core_List.List_any(commonFields_, ((_w1) => {
2492
+ return _w1.mutable_
2493
+ })))) {
2494
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_Option.Option_grab(ff_core_List.List_find(commonFields_, ((_w1) => {
2495
+ return _w1.mutable_
2496
+ }))).at_, "Only classes and capabilities can have mutable fields"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2497
+ };
2498
+ const generics_ = ff_core_List.List_addAll(effectParameter_, poly_.generics_);
2499
+ const result_ = ff_compiler_Syntax.DType(ff_compiler_Token.Token_at(nameToken_), newtype_, (!allowMutable_), ff_compiler_Token.Token_raw(nameToken_), generics_, poly_.constraints_, commonFields_, variants_);
2500
+ if(self_.lspHook_.trackSymbols_) {
2501
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), 5, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(kindToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2502
+ };
2503
+ return result_
2504
+ }
2505
+
2506
+ export async function Parser_parseImportDefinition$(self_, currentPackagePair_, $task) {
2507
+ const importToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "import");
2508
+ const path_ = ff_core_Stack.make_();
2509
+ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
2510
+ ff_core_Stack.Stack_push(path_, ff_compiler_Parser.Parser_parseDashedName(self_));
2511
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot())
2512
+ };
2513
+ const fileToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2514
+ const alias_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "as")
2515
+ ? (await (async function() {
2516
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "as");
2517
+ return ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper()))
2518
+ })())
2519
+ : ff_compiler_Token.Token_raw(fileToken_));
2520
+ const packagePair_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "from")
2521
+ ? (await (async function() {
2522
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "from");
2523
+ const userName_ = ff_compiler_Parser.Parser_parseDashedName(self_);
2524
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2525
+ const packageName_ = ff_compiler_Parser.Parser_parseDashedName(self_);
2526
+ return ff_compiler_Syntax.PackagePair(userName_, packageName_)
2527
+ })())
2528
+ : currentPackagePair_);
2529
+ return ff_compiler_Syntax.DImport(ff_compiler_Token.Token_at(fileToken_), alias_, packagePair_, ff_core_Stack.Stack_toList(path_, 0, 9007199254740991), ff_compiler_Token.Token_raw(fileToken_))
2530
+ }
2531
+
2532
+ export async function Parser_parsePackageDefinition$(self_, $task) {
2533
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
2534
+ const user_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()));
2535
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2536
+ const name_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()));
2537
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2538
+ const version_ = ff_compiler_Parser.Parser_parseVersion(self_);
2539
+ const targets_ = ff_compiler_Parser.Parser_parseTargetNames(self_, ff_compiler_Syntax.TargetNames(true, true));
2540
+ return ff_compiler_Syntax.DPackage(at_, ff_compiler_Syntax.PackagePair(user_, name_), version_, targets_)
2541
+ }
2542
+
2543
+ export async function Parser_parseDependencyDefinition$(self_, defaultTargetNames_, $task) {
2544
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
2545
+ const user_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()));
2546
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2547
+ const name_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()));
2548
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2549
+ const version_ = ff_compiler_Parser.Parser_parseVersion(self_);
2550
+ const safety_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "trusted")
2551
+ ? ff_compiler_Syntax.Trusted()
2552
+ : (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "unsafe")
2553
+ ? ff_compiler_Syntax.Unsafe()
2554
+ : ff_compiler_Syntax.Safe()));
2555
+ const targets_ = ff_compiler_Parser.Parser_parseTargetNames(self_, defaultTargetNames_);
2556
+ return ff_compiler_Syntax.DDependency(at_, ff_compiler_Syntax.PackagePair(user_, name_), version_, safety_, targets_)
2557
+ }
2558
+
2559
+ export async function Parser_parseIncludeDefinition$(self_, $task) {
2560
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
2561
+ const path_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString()));
2562
+ return ff_compiler_Syntax.DInclude(at_, ff_core_String.String_dropLast(ff_core_String.String_dropFirst(path_, 1), 1))
2563
+ }
2564
+
2565
+ export async function Parser_parseTargetNames$(self_, defaultTargets_, $task) {
2566
+ let targets_ = ff_compiler_Syntax.TargetNames(false, false);
2567
+ while(ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword(), ff_compiler_Token.LLower())) {
2568
+ const token_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
2569
+ ? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())
2570
+ : ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()));
2571
+ do {
2572
+ const _1 = ff_compiler_Token.Token_raw(token_);
2573
+ {
2574
+ if(_1 == "node") {
2575
+ const _guard1 = targets_.node_;
2576
+ if(_guard1) {
2577
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(token_), "Duplicate target name"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2578
+ break
2579
+ }
2580
+ }
2581
+ }
2582
+ {
2583
+ if(_1 == "node") {
2584
+ targets_ = (((_c) => {
2585
+ return ff_compiler_Syntax.TargetNames(true, _c.browser_)
2586
+ }))(targets_)
2587
+ break
2588
+ }
2589
+ }
2590
+ {
2591
+ if(_1 == "browser") {
2592
+ const _guard1 = targets_.browser_;
2593
+ if(_guard1) {
2594
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(token_), "Duplicate target name"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2595
+ break
2596
+ }
2597
+ }
2598
+ }
2599
+ {
2600
+ if(_1 == "browser") {
2601
+ targets_ = (((_c) => {
2602
+ return ff_compiler_Syntax.TargetNames(_c.node_, true)
2603
+ }))(targets_)
2604
+ break
2605
+ }
2606
+ }
2607
+ {
2608
+ const t_ = _1;
2609
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(token_), ("Unexpected target: " + t_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2610
+ break
2611
+ }
2612
+ } while(false)
2613
+ };
2614
+ if(((!targets_.node_) && (!targets_.browser_))) {
2615
+ return defaultTargets_
2616
+ } else {
2617
+ return targets_
2618
+ }
2619
+ }
2620
+
2621
+ export async function Parser_parseVersion$(self_, $task) {
2622
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LFloat())) {
2623
+ const majorMinor_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LFloat());
2624
+ const parts_ = ff_core_String.String_split(ff_compiler_Token.Token_raw(majorMinor_), 46);
2625
+ const patch_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())
2626
+ ? (await (async function() {
2627
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot());
2628
+ return ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt())))
2629
+ })())
2630
+ : 0);
2631
+ return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(majorMinor_), ff_core_String.String_grabInt(ff_core_Array.Array_grab(parts_, 0)), ff_core_String.String_grabInt(ff_core_Array.Array_grab(parts_, 1)), patch_)
2632
+ } else {
2633
+ const major_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt());
2634
+ return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(major_), ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(major_)), 0, 0)
2635
+ }
2636
+ }
2637
+
2638
+ export async function Parser_parseDashedName$(self_, $task) {
2639
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
2640
+ function readPart_() {
2641
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LInt())) {
2642
+ const prefix_ = ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt()));
2643
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
2644
+ return (prefix_ + ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())))
2645
+ } else {
2646
+ return prefix_
2647
+ }
2648
+ } else {
2649
+ return ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower()))
2650
+ }
2651
+ }
2652
+ let part_ = readPart_();
2653
+ while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "-")) {
2654
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
2655
+ part_ = ((part_ + "-") + readPart_())
2656
+ };
2657
+ if(ff_core_String.String_any(part_, ((_w1) => {
2658
+ return ff_core_Char.Char_isAsciiUpper(_w1)
2659
+ }))) {
2660
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("Package names and paths must not contain upper case letters: " + part_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2661
+ };
2662
+ if((ff_core_String.String_any(part_, ((_w1) => {
2663
+ return (_w1 === 95)
2664
+ })) || ff_core_String.String_any(part_, ((_w1) => {
2665
+ return (_w1 === 46)
2666
+ })))) {
2667
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ("Package names and paths must not contain underscores or dots: " + part_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
2668
+ };
2669
+ return part_
2670
+ }
2671
+
2672
+ export async function Parser_parseTypeParameters$(self_, $task) {
2673
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "[");
2674
+ const parameters_ = ff_core_Stack.make_();
2675
+ const constraints_ = ff_core_Stack.make_();
2676
+ while(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LSemicolon())))) {
2677
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LBracketLeft())) {
2678
+ ff_core_Stack.Stack_push(constraints_, ff_compiler_Parser.Parser_parseConstraint(self_))
2679
+ } else {
2680
+ const parameterNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2681
+ ff_core_Stack.Stack_push(parameters_, ff_compiler_Token.Token_raw(parameterNameToken_));
2682
+ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())) {
2683
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2684
+ const constraint_ = ff_compiler_Parser.Parser_parseConstraint(self_);
2685
+ ff_core_Stack.Stack_push(constraints_, (((_c) => {
2686
+ return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.Link(ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_raw(parameterNameToken_), ff_core_List.Empty()), constraint_.generics_))
2687
+ }))(constraint_))
2688
+ }
2689
+ };
2690
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2691
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
2692
+ }
2693
+ };
2694
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "]");
2695
+ return ff_compiler_Parser.Poly(ff_core_Stack.Stack_toList(parameters_, 0, 9007199254740991), ff_core_Stack.Stack_toList(constraints_, 0, 9007199254740991))
2696
+ }
2697
+
2698
+ export async function Parser_parseTypeArguments$(self_, parenthesis_ = false, $task) {
2699
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), (parenthesis_
2700
+ ? "("
2701
+ : "["));
2702
+ const types_ = ff_core_Stack.make_();
2703
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2704
+ ff_core_Stack.Stack_push(types_, ff_compiler_Parser.Parser_parseType(self_));
2705
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2706
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
2707
+ }
2708
+ };
2709
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), (parenthesis_
2710
+ ? ")"
2711
+ : "]"));
2712
+ return ff_core_Stack.Stack_toList(types_, 0, 9007199254740991)
2713
+ }
2714
+
2715
+ export async function Parser_parseFunctionParameters$(self_, allowMutable_ = false, $task) {
2716
+ const parameters_ = ff_core_Stack.make_();
2717
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
2718
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2719
+ const lspTrackSymbols_ = (self_.lspHook_.trackSymbols_ && allowMutable_);
2720
+ if(lspTrackSymbols_) {
2721
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
2722
+ };
2723
+ const lspFirst_ = ff_compiler_Parser.Parser_current(self_);
2724
+ const mutable_ = ((allowMutable_ && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword())) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "mutable"));
2725
+ if(mutable_) {
2726
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword())
2727
+ };
2728
+ const parameterNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
2729
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())))) {
2730
+ const t_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(parameterNameToken_), "ff:core/Nothing.Nothing", ff_core_List.Empty());
2731
+ ff_core_Stack.Stack_push(parameters_, ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), t_, ff_core_Option.None()));
2732
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2733
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
2734
+ }
2735
+ } else {
2736
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
2737
+ const parameterType_ = ff_compiler_Parser.Parser_parseType(self_);
2738
+ const default_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign()))
2739
+ ? ff_core_Option.None()
2740
+ : (await (async function() {
2741
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
2742
+ return ff_core_Option.Some(ff_compiler_Parser.Parser_parseTerm(self_))
2743
+ })()));
2744
+ ff_core_Stack.Stack_push(parameters_, ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), parameterType_, default_));
2745
+ if(lspTrackSymbols_) {
2746
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(parameterNameToken_), 7, ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_end(parameterNameToken_), ff_compiler_Token.Token_at(lspFirst_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
2747
+ };
2748
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2749
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
2750
+ }
2751
+ }
2752
+ };
2753
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
2754
+ return ff_core_Stack.Stack_toList(parameters_, 0, 9007199254740991)
2755
+ }
2756
+
2757
+ export async function Parser_parseFunctionArguments$(self_, callAt_, trailing_, $task) {
2758
+ const arguments_ = ff_core_Stack.make_();
2759
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
2760
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
2761
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2762
+ const argumentToken_ = ff_compiler_Parser.Parser_current(self_);
2763
+ const nameToken_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower()) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LAssign()))
2764
+ ? (await (async function() {
2765
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
2766
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
2767
+ return ff_core_Option.Some(token_)
2768
+ })())
2769
+ : ff_core_Option.None());
2770
+ const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
2771
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
2772
+ if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
2773
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, ff_core_Stack.Stack_size(arguments_), ff_core_Option.Option_map(nameToken_, ((_w1) => {
2774
+ return ff_compiler_Token.Token_raw(_w1)
2775
+ }))));
2776
+ self_.lspEmittedArgumentHook_ = true
2777
+ }
2778
+ };
2779
+ ff_core_Stack.Stack_push(arguments_, ff_compiler_Syntax.Argument(ff_compiler_Token.Token_at(argumentToken_), ff_core_Option.Option_map(nameToken_, ((_w1) => {
2780
+ return ff_compiler_Token.Token_raw(_w1)
2781
+ })), value_));
2782
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2783
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
2784
+ }
2785
+ };
2786
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
2787
+ if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
2788
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, ff_core_Stack.Stack_size(arguments_), ff_core_Option.None()));
2789
+ self_.lspEmittedArgumentHook_ = true
2790
+ }
2791
+ };
2792
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")")
2793
+ };
2794
+ let lastWasCurly_ = false;
2795
+ if(trailing_) {
2796
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower(), ff_compiler_Token.LUpper(), ff_compiler_Token.LString()) || ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LInt(), ff_compiler_Token.LChar(), ff_compiler_Token.LFloat())))) {
2797
+ lastWasCurly_ = true;
2798
+ const term_ = ff_compiler_Parser.Parser_parseTerm(self_);
2799
+ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(term_.at_, "TemporaryEffect$", ff_core_List.Empty());
2800
+ const cases_ = ff_core_List.Link(ff_compiler_Syntax.MatchCase(term_.at_, ff_core_List.Empty(), ff_core_List.Empty(), term_), ff_core_List.Empty());
2801
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
2802
+ if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
2803
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, ff_core_Stack.Stack_size(arguments_), ff_core_Option.None()));
2804
+ self_.lspEmittedArgumentHook_ = true
2805
+ }
2806
+ };
2807
+ ff_core_Stack.Stack_push(arguments_, ff_compiler_Syntax.Argument(term_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(term_.at_, ff_compiler_Syntax.Lambda(term_.at_, temporaryEffect_, cases_))))
2808
+ } else {
2809
+ while((ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{") || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()))) {
2810
+ lastWasCurly_ = ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{");
2811
+ const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, 0, false, true);
2812
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
2813
+ if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
2814
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, ff_core_Stack.Stack_size(arguments_), ff_core_Option.None()));
2815
+ self_.lspEmittedArgumentHook_ = true
2816
+ }
2817
+ };
2818
+ ff_core_Stack.Stack_push(arguments_, ff_compiler_Syntax.Argument(lambda_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(lambda_.at_, lambda_)))
2819
+ }
2820
+ }
2821
+ };
2822
+ return ff_core_Pair.Pair(ff_core_Stack.Stack_toList(arguments_, 0, 9007199254740991), lastWasCurly_)
2823
+ }
2824
+
2825
+ export async function Parser_parseLambda$(self_, defaultParameterCount_ = 0, ignoreGenerateKeyword_ = false, allowColon_ = false, $task) {
2826
+ const colon_ = (allowColon_ && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()));
2827
+ const token_ = (colon_
2828
+ ? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon())
2829
+ : ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{"));
2830
+ if(((ignoreGenerateKeyword_ && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword())) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "generate"))) {
2831
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword())
2832
+ };
2833
+ const result_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe())
2834
+ ? (await (async function() {
2835
+ const cases_ = ff_core_Stack.make_();
2836
+ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe())) {
2837
+ ff_core_Stack.Stack_push(cases_, ff_compiler_Parser.Parser_parseCase(self_))
2838
+ };
2839
+ return ff_core_Stack.Stack_toList(cases_, 0, 9007199254740991)
2840
+ })())
2841
+ : (ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower(), ff_compiler_Token.LWildcard()) && ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LComma(), ff_compiler_Token.LArrowThick()))
2842
+ ? (await (async function() {
2843
+ const parameters_ = ff_core_Stack.make_();
2844
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick()))) {
2845
+ const isVariable_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower());
2846
+ const parameterToken_ = (isVariable_
2847
+ ? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())
2848
+ : ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard()));
2849
+ ff_core_Stack.Stack_push(parameters_, ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(parameterToken_), (isVariable_
2850
+ ? ff_core_Option.Some(ff_compiler_Token.Token_raw(parameterToken_))
2851
+ : ff_core_Option.None())));
2852
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick()))) {
2853
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
2854
+ }
2855
+ };
2856
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick());
2857
+ const term_ = ff_compiler_Parser.Parser_parseStatements(self_);
2858
+ return ff_core_List.Link(ff_compiler_Syntax.MatchCase(ff_compiler_Token.Token_at(token_), ff_core_Stack.Stack_toList(parameters_, 0, 9007199254740991), ff_core_List.Empty(), term_), ff_core_List.Empty())
2859
+ })())
2860
+ : (await (async function() {
2861
+ const term_ = ff_compiler_Parser.Parser_parseStatements(self_);
2862
+ const wildcards_ = ff_compiler_Wildcards.make_();
2863
+ const e_ = ff_compiler_Wildcards.Wildcards_fixWildcards(wildcards_, term_);
2864
+ const arguments_ = ((wildcards_.seenWildcards_ !== 0)
2865
+ ? ff_core_List.List_map(ff_core_List.range_(wildcards_.seenWildcards_), ((i_) => {
2866
+ return ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(token_), ff_core_Option.Some(("_w" + (i_ + 1))))
2867
+ }))
2868
+ : ff_core_List.List_map(ff_core_List.range_(defaultParameterCount_), ((i_) => {
2869
+ return ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(token_), ff_core_Option.None())
2870
+ })));
2871
+ return ff_core_List.Link(ff_compiler_Syntax.MatchCase(ff_compiler_Token.Token_at(token_), arguments_, ff_core_List.Empty(), e_), ff_core_List.Empty())
2872
+ })()));
2873
+ if((!colon_)) {
2874
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}")
2875
+ };
2876
+ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), "TemporaryEffect$", ff_core_List.Empty());
2877
+ return ff_compiler_Syntax.Lambda(ff_compiler_Token.Token_at(token_), temporaryEffect_, result_)
2878
+ }
2879
+
2880
+ export async function Parser_parseCase$(self_, $task) {
2881
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe());
2882
+ const patterns_ = ff_core_Stack.make_();
2883
+ while(((!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick(), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
2884
+ ff_core_Stack.Stack_push(patterns_, ff_compiler_Parser.Parser_parsePattern(self_));
2885
+ if(((!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick(), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
2886
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
2887
+ }
2888
+ };
2889
+ const guards_ = ff_core_Stack.make_();
2890
+ while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
2891
+ ff_core_Stack.Stack_push(guards_, ff_compiler_Parser.Parser_parseCaseGuard(self_))
2892
+ };
2893
+ if(((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || (!ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())))) {
2894
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick())
2895
+ };
2896
+ const body_ = ff_compiler_Parser.Parser_parseStatements(self_);
2897
+ return ff_compiler_Syntax.MatchCase(ff_compiler_Token.Token_at(token_), ff_core_Stack.Stack_toList(patterns_, 0, 9007199254740991), ff_core_Stack.Stack_toList(guards_, 0, 9007199254740991), body_)
2898
+ }
2899
+
2900
+ export async function Parser_parseCaseGuard$(self_, $task) {
2901
+ const guardToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LBracketLeft());
2902
+ const term_ = ff_compiler_Parser.Parser_parseStatements(self_);
2903
+ const p_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe()))
2904
+ ? ff_compiler_Syntax.PVariant(ff_compiler_Token.Token_at(guardToken_), "True", ff_core_List.Empty())
2905
+ : (await (async function() {
2906
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe());
2907
+ return ff_compiler_Parser.Parser_parsePattern(self_)
2908
+ })()));
2909
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LBracketRight());
2910
+ return ff_compiler_Syntax.MatchGuard(ff_compiler_Token.Token_at(guardToken_), term_, p_)
2911
+ }
2912
+
2913
+ export async function Parser_parsePattern$(self_, $task) {
2914
+ const pattern_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LWildcard())
2915
+ ? (await (async function() {
2916
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard());
2917
+ return ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(token_), ff_core_Option.None())
2918
+ })())
2919
+ : ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
2920
+ ? (await (async function() {
2921
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
2922
+ return ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(token_), ff_core_Option.Some(ff_compiler_Token.Token_raw(token_)))
2923
+ })())
2924
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")
2925
+ ? (await (async function() {
2926
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
2927
+ const pair_ = ff_core_List.List_unzip(ff_compiler_Parser.Parser_parseRecordPattern(self_));
2928
+ return ff_compiler_Syntax.PVariant(at_, ("Record$" + ff_core_List.List_join(pair_.first_, "$")), pair_.second_)
2929
+ })())
2930
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")
2931
+ ? ff_compiler_Parser.Parser_parseListPattern(self_)
2932
+ : ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LString())
2933
+ ? (await (async function() {
2934
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString());
2935
+ return ff_compiler_Syntax.PString(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
2936
+ })())
2937
+ : ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LInt())
2938
+ ? (await (async function() {
2939
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt());
2940
+ return ff_compiler_Syntax.PInt(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
2941
+ })())
2942
+ : ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LChar())
2943
+ ? (await (async function() {
2944
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LChar());
2945
+ return ff_compiler_Syntax.PChar(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
2946
+ })())
2947
+ : (await (async function() {
2948
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
2949
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
2950
+ const patterns_ = ff_core_Stack.make_();
2951
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
2952
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2953
+ const pattern_ = ff_compiler_Parser.Parser_parsePattern(self_);
2954
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
2955
+ if(ff_compiler_LspHook.strictlyBetween_(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
2956
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_), ff_core_Stack.Stack_size(patterns_), ff_core_Option.None()));
2957
+ self_.lspEmittedArgumentHook_ = true
2958
+ }
2959
+ };
2960
+ ff_core_Stack.Stack_push(patterns_, pattern_);
2961
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
2962
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
2963
+ }
2964
+ };
2965
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
2966
+ if(ff_compiler_LspHook.strictlyBetween_(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
2967
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_), ff_core_Stack.Stack_size(patterns_), ff_core_Option.None()));
2968
+ self_.lspEmittedArgumentHook_ = true
2969
+ }
2970
+ };
2971
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
2972
+ return ff_compiler_Syntax.PVariant(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_core_Stack.Stack_toList(patterns_, 0, 9007199254740991))
2973
+ } else {
2974
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
2975
+ const asToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
2976
+ return ff_compiler_Syntax.PVariantAs(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_compiler_Token.Token_at(asToken_), ff_core_Option.Some(ff_compiler_Token.Token_raw(asToken_)))
2977
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LWildcard())) {
2978
+ const wildcardToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard());
2979
+ return ff_compiler_Syntax.PVariantAs(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_compiler_Token.Token_at(wildcardToken_), ff_core_Option.None())
2980
+ } else {
2981
+ return ff_compiler_Syntax.PVariant(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_core_List.Empty())
2982
+ }
2983
+ }
2984
+ })()));
2985
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "@")) {
2986
+ const atToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
2987
+ const asToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
2988
+ return ff_compiler_Syntax.PAlias(ff_compiler_Token.Token_at(asToken_), pattern_, ff_compiler_Token.Token_raw(asToken_))
2989
+ } else {
2990
+ return pattern_
2991
+ }
2992
+ }
2993
+
2994
+ export async function Parser_parseType$(self_, $task) {
2995
+ const leftTypes_ = (((ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(") && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LLower())) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_aheadAhead(self_), ff_compiler_Token.LColon()))
2996
+ ? (await (async function() {
2997
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
2998
+ const pair_ = ff_core_List.List_unzip(ff_compiler_Parser.Parser_parseRecordType(self_));
2999
+ return ff_core_List.Link(ff_compiler_Syntax.TConstructor(at_, ("Record$" + ff_core_List.List_join(pair_.first_, "$")), pair_.second_), ff_core_List.Empty())
3000
+ })())
3001
+ : ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")
3002
+ ? ff_compiler_Parser.Parser_parseTypeArguments(self_, true)
3003
+ : (await (async function() {
3004
+ const namespace_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace())
3005
+ ? ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace()))
3006
+ : "");
3007
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
3008
+ const arguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
3009
+ ? ff_core_List.Empty()
3010
+ : ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
3011
+ return ff_core_List.Link(ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), (namespace_ + ff_compiler_Token.Token_raw(token_)), arguments_), ff_core_List.Empty())
3012
+ })()));
3013
+ if(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick())) && (ff_core_List.List_size(leftTypes_) === 1))) {
3014
+ return ff_core_List.List_grabFirst(leftTypes_)
3015
+ } else {
3016
+ const arrowToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick());
3017
+ const rightType_ = ff_compiler_Parser.Parser_parseType(self_);
3018
+ return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(arrowToken_), ("Function$" + ff_core_List.List_size(leftTypes_)), ff_core_List.List_addAll(leftTypes_, ff_core_List.Link(rightType_, ff_core_List.Empty())))
3019
+ }
3020
+ }
3021
+
3022
+ export async function Parser_parseConstraint$(self_, $task) {
3023
+ const namespace_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace())
3024
+ ? ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace()))
3025
+ : "");
3026
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
3027
+ const arguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
3028
+ ? ff_core_List.Empty()
3029
+ : ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
3030
+ return ff_compiler_Syntax.Constraint(ff_compiler_Token.Token_at(token_), (namespace_ + ff_compiler_Token.Token_raw(token_)), arguments_)
3031
+ }
3032
+
3033
+ export async function Parser_parseStatements$(self_, $task) {
3034
+ if(ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight(), ff_compiler_Token.LPipe())) {
3035
+ return ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Unit", ff_core_List.Empty(), ff_core_Option.None())
3036
+ } else {
3037
+ let result_ = ff_compiler_Parser.Parser_parseStatement(self_);
3038
+ while(ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon())) {
3039
+ const token_ = ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon());
3040
+ result_ = ff_compiler_Syntax.ESequential(ff_compiler_Token.Token_at(token_), result_, ff_compiler_Parser.Parser_parseStatement(self_))
3041
+ };
3042
+ return result_
3043
+ }
3044
+ }
3045
+
3046
+ export async function Parser_parseStatement$(self_, $task) {
3047
+ if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "let") || ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "mutable")))) {
3048
+ return ff_compiler_Parser.Parser_parseLet(self_)
3049
+ } else {
3050
+ if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "function"))) {
3051
+ return ff_compiler_Parser.Parser_parseFunctions(self_)
3052
+ } else {
3053
+ const term_ = ff_compiler_Parser.Parser_parseTerm(self_);
3054
+ if(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())) && (!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignPlus(), ff_compiler_Token.LAssignMinus(), ff_compiler_Token.LAssignLink())))) {
3055
+ return term_
3056
+ } else {
3057
+ const token_ = ff_core_Core.do_((() => {
3058
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignPlus())) {
3059
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignPlus())
3060
+ } else {
3061
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignMinus())) {
3062
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignMinus())
3063
+ } else {
3064
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignLink())) {
3065
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignLink())
3066
+ } else {
3067
+ return ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign())
3068
+ }
3069
+ }
3070
+ }
3071
+ }));
3072
+ const operator_ = ff_core_String.String_dropLast(ff_compiler_Token.Token_raw(token_), 1);
3073
+ const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
3074
+ {
3075
+ const _1 = term_;
3076
+ {
3077
+ if(_1.EVariable) {
3078
+ const at_ = _1.at_;
3079
+ const name_ = _1.name_;
3080
+ return ff_compiler_Syntax.EAssign(at_, operator_, name_, value_)
3081
+ return
3082
+ }
3083
+ }
3084
+ {
3085
+ if(_1.EField) {
3086
+ const e_ = _1;
3087
+ return ff_compiler_Syntax.EAssignField(e_.at_, operator_, e_.record_, e_.field_, value_)
3088
+ return
3089
+ }
3090
+ }
3091
+ {
3092
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(token_), "Only variables and fields are assignable"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3093
+ return
3094
+ }
3095
+ }
3096
+ }
3097
+ }
3098
+ }
3099
+ }
3100
+
3101
+ export async function Parser_parseLet$(self_, $task) {
3102
+ if(self_.lspHook_.trackSymbols_) {
3103
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
3104
+ };
3105
+ const mutableToken_ = ff_compiler_Parser.Parser_current(self_);
3106
+ const mutable_ = ff_compiler_Token.Token_rawIs(mutableToken_, "mutable");
3107
+ const keywordToken_ = (mutable_
3108
+ ? ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "mutable")
3109
+ : ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "let"));
3110
+ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
3111
+ const valueType_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()))
3112
+ ? ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(nameToken_))
3113
+ : (await (async function() {
3114
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
3115
+ return ff_compiler_Parser.Parser_parseType(self_)
3116
+ })()));
3117
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())))) {
3118
+ const unit_ = ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(keywordToken_), "Unit", ff_core_List.Empty(), ff_core_Option.None());
3119
+ return ff_compiler_Syntax.ELet(ff_compiler_Token.Token_at(nameToken_), mutable_, ff_compiler_Token.Token_raw(nameToken_), valueType_, unit_, unit_)
3120
+ } else {
3121
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
3122
+ const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
3123
+ if(self_.lspHook_.trackSymbols_) {
3124
+ const kind_ = (mutable_
3125
+ ? 13
3126
+ : 14);
3127
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), kind_, ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(mutableToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
3128
+ };
3129
+ const body_ = (ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon())
3130
+ ? (await (async function() {
3131
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon());
3132
+ return ff_compiler_Parser.Parser_parseStatements(self_)
3133
+ })())
3134
+ : ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(keywordToken_), "Unit", ff_core_List.Empty(), ff_core_Option.None()));
3135
+ return ff_compiler_Syntax.ELet(ff_compiler_Token.Token_at(nameToken_), mutable_, ff_compiler_Token.Token_raw(nameToken_), valueType_, value_, body_)
3136
+ }
3137
+ }
3138
+
3139
+ export async function Parser_parseFunctions$(self_, $task) {
3140
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
3141
+ const functions_ = ff_core_Stack.make_();
3142
+ while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "function")) {
3143
+ if(self_.lspHook_.trackSymbols_) {
3144
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolBegin())
3145
+ };
3146
+ const functionAt_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "function"));
3147
+ const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, false);
3148
+ const body_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))
3149
+ ? (await (async function() {
3150
+ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(functionAt_, "TemporaryEffect$", ff_core_List.Empty());
3151
+ return ff_compiler_Syntax.Lambda(functionAt_, temporaryEffect_, ff_core_List.Empty())
3152
+ })())
3153
+ : ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), false, false));
3154
+ ff_core_Stack.Stack_push(functions_, ff_compiler_Syntax.DFunction(signature_.at_, signature_, ff_compiler_Syntax.FireflyTarget(body_)));
3155
+ if(self_.lspHook_.trackSymbols_) {
3156
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(signature_.name_, 12, signature_.at_, (((_c) => {
3157
+ return ff_compiler_Syntax.Location(_c.file_, _c.line_, (signature_.at_.column_ + ff_core_String.String_size(signature_.name_)))
3158
+ }))(signature_.at_), functionAt_, ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
3159
+ };
3160
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon())))) {
3161
+
3162
+ } else {
3163
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
3164
+ }
3165
+ };
3166
+ const body_ = ff_compiler_Parser.Parser_parseStatements(self_);
3167
+ return ff_compiler_Syntax.EFunctions(at_, ff_core_Stack.Stack_toList(functions_, 0, 9007199254740991), body_)
3168
+ }
3169
+
3170
+ export async function Parser_parseTerm$(self_, $task) {
3171
+ return ff_compiler_Parser.Parser_parseBinary(self_, 0)
3172
+ }
3173
+
3174
+ export async function Parser_parseBinary$(self_, level_, $task) {
3175
+ if((level_ >= ff_core_Array.Array_size(ff_compiler_Parser.binaryOperators_))) {
3176
+ return ff_compiler_Parser.Parser_parseUnary(self_)
3177
+ } else {
3178
+ const operators_ = ff_core_Array.Array_grab(ff_compiler_Parser.binaryOperators_, level_);
3179
+ let result_ = ff_compiler_Parser.Parser_parseBinary(self_, (level_ + 1));
3180
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LOperator())) {
3181
+ while(ff_core_List.List_any(operators_, ((value_) => {
3182
+ return ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), value_)
3183
+ }))) {
3184
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
3185
+ const right_ = ff_compiler_Parser.Parser_parseBinary(self_, (level_ + 1));
3186
+ const arguments_ = ff_core_List.Link(ff_compiler_Syntax.Argument(result_.at_, ff_core_Option.None(), result_), ff_core_List.Link(ff_compiler_Syntax.Argument(right_.at_, ff_core_Option.None(), right_), ff_core_List.Empty()));
3187
+ const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(token_));
3188
+ const target_ = (((_1) => {
3189
+ {
3190
+ if(_1 == "==") {
3191
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Equal.equals"), false)
3192
+ return
3193
+ }
3194
+ }
3195
+ {
3196
+ if(_1 == "!=") {
3197
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Equal.notEquals"), false)
3198
+ return
3199
+ }
3200
+ }
3201
+ {
3202
+ if(_1 == "<") {
3203
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Ordering.before"), false)
3204
+ return
3205
+ }
3206
+ }
3207
+ {
3208
+ if(_1 == "<=") {
3209
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Ordering.notAfter"), false)
3210
+ return
3211
+ }
3212
+ }
3213
+ {
3214
+ if(_1 == ">") {
3215
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Ordering.after"), false)
3216
+ return
3217
+ }
3218
+ }
3219
+ {
3220
+ if(_1 == ">=") {
3221
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), "ff:core/Ordering.notBefore"), false)
3222
+ return
3223
+ }
3224
+ }
3225
+ {
3226
+ const o_ = _1;
3227
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), o_), false)
3228
+ return
3229
+ }
3230
+ }))(ff_compiler_Token.Token_raw(token_));
3231
+ result_ = ff_compiler_Syntax.ECall(ff_compiler_Token.Token_at(token_), target_, effect_, ff_core_List.Empty(), arguments_, ff_core_List.Empty())
3232
+ }
3233
+ };
3234
+ return result_
3235
+ }
3236
+ }
3237
+
3238
+ export async function Parser_parseUnary$(self_, $task) {
3239
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LOperator())) {
3240
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
3241
+ const term_ = ff_compiler_Parser.Parser_parseUnary(self_);
3242
+ const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(token_));
3243
+ const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_)), false);
3244
+ return ff_compiler_Syntax.ECall(ff_compiler_Token.Token_at(token_), target_, effect_, ff_core_List.Empty(), ff_core_List.Link(ff_compiler_Syntax.Argument(term_.at_, ff_core_Option.None(), term_), ff_core_List.Empty()), ff_core_List.Empty())
3245
+ } else {
3246
+ return ff_compiler_Parser.Parser_parseFieldsAndCalls(self_)
3247
+ }
3248
+ }
3249
+
3250
+ export async function Parser_parseFieldsAndCalls$(self_, $task) {
3251
+ const tailCall_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "tailcall"))
3252
+ ? (await (async function() {
3253
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword());
3254
+ return true
3255
+ })())
3256
+ : false);
3257
+ let result_ = ff_compiler_Parser.Parser_parseAtom(self_);
3258
+ while(((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketLeft()) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot()))) {
3259
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())) {
3260
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot());
3261
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
3262
+ const term_ = ff_compiler_Parser.Parser_parseAtom(self_);
3263
+ const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, term_.at_);
3264
+ result_ = ff_compiler_Syntax.EPipe(term_.at_, result_, effect_, term_)
3265
+ } else if(ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LUpper(), ff_compiler_Token.LNamespace())) {
3266
+ result_ = ff_compiler_Parser.Parser_parseCopy(self_, result_)
3267
+ } else {
3268
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
3269
+ result_ = ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, result_, ff_compiler_Token.Token_raw(token_))
3270
+ }
3271
+ } else {
3272
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
3273
+ const typeArguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
3274
+ ? ff_core_List.Empty()
3275
+ : ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
3276
+ const arguments_ = ff_compiler_Parser.Parser_parseFunctionArguments(self_, result_.at_, true);
3277
+ const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, at_);
3278
+ const target_ = ff_compiler_Syntax.DynamicCall(result_, tailCall_);
3279
+ result_ = ff_compiler_Syntax.ECall(result_.at_, target_, effect_, typeArguments_, arguments_.first_, ff_core_List.Empty());
3280
+ if((arguments_.second_ && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower()))) {
3281
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
3282
+ result_ = ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, result_, ff_compiler_Token.Token_raw(token_))
3283
+ }
3284
+ }
3285
+ };
3286
+ return result_
3287
+ }
3288
+
3289
+ export async function Parser_parseAtom$(self_, $task) {
3290
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LString())) {
3291
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString());
3292
+ return ff_compiler_Syntax.EString(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
3293
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LChar())) {
3294
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LChar());
3295
+ return ff_compiler_Syntax.EChar(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
3296
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LInt())) {
3297
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt());
3298
+ return ff_compiler_Syntax.EInt(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
3299
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LFloat())) {
3300
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LFloat());
3301
+ return ff_compiler_Syntax.EFloat(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
3302
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
3303
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
3304
+ return ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_))
3305
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace())) {
3306
+ const namespaceToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace());
3307
+ const extraNamespace_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace()))
3308
+ ? ff_core_Option.None()
3309
+ : ff_core_Option.Some(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace()))));
3310
+ const prefix_ = (ff_compiler_Token.Token_raw(namespaceToken_) + ff_core_Option.Option_else(extraNamespace_, (() => {
3311
+ return ""
3312
+ })));
3313
+ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
3314
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
3315
+ return ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), (prefix_ + ff_compiler_Token.Token_raw(token_)))
3316
+ } else {
3317
+ return ff_compiler_Parser.Parser_parseVariant(self_, prefix_)
3318
+ }
3319
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LUpper())) {
3320
+ return ff_compiler_Parser.Parser_parseVariant(self_, "")
3321
+ } else if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
3322
+ const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, 0, false, false);
3323
+ return ff_compiler_Syntax.ELambda(lambda_.at_, lambda_)
3324
+ } else if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")) {
3325
+ return ff_compiler_Parser.Parser_parseList(self_)
3326
+ } else if(((ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(") && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LLower())) && ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_aheadAhead(self_), ff_compiler_Token.LAssign()))) {
3327
+ return ff_compiler_Syntax.ERecord(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), ff_compiler_Parser.Parser_parseRecord(self_, ff_core_Option.None()))
3328
+ } else if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
3329
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
3330
+ const result_ = ff_compiler_Parser.Parser_parseTerm(self_);
3331
+ while((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LComma()))) {
3332
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma());
3333
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
3334
+ ff_compiler_Parser.Parser_parseTerm(self_)
3335
+ }
3336
+ };
3337
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
3338
+ return result_
3339
+ } else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LWildcard())) {
3340
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard());
3341
+ return ff_compiler_Syntax.EWildcard(ff_compiler_Token.Token_at(token_), 0)
3342
+ } else {
3343
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), ("Expected atom, got " + ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_current(self_)))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3344
+ }
3345
+ }
3346
+
3347
+ export async function Parser_parseVariant$(self_, prefix_, $task) {
3348
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
3349
+ const name_ = (prefix_ + ff_compiler_Token.Token_raw(token_));
3350
+ const typeArguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
3351
+ ? ff_core_List.Empty()
3352
+ : ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
3353
+ if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "?")) {
3354
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LOperator());
3355
+ return ff_compiler_Syntax.EVariantIs(ff_compiler_Token.Token_at(token_), name_, typeArguments_)
3356
+ } else {
3357
+ const arguments_ = ff_core_Option.Some(ff_compiler_Parser.Parser_parseFunctionArguments(self_, ff_compiler_Token.Token_at(token_), true));
3358
+ return ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(token_), name_, typeArguments_, ff_core_Option.Option_map(arguments_, ((_w1) => {
3359
+ return _w1.first_
3360
+ })))
3361
+ }
3362
+ }
3363
+
3364
+ export async function Parser_parseCopy$(self_, record_, $task) {
3365
+ const namespace_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace()))
3366
+ ? ""
3367
+ : ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace())));
3368
+ const extraNamespace_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LNamespace()))
3369
+ ? ""
3370
+ : ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LNamespace())));
3371
+ const prefix_ = (namespace_ + extraNamespace_);
3372
+ const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
3373
+ const name_ = (prefix_ + ff_compiler_Token.Token_raw(token_));
3374
+ const fields_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")))
3375
+ ? ff_core_List.Empty()
3376
+ : ff_compiler_Parser.Parser_parseRecord(self_, ff_core_Option.Some(ff_compiler_Token.Token_at(token_))));
3377
+ return ff_compiler_Syntax.ECopy(ff_compiler_Token.Token_at(token_), name_, record_, fields_)
3378
+ }
3379
+
3380
+ export async function Parser_parseRecord$(self_, copyAt_, $task) {
3381
+ const fields_ = ff_core_Stack.make_();
3382
+ const startBracketAt_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "("));
3383
+ const startAt_ = ff_core_Option.Option_else(copyAt_, (() => {
3384
+ return startBracketAt_
3385
+ }));
3386
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
3387
+ const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
3388
+ const field_ = (((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign()))
3389
+ ? (await (async function() {
3390
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
3391
+ return ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseTerm(self_))
3392
+ })())
3393
+ : ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_))));
3394
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
3395
+ if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
3396
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_, ff_core_Stack.Stack_size(fields_), ff_core_Option.Option_filter(ff_core_Option.Some(field_.name_), ((_w1) => {
3397
+ return (_w1 !== "")
3398
+ }))));
3399
+ self_.lspEmittedArgumentHook_ = true
3400
+ }
3401
+ };
3402
+ ff_core_Stack.Stack_push(fields_, field_);
3403
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
3404
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
3405
+ }
3406
+ };
3407
+ if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
3408
+ if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
3409
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_, ff_core_Stack.Stack_size(fields_), ff_core_Option.None()));
3410
+ self_.lspEmittedArgumentHook_ = true
3411
+ }
3412
+ };
3413
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
3414
+ return ff_core_Stack.Stack_toList(fields_, 0, 9007199254740991)
3415
+ }
3416
+
3417
+ export async function Parser_parseRecordType$(self_, $task) {
3418
+ const fields_ = ff_core_Stack.make_();
3419
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
3420
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
3421
+ const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
3422
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LColon());
3423
+ ff_core_Stack.Stack_push(fields_, ff_core_Pair.Pair(ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseType(self_)));
3424
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
3425
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
3426
+ }
3427
+ };
3428
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
3429
+ return ff_core_List.List_sortBy(ff_core_Stack.Stack_toList(fields_, 0, 9007199254740991), ((_w1) => {
3430
+ return _w1.first_
3431
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
3432
+ }
3433
+
3434
+ export async function Parser_parseRecordPattern$(self_, $task) {
3435
+ const fields_ = ff_core_Stack.make_();
3436
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
3437
+ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
3438
+ const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
3439
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
3440
+ ff_core_Stack.Stack_push(fields_, ff_core_Pair.Pair(ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parsePattern(self_)));
3441
+ if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
3442
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
3443
+ }
3444
+ };
3445
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), ")");
3446
+ return ff_core_List.List_sortBy(ff_core_Stack.Stack_toList(fields_, 0, 9007199254740991), ((_w1) => {
3447
+ return _w1.first_
3448
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
3449
+ }
3450
+
3451
+ export async function Parser_parseListPattern$(self_, $task) {
3452
+ function convertListPattern_(at_, items_) {
3453
+ {
3454
+ const at_a = at_;
3455
+ const items_a = items_;
3456
+ {
3457
+ if(items_a.Empty) {
3458
+ return ff_compiler_Syntax.PVariant(at_, "ff:core/List.Empty", ff_core_List.Empty())
3459
+ return
3460
+ }
3461
+ }
3462
+ {
3463
+ if(items_a.Link) {
3464
+ const p_ = items_a.head_.first_;
3465
+ if(!items_a.head_.second_) {
3466
+ const ps_ = items_a.tail_;
3467
+ return ff_compiler_Syntax.PVariant(at_, "ff:core/List.Link", ff_core_List.Link(p_, ff_core_List.Link(convertListPattern_(at_, ps_), ff_core_List.Empty())))
3468
+ return
3469
+ }
3470
+ }
3471
+ }
3472
+ {
3473
+ if(items_a.Link) {
3474
+ const p_ = items_a.head_.first_;
3475
+ if(items_a.head_.second_) {
3476
+ if(items_a.tail_.Empty) {
3477
+ return p_
3478
+ return
3479
+ }
3480
+ }
3481
+ }
3482
+ }
3483
+ {
3484
+ if(items_a.Link) {
3485
+ const p_ = items_a.head_.first_;
3486
+ if(items_a.head_.second_) {
3487
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(p_.at_, "Invalid pattern: ... is only allowed for the last element in a list"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3488
+ return
3489
+ }
3490
+ }
3491
+ }
3492
+ }
3493
+ }
3494
+ const items_ = ff_core_Stack.make_();
3495
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "["));
3496
+ while((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
3497
+ const spread_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDotDotDot());
3498
+ if(spread_) {
3499
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDotDotDot())
3500
+ };
3501
+ const pattern_ = ((spread_ && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))
3502
+ ? ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), ff_core_Option.None())
3503
+ : ff_compiler_Parser.Parser_parsePattern(self_));
3504
+ ff_core_Stack.Stack_push(items_, ff_core_Pair.Pair(pattern_, spread_));
3505
+ if((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
3506
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
3507
+ }
3508
+ };
3509
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "]");
3510
+ return convertListPattern_(at_, ff_core_Stack.Stack_toList(items_, 0, 9007199254740991))
3511
+ }
3512
+
3513
+ export async function Parser_parseList$(self_, $task) {
3514
+ const items_ = ff_core_Stack.make_();
3515
+ const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "["));
3516
+ while((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
3517
+ const spread_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDotDotDot());
3518
+ if(spread_) {
3519
+ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDotDotDot())
3520
+ };
3521
+ ff_core_Stack.Stack_push(items_, ff_core_Pair.Pair(ff_compiler_Parser.Parser_parseTerm(self_), spread_));
3522
+ if((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
3523
+ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
3524
+ }
3525
+ };
3526
+ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "]");
3527
+ return ff_compiler_Syntax.EList(at_, ff_compiler_Parser.Parser_freshUnificationVariable(self_, at_), ff_core_Stack.Stack_toList(items_, 0, 9007199254740991))
3528
+ }
3529
+
3530
+ export const ff_core_Any_HasAnyTag$ff_compiler_Parser_Poly = {
3531
+ anyTag_() {
3532
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Parser.Poly" + "[") + "]"))
3533
+ },
3534
+ async anyTag_$($task) {
3535
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Parser.Poly" + "[") + "]"))
3536
+ }
3537
+ };
3538
+
3539
+ export const ff_core_Any_HasAnyTag$ff_compiler_Parser_ParsedTargets = {
3540
+ anyTag_() {
3541
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Parser.ParsedTargets" + "[") + "]"))
3542
+ },
3543
+ async anyTag_$($task) {
3544
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Parser.ParsedTargets" + "[") + "]"))
3545
+ }
3546
+ };
3547
+
3548
+ export const ff_core_Show_Show$ff_compiler_Parser_Poly = {
3549
+ show_(value_) {
3550
+ {
3551
+ const value_a = value_;
3552
+ {
3553
+ const z_ = value_a;
3554
+ return ((((("Poly" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.generics_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Constraint).show_(z_.constraints_)) + ")")
3555
+ return
3556
+ }
3557
+ }
3558
+ },
3559
+ async show_$(value_, $task) {
3560
+ {
3561
+ const value_a = value_;
3562
+ {
3563
+ const z_ = value_a;
3564
+ return ((((("Poly" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.generics_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Constraint).show_(z_.constraints_)) + ")")
3565
+ return
3566
+ }
3567
+ }
3568
+ }
3569
+ };
3570
+
3571
+ export const ff_core_Show_Show$ff_compiler_Parser_ParsedTargets = {
3572
+ show_(value_) {
3573
+ {
3574
+ const value_a = value_;
3575
+ {
3576
+ const z_ = value_a;
3577
+ return ((((((((((((((((((("ParsedTargets" + "(") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Lambda).show_(z_.js_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.jsSync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.jsAsync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Lambda).show_(z_.browser_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.browserSync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.browserAsync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Lambda).show_(z_.node_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.nodeSync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.nodeAsync_)) + ")")
3578
+ return
3579
+ }
3580
+ }
3581
+ },
3582
+ async show_$(value_, $task) {
3583
+ {
3584
+ const value_a = value_;
3585
+ {
3586
+ const z_ = value_a;
3587
+ return ((((((((((((((((((("ParsedTargets" + "(") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Lambda).show_(z_.js_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.jsSync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.jsAsync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Lambda).show_(z_.browser_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.browserSync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.browserAsync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Lambda).show_(z_.node_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.nodeSync_)) + ", ") + ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.nodeAsync_)) + ")")
3588
+ return
3589
+ }
3590
+ }
3591
+ }
3592
+ };
3593
+
3594
+ export const ff_core_Equal_Equal$ff_compiler_Parser_Poly = {
3595
+ equals_(x_, y_) {
3596
+ {
3597
+ const x_a = x_;
3598
+ const y_a = y_;
3599
+ {
3600
+ const _guard1 = (x_ === y_);
3601
+ if(_guard1) {
3602
+ return true
3603
+ return
3604
+ }
3605
+ }
3606
+ {
3607
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.generics_, y_.generics_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Constraint).equals_(x_.constraints_, y_.constraints_))
3608
+ return
3609
+ }
3610
+ }
3611
+ },
3612
+ async equals_$(x_, y_, $task) {
3613
+ {
3614
+ const x_a = x_;
3615
+ const y_a = y_;
3616
+ {
3617
+ const _guard1 = (x_ === y_);
3618
+ if(_guard1) {
3619
+ return true
3620
+ return
3621
+ }
3622
+ }
3623
+ {
3624
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.generics_, y_.generics_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Constraint).equals_(x_.constraints_, y_.constraints_))
3625
+ return
3626
+ }
3627
+ }
3628
+ }
3629
+ };
3630
+
3631
+ export const ff_core_Equal_Equal$ff_compiler_Parser_ParsedTargets = {
3632
+ equals_(x_, y_) {
3633
+ {
3634
+ const x_a = x_;
3635
+ const y_a = y_;
3636
+ {
3637
+ const _guard1 = (x_ === y_);
3638
+ if(_guard1) {
3639
+ return true
3640
+ return
3641
+ }
3642
+ }
3643
+ {
3644
+ return (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Lambda).equals_(x_.js_, y_.js_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.jsSync_, y_.jsSync_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.jsAsync_, y_.jsAsync_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Lambda).equals_(x_.browser_, y_.browser_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.browserSync_, y_.browserSync_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.browserAsync_, y_.browserAsync_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Lambda).equals_(x_.node_, y_.node_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.nodeSync_, y_.nodeSync_) && ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.nodeAsync_, y_.nodeAsync_)))))))))
3645
+ return
3646
+ }
3647
+ }
3648
+ },
3649
+ async equals_$(x_, y_, $task) {
3650
+ {
3651
+ const x_a = x_;
3652
+ const y_a = y_;
3653
+ {
3654
+ const _guard1 = (x_ === y_);
3655
+ if(_guard1) {
3656
+ return true
3657
+ return
3658
+ }
3659
+ }
3660
+ {
3661
+ return (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Lambda).equals_(x_.js_, y_.js_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.jsSync_, y_.jsSync_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.jsAsync_, y_.jsAsync_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Lambda).equals_(x_.browser_, y_.browser_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.browserSync_, y_.browserSync_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.browserAsync_, y_.browserAsync_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Lambda).equals_(x_.node_, y_.node_) && (ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.nodeSync_, y_.nodeSync_) && ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.nodeAsync_, y_.nodeAsync_)))))))))
3662
+ return
3663
+ }
3664
+ }
3665
+ }
3666
+ };
3667
+
3668
+ export const ff_core_Ordering_Order$ff_compiler_Parser_Poly = {
3669
+ compare_(x_, y_) {
3670
+ {
3671
+ const x_a = x_;
3672
+ const y_a = y_;
3673
+ {
3674
+ const _guard1 = (x_ === y_);
3675
+ if(_guard1) {
3676
+ return ff_core_Ordering.OrderingSame()
3677
+ return
3678
+ }
3679
+ }
3680
+ {
3681
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.generics_, y_.generics_);
3682
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
3683
+ return genericsOrdering_
3684
+ } else {
3685
+ const constraintsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Constraint).compare_(x_.constraints_, y_.constraints_);
3686
+ if((constraintsOrdering_ !== ff_core_Ordering.OrderingSame())) {
3687
+ return constraintsOrdering_
3688
+ } else {
3689
+ return ff_core_Ordering.OrderingSame()
3690
+ }
3691
+ }
3692
+ return
3693
+ }
3694
+ }
3695
+ },
3696
+ async compare_$(x_, y_, $task) {
3697
+ {
3698
+ const x_a = x_;
3699
+ const y_a = y_;
3700
+ {
3701
+ const _guard1 = (x_ === y_);
3702
+ if(_guard1) {
3703
+ return ff_core_Ordering.OrderingSame()
3704
+ return
3705
+ }
3706
+ }
3707
+ {
3708
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.generics_, y_.generics_);
3709
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
3710
+ return genericsOrdering_
3711
+ } else {
3712
+ const constraintsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Constraint).compare_(x_.constraints_, y_.constraints_);
3713
+ if((constraintsOrdering_ !== ff_core_Ordering.OrderingSame())) {
3714
+ return constraintsOrdering_
3715
+ } else {
3716
+ return ff_core_Ordering.OrderingSame()
3717
+ }
3718
+ }
3719
+ return
3720
+ }
3721
+ }
3722
+ }
3723
+ };
3724
+
3725
+ export const ff_core_Ordering_Order$ff_compiler_Parser_ParsedTargets = {
3726
+ compare_(x_, y_) {
3727
+ {
3728
+ const x_a = x_;
3729
+ const y_a = y_;
3730
+ {
3731
+ const _guard1 = (x_ === y_);
3732
+ if(_guard1) {
3733
+ return ff_core_Ordering.OrderingSame()
3734
+ return
3735
+ }
3736
+ }
3737
+ {
3738
+ const jsOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Lambda).compare_(x_.js_, y_.js_);
3739
+ if((jsOrdering_ !== ff_core_Ordering.OrderingSame())) {
3740
+ return jsOrdering_
3741
+ } else {
3742
+ const jsSyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.jsSync_, y_.jsSync_);
3743
+ if((jsSyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3744
+ return jsSyncOrdering_
3745
+ } else {
3746
+ const jsAsyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.jsAsync_, y_.jsAsync_);
3747
+ if((jsAsyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3748
+ return jsAsyncOrdering_
3749
+ } else {
3750
+ const browserOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Lambda).compare_(x_.browser_, y_.browser_);
3751
+ if((browserOrdering_ !== ff_core_Ordering.OrderingSame())) {
3752
+ return browserOrdering_
3753
+ } else {
3754
+ const browserSyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.browserSync_, y_.browserSync_);
3755
+ if((browserSyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3756
+ return browserSyncOrdering_
3757
+ } else {
3758
+ const browserAsyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.browserAsync_, y_.browserAsync_);
3759
+ if((browserAsyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3760
+ return browserAsyncOrdering_
3761
+ } else {
3762
+ const nodeOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Lambda).compare_(x_.node_, y_.node_);
3763
+ if((nodeOrdering_ !== ff_core_Ordering.OrderingSame())) {
3764
+ return nodeOrdering_
3765
+ } else {
3766
+ const nodeSyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.nodeSync_, y_.nodeSync_);
3767
+ if((nodeSyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3768
+ return nodeSyncOrdering_
3769
+ } else {
3770
+ const nodeAsyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.nodeAsync_, y_.nodeAsync_);
3771
+ if((nodeAsyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3772
+ return nodeAsyncOrdering_
3773
+ } else {
3774
+ return ff_core_Ordering.OrderingSame()
3775
+ }
3776
+ }
3777
+ }
3778
+ }
3779
+ }
3780
+ }
3781
+ }
3782
+ }
3783
+ }
3784
+ return
3785
+ }
3786
+ }
3787
+ },
3788
+ async compare_$(x_, y_, $task) {
3789
+ {
3790
+ const x_a = x_;
3791
+ const y_a = y_;
3792
+ {
3793
+ const _guard1 = (x_ === y_);
3794
+ if(_guard1) {
3795
+ return ff_core_Ordering.OrderingSame()
3796
+ return
3797
+ }
3798
+ }
3799
+ {
3800
+ const jsOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Lambda).compare_(x_.js_, y_.js_);
3801
+ if((jsOrdering_ !== ff_core_Ordering.OrderingSame())) {
3802
+ return jsOrdering_
3803
+ } else {
3804
+ const jsSyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.jsSync_, y_.jsSync_);
3805
+ if((jsSyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3806
+ return jsSyncOrdering_
3807
+ } else {
3808
+ const jsAsyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.jsAsync_, y_.jsAsync_);
3809
+ if((jsAsyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3810
+ return jsAsyncOrdering_
3811
+ } else {
3812
+ const browserOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Lambda).compare_(x_.browser_, y_.browser_);
3813
+ if((browserOrdering_ !== ff_core_Ordering.OrderingSame())) {
3814
+ return browserOrdering_
3815
+ } else {
3816
+ const browserSyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.browserSync_, y_.browserSync_);
3817
+ if((browserSyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3818
+ return browserSyncOrdering_
3819
+ } else {
3820
+ const browserAsyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.browserAsync_, y_.browserAsync_);
3821
+ if((browserAsyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3822
+ return browserAsyncOrdering_
3823
+ } else {
3824
+ const nodeOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Lambda).compare_(x_.node_, y_.node_);
3825
+ if((nodeOrdering_ !== ff_core_Ordering.OrderingSame())) {
3826
+ return nodeOrdering_
3827
+ } else {
3828
+ const nodeSyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.nodeSync_, y_.nodeSync_);
3829
+ if((nodeSyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3830
+ return nodeSyncOrdering_
3831
+ } else {
3832
+ const nodeAsyncOrdering_ = ff_core_Option.ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.nodeAsync_, y_.nodeAsync_);
3833
+ if((nodeAsyncOrdering_ !== ff_core_Ordering.OrderingSame())) {
3834
+ return nodeAsyncOrdering_
3835
+ } else {
3836
+ return ff_core_Ordering.OrderingSame()
3837
+ }
3838
+ }
3839
+ }
3840
+ }
3841
+ }
3842
+ }
3843
+ }
3844
+ }
3845
+ }
3846
+ return
3847
+ }
3848
+ }
3849
+ }
3850
+ };
3851
+
3852
+ export const ff_core_Serializable_Serializable$ff_compiler_Parser_Poly = {
3853
+ serializeUsing_(serialization_, value_) {
3854
+ {
3855
+ const serialization_a = serialization_;
3856
+ const value_a = value_;
3857
+ {
3858
+ const v_ = value_a;
3859
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 23), 0);
3860
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
3861
+ serialization_.offset_ += 1;
3862
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.generics_);
3863
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).serializeUsing_(serialization_, v_.constraints_)
3864
+ return
3865
+ }
3866
+ }
3867
+ },
3868
+ deserializeUsing_(serialization_) {
3869
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
3870
+ serialization_.offset_ += 1;
3871
+ {
3872
+ const _1 = variantIndex_;
3873
+ {
3874
+ if(_1 == 0) {
3875
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 23), 0);
3876
+ return ff_compiler_Parser.Poly(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).deserializeUsing_(serialization_))
3877
+ return
3878
+ }
3879
+ }
3880
+ {
3881
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
3882
+ return
3883
+ }
3884
+ }
3885
+ },
3886
+ async serializeUsing_$(serialization_, value_, $task) {
3887
+ {
3888
+ const serialization_a = serialization_;
3889
+ const value_a = value_;
3890
+ {
3891
+ const v_ = value_a;
3892
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 23), 0);
3893
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
3894
+ serialization_.offset_ += 1;
3895
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.generics_);
3896
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).serializeUsing_(serialization_, v_.constraints_)
3897
+ return
3898
+ }
3899
+ }
3900
+ },
3901
+ async deserializeUsing_$(serialization_, $task) {
3902
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
3903
+ serialization_.offset_ += 1;
3904
+ {
3905
+ const _1 = variantIndex_;
3906
+ {
3907
+ if(_1 == 0) {
3908
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 23), 0);
3909
+ return ff_compiler_Parser.Poly(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).deserializeUsing_(serialization_))
3910
+ return
3911
+ }
3912
+ }
3913
+ {
3914
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
3915
+ return
3916
+ }
3917
+ }
3918
+ }
3919
+ };
3920
+
3921
+ export const ff_core_Serializable_Serializable$ff_compiler_Parser_ParsedTargets = {
3922
+ serializeUsing_(serialization_, value_) {
3923
+ {
3924
+ const serialization_a = serialization_;
3925
+ const value_a = value_;
3926
+ {
3927
+ const v_ = value_a;
3928
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
3929
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
3930
+ serialization_.offset_ += 1;
3931
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).serializeUsing_(serialization_, v_.js_);
3932
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.jsSync_);
3933
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.jsAsync_);
3934
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).serializeUsing_(serialization_, v_.browser_);
3935
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.browserSync_);
3936
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.browserAsync_);
3937
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).serializeUsing_(serialization_, v_.node_);
3938
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.nodeSync_);
3939
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.nodeAsync_)
3940
+ return
3941
+ }
3942
+ }
3943
+ },
3944
+ deserializeUsing_(serialization_) {
3945
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
3946
+ serialization_.offset_ += 1;
3947
+ {
3948
+ const _1 = variantIndex_;
3949
+ {
3950
+ if(_1 == 0) {
3951
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
3952
+ return ff_compiler_Parser.ParsedTargets(ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
3953
+ return
3954
+ }
3955
+ }
3956
+ {
3957
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
3958
+ return
3959
+ }
3960
+ }
3961
+ },
3962
+ async serializeUsing_$(serialization_, value_, $task) {
3963
+ {
3964
+ const serialization_a = serialization_;
3965
+ const value_a = value_;
3966
+ {
3967
+ const v_ = value_a;
3968
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
3969
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
3970
+ serialization_.offset_ += 1;
3971
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).serializeUsing_(serialization_, v_.js_);
3972
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.jsSync_);
3973
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.jsAsync_);
3974
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).serializeUsing_(serialization_, v_.browser_);
3975
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.browserSync_);
3976
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.browserAsync_);
3977
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).serializeUsing_(serialization_, v_.node_);
3978
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.nodeSync_);
3979
+ ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.nodeAsync_)
3980
+ return
3981
+ }
3982
+ }
3983
+ },
3984
+ async deserializeUsing_$(serialization_, $task) {
3985
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
3986
+ serialization_.offset_ += 1;
3987
+ {
3988
+ const _1 = variantIndex_;
3989
+ {
3990
+ if(_1 == 0) {
3991
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
3992
+ return ff_compiler_Parser.ParsedTargets(ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Lambda).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Option.ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
3993
+ return
3994
+ }
3995
+ }
3996
+ {
3997
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
3998
+ return
3999
+ }
4000
+ }
4001
+ }
4002
+ };
4003
+
4004
+