@notatki/parser 0.0.1

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/parser$.js ADDED
@@ -0,0 +1,2805 @@
1
+ // @generated by Peggy 5.0.6.
2
+ //
3
+ // https://peggyjs.org/
4
+
5
+
6
+ class peg$SyntaxError extends SyntaxError {
7
+ constructor(message, expected, found, location) {
8
+ super(message);
9
+ this.expected = expected;
10
+ this.found = found;
11
+ this.location = location;
12
+ this.name = "SyntaxError";
13
+ }
14
+
15
+ format(sources) {
16
+ let str = "Error: " + this.message;
17
+ if (this.location) {
18
+ let src = null;
19
+ const st = sources.find(s => s.source === this.location.source);
20
+ if (st) {
21
+ src = st.text.split(/\r\n|\n|\r/g);
22
+ }
23
+ const s = this.location.start;
24
+ const offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
25
+ ? this.location.source.offset(s)
26
+ : s;
27
+ const loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
28
+ if (src) {
29
+ const e = this.location.end;
30
+ const filler = "".padEnd(offset_s.line.toString().length, " ");
31
+ const line = src[s.line - 1];
32
+ const last = s.line === e.line ? e.column : line.length + 1;
33
+ const hatLen = (last - s.column) || 1;
34
+ str += "\n --> " + loc + "\n"
35
+ + filler + " |\n"
36
+ + offset_s.line + " | " + line + "\n"
37
+ + filler + " | " + "".padEnd(s.column - 1, " ")
38
+ + "".padEnd(hatLen, "^");
39
+ } else {
40
+ str += "\n at " + loc;
41
+ }
42
+ }
43
+ return str;
44
+ }
45
+
46
+ static buildMessage(expected, found) {
47
+ function hex(ch) {
48
+ return ch.codePointAt(0).toString(16).toUpperCase();
49
+ }
50
+
51
+ const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode")
52
+ ? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu")
53
+ : null;
54
+ function unicodeEscape(s) {
55
+ if (nonPrintable) {
56
+ return s.replace(nonPrintable, ch => "\\u{" + hex(ch) + "}");
57
+ }
58
+ return s;
59
+ }
60
+
61
+ function literalEscape(s) {
62
+ return unicodeEscape(s
63
+ .replace(/\\/g, "\\\\")
64
+ .replace(/"/g, "\\\"")
65
+ .replace(/\0/g, "\\0")
66
+ .replace(/\t/g, "\\t")
67
+ .replace(/\n/g, "\\n")
68
+ .replace(/\r/g, "\\r")
69
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
70
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
71
+ }
72
+
73
+ function classEscape(s) {
74
+ return unicodeEscape(s
75
+ .replace(/\\/g, "\\\\")
76
+ .replace(/\]/g, "\\]")
77
+ .replace(/\^/g, "\\^")
78
+ .replace(/-/g, "\\-")
79
+ .replace(/\0/g, "\\0")
80
+ .replace(/\t/g, "\\t")
81
+ .replace(/\n/g, "\\n")
82
+ .replace(/\r/g, "\\r")
83
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
84
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
85
+ }
86
+
87
+ const DESCRIBE_EXPECTATION_FNS = {
88
+ literal(expectation) {
89
+ return "\"" + literalEscape(expectation.text) + "\"";
90
+ },
91
+
92
+ class(expectation) {
93
+ const escapedParts = expectation.parts.map(
94
+ part => (Array.isArray(part)
95
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
96
+ : classEscape(part))
97
+ );
98
+
99
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]" + (expectation.unicode ? "u" : "");
100
+ },
101
+
102
+ any() {
103
+ return "any character";
104
+ },
105
+
106
+ end() {
107
+ return "end of input";
108
+ },
109
+
110
+ other(expectation) {
111
+ return expectation.description;
112
+ },
113
+ };
114
+
115
+ function describeExpectation(expectation) {
116
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
117
+ }
118
+
119
+ function describeExpected(expected) {
120
+ const descriptions = expected.map(describeExpectation);
121
+ descriptions.sort();
122
+
123
+ if (descriptions.length > 0) {
124
+ let j = 1;
125
+ for (let i = 1; i < descriptions.length; i++) {
126
+ if (descriptions[i - 1] !== descriptions[i]) {
127
+ descriptions[j] = descriptions[i];
128
+ j++;
129
+ }
130
+ }
131
+ descriptions.length = j;
132
+ }
133
+
134
+ switch (descriptions.length) {
135
+ case 1:
136
+ return descriptions[0];
137
+
138
+ case 2:
139
+ return descriptions[0] + " or " + descriptions[1];
140
+
141
+ default:
142
+ return descriptions.slice(0, -1).join(", ")
143
+ + ", or "
144
+ + descriptions[descriptions.length - 1];
145
+ }
146
+ }
147
+
148
+ function describeFound(found) {
149
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
150
+ }
151
+
152
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
153
+ }
154
+ }
155
+
156
+ function peg$parse(input, options) {
157
+ options = options !== undefined ? options : {};
158
+
159
+ const peg$FAILED = {};
160
+ const peg$source = options.grammarSource;
161
+
162
+ const peg$startRuleFunctions = {
163
+ Start: peg$parseStart,
164
+ NoteList: peg$parseNoteList,
165
+ ModelList: peg$parseModelList,
166
+ Template: peg$parseTemplate,
167
+ };
168
+ let peg$startRuleFunction = peg$parseStart;
169
+
170
+ const peg$c0 = "!type:";
171
+ const peg$c1 = "!deck:";
172
+ const peg$c2 = "!tags:";
173
+ const peg$c3 = "!";
174
+ const peg$c4 = ":";
175
+ const peg$c5 = "~~~";
176
+ const peg$c6 = "model";
177
+ const peg$c7 = "id";
178
+ const peg$c8 = "cloze";
179
+ const peg$c9 = "field";
180
+ const peg$c10 = "?";
181
+ const peg$c11 = "card";
182
+ const peg$c12 = "front";
183
+ const peg$c13 = "back";
184
+ const peg$c14 = "styling";
185
+ const peg$c15 = "{{";
186
+ const peg$c16 = "}}";
187
+ const peg$c17 = "#";
188
+ const peg$c18 = "^";
189
+ const peg$c19 = "/";
190
+ const peg$c20 = "\r\n";
191
+ const peg$c21 = "\n";
192
+
193
+ const peg$r0 = /^[0-9]/;
194
+ const peg$r1 = /^[#\/\^]/;
195
+ const peg$r2 = /^[\-_a-z0-9]/i;
196
+ const peg$r3 = /^[ \t]/;
197
+
198
+ const peg$e0 = peg$otherExpectation("property");
199
+ const peg$e1 = peg$literalExpectation("!type:", true);
200
+ const peg$e2 = peg$literalExpectation("!deck:", true);
201
+ const peg$e3 = peg$literalExpectation("!tags:", true);
202
+ const peg$e4 = peg$otherExpectation("field");
203
+ const peg$e5 = peg$literalExpectation("!", false);
204
+ const peg$e6 = peg$literalExpectation(":", false);
205
+ const peg$e7 = peg$anyExpectation();
206
+ const peg$e8 = peg$literalExpectation("~~~", false);
207
+ const peg$e9 = peg$literalExpectation("model", false);
208
+ const peg$e10 = peg$literalExpectation("id", false);
209
+ const peg$e11 = peg$classExpectation([["0", "9"]], false, false, false);
210
+ const peg$e12 = peg$literalExpectation("cloze", false);
211
+ const peg$e13 = peg$literalExpectation("field", false);
212
+ const peg$e14 = peg$literalExpectation("?", false);
213
+ const peg$e15 = peg$literalExpectation("card", false);
214
+ const peg$e16 = peg$literalExpectation("front", false);
215
+ const peg$e17 = peg$literalExpectation("back", false);
216
+ const peg$e18 = peg$literalExpectation("styling", false);
217
+ const peg$e19 = peg$literalExpectation("{{", false);
218
+ const peg$e20 = peg$classExpectation(["#", "/", "^"], false, false, false);
219
+ const peg$e21 = peg$literalExpectation("}}", false);
220
+ const peg$e22 = peg$literalExpectation("#", false);
221
+ const peg$e23 = peg$literalExpectation("^", false);
222
+ const peg$e24 = peg$literalExpectation("/", false);
223
+ const peg$e25 = peg$classExpectation(["-", "_", ["a", "z"], ["0", "9"]], false, true, false);
224
+ const peg$e26 = peg$otherExpectation("newline");
225
+ const peg$e27 = peg$literalExpectation("\r\n", false);
226
+ const peg$e28 = peg$literalExpectation("\n", false);
227
+ const peg$e29 = peg$otherExpectation("whitespace");
228
+ const peg$e30 = peg$classExpectation([" ", "\t"], false, false, false);
229
+
230
+ function peg$f0() { return null; }
231
+ function peg$f1(list) { return list; }
232
+ function peg$f2(properties, fields, end) { return { properties, fields, end, loc: location() }; }
233
+ function peg$f3(name, value) { return { name, value, loc: location() }; }
234
+ function peg$f4() { return "type"; }
235
+ function peg$f5() { return "deck"; }
236
+ function peg$f6() { return "tags"; }
237
+ function peg$f7(text) { return { text, loc: location() }; }
238
+ function peg$f8(name, value) { return { name, value, loc: location() }; }
239
+ function peg$f9(text) { return { text, loc: location() }; }
240
+ function peg$f10(head, lines) { return [head, ...lines].join("\n").trim(); }
241
+ function peg$f11(text) { return { text, loc: location() }; }
242
+ function peg$f12(text) { return { text, loc: location() }; }
243
+ function peg$f13(list) { return list; }
244
+ function peg$f14(name, id, cloze, fields, cards, styling) { return { name, id, cloze, fields, cards, styling, loc: location() } }
245
+ function peg$f15(text) { return { text, loc: location() }; }
246
+ function peg$f16(id) { return { id, value: Number.parseInt(id.text), loc: location() }; }
247
+ function peg$f17(text) { return { text, loc: location() }; }
248
+ function peg$f18(name, opt) { return { name, required: !opt, loc: location() } }
249
+ function peg$f19(text) { return { text, loc: location() }; }
250
+ function peg$f20(name, front, back) { return { name, front, back, loc: location() } }
251
+ function peg$f21(text) { return { text, loc: location() } }
252
+ function peg$f22(text) { return { text, loc: location() } }
253
+ function peg$f23(text) { return { text, loc: location() } }
254
+ function peg$f24(lines) { return lines.join("\n").trim(); }
255
+ function peg$f25(text) { return { type: "text", text, loc: location() }; }
256
+ function peg$f26(cond, items, end) {
257
+ if (cond.field.text !== end.field.text) {
258
+ error(`Expected "${cond.field.text}" but got "${end.field.text}".`, end.field.loc);
259
+ }
260
+ return { type: "branch", cond, items, end, loc: location() };
261
+ }
262
+ function peg$f27(field) { return { type: "field", field, loc: location() }; }
263
+ function peg$f28(field) { return { field, not: false, loc: location() }; }
264
+ function peg$f29(field) { return { field, not: true, loc: location() }; }
265
+ function peg$f30(field) { return { field, loc: location() }; }
266
+ function peg$f31(text) { return { text: text.replaceAll(/\s+/g, " "), loc: location() }; }
267
+ function peg$f32(text) { return { text: text.replaceAll(/\s+/g, " "), loc: location() }; }
268
+ function peg$f33(part) { return part.join(" "); }
269
+ let peg$currPos = options.peg$currPos | 0;
270
+ let peg$savedPos = peg$currPos;
271
+ const peg$posDetailsCache = [{ line: 1, column: 1 }];
272
+ let peg$maxFailPos = peg$currPos;
273
+ let peg$maxFailExpected = options.peg$maxFailExpected || [];
274
+ let peg$silentFails = options.peg$silentFails | 0;
275
+
276
+ let peg$result;
277
+
278
+ if (options.startRule) {
279
+ if (!(options.startRule in peg$startRuleFunctions)) {
280
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
281
+ }
282
+
283
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
284
+ }
285
+
286
+ function text() {
287
+ return input.substring(peg$savedPos, peg$currPos);
288
+ }
289
+
290
+ function offset() {
291
+ return peg$savedPos;
292
+ }
293
+
294
+ function range() {
295
+ return {
296
+ source: peg$source,
297
+ start: peg$savedPos,
298
+ end: peg$currPos,
299
+ };
300
+ }
301
+
302
+ function location() {
303
+ return peg$computeLocation(peg$savedPos, peg$currPos);
304
+ }
305
+
306
+ function expected(description, location) {
307
+ location = location !== undefined
308
+ ? location
309
+ : peg$computeLocation(peg$savedPos, peg$currPos);
310
+
311
+ throw peg$buildStructuredError(
312
+ [peg$otherExpectation(description)],
313
+ input.substring(peg$savedPos, peg$currPos),
314
+ location
315
+ );
316
+ }
317
+
318
+ function error(message, location) {
319
+ location = location !== undefined
320
+ ? location
321
+ : peg$computeLocation(peg$savedPos, peg$currPos);
322
+
323
+ throw peg$buildSimpleError(message, location);
324
+ }
325
+
326
+ function peg$getUnicode(pos = peg$currPos) {
327
+ const cp = input.codePointAt(pos);
328
+ if (cp === undefined) {
329
+ return "";
330
+ }
331
+ return String.fromCodePoint(cp);
332
+ }
333
+
334
+ function peg$literalExpectation(text, ignoreCase) {
335
+ return { type: "literal", text, ignoreCase };
336
+ }
337
+
338
+ function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
339
+ return { type: "class", parts, inverted, ignoreCase, unicode };
340
+ }
341
+
342
+ function peg$anyExpectation() {
343
+ return { type: "any" };
344
+ }
345
+
346
+ function peg$endExpectation() {
347
+ return { type: "end" };
348
+ }
349
+
350
+ function peg$otherExpectation(description) {
351
+ return { type: "other", description };
352
+ }
353
+
354
+ function peg$computePosDetails(pos) {
355
+ let details = peg$posDetailsCache[pos];
356
+ let p;
357
+
358
+ if (details) {
359
+ return details;
360
+ } else {
361
+ if (pos >= peg$posDetailsCache.length) {
362
+ p = peg$posDetailsCache.length - 1;
363
+ } else {
364
+ p = pos;
365
+ while (!peg$posDetailsCache[--p]) {}
366
+ }
367
+
368
+ details = peg$posDetailsCache[p];
369
+ details = {
370
+ line: details.line,
371
+ column: details.column,
372
+ };
373
+
374
+ while (p < pos) {
375
+ if (input.charCodeAt(p) === 10) {
376
+ details.line++;
377
+ details.column = 1;
378
+ } else {
379
+ details.column++;
380
+ }
381
+
382
+ p++;
383
+ }
384
+
385
+ peg$posDetailsCache[pos] = details;
386
+
387
+ return details;
388
+ }
389
+ }
390
+
391
+ function peg$computeLocation(startPos, endPos, offset) {
392
+ const startPosDetails = peg$computePosDetails(startPos);
393
+ const endPosDetails = peg$computePosDetails(endPos);
394
+
395
+ const res = {
396
+ source: peg$source,
397
+ start: {
398
+ offset: startPos,
399
+ line: startPosDetails.line,
400
+ column: startPosDetails.column,
401
+ },
402
+ end: {
403
+ offset: endPos,
404
+ line: endPosDetails.line,
405
+ column: endPosDetails.column,
406
+ },
407
+ };
408
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
409
+ res.start = peg$source.offset(res.start);
410
+ res.end = peg$source.offset(res.end);
411
+ }
412
+ return res;
413
+ }
414
+
415
+ function peg$fail(expected) {
416
+ if (peg$currPos < peg$maxFailPos) { return; }
417
+
418
+ if (peg$currPos > peg$maxFailPos) {
419
+ peg$maxFailPos = peg$currPos;
420
+ peg$maxFailExpected = [];
421
+ }
422
+
423
+ peg$maxFailExpected.push(expected);
424
+ }
425
+
426
+ function peg$buildSimpleError(message, location) {
427
+ return new peg$SyntaxError(message, null, null, location);
428
+ }
429
+
430
+ function peg$buildStructuredError(expected, found, location) {
431
+ return new peg$SyntaxError(
432
+ peg$SyntaxError.buildMessage(expected, found),
433
+ expected,
434
+ found,
435
+ location
436
+ );
437
+ }
438
+
439
+ function peg$parseStart() {
440
+ let s0, s1;
441
+
442
+ s0 = peg$currPos;
443
+ s1 = '';
444
+ peg$savedPos = s0;
445
+ s1 = peg$f0();
446
+ s0 = s1;
447
+
448
+ return s0;
449
+ }
450
+
451
+ function peg$parseNoteList() {
452
+ let s0, s1, s2, s3, s4, s5, s6;
453
+
454
+ s0 = peg$currPos;
455
+ s1 = [];
456
+ s2 = peg$currPos;
457
+ s3 = [];
458
+ s4 = peg$currPos;
459
+ s5 = peg$parse_();
460
+ s6 = peg$parseNewline();
461
+ if (s6 !== peg$FAILED) {
462
+ s5 = [s5, s6];
463
+ s4 = s5;
464
+ } else {
465
+ peg$currPos = s4;
466
+ s4 = peg$FAILED;
467
+ }
468
+ while (s4 !== peg$FAILED) {
469
+ s3.push(s4);
470
+ s4 = peg$currPos;
471
+ s5 = peg$parse_();
472
+ s6 = peg$parseNewline();
473
+ if (s6 !== peg$FAILED) {
474
+ s5 = [s5, s6];
475
+ s4 = s5;
476
+ } else {
477
+ peg$currPos = s4;
478
+ s4 = peg$FAILED;
479
+ }
480
+ }
481
+ s4 = peg$parseNote();
482
+ if (s4 !== peg$FAILED) {
483
+ s2 = s4;
484
+ } else {
485
+ peg$currPos = s2;
486
+ s2 = peg$FAILED;
487
+ }
488
+ while (s2 !== peg$FAILED) {
489
+ s1.push(s2);
490
+ s2 = peg$currPos;
491
+ s3 = [];
492
+ s4 = peg$currPos;
493
+ s5 = peg$parse_();
494
+ s6 = peg$parseNewline();
495
+ if (s6 !== peg$FAILED) {
496
+ s5 = [s5, s6];
497
+ s4 = s5;
498
+ } else {
499
+ peg$currPos = s4;
500
+ s4 = peg$FAILED;
501
+ }
502
+ while (s4 !== peg$FAILED) {
503
+ s3.push(s4);
504
+ s4 = peg$currPos;
505
+ s5 = peg$parse_();
506
+ s6 = peg$parseNewline();
507
+ if (s6 !== peg$FAILED) {
508
+ s5 = [s5, s6];
509
+ s4 = s5;
510
+ } else {
511
+ peg$currPos = s4;
512
+ s4 = peg$FAILED;
513
+ }
514
+ }
515
+ s4 = peg$parseNote();
516
+ if (s4 !== peg$FAILED) {
517
+ s2 = s4;
518
+ } else {
519
+ peg$currPos = s2;
520
+ s2 = peg$FAILED;
521
+ }
522
+ }
523
+ s2 = [];
524
+ s3 = peg$currPos;
525
+ s4 = peg$parse_();
526
+ s5 = peg$parseNewline();
527
+ if (s5 !== peg$FAILED) {
528
+ s4 = [s4, s5];
529
+ s3 = s4;
530
+ } else {
531
+ peg$currPos = s3;
532
+ s3 = peg$FAILED;
533
+ }
534
+ while (s3 !== peg$FAILED) {
535
+ s2.push(s3);
536
+ s3 = peg$currPos;
537
+ s4 = peg$parse_();
538
+ s5 = peg$parseNewline();
539
+ if (s5 !== peg$FAILED) {
540
+ s4 = [s4, s5];
541
+ s3 = s4;
542
+ } else {
543
+ peg$currPos = s3;
544
+ s3 = peg$FAILED;
545
+ }
546
+ }
547
+ s3 = peg$parse_();
548
+ peg$savedPos = s0;
549
+ s0 = peg$f1(s1);
550
+
551
+ return s0;
552
+ }
553
+
554
+ function peg$parseNote() {
555
+ let s0, s1, s2, s3, s4, s5, s6, s7;
556
+
557
+ s0 = peg$currPos;
558
+ s1 = [];
559
+ s2 = peg$currPos;
560
+ s3 = [];
561
+ s4 = peg$currPos;
562
+ s5 = peg$parse_();
563
+ s6 = peg$parseNewline();
564
+ if (s6 !== peg$FAILED) {
565
+ s5 = [s5, s6];
566
+ s4 = s5;
567
+ } else {
568
+ peg$currPos = s4;
569
+ s4 = peg$FAILED;
570
+ }
571
+ while (s4 !== peg$FAILED) {
572
+ s3.push(s4);
573
+ s4 = peg$currPos;
574
+ s5 = peg$parse_();
575
+ s6 = peg$parseNewline();
576
+ if (s6 !== peg$FAILED) {
577
+ s5 = [s5, s6];
578
+ s4 = s5;
579
+ } else {
580
+ peg$currPos = s4;
581
+ s4 = peg$FAILED;
582
+ }
583
+ }
584
+ s4 = peg$parseNoteProperty();
585
+ if (s4 !== peg$FAILED) {
586
+ s5 = peg$parse_();
587
+ s6 = peg$parseNewline();
588
+ if (s6 !== peg$FAILED) {
589
+ s2 = s4;
590
+ } else {
591
+ peg$currPos = s2;
592
+ s2 = peg$FAILED;
593
+ }
594
+ } else {
595
+ peg$currPos = s2;
596
+ s2 = peg$FAILED;
597
+ }
598
+ while (s2 !== peg$FAILED) {
599
+ s1.push(s2);
600
+ s2 = peg$currPos;
601
+ s3 = [];
602
+ s4 = peg$currPos;
603
+ s5 = peg$parse_();
604
+ s6 = peg$parseNewline();
605
+ if (s6 !== peg$FAILED) {
606
+ s5 = [s5, s6];
607
+ s4 = s5;
608
+ } else {
609
+ peg$currPos = s4;
610
+ s4 = peg$FAILED;
611
+ }
612
+ while (s4 !== peg$FAILED) {
613
+ s3.push(s4);
614
+ s4 = peg$currPos;
615
+ s5 = peg$parse_();
616
+ s6 = peg$parseNewline();
617
+ if (s6 !== peg$FAILED) {
618
+ s5 = [s5, s6];
619
+ s4 = s5;
620
+ } else {
621
+ peg$currPos = s4;
622
+ s4 = peg$FAILED;
623
+ }
624
+ }
625
+ s4 = peg$parseNoteProperty();
626
+ if (s4 !== peg$FAILED) {
627
+ s5 = peg$parse_();
628
+ s6 = peg$parseNewline();
629
+ if (s6 !== peg$FAILED) {
630
+ s2 = s4;
631
+ } else {
632
+ peg$currPos = s2;
633
+ s2 = peg$FAILED;
634
+ }
635
+ } else {
636
+ peg$currPos = s2;
637
+ s2 = peg$FAILED;
638
+ }
639
+ }
640
+ s2 = [];
641
+ s3 = peg$currPos;
642
+ s4 = [];
643
+ s5 = peg$currPos;
644
+ s6 = peg$parse_();
645
+ s7 = peg$parseNewline();
646
+ if (s7 !== peg$FAILED) {
647
+ s6 = [s6, s7];
648
+ s5 = s6;
649
+ } else {
650
+ peg$currPos = s5;
651
+ s5 = peg$FAILED;
652
+ }
653
+ while (s5 !== peg$FAILED) {
654
+ s4.push(s5);
655
+ s5 = peg$currPos;
656
+ s6 = peg$parse_();
657
+ s7 = peg$parseNewline();
658
+ if (s7 !== peg$FAILED) {
659
+ s6 = [s6, s7];
660
+ s5 = s6;
661
+ } else {
662
+ peg$currPos = s5;
663
+ s5 = peg$FAILED;
664
+ }
665
+ }
666
+ s5 = peg$parseNoteField();
667
+ if (s5 !== peg$FAILED) {
668
+ s6 = peg$parse_();
669
+ s7 = peg$parseNewline();
670
+ if (s7 !== peg$FAILED) {
671
+ s3 = s5;
672
+ } else {
673
+ peg$currPos = s3;
674
+ s3 = peg$FAILED;
675
+ }
676
+ } else {
677
+ peg$currPos = s3;
678
+ s3 = peg$FAILED;
679
+ }
680
+ while (s3 !== peg$FAILED) {
681
+ s2.push(s3);
682
+ s3 = peg$currPos;
683
+ s4 = [];
684
+ s5 = peg$currPos;
685
+ s6 = peg$parse_();
686
+ s7 = peg$parseNewline();
687
+ if (s7 !== peg$FAILED) {
688
+ s6 = [s6, s7];
689
+ s5 = s6;
690
+ } else {
691
+ peg$currPos = s5;
692
+ s5 = peg$FAILED;
693
+ }
694
+ while (s5 !== peg$FAILED) {
695
+ s4.push(s5);
696
+ s5 = peg$currPos;
697
+ s6 = peg$parse_();
698
+ s7 = peg$parseNewline();
699
+ if (s7 !== peg$FAILED) {
700
+ s6 = [s6, s7];
701
+ s5 = s6;
702
+ } else {
703
+ peg$currPos = s5;
704
+ s5 = peg$FAILED;
705
+ }
706
+ }
707
+ s5 = peg$parseNoteField();
708
+ if (s5 !== peg$FAILED) {
709
+ s6 = peg$parse_();
710
+ s7 = peg$parseNewline();
711
+ if (s7 !== peg$FAILED) {
712
+ s3 = s5;
713
+ } else {
714
+ peg$currPos = s3;
715
+ s3 = peg$FAILED;
716
+ }
717
+ } else {
718
+ peg$currPos = s3;
719
+ s3 = peg$FAILED;
720
+ }
721
+ }
722
+ s3 = peg$currPos;
723
+ s4 = [];
724
+ s5 = peg$currPos;
725
+ s6 = peg$parse_();
726
+ s7 = peg$parseNewline();
727
+ if (s7 !== peg$FAILED) {
728
+ s6 = [s6, s7];
729
+ s5 = s6;
730
+ } else {
731
+ peg$currPos = s5;
732
+ s5 = peg$FAILED;
733
+ }
734
+ while (s5 !== peg$FAILED) {
735
+ s4.push(s5);
736
+ s5 = peg$currPos;
737
+ s6 = peg$parse_();
738
+ s7 = peg$parseNewline();
739
+ if (s7 !== peg$FAILED) {
740
+ s6 = [s6, s7];
741
+ s5 = s6;
742
+ } else {
743
+ peg$currPos = s5;
744
+ s5 = peg$FAILED;
745
+ }
746
+ }
747
+ s5 = peg$parseNoteEnd();
748
+ if (s5 !== peg$FAILED) {
749
+ s6 = peg$parse_();
750
+ s7 = peg$parseNewline();
751
+ if (s7 !== peg$FAILED) {
752
+ s3 = s5;
753
+ } else {
754
+ peg$currPos = s3;
755
+ s3 = peg$FAILED;
756
+ }
757
+ } else {
758
+ peg$currPos = s3;
759
+ s3 = peg$FAILED;
760
+ }
761
+ if (s3 !== peg$FAILED) {
762
+ peg$savedPos = s0;
763
+ s0 = peg$f2(s1, s2, s3);
764
+ } else {
765
+ peg$currPos = s0;
766
+ s0 = peg$FAILED;
767
+ }
768
+
769
+ return s0;
770
+ }
771
+
772
+ function peg$parseNoteProperty() {
773
+ let s0, s1, s2, s3;
774
+
775
+ peg$silentFails++;
776
+ s0 = peg$currPos;
777
+ s1 = peg$parseNotePropertyName();
778
+ if (s1 !== peg$FAILED) {
779
+ s2 = peg$parse_();
780
+ s3 = peg$parseNormalText();
781
+ peg$savedPos = s0;
782
+ s0 = peg$f3(s1, s3);
783
+ } else {
784
+ peg$currPos = s0;
785
+ s0 = peg$FAILED;
786
+ }
787
+ peg$silentFails--;
788
+ if (s0 === peg$FAILED) {
789
+ s1 = peg$FAILED;
790
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
791
+ }
792
+
793
+ return s0;
794
+ }
795
+
796
+ function peg$parseNotePropertyName() {
797
+ let s0, s1, s2;
798
+
799
+ s0 = peg$currPos;
800
+ s1 = peg$currPos;
801
+ s2 = input.substr(peg$currPos, 6);
802
+ if (s2.toLowerCase() === peg$c0) {
803
+ peg$currPos += (6);
804
+ } else {
805
+ s2 = peg$FAILED;
806
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
807
+ }
808
+ if (s2 !== peg$FAILED) {
809
+ peg$savedPos = s1;
810
+ s2 = peg$f4();
811
+ }
812
+ s1 = s2;
813
+ if (s1 === peg$FAILED) {
814
+ s1 = peg$currPos;
815
+ s2 = input.substr(peg$currPos, 6);
816
+ if (s2.toLowerCase() === peg$c1) {
817
+ peg$currPos += (6);
818
+ } else {
819
+ s2 = peg$FAILED;
820
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
821
+ }
822
+ if (s2 !== peg$FAILED) {
823
+ peg$savedPos = s1;
824
+ s2 = peg$f5();
825
+ }
826
+ s1 = s2;
827
+ if (s1 === peg$FAILED) {
828
+ s1 = peg$currPos;
829
+ s2 = input.substr(peg$currPos, 6);
830
+ if (s2.toLowerCase() === peg$c2) {
831
+ peg$currPos += (6);
832
+ } else {
833
+ s2 = peg$FAILED;
834
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
835
+ }
836
+ if (s2 !== peg$FAILED) {
837
+ peg$savedPos = s1;
838
+ s2 = peg$f6();
839
+ }
840
+ s1 = s2;
841
+ }
842
+ }
843
+ if (s1 !== peg$FAILED) {
844
+ peg$savedPos = s0;
845
+ s1 = peg$f7(s1);
846
+ }
847
+ s0 = s1;
848
+
849
+ return s0;
850
+ }
851
+
852
+ function peg$parseNoteField() {
853
+ let s0, s1, s2, s3;
854
+
855
+ peg$silentFails++;
856
+ s0 = peg$currPos;
857
+ s1 = peg$parseNoteFieldName();
858
+ if (s1 !== peg$FAILED) {
859
+ s2 = peg$parse_();
860
+ s3 = peg$parseNoteFieldValue();
861
+ peg$savedPos = s0;
862
+ s0 = peg$f8(s1, s3);
863
+ } else {
864
+ peg$currPos = s0;
865
+ s0 = peg$FAILED;
866
+ }
867
+ peg$silentFails--;
868
+ if (s0 === peg$FAILED) {
869
+ s1 = peg$FAILED;
870
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
871
+ }
872
+
873
+ return s0;
874
+ }
875
+
876
+ function peg$parseNoteFieldName() {
877
+ let s0, s1, s2, s3;
878
+
879
+ s0 = peg$currPos;
880
+ if (input.charCodeAt(peg$currPos) === 33) {
881
+ s1 = peg$c3;
882
+ peg$currPos++;
883
+ } else {
884
+ s1 = peg$FAILED;
885
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
886
+ }
887
+ if (s1 !== peg$FAILED) {
888
+ s2 = peg$parseFieldNameText();
889
+ if (s2 !== peg$FAILED) {
890
+ if (input.charCodeAt(peg$currPos) === 58) {
891
+ s3 = peg$c4;
892
+ peg$currPos++;
893
+ } else {
894
+ s3 = peg$FAILED;
895
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
896
+ }
897
+ if (s3 !== peg$FAILED) {
898
+ peg$savedPos = s0;
899
+ s0 = peg$f9(s2);
900
+ } else {
901
+ peg$currPos = s0;
902
+ s0 = peg$FAILED;
903
+ }
904
+ } else {
905
+ peg$currPos = s0;
906
+ s0 = peg$FAILED;
907
+ }
908
+ } else {
909
+ peg$currPos = s0;
910
+ s0 = peg$FAILED;
911
+ }
912
+
913
+ return s0;
914
+ }
915
+
916
+ function peg$parseNoteFieldValue() {
917
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
918
+
919
+ s0 = peg$currPos;
920
+ s1 = peg$currPos;
921
+ s2 = peg$currPos;
922
+ s3 = peg$parseText();
923
+ s4 = peg$parse_();
924
+ s2 = s3;
925
+ s3 = [];
926
+ s4 = peg$currPos;
927
+ s5 = peg$currPos;
928
+ peg$silentFails++;
929
+ s6 = peg$currPos;
930
+ s7 = peg$parseNewline();
931
+ if (s7 !== peg$FAILED) {
932
+ s8 = peg$parseNoteFieldName();
933
+ if (s8 === peg$FAILED) {
934
+ s8 = peg$parseNoteEnd();
935
+ if (s8 === peg$FAILED) {
936
+ s8 = peg$currPos;
937
+ peg$silentFails++;
938
+ if (input.length > peg$currPos) {
939
+ s9 = input.charAt(peg$currPos);
940
+ peg$currPos++;
941
+ } else {
942
+ s9 = peg$FAILED;
943
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
944
+ }
945
+ peg$silentFails--;
946
+ if (s9 === peg$FAILED) {
947
+ s8 = undefined;
948
+ } else {
949
+ peg$currPos = s8;
950
+ s8 = peg$FAILED;
951
+ }
952
+ }
953
+ }
954
+ if (s8 !== peg$FAILED) {
955
+ s7 = [s7, s8];
956
+ s6 = s7;
957
+ } else {
958
+ peg$currPos = s6;
959
+ s6 = peg$FAILED;
960
+ }
961
+ } else {
962
+ peg$currPos = s6;
963
+ s6 = peg$FAILED;
964
+ }
965
+ peg$silentFails--;
966
+ if (s6 === peg$FAILED) {
967
+ s5 = undefined;
968
+ } else {
969
+ peg$currPos = s5;
970
+ s5 = peg$FAILED;
971
+ }
972
+ if (s5 !== peg$FAILED) {
973
+ s6 = peg$parseNewline();
974
+ if (s6 !== peg$FAILED) {
975
+ s7 = peg$parseText();
976
+ s8 = peg$parse_();
977
+ s4 = s7;
978
+ } else {
979
+ peg$currPos = s4;
980
+ s4 = peg$FAILED;
981
+ }
982
+ } else {
983
+ peg$currPos = s4;
984
+ s4 = peg$FAILED;
985
+ }
986
+ while (s4 !== peg$FAILED) {
987
+ s3.push(s4);
988
+ s4 = peg$currPos;
989
+ s5 = peg$currPos;
990
+ peg$silentFails++;
991
+ s6 = peg$currPos;
992
+ s7 = peg$parseNewline();
993
+ if (s7 !== peg$FAILED) {
994
+ s8 = peg$parseNoteFieldName();
995
+ if (s8 === peg$FAILED) {
996
+ s8 = peg$parseNoteEnd();
997
+ if (s8 === peg$FAILED) {
998
+ s8 = peg$currPos;
999
+ peg$silentFails++;
1000
+ if (input.length > peg$currPos) {
1001
+ s9 = input.charAt(peg$currPos);
1002
+ peg$currPos++;
1003
+ } else {
1004
+ s9 = peg$FAILED;
1005
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
1006
+ }
1007
+ peg$silentFails--;
1008
+ if (s9 === peg$FAILED) {
1009
+ s8 = undefined;
1010
+ } else {
1011
+ peg$currPos = s8;
1012
+ s8 = peg$FAILED;
1013
+ }
1014
+ }
1015
+ }
1016
+ if (s8 !== peg$FAILED) {
1017
+ s7 = [s7, s8];
1018
+ s6 = s7;
1019
+ } else {
1020
+ peg$currPos = s6;
1021
+ s6 = peg$FAILED;
1022
+ }
1023
+ } else {
1024
+ peg$currPos = s6;
1025
+ s6 = peg$FAILED;
1026
+ }
1027
+ peg$silentFails--;
1028
+ if (s6 === peg$FAILED) {
1029
+ s5 = undefined;
1030
+ } else {
1031
+ peg$currPos = s5;
1032
+ s5 = peg$FAILED;
1033
+ }
1034
+ if (s5 !== peg$FAILED) {
1035
+ s6 = peg$parseNewline();
1036
+ if (s6 !== peg$FAILED) {
1037
+ s7 = peg$parseText();
1038
+ s8 = peg$parse_();
1039
+ s4 = s7;
1040
+ } else {
1041
+ peg$currPos = s4;
1042
+ s4 = peg$FAILED;
1043
+ }
1044
+ } else {
1045
+ peg$currPos = s4;
1046
+ s4 = peg$FAILED;
1047
+ }
1048
+ }
1049
+ peg$savedPos = s1;
1050
+ s1 = peg$f10(s2, s3);
1051
+ peg$savedPos = s0;
1052
+ s1 = peg$f11(s1);
1053
+ s0 = s1;
1054
+
1055
+ return s0;
1056
+ }
1057
+
1058
+ function peg$parseNoteEnd() {
1059
+ let s0, s1;
1060
+
1061
+ s0 = peg$currPos;
1062
+ if (input.substr(peg$currPos, 3) === peg$c5) {
1063
+ s1 = peg$c5;
1064
+ peg$currPos += 3;
1065
+ } else {
1066
+ s1 = peg$FAILED;
1067
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
1068
+ }
1069
+ if (s1 !== peg$FAILED) {
1070
+ peg$savedPos = s0;
1071
+ s1 = peg$f12(s1);
1072
+ }
1073
+ s0 = s1;
1074
+
1075
+ return s0;
1076
+ }
1077
+
1078
+ function peg$parseModelList() {
1079
+ let s0, s1, s2, s3, s4, s5, s6;
1080
+
1081
+ s0 = peg$currPos;
1082
+ s1 = [];
1083
+ s2 = peg$currPos;
1084
+ s3 = [];
1085
+ s4 = peg$currPos;
1086
+ s5 = peg$parse_();
1087
+ s6 = peg$parseNewline();
1088
+ if (s6 !== peg$FAILED) {
1089
+ s5 = [s5, s6];
1090
+ s4 = s5;
1091
+ } else {
1092
+ peg$currPos = s4;
1093
+ s4 = peg$FAILED;
1094
+ }
1095
+ while (s4 !== peg$FAILED) {
1096
+ s3.push(s4);
1097
+ s4 = peg$currPos;
1098
+ s5 = peg$parse_();
1099
+ s6 = peg$parseNewline();
1100
+ if (s6 !== peg$FAILED) {
1101
+ s5 = [s5, s6];
1102
+ s4 = s5;
1103
+ } else {
1104
+ peg$currPos = s4;
1105
+ s4 = peg$FAILED;
1106
+ }
1107
+ }
1108
+ s4 = peg$parseModel();
1109
+ if (s4 !== peg$FAILED) {
1110
+ s2 = s4;
1111
+ } else {
1112
+ peg$currPos = s2;
1113
+ s2 = peg$FAILED;
1114
+ }
1115
+ while (s2 !== peg$FAILED) {
1116
+ s1.push(s2);
1117
+ s2 = peg$currPos;
1118
+ s3 = [];
1119
+ s4 = peg$currPos;
1120
+ s5 = peg$parse_();
1121
+ s6 = peg$parseNewline();
1122
+ if (s6 !== peg$FAILED) {
1123
+ s5 = [s5, s6];
1124
+ s4 = s5;
1125
+ } else {
1126
+ peg$currPos = s4;
1127
+ s4 = peg$FAILED;
1128
+ }
1129
+ while (s4 !== peg$FAILED) {
1130
+ s3.push(s4);
1131
+ s4 = peg$currPos;
1132
+ s5 = peg$parse_();
1133
+ s6 = peg$parseNewline();
1134
+ if (s6 !== peg$FAILED) {
1135
+ s5 = [s5, s6];
1136
+ s4 = s5;
1137
+ } else {
1138
+ peg$currPos = s4;
1139
+ s4 = peg$FAILED;
1140
+ }
1141
+ }
1142
+ s4 = peg$parseModel();
1143
+ if (s4 !== peg$FAILED) {
1144
+ s2 = s4;
1145
+ } else {
1146
+ peg$currPos = s2;
1147
+ s2 = peg$FAILED;
1148
+ }
1149
+ }
1150
+ s2 = [];
1151
+ s3 = peg$currPos;
1152
+ s4 = peg$parse_();
1153
+ s5 = peg$parseNewline();
1154
+ if (s5 !== peg$FAILED) {
1155
+ s4 = [s4, s5];
1156
+ s3 = s4;
1157
+ } else {
1158
+ peg$currPos = s3;
1159
+ s3 = peg$FAILED;
1160
+ }
1161
+ while (s3 !== peg$FAILED) {
1162
+ s2.push(s3);
1163
+ s3 = peg$currPos;
1164
+ s4 = peg$parse_();
1165
+ s5 = peg$parseNewline();
1166
+ if (s5 !== peg$FAILED) {
1167
+ s4 = [s4, s5];
1168
+ s3 = s4;
1169
+ } else {
1170
+ peg$currPos = s3;
1171
+ s3 = peg$FAILED;
1172
+ }
1173
+ }
1174
+ s3 = peg$parse_();
1175
+ peg$savedPos = s0;
1176
+ s0 = peg$f13(s1);
1177
+
1178
+ return s0;
1179
+ }
1180
+
1181
+ function peg$parseModel() {
1182
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
1183
+
1184
+ s0 = peg$currPos;
1185
+ if (input.substr(peg$currPos, 5) === peg$c6) {
1186
+ s1 = peg$c6;
1187
+ peg$currPos += 5;
1188
+ } else {
1189
+ s1 = peg$FAILED;
1190
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
1191
+ }
1192
+ if (s1 !== peg$FAILED) {
1193
+ s2 = peg$parseWhitespace();
1194
+ if (s2 !== peg$FAILED) {
1195
+ s3 = peg$parseNormalText();
1196
+ s4 = peg$parse_();
1197
+ s5 = peg$parseNewline();
1198
+ if (s5 !== peg$FAILED) {
1199
+ s6 = peg$currPos;
1200
+ s7 = [];
1201
+ s8 = peg$currPos;
1202
+ s9 = peg$parse_();
1203
+ s10 = peg$parseNewline();
1204
+ if (s10 !== peg$FAILED) {
1205
+ s9 = [s9, s10];
1206
+ s8 = s9;
1207
+ } else {
1208
+ peg$currPos = s8;
1209
+ s8 = peg$FAILED;
1210
+ }
1211
+ while (s8 !== peg$FAILED) {
1212
+ s7.push(s8);
1213
+ s8 = peg$currPos;
1214
+ s9 = peg$parse_();
1215
+ s10 = peg$parseNewline();
1216
+ if (s10 !== peg$FAILED) {
1217
+ s9 = [s9, s10];
1218
+ s8 = s9;
1219
+ } else {
1220
+ peg$currPos = s8;
1221
+ s8 = peg$FAILED;
1222
+ }
1223
+ }
1224
+ s8 = peg$parseModelId();
1225
+ if (s8 !== peg$FAILED) {
1226
+ s9 = peg$parse_();
1227
+ s10 = peg$parseNewline();
1228
+ if (s10 !== peg$FAILED) {
1229
+ s6 = s8;
1230
+ } else {
1231
+ peg$currPos = s6;
1232
+ s6 = peg$FAILED;
1233
+ }
1234
+ } else {
1235
+ peg$currPos = s6;
1236
+ s6 = peg$FAILED;
1237
+ }
1238
+ if (s6 !== peg$FAILED) {
1239
+ s7 = peg$currPos;
1240
+ s8 = [];
1241
+ s9 = peg$currPos;
1242
+ s10 = peg$parse_();
1243
+ s11 = peg$parseNewline();
1244
+ if (s11 !== peg$FAILED) {
1245
+ s10 = [s10, s11];
1246
+ s9 = s10;
1247
+ } else {
1248
+ peg$currPos = s9;
1249
+ s9 = peg$FAILED;
1250
+ }
1251
+ while (s9 !== peg$FAILED) {
1252
+ s8.push(s9);
1253
+ s9 = peg$currPos;
1254
+ s10 = peg$parse_();
1255
+ s11 = peg$parseNewline();
1256
+ if (s11 !== peg$FAILED) {
1257
+ s10 = [s10, s11];
1258
+ s9 = s10;
1259
+ } else {
1260
+ peg$currPos = s9;
1261
+ s9 = peg$FAILED;
1262
+ }
1263
+ }
1264
+ s9 = peg$parseModelCloze();
1265
+ if (s9 !== peg$FAILED) {
1266
+ s10 = peg$parse_();
1267
+ s11 = peg$parseNewline();
1268
+ if (s11 !== peg$FAILED) {
1269
+ s7 = s9;
1270
+ } else {
1271
+ peg$currPos = s7;
1272
+ s7 = peg$FAILED;
1273
+ }
1274
+ } else {
1275
+ peg$currPos = s7;
1276
+ s7 = peg$FAILED;
1277
+ }
1278
+ if (s7 === peg$FAILED) {
1279
+ s7 = null;
1280
+ }
1281
+ s8 = [];
1282
+ s9 = peg$currPos;
1283
+ s10 = [];
1284
+ s11 = peg$currPos;
1285
+ s12 = peg$parse_();
1286
+ s13 = peg$parseNewline();
1287
+ if (s13 !== peg$FAILED) {
1288
+ s12 = [s12, s13];
1289
+ s11 = s12;
1290
+ } else {
1291
+ peg$currPos = s11;
1292
+ s11 = peg$FAILED;
1293
+ }
1294
+ while (s11 !== peg$FAILED) {
1295
+ s10.push(s11);
1296
+ s11 = peg$currPos;
1297
+ s12 = peg$parse_();
1298
+ s13 = peg$parseNewline();
1299
+ if (s13 !== peg$FAILED) {
1300
+ s12 = [s12, s13];
1301
+ s11 = s12;
1302
+ } else {
1303
+ peg$currPos = s11;
1304
+ s11 = peg$FAILED;
1305
+ }
1306
+ }
1307
+ s11 = peg$parseModelField();
1308
+ if (s11 !== peg$FAILED) {
1309
+ s12 = peg$parse_();
1310
+ s13 = peg$parseNewline();
1311
+ if (s13 !== peg$FAILED) {
1312
+ s9 = s11;
1313
+ } else {
1314
+ peg$currPos = s9;
1315
+ s9 = peg$FAILED;
1316
+ }
1317
+ } else {
1318
+ peg$currPos = s9;
1319
+ s9 = peg$FAILED;
1320
+ }
1321
+ while (s9 !== peg$FAILED) {
1322
+ s8.push(s9);
1323
+ s9 = peg$currPos;
1324
+ s10 = [];
1325
+ s11 = peg$currPos;
1326
+ s12 = peg$parse_();
1327
+ s13 = peg$parseNewline();
1328
+ if (s13 !== peg$FAILED) {
1329
+ s12 = [s12, s13];
1330
+ s11 = s12;
1331
+ } else {
1332
+ peg$currPos = s11;
1333
+ s11 = peg$FAILED;
1334
+ }
1335
+ while (s11 !== peg$FAILED) {
1336
+ s10.push(s11);
1337
+ s11 = peg$currPos;
1338
+ s12 = peg$parse_();
1339
+ s13 = peg$parseNewline();
1340
+ if (s13 !== peg$FAILED) {
1341
+ s12 = [s12, s13];
1342
+ s11 = s12;
1343
+ } else {
1344
+ peg$currPos = s11;
1345
+ s11 = peg$FAILED;
1346
+ }
1347
+ }
1348
+ s11 = peg$parseModelField();
1349
+ if (s11 !== peg$FAILED) {
1350
+ s12 = peg$parse_();
1351
+ s13 = peg$parseNewline();
1352
+ if (s13 !== peg$FAILED) {
1353
+ s9 = s11;
1354
+ } else {
1355
+ peg$currPos = s9;
1356
+ s9 = peg$FAILED;
1357
+ }
1358
+ } else {
1359
+ peg$currPos = s9;
1360
+ s9 = peg$FAILED;
1361
+ }
1362
+ }
1363
+ s9 = [];
1364
+ s10 = peg$currPos;
1365
+ s11 = [];
1366
+ s12 = peg$currPos;
1367
+ s13 = peg$parse_();
1368
+ s14 = peg$parseNewline();
1369
+ if (s14 !== peg$FAILED) {
1370
+ s13 = [s13, s14];
1371
+ s12 = s13;
1372
+ } else {
1373
+ peg$currPos = s12;
1374
+ s12 = peg$FAILED;
1375
+ }
1376
+ while (s12 !== peg$FAILED) {
1377
+ s11.push(s12);
1378
+ s12 = peg$currPos;
1379
+ s13 = peg$parse_();
1380
+ s14 = peg$parseNewline();
1381
+ if (s14 !== peg$FAILED) {
1382
+ s13 = [s13, s14];
1383
+ s12 = s13;
1384
+ } else {
1385
+ peg$currPos = s12;
1386
+ s12 = peg$FAILED;
1387
+ }
1388
+ }
1389
+ s12 = peg$parseModelCard();
1390
+ if (s12 !== peg$FAILED) {
1391
+ s10 = s12;
1392
+ } else {
1393
+ peg$currPos = s10;
1394
+ s10 = peg$FAILED;
1395
+ }
1396
+ while (s10 !== peg$FAILED) {
1397
+ s9.push(s10);
1398
+ s10 = peg$currPos;
1399
+ s11 = [];
1400
+ s12 = peg$currPos;
1401
+ s13 = peg$parse_();
1402
+ s14 = peg$parseNewline();
1403
+ if (s14 !== peg$FAILED) {
1404
+ s13 = [s13, s14];
1405
+ s12 = s13;
1406
+ } else {
1407
+ peg$currPos = s12;
1408
+ s12 = peg$FAILED;
1409
+ }
1410
+ while (s12 !== peg$FAILED) {
1411
+ s11.push(s12);
1412
+ s12 = peg$currPos;
1413
+ s13 = peg$parse_();
1414
+ s14 = peg$parseNewline();
1415
+ if (s14 !== peg$FAILED) {
1416
+ s13 = [s13, s14];
1417
+ s12 = s13;
1418
+ } else {
1419
+ peg$currPos = s12;
1420
+ s12 = peg$FAILED;
1421
+ }
1422
+ }
1423
+ s12 = peg$parseModelCard();
1424
+ if (s12 !== peg$FAILED) {
1425
+ s10 = s12;
1426
+ } else {
1427
+ peg$currPos = s10;
1428
+ s10 = peg$FAILED;
1429
+ }
1430
+ }
1431
+ s10 = peg$currPos;
1432
+ s11 = [];
1433
+ s12 = peg$currPos;
1434
+ s13 = peg$parse_();
1435
+ s14 = peg$parseNewline();
1436
+ if (s14 !== peg$FAILED) {
1437
+ s13 = [s13, s14];
1438
+ s12 = s13;
1439
+ } else {
1440
+ peg$currPos = s12;
1441
+ s12 = peg$FAILED;
1442
+ }
1443
+ while (s12 !== peg$FAILED) {
1444
+ s11.push(s12);
1445
+ s12 = peg$currPos;
1446
+ s13 = peg$parse_();
1447
+ s14 = peg$parseNewline();
1448
+ if (s14 !== peg$FAILED) {
1449
+ s13 = [s13, s14];
1450
+ s12 = s13;
1451
+ } else {
1452
+ peg$currPos = s12;
1453
+ s12 = peg$FAILED;
1454
+ }
1455
+ }
1456
+ s12 = peg$parseModelStyling();
1457
+ if (s12 !== peg$FAILED) {
1458
+ s13 = peg$parse_();
1459
+ s14 = peg$parseNewline();
1460
+ if (s14 !== peg$FAILED) {
1461
+ s10 = s12;
1462
+ } else {
1463
+ peg$currPos = s10;
1464
+ s10 = peg$FAILED;
1465
+ }
1466
+ } else {
1467
+ peg$currPos = s10;
1468
+ s10 = peg$FAILED;
1469
+ }
1470
+ if (s10 === peg$FAILED) {
1471
+ s10 = null;
1472
+ }
1473
+ peg$savedPos = s0;
1474
+ s0 = peg$f14(s3, s6, s7, s8, s9, s10);
1475
+ } else {
1476
+ peg$currPos = s0;
1477
+ s0 = peg$FAILED;
1478
+ }
1479
+ } else {
1480
+ peg$currPos = s0;
1481
+ s0 = peg$FAILED;
1482
+ }
1483
+ } else {
1484
+ peg$currPos = s0;
1485
+ s0 = peg$FAILED;
1486
+ }
1487
+ } else {
1488
+ peg$currPos = s0;
1489
+ s0 = peg$FAILED;
1490
+ }
1491
+
1492
+ return s0;
1493
+ }
1494
+
1495
+ function peg$parseModelId() {
1496
+ let s0, s1, s2, s3, s4, s5, s6;
1497
+
1498
+ s0 = peg$currPos;
1499
+ if (input.substr(peg$currPos, 2) === peg$c7) {
1500
+ s1 = peg$c7;
1501
+ peg$currPos += 2;
1502
+ } else {
1503
+ s1 = peg$FAILED;
1504
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1505
+ }
1506
+ if (s1 !== peg$FAILED) {
1507
+ s2 = peg$parseWhitespace();
1508
+ if (s2 !== peg$FAILED) {
1509
+ s3 = peg$currPos;
1510
+ s4 = peg$currPos;
1511
+ s5 = [];
1512
+ s6 = input.charAt(peg$currPos);
1513
+ if (peg$r0.test(s6)) {
1514
+ peg$currPos++;
1515
+ } else {
1516
+ s6 = peg$FAILED;
1517
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1518
+ }
1519
+ if (s6 !== peg$FAILED) {
1520
+ while (s6 !== peg$FAILED) {
1521
+ s5.push(s6);
1522
+ s6 = input.charAt(peg$currPos);
1523
+ if (peg$r0.test(s6)) {
1524
+ peg$currPos++;
1525
+ } else {
1526
+ s6 = peg$FAILED;
1527
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1528
+ }
1529
+ }
1530
+ } else {
1531
+ s5 = peg$FAILED;
1532
+ }
1533
+ if (s5 !== peg$FAILED) {
1534
+ s4 = input.substring(s4, peg$currPos);
1535
+ } else {
1536
+ s4 = s5;
1537
+ }
1538
+ if (s4 !== peg$FAILED) {
1539
+ peg$savedPos = s3;
1540
+ s4 = peg$f15(s4);
1541
+ }
1542
+ s3 = s4;
1543
+ if (s3 !== peg$FAILED) {
1544
+ peg$savedPos = s0;
1545
+ s0 = peg$f16(s3);
1546
+ } else {
1547
+ peg$currPos = s0;
1548
+ s0 = peg$FAILED;
1549
+ }
1550
+ } else {
1551
+ peg$currPos = s0;
1552
+ s0 = peg$FAILED;
1553
+ }
1554
+ } else {
1555
+ peg$currPos = s0;
1556
+ s0 = peg$FAILED;
1557
+ }
1558
+
1559
+ return s0;
1560
+ }
1561
+
1562
+ function peg$parseModelCloze() {
1563
+ let s0, s1;
1564
+
1565
+ s0 = peg$currPos;
1566
+ if (input.substr(peg$currPos, 5) === peg$c8) {
1567
+ s1 = peg$c8;
1568
+ peg$currPos += 5;
1569
+ } else {
1570
+ s1 = peg$FAILED;
1571
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1572
+ }
1573
+ if (s1 !== peg$FAILED) {
1574
+ peg$savedPos = s0;
1575
+ s1 = peg$f17(s1);
1576
+ }
1577
+ s0 = s1;
1578
+
1579
+ return s0;
1580
+ }
1581
+
1582
+ function peg$parseModelField() {
1583
+ let s0, s1, s2, s3, s4, s5;
1584
+
1585
+ s0 = peg$currPos;
1586
+ if (input.substr(peg$currPos, 5) === peg$c9) {
1587
+ s1 = peg$c9;
1588
+ peg$currPos += 5;
1589
+ } else {
1590
+ s1 = peg$FAILED;
1591
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1592
+ }
1593
+ if (s1 !== peg$FAILED) {
1594
+ s2 = peg$parseWhitespace();
1595
+ if (s2 !== peg$FAILED) {
1596
+ s3 = peg$parseModelFieldName();
1597
+ if (s3 !== peg$FAILED) {
1598
+ s4 = peg$parse_();
1599
+ if (input.charCodeAt(peg$currPos) === 63) {
1600
+ s5 = peg$c10;
1601
+ peg$currPos++;
1602
+ } else {
1603
+ s5 = peg$FAILED;
1604
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1605
+ }
1606
+ if (s5 === peg$FAILED) {
1607
+ s5 = null;
1608
+ }
1609
+ peg$savedPos = s0;
1610
+ s0 = peg$f18(s3, s5);
1611
+ } else {
1612
+ peg$currPos = s0;
1613
+ s0 = peg$FAILED;
1614
+ }
1615
+ } else {
1616
+ peg$currPos = s0;
1617
+ s0 = peg$FAILED;
1618
+ }
1619
+ } else {
1620
+ peg$currPos = s0;
1621
+ s0 = peg$FAILED;
1622
+ }
1623
+
1624
+ return s0;
1625
+ }
1626
+
1627
+ function peg$parseModelFieldName() {
1628
+ let s0, s1;
1629
+
1630
+ s0 = peg$currPos;
1631
+ s1 = peg$parseFieldNameText();
1632
+ if (s1 !== peg$FAILED) {
1633
+ peg$savedPos = s0;
1634
+ s1 = peg$f19(s1);
1635
+ }
1636
+ s0 = s1;
1637
+
1638
+ return s0;
1639
+ }
1640
+
1641
+ function peg$parseModelCard() {
1642
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
1643
+
1644
+ s0 = peg$currPos;
1645
+ if (input.substr(peg$currPos, 4) === peg$c11) {
1646
+ s1 = peg$c11;
1647
+ peg$currPos += 4;
1648
+ } else {
1649
+ s1 = peg$FAILED;
1650
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1651
+ }
1652
+ if (s1 !== peg$FAILED) {
1653
+ s2 = peg$parseWhitespace();
1654
+ if (s2 !== peg$FAILED) {
1655
+ s3 = peg$parseNormalText();
1656
+ s4 = peg$parse_();
1657
+ s5 = peg$parseNewline();
1658
+ if (s5 !== peg$FAILED) {
1659
+ s6 = peg$currPos;
1660
+ s7 = [];
1661
+ s8 = peg$currPos;
1662
+ s9 = peg$parse_();
1663
+ s10 = peg$parseNewline();
1664
+ if (s10 !== peg$FAILED) {
1665
+ s9 = [s9, s10];
1666
+ s8 = s9;
1667
+ } else {
1668
+ peg$currPos = s8;
1669
+ s8 = peg$FAILED;
1670
+ }
1671
+ while (s8 !== peg$FAILED) {
1672
+ s7.push(s8);
1673
+ s8 = peg$currPos;
1674
+ s9 = peg$parse_();
1675
+ s10 = peg$parseNewline();
1676
+ if (s10 !== peg$FAILED) {
1677
+ s9 = [s9, s10];
1678
+ s8 = s9;
1679
+ } else {
1680
+ peg$currPos = s8;
1681
+ s8 = peg$FAILED;
1682
+ }
1683
+ }
1684
+ s8 = peg$parseModelCardFront();
1685
+ if (s8 !== peg$FAILED) {
1686
+ s9 = peg$parse_();
1687
+ s10 = peg$parseNewline();
1688
+ if (s10 !== peg$FAILED) {
1689
+ s6 = s8;
1690
+ } else {
1691
+ peg$currPos = s6;
1692
+ s6 = peg$FAILED;
1693
+ }
1694
+ } else {
1695
+ peg$currPos = s6;
1696
+ s6 = peg$FAILED;
1697
+ }
1698
+ if (s6 !== peg$FAILED) {
1699
+ s7 = peg$currPos;
1700
+ s8 = [];
1701
+ s9 = peg$currPos;
1702
+ s10 = peg$parse_();
1703
+ s11 = peg$parseNewline();
1704
+ if (s11 !== peg$FAILED) {
1705
+ s10 = [s10, s11];
1706
+ s9 = s10;
1707
+ } else {
1708
+ peg$currPos = s9;
1709
+ s9 = peg$FAILED;
1710
+ }
1711
+ while (s9 !== peg$FAILED) {
1712
+ s8.push(s9);
1713
+ s9 = peg$currPos;
1714
+ s10 = peg$parse_();
1715
+ s11 = peg$parseNewline();
1716
+ if (s11 !== peg$FAILED) {
1717
+ s10 = [s10, s11];
1718
+ s9 = s10;
1719
+ } else {
1720
+ peg$currPos = s9;
1721
+ s9 = peg$FAILED;
1722
+ }
1723
+ }
1724
+ s9 = peg$parseModelCardBack();
1725
+ if (s9 !== peg$FAILED) {
1726
+ s10 = peg$parse_();
1727
+ s11 = peg$parseNewline();
1728
+ if (s11 !== peg$FAILED) {
1729
+ s7 = s9;
1730
+ } else {
1731
+ peg$currPos = s7;
1732
+ s7 = peg$FAILED;
1733
+ }
1734
+ } else {
1735
+ peg$currPos = s7;
1736
+ s7 = peg$FAILED;
1737
+ }
1738
+ if (s7 !== peg$FAILED) {
1739
+ peg$savedPos = s0;
1740
+ s0 = peg$f20(s3, s6, s7);
1741
+ } else {
1742
+ peg$currPos = s0;
1743
+ s0 = peg$FAILED;
1744
+ }
1745
+ } else {
1746
+ peg$currPos = s0;
1747
+ s0 = peg$FAILED;
1748
+ }
1749
+ } else {
1750
+ peg$currPos = s0;
1751
+ s0 = peg$FAILED;
1752
+ }
1753
+ } else {
1754
+ peg$currPos = s0;
1755
+ s0 = peg$FAILED;
1756
+ }
1757
+ } else {
1758
+ peg$currPos = s0;
1759
+ s0 = peg$FAILED;
1760
+ }
1761
+
1762
+ return s0;
1763
+ }
1764
+
1765
+ function peg$parseModelCardFront() {
1766
+ let s0, s1, s2, s3, s4;
1767
+
1768
+ s0 = peg$currPos;
1769
+ if (input.substr(peg$currPos, 5) === peg$c12) {
1770
+ s1 = peg$c12;
1771
+ peg$currPos += 5;
1772
+ } else {
1773
+ s1 = peg$FAILED;
1774
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1775
+ }
1776
+ if (s1 !== peg$FAILED) {
1777
+ s2 = peg$parse_();
1778
+ s3 = peg$parseNewline();
1779
+ if (s3 !== peg$FAILED) {
1780
+ s4 = peg$parseMultilineText();
1781
+ if (s4 !== peg$FAILED) {
1782
+ peg$savedPos = s0;
1783
+ s0 = peg$f21(s4);
1784
+ } else {
1785
+ peg$currPos = s0;
1786
+ s0 = peg$FAILED;
1787
+ }
1788
+ } else {
1789
+ peg$currPos = s0;
1790
+ s0 = peg$FAILED;
1791
+ }
1792
+ } else {
1793
+ peg$currPos = s0;
1794
+ s0 = peg$FAILED;
1795
+ }
1796
+
1797
+ return s0;
1798
+ }
1799
+
1800
+ function peg$parseModelCardBack() {
1801
+ let s0, s1, s2, s3, s4;
1802
+
1803
+ s0 = peg$currPos;
1804
+ if (input.substr(peg$currPos, 4) === peg$c13) {
1805
+ s1 = peg$c13;
1806
+ peg$currPos += 4;
1807
+ } else {
1808
+ s1 = peg$FAILED;
1809
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1810
+ }
1811
+ if (s1 !== peg$FAILED) {
1812
+ s2 = peg$parse_();
1813
+ s3 = peg$parseNewline();
1814
+ if (s3 !== peg$FAILED) {
1815
+ s4 = peg$parseMultilineText();
1816
+ if (s4 !== peg$FAILED) {
1817
+ peg$savedPos = s0;
1818
+ s0 = peg$f22(s4);
1819
+ } else {
1820
+ peg$currPos = s0;
1821
+ s0 = peg$FAILED;
1822
+ }
1823
+ } else {
1824
+ peg$currPos = s0;
1825
+ s0 = peg$FAILED;
1826
+ }
1827
+ } else {
1828
+ peg$currPos = s0;
1829
+ s0 = peg$FAILED;
1830
+ }
1831
+
1832
+ return s0;
1833
+ }
1834
+
1835
+ function peg$parseModelStyling() {
1836
+ let s0, s1, s2, s3, s4;
1837
+
1838
+ s0 = peg$currPos;
1839
+ if (input.substr(peg$currPos, 7) === peg$c14) {
1840
+ s1 = peg$c14;
1841
+ peg$currPos += 7;
1842
+ } else {
1843
+ s1 = peg$FAILED;
1844
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1845
+ }
1846
+ if (s1 !== peg$FAILED) {
1847
+ s2 = peg$parse_();
1848
+ s3 = peg$parseNewline();
1849
+ if (s3 !== peg$FAILED) {
1850
+ s4 = peg$parseMultilineText();
1851
+ if (s4 !== peg$FAILED) {
1852
+ peg$savedPos = s0;
1853
+ s0 = peg$f23(s4);
1854
+ } else {
1855
+ peg$currPos = s0;
1856
+ s0 = peg$FAILED;
1857
+ }
1858
+ } else {
1859
+ peg$currPos = s0;
1860
+ s0 = peg$FAILED;
1861
+ }
1862
+ } else {
1863
+ peg$currPos = s0;
1864
+ s0 = peg$FAILED;
1865
+ }
1866
+
1867
+ return s0;
1868
+ }
1869
+
1870
+ function peg$parseMultilineText() {
1871
+ let s0, s1, s2, s3, s4, s5, s6;
1872
+
1873
+ s0 = peg$currPos;
1874
+ s1 = [];
1875
+ s2 = peg$currPos;
1876
+ s3 = peg$currPos;
1877
+ peg$silentFails++;
1878
+ if (input.substr(peg$currPos, 3) === peg$c5) {
1879
+ s4 = peg$c5;
1880
+ peg$currPos += 3;
1881
+ } else {
1882
+ s4 = peg$FAILED;
1883
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
1884
+ }
1885
+ peg$silentFails--;
1886
+ if (s4 === peg$FAILED) {
1887
+ s3 = undefined;
1888
+ } else {
1889
+ peg$currPos = s3;
1890
+ s3 = peg$FAILED;
1891
+ }
1892
+ if (s3 !== peg$FAILED) {
1893
+ s4 = peg$parseText();
1894
+ s5 = peg$parse_();
1895
+ s6 = peg$parseNewline();
1896
+ if (s6 !== peg$FAILED) {
1897
+ s2 = s4;
1898
+ } else {
1899
+ peg$currPos = s2;
1900
+ s2 = peg$FAILED;
1901
+ }
1902
+ } else {
1903
+ peg$currPos = s2;
1904
+ s2 = peg$FAILED;
1905
+ }
1906
+ while (s2 !== peg$FAILED) {
1907
+ s1.push(s2);
1908
+ s2 = peg$currPos;
1909
+ s3 = peg$currPos;
1910
+ peg$silentFails++;
1911
+ if (input.substr(peg$currPos, 3) === peg$c5) {
1912
+ s4 = peg$c5;
1913
+ peg$currPos += 3;
1914
+ } else {
1915
+ s4 = peg$FAILED;
1916
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
1917
+ }
1918
+ peg$silentFails--;
1919
+ if (s4 === peg$FAILED) {
1920
+ s3 = undefined;
1921
+ } else {
1922
+ peg$currPos = s3;
1923
+ s3 = peg$FAILED;
1924
+ }
1925
+ if (s3 !== peg$FAILED) {
1926
+ s4 = peg$parseText();
1927
+ s5 = peg$parse_();
1928
+ s6 = peg$parseNewline();
1929
+ if (s6 !== peg$FAILED) {
1930
+ s2 = s4;
1931
+ } else {
1932
+ peg$currPos = s2;
1933
+ s2 = peg$FAILED;
1934
+ }
1935
+ } else {
1936
+ peg$currPos = s2;
1937
+ s2 = peg$FAILED;
1938
+ }
1939
+ }
1940
+ if (input.substr(peg$currPos, 3) === peg$c5) {
1941
+ s2 = peg$c5;
1942
+ peg$currPos += 3;
1943
+ } else {
1944
+ s2 = peg$FAILED;
1945
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
1946
+ }
1947
+ if (s2 !== peg$FAILED) {
1948
+ peg$savedPos = s0;
1949
+ s0 = peg$f24(s1);
1950
+ } else {
1951
+ peg$currPos = s0;
1952
+ s0 = peg$FAILED;
1953
+ }
1954
+
1955
+ return s0;
1956
+ }
1957
+
1958
+ function peg$parseTemplate() {
1959
+ let s0, s1;
1960
+
1961
+ s0 = [];
1962
+ s1 = peg$parseTemplateText();
1963
+ if (s1 === peg$FAILED) {
1964
+ s1 = peg$parseTemplateBranch();
1965
+ if (s1 === peg$FAILED) {
1966
+ s1 = peg$parseTemplateField();
1967
+ }
1968
+ }
1969
+ while (s1 !== peg$FAILED) {
1970
+ s0.push(s1);
1971
+ s1 = peg$parseTemplateText();
1972
+ if (s1 === peg$FAILED) {
1973
+ s1 = peg$parseTemplateBranch();
1974
+ if (s1 === peg$FAILED) {
1975
+ s1 = peg$parseTemplateField();
1976
+ }
1977
+ }
1978
+ }
1979
+
1980
+ return s0;
1981
+ }
1982
+
1983
+ function peg$parseTemplateText() {
1984
+ let s0, s1, s2, s3, s4, s5;
1985
+
1986
+ s0 = peg$currPos;
1987
+ s1 = peg$currPos;
1988
+ s2 = [];
1989
+ s3 = peg$currPos;
1990
+ s4 = peg$currPos;
1991
+ peg$silentFails++;
1992
+ if (input.substr(peg$currPos, 2) === peg$c15) {
1993
+ s5 = peg$c15;
1994
+ peg$currPos += 2;
1995
+ } else {
1996
+ s5 = peg$FAILED;
1997
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
1998
+ }
1999
+ peg$silentFails--;
2000
+ if (s5 === peg$FAILED) {
2001
+ s4 = undefined;
2002
+ } else {
2003
+ peg$currPos = s4;
2004
+ s4 = peg$FAILED;
2005
+ }
2006
+ if (s4 !== peg$FAILED) {
2007
+ if (input.length > peg$currPos) {
2008
+ s5 = input.charAt(peg$currPos);
2009
+ peg$currPos++;
2010
+ } else {
2011
+ s5 = peg$FAILED;
2012
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
2013
+ }
2014
+ if (s5 !== peg$FAILED) {
2015
+ s4 = [s4, s5];
2016
+ s3 = s4;
2017
+ } else {
2018
+ peg$currPos = s3;
2019
+ s3 = peg$FAILED;
2020
+ }
2021
+ } else {
2022
+ peg$currPos = s3;
2023
+ s3 = peg$FAILED;
2024
+ }
2025
+ if (s3 !== peg$FAILED) {
2026
+ while (s3 !== peg$FAILED) {
2027
+ s2.push(s3);
2028
+ s3 = peg$currPos;
2029
+ s4 = peg$currPos;
2030
+ peg$silentFails++;
2031
+ if (input.substr(peg$currPos, 2) === peg$c15) {
2032
+ s5 = peg$c15;
2033
+ peg$currPos += 2;
2034
+ } else {
2035
+ s5 = peg$FAILED;
2036
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
2037
+ }
2038
+ peg$silentFails--;
2039
+ if (s5 === peg$FAILED) {
2040
+ s4 = undefined;
2041
+ } else {
2042
+ peg$currPos = s4;
2043
+ s4 = peg$FAILED;
2044
+ }
2045
+ if (s4 !== peg$FAILED) {
2046
+ if (input.length > peg$currPos) {
2047
+ s5 = input.charAt(peg$currPos);
2048
+ peg$currPos++;
2049
+ } else {
2050
+ s5 = peg$FAILED;
2051
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
2052
+ }
2053
+ if (s5 !== peg$FAILED) {
2054
+ s4 = [s4, s5];
2055
+ s3 = s4;
2056
+ } else {
2057
+ peg$currPos = s3;
2058
+ s3 = peg$FAILED;
2059
+ }
2060
+ } else {
2061
+ peg$currPos = s3;
2062
+ s3 = peg$FAILED;
2063
+ }
2064
+ }
2065
+ } else {
2066
+ s2 = peg$FAILED;
2067
+ }
2068
+ if (s2 !== peg$FAILED) {
2069
+ s1 = input.substring(s1, peg$currPos);
2070
+ } else {
2071
+ s1 = s2;
2072
+ }
2073
+ if (s1 !== peg$FAILED) {
2074
+ peg$savedPos = s0;
2075
+ s1 = peg$f25(s1);
2076
+ }
2077
+ s0 = s1;
2078
+
2079
+ return s0;
2080
+ }
2081
+
2082
+ function peg$parseTemplateBranch() {
2083
+ let s0, s1, s2, s3;
2084
+
2085
+ s0 = peg$currPos;
2086
+ s1 = peg$parseIfField();
2087
+ if (s1 === peg$FAILED) {
2088
+ s1 = peg$parseIfNotField();
2089
+ }
2090
+ if (s1 !== peg$FAILED) {
2091
+ s2 = peg$parseTemplate();
2092
+ if (s2 !== peg$FAILED) {
2093
+ s3 = peg$parseEndIfField();
2094
+ if (s3 !== peg$FAILED) {
2095
+ peg$savedPos = s0;
2096
+ s0 = peg$f26(s1, s2, s3);
2097
+ } else {
2098
+ peg$currPos = s0;
2099
+ s0 = peg$FAILED;
2100
+ }
2101
+ } else {
2102
+ peg$currPos = s0;
2103
+ s0 = peg$FAILED;
2104
+ }
2105
+ } else {
2106
+ peg$currPos = s0;
2107
+ s0 = peg$FAILED;
2108
+ }
2109
+
2110
+ return s0;
2111
+ }
2112
+
2113
+ function peg$parseTemplateField() {
2114
+ let s0, s1, s2, s3, s4, s5, s6;
2115
+
2116
+ s0 = peg$currPos;
2117
+ if (input.substr(peg$currPos, 2) === peg$c15) {
2118
+ s1 = peg$c15;
2119
+ peg$currPos += 2;
2120
+ } else {
2121
+ s1 = peg$FAILED;
2122
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
2123
+ }
2124
+ if (s1 !== peg$FAILED) {
2125
+ s2 = peg$parse_();
2126
+ s3 = peg$currPos;
2127
+ peg$silentFails++;
2128
+ s4 = input.charAt(peg$currPos);
2129
+ if (peg$r1.test(s4)) {
2130
+ peg$currPos++;
2131
+ } else {
2132
+ s4 = peg$FAILED;
2133
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
2134
+ }
2135
+ peg$silentFails--;
2136
+ if (s4 === peg$FAILED) {
2137
+ s3 = undefined;
2138
+ } else {
2139
+ peg$currPos = s3;
2140
+ s3 = peg$FAILED;
2141
+ }
2142
+ if (s3 !== peg$FAILED) {
2143
+ s4 = peg$parseTemplateFieldName();
2144
+ if (s4 !== peg$FAILED) {
2145
+ s5 = peg$parse_();
2146
+ if (input.substr(peg$currPos, 2) === peg$c16) {
2147
+ s6 = peg$c16;
2148
+ peg$currPos += 2;
2149
+ } else {
2150
+ s6 = peg$FAILED;
2151
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2152
+ }
2153
+ if (s6 !== peg$FAILED) {
2154
+ peg$savedPos = s0;
2155
+ s0 = peg$f27(s4);
2156
+ } else {
2157
+ peg$currPos = s0;
2158
+ s0 = peg$FAILED;
2159
+ }
2160
+ } else {
2161
+ peg$currPos = s0;
2162
+ s0 = peg$FAILED;
2163
+ }
2164
+ } else {
2165
+ peg$currPos = s0;
2166
+ s0 = peg$FAILED;
2167
+ }
2168
+ } else {
2169
+ peg$currPos = s0;
2170
+ s0 = peg$FAILED;
2171
+ }
2172
+
2173
+ return s0;
2174
+ }
2175
+
2176
+ function peg$parseIfField() {
2177
+ let s0, s1, s2, s3, s4, s5, s6, s7;
2178
+
2179
+ s0 = peg$currPos;
2180
+ if (input.substr(peg$currPos, 2) === peg$c15) {
2181
+ s1 = peg$c15;
2182
+ peg$currPos += 2;
2183
+ } else {
2184
+ s1 = peg$FAILED;
2185
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
2186
+ }
2187
+ if (s1 !== peg$FAILED) {
2188
+ s2 = peg$parse_();
2189
+ if (input.charCodeAt(peg$currPos) === 35) {
2190
+ s3 = peg$c17;
2191
+ peg$currPos++;
2192
+ } else {
2193
+ s3 = peg$FAILED;
2194
+ if (peg$silentFails === 0) { peg$fail(peg$e22); }
2195
+ }
2196
+ if (s3 !== peg$FAILED) {
2197
+ s4 = peg$parse_();
2198
+ s5 = peg$parseTemplateFieldName();
2199
+ if (s5 !== peg$FAILED) {
2200
+ s6 = peg$parse_();
2201
+ if (input.substr(peg$currPos, 2) === peg$c16) {
2202
+ s7 = peg$c16;
2203
+ peg$currPos += 2;
2204
+ } else {
2205
+ s7 = peg$FAILED;
2206
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2207
+ }
2208
+ if (s7 !== peg$FAILED) {
2209
+ peg$savedPos = s0;
2210
+ s0 = peg$f28(s5);
2211
+ } else {
2212
+ peg$currPos = s0;
2213
+ s0 = peg$FAILED;
2214
+ }
2215
+ } else {
2216
+ peg$currPos = s0;
2217
+ s0 = peg$FAILED;
2218
+ }
2219
+ } else {
2220
+ peg$currPos = s0;
2221
+ s0 = peg$FAILED;
2222
+ }
2223
+ } else {
2224
+ peg$currPos = s0;
2225
+ s0 = peg$FAILED;
2226
+ }
2227
+
2228
+ return s0;
2229
+ }
2230
+
2231
+ function peg$parseIfNotField() {
2232
+ let s0, s1, s2, s3, s4, s5, s6, s7;
2233
+
2234
+ s0 = peg$currPos;
2235
+ if (input.substr(peg$currPos, 2) === peg$c15) {
2236
+ s1 = peg$c15;
2237
+ peg$currPos += 2;
2238
+ } else {
2239
+ s1 = peg$FAILED;
2240
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
2241
+ }
2242
+ if (s1 !== peg$FAILED) {
2243
+ s2 = peg$parse_();
2244
+ if (input.charCodeAt(peg$currPos) === 94) {
2245
+ s3 = peg$c18;
2246
+ peg$currPos++;
2247
+ } else {
2248
+ s3 = peg$FAILED;
2249
+ if (peg$silentFails === 0) { peg$fail(peg$e23); }
2250
+ }
2251
+ if (s3 !== peg$FAILED) {
2252
+ s4 = peg$parse_();
2253
+ s5 = peg$parseTemplateFieldName();
2254
+ if (s5 !== peg$FAILED) {
2255
+ s6 = peg$parse_();
2256
+ if (input.substr(peg$currPos, 2) === peg$c16) {
2257
+ s7 = peg$c16;
2258
+ peg$currPos += 2;
2259
+ } else {
2260
+ s7 = peg$FAILED;
2261
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2262
+ }
2263
+ if (s7 !== peg$FAILED) {
2264
+ peg$savedPos = s0;
2265
+ s0 = peg$f29(s5);
2266
+ } else {
2267
+ peg$currPos = s0;
2268
+ s0 = peg$FAILED;
2269
+ }
2270
+ } else {
2271
+ peg$currPos = s0;
2272
+ s0 = peg$FAILED;
2273
+ }
2274
+ } else {
2275
+ peg$currPos = s0;
2276
+ s0 = peg$FAILED;
2277
+ }
2278
+ } else {
2279
+ peg$currPos = s0;
2280
+ s0 = peg$FAILED;
2281
+ }
2282
+
2283
+ return s0;
2284
+ }
2285
+
2286
+ function peg$parseEndIfField() {
2287
+ let s0, s1, s2, s3, s4, s5, s6, s7;
2288
+
2289
+ s0 = peg$currPos;
2290
+ if (input.substr(peg$currPos, 2) === peg$c15) {
2291
+ s1 = peg$c15;
2292
+ peg$currPos += 2;
2293
+ } else {
2294
+ s1 = peg$FAILED;
2295
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
2296
+ }
2297
+ if (s1 !== peg$FAILED) {
2298
+ s2 = peg$parse_();
2299
+ if (input.charCodeAt(peg$currPos) === 47) {
2300
+ s3 = peg$c19;
2301
+ peg$currPos++;
2302
+ } else {
2303
+ s3 = peg$FAILED;
2304
+ if (peg$silentFails === 0) { peg$fail(peg$e24); }
2305
+ }
2306
+ if (s3 !== peg$FAILED) {
2307
+ s4 = peg$parse_();
2308
+ s5 = peg$parseTemplateFieldName();
2309
+ if (s5 !== peg$FAILED) {
2310
+ s6 = peg$parse_();
2311
+ if (input.substr(peg$currPos, 2) === peg$c16) {
2312
+ s7 = peg$c16;
2313
+ peg$currPos += 2;
2314
+ } else {
2315
+ s7 = peg$FAILED;
2316
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2317
+ }
2318
+ if (s7 !== peg$FAILED) {
2319
+ peg$savedPos = s0;
2320
+ s0 = peg$f30(s5);
2321
+ } else {
2322
+ peg$currPos = s0;
2323
+ s0 = peg$FAILED;
2324
+ }
2325
+ } else {
2326
+ peg$currPos = s0;
2327
+ s0 = peg$FAILED;
2328
+ }
2329
+ } else {
2330
+ peg$currPos = s0;
2331
+ s0 = peg$FAILED;
2332
+ }
2333
+ } else {
2334
+ peg$currPos = s0;
2335
+ s0 = peg$FAILED;
2336
+ }
2337
+
2338
+ return s0;
2339
+ }
2340
+
2341
+ function peg$parseTemplateFieldName() {
2342
+ let s0, s1, s2, s3, s4, s5, s6, s7;
2343
+
2344
+ s0 = peg$currPos;
2345
+ s1 = peg$currPos;
2346
+ s2 = [];
2347
+ s3 = peg$currPos;
2348
+ s4 = peg$currPos;
2349
+ peg$silentFails++;
2350
+ s5 = peg$currPos;
2351
+ s6 = peg$parse_();
2352
+ if (input.substr(peg$currPos, 2) === peg$c16) {
2353
+ s7 = peg$c16;
2354
+ peg$currPos += 2;
2355
+ } else {
2356
+ s7 = peg$FAILED;
2357
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2358
+ }
2359
+ if (s7 !== peg$FAILED) {
2360
+ s6 = [s6, s7];
2361
+ s5 = s6;
2362
+ } else {
2363
+ peg$currPos = s5;
2364
+ s5 = peg$FAILED;
2365
+ }
2366
+ peg$silentFails--;
2367
+ if (s5 === peg$FAILED) {
2368
+ s4 = undefined;
2369
+ } else {
2370
+ peg$currPos = s4;
2371
+ s4 = peg$FAILED;
2372
+ }
2373
+ if (s4 !== peg$FAILED) {
2374
+ if (input.length > peg$currPos) {
2375
+ s5 = input.charAt(peg$currPos);
2376
+ peg$currPos++;
2377
+ } else {
2378
+ s5 = peg$FAILED;
2379
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
2380
+ }
2381
+ if (s5 !== peg$FAILED) {
2382
+ s4 = [s4, s5];
2383
+ s3 = s4;
2384
+ } else {
2385
+ peg$currPos = s3;
2386
+ s3 = peg$FAILED;
2387
+ }
2388
+ } else {
2389
+ peg$currPos = s3;
2390
+ s3 = peg$FAILED;
2391
+ }
2392
+ if (s3 !== peg$FAILED) {
2393
+ while (s3 !== peg$FAILED) {
2394
+ s2.push(s3);
2395
+ s3 = peg$currPos;
2396
+ s4 = peg$currPos;
2397
+ peg$silentFails++;
2398
+ s5 = peg$currPos;
2399
+ s6 = peg$parse_();
2400
+ if (input.substr(peg$currPos, 2) === peg$c16) {
2401
+ s7 = peg$c16;
2402
+ peg$currPos += 2;
2403
+ } else {
2404
+ s7 = peg$FAILED;
2405
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2406
+ }
2407
+ if (s7 !== peg$FAILED) {
2408
+ s6 = [s6, s7];
2409
+ s5 = s6;
2410
+ } else {
2411
+ peg$currPos = s5;
2412
+ s5 = peg$FAILED;
2413
+ }
2414
+ peg$silentFails--;
2415
+ if (s5 === peg$FAILED) {
2416
+ s4 = undefined;
2417
+ } else {
2418
+ peg$currPos = s4;
2419
+ s4 = peg$FAILED;
2420
+ }
2421
+ if (s4 !== peg$FAILED) {
2422
+ if (input.length > peg$currPos) {
2423
+ s5 = input.charAt(peg$currPos);
2424
+ peg$currPos++;
2425
+ } else {
2426
+ s5 = peg$FAILED;
2427
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
2428
+ }
2429
+ if (s5 !== peg$FAILED) {
2430
+ s4 = [s4, s5];
2431
+ s3 = s4;
2432
+ } else {
2433
+ peg$currPos = s3;
2434
+ s3 = peg$FAILED;
2435
+ }
2436
+ } else {
2437
+ peg$currPos = s3;
2438
+ s3 = peg$FAILED;
2439
+ }
2440
+ }
2441
+ } else {
2442
+ s2 = peg$FAILED;
2443
+ }
2444
+ if (s2 !== peg$FAILED) {
2445
+ s1 = input.substring(s1, peg$currPos);
2446
+ } else {
2447
+ s1 = s2;
2448
+ }
2449
+ if (s1 !== peg$FAILED) {
2450
+ peg$savedPos = s0;
2451
+ s1 = peg$f31(s1);
2452
+ }
2453
+ s0 = s1;
2454
+
2455
+ return s0;
2456
+ }
2457
+
2458
+ function peg$parseNormalText() {
2459
+ let s0, s1;
2460
+
2461
+ s0 = peg$currPos;
2462
+ s1 = peg$parseText();
2463
+ peg$savedPos = s0;
2464
+ s1 = peg$f32(s1);
2465
+ s0 = s1;
2466
+
2467
+ return s0;
2468
+ }
2469
+
2470
+ function peg$parseFieldNameText() {
2471
+ let s0, s1, s2, s3, s4, s5, s6;
2472
+
2473
+ s0 = peg$currPos;
2474
+ s1 = peg$currPos;
2475
+ s2 = [];
2476
+ s3 = peg$currPos;
2477
+ s4 = [];
2478
+ s5 = input.charAt(peg$currPos);
2479
+ if (peg$r2.test(s5)) {
2480
+ peg$currPos++;
2481
+ } else {
2482
+ s5 = peg$FAILED;
2483
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
2484
+ }
2485
+ if (s5 !== peg$FAILED) {
2486
+ while (s5 !== peg$FAILED) {
2487
+ s4.push(s5);
2488
+ s5 = input.charAt(peg$currPos);
2489
+ if (peg$r2.test(s5)) {
2490
+ peg$currPos++;
2491
+ } else {
2492
+ s5 = peg$FAILED;
2493
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
2494
+ }
2495
+ }
2496
+ } else {
2497
+ s4 = peg$FAILED;
2498
+ }
2499
+ if (s4 !== peg$FAILED) {
2500
+ s3 = input.substring(s3, peg$currPos);
2501
+ } else {
2502
+ s3 = s4;
2503
+ }
2504
+ while (s3 !== peg$FAILED) {
2505
+ s2.push(s3);
2506
+ s3 = peg$currPos;
2507
+ s4 = peg$parseWhitespace();
2508
+ if (s4 !== peg$FAILED) {
2509
+ s4 = peg$currPos;
2510
+ s5 = [];
2511
+ s6 = input.charAt(peg$currPos);
2512
+ if (peg$r2.test(s6)) {
2513
+ peg$currPos++;
2514
+ } else {
2515
+ s6 = peg$FAILED;
2516
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
2517
+ }
2518
+ if (s6 !== peg$FAILED) {
2519
+ while (s6 !== peg$FAILED) {
2520
+ s5.push(s6);
2521
+ s6 = input.charAt(peg$currPos);
2522
+ if (peg$r2.test(s6)) {
2523
+ peg$currPos++;
2524
+ } else {
2525
+ s6 = peg$FAILED;
2526
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
2527
+ }
2528
+ }
2529
+ } else {
2530
+ s5 = peg$FAILED;
2531
+ }
2532
+ if (s5 !== peg$FAILED) {
2533
+ s4 = input.substring(s4, peg$currPos);
2534
+ } else {
2535
+ s4 = s5;
2536
+ }
2537
+ if (s4 === peg$FAILED) {
2538
+ peg$currPos = s3;
2539
+ s3 = peg$FAILED;
2540
+ } else {
2541
+ s3 = s4;
2542
+ }
2543
+ } else {
2544
+ s3 = s4;
2545
+ }
2546
+ }
2547
+ if (s2.length < 1) {
2548
+ peg$currPos = s1;
2549
+ s1 = peg$FAILED;
2550
+ } else {
2551
+ s1 = s2;
2552
+ }
2553
+ if (s1 !== peg$FAILED) {
2554
+ peg$savedPos = s0;
2555
+ s1 = peg$f33(s1);
2556
+ }
2557
+ s0 = s1;
2558
+
2559
+ return s0;
2560
+ }
2561
+
2562
+ function peg$parseText() {
2563
+ let s0, s1, s2, s3, s4, s5, s6;
2564
+
2565
+ peg$silentFails++;
2566
+ s0 = peg$currPos;
2567
+ s1 = [];
2568
+ s2 = peg$currPos;
2569
+ s3 = peg$currPos;
2570
+ peg$silentFails++;
2571
+ s4 = peg$currPos;
2572
+ s5 = peg$parse_();
2573
+ s6 = peg$parseNewline();
2574
+ if (s6 !== peg$FAILED) {
2575
+ s5 = [s5, s6];
2576
+ s4 = s5;
2577
+ } else {
2578
+ peg$currPos = s4;
2579
+ s4 = peg$FAILED;
2580
+ }
2581
+ peg$silentFails--;
2582
+ if (s4 === peg$FAILED) {
2583
+ s3 = undefined;
2584
+ } else {
2585
+ peg$currPos = s3;
2586
+ s3 = peg$FAILED;
2587
+ }
2588
+ if (s3 !== peg$FAILED) {
2589
+ if (input.length > peg$currPos) {
2590
+ s4 = input.charAt(peg$currPos);
2591
+ peg$currPos++;
2592
+ } else {
2593
+ s4 = peg$FAILED;
2594
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
2595
+ }
2596
+ if (s4 !== peg$FAILED) {
2597
+ s3 = [s3, s4];
2598
+ s2 = s3;
2599
+ } else {
2600
+ peg$currPos = s2;
2601
+ s2 = peg$FAILED;
2602
+ }
2603
+ } else {
2604
+ peg$currPos = s2;
2605
+ s2 = peg$FAILED;
2606
+ }
2607
+ while (s2 !== peg$FAILED) {
2608
+ s1.push(s2);
2609
+ s2 = peg$currPos;
2610
+ s3 = peg$currPos;
2611
+ peg$silentFails++;
2612
+ s4 = peg$currPos;
2613
+ s5 = peg$parse_();
2614
+ s6 = peg$parseNewline();
2615
+ if (s6 !== peg$FAILED) {
2616
+ s5 = [s5, s6];
2617
+ s4 = s5;
2618
+ } else {
2619
+ peg$currPos = s4;
2620
+ s4 = peg$FAILED;
2621
+ }
2622
+ peg$silentFails--;
2623
+ if (s4 === peg$FAILED) {
2624
+ s3 = undefined;
2625
+ } else {
2626
+ peg$currPos = s3;
2627
+ s3 = peg$FAILED;
2628
+ }
2629
+ if (s3 !== peg$FAILED) {
2630
+ if (input.length > peg$currPos) {
2631
+ s4 = input.charAt(peg$currPos);
2632
+ peg$currPos++;
2633
+ } else {
2634
+ s4 = peg$FAILED;
2635
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
2636
+ }
2637
+ if (s4 !== peg$FAILED) {
2638
+ s3 = [s3, s4];
2639
+ s2 = s3;
2640
+ } else {
2641
+ peg$currPos = s2;
2642
+ s2 = peg$FAILED;
2643
+ }
2644
+ } else {
2645
+ peg$currPos = s2;
2646
+ s2 = peg$FAILED;
2647
+ }
2648
+ }
2649
+ s0 = input.substring(s0, peg$currPos);
2650
+ peg$silentFails--;
2651
+
2652
+ return s0;
2653
+ }
2654
+
2655
+ function peg$parseNewline() {
2656
+ let s0, s1;
2657
+
2658
+ peg$silentFails++;
2659
+ s0 = peg$currPos;
2660
+ if (input.substr(peg$currPos, 2) === peg$c20) {
2661
+ s1 = peg$c20;
2662
+ peg$currPos += 2;
2663
+ } else {
2664
+ s1 = peg$FAILED;
2665
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
2666
+ }
2667
+ if (s1 === peg$FAILED) {
2668
+ if (input.charCodeAt(peg$currPos) === 10) {
2669
+ s1 = peg$c21;
2670
+ peg$currPos++;
2671
+ } else {
2672
+ s1 = peg$FAILED;
2673
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
2674
+ }
2675
+ }
2676
+ if (s1 !== peg$FAILED) {
2677
+ s0 = input.substring(s0, peg$currPos);
2678
+ } else {
2679
+ s0 = s1;
2680
+ }
2681
+ peg$silentFails--;
2682
+ if (s0 === peg$FAILED) {
2683
+ s1 = peg$FAILED;
2684
+ if (peg$silentFails === 0) { peg$fail(peg$e26); }
2685
+ }
2686
+
2687
+ return s0;
2688
+ }
2689
+
2690
+ function peg$parseWhitespace() {
2691
+ let s0, s1, s2;
2692
+
2693
+ peg$silentFails++;
2694
+ s0 = peg$currPos;
2695
+ s1 = [];
2696
+ s2 = input.charAt(peg$currPos);
2697
+ if (peg$r3.test(s2)) {
2698
+ peg$currPos++;
2699
+ } else {
2700
+ s2 = peg$FAILED;
2701
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2702
+ }
2703
+ if (s2 !== peg$FAILED) {
2704
+ while (s2 !== peg$FAILED) {
2705
+ s1.push(s2);
2706
+ s2 = input.charAt(peg$currPos);
2707
+ if (peg$r3.test(s2)) {
2708
+ peg$currPos++;
2709
+ } else {
2710
+ s2 = peg$FAILED;
2711
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2712
+ }
2713
+ }
2714
+ } else {
2715
+ s1 = peg$FAILED;
2716
+ }
2717
+ if (s1 !== peg$FAILED) {
2718
+ s0 = input.substring(s0, peg$currPos);
2719
+ } else {
2720
+ s0 = s1;
2721
+ }
2722
+ peg$silentFails--;
2723
+ if (s0 === peg$FAILED) {
2724
+ s1 = peg$FAILED;
2725
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2726
+ }
2727
+
2728
+ return s0;
2729
+ }
2730
+
2731
+ function peg$parse_() {
2732
+ let s0, s1, s2;
2733
+
2734
+ peg$silentFails++;
2735
+ s0 = peg$currPos;
2736
+ s1 = [];
2737
+ s2 = input.charAt(peg$currPos);
2738
+ if (peg$r3.test(s2)) {
2739
+ peg$currPos++;
2740
+ } else {
2741
+ s2 = peg$FAILED;
2742
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2743
+ }
2744
+ while (s2 !== peg$FAILED) {
2745
+ s1.push(s2);
2746
+ s2 = input.charAt(peg$currPos);
2747
+ if (peg$r3.test(s2)) {
2748
+ peg$currPos++;
2749
+ } else {
2750
+ s2 = peg$FAILED;
2751
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2752
+ }
2753
+ }
2754
+ s0 = input.substring(s0, peg$currPos);
2755
+ peg$silentFails--;
2756
+
2757
+ return s0;
2758
+ }
2759
+
2760
+ peg$result = peg$startRuleFunction();
2761
+
2762
+ const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
2763
+ function peg$throw() {
2764
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
2765
+ peg$fail(peg$endExpectation());
2766
+ }
2767
+
2768
+ throw peg$buildStructuredError(
2769
+ peg$maxFailExpected,
2770
+ peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
2771
+ peg$maxFailPos < input.length
2772
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
2773
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
2774
+ );
2775
+ }
2776
+ if (options.peg$library) {
2777
+ return /** @type {any} */ ({
2778
+ peg$result,
2779
+ peg$currPos,
2780
+ peg$FAILED,
2781
+ peg$maxFailExpected,
2782
+ peg$maxFailPos,
2783
+ peg$success,
2784
+ peg$throw: peg$success ? undefined : peg$throw,
2785
+ });
2786
+ }
2787
+ if (peg$success) {
2788
+ return peg$result;
2789
+ } else {
2790
+ peg$throw();
2791
+ }
2792
+ }
2793
+
2794
+ const peg$allowedStartRules = [
2795
+ "Start",
2796
+ "NoteList",
2797
+ "ModelList",
2798
+ "Template"
2799
+ ];
2800
+
2801
+ export {
2802
+ peg$allowedStartRules as StartRules,
2803
+ peg$SyntaxError as SyntaxError,
2804
+ peg$parse as parse
2805
+ };