yyjj 2025.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,4547 @@
1
+
2
+ //#region target/js/release/build/yyjj.js
3
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$LBrace = { $tag: 0 };
4
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBrace = { $tag: 1 };
5
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$LBracket = { $tag: 2 };
6
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBracket = { $tag: 3 };
7
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Colon = { $tag: 4 };
8
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Comma = { $tag: 5 };
9
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$String(param0) {
10
+ this._0 = param0;
11
+ }
12
+ $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$String.prototype.$tag = 6;
13
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Number(param0) {
14
+ this._0 = param0;
15
+ }
16
+ $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Number.prototype.$tag = 7;
17
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$True = { $tag: 8 };
18
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$False = { $tag: 9 };
19
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Null = { $tag: 10 };
20
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$LineComment(param0) {
21
+ this._0 = param0;
22
+ }
23
+ $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$LineComment.prototype.$tag = 11;
24
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$BlockComment(param0) {
25
+ this._0 = param0;
26
+ }
27
+ $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$BlockComment.prototype.$tag = 12;
28
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Whitespace(param0) {
29
+ this._0 = param0;
30
+ }
31
+ $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Whitespace.prototype.$tag = 13;
32
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Newline = { $tag: 14 };
33
+ const $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Eof = { $tag: 15 };
34
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid(param0) {
35
+ this._0 = param0;
36
+ }
37
+ $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid.prototype.$tag = 16;
38
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon = { $tag: 0 };
39
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Dash = { $tag: 1 };
40
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Comma = { $tag: 2 };
41
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$LBrace = { $tag: 3 };
42
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$RBrace = { $tag: 4 };
43
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$LBracket = { $tag: 5 };
44
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$RBracket = { $tag: 6 };
45
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Indent(param0) {
46
+ this._0 = param0;
47
+ }
48
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Indent.prototype.$tag = 7;
49
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Dedent(param0) {
50
+ this._0 = param0;
51
+ }
52
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Dedent.prototype.$tag = 8;
53
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$PlainScalar(param0) {
54
+ this._0 = param0;
55
+ }
56
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$PlainScalar.prototype.$tag = 9;
57
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$SingleQuotedScalar(param0) {
58
+ this._0 = param0;
59
+ }
60
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$SingleQuotedScalar.prototype.$tag = 10;
61
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$DoubleQuotedScalar(param0) {
62
+ this._0 = param0;
63
+ }
64
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$DoubleQuotedScalar.prototype.$tag = 11;
65
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$LiteralBlock(param0) {
66
+ this._0 = param0;
67
+ }
68
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$LiteralBlock.prototype.$tag = 12;
69
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$FoldedBlock(param0) {
70
+ this._0 = param0;
71
+ }
72
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$FoldedBlock.prototype.$tag = 13;
73
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$NullValue = { $tag: 14 };
74
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$TrueValue = { $tag: 15 };
75
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$FalseValue = { $tag: 16 };
76
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Anchor(param0) {
77
+ this._0 = param0;
78
+ }
79
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Anchor.prototype.$tag = 17;
80
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Alias(param0) {
81
+ this._0 = param0;
82
+ }
83
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Alias.prototype.$tag = 18;
84
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Comment(param0) {
85
+ this._0 = param0;
86
+ }
87
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Comment.prototype.$tag = 19;
88
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Whitespace(param0) {
89
+ this._0 = param0;
90
+ }
91
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Whitespace.prototype.$tag = 20;
92
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Newline = { $tag: 21 };
93
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$DocumentStart = { $tag: 22 };
94
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$DocumentEnd = { $tag: 23 };
95
+ const $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Eof = { $tag: 24 };
96
+ function $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Invalid(param0) {
97
+ this._0 = param0;
98
+ }
99
+ $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Invalid.prototype.$tag = 25;
100
+ function $bound_check(arr, index) {
101
+ if (index < 0 || index >= arr.length) throw new Error("Index out of bounds");
102
+ }
103
+ var $PanicError = class extends Error {};
104
+ function $panic() {
105
+ throw new $PanicError();
106
+ }
107
+ const moonbitlang$core$builtin$$random_seed = () => {
108
+ if (globalThis.crypto?.getRandomValues) {
109
+ const array = new Uint32Array(1);
110
+ globalThis.crypto.getRandomValues(array);
111
+ return array[0] | 0;
112
+ } else return Math.floor(Math.random() * 4294967296) | 0;
113
+ };
114
+ function Result$Err$0$(param0) {
115
+ this._0 = param0;
116
+ }
117
+ Result$Err$0$.prototype.$tag = 0;
118
+ function Result$Ok$0$(param0) {
119
+ this._0 = param0;
120
+ }
121
+ Result$Ok$0$.prototype.$tag = 1;
122
+ const Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$IndexOutOfBounds = { $tag: 1 };
123
+ const Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex = { $tag: 0 };
124
+ const moonbitlang$core$builtin$$int_to_string_js = (x, radix) => {
125
+ return x.toString(radix);
126
+ };
127
+ const moonbitlang$core$builtin$$JSArray$push = (arr, val) => {
128
+ arr.push(val);
129
+ };
130
+ function $make_array_len_and_init(a, b) {
131
+ const arr = new Array(a);
132
+ arr.fill(b);
133
+ return arr;
134
+ }
135
+ const moonbitlang$core$builtin$$JSArray$copy = (arr) => arr.slice(0);
136
+ const moonbitlang$core$builtin$$JSArray$set_length = (arr, len) => {
137
+ arr.length = len;
138
+ };
139
+ const moonbitlang$core$builtin$$JSArray$pop = (arr) => arr.pop();
140
+ function $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$UnexpectedToken(param0) {
141
+ this._0 = param0;
142
+ }
143
+ $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$UnexpectedToken.prototype.$tag = 0;
144
+ const $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$UnexpectedEof = { $tag: 1 };
145
+ function $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$InvalidEscape(param0) {
146
+ this._0 = param0;
147
+ }
148
+ $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$InvalidEscape.prototype.$tag = 2;
149
+ function $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$InvalidNumber(param0) {
150
+ this._0 = param0;
151
+ }
152
+ $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$InvalidNumber.prototype.$tag = 3;
153
+ function $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$InvalidIndentation(param0, param1) {
154
+ this._0 = param0;
155
+ this._1 = param1;
156
+ }
157
+ $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$InvalidIndentation.prototype.$tag = 4;
158
+ function $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$UnresolvedAlias(param0) {
159
+ this._0 = param0;
160
+ }
161
+ $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$UnresolvedAlias.prototype.$tag = 7;
162
+ function $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$DuplicateAnchor(param0) {
163
+ this._0 = param0;
164
+ }
165
+ $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$DuplicateAnchor.prototype.$tag = 8;
166
+ const $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$TrailingContent = { $tag: 10 };
167
+ const $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nil = { $tag: 0 };
168
+ function $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(param0) {
169
+ this._0 = param0;
170
+ }
171
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text.prototype.$tag = 1;
172
+ const $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Line = { $tag: 2 };
173
+ const $64$f4ah6o$47$yyjj$47$pretty$46$Doc$HardLine = { $tag: 3 };
174
+ function $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Concat(param0, param1) {
175
+ this._0 = param0;
176
+ this._1 = param1;
177
+ }
178
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Concat.prototype.$tag = 4;
179
+ function $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nest(param0, param1) {
180
+ this._0 = param0;
181
+ this._1 = param1;
182
+ }
183
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nest.prototype.$tag = 5;
184
+ function $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Group(param0) {
185
+ this._0 = param0;
186
+ }
187
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Group.prototype.$tag = 6;
188
+ function $64$f4ah6o$47$yyjj$47$pretty$46$Doc$FlatAlt(param0, param1) {
189
+ this._0 = param0;
190
+ this._1 = param1;
191
+ }
192
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$FlatAlt.prototype.$tag = 7;
193
+ function Result$Err$1$(param0) {
194
+ this._0 = param0;
195
+ }
196
+ Result$Err$1$.prototype.$tag = 0;
197
+ function Result$Ok$1$(param0) {
198
+ this._0 = param0;
199
+ }
200
+ Result$Ok$1$.prototype.$tag = 1;
201
+ function Result$Err$2$(param0) {
202
+ this._0 = param0;
203
+ }
204
+ Result$Err$2$.prototype.$tag = 0;
205
+ function Result$Ok$2$(param0) {
206
+ this._0 = param0;
207
+ }
208
+ Result$Ok$2$.prototype.$tag = 1;
209
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JNull(param0) {
210
+ this._0 = param0;
211
+ }
212
+ $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JNull.prototype.$tag = 0;
213
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JBool(param0, param1) {
214
+ this._0 = param0;
215
+ this._1 = param1;
216
+ }
217
+ $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JBool.prototype.$tag = 1;
218
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JNumber(param0, param1) {
219
+ this._0 = param0;
220
+ this._1 = param1;
221
+ }
222
+ $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JNumber.prototype.$tag = 2;
223
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JString(param0, param1) {
224
+ this._0 = param0;
225
+ this._1 = param1;
226
+ }
227
+ $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JString.prototype.$tag = 3;
228
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JArray(param0, param1) {
229
+ this._0 = param0;
230
+ this._1 = param1;
231
+ }
232
+ $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JArray.prototype.$tag = 4;
233
+ function $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JObject(param0, param1) {
234
+ this._0 = param0;
235
+ this._1 = param1;
236
+ }
237
+ $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JObject.prototype.$tag = 5;
238
+ function Result$Err$3$(param0) {
239
+ this._0 = param0;
240
+ }
241
+ Result$Err$3$.prototype.$tag = 0;
242
+ function Result$Ok$3$(param0) {
243
+ this._0 = param0;
244
+ }
245
+ Result$Ok$3$.prototype.$tag = 1;
246
+ function $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNull(param0) {
247
+ this._0 = param0;
248
+ }
249
+ $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNull.prototype.$tag = 0;
250
+ function $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YBool(param0, param1) {
251
+ this._0 = param0;
252
+ this._1 = param1;
253
+ }
254
+ $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YBool.prototype.$tag = 1;
255
+ function $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNumber(param0, param1) {
256
+ this._0 = param0;
257
+ this._1 = param1;
258
+ }
259
+ $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNumber.prototype.$tag = 2;
260
+ function $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(param0, param1, param2) {
261
+ this._0 = param0;
262
+ this._1 = param1;
263
+ this._2 = param2;
264
+ }
265
+ $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString.prototype.$tag = 3;
266
+ function $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YSequence(param0, param1) {
267
+ this._0 = param0;
268
+ this._1 = param1;
269
+ }
270
+ $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YSequence.prototype.$tag = 4;
271
+ function $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YMapping(param0, param1) {
272
+ this._0 = param0;
273
+ this._1 = param1;
274
+ }
275
+ $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YMapping.prototype.$tag = 5;
276
+ function $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YAlias(param0, param1) {
277
+ this._0 = param0;
278
+ this._1 = param1;
279
+ }
280
+ $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YAlias.prototype.$tag = 6;
281
+ function $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YAnchor(param0, param1) {
282
+ this._0 = param0;
283
+ this._1 = param1;
284
+ }
285
+ $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YAnchor.prototype.$tag = 7;
286
+ function Result$Err$4$(param0) {
287
+ this._0 = param0;
288
+ }
289
+ Result$Err$4$.prototype.$tag = 0;
290
+ function Result$Ok$4$(param0) {
291
+ this._0 = param0;
292
+ }
293
+ Result$Ok$4$.prototype.$tag = 1;
294
+ const $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger = {
295
+ method_0: moonbitlang$core$builtin$$Logger$write_string$0$,
296
+ method_1: moonbitlang$core$builtin$$Logger$write_substring$1$,
297
+ method_2: moonbitlang$core$builtin$$Logger$write_view$0$,
298
+ method_3: moonbitlang$core$builtin$$Logger$write_char$0$
299
+ };
300
+ const f4ah6o$yyjj$common$$zero$46$record$47$413 = {
301
+ line: 0,
302
+ column: 0,
303
+ offset: 0
304
+ };
305
+ const f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192 = "0123456789abcdef";
306
+ const f4ah6o$yyjj$jsonc$$lex_comment_or_invalid$46$constr$47$594 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("unexpected character: /");
307
+ const f4ah6o$yyjj$jsonc$$lex_comment_or_invalid$46$constr$47$595 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("unclosed block comment");
308
+ const f4ah6o$yyjj$jsonc$$lex_comment_or_invalid$46$constr$47$596 = 47;
309
+ const f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$628 = 45;
310
+ const f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$629 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("invalid number");
311
+ const f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$630 = 46;
312
+ const f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$631 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("invalid number: expected digit after decimal point");
313
+ const f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$632 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("invalid number: expected digit in exponent");
314
+ const f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$674 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("unclosed string");
315
+ const f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$675 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("unclosed string");
316
+ const f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$676 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("invalid unicode escape");
317
+ const f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$677 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("invalid unicode escape");
318
+ const f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$678 = new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid("control character in string");
319
+ const f4ah6o$yyjj$jsonc$$next_token$46$constr$47$699 = 10;
320
+ const f4ah6o$yyjj$yaml$$lex_alias$46$constr$47$1055 = new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Invalid("empty alias name");
321
+ const f4ah6o$yyjj$yaml$$lex_anchor$46$constr$47$1060 = new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Invalid("empty anchor name");
322
+ const f4ah6o$yyjj$yaml$$lex_double_quoted$46$constr$47$1066 = new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Invalid("unclosed double-quoted string");
323
+ const f4ah6o$yyjj$yaml$$lex_double_quoted$46$constr$47$1067 = new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Invalid("unclosed double-quoted string");
324
+ const f4ah6o$yyjj$yaml$$lex_folded_block$46$constr$47$1082 = 10;
325
+ const f4ah6o$yyjj$yaml$$lex_folded_block$46$constr$47$1083 = 10;
326
+ const f4ah6o$yyjj$yaml$$lex_literal_block$46$constr$47$1112 = 10;
327
+ const f4ah6o$yyjj$yaml$$lex_literal_block$46$constr$47$1113 = 10;
328
+ const f4ah6o$yyjj$yaml$$lex_single_quoted$46$constr$47$1150 = new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Invalid("unclosed single-quoted string");
329
+ const f4ah6o$yyjj$yaml$$lex_single_quoted$46$constr$47$1151 = 39;
330
+ const f4ah6o$yyjj$yaml$$next_token$46$constr$47$1162 = 10;
331
+ const f4ah6o$yyjj$yaml$$next_token$46$constr$47$1163 = 32;
332
+ const f4ah6o$yyjj$yaml$$next_token$46$constr$47$1164 = 10;
333
+ const f4ah6o$yyjj$yaml$$next_token$46$constr$47$1165 = 45;
334
+ const f4ah6o$yyjj$yaml$$next_token$46$constr$47$1166 = 45;
335
+ const f4ah6o$yyjj$yaml$$next_token$46$constr$47$1167 = 46;
336
+ const f4ah6o$yyjj$yaml$$next_token$46$constr$47$1168 = 46;
337
+ const moonbitlang$core$builtin$$seed = moonbitlang$core$builtin$$random_seed();
338
+ function moonbitlang$core$builtin$$Logger$write_object$2$(self, obj) {
339
+ moonbitlang$core$builtin$$Show$output$2$(obj, self);
340
+ }
341
+ function moonbitlang$core$builtin$$Logger$write_object$3$(self, obj) {
342
+ moonbitlang$core$builtin$$Show$output$3$(obj, self);
343
+ }
344
+ function moonbitlang$core$array$$FixedArray$unsafe_blit$4$(dst, dst_offset, src, src_offset, len) {
345
+ if (dst === src && dst_offset < src_offset) {
346
+ let _tmp = 0;
347
+ while (true) {
348
+ const i = _tmp;
349
+ if (i < len) {
350
+ const _tmp$2 = dst_offset + i | 0;
351
+ const _tmp$3 = src_offset + i | 0;
352
+ $bound_check(src, _tmp$3);
353
+ $bound_check(dst, _tmp$2);
354
+ dst[_tmp$2] = src[_tmp$3];
355
+ _tmp = i + 1 | 0;
356
+ continue;
357
+ } else return;
358
+ }
359
+ } else {
360
+ let _tmp = len - 1 | 0;
361
+ while (true) {
362
+ const i = _tmp;
363
+ if (i >= 0) {
364
+ const _tmp$2 = dst_offset + i | 0;
365
+ const _tmp$3 = src_offset + i | 0;
366
+ $bound_check(src, _tmp$3);
367
+ $bound_check(dst, _tmp$2);
368
+ dst[_tmp$2] = src[_tmp$3];
369
+ _tmp = i - 1 | 0;
370
+ continue;
371
+ } else return;
372
+ }
373
+ }
374
+ }
375
+ function moonbitlang$core$builtin$$StringBuilder$new$46$inner(size_hint) {
376
+ return { val: "" };
377
+ }
378
+ function moonbitlang$core$builtin$$Logger$write_char$0$(self, ch) {
379
+ const _bind = self;
380
+ _bind.val = `${_bind.val}${String.fromCodePoint(ch)}`;
381
+ }
382
+ function moonbitlang$core$builtin$$op_notequal$5$(x, y) {
383
+ return !moonbitlang$core$builtin$$Eq$equal$6$(x, y);
384
+ }
385
+ function moonbitlang$core$array$$Array$at$7$(self, index) {
386
+ const len = self.length;
387
+ if (index >= 0 && index < len) {
388
+ $bound_check(self, index);
389
+ return self[index];
390
+ } else return $panic();
391
+ }
392
+ function moonbitlang$core$array$$Array$at$8$(self, index) {
393
+ const len = self.length;
394
+ if (index >= 0 && index < len) {
395
+ $bound_check(self, index);
396
+ return self[index];
397
+ } else return $panic();
398
+ }
399
+ function moonbitlang$core$array$$Array$at$9$(self, index) {
400
+ const len = self.length;
401
+ if (index >= 0 && index < len) {
402
+ $bound_check(self, index);
403
+ return self[index];
404
+ } else return $panic();
405
+ }
406
+ function moonbitlang$core$array$$Array$at$10$(self, index) {
407
+ const len = self.length;
408
+ if (index >= 0 && index < len) {
409
+ $bound_check(self, index);
410
+ return self[index];
411
+ } else return $panic();
412
+ }
413
+ function moonbitlang$core$array$$Array$at$11$(self, index) {
414
+ const len = self.length;
415
+ if (index >= 0 && index < len) {
416
+ $bound_check(self, index);
417
+ return self[index];
418
+ } else return $panic();
419
+ }
420
+ function moonbitlang$core$array$$Array$at$12$(self, index) {
421
+ const len = self.length;
422
+ if (index >= 0 && index < len) {
423
+ $bound_check(self, index);
424
+ return self[index];
425
+ } else return $panic();
426
+ }
427
+ function moonbitlang$core$array$$Array$at$13$(self, index) {
428
+ const len = self.length;
429
+ if (index >= 0 && index < len) {
430
+ $bound_check(self, index);
431
+ return self[index];
432
+ } else return $panic();
433
+ }
434
+ function moonbitlang$core$array$$Array$at$14$(self, index) {
435
+ const len = self.length;
436
+ if (index >= 0 && index < len) {
437
+ $bound_check(self, index);
438
+ return self[index];
439
+ } else return $panic();
440
+ }
441
+ function moonbitlang$core$builtin$$Logger$write_string$0$(self, str) {
442
+ const _bind = self;
443
+ _bind.val = `${_bind.val}${str}`;
444
+ }
445
+ function moonbitlang$core$builtin$$Hasher$consume4(self, input) {
446
+ const _p = (self.acc >>> 0) + ((Math.imul(input, -1028477379) | 0) >>> 0) | 0;
447
+ const _p$2 = 17;
448
+ self.acc = Math.imul(_p << _p$2 | (_p >>> (32 - _p$2 | 0) | 0), 668265263) | 0;
449
+ }
450
+ function moonbitlang$core$builtin$$Hasher$combine_uint(self, value) {
451
+ self.acc = (self.acc >>> 0) + 4 | 0;
452
+ moonbitlang$core$builtin$$Hasher$consume4(self, value);
453
+ }
454
+ function moonbitlang$core$builtin$$Hasher$combine$3$(self, value) {
455
+ moonbitlang$core$builtin$$Hash$hash_combine$3$(value, self);
456
+ }
457
+ function moonbitlang$core$builtin$$Hasher$avalanche(self) {
458
+ let acc = self.acc;
459
+ acc = acc ^ (acc >>> 15 | 0);
460
+ acc = Math.imul(acc, -2048144777) | 0;
461
+ acc = acc ^ (acc >>> 13 | 0);
462
+ acc = Math.imul(acc, -1028477379) | 0;
463
+ acc = acc ^ (acc >>> 16 | 0);
464
+ return acc;
465
+ }
466
+ function moonbitlang$core$builtin$$Hasher$finalize(self) {
467
+ return moonbitlang$core$builtin$$Hasher$avalanche(self);
468
+ }
469
+ function moonbitlang$core$builtin$$Hasher$new$46$inner(seed) {
470
+ return { acc: (seed >>> 0) + 374761393 | 0 };
471
+ }
472
+ function moonbitlang$core$builtin$$Hasher$new(seed$46$opt) {
473
+ let seed;
474
+ if (seed$46$opt === void 0) seed = moonbitlang$core$builtin$$seed;
475
+ else seed = seed$46$opt;
476
+ return moonbitlang$core$builtin$$Hasher$new$46$inner(seed);
477
+ }
478
+ function moonbitlang$core$builtin$$Hash$hash$15$(self) {
479
+ const _self = moonbitlang$core$builtin$$Hasher$new(void 0);
480
+ moonbitlang$core$builtin$$Hasher$combine$3$(_self, self);
481
+ return moonbitlang$core$builtin$$Hasher$finalize(_self);
482
+ }
483
+ function moonbitlang$core$string$$String$sub$46$inner(self, start, end) {
484
+ const len = self.length;
485
+ let end$2;
486
+ if (end === void 0) end$2 = len;
487
+ else {
488
+ const _end = end;
489
+ end$2 = _end < 0 ? len + _end | 0 : _end;
490
+ }
491
+ const start$2 = start < 0 ? len + start | 0 : start;
492
+ if (start$2 >= 0 && start$2 <= end$2 && end$2 <= len) {
493
+ let _tmp;
494
+ if (start$2 < len) {
495
+ const _p = self.charCodeAt(start$2);
496
+ _tmp = 56320 <= _p && _p <= 57343;
497
+ } else _tmp = false;
498
+ if (_tmp) return new Result$Err$0$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex);
499
+ let _tmp$2;
500
+ if (end$2 < len) {
501
+ const _p = self.charCodeAt(end$2);
502
+ _tmp$2 = 56320 <= _p && _p <= 57343;
503
+ } else _tmp$2 = false;
504
+ if (_tmp$2) return new Result$Err$0$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex);
505
+ return new Result$Ok$0$({
506
+ str: self,
507
+ start: start$2,
508
+ end: end$2
509
+ });
510
+ } else return new Result$Err$0$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$IndexOutOfBounds);
511
+ }
512
+ function moonbitlang$core$builtin$$Logger$write_substring$1$(self, value, start, len) {
513
+ let _tmp;
514
+ _L: {
515
+ _L$2: {
516
+ const _bind = moonbitlang$core$string$$String$sub$46$inner(value, start, start + len | 0);
517
+ if (_bind.$tag === 1) _tmp = _bind._0;
518
+ else {
519
+ _bind._0;
520
+ break _L$2;
521
+ }
522
+ break _L;
523
+ }
524
+ _tmp = $panic();
525
+ }
526
+ moonbitlang$core$builtin$$Logger$write_view$0$(self, _tmp);
527
+ }
528
+ function moonbitlang$core$builtin$$Show$to_string$16$(self) {
529
+ const logger = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
530
+ moonbitlang$core$builtin$$Show$output$2$(self, {
531
+ self: logger,
532
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
533
+ });
534
+ return logger.val;
535
+ }
536
+ function moonbitlang$core$builtin$$Show$to_string$17$(self) {
537
+ const logger = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
538
+ moonbitlang$core$builtin$$Show$output$18$(self, {
539
+ self: logger,
540
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
541
+ });
542
+ return logger.val;
543
+ }
544
+ function moonbitlang$core$builtin$$Show$to_string$19$(self) {
545
+ const logger = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
546
+ const _p = {
547
+ self: logger,
548
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
549
+ };
550
+ if (self) _p.method_table.method_0(_p.self, "true");
551
+ else _p.method_table.method_0(_p.self, "false");
552
+ return logger.val;
553
+ }
554
+ function moonbitlang$core$int$$Int$to_string$46$inner(self, radix) {
555
+ return moonbitlang$core$builtin$$int_to_string_js(self, radix);
556
+ }
557
+ function moonbitlang$core$builtin$$to_hex$46$to_hex_digit$124$3958(i) {
558
+ if (i < 10) return (i + 48 | 0) & 255;
559
+ else return (((i + 97 | 0) & 255) - 10 | 0) & 255;
560
+ }
561
+ function moonbitlang$core$byte$$Byte$to_hex(b) {
562
+ const _self = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
563
+ moonbitlang$core$builtin$$Logger$write_char$0$(_self, moonbitlang$core$builtin$$to_hex$46$to_hex_digit$124$3958((b / 16 | 0) & 255));
564
+ moonbitlang$core$builtin$$Logger$write_char$0$(_self, moonbitlang$core$builtin$$to_hex$46$to_hex_digit$124$3958((b % 16 | 0) & 255));
565
+ return _self.val;
566
+ }
567
+ function moonbitlang$core$builtin$$output$46$flush_segment$124$3948(_env, seg, i) {
568
+ const logger = _env._1;
569
+ const self = _env._0;
570
+ if (i > seg) {
571
+ logger.method_table.method_1(logger.self, self, seg, i - seg | 0);
572
+ return;
573
+ } else return;
574
+ }
575
+ function moonbitlang$core$builtin$$Show$output$3$(self, logger) {
576
+ logger.method_table.method_3(logger.self, 34);
577
+ const _env = {
578
+ _0: self,
579
+ _1: logger
580
+ };
581
+ const len = self.length;
582
+ let _tmp = 0;
583
+ let _tmp$2 = 0;
584
+ _L: while (true) {
585
+ const i = _tmp;
586
+ const seg = _tmp$2;
587
+ if (i >= len) {
588
+ moonbitlang$core$builtin$$output$46$flush_segment$124$3948(_env, seg, i);
589
+ break;
590
+ }
591
+ const code = self.charCodeAt(i);
592
+ let c;
593
+ _L$2: switch (code) {
594
+ case 34:
595
+ c = code;
596
+ break _L$2;
597
+ case 92:
598
+ c = code;
599
+ break _L$2;
600
+ case 10:
601
+ moonbitlang$core$builtin$$output$46$flush_segment$124$3948(_env, seg, i);
602
+ logger.method_table.method_0(logger.self, "\\n");
603
+ _tmp = i + 1 | 0;
604
+ _tmp$2 = i + 1 | 0;
605
+ continue _L;
606
+ case 13:
607
+ moonbitlang$core$builtin$$output$46$flush_segment$124$3948(_env, seg, i);
608
+ logger.method_table.method_0(logger.self, "\\r");
609
+ _tmp = i + 1 | 0;
610
+ _tmp$2 = i + 1 | 0;
611
+ continue _L;
612
+ case 8:
613
+ moonbitlang$core$builtin$$output$46$flush_segment$124$3948(_env, seg, i);
614
+ logger.method_table.method_0(logger.self, "\\b");
615
+ _tmp = i + 1 | 0;
616
+ _tmp$2 = i + 1 | 0;
617
+ continue _L;
618
+ case 9:
619
+ moonbitlang$core$builtin$$output$46$flush_segment$124$3948(_env, seg, i);
620
+ logger.method_table.method_0(logger.self, "\\t");
621
+ _tmp = i + 1 | 0;
622
+ _tmp$2 = i + 1 | 0;
623
+ continue _L;
624
+ default: if (code < 32) {
625
+ moonbitlang$core$builtin$$output$46$flush_segment$124$3948(_env, seg, i);
626
+ logger.method_table.method_0(logger.self, "\\u{");
627
+ logger.method_table.method_0(logger.self, moonbitlang$core$byte$$Byte$to_hex(code & 255));
628
+ logger.method_table.method_3(logger.self, 125);
629
+ _tmp = i + 1 | 0;
630
+ _tmp$2 = i + 1 | 0;
631
+ continue _L;
632
+ } else {
633
+ _tmp = i + 1 | 0;
634
+ continue _L;
635
+ }
636
+ }
637
+ moonbitlang$core$builtin$$output$46$flush_segment$124$3948(_env, seg, i);
638
+ logger.method_table.method_3(logger.self, 92);
639
+ logger.method_table.method_3(logger.self, c);
640
+ _tmp = i + 1 | 0;
641
+ _tmp$2 = i + 1 | 0;
642
+ continue;
643
+ }
644
+ logger.method_table.method_3(logger.self, 34);
645
+ }
646
+ function moonbitlang$core$builtin$$Show$to_string$20$(self) {
647
+ return self.str.substring(self.start, self.end);
648
+ }
649
+ function moonbitlang$core$builtin$$Logger$write_view$0$(self, str) {
650
+ const _bind = self;
651
+ _bind.val = `${_bind.val}${moonbitlang$core$builtin$$Show$to_string$20$(str)}`;
652
+ }
653
+ function moonbitlang$core$builtin$$StringBuilder$reset(self) {
654
+ self.val = "";
655
+ }
656
+ function moonbitlang$core$array$$Array$push$7$(self, value) {
657
+ moonbitlang$core$builtin$$JSArray$push(self, value);
658
+ }
659
+ function moonbitlang$core$array$$Array$push$9$(self, value) {
660
+ moonbitlang$core$builtin$$JSArray$push(self, value);
661
+ }
662
+ function moonbitlang$core$array$$Array$push$21$(self, value) {
663
+ moonbitlang$core$builtin$$JSArray$push(self, value);
664
+ }
665
+ function moonbitlang$core$array$$Array$push$8$(self, value) {
666
+ moonbitlang$core$builtin$$JSArray$push(self, value);
667
+ }
668
+ function moonbitlang$core$array$$Array$push$14$(self, value) {
669
+ moonbitlang$core$builtin$$JSArray$push(self, value);
670
+ }
671
+ function moonbitlang$core$array$$Array$push$13$(self, value) {
672
+ moonbitlang$core$builtin$$JSArray$push(self, value);
673
+ }
674
+ function moonbitlang$core$array$$Array$push$12$(self, value) {
675
+ moonbitlang$core$builtin$$JSArray$push(self, value);
676
+ }
677
+ function moonbitlang$core$array$$Array$push$11$(self, value) {
678
+ moonbitlang$core$builtin$$JSArray$push(self, value);
679
+ }
680
+ function moonbitlang$core$array$$Array$push$10$(self, value) {
681
+ moonbitlang$core$builtin$$JSArray$push(self, value);
682
+ }
683
+ function moonbitlang$core$array$$Array$push$3$(self, value) {
684
+ moonbitlang$core$builtin$$JSArray$push(self, value);
685
+ }
686
+ function moonbitlang$core$array$$Array$push$2$(self, value) {
687
+ moonbitlang$core$builtin$$JSArray$push(self, value);
688
+ }
689
+ function moonbitlang$core$builtin$$Show$to_string$22$(self) {
690
+ return String.fromCodePoint(self);
691
+ }
692
+ function moonbitlang$core$string$$String$substring$46$inner(self, start, end) {
693
+ const len = self.length;
694
+ let end$2;
695
+ if (end === void 0) end$2 = len;
696
+ else end$2 = end;
697
+ return start >= 0 && start <= end$2 && end$2 <= len ? self.substring(start, end$2) : $panic();
698
+ }
699
+ function moonbitlang$core$builtin$$Show$output$2$(self, logger) {
700
+ logger.method_table.method_0(logger.self, moonbitlang$core$int$$Int$to_string$46$inner(self, 10));
701
+ }
702
+ function moonbitlang$core$builtin$$Eq$equal$23$(self, other) {
703
+ if (self === void 0) return other === void 0;
704
+ else {
705
+ const _x = self;
706
+ if (other === void 0) return false;
707
+ else return moonbitlang$core$builtin$$Eq$equal$24$(_x, other);
708
+ }
709
+ }
710
+ function moonbitlang$core$builtin$$Eq$equal$6$(self, other) {
711
+ if (self === void 0) return other === void 0;
712
+ else {
713
+ const _x = self;
714
+ if (other === void 0) return false;
715
+ else return moonbitlang$core$builtin$$Eq$equal$18$(_x, other);
716
+ }
717
+ }
718
+ function moonbitlang$core$builtin$$Eq$equal$25$(self, other) {
719
+ if (self === -1) return other === -1;
720
+ else {
721
+ const _x = self;
722
+ if (other === -1) return false;
723
+ else return _x === other;
724
+ }
725
+ }
726
+ function moonbitlang$core$int$$Int$next_power_of_two(self) {
727
+ if (self >= 0) {
728
+ if (self <= 1) return 1;
729
+ if (self > 1073741824) return 1073741824;
730
+ return (2147483647 >> (Math.clz32(self - 1 | 0) - 1 | 0)) + 1 | 0;
731
+ } else return $panic();
732
+ }
733
+ function moonbitlang$core$builtin$$Map$new$46$inner$26$(capacity) {
734
+ const capacity$2 = moonbitlang$core$int$$Int$next_power_of_two(capacity);
735
+ const _bind = capacity$2 - 1 | 0;
736
+ const _bind$2 = (Math.imul(capacity$2, 13) | 0) / 16 | 0;
737
+ return {
738
+ entries: $make_array_len_and_init(capacity$2, void 0),
739
+ size: 0,
740
+ capacity: capacity$2,
741
+ capacity_mask: _bind,
742
+ grow_at: _bind$2,
743
+ head: void 0,
744
+ tail: -1
745
+ };
746
+ }
747
+ function moonbitlang$core$builtin$$Map$add_entry_to_tail$26$(self, idx, entry) {
748
+ const _bind = self.tail;
749
+ if (_bind === -1) self.head = entry;
750
+ else {
751
+ const _tmp$1 = self.entries;
752
+ $bound_check(_tmp$1, _bind);
753
+ const _p = _tmp$1[_bind];
754
+ let _tmp$2;
755
+ if (_p === void 0) _tmp$2 = $panic();
756
+ else _tmp$2 = _p;
757
+ _tmp$2.next = entry;
758
+ }
759
+ self.tail = idx;
760
+ const _tmp = self.entries;
761
+ $bound_check(_tmp, idx);
762
+ _tmp[idx] = entry;
763
+ self.size = self.size + 1 | 0;
764
+ }
765
+ function moonbitlang$core$builtin$$Map$set_entry$26$(self, entry, new_idx) {
766
+ const _tmp = self.entries;
767
+ $bound_check(_tmp, new_idx);
768
+ _tmp[new_idx] = entry;
769
+ const _bind = entry.next;
770
+ if (_bind === void 0) {
771
+ self.tail = new_idx;
772
+ return;
773
+ } else {
774
+ const _next = _bind;
775
+ _next.prev = new_idx;
776
+ return;
777
+ }
778
+ }
779
+ function moonbitlang$core$builtin$$Map$push_away$26$(self, idx, entry) {
780
+ let _tmp = entry.psl + 1 | 0;
781
+ let _tmp$2 = idx + 1 & self.capacity_mask;
782
+ let _tmp$3 = entry;
783
+ while (true) {
784
+ const psl = _tmp;
785
+ const idx$2 = _tmp$2;
786
+ const entry$2 = _tmp$3;
787
+ const _tmp$4 = self.entries;
788
+ $bound_check(_tmp$4, idx$2);
789
+ const _bind = _tmp$4[idx$2];
790
+ if (_bind === void 0) {
791
+ entry$2.psl = psl;
792
+ moonbitlang$core$builtin$$Map$set_entry$26$(self, entry$2, idx$2);
793
+ break;
794
+ } else {
795
+ const _curr_entry = _bind;
796
+ if (psl > _curr_entry.psl) {
797
+ entry$2.psl = psl;
798
+ moonbitlang$core$builtin$$Map$set_entry$26$(self, entry$2, idx$2);
799
+ _tmp = _curr_entry.psl + 1 | 0;
800
+ _tmp$2 = idx$2 + 1 & self.capacity_mask;
801
+ _tmp$3 = _curr_entry;
802
+ continue;
803
+ } else {
804
+ _tmp = psl + 1 | 0;
805
+ _tmp$2 = idx$2 + 1 & self.capacity_mask;
806
+ continue;
807
+ }
808
+ }
809
+ }
810
+ }
811
+ function moonbitlang$core$builtin$$Map$set_with_hash$26$(self, key, value, hash) {
812
+ if (self.size >= self.grow_at) moonbitlang$core$builtin$$Map$grow$26$(self);
813
+ let _bind;
814
+ let _tmp = 0;
815
+ let _tmp$2 = hash & self.capacity_mask;
816
+ while (true) {
817
+ const psl = _tmp;
818
+ const idx = _tmp$2;
819
+ const _tmp$3 = self.entries;
820
+ $bound_check(_tmp$3, idx);
821
+ const _bind$2 = _tmp$3[idx];
822
+ if (_bind$2 === void 0) {
823
+ _bind = {
824
+ _0: idx,
825
+ _1: psl
826
+ };
827
+ break;
828
+ } else {
829
+ const _curr_entry = _bind$2;
830
+ if (_curr_entry.hash === hash && _curr_entry.key === key) {
831
+ _curr_entry.value = value;
832
+ return;
833
+ }
834
+ if (psl > _curr_entry.psl) {
835
+ moonbitlang$core$builtin$$Map$push_away$26$(self, idx, _curr_entry);
836
+ _bind = {
837
+ _0: idx,
838
+ _1: psl
839
+ };
840
+ break;
841
+ }
842
+ _tmp = psl + 1 | 0;
843
+ _tmp$2 = idx + 1 & self.capacity_mask;
844
+ continue;
845
+ }
846
+ }
847
+ const _idx = _bind._0;
848
+ const _psl = _bind._1;
849
+ moonbitlang$core$builtin$$Map$add_entry_to_tail$26$(self, _idx, {
850
+ prev: self.tail,
851
+ next: void 0,
852
+ psl: _psl,
853
+ hash,
854
+ key,
855
+ value
856
+ });
857
+ }
858
+ function moonbitlang$core$builtin$$Map$grow$26$(self) {
859
+ const old_head = self.head;
860
+ const new_capacity = self.capacity << 1;
861
+ self.entries = $make_array_len_and_init(new_capacity, void 0);
862
+ self.capacity = new_capacity;
863
+ self.capacity_mask = new_capacity - 1 | 0;
864
+ const _p = self.capacity;
865
+ self.grow_at = (Math.imul(_p, 13) | 0) / 16 | 0;
866
+ self.size = 0;
867
+ self.head = void 0;
868
+ self.tail = -1;
869
+ let _tmp = old_head;
870
+ while (true) {
871
+ const _param = _tmp;
872
+ if (_param === void 0) return;
873
+ else {
874
+ const _x = _param;
875
+ const _next = _x.next;
876
+ const _key = _x.key;
877
+ const _value = _x.value;
878
+ const _hash = _x.hash;
879
+ moonbitlang$core$builtin$$Map$set_with_hash$26$(self, _key, _value, _hash);
880
+ _tmp = _next;
881
+ continue;
882
+ }
883
+ }
884
+ }
885
+ function moonbitlang$core$builtin$$Map$set$26$(self, key, value) {
886
+ moonbitlang$core$builtin$$Map$set_with_hash$26$(self, key, value, moonbitlang$core$builtin$$Hash$hash$15$(key));
887
+ }
888
+ function moonbitlang$core$builtin$$Map$from_array$26$(arr) {
889
+ const length = arr.end - arr.start | 0;
890
+ let capacity = moonbitlang$core$int$$Int$next_power_of_two(length);
891
+ const _p = capacity;
892
+ if (length > ((Math.imul(_p, 13) | 0) / 16 | 0)) capacity = Math.imul(capacity, 2) | 0;
893
+ const m = moonbitlang$core$builtin$$Map$new$46$inner$26$(capacity);
894
+ const _len = arr.end - arr.start | 0;
895
+ let _tmp = 0;
896
+ while (true) {
897
+ const _i = _tmp;
898
+ if (_i < _len) {
899
+ const e = arr.buf[arr.start + _i | 0];
900
+ moonbitlang$core$builtin$$Map$set$26$(m, e._0, e._1);
901
+ _tmp = _i + 1 | 0;
902
+ continue;
903
+ } else break;
904
+ }
905
+ return m;
906
+ }
907
+ function moonbitlang$core$builtin$$Map$get$26$(self, key) {
908
+ const hash = moonbitlang$core$builtin$$Hash$hash$15$(key);
909
+ let _tmp = 0;
910
+ let _tmp$2 = hash & self.capacity_mask;
911
+ while (true) {
912
+ const i = _tmp;
913
+ const idx = _tmp$2;
914
+ const _tmp$3 = self.entries;
915
+ $bound_check(_tmp$3, idx);
916
+ const _bind = _tmp$3[idx];
917
+ if (_bind === void 0) return;
918
+ else {
919
+ const _entry = _bind;
920
+ if (_entry.hash === hash && _entry.key === key) return _entry.value;
921
+ if (i > _entry.psl) return;
922
+ _tmp = i + 1 | 0;
923
+ _tmp$2 = idx + 1 & self.capacity_mask;
924
+ continue;
925
+ }
926
+ }
927
+ }
928
+ function moonbitlang$core$builtin$$Hasher$combine_string(self, value) {
929
+ const _end2438 = value.length;
930
+ let _tmp = 0;
931
+ while (true) {
932
+ const i = _tmp;
933
+ if (i < _end2438) {
934
+ moonbitlang$core$builtin$$Hasher$combine_uint(self, value.charCodeAt(i));
935
+ _tmp = i + 1 | 0;
936
+ continue;
937
+ } else return;
938
+ }
939
+ }
940
+ function moonbitlang$core$builtin$$Hash$hash_combine$3$(self, hasher) {
941
+ moonbitlang$core$builtin$$Hasher$combine_string(hasher, self);
942
+ }
943
+ function moonbitlang$core$builtin$$println$3$(input) {
944
+ console.log(input);
945
+ }
946
+ function moonbitlang$core$array$$Array$set$11$(self, index, value) {
947
+ const len = self.length;
948
+ if (index >= 0 && index < len) {
949
+ $bound_check(self, index);
950
+ self[index] = value;
951
+ return;
952
+ } else {
953
+ $panic();
954
+ return;
955
+ }
956
+ }
957
+ function moonbitlang$core$array$$Array$unsafe_truncate_to_length$9$(self, new_len) {
958
+ moonbitlang$core$builtin$$JSArray$set_length(self, new_len);
959
+ }
960
+ function moonbitlang$core$array$$Array$unsafe_pop$21$(self) {
961
+ return moonbitlang$core$builtin$$JSArray$pop(self);
962
+ }
963
+ function moonbitlang$core$array$$Array$unsafe_pop$2$(self) {
964
+ return moonbitlang$core$builtin$$JSArray$pop(self);
965
+ }
966
+ function moonbitlang$core$array$$Array$pop$21$(self) {
967
+ if (self.length === 0) return;
968
+ else return moonbitlang$core$array$$Array$unsafe_pop$21$(self);
969
+ }
970
+ function moonbitlang$core$array$$Array$pop$2$(self) {
971
+ if (self.length === 0) return;
972
+ else return moonbitlang$core$array$$Array$unsafe_pop$2$(self);
973
+ }
974
+ function moonbitlang$core$array$$Array$copy$9$(self) {
975
+ return moonbitlang$core$builtin$$JSArray$copy(self);
976
+ }
977
+ function moonbitlang$core$array$$Array$unsafe_blit$9$(dst, dst_offset, src, src_offset, len) {
978
+ moonbitlang$core$array$$FixedArray$unsafe_blit$4$(dst, dst_offset, src, src_offset, len);
979
+ }
980
+ function moonbitlang$core$array$$Array$clear$9$(self) {
981
+ moonbitlang$core$array$$Array$unsafe_truncate_to_length$9$(self, 0);
982
+ }
983
+ function moonbitlang$core$array$$Array$flatten$9$(self) {
984
+ let len = 0;
985
+ const _len = self.length;
986
+ let _tmp = 0;
987
+ while (true) {
988
+ const _i = _tmp;
989
+ if (_i < _len) {
990
+ const x = self[_i];
991
+ len = len + x.length | 0;
992
+ _tmp = _i + 1 | 0;
993
+ continue;
994
+ } else break;
995
+ }
996
+ const res = new Array(len);
997
+ let i = 0;
998
+ const _len$2 = self.length;
999
+ let _tmp$2 = 0;
1000
+ while (true) {
1001
+ const _i = _tmp$2;
1002
+ if (_i < _len$2) {
1003
+ const xs = self[_i];
1004
+ moonbitlang$core$array$$Array$unsafe_blit$9$(res, i, xs, 0, xs.length);
1005
+ i = i + xs.length | 0;
1006
+ _tmp$2 = _i + 1 | 0;
1007
+ continue;
1008
+ } else break;
1009
+ }
1010
+ return res;
1011
+ }
1012
+ function moonbitlang$core$array$$Array$last$2$(self) {
1013
+ if (self.length === 0) return;
1014
+ else return self[self.length - 1 | 0];
1015
+ }
1016
+ function f4ah6o$yyjj$common$$Comment$new(content, kind, span, preceding_newline) {
1017
+ return {
1018
+ content,
1019
+ kind,
1020
+ span,
1021
+ preceding_newline
1022
+ };
1023
+ }
1024
+ function f4ah6o$yyjj$common$$Trivia$empty() {
1025
+ return {
1026
+ leading: [],
1027
+ trailing: []
1028
+ };
1029
+ }
1030
+ function f4ah6o$yyjj$common$$Trivia$new(leading, trailing) {
1031
+ return {
1032
+ leading,
1033
+ trailing
1034
+ };
1035
+ }
1036
+ function f4ah6o$yyjj$common$$Pos$new(line, column, offset) {
1037
+ return {
1038
+ line,
1039
+ column,
1040
+ offset
1041
+ };
1042
+ }
1043
+ function f4ah6o$yyjj$common$$Span$new(start, end) {
1044
+ return {
1045
+ start,
1046
+ end
1047
+ };
1048
+ }
1049
+ function f4ah6o$yyjj$common$$Span$at(pos) {
1050
+ return {
1051
+ start: pos,
1052
+ end: pos
1053
+ };
1054
+ }
1055
+ function f4ah6o$yyjj$common$$ParseError$new(kind, span, message) {
1056
+ return {
1057
+ kind,
1058
+ span,
1059
+ message
1060
+ };
1061
+ }
1062
+ function f4ah6o$yyjj$common$$ParseError$unexpected_token(token, span) {
1063
+ return {
1064
+ kind: new $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$UnexpectedToken(token),
1065
+ span,
1066
+ message: `unexpected token: ${token}`
1067
+ };
1068
+ }
1069
+ function f4ah6o$yyjj$common$$ParseError$unexpected_eof(span) {
1070
+ return {
1071
+ kind: $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$UnexpectedEof,
1072
+ span,
1073
+ message: "unexpected end of input"
1074
+ };
1075
+ }
1076
+ function f4ah6o$yyjj$pretty$$fits(width, items) {
1077
+ let remaining = width;
1078
+ if (remaining < 0) return false;
1079
+ while (true) if (items.length > 0) {
1080
+ const item = moonbitlang$core$array$$Array$pop$21$(items);
1081
+ if (item === void 0) break;
1082
+ else {
1083
+ const _x = item;
1084
+ const _indent = _x._0;
1085
+ const _mode = _x._1;
1086
+ const _doc = _x._2;
1087
+ switch (_doc.$tag) {
1088
+ case 0: break;
1089
+ case 1: {
1090
+ const _s = _doc._0;
1091
+ remaining = remaining - _s.length | 0;
1092
+ break;
1093
+ }
1094
+ case 2:
1095
+ if (_mode === 0) remaining = remaining - 1 | 0;
1096
+ else return true;
1097
+ break;
1098
+ case 3: return true;
1099
+ case 4: {
1100
+ const _Concat = _doc;
1101
+ const _a = _Concat._0;
1102
+ const _b = _Concat._1;
1103
+ moonbitlang$core$array$$Array$push$21$(items, {
1104
+ _0: _indent,
1105
+ _1: _mode,
1106
+ _2: _b
1107
+ });
1108
+ moonbitlang$core$array$$Array$push$21$(items, {
1109
+ _0: _indent,
1110
+ _1: _mode,
1111
+ _2: _a
1112
+ });
1113
+ break;
1114
+ }
1115
+ case 5: {
1116
+ const _Nest = _doc;
1117
+ const _i = _Nest._0;
1118
+ const _d = _Nest._1;
1119
+ moonbitlang$core$array$$Array$push$21$(items, {
1120
+ _0: _indent + _i | 0,
1121
+ _1: _mode,
1122
+ _2: _d
1123
+ });
1124
+ break;
1125
+ }
1126
+ case 6: {
1127
+ const _d$2 = _doc._0;
1128
+ moonbitlang$core$array$$Array$push$21$(items, {
1129
+ _0: _indent,
1130
+ _1: _mode,
1131
+ _2: _d$2
1132
+ });
1133
+ break;
1134
+ }
1135
+ default: {
1136
+ const _flat = _doc._0;
1137
+ moonbitlang$core$array$$Array$push$21$(items, {
1138
+ _0: _indent,
1139
+ _1: _mode,
1140
+ _2: _flat
1141
+ });
1142
+ }
1143
+ }
1144
+ if (remaining < 0) return false;
1145
+ }
1146
+ continue;
1147
+ } else break;
1148
+ return true;
1149
+ }
1150
+ function f4ah6o$yyjj$pretty$$render_items(buf, width, items) {
1151
+ let column = 0;
1152
+ while (true) if (items.length > 0) {
1153
+ const item = moonbitlang$core$array$$Array$pop$21$(items);
1154
+ if (item === void 0) break;
1155
+ else {
1156
+ const _x = item;
1157
+ const _indent = _x._0;
1158
+ const _mode = _x._1;
1159
+ const _doc = _x._2;
1160
+ switch (_doc.$tag) {
1161
+ case 0: break;
1162
+ case 1: {
1163
+ const _s = _doc._0;
1164
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, _s);
1165
+ column = column + _s.length | 0;
1166
+ break;
1167
+ }
1168
+ case 2:
1169
+ if (_mode === 0) {
1170
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 32);
1171
+ column = column + 1 | 0;
1172
+ } else {
1173
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 10);
1174
+ let _tmp = 0;
1175
+ while (true) {
1176
+ const i = _tmp;
1177
+ if (i < _indent) {
1178
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 32);
1179
+ _tmp = i + 1 | 0;
1180
+ continue;
1181
+ } else break;
1182
+ }
1183
+ column = _indent;
1184
+ }
1185
+ break;
1186
+ case 3: {
1187
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 10);
1188
+ let _tmp = 0;
1189
+ while (true) {
1190
+ const i = _tmp;
1191
+ if (i < _indent) {
1192
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 32);
1193
+ _tmp = i + 1 | 0;
1194
+ continue;
1195
+ } else break;
1196
+ }
1197
+ column = _indent;
1198
+ break;
1199
+ }
1200
+ case 4: {
1201
+ const _Concat = _doc;
1202
+ const _a = _Concat._0;
1203
+ const _b = _Concat._1;
1204
+ moonbitlang$core$array$$Array$push$21$(items, {
1205
+ _0: _indent,
1206
+ _1: _mode,
1207
+ _2: _b
1208
+ });
1209
+ moonbitlang$core$array$$Array$push$21$(items, {
1210
+ _0: _indent,
1211
+ _1: _mode,
1212
+ _2: _a
1213
+ });
1214
+ break;
1215
+ }
1216
+ case 5: {
1217
+ const _Nest = _doc;
1218
+ const _i = _Nest._0;
1219
+ const _d = _Nest._1;
1220
+ moonbitlang$core$array$$Array$push$21$(items, {
1221
+ _0: _indent + _i | 0,
1222
+ _1: _mode,
1223
+ _2: _d
1224
+ });
1225
+ break;
1226
+ }
1227
+ case 6: {
1228
+ const _d$2 = _doc._0;
1229
+ if (f4ah6o$yyjj$pretty$$fits(width - column | 0, [{
1230
+ _0: _indent,
1231
+ _1: 0,
1232
+ _2: _d$2
1233
+ }])) moonbitlang$core$array$$Array$push$21$(items, {
1234
+ _0: _indent,
1235
+ _1: 0,
1236
+ _2: _d$2
1237
+ });
1238
+ else moonbitlang$core$array$$Array$push$21$(items, {
1239
+ _0: _indent,
1240
+ _1: 1,
1241
+ _2: _d$2
1242
+ });
1243
+ break;
1244
+ }
1245
+ default: {
1246
+ const _FlatAlt = _doc;
1247
+ const _flat = _FlatAlt._0;
1248
+ const _broken = _FlatAlt._1;
1249
+ if (_mode === 0) moonbitlang$core$array$$Array$push$21$(items, {
1250
+ _0: _indent,
1251
+ _1: _mode,
1252
+ _2: _flat
1253
+ });
1254
+ else moonbitlang$core$array$$Array$push$21$(items, {
1255
+ _0: _indent,
1256
+ _1: _mode,
1257
+ _2: _broken
1258
+ });
1259
+ }
1260
+ }
1261
+ }
1262
+ continue;
1263
+ } else return;
1264
+ }
1265
+ function f4ah6o$yyjj$pretty$$render(doc, width) {
1266
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1267
+ f4ah6o$yyjj$pretty$$render_items(buf, width, [{
1268
+ _0: 0,
1269
+ _1: 1,
1270
+ _2: doc
1271
+ }]);
1272
+ return buf.val;
1273
+ }
1274
+ function f4ah6o$yyjj$pretty$$concat(docs) {
1275
+ if (docs.length === 0) return $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nil;
1276
+ let result = moonbitlang$core$array$$Array$at$12$(docs, 0);
1277
+ let _tmp = 1;
1278
+ while (true) {
1279
+ const i = _tmp;
1280
+ if (i < docs.length) {
1281
+ result = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Concat(result, moonbitlang$core$array$$Array$at$12$(docs, i));
1282
+ _tmp = i + 1 | 0;
1283
+ continue;
1284
+ } else break;
1285
+ }
1286
+ return result;
1287
+ }
1288
+ function f4ah6o$yyjj$pretty$$join(docs, sep) {
1289
+ if (docs.length === 0) return $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nil;
1290
+ let result = moonbitlang$core$array$$Array$at$12$(docs, 0);
1291
+ let _tmp = 1;
1292
+ while (true) {
1293
+ const i = _tmp;
1294
+ if (i < docs.length) {
1295
+ result = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Concat(result, new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Concat(sep, moonbitlang$core$array$$Array$at$12$(docs, i)));
1296
+ _tmp = i + 1 | 0;
1297
+ continue;
1298
+ } else break;
1299
+ }
1300
+ return result;
1301
+ }
1302
+ function moonbitlang$core$builtin$$Eq$equal$24$(_x_269, _x_270) {
1303
+ switch (_x_269.$tag) {
1304
+ case 0: if (_x_270.$tag === 0) return true;
1305
+ else return false;
1306
+ case 1: if (_x_270.$tag === 1) return true;
1307
+ else return false;
1308
+ case 2: if (_x_270.$tag === 2) return true;
1309
+ else return false;
1310
+ case 3: if (_x_270.$tag === 3) return true;
1311
+ else return false;
1312
+ case 4: if (_x_270.$tag === 4) return true;
1313
+ else return false;
1314
+ case 5: if (_x_270.$tag === 5) return true;
1315
+ else return false;
1316
+ case 6: {
1317
+ const _$42$x0_271 = _x_269._0;
1318
+ if (_x_270.$tag === 6) return _$42$x0_271 === _x_270._0;
1319
+ else return false;
1320
+ }
1321
+ case 7: {
1322
+ const _$42$x0_273 = _x_269._0;
1323
+ if (_x_270.$tag === 7) return _$42$x0_273 === _x_270._0;
1324
+ else return false;
1325
+ }
1326
+ case 8: if (_x_270.$tag === 8) return true;
1327
+ else return false;
1328
+ case 9: if (_x_270.$tag === 9) return true;
1329
+ else return false;
1330
+ case 10: if (_x_270.$tag === 10) return true;
1331
+ else return false;
1332
+ case 11: {
1333
+ const _$42$x0_275 = _x_269._0;
1334
+ if (_x_270.$tag === 11) return _$42$x0_275 === _x_270._0;
1335
+ else return false;
1336
+ }
1337
+ case 12: {
1338
+ const _$42$x0_277 = _x_269._0;
1339
+ if (_x_270.$tag === 12) return _$42$x0_277 === _x_270._0;
1340
+ else return false;
1341
+ }
1342
+ case 13: {
1343
+ const _$42$x0_279 = _x_269._0;
1344
+ if (_x_270.$tag === 13) return _$42$x0_279 === _x_270._0;
1345
+ else return false;
1346
+ }
1347
+ case 14: if (_x_270.$tag === 14) return true;
1348
+ else return false;
1349
+ case 15: if (_x_270.$tag === 15) return true;
1350
+ else return false;
1351
+ default: {
1352
+ const _$42$x0_281 = _x_269._0;
1353
+ if (_x_270.$tag === 16) return _$42$x0_281 === _x_270._0;
1354
+ else return false;
1355
+ }
1356
+ }
1357
+ }
1358
+ function f4ah6o$yyjj$jsonc$$Token$new(kind, span) {
1359
+ return {
1360
+ kind,
1361
+ span
1362
+ };
1363
+ }
1364
+ function f4ah6o$yyjj$jsonc$$int_to_hex4(n) {
1365
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1366
+ const _tmp = n >> 12 & 15;
1367
+ $bound_check(f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192, _tmp);
1368
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192.charCodeAt(_tmp));
1369
+ const _tmp$2 = n >> 8 & 15;
1370
+ $bound_check(f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192, _tmp$2);
1371
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192.charCodeAt(_tmp$2));
1372
+ const _tmp$3 = n >> 4 & 15;
1373
+ $bound_check(f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192, _tmp$3);
1374
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192.charCodeAt(_tmp$3));
1375
+ const _tmp$4 = n & 15;
1376
+ $bound_check(f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192, _tmp$4);
1377
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, f4ah6o$yyjj$jsonc$$int_to_hex4$46$hex_chars$124$192.charCodeAt(_tmp$4));
1378
+ return buf.val;
1379
+ }
1380
+ function f4ah6o$yyjj$jsonc$$escape_json_string(s) {
1381
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1382
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 34);
1383
+ let _tmp = 0;
1384
+ while (true) {
1385
+ const i = _tmp;
1386
+ if (i < s.length) {
1387
+ $bound_check(s, i);
1388
+ const ch = s.charCodeAt(i);
1389
+ switch (ch) {
1390
+ case 34:
1391
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\\"");
1392
+ break;
1393
+ case 92:
1394
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\\\");
1395
+ break;
1396
+ case 10:
1397
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\n");
1398
+ break;
1399
+ case 13:
1400
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\r");
1401
+ break;
1402
+ case 9:
1403
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\t");
1404
+ break;
1405
+ default: if (ch < 32) {
1406
+ const hex = f4ah6o$yyjj$jsonc$$int_to_hex4(ch);
1407
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\u");
1408
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, hex);
1409
+ } else moonbitlang$core$builtin$$Logger$write_char$0$(buf, ch);
1410
+ }
1411
+ _tmp = i + 1 | 0;
1412
+ continue;
1413
+ } else break;
1414
+ }
1415
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 34);
1416
+ return buf.val;
1417
+ }
1418
+ function f4ah6o$yyjj$jsonc$$trivia_to_doc(comments, is_leading) {
1419
+ if (comments.length === 0) return $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nil;
1420
+ const docs = [];
1421
+ let _tmp = 0;
1422
+ while (true) {
1423
+ const i = _tmp;
1424
+ if (i < comments.length) {
1425
+ const comment = moonbitlang$core$array$$Array$at$9$(comments, i);
1426
+ const _bind = comment.kind;
1427
+ let text;
1428
+ if (_bind === 0) text = `//${comment.content}`;
1429
+ else text = `/*${comment.content}*/`;
1430
+ if (is_leading) moonbitlang$core$array$$Array$push$12$(docs, f4ah6o$yyjj$pretty$$concat([new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(text), $64$f4ah6o$47$yyjj$47$pretty$46$Doc$HardLine]));
1431
+ else moonbitlang$core$array$$Array$push$12$(docs, f4ah6o$yyjj$pretty$$concat([new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(" "), new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(text)]));
1432
+ _tmp = i + 1 | 0;
1433
+ continue;
1434
+ } else break;
1435
+ }
1436
+ return f4ah6o$yyjj$pretty$$concat(docs);
1437
+ }
1438
+ function f4ah6o$yyjj$jsonc$$JsonNode$trivia(self) {
1439
+ switch (self.$tag) {
1440
+ case 0: return self._0;
1441
+ case 1: return self._1;
1442
+ case 2: return self._1;
1443
+ case 3: return self._1;
1444
+ case 4: return self._1;
1445
+ default: return self._1;
1446
+ }
1447
+ }
1448
+ function f4ah6o$yyjj$jsonc$$to_doc_with_trivia(node) {
1449
+ const trivia = f4ah6o$yyjj$jsonc$$JsonNode$trivia(node);
1450
+ const leading = f4ah6o$yyjj$jsonc$$trivia_to_doc(trivia.leading, true);
1451
+ const trailing = f4ah6o$yyjj$jsonc$$trivia_to_doc(trivia.trailing, false);
1452
+ return f4ah6o$yyjj$pretty$$concat([
1453
+ leading,
1454
+ f4ah6o$yyjj$jsonc$$node_to_doc(node),
1455
+ trailing
1456
+ ]);
1457
+ }
1458
+ function f4ah6o$yyjj$jsonc$$node_to_doc(node) {
1459
+ switch (node.$tag) {
1460
+ case 0: return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("null");
1461
+ case 1: if (node._0 === true) return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("true");
1462
+ else return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("false");
1463
+ case 2: {
1464
+ const _n = node._0;
1465
+ return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(_n);
1466
+ }
1467
+ case 3: {
1468
+ const _s = node._0;
1469
+ return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(f4ah6o$yyjj$jsonc$$escape_json_string(_s));
1470
+ }
1471
+ case 4: {
1472
+ const _elements = node._0;
1473
+ return f4ah6o$yyjj$jsonc$$array_to_doc(_elements);
1474
+ }
1475
+ default: {
1476
+ const _props = node._0;
1477
+ return f4ah6o$yyjj$jsonc$$object_to_doc(_props);
1478
+ }
1479
+ }
1480
+ }
1481
+ function f4ah6o$yyjj$jsonc$$array_to_doc(elements) {
1482
+ if (elements.length === 0) return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("[]");
1483
+ const open = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("[");
1484
+ const close = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("]");
1485
+ const content_docs = [];
1486
+ let _tmp = 0;
1487
+ while (true) {
1488
+ const i = _tmp;
1489
+ if (i < elements.length) {
1490
+ const elem_doc = f4ah6o$yyjj$jsonc$$to_doc_with_trivia(moonbitlang$core$array$$Array$at$13$(elements, i));
1491
+ if (i < (elements.length - 1 | 0)) moonbitlang$core$array$$Array$push$12$(content_docs, f4ah6o$yyjj$pretty$$concat([elem_doc, new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(",")]));
1492
+ else moonbitlang$core$array$$Array$push$12$(content_docs, elem_doc);
1493
+ _tmp = i + 1 | 0;
1494
+ continue;
1495
+ } else break;
1496
+ }
1497
+ return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Group(f4ah6o$yyjj$pretty$$concat([
1498
+ open,
1499
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nest(2, f4ah6o$yyjj$pretty$$concat([$64$f4ah6o$47$yyjj$47$pretty$46$Doc$Line, f4ah6o$yyjj$pretty$$join(content_docs, $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Line)])),
1500
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Line,
1501
+ close
1502
+ ]));
1503
+ }
1504
+ function f4ah6o$yyjj$jsonc$$object_to_doc(props) {
1505
+ if (props.length === 0) return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("{}");
1506
+ const open = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("{");
1507
+ const close = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("}");
1508
+ const prop_docs = [];
1509
+ let _tmp = 0;
1510
+ while (true) {
1511
+ const i = _tmp;
1512
+ if (i < props.length) {
1513
+ const prop = moonbitlang$core$array$$Array$at$14$(props, i);
1514
+ const key_doc = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(f4ah6o$yyjj$jsonc$$escape_json_string(prop.key));
1515
+ const value_doc = f4ah6o$yyjj$jsonc$$to_doc_with_trivia(prop.value);
1516
+ const prop_doc = f4ah6o$yyjj$pretty$$concat([
1517
+ key_doc,
1518
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(": "),
1519
+ value_doc
1520
+ ]);
1521
+ if (i < (props.length - 1 | 0)) moonbitlang$core$array$$Array$push$12$(prop_docs, f4ah6o$yyjj$pretty$$concat([prop_doc, new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(",")]));
1522
+ else moonbitlang$core$array$$Array$push$12$(prop_docs, prop_doc);
1523
+ _tmp = i + 1 | 0;
1524
+ continue;
1525
+ } else break;
1526
+ }
1527
+ return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Group(f4ah6o$yyjj$pretty$$concat([
1528
+ open,
1529
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nest(2, f4ah6o$yyjj$pretty$$concat([$64$f4ah6o$47$yyjj$47$pretty$46$Doc$Line, f4ah6o$yyjj$pretty$$join(prop_docs, $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Line)])),
1530
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Line,
1531
+ close
1532
+ ]));
1533
+ }
1534
+ function f4ah6o$yyjj$jsonc$$to_doc(node) {
1535
+ return f4ah6o$yyjj$jsonc$$to_doc_with_trivia(node);
1536
+ }
1537
+ function f4ah6o$yyjj$jsonc$$print(node, width) {
1538
+ const _p = 80;
1539
+ let w;
1540
+ if (width === void 0) w = _p;
1541
+ else w = width;
1542
+ return f4ah6o$yyjj$pretty$$render(f4ah6o$yyjj$jsonc$$to_doc(node), w);
1543
+ }
1544
+ function f4ah6o$yyjj$jsonc$$Lexer$new(source) {
1545
+ return {
1546
+ source,
1547
+ pos: 0,
1548
+ line: 0,
1549
+ column: 0
1550
+ };
1551
+ }
1552
+ function f4ah6o$yyjj$jsonc$$Lexer$advance(self) {
1553
+ if (self.pos >= self.source.length) return -1;
1554
+ const _p = self.pos;
1555
+ const _tmp = self.source;
1556
+ $bound_check(_tmp, _p);
1557
+ const ch = _tmp.charCodeAt(_p);
1558
+ self.pos = self.pos + 1 | 0;
1559
+ if (ch === 10) {
1560
+ self.line = self.line + 1 | 0;
1561
+ self.column = 0;
1562
+ } else self.column = self.column + 1 | 0;
1563
+ return ch;
1564
+ }
1565
+ function f4ah6o$yyjj$jsonc$$Lexer$current_pos(self) {
1566
+ return f4ah6o$yyjj$common$$Pos$new(self.line, self.column, self.pos);
1567
+ }
1568
+ function f4ah6o$yyjj$jsonc$$Lexer$peek(self) {
1569
+ if (self.pos >= self.source.length) return -1;
1570
+ else {
1571
+ const _p = self.pos;
1572
+ const _tmp = self.source;
1573
+ $bound_check(_tmp, _p);
1574
+ return _tmp.charCodeAt(_p);
1575
+ }
1576
+ }
1577
+ function f4ah6o$yyjj$jsonc$$Lexer$skip_while(self, pred) {
1578
+ const start = self.pos;
1579
+ while (true) {
1580
+ let _tmp;
1581
+ if (!(self.pos >= self.source.length)) {
1582
+ const _p = self.pos;
1583
+ const _tmp$2 = self.source;
1584
+ $bound_check(_tmp$2, _p);
1585
+ _tmp = pred(_tmp$2.charCodeAt(_p));
1586
+ } else _tmp = false;
1587
+ if (_tmp) {
1588
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1589
+ continue;
1590
+ } else break;
1591
+ }
1592
+ return moonbitlang$core$string$$String$substring$46$inner(self.source, start, self.pos);
1593
+ }
1594
+ function f4ah6o$yyjj$jsonc$$Lexer$lex_comment_or_invalid(self, start) {
1595
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1596
+ _L: {
1597
+ const _bind = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1598
+ if (_bind === -1) break _L;
1599
+ else switch (_bind) {
1600
+ case 47:
1601
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1602
+ return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$LineComment(f4ah6o$yyjj$jsonc$$Lexer$skip_while(self, (c) => c !== 10 && c !== 13)), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1603
+ case 42: {
1604
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1605
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1606
+ while (true) {
1607
+ const _bind$2 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1608
+ if (_bind$2 === -1) return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_comment_or_invalid$46$constr$47$595, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1609
+ else {
1610
+ const _x$2 = _bind$2;
1611
+ if (_x$2 === 42) {
1612
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1613
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$jsonc$$Lexer$peek(self), f4ah6o$yyjj$jsonc$$lex_comment_or_invalid$46$constr$47$596)) {
1614
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1615
+ break;
1616
+ } else moonbitlang$core$builtin$$Logger$write_char$0$(buf, 42);
1617
+ } else {
1618
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1619
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, _x$2);
1620
+ }
1621
+ }
1622
+ continue;
1623
+ }
1624
+ return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$BlockComment(buf.val), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1625
+ }
1626
+ default: break _L;
1627
+ }
1628
+ }
1629
+ return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_comment_or_invalid$46$constr$47$594, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1630
+ }
1631
+ function f4ah6o$yyjj$jsonc$$is_ident_char(c) {
1632
+ return c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95;
1633
+ }
1634
+ function f4ah6o$yyjj$jsonc$$Lexer$lex_keyword(self, expected, kind, start) {
1635
+ let _tmp = 0;
1636
+ while (true) {
1637
+ const i = _tmp;
1638
+ if (i < expected.length) {
1639
+ _L: {
1640
+ _L$2: {
1641
+ const _bind$1 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1642
+ if (_bind$1 === -1) break _L$2;
1643
+ else {
1644
+ const _c = _bind$1;
1645
+ $bound_check(expected, i);
1646
+ if (_c === expected.charCodeAt(i)) f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1647
+ else break _L$2;
1648
+ }
1649
+ break _L;
1650
+ }
1651
+ const ident = f4ah6o$yyjj$jsonc$$Lexer$skip_while(self, (c) => f4ah6o$yyjj$jsonc$$is_ident_char(c));
1652
+ return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid(`unexpected identifier: ${moonbitlang$core$string$$String$substring$46$inner(expected, 0, i)}${ident}`), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1653
+ }
1654
+ _tmp = i + 1 | 0;
1655
+ continue;
1656
+ } else break;
1657
+ }
1658
+ const _bind = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1659
+ if (_bind === -1) {} else if (f4ah6o$yyjj$jsonc$$is_ident_char(_bind)) return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid(`unexpected identifier: ${expected}${f4ah6o$yyjj$jsonc$$Lexer$skip_while(self, (c) => f4ah6o$yyjj$jsonc$$is_ident_char(c))}`), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1660
+ return f4ah6o$yyjj$jsonc$$Token$new(kind, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1661
+ }
1662
+ function f4ah6o$yyjj$jsonc$$Lexer$lex_number(self, start) {
1663
+ const num_start = self.pos;
1664
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$jsonc$$Lexer$peek(self), f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$628)) f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1665
+ _L: {
1666
+ _L$2: {
1667
+ const _bind$1 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1668
+ if (_bind$1 === -1) break _L$2;
1669
+ else {
1670
+ const _x = _bind$1;
1671
+ if (_x === 48) f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1672
+ else if (_x >= 49 && _x <= 57) {
1673
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1674
+ while (true) {
1675
+ const _bind$2 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1676
+ if (_bind$2 === -1) break;
1677
+ else {
1678
+ const _d = _bind$2;
1679
+ if (_d >= 48) if (_d <= 57) {
1680
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1681
+ continue;
1682
+ } else break;
1683
+ else break;
1684
+ }
1685
+ }
1686
+ } else break _L$2;
1687
+ }
1688
+ break _L;
1689
+ }
1690
+ return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$629, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1691
+ }
1692
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$jsonc$$Lexer$peek(self), f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$630)) {
1693
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1694
+ const _bind$1 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1695
+ let _tmp;
1696
+ if (_bind$1 === -1) _tmp = false;
1697
+ else {
1698
+ const _d = _bind$1;
1699
+ _tmp = _d >= 48 && _d <= 57;
1700
+ }
1701
+ if (!_tmp) return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$631, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1702
+ while (true) {
1703
+ const _bind$2 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1704
+ if (_bind$2 === -1) break;
1705
+ else {
1706
+ const _d = _bind$2;
1707
+ if (_d >= 48) if (_d <= 57) {
1708
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1709
+ continue;
1710
+ } else break;
1711
+ else break;
1712
+ }
1713
+ }
1714
+ }
1715
+ const _bind = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1716
+ if (_bind === -1) {} else {
1717
+ const _e = _bind;
1718
+ _L$2: {
1719
+ _L$3: {
1720
+ if (_e === 101) break _L$3;
1721
+ else if (_e === 69) break _L$3;
1722
+ break _L$2;
1723
+ }
1724
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1725
+ const _bind$2 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1726
+ if (_bind$2 === -1) {} else {
1727
+ const _s = _bind$2;
1728
+ _L$4: {
1729
+ _L$5: {
1730
+ if (_s === 43) break _L$5;
1731
+ else if (_s === 45) break _L$5;
1732
+ break _L$4;
1733
+ }
1734
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1735
+ }
1736
+ }
1737
+ const _bind$3 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1738
+ let _tmp;
1739
+ if (_bind$3 === -1) _tmp = false;
1740
+ else {
1741
+ const _d = _bind$3;
1742
+ _tmp = _d >= 48 && _d <= 57;
1743
+ }
1744
+ if (!_tmp) return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_number$46$constr$47$632, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1745
+ while (true) {
1746
+ const _bind$4 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1747
+ if (_bind$4 === -1) break;
1748
+ else {
1749
+ const _d = _bind$4;
1750
+ if (_d >= 48) if (_d <= 57) {
1751
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1752
+ continue;
1753
+ } else break;
1754
+ else break;
1755
+ }
1756
+ }
1757
+ }
1758
+ }
1759
+ return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Number(moonbitlang$core$string$$String$substring$46$inner(self.source, num_start, self.pos)), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1760
+ }
1761
+ function f4ah6o$yyjj$jsonc$$is_hex_digit(c) {
1762
+ return c >= 48 && c <= 57 || c >= 97 && c <= 102 || c >= 65 && c <= 70;
1763
+ }
1764
+ function f4ah6o$yyjj$jsonc$$parse_hex(s) {
1765
+ let result = 0;
1766
+ let _tmp = 0;
1767
+ while (true) {
1768
+ const i = _tmp;
1769
+ if (i < s.length) {
1770
+ $bound_check(s, i);
1771
+ const c = s.charCodeAt(i);
1772
+ let digit;
1773
+ if (c >= 48 && c <= 57) digit = c - 48 | 0;
1774
+ else if (c >= 97 && c <= 102) digit = (c - 97 | 0) + 10 | 0;
1775
+ else if (c >= 65 && c <= 70) digit = (c - 65 | 0) + 10 | 0;
1776
+ else return;
1777
+ result = (Math.imul(result, 16) | 0) + digit | 0;
1778
+ _tmp = i + 1 | 0;
1779
+ continue;
1780
+ } else break;
1781
+ }
1782
+ return result;
1783
+ }
1784
+ function f4ah6o$yyjj$jsonc$$Lexer$lex_string(self, start) {
1785
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1786
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1787
+ _L: while (true) {
1788
+ const _bind = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1789
+ if (_bind === -1) return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$674, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1790
+ else {
1791
+ const _x = _bind;
1792
+ switch (_x) {
1793
+ case 34:
1794
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1795
+ break _L;
1796
+ case 92: {
1797
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1798
+ const _bind$2 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1799
+ if (_bind$2 === -1) return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$675, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1800
+ else {
1801
+ const _esc = _bind$2;
1802
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1803
+ switch (_esc) {
1804
+ case 34:
1805
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 34);
1806
+ break;
1807
+ case 92:
1808
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 92);
1809
+ break;
1810
+ case 47:
1811
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 47);
1812
+ break;
1813
+ case 98:
1814
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 8);
1815
+ break;
1816
+ case 102:
1817
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 12);
1818
+ break;
1819
+ case 110:
1820
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 10);
1821
+ break;
1822
+ case 116:
1823
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 9);
1824
+ break;
1825
+ case 114:
1826
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 13);
1827
+ break;
1828
+ case 117: {
1829
+ let hex = "";
1830
+ let _tmp = 0;
1831
+ while (true) {
1832
+ const i = _tmp;
1833
+ if (i < 4) {
1834
+ _L$2: {
1835
+ _L$3: {
1836
+ const _bind$3$1 = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1837
+ if (_bind$3$1 === -1) break _L$3;
1838
+ else {
1839
+ const _h = _bind$3$1;
1840
+ if (f4ah6o$yyjj$jsonc$$is_hex_digit(_h)) {
1841
+ hex = `${hex}${moonbitlang$core$builtin$$Show$to_string$22$(_h)}`;
1842
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1843
+ } else break _L$3;
1844
+ }
1845
+ break _L$2;
1846
+ }
1847
+ return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$676, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1848
+ }
1849
+ _tmp = i + 1 | 0;
1850
+ continue;
1851
+ } else break;
1852
+ }
1853
+ const _bind$3 = f4ah6o$yyjj$jsonc$$parse_hex(hex);
1854
+ if (_bind$3 === void 0) return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$677, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1855
+ else moonbitlang$core$builtin$$Logger$write_char$0$(buf, _bind$3);
1856
+ break;
1857
+ }
1858
+ default: return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid(`invalid escape sequence: \\${moonbitlang$core$builtin$$Show$to_string$22$(_esc)}`), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1859
+ }
1860
+ }
1861
+ break;
1862
+ }
1863
+ default: if (_x < 32) return f4ah6o$yyjj$jsonc$$Token$new(f4ah6o$yyjj$jsonc$$lex_string$46$constr$47$678, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1864
+ else {
1865
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1866
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, _x);
1867
+ }
1868
+ }
1869
+ }
1870
+ continue;
1871
+ }
1872
+ return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$String(buf.val), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1873
+ }
1874
+ function f4ah6o$yyjj$jsonc$$Lexer$next_token(self) {
1875
+ const start = f4ah6o$yyjj$jsonc$$Lexer$current_pos(self);
1876
+ const _bind = f4ah6o$yyjj$jsonc$$Lexer$peek(self);
1877
+ if (_bind === -1) return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Eof, f4ah6o$yyjj$common$$Span$at(start));
1878
+ else {
1879
+ const _ch = _bind;
1880
+ _L: {
1881
+ _L$2: switch (_ch) {
1882
+ case 123:
1883
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1884
+ return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$LBrace, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1885
+ case 125:
1886
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1887
+ return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBrace, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1888
+ case 91:
1889
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1890
+ return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$LBracket, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1891
+ case 93:
1892
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1893
+ return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBracket, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1894
+ case 58:
1895
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1896
+ return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Colon, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1897
+ case 44:
1898
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1899
+ return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Comma, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1900
+ case 34: return f4ah6o$yyjj$jsonc$$Lexer$lex_string(self, start);
1901
+ case 32: break _L$2;
1902
+ case 9: break _L$2;
1903
+ case 10:
1904
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1905
+ return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Newline, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1906
+ case 13:
1907
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1908
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$jsonc$$Lexer$peek(self), f4ah6o$yyjj$jsonc$$next_token$46$constr$47$699)) f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1909
+ return f4ah6o$yyjj$jsonc$$Token$new($64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Newline, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1910
+ case 47: return f4ah6o$yyjj$jsonc$$Lexer$lex_comment_or_invalid(self, start);
1911
+ case 45: break _L;
1912
+ case 48: break _L;
1913
+ case 49: break _L;
1914
+ case 50: break _L;
1915
+ case 51: break _L;
1916
+ case 52: break _L;
1917
+ case 53: break _L;
1918
+ case 54: break _L;
1919
+ case 55: break _L;
1920
+ case 56: break _L;
1921
+ case 57: break _L;
1922
+ case 116: return f4ah6o$yyjj$jsonc$$Lexer$lex_keyword(self, "true", $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$True, start);
1923
+ case 102: return f4ah6o$yyjj$jsonc$$Lexer$lex_keyword(self, "false", $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$False, start);
1924
+ case 110: return f4ah6o$yyjj$jsonc$$Lexer$lex_keyword(self, "null", $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Null, start);
1925
+ default:
1926
+ f4ah6o$yyjj$jsonc$$Lexer$advance(self);
1927
+ return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Invalid(`unexpected character: ${moonbitlang$core$builtin$$Show$to_string$22$(_ch)}`), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1928
+ }
1929
+ return f4ah6o$yyjj$jsonc$$Token$new(new $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Whitespace(f4ah6o$yyjj$jsonc$$Lexer$skip_while(self, (c) => c === 32 || c === 9)), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$jsonc$$Lexer$current_pos(self)));
1930
+ }
1931
+ return f4ah6o$yyjj$jsonc$$Lexer$lex_number(self, start);
1932
+ }
1933
+ }
1934
+ function f4ah6o$yyjj$jsonc$$Lexer$tokenize(self) {
1935
+ const tokens = [];
1936
+ while (true) {
1937
+ const tok = f4ah6o$yyjj$jsonc$$Lexer$next_token(self);
1938
+ const is_eof = moonbitlang$core$builtin$$Eq$equal$24$(tok.kind, $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Eof);
1939
+ moonbitlang$core$array$$Array$push$7$(tokens, tok);
1940
+ if (is_eof) break;
1941
+ continue;
1942
+ }
1943
+ return tokens;
1944
+ }
1945
+ function f4ah6o$yyjj$jsonc$$Parser$from_source(source) {
1946
+ return {
1947
+ tokens: f4ah6o$yyjj$jsonc$$Lexer$tokenize(f4ah6o$yyjj$jsonc$$Lexer$new(source)),
1948
+ pos: 0,
1949
+ pending_trivia: [],
1950
+ saw_newline: false
1951
+ };
1952
+ }
1953
+ function f4ah6o$yyjj$jsonc$$Parser$peek(self) {
1954
+ return self.pos < self.tokens.length ? moonbitlang$core$array$$Array$at$7$(self.tokens, self.pos) : void 0;
1955
+ }
1956
+ function f4ah6o$yyjj$jsonc$$Parser$peek_kind(self) {
1957
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$peek(self);
1958
+ if (_bind === void 0) return;
1959
+ else return _bind.kind;
1960
+ }
1961
+ function f4ah6o$yyjj$jsonc$$Parser$is_eof(self) {
1962
+ return self.pos >= self.tokens.length || moonbitlang$core$builtin$$Eq$equal$23$(f4ah6o$yyjj$jsonc$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Eof);
1963
+ }
1964
+ function f4ah6o$yyjj$jsonc$$Parser$advance(self) {
1965
+ if (self.pos < self.tokens.length) {
1966
+ const tok = moonbitlang$core$array$$Array$at$7$(self.tokens, self.pos);
1967
+ self.pos = self.pos + 1 | 0;
1968
+ return tok;
1969
+ } else return;
1970
+ }
1971
+ function f4ah6o$yyjj$jsonc$$Parser$current_span(self) {
1972
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$peek(self);
1973
+ if (_bind === void 0) return f4ah6o$yyjj$common$$Span$at(f4ah6o$yyjj$common$$zero$46$record$47$413);
1974
+ else return _bind.span;
1975
+ }
1976
+ function f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self) {
1977
+ while (true) {
1978
+ _L: {
1979
+ _L$2: {
1980
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$peek_kind(self);
1981
+ if (_bind === void 0) break _L$2;
1982
+ else {
1983
+ const _x = _bind;
1984
+ switch (_x.$tag) {
1985
+ case 13:
1986
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
1987
+ break;
1988
+ case 14:
1989
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
1990
+ self.saw_newline = true;
1991
+ break;
1992
+ case 11: {
1993
+ const _content = _x._0;
1994
+ const tok = f4ah6o$yyjj$jsonc$$Parser$advance(self);
1995
+ if (tok === void 0) return;
1996
+ else {
1997
+ const comment = f4ah6o$yyjj$common$$Comment$new(_content, 0, tok.span, self.saw_newline);
1998
+ moonbitlang$core$array$$Array$push$9$(self.pending_trivia, comment);
1999
+ self.saw_newline = true;
2000
+ }
2001
+ break;
2002
+ }
2003
+ case 12: {
2004
+ const _content$2 = _x._0;
2005
+ const tok$2 = f4ah6o$yyjj$jsonc$$Parser$advance(self);
2006
+ if (tok$2 === void 0) return;
2007
+ else {
2008
+ const comment = f4ah6o$yyjj$common$$Comment$new(_content$2, 1, tok$2.span, self.saw_newline);
2009
+ moonbitlang$core$array$$Array$push$9$(self.pending_trivia, comment);
2010
+ }
2011
+ break;
2012
+ }
2013
+ default: break _L$2;
2014
+ }
2015
+ }
2016
+ break _L;
2017
+ }
2018
+ break;
2019
+ }
2020
+ continue;
2021
+ }
2022
+ }
2023
+ function f4ah6o$yyjj$jsonc$$Parser$flush_leading(self) {
2024
+ const leading = moonbitlang$core$array$$Array$copy$9$(self.pending_trivia);
2025
+ moonbitlang$core$array$$Array$clear$9$(self.pending_trivia);
2026
+ self.saw_newline = false;
2027
+ return leading;
2028
+ }
2029
+ function f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self) {
2030
+ const trailing = [];
2031
+ _L: while (true) {
2032
+ _L$2: {
2033
+ _L$3: {
2034
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$peek_kind(self);
2035
+ if (_bind === void 0) break _L$3;
2036
+ else {
2037
+ const _x = _bind;
2038
+ switch (_x.$tag) {
2039
+ case 13:
2040
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2041
+ break;
2042
+ case 11: {
2043
+ const _content = _x._0;
2044
+ if (!self.saw_newline) {
2045
+ const tok = f4ah6o$yyjj$jsonc$$Parser$advance(self);
2046
+ if (tok === void 0) break _L;
2047
+ else {
2048
+ moonbitlang$core$array$$Array$push$9$(trailing, f4ah6o$yyjj$common$$Comment$new(_content, 0, tok.span, false));
2049
+ self.saw_newline = true;
2050
+ }
2051
+ }
2052
+ break _L;
2053
+ }
2054
+ case 12: {
2055
+ const _content$2 = _x._0;
2056
+ if (!self.saw_newline) {
2057
+ const tok = f4ah6o$yyjj$jsonc$$Parser$advance(self);
2058
+ if (tok === void 0) break _L;
2059
+ else moonbitlang$core$array$$Array$push$9$(trailing, f4ah6o$yyjj$common$$Comment$new(_content$2, 1, tok.span, false));
2060
+ } else {
2061
+ const tok = f4ah6o$yyjj$jsonc$$Parser$advance(self);
2062
+ if (tok === void 0) break _L;
2063
+ else {
2064
+ const comment = f4ah6o$yyjj$common$$Comment$new(_content$2, 1, tok.span, self.saw_newline);
2065
+ moonbitlang$core$array$$Array$push$9$(self.pending_trivia, comment);
2066
+ }
2067
+ }
2068
+ break;
2069
+ }
2070
+ case 14:
2071
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2072
+ self.saw_newline = true;
2073
+ break _L;
2074
+ default: break _L$3;
2075
+ }
2076
+ }
2077
+ break _L$2;
2078
+ }
2079
+ break;
2080
+ }
2081
+ continue;
2082
+ }
2083
+ return trailing;
2084
+ }
2085
+ function f4ah6o$yyjj$jsonc$$token_kind_matches(a, b) {
2086
+ switch (a.$tag) {
2087
+ case 0: if (b.$tag === 0) return true;
2088
+ else return false;
2089
+ case 1: if (b.$tag === 1) return true;
2090
+ else return false;
2091
+ case 2: if (b.$tag === 2) return true;
2092
+ else return false;
2093
+ case 3: if (b.$tag === 3) return true;
2094
+ else return false;
2095
+ case 4: if (b.$tag === 4) return true;
2096
+ else return false;
2097
+ case 5: if (b.$tag === 5) return true;
2098
+ else return false;
2099
+ case 8: if (b.$tag === 8) return true;
2100
+ else return false;
2101
+ case 9: if (b.$tag === 9) return true;
2102
+ else return false;
2103
+ case 10: if (b.$tag === 10) return true;
2104
+ else return false;
2105
+ case 15: if (b.$tag === 15) return true;
2106
+ else return false;
2107
+ case 6: if (b.$tag === 6) return true;
2108
+ else return false;
2109
+ case 7: if (b.$tag === 7) return true;
2110
+ else return false;
2111
+ case 11: if (b.$tag === 11) return true;
2112
+ else return false;
2113
+ case 12: if (b.$tag === 12) return true;
2114
+ else return false;
2115
+ case 13: if (b.$tag === 13) return true;
2116
+ else return false;
2117
+ case 14: if (b.$tag === 14) return true;
2118
+ else return false;
2119
+ default: if (b.$tag === 16) return true;
2120
+ else return false;
2121
+ }
2122
+ }
2123
+ function f4ah6o$yyjj$jsonc$$token_kind_name(kind) {
2124
+ switch (kind.$tag) {
2125
+ case 0: return "'{'";
2126
+ case 1: return "'}'";
2127
+ case 2: return "'['";
2128
+ case 3: return "']'";
2129
+ case 4: return "':'";
2130
+ case 5: return "','";
2131
+ case 6: return "string";
2132
+ case 7: return "number";
2133
+ case 8: return "'true'";
2134
+ case 9: return "'false'";
2135
+ case 10: return "'null'";
2136
+ case 11: return "comment";
2137
+ case 12: return "comment";
2138
+ case 13: return "whitespace";
2139
+ case 14: return "newline";
2140
+ case 15: return "end of input";
2141
+ default: return kind._0;
2142
+ }
2143
+ }
2144
+ function f4ah6o$yyjj$jsonc$$Parser$expect(self, kind) {
2145
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2146
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$peek(self);
2147
+ if (_bind === void 0) return new Result$Err$1$(f4ah6o$yyjj$common$$ParseError$unexpected_eof(f4ah6o$yyjj$jsonc$$Parser$current_span(self)));
2148
+ else {
2149
+ const _t = _bind;
2150
+ if (f4ah6o$yyjj$jsonc$$token_kind_matches(_t.kind, kind)) {
2151
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2152
+ return new Result$Ok$1$(_t);
2153
+ } else return new Result$Err$1$(f4ah6o$yyjj$common$$ParseError$unexpected_token(f4ah6o$yyjj$jsonc$$token_kind_name(_t.kind), _t.span));
2154
+ }
2155
+ }
2156
+ function f4ah6o$yyjj$jsonc$$JProperty$new(key, key_trivia, value) {
2157
+ return {
2158
+ key,
2159
+ key_trivia,
2160
+ value
2161
+ };
2162
+ }
2163
+ function f4ah6o$yyjj$jsonc$$Parser$parse_value(self) {
2164
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2165
+ const leading = f4ah6o$yyjj$jsonc$$Parser$flush_leading(self);
2166
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$peek_kind(self);
2167
+ if (_bind === void 0) return new Result$Err$2$(f4ah6o$yyjj$common$$ParseError$unexpected_eof(f4ah6o$yyjj$jsonc$$Parser$current_span(self)));
2168
+ else {
2169
+ const _x = _bind;
2170
+ switch (_x.$tag) {
2171
+ case 0: return f4ah6o$yyjj$jsonc$$Parser$parse_object(self, leading);
2172
+ case 2: return f4ah6o$yyjj$jsonc$$Parser$parse_array(self, leading);
2173
+ case 6: {
2174
+ const _s = _x._0;
2175
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2176
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JString(_s, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2177
+ }
2178
+ case 7: {
2179
+ const _n = _x._0;
2180
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2181
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JNumber(_n, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2182
+ }
2183
+ case 8:
2184
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2185
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JBool(true, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2186
+ case 9:
2187
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2188
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JBool(false, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2189
+ case 10:
2190
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2191
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JNull(f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2192
+ case 16: {
2193
+ const _msg = _x._0;
2194
+ const span = f4ah6o$yyjj$jsonc$$Parser$current_span(self);
2195
+ return new Result$Err$2$(f4ah6o$yyjj$common$$ParseError$new(new $64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$UnexpectedToken(_msg), span, _msg));
2196
+ }
2197
+ default: return new Result$Err$2$(f4ah6o$yyjj$common$$ParseError$unexpected_token(f4ah6o$yyjj$jsonc$$token_kind_name(_x), f4ah6o$yyjj$jsonc$$Parser$current_span(self)));
2198
+ }
2199
+ }
2200
+ }
2201
+ function f4ah6o$yyjj$jsonc$$Parser$parse_array(self, leading) {
2202
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2203
+ const elements = [];
2204
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2205
+ if (moonbitlang$core$builtin$$Eq$equal$23$(f4ah6o$yyjj$jsonc$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBracket)) {
2206
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2207
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JArray(elements, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2208
+ }
2209
+ _L: while (true) {
2210
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2211
+ if (moonbitlang$core$builtin$$Eq$equal$23$(f4ah6o$yyjj$jsonc$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBracket)) break;
2212
+ const _bind$1 = f4ah6o$yyjj$jsonc$$Parser$parse_value(self);
2213
+ let value;
2214
+ if (_bind$1.$tag === 1) value = _bind$1._0;
2215
+ else {
2216
+ const _e = _bind$1._0;
2217
+ return new Result$Err$2$(_e);
2218
+ }
2219
+ moonbitlang$core$array$$Array$push$13$(elements, value);
2220
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2221
+ _L$2: {
2222
+ _L$3: {
2223
+ const _bind$2 = f4ah6o$yyjj$jsonc$$Parser$peek_kind(self);
2224
+ if (_bind$2 === void 0) break _L$3;
2225
+ else switch (_bind$2.$tag) {
2226
+ case 5:
2227
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2228
+ break;
2229
+ case 3: break _L;
2230
+ default: break _L$3;
2231
+ }
2232
+ break _L$2;
2233
+ }
2234
+ return new Result$Err$2$(f4ah6o$yyjj$common$$ParseError$unexpected_token("expected ',' or ']'", f4ah6o$yyjj$jsonc$$Parser$current_span(self)));
2235
+ }
2236
+ continue;
2237
+ }
2238
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$expect(self, $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBracket);
2239
+ if (_bind.$tag === 1) {} else {
2240
+ const _e = _bind._0;
2241
+ return new Result$Err$2$(_e);
2242
+ }
2243
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JArray(elements, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2244
+ }
2245
+ function f4ah6o$yyjj$jsonc$$Parser$parse_object(self, leading) {
2246
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2247
+ const properties = [];
2248
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2249
+ if (moonbitlang$core$builtin$$Eq$equal$23$(f4ah6o$yyjj$jsonc$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBrace)) {
2250
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2251
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JObject(properties, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2252
+ }
2253
+ _L: while (true) {
2254
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2255
+ const key_leading = f4ah6o$yyjj$jsonc$$Parser$flush_leading(self);
2256
+ if (moonbitlang$core$builtin$$Eq$equal$23$(f4ah6o$yyjj$jsonc$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBrace)) break;
2257
+ _L$2: {
2258
+ _L$3: {
2259
+ const _bind$1 = f4ah6o$yyjj$jsonc$$Parser$peek_kind(self);
2260
+ if (_bind$1 === void 0) break _L$3;
2261
+ else {
2262
+ const _x = _bind$1;
2263
+ if (_x.$tag === 6) {
2264
+ const _key = _x._0;
2265
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2266
+ const key_trivia = f4ah6o$yyjj$common$$Trivia$new(key_leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self));
2267
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2268
+ const _bind$2 = f4ah6o$yyjj$jsonc$$Parser$expect(self, $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$Colon);
2269
+ if (_bind$2.$tag === 1) {} else {
2270
+ const _e = _bind$2._0;
2271
+ return new Result$Err$2$(_e);
2272
+ }
2273
+ const _bind$3 = f4ah6o$yyjj$jsonc$$Parser$parse_value(self);
2274
+ let value;
2275
+ if (_bind$3.$tag === 1) value = _bind$3._0;
2276
+ else {
2277
+ const _e = _bind$3._0;
2278
+ return new Result$Err$2$(_e);
2279
+ }
2280
+ moonbitlang$core$array$$Array$push$14$(properties, f4ah6o$yyjj$jsonc$$JProperty$new(_key, key_trivia, value));
2281
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2282
+ _L$4: {
2283
+ _L$5: {
2284
+ const _bind$4 = f4ah6o$yyjj$jsonc$$Parser$peek_kind(self);
2285
+ if (_bind$4 === void 0) break _L$5;
2286
+ else switch (_bind$4.$tag) {
2287
+ case 5:
2288
+ f4ah6o$yyjj$jsonc$$Parser$advance(self);
2289
+ break;
2290
+ case 1: break _L;
2291
+ default: break _L$5;
2292
+ }
2293
+ break _L$4;
2294
+ }
2295
+ return new Result$Err$2$(f4ah6o$yyjj$common$$ParseError$unexpected_token("expected ',' or '}'", f4ah6o$yyjj$jsonc$$Parser$current_span(self)));
2296
+ }
2297
+ } else break _L$3;
2298
+ }
2299
+ break _L$2;
2300
+ }
2301
+ return new Result$Err$2$(f4ah6o$yyjj$common$$ParseError$unexpected_token("expected string key", f4ah6o$yyjj$jsonc$$Parser$current_span(self)));
2302
+ }
2303
+ continue;
2304
+ }
2305
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$expect(self, $64$f4ah6o$47$yyjj$47$jsonc$46$TokenKind$RBrace);
2306
+ if (_bind.$tag === 1) {} else {
2307
+ const _e = _bind._0;
2308
+ return new Result$Err$2$(_e);
2309
+ }
2310
+ return new Result$Ok$2$(new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JObject(properties, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$jsonc$$Parser$collect_trailing(self))));
2311
+ }
2312
+ function f4ah6o$yyjj$jsonc$$Parser$parse(self) {
2313
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2314
+ const _bind = f4ah6o$yyjj$jsonc$$Parser$parse_value(self);
2315
+ let node;
2316
+ if (_bind.$tag === 1) node = _bind._0;
2317
+ else {
2318
+ const _e = _bind._0;
2319
+ return new Result$Err$2$(_e);
2320
+ }
2321
+ f4ah6o$yyjj$jsonc$$Parser$skip_trivia(self);
2322
+ if (!f4ah6o$yyjj$jsonc$$Parser$is_eof(self)) {
2323
+ const tok = f4ah6o$yyjj$jsonc$$Parser$peek(self);
2324
+ if (tok === void 0) return new Result$Ok$2$(node);
2325
+ else return new Result$Err$2$(f4ah6o$yyjj$common$$ParseError$new($64$f4ah6o$47$yyjj$47$common$46$ParseErrorKind$TrailingContent, tok.span, "unexpected content after JSON value"));
2326
+ }
2327
+ return new Result$Ok$2$(node);
2328
+ }
2329
+ function f4ah6o$yyjj$jsonc$$parse(source) {
2330
+ return f4ah6o$yyjj$jsonc$$Parser$parse(f4ah6o$yyjj$jsonc$$Parser$from_source(source));
2331
+ }
2332
+ function moonbitlang$core$builtin$$Eq$equal$18$(_x_386, _x_387) {
2333
+ switch (_x_386.$tag) {
2334
+ case 0: if (_x_387.$tag === 0) return true;
2335
+ else return false;
2336
+ case 1: if (_x_387.$tag === 1) return true;
2337
+ else return false;
2338
+ case 2: if (_x_387.$tag === 2) return true;
2339
+ else return false;
2340
+ case 3: if (_x_387.$tag === 3) return true;
2341
+ else return false;
2342
+ case 4: if (_x_387.$tag === 4) return true;
2343
+ else return false;
2344
+ case 5: if (_x_387.$tag === 5) return true;
2345
+ else return false;
2346
+ case 6: if (_x_387.$tag === 6) return true;
2347
+ else return false;
2348
+ case 7: {
2349
+ const _$42$x0_388 = _x_386._0;
2350
+ if (_x_387.$tag === 7) return _$42$x0_388 === _x_387._0;
2351
+ else return false;
2352
+ }
2353
+ case 8: {
2354
+ const _$42$x0_390 = _x_386._0;
2355
+ if (_x_387.$tag === 8) return _$42$x0_390 === _x_387._0;
2356
+ else return false;
2357
+ }
2358
+ case 9: {
2359
+ const _$42$x0_392 = _x_386._0;
2360
+ if (_x_387.$tag === 9) return _$42$x0_392 === _x_387._0;
2361
+ else return false;
2362
+ }
2363
+ case 10: {
2364
+ const _$42$x0_394 = _x_386._0;
2365
+ if (_x_387.$tag === 10) return _$42$x0_394 === _x_387._0;
2366
+ else return false;
2367
+ }
2368
+ case 11: {
2369
+ const _$42$x0_396 = _x_386._0;
2370
+ if (_x_387.$tag === 11) return _$42$x0_396 === _x_387._0;
2371
+ else return false;
2372
+ }
2373
+ case 12: {
2374
+ const _$42$x0_398 = _x_386._0;
2375
+ if (_x_387.$tag === 12) return _$42$x0_398 === _x_387._0;
2376
+ else return false;
2377
+ }
2378
+ case 13: {
2379
+ const _$42$x0_400 = _x_386._0;
2380
+ if (_x_387.$tag === 13) return _$42$x0_400 === _x_387._0;
2381
+ else return false;
2382
+ }
2383
+ case 14: if (_x_387.$tag === 14) return true;
2384
+ else return false;
2385
+ case 15: if (_x_387.$tag === 15) return true;
2386
+ else return false;
2387
+ case 16: if (_x_387.$tag === 16) return true;
2388
+ else return false;
2389
+ case 17: {
2390
+ const _$42$x0_402 = _x_386._0;
2391
+ if (_x_387.$tag === 17) return _$42$x0_402 === _x_387._0;
2392
+ else return false;
2393
+ }
2394
+ case 18: {
2395
+ const _$42$x0_404 = _x_386._0;
2396
+ if (_x_387.$tag === 18) return _$42$x0_404 === _x_387._0;
2397
+ else return false;
2398
+ }
2399
+ case 19: {
2400
+ const _$42$x0_406 = _x_386._0;
2401
+ if (_x_387.$tag === 19) return _$42$x0_406 === _x_387._0;
2402
+ else return false;
2403
+ }
2404
+ case 20: {
2405
+ const _$42$x0_408 = _x_386._0;
2406
+ if (_x_387.$tag === 20) return _$42$x0_408 === _x_387._0;
2407
+ else return false;
2408
+ }
2409
+ case 21: if (_x_387.$tag === 21) return true;
2410
+ else return false;
2411
+ case 22: if (_x_387.$tag === 22) return true;
2412
+ else return false;
2413
+ case 23: if (_x_387.$tag === 23) return true;
2414
+ else return false;
2415
+ case 24: if (_x_387.$tag === 24) return true;
2416
+ else return false;
2417
+ default: {
2418
+ const _$42$x0_410 = _x_386._0;
2419
+ if (_x_387.$tag === 25) return _$42$x0_410 === _x_387._0;
2420
+ else return false;
2421
+ }
2422
+ }
2423
+ }
2424
+ function moonbitlang$core$builtin$$Show$output$18$(_x_358, _x_359) {
2425
+ switch (_x_358.$tag) {
2426
+ case 0:
2427
+ _x_359.method_table.method_0(_x_359.self, "Colon");
2428
+ return;
2429
+ case 1:
2430
+ _x_359.method_table.method_0(_x_359.self, "Dash");
2431
+ return;
2432
+ case 2:
2433
+ _x_359.method_table.method_0(_x_359.self, "Comma");
2434
+ return;
2435
+ case 3:
2436
+ _x_359.method_table.method_0(_x_359.self, "LBrace");
2437
+ return;
2438
+ case 4:
2439
+ _x_359.method_table.method_0(_x_359.self, "RBrace");
2440
+ return;
2441
+ case 5:
2442
+ _x_359.method_table.method_0(_x_359.self, "LBracket");
2443
+ return;
2444
+ case 6:
2445
+ _x_359.method_table.method_0(_x_359.self, "RBracket");
2446
+ return;
2447
+ case 7: {
2448
+ const _$42$arg_360 = _x_358._0;
2449
+ _x_359.method_table.method_0(_x_359.self, "Indent(");
2450
+ moonbitlang$core$builtin$$Logger$write_object$2$(_x_359, _$42$arg_360);
2451
+ _x_359.method_table.method_0(_x_359.self, ")");
2452
+ return;
2453
+ }
2454
+ case 8: {
2455
+ const _$42$arg_361 = _x_358._0;
2456
+ _x_359.method_table.method_0(_x_359.self, "Dedent(");
2457
+ moonbitlang$core$builtin$$Logger$write_object$2$(_x_359, _$42$arg_361);
2458
+ _x_359.method_table.method_0(_x_359.self, ")");
2459
+ return;
2460
+ }
2461
+ case 9: {
2462
+ const _$42$arg_362 = _x_358._0;
2463
+ _x_359.method_table.method_0(_x_359.self, "PlainScalar(");
2464
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_362);
2465
+ _x_359.method_table.method_0(_x_359.self, ")");
2466
+ return;
2467
+ }
2468
+ case 10: {
2469
+ const _$42$arg_363 = _x_358._0;
2470
+ _x_359.method_table.method_0(_x_359.self, "SingleQuotedScalar(");
2471
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_363);
2472
+ _x_359.method_table.method_0(_x_359.self, ")");
2473
+ return;
2474
+ }
2475
+ case 11: {
2476
+ const _$42$arg_364 = _x_358._0;
2477
+ _x_359.method_table.method_0(_x_359.self, "DoubleQuotedScalar(");
2478
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_364);
2479
+ _x_359.method_table.method_0(_x_359.self, ")");
2480
+ return;
2481
+ }
2482
+ case 12: {
2483
+ const _$42$arg_365 = _x_358._0;
2484
+ _x_359.method_table.method_0(_x_359.self, "LiteralBlock(");
2485
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_365);
2486
+ _x_359.method_table.method_0(_x_359.self, ")");
2487
+ return;
2488
+ }
2489
+ case 13: {
2490
+ const _$42$arg_366 = _x_358._0;
2491
+ _x_359.method_table.method_0(_x_359.self, "FoldedBlock(");
2492
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_366);
2493
+ _x_359.method_table.method_0(_x_359.self, ")");
2494
+ return;
2495
+ }
2496
+ case 14:
2497
+ _x_359.method_table.method_0(_x_359.self, "NullValue");
2498
+ return;
2499
+ case 15:
2500
+ _x_359.method_table.method_0(_x_359.self, "TrueValue");
2501
+ return;
2502
+ case 16:
2503
+ _x_359.method_table.method_0(_x_359.self, "FalseValue");
2504
+ return;
2505
+ case 17: {
2506
+ const _$42$arg_367 = _x_358._0;
2507
+ _x_359.method_table.method_0(_x_359.self, "Anchor(");
2508
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_367);
2509
+ _x_359.method_table.method_0(_x_359.self, ")");
2510
+ return;
2511
+ }
2512
+ case 18: {
2513
+ const _$42$arg_368 = _x_358._0;
2514
+ _x_359.method_table.method_0(_x_359.self, "Alias(");
2515
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_368);
2516
+ _x_359.method_table.method_0(_x_359.self, ")");
2517
+ return;
2518
+ }
2519
+ case 19: {
2520
+ const _$42$arg_369 = _x_358._0;
2521
+ _x_359.method_table.method_0(_x_359.self, "Comment(");
2522
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_369);
2523
+ _x_359.method_table.method_0(_x_359.self, ")");
2524
+ return;
2525
+ }
2526
+ case 20: {
2527
+ const _$42$arg_370 = _x_358._0;
2528
+ _x_359.method_table.method_0(_x_359.self, "Whitespace(");
2529
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_370);
2530
+ _x_359.method_table.method_0(_x_359.self, ")");
2531
+ return;
2532
+ }
2533
+ case 21:
2534
+ _x_359.method_table.method_0(_x_359.self, "Newline");
2535
+ return;
2536
+ case 22:
2537
+ _x_359.method_table.method_0(_x_359.self, "DocumentStart");
2538
+ return;
2539
+ case 23:
2540
+ _x_359.method_table.method_0(_x_359.self, "DocumentEnd");
2541
+ return;
2542
+ case 24:
2543
+ _x_359.method_table.method_0(_x_359.self, "Eof");
2544
+ return;
2545
+ default: {
2546
+ const _$42$arg_371 = _x_358._0;
2547
+ _x_359.method_table.method_0(_x_359.self, "Invalid(");
2548
+ moonbitlang$core$builtin$$Logger$write_object$3$(_x_359, _$42$arg_371);
2549
+ _x_359.method_table.method_0(_x_359.self, ")");
2550
+ return;
2551
+ }
2552
+ }
2553
+ }
2554
+ function f4ah6o$yyjj$yaml$$Token$new(kind, span) {
2555
+ return {
2556
+ kind,
2557
+ span
2558
+ };
2559
+ }
2560
+ function f4ah6o$yyjj$yaml$$escape_double_quoted(s) {
2561
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
2562
+ let _tmp = 0;
2563
+ while (true) {
2564
+ const i = _tmp;
2565
+ if (i < s.length) {
2566
+ $bound_check(s, i);
2567
+ const ch = s.charCodeAt(i);
2568
+ switch (ch) {
2569
+ case 34:
2570
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\\"");
2571
+ break;
2572
+ case 92:
2573
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\\\");
2574
+ break;
2575
+ case 10:
2576
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\n");
2577
+ break;
2578
+ case 13:
2579
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\r");
2580
+ break;
2581
+ case 9:
2582
+ moonbitlang$core$builtin$$Logger$write_string$0$(buf, "\\t");
2583
+ break;
2584
+ default: moonbitlang$core$builtin$$Logger$write_char$0$(buf, ch);
2585
+ }
2586
+ _tmp = i + 1 | 0;
2587
+ continue;
2588
+ } else break;
2589
+ }
2590
+ return buf.val;
2591
+ }
2592
+ function f4ah6o$yyjj$yaml$$escape_single_quoted(s) {
2593
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
2594
+ let _tmp = 0;
2595
+ while (true) {
2596
+ const i = _tmp;
2597
+ if (i < s.length) {
2598
+ $bound_check(s, i);
2599
+ const ch = s.charCodeAt(i);
2600
+ if (ch === 39) moonbitlang$core$builtin$$Logger$write_string$0$(buf, "''");
2601
+ else moonbitlang$core$builtin$$Logger$write_char$0$(buf, ch);
2602
+ _tmp = i + 1 | 0;
2603
+ continue;
2604
+ } else break;
2605
+ }
2606
+ return buf.val;
2607
+ }
2608
+ function f4ah6o$yyjj$yaml$$folded_block_to_doc(s) {
2609
+ return f4ah6o$yyjj$pretty$$concat([
2610
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(">"),
2611
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$HardLine,
2612
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(s)
2613
+ ]);
2614
+ }
2615
+ function f4ah6o$yyjj$yaml$$literal_block_to_doc(s) {
2616
+ return f4ah6o$yyjj$pretty$$concat([
2617
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("|"),
2618
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$HardLine,
2619
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(s)
2620
+ ]);
2621
+ }
2622
+ function f4ah6o$yyjj$yaml$$string_to_doc(s, style) {
2623
+ switch (style) {
2624
+ case 0: return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(s);
2625
+ case 1: return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(`'${f4ah6o$yyjj$yaml$$escape_single_quoted(s)}'`);
2626
+ case 2: return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(`\"${f4ah6o$yyjj$yaml$$escape_double_quoted(s)}\"`);
2627
+ case 3: return f4ah6o$yyjj$yaml$$literal_block_to_doc(s);
2628
+ default: return f4ah6o$yyjj$yaml$$folded_block_to_doc(s);
2629
+ }
2630
+ }
2631
+ function f4ah6o$yyjj$yaml$$trivia_to_doc(comments) {
2632
+ if (comments.length === 0) return $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nil;
2633
+ const docs = [];
2634
+ let _tmp = 0;
2635
+ while (true) {
2636
+ const i = _tmp;
2637
+ if (i < comments.length) {
2638
+ moonbitlang$core$array$$Array$push$12$(docs, new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(` #${moonbitlang$core$array$$Array$at$9$(comments, i).content}`));
2639
+ _tmp = i + 1 | 0;
2640
+ continue;
2641
+ } else break;
2642
+ }
2643
+ return f4ah6o$yyjj$pretty$$concat(docs);
2644
+ }
2645
+ function f4ah6o$yyjj$yaml$$YamlNode$trivia(self) {
2646
+ let _tmp = self;
2647
+ _L: while (true) {
2648
+ const self$2 = _tmp;
2649
+ switch (self$2.$tag) {
2650
+ case 0: return self$2._0;
2651
+ case 1: return self$2._1;
2652
+ case 2: return self$2._1;
2653
+ case 3: return self$2._2;
2654
+ case 4: return self$2._1;
2655
+ case 5: return self$2._1;
2656
+ case 6: return self$2._1;
2657
+ default:
2658
+ _tmp = self$2._1;
2659
+ continue _L;
2660
+ }
2661
+ }
2662
+ }
2663
+ function f4ah6o$yyjj$yaml$$node_to_doc(node, indent) {
2664
+ const trivia = f4ah6o$yyjj$yaml$$YamlNode$trivia(node);
2665
+ const leading = f4ah6o$yyjj$yaml$$trivia_to_doc(trivia.leading);
2666
+ const trailing = f4ah6o$yyjj$yaml$$trivia_to_doc(trivia.trailing);
2667
+ let content;
2668
+ switch (node.$tag) {
2669
+ case 0:
2670
+ content = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("null");
2671
+ break;
2672
+ case 1:
2673
+ if (node._0 === true) content = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("true");
2674
+ else content = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("false");
2675
+ break;
2676
+ case 2: {
2677
+ const _n = node._0;
2678
+ content = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(_n);
2679
+ break;
2680
+ }
2681
+ case 3: {
2682
+ const _YString = node;
2683
+ const _s = _YString._0;
2684
+ const _style = _YString._1;
2685
+ content = f4ah6o$yyjj$yaml$$string_to_doc(_s, _style);
2686
+ break;
2687
+ }
2688
+ case 4: {
2689
+ const _elements = node._0;
2690
+ content = f4ah6o$yyjj$yaml$$sequence_to_doc(_elements, indent);
2691
+ break;
2692
+ }
2693
+ case 5: {
2694
+ const _pairs = node._0;
2695
+ content = f4ah6o$yyjj$yaml$$mapping_to_doc(_pairs, indent);
2696
+ break;
2697
+ }
2698
+ case 6:
2699
+ content = new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(`*${node._0}`);
2700
+ break;
2701
+ default: {
2702
+ const _YAnchor = node;
2703
+ const _name$2 = _YAnchor._0;
2704
+ const _value = _YAnchor._1;
2705
+ content = f4ah6o$yyjj$pretty$$concat([new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(`&${_name$2} `), f4ah6o$yyjj$yaml$$node_to_doc(_value, indent)]);
2706
+ }
2707
+ }
2708
+ return f4ah6o$yyjj$pretty$$concat([
2709
+ leading,
2710
+ content,
2711
+ trailing
2712
+ ]);
2713
+ }
2714
+ function f4ah6o$yyjj$yaml$$mapping_to_doc(pairs, indent) {
2715
+ if (pairs.length === 0) return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("{}");
2716
+ const docs = [];
2717
+ let _tmp = 0;
2718
+ while (true) {
2719
+ const i = _tmp;
2720
+ if (i < pairs.length) {
2721
+ const pair = moonbitlang$core$array$$Array$at$11$(pairs, i);
2722
+ const key_doc = f4ah6o$yyjj$yaml$$node_to_doc(pair.key, indent);
2723
+ const value_doc = f4ah6o$yyjj$yaml$$node_to_doc(pair.value, indent + 2 | 0);
2724
+ const _bind = pair.value;
2725
+ let is_nested;
2726
+ switch (_bind.$tag) {
2727
+ case 4:
2728
+ is_nested = true;
2729
+ break;
2730
+ case 5:
2731
+ is_nested = true;
2732
+ break;
2733
+ default: is_nested = false;
2734
+ }
2735
+ if (is_nested) moonbitlang$core$array$$Array$push$12$(docs, f4ah6o$yyjj$pretty$$concat([
2736
+ key_doc,
2737
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(":"),
2738
+ $64$f4ah6o$47$yyjj$47$pretty$46$Doc$HardLine,
2739
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Nest(2, value_doc)
2740
+ ]));
2741
+ else moonbitlang$core$array$$Array$push$12$(docs, f4ah6o$yyjj$pretty$$concat([
2742
+ key_doc,
2743
+ new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text(": "),
2744
+ value_doc
2745
+ ]));
2746
+ _tmp = i + 1 | 0;
2747
+ continue;
2748
+ } else break;
2749
+ }
2750
+ return f4ah6o$yyjj$pretty$$join(docs, $64$f4ah6o$47$yyjj$47$pretty$46$Doc$HardLine);
2751
+ }
2752
+ function f4ah6o$yyjj$yaml$$sequence_to_doc(elements, indent) {
2753
+ if (elements.length === 0) return new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("[]");
2754
+ const docs = [];
2755
+ let _tmp = 0;
2756
+ while (true) {
2757
+ const i = _tmp;
2758
+ if (i < elements.length) {
2759
+ const elem_doc = f4ah6o$yyjj$yaml$$node_to_doc(moonbitlang$core$array$$Array$at$10$(elements, i), indent + 2 | 0);
2760
+ moonbitlang$core$array$$Array$push$12$(docs, f4ah6o$yyjj$pretty$$concat([new $64$f4ah6o$47$yyjj$47$pretty$46$Doc$Text("- "), elem_doc]));
2761
+ _tmp = i + 1 | 0;
2762
+ continue;
2763
+ } else break;
2764
+ }
2765
+ return f4ah6o$yyjj$pretty$$join(docs, $64$f4ah6o$47$yyjj$47$pretty$46$Doc$HardLine);
2766
+ }
2767
+ function f4ah6o$yyjj$yaml$$to_doc(node) {
2768
+ return f4ah6o$yyjj$yaml$$node_to_doc(node, 0);
2769
+ }
2770
+ function f4ah6o$yyjj$yaml$$print(node, width) {
2771
+ const _p = 80;
2772
+ let w;
2773
+ if (width === void 0) w = _p;
2774
+ else w = width;
2775
+ return f4ah6o$yyjj$pretty$$render(f4ah6o$yyjj$yaml$$to_doc(node), w);
2776
+ }
2777
+ function f4ah6o$yyjj$yaml$$Lexer$new(source) {
2778
+ return {
2779
+ source,
2780
+ pos: 0,
2781
+ line: 0,
2782
+ column: 0,
2783
+ indent_stack: [0],
2784
+ at_line_start: true
2785
+ };
2786
+ }
2787
+ function f4ah6o$yyjj$yaml$$Lexer$advance(self) {
2788
+ if (self.pos >= self.source.length) return -1;
2789
+ const _p = self.pos;
2790
+ const _tmp = self.source;
2791
+ $bound_check(_tmp, _p);
2792
+ const ch = _tmp.charCodeAt(_p);
2793
+ self.pos = self.pos + 1 | 0;
2794
+ if (ch === 10) {
2795
+ self.line = self.line + 1 | 0;
2796
+ self.column = 0;
2797
+ self.at_line_start = true;
2798
+ } else {
2799
+ self.column = self.column + 1 | 0;
2800
+ if (ch !== 32 && ch !== 9) self.at_line_start = false;
2801
+ }
2802
+ return ch;
2803
+ }
2804
+ function f4ah6o$yyjj$yaml$$Lexer$current_indent(self) {
2805
+ const _bind = moonbitlang$core$array$$Array$last$2$(self.indent_stack);
2806
+ if (_bind === void 0) return 0;
2807
+ else return _bind;
2808
+ }
2809
+ function f4ah6o$yyjj$yaml$$Lexer$current_pos(self) {
2810
+ return f4ah6o$yyjj$common$$Pos$new(self.line, self.column, self.pos);
2811
+ }
2812
+ function f4ah6o$yyjj$yaml$$Lexer$count_spaces(self) {
2813
+ let count = 0;
2814
+ let idx = self.pos;
2815
+ while (true) if (idx < self.source.length) {
2816
+ const _p = idx;
2817
+ const _tmp = self.source;
2818
+ $bound_check(_tmp, _p);
2819
+ if (_tmp.charCodeAt(_p) === 32) {
2820
+ count = count + 1 | 0;
2821
+ idx = idx + 1 | 0;
2822
+ } else break;
2823
+ continue;
2824
+ } else break;
2825
+ return count;
2826
+ }
2827
+ function f4ah6o$yyjj$yaml$$Lexer$handle_indent(self) {
2828
+ if (!self.at_line_start) return;
2829
+ const spaces = f4ah6o$yyjj$yaml$$Lexer$count_spaces(self);
2830
+ const start = f4ah6o$yyjj$yaml$$Lexer$current_pos(self);
2831
+ const current = f4ah6o$yyjj$yaml$$Lexer$current_indent(self);
2832
+ if (spaces > current) {
2833
+ let _tmp = 0;
2834
+ while (true) {
2835
+ const i = _tmp;
2836
+ if (i < spaces) {
2837
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2838
+ _tmp = i + 1 | 0;
2839
+ continue;
2840
+ } else break;
2841
+ }
2842
+ moonbitlang$core$array$$Array$push$2$(self.indent_stack, spaces);
2843
+ self.at_line_start = false;
2844
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Indent(spaces), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
2845
+ } else if (spaces < current) {
2846
+ moonbitlang$core$array$$Array$pop$2$(self.indent_stack);
2847
+ const to_level = f4ah6o$yyjj$yaml$$Lexer$current_indent(self);
2848
+ if (to_level <= spaces) {
2849
+ let _tmp = 0;
2850
+ while (true) {
2851
+ const i = _tmp;
2852
+ if (i < spaces) {
2853
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2854
+ _tmp = i + 1 | 0;
2855
+ continue;
2856
+ } else break;
2857
+ }
2858
+ self.at_line_start = false;
2859
+ }
2860
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Dedent(to_level), f4ah6o$yyjj$common$$Span$at(start));
2861
+ } else {
2862
+ let _tmp = 0;
2863
+ while (true) {
2864
+ const i = _tmp;
2865
+ if (i < spaces) {
2866
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2867
+ _tmp = i + 1 | 0;
2868
+ continue;
2869
+ } else break;
2870
+ }
2871
+ self.at_line_start = false;
2872
+ return;
2873
+ }
2874
+ }
2875
+ function f4ah6o$yyjj$yaml$$is_anchor_char(c) {
2876
+ return c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95 || c === 45;
2877
+ }
2878
+ function f4ah6o$yyjj$yaml$$Lexer$skip_while(self, pred) {
2879
+ const start = self.pos;
2880
+ while (true) {
2881
+ let _tmp;
2882
+ if (!(self.pos >= self.source.length)) {
2883
+ const _p = self.pos;
2884
+ const _tmp$2 = self.source;
2885
+ $bound_check(_tmp$2, _p);
2886
+ _tmp = pred(_tmp$2.charCodeAt(_p));
2887
+ } else _tmp = false;
2888
+ if (_tmp) {
2889
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2890
+ continue;
2891
+ } else break;
2892
+ }
2893
+ return moonbitlang$core$string$$String$substring$46$inner(self.source, start, self.pos);
2894
+ }
2895
+ function f4ah6o$yyjj$yaml$$Lexer$lex_alias(self, start) {
2896
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2897
+ const name = f4ah6o$yyjj$yaml$$Lexer$skip_while(self, (c) => f4ah6o$yyjj$yaml$$is_anchor_char(c));
2898
+ return name.length === 0 ? f4ah6o$yyjj$yaml$$Token$new(f4ah6o$yyjj$yaml$$lex_alias$46$constr$47$1055, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self))) : f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Alias(name), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
2899
+ }
2900
+ function f4ah6o$yyjj$yaml$$Lexer$lex_anchor(self, start) {
2901
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2902
+ const name = f4ah6o$yyjj$yaml$$Lexer$skip_while(self, (c) => f4ah6o$yyjj$yaml$$is_anchor_char(c));
2903
+ return name.length === 0 ? f4ah6o$yyjj$yaml$$Token$new(f4ah6o$yyjj$yaml$$lex_anchor$46$constr$47$1060, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self))) : f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Anchor(name), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
2904
+ }
2905
+ function f4ah6o$yyjj$yaml$$Lexer$peek(self) {
2906
+ if (self.pos >= self.source.length) return -1;
2907
+ else {
2908
+ const _p = self.pos;
2909
+ const _tmp = self.source;
2910
+ $bound_check(_tmp, _p);
2911
+ return _tmp.charCodeAt(_p);
2912
+ }
2913
+ }
2914
+ function f4ah6o$yyjj$yaml$$Lexer$lex_double_quoted(self, start) {
2915
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2916
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
2917
+ _L: while (true) {
2918
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
2919
+ if (_bind === -1) return f4ah6o$yyjj$yaml$$Token$new(f4ah6o$yyjj$yaml$$lex_double_quoted$46$constr$47$1066, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
2920
+ else {
2921
+ const _x = _bind;
2922
+ switch (_x) {
2923
+ case 34:
2924
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2925
+ break _L;
2926
+ case 92: {
2927
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2928
+ const _bind$2 = f4ah6o$yyjj$yaml$$Lexer$peek(self);
2929
+ if (_bind$2 === -1) return f4ah6o$yyjj$yaml$$Token$new(f4ah6o$yyjj$yaml$$lex_double_quoted$46$constr$47$1067, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
2930
+ else {
2931
+ const _esc = _bind$2;
2932
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2933
+ switch (_esc) {
2934
+ case 110:
2935
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 10);
2936
+ break;
2937
+ case 116:
2938
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 9);
2939
+ break;
2940
+ case 114:
2941
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 13);
2942
+ break;
2943
+ case 92:
2944
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 92);
2945
+ break;
2946
+ case 34:
2947
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 34);
2948
+ break;
2949
+ case 48:
2950
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 0);
2951
+ break;
2952
+ default:
2953
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 92);
2954
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, _esc);
2955
+ }
2956
+ }
2957
+ break;
2958
+ }
2959
+ default:
2960
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2961
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, _x);
2962
+ }
2963
+ }
2964
+ continue;
2965
+ }
2966
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$DoubleQuotedScalar(buf.val), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
2967
+ }
2968
+ function f4ah6o$yyjj$yaml$$is_blank_line(lexer) {
2969
+ let idx = lexer.pos;
2970
+ while (true) if (idx < lexer.source.length) {
2971
+ const _tmp = lexer.source;
2972
+ const _tmp$2 = idx;
2973
+ $bound_check(_tmp, _tmp$2);
2974
+ const ch = _tmp.charCodeAt(_tmp$2);
2975
+ if (ch === 10 || ch === 13) return true;
2976
+ if (ch !== 32 && ch !== 9) return false;
2977
+ idx = idx + 1 | 0;
2978
+ continue;
2979
+ } else break;
2980
+ return true;
2981
+ }
2982
+ function f4ah6o$yyjj$yaml$$Lexer$lex_folded_block(self, start) {
2983
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2984
+ while (true) {
2985
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
2986
+ if (_bind === -1) break;
2987
+ else {
2988
+ const _c = _bind;
2989
+ if (_c !== 10) if (_c !== 13) {
2990
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
2991
+ continue;
2992
+ } else break;
2993
+ else break;
2994
+ }
2995
+ }
2996
+ _L: {
2997
+ _L$2: {
2998
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
2999
+ if (_bind === -1) {} else switch (_bind) {
3000
+ case 10: break _L$2;
3001
+ case 13: break _L$2;
3002
+ }
3003
+ break _L;
3004
+ }
3005
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3006
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek(self), f4ah6o$yyjj$yaml$$lex_folded_block$46$constr$47$1082)) f4ah6o$yyjj$yaml$$Lexer$advance(self);
3007
+ }
3008
+ const block_indent = f4ah6o$yyjj$yaml$$Lexer$current_indent(self) + 2 | 0;
3009
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
3010
+ let first_line = true;
3011
+ while (true) if (!(self.pos >= self.source.length)) {
3012
+ const spaces = f4ah6o$yyjj$yaml$$Lexer$count_spaces(self);
3013
+ if (spaces < block_indent && !f4ah6o$yyjj$yaml$$is_blank_line(self)) break;
3014
+ let _tmp = 0;
3015
+ while (true) {
3016
+ const i = _tmp;
3017
+ if (i < spaces) {
3018
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3019
+ _tmp = i + 1 | 0;
3020
+ continue;
3021
+ } else break;
3022
+ }
3023
+ if (!first_line) moonbitlang$core$builtin$$Logger$write_char$0$(buf, 32);
3024
+ first_line = false;
3025
+ while (true) {
3026
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3027
+ if (_bind === -1) break;
3028
+ else {
3029
+ const _c = _bind;
3030
+ if (_c !== 10) if (_c !== 13) {
3031
+ const c = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3032
+ if (c === -1) break;
3033
+ else {
3034
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, c);
3035
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3036
+ }
3037
+ continue;
3038
+ } else break;
3039
+ else break;
3040
+ }
3041
+ }
3042
+ _L$2: {
3043
+ _L$3: {
3044
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3045
+ if (_bind === -1) {} else switch (_bind) {
3046
+ case 10: break _L$3;
3047
+ case 13: break _L$3;
3048
+ }
3049
+ break _L$2;
3050
+ }
3051
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3052
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek(self), f4ah6o$yyjj$yaml$$lex_folded_block$46$constr$47$1083)) f4ah6o$yyjj$yaml$$Lexer$advance(self);
3053
+ }
3054
+ continue;
3055
+ } else break;
3056
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$FoldedBlock(buf.val), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3057
+ }
3058
+ function f4ah6o$yyjj$yaml$$Lexer$lex_literal_block(self, start) {
3059
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3060
+ while (true) {
3061
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3062
+ if (_bind === -1) break;
3063
+ else {
3064
+ const _c = _bind;
3065
+ if (_c !== 10) if (_c !== 13) {
3066
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3067
+ continue;
3068
+ } else break;
3069
+ else break;
3070
+ }
3071
+ }
3072
+ _L: {
3073
+ _L$2: {
3074
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3075
+ if (_bind === -1) {} else switch (_bind) {
3076
+ case 10: break _L$2;
3077
+ case 13: break _L$2;
3078
+ }
3079
+ break _L;
3080
+ }
3081
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3082
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek(self), f4ah6o$yyjj$yaml$$lex_literal_block$46$constr$47$1112)) f4ah6o$yyjj$yaml$$Lexer$advance(self);
3083
+ }
3084
+ const block_indent = f4ah6o$yyjj$yaml$$Lexer$current_indent(self) + 2 | 0;
3085
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
3086
+ while (true) if (!(self.pos >= self.source.length)) {
3087
+ const spaces = f4ah6o$yyjj$yaml$$Lexer$count_spaces(self);
3088
+ if (spaces < block_indent && !f4ah6o$yyjj$yaml$$is_blank_line(self)) break;
3089
+ let _tmp = 0;
3090
+ while (true) {
3091
+ const i = _tmp;
3092
+ if (i < spaces) {
3093
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3094
+ _tmp = i + 1 | 0;
3095
+ continue;
3096
+ } else break;
3097
+ }
3098
+ while (true) {
3099
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3100
+ if (_bind === -1) break;
3101
+ else {
3102
+ const _c = _bind;
3103
+ if (_c !== 10) if (_c !== 13) {
3104
+ const c = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3105
+ if (c === -1) break;
3106
+ else {
3107
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, c);
3108
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3109
+ }
3110
+ continue;
3111
+ } else break;
3112
+ else break;
3113
+ }
3114
+ }
3115
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 10);
3116
+ _L$2: {
3117
+ _L$3: {
3118
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3119
+ if (_bind === -1) {} else switch (_bind) {
3120
+ case 10: break _L$3;
3121
+ case 13: break _L$3;
3122
+ }
3123
+ break _L$2;
3124
+ }
3125
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3126
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek(self), f4ah6o$yyjj$yaml$$lex_literal_block$46$constr$47$1113)) f4ah6o$yyjj$yaml$$Lexer$advance(self);
3127
+ }
3128
+ continue;
3129
+ } else break;
3130
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$LiteralBlock(buf.val), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3131
+ }
3132
+ function f4ah6o$yyjj$yaml$$is_plain_scalar_char(c) {
3133
+ return c !== 58 && c !== 35 && c !== 10 && c !== 13 && c !== 123 && c !== 125 && c !== 91 && c !== 93 && c !== 44 && c !== 32 && c !== 9;
3134
+ }
3135
+ function f4ah6o$yyjj$yaml$$Lexer$lex_plain_scalar(self, start) {
3136
+ const scalar = f4ah6o$yyjj$yaml$$Lexer$skip_while(self, (c) => f4ah6o$yyjj$yaml$$is_plain_scalar_char(c));
3137
+ let kind;
3138
+ _L: {
3139
+ _L$2: {
3140
+ _L$3: {
3141
+ _L$4: {
3142
+ _L$5: {
3143
+ _L$6: {
3144
+ switch (scalar) {
3145
+ case "null": break _L$6;
3146
+ case "Null": break _L$6;
3147
+ case "NULL": break _L$6;
3148
+ case "~": break _L$6;
3149
+ case "true": break _L$4;
3150
+ case "True": break _L$4;
3151
+ case "TRUE": break _L$4;
3152
+ case "yes": break _L$4;
3153
+ case "Yes": break _L$4;
3154
+ case "YES": break _L$4;
3155
+ case "on": break _L$4;
3156
+ case "On": break _L$4;
3157
+ case "ON": break _L$4;
3158
+ case "false": break _L$2;
3159
+ case "False": break _L$2;
3160
+ case "FALSE": break _L$2;
3161
+ case "no": break _L$2;
3162
+ case "No": break _L$2;
3163
+ case "NO": break _L$2;
3164
+ case "off": break _L$2;
3165
+ case "Off": break _L$2;
3166
+ case "OFF": break _L$2;
3167
+ default: kind = new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$PlainScalar(scalar);
3168
+ }
3169
+ break _L$5;
3170
+ }
3171
+ kind = $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$NullValue;
3172
+ }
3173
+ break _L$3;
3174
+ }
3175
+ kind = $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$TrueValue;
3176
+ }
3177
+ break _L;
3178
+ }
3179
+ kind = $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$FalseValue;
3180
+ }
3181
+ return f4ah6o$yyjj$yaml$$Token$new(kind, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3182
+ }
3183
+ function f4ah6o$yyjj$yaml$$Lexer$lex_single_quoted(self, start) {
3184
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3185
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
3186
+ while (true) {
3187
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3188
+ if (_bind === -1) return f4ah6o$yyjj$yaml$$Token$new(f4ah6o$yyjj$yaml$$lex_single_quoted$46$constr$47$1150, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3189
+ else {
3190
+ const _x = _bind;
3191
+ if (_x === 39) {
3192
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3193
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek(self), f4ah6o$yyjj$yaml$$lex_single_quoted$46$constr$47$1151)) {
3194
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3195
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, 39);
3196
+ } else break;
3197
+ } else {
3198
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3199
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, _x);
3200
+ }
3201
+ }
3202
+ continue;
3203
+ }
3204
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$SingleQuotedScalar(buf.val), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3205
+ }
3206
+ function f4ah6o$yyjj$yaml$$Lexer$peek_at(self, offset) {
3207
+ const idx = self.pos + offset | 0;
3208
+ if (idx >= self.source.length) return -1;
3209
+ else {
3210
+ const _tmp = self.source;
3211
+ $bound_check(_tmp, idx);
3212
+ return _tmp.charCodeAt(idx);
3213
+ }
3214
+ }
3215
+ function f4ah6o$yyjj$yaml$$Lexer$next_token(self) {
3216
+ const _bind = f4ah6o$yyjj$yaml$$Lexer$handle_indent(self);
3217
+ if (_bind === void 0) {} else return _bind;
3218
+ const start = f4ah6o$yyjj$yaml$$Lexer$current_pos(self);
3219
+ const _bind$2 = f4ah6o$yyjj$yaml$$Lexer$peek(self);
3220
+ if (_bind$2 === -1) {
3221
+ if (self.indent_stack.length > 1) {
3222
+ moonbitlang$core$array$$Array$pop$2$(self.indent_stack);
3223
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Dedent(f4ah6o$yyjj$yaml$$Lexer$current_indent(self)), f4ah6o$yyjj$common$$Span$at(start));
3224
+ }
3225
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Eof, f4ah6o$yyjj$common$$Span$at(start));
3226
+ } else {
3227
+ const _ch = _bind$2;
3228
+ _L: switch (_ch) {
3229
+ case 10:
3230
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3231
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Newline, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3232
+ case 13:
3233
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3234
+ if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek(self), f4ah6o$yyjj$yaml$$next_token$46$constr$47$1162)) f4ah6o$yyjj$yaml$$Lexer$advance(self);
3235
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Newline, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3236
+ case 32: break _L;
3237
+ case 9: break _L;
3238
+ case 35:
3239
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3240
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Comment(f4ah6o$yyjj$yaml$$Lexer$skip_while(self, (c) => c !== 10 && c !== 13)), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3241
+ case 58:
3242
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3243
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3244
+ case 45:
3245
+ _L$2: if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek_at(self, 1), f4ah6o$yyjj$yaml$$next_token$46$constr$47$1163)) break _L$2;
3246
+ else if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek_at(self, 1), f4ah6o$yyjj$yaml$$next_token$46$constr$47$1164)) break _L$2;
3247
+ else if (f4ah6o$yyjj$yaml$$Lexer$peek_at(self, 1) === -1) break _L$2;
3248
+ else if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek_at(self, 1), f4ah6o$yyjj$yaml$$next_token$46$constr$47$1165) && moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek_at(self, 2), f4ah6o$yyjj$yaml$$next_token$46$constr$47$1166)) {
3249
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3250
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3251
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3252
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$DocumentStart, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3253
+ } else return f4ah6o$yyjj$yaml$$Lexer$lex_plain_scalar(self, start);
3254
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3255
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Dash, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3256
+ case 46: if (moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek_at(self, 1), f4ah6o$yyjj$yaml$$next_token$46$constr$47$1167) && moonbitlang$core$builtin$$Eq$equal$25$(f4ah6o$yyjj$yaml$$Lexer$peek_at(self, 2), f4ah6o$yyjj$yaml$$next_token$46$constr$47$1168)) {
3257
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3258
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3259
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3260
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$DocumentEnd, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3261
+ } else return f4ah6o$yyjj$yaml$$Lexer$lex_plain_scalar(self, start);
3262
+ case 123:
3263
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3264
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$LBrace, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3265
+ case 125:
3266
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3267
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$RBrace, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3268
+ case 91:
3269
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3270
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$LBracket, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3271
+ case 93:
3272
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3273
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$RBracket, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3274
+ case 44:
3275
+ f4ah6o$yyjj$yaml$$Lexer$advance(self);
3276
+ return f4ah6o$yyjj$yaml$$Token$new($64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Comma, f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3277
+ case 38: return f4ah6o$yyjj$yaml$$Lexer$lex_anchor(self, start);
3278
+ case 42: return f4ah6o$yyjj$yaml$$Lexer$lex_alias(self, start);
3279
+ case 39: return f4ah6o$yyjj$yaml$$Lexer$lex_single_quoted(self, start);
3280
+ case 34: return f4ah6o$yyjj$yaml$$Lexer$lex_double_quoted(self, start);
3281
+ case 124: return f4ah6o$yyjj$yaml$$Lexer$lex_literal_block(self, start);
3282
+ case 62: return f4ah6o$yyjj$yaml$$Lexer$lex_folded_block(self, start);
3283
+ default: return f4ah6o$yyjj$yaml$$Lexer$lex_plain_scalar(self, start);
3284
+ }
3285
+ return f4ah6o$yyjj$yaml$$Token$new(new $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Whitespace(f4ah6o$yyjj$yaml$$Lexer$skip_while(self, (c) => c === 32 || c === 9)), f4ah6o$yyjj$common$$Span$new(start, f4ah6o$yyjj$yaml$$Lexer$current_pos(self)));
3286
+ }
3287
+ }
3288
+ function f4ah6o$yyjj$yaml$$Lexer$tokenize(self) {
3289
+ const tokens = [];
3290
+ while (true) {
3291
+ const tok = f4ah6o$yyjj$yaml$$Lexer$next_token(self);
3292
+ const is_eof = moonbitlang$core$builtin$$Eq$equal$18$(tok.kind, $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Eof);
3293
+ moonbitlang$core$array$$Array$push$8$(tokens, tok);
3294
+ if (is_eof) break;
3295
+ continue;
3296
+ }
3297
+ return tokens;
3298
+ }
3299
+ function f4ah6o$yyjj$yaml$$Parser$from_source(source) {
3300
+ return {
3301
+ tokens: f4ah6o$yyjj$yaml$$Lexer$tokenize(f4ah6o$yyjj$yaml$$Lexer$new(source)),
3302
+ pos: 0,
3303
+ pending_trivia: [],
3304
+ saw_newline: false
3305
+ };
3306
+ }
3307
+ function f4ah6o$yyjj$yaml$$Parser$peek(self) {
3308
+ return self.pos < self.tokens.length ? moonbitlang$core$array$$Array$at$8$(self.tokens, self.pos) : void 0;
3309
+ }
3310
+ function f4ah6o$yyjj$yaml$$Parser$peek_kind(self) {
3311
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek(self);
3312
+ if (_bind === void 0) return;
3313
+ else return _bind.kind;
3314
+ }
3315
+ function f4ah6o$yyjj$yaml$$Parser$is_eof(self) {
3316
+ return self.pos >= self.tokens.length || moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Eof);
3317
+ }
3318
+ function f4ah6o$yyjj$yaml$$Parser$advance(self) {
3319
+ if (self.pos < self.tokens.length) {
3320
+ const tok = moonbitlang$core$array$$Array$at$8$(self.tokens, self.pos);
3321
+ self.pos = self.pos + 1 | 0;
3322
+ return tok;
3323
+ } else return;
3324
+ }
3325
+ function f4ah6o$yyjj$yaml$$Parser$current_span(self) {
3326
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek(self);
3327
+ if (_bind === void 0) return f4ah6o$yyjj$common$$Span$at(f4ah6o$yyjj$common$$zero$46$record$47$413);
3328
+ else return _bind.span;
3329
+ }
3330
+ function f4ah6o$yyjj$yaml$$Parser$skip_trivia(self) {
3331
+ while (true) {
3332
+ _L: {
3333
+ _L$2: {
3334
+ _L$3: {
3335
+ _L$4: {
3336
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3337
+ if (_bind === void 0) break _L$2;
3338
+ else {
3339
+ const _x = _bind;
3340
+ switch (_x.$tag) {
3341
+ case 20:
3342
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3343
+ break;
3344
+ case 21:
3345
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3346
+ self.saw_newline = true;
3347
+ break;
3348
+ case 19: {
3349
+ const _content = _x._0;
3350
+ const tok = f4ah6o$yyjj$yaml$$Parser$advance(self);
3351
+ if (tok === void 0) return;
3352
+ else {
3353
+ const comment = f4ah6o$yyjj$common$$Comment$new(_content, 0, tok.span, self.saw_newline);
3354
+ moonbitlang$core$array$$Array$push$9$(self.pending_trivia, comment);
3355
+ self.saw_newline = true;
3356
+ }
3357
+ break;
3358
+ }
3359
+ case 7: break _L$4;
3360
+ case 8: break _L$4;
3361
+ default: break _L$2;
3362
+ }
3363
+ }
3364
+ break _L$3;
3365
+ }
3366
+ break;
3367
+ }
3368
+ break _L;
3369
+ }
3370
+ break;
3371
+ }
3372
+ continue;
3373
+ }
3374
+ }
3375
+ function f4ah6o$yyjj$yaml$$Parser$flush_leading(self) {
3376
+ const leading = moonbitlang$core$array$$Array$copy$9$(self.pending_trivia);
3377
+ moonbitlang$core$array$$Array$clear$9$(self.pending_trivia);
3378
+ self.saw_newline = false;
3379
+ return leading;
3380
+ }
3381
+ function f4ah6o$yyjj$yaml$$Parser$collect_trailing(self) {
3382
+ const trailing = [];
3383
+ _L: while (true) {
3384
+ _L$2: {
3385
+ _L$3: {
3386
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3387
+ if (_bind === void 0) break _L$3;
3388
+ else {
3389
+ const _x = _bind;
3390
+ switch (_x.$tag) {
3391
+ case 20:
3392
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3393
+ break;
3394
+ case 19: {
3395
+ const _content = _x._0;
3396
+ if (!self.saw_newline) {
3397
+ const tok = f4ah6o$yyjj$yaml$$Parser$advance(self);
3398
+ if (tok === void 0) break _L;
3399
+ else {
3400
+ moonbitlang$core$array$$Array$push$9$(trailing, f4ah6o$yyjj$common$$Comment$new(_content, 0, tok.span, false));
3401
+ self.saw_newline = true;
3402
+ }
3403
+ }
3404
+ break _L;
3405
+ }
3406
+ case 21:
3407
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3408
+ self.saw_newline = true;
3409
+ break _L;
3410
+ default: break _L$3;
3411
+ }
3412
+ }
3413
+ break _L$2;
3414
+ }
3415
+ break;
3416
+ }
3417
+ continue;
3418
+ }
3419
+ return trailing;
3420
+ }
3421
+ function f4ah6o$yyjj$yaml$$token_kind_name(kind) {
3422
+ switch (kind.$tag) {
3423
+ case 0: return "':'";
3424
+ case 1: return "'-'";
3425
+ case 2: return "','";
3426
+ case 3: return "'{'";
3427
+ case 4: return "'}'";
3428
+ case 5: return "'['";
3429
+ case 6: return "']'";
3430
+ case 7: {
3431
+ const _n = kind._0;
3432
+ return `indent(${moonbitlang$core$int$$Int$to_string$46$inner(_n, 10)})`;
3433
+ }
3434
+ case 8: {
3435
+ const _n$2 = kind._0;
3436
+ return `dedent(${moonbitlang$core$int$$Int$to_string$46$inner(_n$2, 10)})`;
3437
+ }
3438
+ case 9: return `scalar: ${kind._0}`;
3439
+ case 10: return `'${kind._0}'`;
3440
+ case 11: return `\"${kind._0}\"`;
3441
+ case 12: return "literal block";
3442
+ case 13: return "folded block";
3443
+ case 14: return "null";
3444
+ case 15: return "true";
3445
+ case 16: return "false";
3446
+ case 17: return `&${kind._0}`;
3447
+ case 18: return `*${kind._0}`;
3448
+ case 19: return "comment";
3449
+ case 20: return "whitespace";
3450
+ case 21: return "newline";
3451
+ case 22: return "---";
3452
+ case 23: return "...";
3453
+ case 24: return "end of input";
3454
+ default: return kind._0;
3455
+ }
3456
+ }
3457
+ function f4ah6o$yyjj$yaml$$YKeyValue$new(key, key_trivia, value) {
3458
+ return {
3459
+ key,
3460
+ key_trivia,
3461
+ value
3462
+ };
3463
+ }
3464
+ function f4ah6o$yyjj$yaml$$debug_token_kind(kind) {
3465
+ if (kind === void 0) return "None";
3466
+ else return f4ah6o$yyjj$yaml$$token_kind_name(kind);
3467
+ }
3468
+ function f4ah6o$yyjj$yaml$$is_potential_key(kind) {
3469
+ if (kind === void 0) return false;
3470
+ else switch (kind.$tag) {
3471
+ case 9: return true;
3472
+ case 10: return true;
3473
+ case 11: return true;
3474
+ case 15: return true;
3475
+ case 16: return true;
3476
+ case 14: return true;
3477
+ default: return false;
3478
+ }
3479
+ }
3480
+ function f4ah6o$yyjj$yaml$$Parser$is_sibling_key_ahead(self) {
3481
+ const start_pos = self.pos;
3482
+ if (!f4ah6o$yyjj$yaml$$is_potential_key(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))) return false;
3483
+ self.pos = self.pos + 1 | 0;
3484
+ while (true) {
3485
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3486
+ if (_bind === void 0) break;
3487
+ else if (_bind.$tag === 20) {
3488
+ self.pos = self.pos + 1 | 0;
3489
+ continue;
3490
+ } else break;
3491
+ }
3492
+ const result = moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon);
3493
+ self.pos = start_pos;
3494
+ return result;
3495
+ }
3496
+ function f4ah6o$yyjj$yaml$$Parser$parse_value(self) {
3497
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3498
+ const leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
3499
+ _L: {
3500
+ _L$2: {
3501
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3502
+ if (_bind === void 0) return new Result$Err$3$(f4ah6o$yyjj$common$$ParseError$unexpected_eof(f4ah6o$yyjj$yaml$$Parser$current_span(self)));
3503
+ else {
3504
+ const _x = _bind;
3505
+ switch (_x.$tag) {
3506
+ case 7: {
3507
+ let check_pos = self.pos + 1 | 0;
3508
+ _L$3: while (true) if (check_pos < self.tokens.length) {
3509
+ _L$4: switch (moonbitlang$core$array$$Array$at$8$(self.tokens, check_pos).kind.$tag) {
3510
+ case 20: break _L$4;
3511
+ case 21: break _L$4;
3512
+ case 19: break _L$4;
3513
+ default: break _L$3;
3514
+ }
3515
+ check_pos = check_pos + 1 | 0;
3516
+ continue;
3517
+ } else break;
3518
+ _L$4: if (check_pos < self.tokens.length) if (moonbitlang$core$array$$Array$at$8$(self.tokens, check_pos).kind.$tag === 1) {
3519
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3520
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3521
+ return f4ah6o$yyjj$yaml$$Parser$parse_block_sequence(self, leading);
3522
+ } else break _L$4;
3523
+ else break _L$4;
3524
+ return f4ah6o$yyjj$yaml$$Parser$parse_indented_mapping(self, leading);
3525
+ }
3526
+ case 1: return f4ah6o$yyjj$yaml$$Parser$parse_block_sequence(self, leading);
3527
+ case 9: break _L$2;
3528
+ case 10: break _L$2;
3529
+ case 11: break _L$2;
3530
+ case 14:
3531
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3532
+ while (true) {
3533
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3534
+ if (_bind$2 === void 0) break;
3535
+ else if (_bind$2.$tag === 20) {
3536
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3537
+ continue;
3538
+ } else break;
3539
+ }
3540
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon)) return f4ah6o$yyjj$yaml$$Parser$parse_mapping_with_first_key(self, "null", 0, leading);
3541
+ else return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNull(f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
3542
+ case 15:
3543
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3544
+ while (true) {
3545
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3546
+ if (_bind$2 === void 0) break;
3547
+ else if (_bind$2.$tag === 20) {
3548
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3549
+ continue;
3550
+ } else break;
3551
+ }
3552
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon)) return f4ah6o$yyjj$yaml$$Parser$parse_mapping_with_first_key(self, "true", 0, leading);
3553
+ else return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YBool(true, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
3554
+ case 16:
3555
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3556
+ while (true) {
3557
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3558
+ if (_bind$2 === void 0) break;
3559
+ else if (_bind$2.$tag === 20) {
3560
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3561
+ continue;
3562
+ } else break;
3563
+ }
3564
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon)) return f4ah6o$yyjj$yaml$$Parser$parse_mapping_with_first_key(self, "false", 0, leading);
3565
+ else return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YBool(false, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
3566
+ case 5: return f4ah6o$yyjj$yaml$$Parser$parse_flow_sequence(self, leading);
3567
+ case 3: return f4ah6o$yyjj$yaml$$Parser$parse_flow_mapping(self, leading);
3568
+ case 12: {
3569
+ const _content = _x._0;
3570
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3571
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(_content, 3, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
3572
+ }
3573
+ case 13: {
3574
+ const _content$2 = _x._0;
3575
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3576
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(_content$2, 4, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
3577
+ }
3578
+ case 17: {
3579
+ const _name = _x._0;
3580
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3581
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3582
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$parse_value(self);
3583
+ let value;
3584
+ if (_bind$2.$tag === 1) value = _bind$2._0;
3585
+ else {
3586
+ const _e = _bind$2._0;
3587
+ return new Result$Err$3$(_e);
3588
+ }
3589
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YAnchor(_name, value));
3590
+ }
3591
+ case 18: {
3592
+ const _name$2 = _x._0;
3593
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3594
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YAlias(_name$2, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
3595
+ }
3596
+ case 24: return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNull(f4ah6o$yyjj$common$$Trivia$new(leading, [])));
3597
+ case 8: break _L;
3598
+ case 21: break _L;
3599
+ default: return new Result$Err$3$(f4ah6o$yyjj$common$$ParseError$unexpected_token(f4ah6o$yyjj$yaml$$token_kind_name(_x), f4ah6o$yyjj$yaml$$Parser$current_span(self)));
3600
+ }
3601
+ }
3602
+ }
3603
+ return f4ah6o$yyjj$yaml$$Parser$parse_scalar_or_mapping(self, leading);
3604
+ }
3605
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNull(f4ah6o$yyjj$common$$Trivia$new(leading, [])));
3606
+ }
3607
+ function f4ah6o$yyjj$yaml$$Parser$parse_block_sequence(self, leading) {
3608
+ const elements = [];
3609
+ let base_indent = -1;
3610
+ while (true) if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Dash)) {
3611
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3612
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3613
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3614
+ if (_bind === void 0) {} else {
3615
+ const _x = _bind;
3616
+ if (_x.$tag === 7) {
3617
+ const _n = _x._0;
3618
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3619
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3620
+ if (base_indent === -1) base_indent = _n;
3621
+ }
3622
+ }
3623
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$parse_value(self);
3624
+ let elem;
3625
+ if (_bind$2.$tag === 1) elem = _bind$2._0;
3626
+ else {
3627
+ const _e = _bind$2._0;
3628
+ return new Result$Err$3$(_e);
3629
+ }
3630
+ moonbitlang$core$array$$Array$push$10$(elements, elem);
3631
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3632
+ const _bind$3 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3633
+ if (_bind$3 === void 0) {} else {
3634
+ const _x = _bind$3;
3635
+ if (_x.$tag === 8) {
3636
+ const _n = _x._0;
3637
+ if (base_indent === -1 ? true : _n >= base_indent) f4ah6o$yyjj$yaml$$Parser$advance(self);
3638
+ break;
3639
+ }
3640
+ }
3641
+ continue;
3642
+ } else break;
3643
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YSequence(elements, f4ah6o$yyjj$common$$Trivia$new(leading, [])));
3644
+ }
3645
+ function f4ah6o$yyjj$yaml$$Parser$parse_flow_mapping(self, leading) {
3646
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3647
+ const pairs = [];
3648
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3649
+ while (true) if (moonbitlang$core$builtin$$op_notequal$5$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$RBrace) && !f4ah6o$yyjj$yaml$$Parser$is_eof(self)) {
3650
+ let _bind;
3651
+ _L: {
3652
+ _L$2: {
3653
+ const _bind$2$1 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3654
+ if (_bind$2$1 === void 0) break _L$2;
3655
+ else {
3656
+ const _x = _bind$2$1;
3657
+ switch (_x.$tag) {
3658
+ case 9: {
3659
+ const _s = _x._0;
3660
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3661
+ _bind = {
3662
+ _0: _s,
3663
+ _1: 0
3664
+ };
3665
+ break;
3666
+ }
3667
+ case 10: {
3668
+ const _s$2 = _x._0;
3669
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3670
+ _bind = {
3671
+ _0: _s$2,
3672
+ _1: 1
3673
+ };
3674
+ break;
3675
+ }
3676
+ case 11: {
3677
+ const _s$3 = _x._0;
3678
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3679
+ _bind = {
3680
+ _0: _s$3,
3681
+ _1: 2
3682
+ };
3683
+ break;
3684
+ }
3685
+ default: break _L$2;
3686
+ }
3687
+ }
3688
+ break _L;
3689
+ }
3690
+ break;
3691
+ }
3692
+ const _key_str = _bind._0;
3693
+ const _key_style = _bind._1;
3694
+ const key_node = new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(_key_str, _key_style, f4ah6o$yyjj$common$$Trivia$empty());
3695
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3696
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon)) f4ah6o$yyjj$yaml$$Parser$advance(self);
3697
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3698
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$parse_value(self);
3699
+ let value;
3700
+ if (_bind$2.$tag === 1) value = _bind$2._0;
3701
+ else {
3702
+ const _e = _bind$2._0;
3703
+ return new Result$Err$3$(_e);
3704
+ }
3705
+ moonbitlang$core$array$$Array$push$11$(pairs, f4ah6o$yyjj$yaml$$YKeyValue$new(key_node, f4ah6o$yyjj$common$$Trivia$empty(), value));
3706
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3707
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Comma)) {
3708
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3709
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3710
+ }
3711
+ continue;
3712
+ } else break;
3713
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$RBrace)) f4ah6o$yyjj$yaml$$Parser$advance(self);
3714
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YMapping(pairs, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
3715
+ }
3716
+ function f4ah6o$yyjj$yaml$$Parser$parse_flow_sequence(self, leading) {
3717
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3718
+ const elements = [];
3719
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3720
+ while (true) if (moonbitlang$core$builtin$$op_notequal$5$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$RBracket) && !f4ah6o$yyjj$yaml$$Parser$is_eof(self)) {
3721
+ const _bind = f4ah6o$yyjj$yaml$$Parser$parse_value(self);
3722
+ let elem;
3723
+ if (_bind.$tag === 1) elem = _bind._0;
3724
+ else {
3725
+ const _e = _bind._0;
3726
+ return new Result$Err$3$(_e);
3727
+ }
3728
+ moonbitlang$core$array$$Array$push$10$(elements, elem);
3729
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3730
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Comma)) {
3731
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3732
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3733
+ }
3734
+ continue;
3735
+ } else break;
3736
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$RBracket)) f4ah6o$yyjj$yaml$$Parser$advance(self);
3737
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YSequence(elements, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
3738
+ }
3739
+ function f4ah6o$yyjj$yaml$$Parser$parse_indented_mapping(self, leading) {
3740
+ moonbitlang$core$builtin$$println$3$(`parse_indented_mapping: starting... tokens.length=${moonbitlang$core$builtin$$Show$to_string$16$(self.tokens.length)}, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}`);
3741
+ if (self.tokens.length >= 30 && self.tokens.length <= 60) {
3742
+ moonbitlang$core$builtin$$println$3$(" All tokens: ");
3743
+ let _tmp = 0;
3744
+ while (true) {
3745
+ const i = _tmp;
3746
+ if (i < self.tokens.length) {
3747
+ moonbitlang$core$builtin$$println$3$(` ${moonbitlang$core$builtin$$Show$to_string$16$(i)}: ${moonbitlang$core$builtin$$Show$to_string$17$(moonbitlang$core$array$$Array$at$8$(self.tokens, i).kind)}`);
3748
+ _tmp = i + 1 | 0;
3749
+ continue;
3750
+ } else break;
3751
+ }
3752
+ } else if (self.tokens.length < 25) {
3753
+ moonbitlang$core$builtin$$println$3$(" All tokens: ");
3754
+ let _tmp = 0;
3755
+ while (true) {
3756
+ const i = _tmp;
3757
+ if (i < self.tokens.length) {
3758
+ moonbitlang$core$builtin$$println$3$(` ${moonbitlang$core$builtin$$Show$to_string$16$(i)}: ${moonbitlang$core$builtin$$Show$to_string$17$(moonbitlang$core$array$$Array$at$8$(self.tokens, i).kind)}`);
3759
+ _tmp = i + 1 | 0;
3760
+ continue;
3761
+ } else break;
3762
+ }
3763
+ }
3764
+ const pairs = [];
3765
+ let key = "";
3766
+ let key_style = 0;
3767
+ let key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
3768
+ let base_indent = -1;
3769
+ const entry_pos = self.pos;
3770
+ if (entry_pos > 0) {
3771
+ const _bind = moonbitlang$core$array$$Array$at$8$(self.tokens, entry_pos - 1 | 0).kind;
3772
+ if (_bind.$tag === 7) {
3773
+ base_indent = _bind._0;
3774
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: set base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)} from entry Indent at pos ${moonbitlang$core$builtin$$Show$to_string$16$(entry_pos - 1 | 0)}`);
3775
+ }
3776
+ }
3777
+ let loop_count = 0;
3778
+ _L: while (true) {
3779
+ loop_count = loop_count + 1 | 0;
3780
+ if (loop_count > 50) break;
3781
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3782
+ if (_bind === void 0) {} else {
3783
+ const _x = _bind;
3784
+ if (_x.$tag === 8) {
3785
+ const _n = _x._0;
3786
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: loop start - saw dedent n=${moonbitlang$core$builtin$$Show$to_string$16$(_n)}, base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}`);
3787
+ if (base_indent !== -1 ? _n < base_indent : _n === 0) {
3788
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: early exit due to dedent, n=${moonbitlang$core$builtin$$Show$to_string$16$(_n)}, base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}`);
3789
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3790
+ break;
3791
+ }
3792
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: consuming dedent and continuing, n=${moonbitlang$core$builtin$$Show$to_string$16$(_n)}, base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}`);
3793
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3794
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3795
+ continue;
3796
+ }
3797
+ }
3798
+ _L$2: {
3799
+ _L$3: {
3800
+ const _bind$2$1 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3801
+ if (_bind$2$1 === void 0) break _L$3;
3802
+ else {
3803
+ const _x = _bind$2$1;
3804
+ switch (_x.$tag) {
3805
+ case 1:
3806
+ if (pairs.length > 0) {
3807
+ const last_idx = pairs.length - 1 | 0;
3808
+ const last_key = moonbitlang$core$array$$Array$at$11$(pairs, last_idx).key;
3809
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: Dash handling - before parse_block_sequence, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}, tokens.length=${moonbitlang$core$builtin$$Show$to_string$16$(self.tokens.length)}`);
3810
+ const _bind$3$1 = f4ah6o$yyjj$yaml$$Parser$parse_block_sequence(self, []);
3811
+ if (_bind$3$1.$tag === 1) {
3812
+ const _seq = _bind$3$1._0;
3813
+ moonbitlang$core$array$$Array$set$11$(pairs, last_idx, f4ah6o$yyjj$yaml$$YKeyValue$new(last_key, moonbitlang$core$array$$Array$at$11$(pairs, last_idx).key_trivia, _seq));
3814
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: Dash handling - after parse_block_sequence, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
3815
+ } else {
3816
+ const _e = _bind$3$1._0;
3817
+ return new Result$Err$3$(_e);
3818
+ }
3819
+ }
3820
+ continue _L;
3821
+ case 9: {
3822
+ const _s = _x._0;
3823
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping iter ${moonbitlang$core$builtin$$Show$to_string$16$(loop_count)}: PlainScalar(${_s}), self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}`);
3824
+ key = _s;
3825
+ key_style = 0;
3826
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
3827
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3828
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3829
+ break;
3830
+ }
3831
+ case 10: {
3832
+ const _s$2 = _x._0;
3833
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping iter ${moonbitlang$core$builtin$$Show$to_string$16$(loop_count)}: SingleQuotedScalar(${_s$2})`);
3834
+ key = _s$2;
3835
+ key_style = 1;
3836
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
3837
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3838
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3839
+ break;
3840
+ }
3841
+ case 11: {
3842
+ const _s$3 = _x._0;
3843
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping iter ${moonbitlang$core$builtin$$Show$to_string$16$(loop_count)}: DoubleQuotedScalar(${_s$3})`);
3844
+ key = _s$3;
3845
+ key_style = 2;
3846
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
3847
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3848
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3849
+ break;
3850
+ }
3851
+ case 15:
3852
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping iter ${moonbitlang$core$builtin$$Show$to_string$16$(loop_count)}: TrueValue`);
3853
+ key = "true";
3854
+ key_style = 0;
3855
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
3856
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3857
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3858
+ break;
3859
+ case 16:
3860
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping iter ${moonbitlang$core$builtin$$Show$to_string$16$(loop_count)}: FalseValue`);
3861
+ key = "false";
3862
+ key_style = 0;
3863
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
3864
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3865
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3866
+ break;
3867
+ case 14:
3868
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping iter ${moonbitlang$core$builtin$$Show$to_string$16$(loop_count)}: NullValue`);
3869
+ key = "null";
3870
+ key_style = 0;
3871
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
3872
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3873
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3874
+ break;
3875
+ case 7:
3876
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3877
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3878
+ continue _L;
3879
+ default: break _L$3;
3880
+ }
3881
+ }
3882
+ break _L$2;
3883
+ }
3884
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping iter ${moonbitlang$core$builtin$$Show$to_string$16$(loop_count)}: breaking, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
3885
+ break;
3886
+ }
3887
+ if (moonbitlang$core$builtin$$op_notequal$5$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon)) break;
3888
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3889
+ const key_trailing = f4ah6o$yyjj$yaml$$Parser$collect_trailing(self);
3890
+ const key_trivia = f4ah6o$yyjj$common$$Trivia$new(key_leading, key_trailing);
3891
+ const key_node = new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(key, key_style, f4ah6o$yyjj$common$$Trivia$empty());
3892
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3893
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3894
+ let has_indent;
3895
+ if (_bind$2 === void 0) has_indent = false;
3896
+ else {
3897
+ const _x = _bind$2;
3898
+ if (_x.$tag === 7) {
3899
+ const _n = _x._0;
3900
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3901
+ if (base_indent === -1) base_indent = _n;
3902
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3903
+ has_indent = true;
3904
+ } else has_indent = false;
3905
+ }
3906
+ let value;
3907
+ if (!has_indent && f4ah6o$yyjj$yaml$$Parser$is_sibling_key_ahead(self)) value = new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNull(f4ah6o$yyjj$common$$Trivia$empty());
3908
+ else {
3909
+ if (key === "push") moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: before parse_value for push, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
3910
+ const _bind$3$1 = f4ah6o$yyjj$yaml$$Parser$parse_value(self);
3911
+ if (_bind$3$1.$tag === 1) {
3912
+ const _v = _bind$3$1._0;
3913
+ if (key === "push") moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: after parse_value for push, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
3914
+ value = _v;
3915
+ } else {
3916
+ const _e = _bind$3$1._0;
3917
+ return new Result$Err$3$(_e);
3918
+ }
3919
+ }
3920
+ moonbitlang$core$array$$Array$push$11$(pairs, f4ah6o$yyjj$yaml$$YKeyValue$new(key_node, key_trivia, value));
3921
+ if (key === "push") moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: after adding push, pairs.length()=${moonbitlang$core$builtin$$Show$to_string$16$(pairs.length)}`);
3922
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3923
+ const _bind$3 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3924
+ if (_bind$3 === void 0) {} else {
3925
+ const _x = _bind$3;
3926
+ switch (_x.$tag) {
3927
+ case 8: {
3928
+ const _n = _x._0;
3929
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: saw Dedent(${moonbitlang$core$builtin$$Show$to_string$16$(_n)}), base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}, key=${key}`);
3930
+ if (base_indent !== -1 ? _n < base_indent : _n === 0) {
3931
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: exiting due to dedent (should_exit), key=${key}, n=${moonbitlang$core$builtin$$Show$to_string$16$(_n)}, base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}`);
3932
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3933
+ break _L;
3934
+ }
3935
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3936
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3937
+ const _bind$4 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3938
+ if (_bind$4 === void 0) {} else if (_bind$4.$tag === 7) continue _L;
3939
+ if (key === "push") moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: consumed dedent, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
3940
+ break;
3941
+ }
3942
+ case 7:
3943
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3944
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3945
+ continue _L;
3946
+ }
3947
+ }
3948
+ if (key === "push") moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: after dedents, base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
3949
+ if (!f4ah6o$yyjj$yaml$$is_potential_key(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))) {
3950
+ if (key === "push") moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: breaking because no potential key, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
3951
+ break;
3952
+ }
3953
+ continue;
3954
+ }
3955
+ moonbitlang$core$builtin$$println$3$(` parse_indented_mapping: returning with pairs.length=${moonbitlang$core$builtin$$Show$to_string$16$(pairs.length)}, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
3956
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YMapping(pairs, f4ah6o$yyjj$common$$Trivia$new(leading, [])));
3957
+ }
3958
+ function f4ah6o$yyjj$yaml$$Parser$parse_mapping_with_first_key(self, first_key, key_style, leading) {
3959
+ const pairs = [];
3960
+ let key = first_key;
3961
+ let key_style$2 = key_style;
3962
+ let key_leading = leading;
3963
+ let base_indent = -1;
3964
+ let loop_iter = 0;
3965
+ while (true) {
3966
+ loop_iter = loop_iter + 1 | 0;
3967
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key loop ${moonbitlang$core$builtin$$Show$to_string$16$(loop_iter)}: first_key=${first_key}, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}, base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}`);
3968
+ if (moonbitlang$core$builtin$$op_notequal$5$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon)) break;
3969
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3970
+ const key_trailing = f4ah6o$yyjj$yaml$$Parser$collect_trailing(self);
3971
+ const key_trivia = f4ah6o$yyjj$common$$Trivia$new(key_leading, key_trailing);
3972
+ const key_node = new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(key, key_style$2, f4ah6o$yyjj$common$$Trivia$empty());
3973
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3974
+ const _bind = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3975
+ let has_indent;
3976
+ if (_bind === void 0) has_indent = false;
3977
+ else {
3978
+ const _x = _bind;
3979
+ if (_x.$tag === 7) {
3980
+ const _n = _x._0;
3981
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
3982
+ if (base_indent === -1) base_indent = _n;
3983
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key: consumed Indent(${moonbitlang$core$builtin$$Show$to_string$16$(_n)}), set base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}, key=${key}`);
3984
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
3985
+ has_indent = true;
3986
+ } else has_indent = false;
3987
+ }
3988
+ let has_key_after;
3989
+ if (has_indent) {
3990
+ const temp_pos = self.pos;
3991
+ while (true) {
3992
+ const _bind$2$1 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
3993
+ if (_bind$2$1 === void 0) break;
3994
+ else if (_bind$2$1.$tag === 7) {
3995
+ self.pos = self.pos + 1 | 0;
3996
+ continue;
3997
+ } else break;
3998
+ }
3999
+ while (true) {
4000
+ const _bind$2$1 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4001
+ if (_bind$2$1 === void 0) break;
4002
+ else if (_bind$2$1.$tag === 20) {
4003
+ self.pos = self.pos + 1 | 0;
4004
+ continue;
4005
+ } else break;
4006
+ }
4007
+ const result = f4ah6o$yyjj$yaml$$is_potential_key(f4ah6o$yyjj$yaml$$Parser$peek_kind(self));
4008
+ self.pos = temp_pos;
4009
+ has_key_after = result;
4010
+ } else has_key_after = false;
4011
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping: key=${first_key}, has_indent=${moonbitlang$core$builtin$$Show$to_string$19$(has_indent)}, has_key_after=${moonbitlang$core$builtin$$Show$to_string$19$(has_key_after)}, peek_kind=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}`);
4012
+ let value;
4013
+ if (!has_indent && f4ah6o$yyjj$yaml$$Parser$is_sibling_key_ahead(self)) {
4014
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key: sibling key ahead, returning null for key=${key}`);
4015
+ value = new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNull(f4ah6o$yyjj$common$$Trivia$empty());
4016
+ } else if (has_indent && has_key_after) {
4017
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key: calling parse_indented_mapping for key=${key}`);
4018
+ const _bind$2$1 = f4ah6o$yyjj$yaml$$Parser$parse_indented_mapping(self, []);
4019
+ if (_bind$2$1.$tag === 1) value = _bind$2$1._0;
4020
+ else {
4021
+ const _e = _bind$2$1._0;
4022
+ return new Result$Err$3$(_e);
4023
+ }
4024
+ } else {
4025
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key: calling parse_value for key=${key}, has_indent=${moonbitlang$core$builtin$$Show$to_string$19$(has_indent)}, has_key_after=${moonbitlang$core$builtin$$Show$to_string$19$(has_key_after)}`);
4026
+ const _bind$2$1 = f4ah6o$yyjj$yaml$$Parser$parse_value(self);
4027
+ if (_bind$2$1.$tag === 1) {
4028
+ const _v = _bind$2$1._0;
4029
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key: parse_value returned for key=${key}, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}`);
4030
+ value = _v;
4031
+ } else {
4032
+ const _e = _bind$2$1._0;
4033
+ return new Result$Err$3$(_e);
4034
+ }
4035
+ }
4036
+ moonbitlang$core$array$$Array$push$11$(pairs, f4ah6o$yyjj$yaml$$YKeyValue$new(key_node, key_trivia, value));
4037
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key: after adding pair (key=${key}), pairs.length=${moonbitlang$core$builtin$$Show$to_string$16$(pairs.length)}, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}`);
4038
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4039
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4040
+ if (_bind$2 === void 0) {} else if (_bind$2.$tag === 8) {
4041
+ while (true) {
4042
+ const _bind$3$2 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4043
+ if (_bind$3$2 === void 0) break;
4044
+ else {
4045
+ const _x$2 = _bind$3$2;
4046
+ if (_x$2.$tag === 8) {
4047
+ const _dn = _x$2._0;
4048
+ if (base_indent !== -1 ? _dn < base_indent : _dn === 0) {
4049
+ if (_dn === 0) {
4050
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4051
+ while (true) {
4052
+ const _bind$4 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4053
+ if (_bind$4 === void 0) break;
4054
+ else if (_bind$4.$tag === 8) {
4055
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4056
+ continue;
4057
+ } else break;
4058
+ }
4059
+ }
4060
+ break;
4061
+ }
4062
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4063
+ continue;
4064
+ } else break;
4065
+ }
4066
+ }
4067
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4068
+ const next_kind = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4069
+ if (first_key === "name" || first_key === "true" || first_key === "paths" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key: after dedent, next_kind=${f4ah6o$yyjj$yaml$$debug_token_kind(next_kind)}, is_potential_key=${moonbitlang$core$builtin$$Show$to_string$19$(f4ah6o$yyjj$yaml$$is_potential_key(next_kind))}, base_indent=${moonbitlang$core$builtin$$Show$to_string$16$(base_indent)}, first_key=${first_key}`);
4070
+ const _bind$3$1 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4071
+ if (_bind$3$1 === void 0) {} else if (_bind$3$1.$tag === 8) break;
4072
+ if (!f4ah6o$yyjj$yaml$$is_potential_key(next_kind)) break;
4073
+ }
4074
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4075
+ if (first_key === "name" || first_key === "true" || first_key === "on") moonbitlang$core$builtin$$println$3$(`parse_mapping_with_first_key: checking for next key, peek=${f4ah6o$yyjj$yaml$$debug_token_kind(f4ah6o$yyjj$yaml$$Parser$peek_kind(self))}, self.pos=${moonbitlang$core$builtin$$Show$to_string$16$(self.pos)}`);
4076
+ const _bind$3 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4077
+ if (_bind$3 === void 0) {} else if (_bind$3.$tag === 7) {
4078
+ const temp_pos = self.pos;
4079
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4080
+ const has_sibling_key = f4ah6o$yyjj$yaml$$is_potential_key(f4ah6o$yyjj$yaml$$Parser$peek_kind(self));
4081
+ self.pos = temp_pos;
4082
+ if (has_sibling_key) {
4083
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4084
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4085
+ }
4086
+ if (!has_sibling_key) break;
4087
+ }
4088
+ _L: {
4089
+ _L$2: {
4090
+ const _bind$4 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4091
+ if (_bind$4 === void 0) break _L$2;
4092
+ else {
4093
+ const _x = _bind$4;
4094
+ switch (_x.$tag) {
4095
+ case 9:
4096
+ key = _x._0;
4097
+ key_style$2 = 0;
4098
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
4099
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4100
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4101
+ break;
4102
+ case 10:
4103
+ key = _x._0;
4104
+ key_style$2 = 1;
4105
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
4106
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4107
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4108
+ break;
4109
+ case 11:
4110
+ key = _x._0;
4111
+ key_style$2 = 2;
4112
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
4113
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4114
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4115
+ break;
4116
+ case 15:
4117
+ key = "true";
4118
+ key_style$2 = 0;
4119
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
4120
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4121
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4122
+ break;
4123
+ case 16:
4124
+ key = "false";
4125
+ key_style$2 = 0;
4126
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
4127
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4128
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4129
+ break;
4130
+ case 14:
4131
+ key = "null";
4132
+ key_style$2 = 0;
4133
+ key_leading = f4ah6o$yyjj$yaml$$Parser$flush_leading(self);
4134
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4135
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4136
+ break;
4137
+ default: break _L$2;
4138
+ }
4139
+ }
4140
+ break _L;
4141
+ }
4142
+ break;
4143
+ }
4144
+ continue;
4145
+ }
4146
+ return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YMapping(pairs, f4ah6o$yyjj$common$$Trivia$empty()));
4147
+ }
4148
+ function f4ah6o$yyjj$yaml$$Parser$parse_scalar_or_mapping(self, leading) {
4149
+ let _bind;
4150
+ _L: {
4151
+ _L$2: {
4152
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4153
+ if (_bind$2 === void 0) break _L$2;
4154
+ else {
4155
+ const _x = _bind$2;
4156
+ switch (_x.$tag) {
4157
+ case 9:
4158
+ _bind = {
4159
+ _0: _x._0,
4160
+ _1: 0
4161
+ };
4162
+ break;
4163
+ case 10:
4164
+ _bind = {
4165
+ _0: _x._0,
4166
+ _1: 1
4167
+ };
4168
+ break;
4169
+ case 11:
4170
+ _bind = {
4171
+ _0: _x._0,
4172
+ _1: 2
4173
+ };
4174
+ break;
4175
+ default: break _L$2;
4176
+ }
4177
+ }
4178
+ break _L;
4179
+ }
4180
+ return new Result$Err$3$(f4ah6o$yyjj$common$$ParseError$unexpected_eof(f4ah6o$yyjj$yaml$$Parser$current_span(self)));
4181
+ }
4182
+ const _scalar = _bind._0;
4183
+ const _style = _bind._1;
4184
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4185
+ while (true) {
4186
+ const _bind$2 = f4ah6o$yyjj$yaml$$Parser$peek_kind(self);
4187
+ if (_bind$2 === void 0) break;
4188
+ else if (_bind$2.$tag === 20) {
4189
+ f4ah6o$yyjj$yaml$$Parser$advance(self);
4190
+ continue;
4191
+ } else break;
4192
+ }
4193
+ if (moonbitlang$core$builtin$$Eq$equal$6$(f4ah6o$yyjj$yaml$$Parser$peek_kind(self), $64$f4ah6o$47$yyjj$47$yaml$46$TokenKind$Colon)) return f4ah6o$yyjj$yaml$$Parser$parse_mapping_with_first_key(self, _scalar, _style, leading);
4194
+ else return new Result$Ok$3$(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(_scalar, _style, f4ah6o$yyjj$common$$Trivia$new(leading, f4ah6o$yyjj$yaml$$Parser$collect_trailing(self))));
4195
+ }
4196
+ function f4ah6o$yyjj$yaml$$Parser$parse(self) {
4197
+ f4ah6o$yyjj$yaml$$Parser$skip_trivia(self);
4198
+ return f4ah6o$yyjj$yaml$$Parser$parse_value(self);
4199
+ }
4200
+ function f4ah6o$yyjj$yaml$$parse(source) {
4201
+ return f4ah6o$yyjj$yaml$$Parser$parse(f4ah6o$yyjj$yaml$$Parser$from_source(source));
4202
+ }
4203
+ function f4ah6o$yyjj$transform$$extract_string_key(node) {
4204
+ switch (node.$tag) {
4205
+ case 3: return node._0;
4206
+ case 2: return node._0;
4207
+ case 1: if (node._0 === true) return "true";
4208
+ else return "false";
4209
+ case 0: return "null";
4210
+ default: return "";
4211
+ }
4212
+ }
4213
+ function f4ah6o$yyjj$transform$$transform_yaml_node(node, anchors) {
4214
+ let _tmp = node;
4215
+ _L: while (true) {
4216
+ const node$2 = _tmp;
4217
+ const trivia = f4ah6o$yyjj$yaml$$YamlNode$trivia(node$2);
4218
+ switch (node$2.$tag) {
4219
+ case 0: return new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JNull(trivia);
4220
+ case 1: {
4221
+ const _v = node$2._0;
4222
+ return new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JBool(_v, trivia);
4223
+ }
4224
+ case 2: {
4225
+ const _n = node$2._0;
4226
+ return new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JNumber(_n, trivia);
4227
+ }
4228
+ case 3: {
4229
+ const _s = node$2._0;
4230
+ return new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JString(_s, trivia);
4231
+ }
4232
+ case 4: {
4233
+ const _elements = node$2._0;
4234
+ const _p = new Array(_elements.length);
4235
+ const _p$2 = _elements.length;
4236
+ let _tmp$2 = 0;
4237
+ while (true) {
4238
+ const _p$3 = _tmp$2;
4239
+ if (_p$3 < _p$2) {
4240
+ const _p$4 = _elements[_p$3];
4241
+ _p[_p$3] = f4ah6o$yyjj$transform$$transform_yaml_node(_p$4, anchors);
4242
+ _tmp$2 = _p$3 + 1 | 0;
4243
+ continue;
4244
+ } else break;
4245
+ }
4246
+ return new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JArray(_p, trivia);
4247
+ }
4248
+ case 5: {
4249
+ const _pairs = node$2._0;
4250
+ const _p$3 = new Array(_pairs.length);
4251
+ const _p$4 = _pairs.length;
4252
+ let _tmp$3 = 0;
4253
+ while (true) {
4254
+ const _p$5 = _tmp$3;
4255
+ if (_p$5 < _p$4) {
4256
+ const _p$6 = _pairs[_p$5];
4257
+ const _p$7 = f4ah6o$yyjj$transform$$extract_string_key(_p$6.key);
4258
+ const _p$8 = _p$6.key_trivia;
4259
+ _p$3[_p$5] = f4ah6o$yyjj$jsonc$$JProperty$new(_p$7, _p$8, f4ah6o$yyjj$transform$$transform_yaml_node(_p$6.value, anchors));
4260
+ _tmp$3 = _p$5 + 1 | 0;
4261
+ continue;
4262
+ } else break;
4263
+ }
4264
+ return new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JObject(_p$3, trivia);
4265
+ }
4266
+ case 6: {
4267
+ const _name = node$2._0;
4268
+ const _bind = moonbitlang$core$builtin$$Map$get$26$(anchors, _name);
4269
+ if (_bind === void 0) return new $64$f4ah6o$47$yyjj$47$jsonc$46$JsonNode$JString(`*${_name}`, trivia);
4270
+ else {
4271
+ _tmp = _bind;
4272
+ continue _L;
4273
+ }
4274
+ }
4275
+ default: {
4276
+ const _YAnchor = node$2;
4277
+ const _name$2 = _YAnchor._0;
4278
+ const _value = _YAnchor._1;
4279
+ moonbitlang$core$builtin$$Map$set$26$(anchors, _name$2, _value);
4280
+ _tmp = _value;
4281
+ continue _L;
4282
+ }
4283
+ }
4284
+ }
4285
+ }
4286
+ function f4ah6o$yyjj$transform$$yaml_to_jsonc(node) {
4287
+ return f4ah6o$yyjj$transform$$transform_yaml_node(node, moonbitlang$core$builtin$$Map$from_array$26$({
4288
+ buf: [],
4289
+ start: 0,
4290
+ end: 0
4291
+ }));
4292
+ }
4293
+ function f4ah6o$yyjj$transform$$needs_quoting(s) {
4294
+ if (s.length === 0) return true;
4295
+ _L: {
4296
+ _L$2: {
4297
+ _L$3: {
4298
+ _L$4: {
4299
+ _L$5: {
4300
+ _L$6: {
4301
+ switch (s) {
4302
+ case "null": break _L$6;
4303
+ case "Null": break _L$6;
4304
+ case "NULL": break _L$6;
4305
+ case "~": break _L$6;
4306
+ case "true": break _L$4;
4307
+ case "True": break _L$4;
4308
+ case "TRUE": break _L$4;
4309
+ case "yes": break _L$4;
4310
+ case "Yes": break _L$4;
4311
+ case "YES": break _L$4;
4312
+ case "on": break _L$4;
4313
+ case "On": break _L$4;
4314
+ case "ON": break _L$4;
4315
+ case "false": break _L$2;
4316
+ case "False": break _L$2;
4317
+ case "FALSE": break _L$2;
4318
+ case "no": break _L$2;
4319
+ case "No": break _L$2;
4320
+ case "NO": break _L$2;
4321
+ case "off": break _L$2;
4322
+ case "Off": break _L$2;
4323
+ case "OFF": break _L$2;
4324
+ }
4325
+ break _L$5;
4326
+ }
4327
+ return true;
4328
+ }
4329
+ break _L$3;
4330
+ }
4331
+ return true;
4332
+ }
4333
+ break _L;
4334
+ }
4335
+ return true;
4336
+ }
4337
+ let _tmp = 0;
4338
+ while (true) {
4339
+ const i = _tmp;
4340
+ if (i < s.length) {
4341
+ $bound_check(s, i);
4342
+ const ch = s.charCodeAt(i);
4343
+ if (ch === 58 || ch === 35 || ch === 91 || ch === 93 || ch === 123 || ch === 125 || ch === 44 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96 || ch === 10 || ch === 13) return true;
4344
+ _tmp = i + 1 | 0;
4345
+ continue;
4346
+ } else break;
4347
+ }
4348
+ $bound_check(s, 0);
4349
+ const first = s.charCodeAt(0);
4350
+ if (first === 45 || first === 63 || first === 32 || first === 9) return true;
4351
+ return false;
4352
+ }
4353
+ function f4ah6o$yyjj$transform$$transform_string(s, trivia) {
4354
+ return new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(s, f4ah6o$yyjj$transform$$needs_quoting(s) ? 2 : 0, trivia);
4355
+ }
4356
+ function f4ah6o$yyjj$transform$$split_lines(s) {
4357
+ const lines = [];
4358
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
4359
+ let _tmp = 0;
4360
+ while (true) {
4361
+ const i = _tmp;
4362
+ if (i < s.length) {
4363
+ $bound_check(s, i);
4364
+ const ch = s.charCodeAt(i);
4365
+ if (ch === 10) {
4366
+ moonbitlang$core$array$$Array$push$3$(lines, buf.val);
4367
+ moonbitlang$core$builtin$$StringBuilder$reset(buf);
4368
+ } else if (ch !== 13) moonbitlang$core$builtin$$Logger$write_char$0$(buf, ch);
4369
+ _tmp = i + 1 | 0;
4370
+ continue;
4371
+ } else break;
4372
+ }
4373
+ const last = buf.val;
4374
+ if (last.length > 0) moonbitlang$core$array$$Array$push$3$(lines, last);
4375
+ return lines;
4376
+ }
4377
+ function f4ah6o$yyjj$transform$$transform_comment(comment) {
4378
+ if (comment.kind === 0) return [comment];
4379
+ else {
4380
+ const lines = f4ah6o$yyjj$transform$$split_lines(comment.content);
4381
+ if (lines.length === 0) return [];
4382
+ const _p = new Array(lines.length);
4383
+ const _p$2 = lines.length;
4384
+ let _tmp = 0;
4385
+ while (true) {
4386
+ const _p$3 = _tmp;
4387
+ if (_p$3 < _p$2) {
4388
+ const _p$4 = lines[_p$3];
4389
+ _p[_p$3] = f4ah6o$yyjj$common$$Comment$new(_p$4, 0, comment.span, _p$3 > 0);
4390
+ _tmp = _p$3 + 1 | 0;
4391
+ continue;
4392
+ } else break;
4393
+ }
4394
+ return _p;
4395
+ }
4396
+ }
4397
+ function f4ah6o$yyjj$transform$$transform_trivia(trivia) {
4398
+ const _p = trivia.leading;
4399
+ const _p$2 = new Array(_p.length);
4400
+ const _p$3 = _p.length;
4401
+ let _tmp = 0;
4402
+ while (true) {
4403
+ const _p$4$1 = _tmp;
4404
+ if (_p$4$1 < _p$3) {
4405
+ const _p$5$1 = _p[_p$4$1];
4406
+ _p$2[_p$4$1] = f4ah6o$yyjj$transform$$transform_comment(_p$5$1);
4407
+ _tmp = _p$4$1 + 1 | 0;
4408
+ continue;
4409
+ } else break;
4410
+ }
4411
+ const leading = moonbitlang$core$array$$Array$flatten$9$(_p$2);
4412
+ const _p$4 = trivia.trailing;
4413
+ const _p$5 = new Array(_p$4.length);
4414
+ const _p$6 = _p$4.length;
4415
+ let _tmp$2 = 0;
4416
+ while (true) {
4417
+ const _p$7 = _tmp$2;
4418
+ if (_p$7 < _p$6) {
4419
+ const _p$8 = _p$4[_p$7];
4420
+ _p$5[_p$7] = f4ah6o$yyjj$transform$$transform_comment(_p$8);
4421
+ _tmp$2 = _p$7 + 1 | 0;
4422
+ continue;
4423
+ } else break;
4424
+ }
4425
+ return f4ah6o$yyjj$common$$Trivia$new(leading, moonbitlang$core$array$$Array$flatten$9$(_p$5));
4426
+ }
4427
+ function f4ah6o$yyjj$transform$$transform_node(node) {
4428
+ const trivia = f4ah6o$yyjj$transform$$transform_trivia(f4ah6o$yyjj$jsonc$$JsonNode$trivia(node));
4429
+ switch (node.$tag) {
4430
+ case 0: return new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNull(trivia);
4431
+ case 1: {
4432
+ const _v = node._0;
4433
+ return new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YBool(_v, trivia);
4434
+ }
4435
+ case 2: {
4436
+ const _n = node._0;
4437
+ return new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YNumber(_n, trivia);
4438
+ }
4439
+ case 3: {
4440
+ const _s = node._0;
4441
+ return f4ah6o$yyjj$transform$$transform_string(_s, trivia);
4442
+ }
4443
+ case 4: {
4444
+ const _elements = node._0;
4445
+ const _p = new Array(_elements.length);
4446
+ const _p$2 = _elements.length;
4447
+ let _tmp = 0;
4448
+ while (true) {
4449
+ const _p$3 = _tmp;
4450
+ if (_p$3 < _p$2) {
4451
+ const _p$4 = _elements[_p$3];
4452
+ _p[_p$3] = f4ah6o$yyjj$transform$$transform_node(_p$4);
4453
+ _tmp = _p$3 + 1 | 0;
4454
+ continue;
4455
+ } else break;
4456
+ }
4457
+ return new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YSequence(_p, trivia);
4458
+ }
4459
+ default: {
4460
+ const _props = node._0;
4461
+ const _p$3 = new Array(_props.length);
4462
+ const _p$4 = _props.length;
4463
+ let _tmp$2 = 0;
4464
+ while (true) {
4465
+ const _p$5 = _tmp$2;
4466
+ if (_p$5 < _p$4) {
4467
+ const _p$6 = _props[_p$5];
4468
+ const _p$7 = _p$6.key;
4469
+ _p$3[_p$5] = f4ah6o$yyjj$yaml$$YKeyValue$new(new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YString(_p$7, 0, f4ah6o$yyjj$common$$Trivia$empty()), f4ah6o$yyjj$transform$$transform_trivia(_p$6.key_trivia), f4ah6o$yyjj$transform$$transform_node(_p$6.value));
4470
+ _tmp$2 = _p$5 + 1 | 0;
4471
+ continue;
4472
+ } else break;
4473
+ }
4474
+ return new $64$f4ah6o$47$yyjj$47$yaml$46$YamlNode$YMapping(_p$3, trivia);
4475
+ }
4476
+ }
4477
+ }
4478
+ function f4ah6o$yyjj$transform$$jsonc_to_yaml(node) {
4479
+ return f4ah6o$yyjj$transform$$transform_node(node);
4480
+ }
4481
+ function f4ah6o$yyjj$$jsonc_to_yaml(input, width) {
4482
+ const parsed = f4ah6o$yyjj$jsonc$$parse(input);
4483
+ if (parsed.$tag === 1) {
4484
+ const _node = parsed._0;
4485
+ const yaml_node = f4ah6o$yyjj$transform$$jsonc_to_yaml(_node);
4486
+ const _p = 80;
4487
+ let w;
4488
+ if (width === void 0) w = _p;
4489
+ else w = width;
4490
+ return new Result$Ok$4$(f4ah6o$yyjj$yaml$$print(yaml_node, w));
4491
+ } else {
4492
+ const _e = parsed._0;
4493
+ return new Result$Err$4$(_e);
4494
+ }
4495
+ }
4496
+ function f4ah6o$yyjj$$yaml_to_jsonc(input, width) {
4497
+ const parsed = f4ah6o$yyjj$yaml$$parse(input);
4498
+ if (parsed.$tag === 1) {
4499
+ const _node = parsed._0;
4500
+ const jsonc_node = f4ah6o$yyjj$transform$$yaml_to_jsonc(_node);
4501
+ const _p = 80;
4502
+ let w;
4503
+ if (width === void 0) w = _p;
4504
+ else w = width;
4505
+ return new Result$Ok$4$(f4ah6o$yyjj$jsonc$$print(jsonc_node, w));
4506
+ } else {
4507
+ const _e = parsed._0;
4508
+ return new Result$Err$4$(_e);
4509
+ }
4510
+ }
4511
+ function f4ah6o$yyjj$$parse_jsonc(input) {
4512
+ return f4ah6o$yyjj$jsonc$$parse(input);
4513
+ }
4514
+ function f4ah6o$yyjj$$parse_yaml(input) {
4515
+ return f4ah6o$yyjj$yaml$$parse(input);
4516
+ }
4517
+ function f4ah6o$yyjj$$print_jsonc(node, width) {
4518
+ const _p = 80;
4519
+ let w;
4520
+ if (width === void 0) w = _p;
4521
+ else w = width;
4522
+ return f4ah6o$yyjj$jsonc$$print(node, w);
4523
+ }
4524
+ function f4ah6o$yyjj$$print_yaml(node, width) {
4525
+ const _p = 80;
4526
+ let w;
4527
+ if (width === void 0) w = _p;
4528
+ else w = width;
4529
+ return f4ah6o$yyjj$yaml$$print(node, w);
4530
+ }
4531
+ function f4ah6o$yyjj$$transform_jsonc_to_yaml(node) {
4532
+ return f4ah6o$yyjj$transform$$jsonc_to_yaml(node);
4533
+ }
4534
+ function f4ah6o$yyjj$$transform_yaml_to_jsonc(node) {
4535
+ return f4ah6o$yyjj$transform$$yaml_to_jsonc(node);
4536
+ }
4537
+
4538
+ //#endregion
4539
+ exports.jsonc_to_yaml = f4ah6o$yyjj$$jsonc_to_yaml;
4540
+ exports.parse_jsonc = f4ah6o$yyjj$$parse_jsonc;
4541
+ exports.parse_yaml = f4ah6o$yyjj$$parse_yaml;
4542
+ exports.print_jsonc = f4ah6o$yyjj$$print_jsonc;
4543
+ exports.print_yaml = f4ah6o$yyjj$$print_yaml;
4544
+ exports.transform_jsonc_to_yaml = f4ah6o$yyjj$$transform_jsonc_to_yaml;
4545
+ exports.transform_yaml_to_jsonc = f4ah6o$yyjj$$transform_yaml_to_jsonc;
4546
+ exports.yaml_to_jsonc = f4ah6o$yyjj$$yaml_to_jsonc;
4547
+ //# sourceMappingURL=index.cjs.map