@keymanapp/kmc-ldml 19.0.7-alpha → 19.0.8-alpha

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.
@@ -0,0 +1,1121 @@
1
+ // @generated by Peggy 4.2.0.
2
+ //
3
+ // https://peggyjs.org/
4
+ function peg$subclass(child, parent) {
5
+ function C() { this.constructor = child; }
6
+ C.prototype = parent.prototype;
7
+ child.prototype = new C();
8
+ }
9
+ function peg$SyntaxError(message, expected, found, location) {
10
+ var self = Error.call(this, message);
11
+ // istanbul ignore next Check is a necessary evil to support older environments
12
+ if (Object.setPrototypeOf) {
13
+ Object.setPrototypeOf(self, peg$SyntaxError.prototype);
14
+ }
15
+ self.expected = expected;
16
+ self.found = found;
17
+ self.location = location;
18
+ self.name = "SyntaxError";
19
+ return self;
20
+ }
21
+ peg$subclass(peg$SyntaxError, Error);
22
+ function peg$padEnd(str, targetLength, padString) {
23
+ padString = padString || " ";
24
+ if (str.length > targetLength) {
25
+ return str;
26
+ }
27
+ targetLength -= str.length;
28
+ padString += padString.repeat(targetLength);
29
+ return str + padString.slice(0, targetLength);
30
+ }
31
+ peg$SyntaxError.prototype.format = function (sources) {
32
+ var str = "Error: " + this.message;
33
+ if (this.location) {
34
+ var src = null;
35
+ var k;
36
+ for (k = 0; k < sources.length; k++) {
37
+ if (sources[k].source === this.location.source) {
38
+ src = sources[k].text.split(/\r\n|\n|\r/g);
39
+ break;
40
+ }
41
+ }
42
+ var s = this.location.start;
43
+ var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
44
+ ? this.location.source.offset(s)
45
+ : s;
46
+ var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
47
+ if (src) {
48
+ var e = this.location.end;
49
+ var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
50
+ var line = src[s.line - 1];
51
+ var last = s.line === e.line ? e.column : line.length + 1;
52
+ var hatLen = (last - s.column) || 1;
53
+ str += "\n --> " + loc + "\n"
54
+ + filler + " |\n"
55
+ + offset_s.line + " | " + line + "\n"
56
+ + filler + " | " + peg$padEnd("", s.column - 1, ' ')
57
+ + peg$padEnd("", hatLen, "^");
58
+ }
59
+ else {
60
+ str += "\n at " + loc;
61
+ }
62
+ }
63
+ return str;
64
+ };
65
+ peg$SyntaxError.buildMessage = function (expected, found) {
66
+ var DESCRIBE_EXPECTATION_FNS = {
67
+ literal: function (expectation) {
68
+ return "\"" + literalEscape(expectation.text) + "\"";
69
+ },
70
+ class: function (expectation) {
71
+ var escapedParts = expectation.parts.map(function (part) {
72
+ return Array.isArray(part)
73
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
74
+ : classEscape(part);
75
+ });
76
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
77
+ },
78
+ any: function () {
79
+ return "any character";
80
+ },
81
+ end: function () {
82
+ return "end of input";
83
+ },
84
+ other: function (expectation) {
85
+ return expectation.description;
86
+ }
87
+ };
88
+ function hex(ch) {
89
+ return ch.charCodeAt(0).toString(16).toUpperCase();
90
+ }
91
+ function literalEscape(s) {
92
+ return s
93
+ .replace(/\\/g, "\\\\")
94
+ .replace(/"/g, "\\\"")
95
+ .replace(/\0/g, "\\0")
96
+ .replace(/\t/g, "\\t")
97
+ .replace(/\n/g, "\\n")
98
+ .replace(/\r/g, "\\r")
99
+ .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
100
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
101
+ }
102
+ function classEscape(s) {
103
+ return s
104
+ .replace(/\\/g, "\\\\")
105
+ .replace(/\]/g, "\\]")
106
+ .replace(/\^/g, "\\^")
107
+ .replace(/-/g, "\\-")
108
+ .replace(/\0/g, "\\0")
109
+ .replace(/\t/g, "\\t")
110
+ .replace(/\n/g, "\\n")
111
+ .replace(/\r/g, "\\r")
112
+ .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
113
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
114
+ }
115
+ function describeExpectation(expectation) {
116
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
117
+ }
118
+ function describeExpected(expected) {
119
+ var descriptions = expected.map(describeExpectation);
120
+ var i, j;
121
+ descriptions.sort();
122
+ if (descriptions.length > 0) {
123
+ for (i = 1, j = 1; i < descriptions.length; i++) {
124
+ if (descriptions[i - 1] !== descriptions[i]) {
125
+ descriptions[j] = descriptions[i];
126
+ j++;
127
+ }
128
+ }
129
+ descriptions.length = j;
130
+ }
131
+ switch (descriptions.length) {
132
+ case 1:
133
+ return descriptions[0];
134
+ case 2:
135
+ return descriptions[0] + " or " + descriptions[1];
136
+ default:
137
+ return descriptions.slice(0, -1).join(", ")
138
+ + ", or "
139
+ + descriptions[descriptions.length - 1];
140
+ }
141
+ }
142
+ function describeFound(found) {
143
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
144
+ }
145
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
146
+ };
147
+ function peg$parse(input, options) {
148
+ options = options !== undefined ? options : {};
149
+ var peg$FAILED = {};
150
+ var peg$source = options.grammarSource;
151
+ var peg$startRuleFunctions = { to_replacement: peg$parseto_replacement };
152
+ var peg$startRuleFunction = peg$parseto_replacement;
153
+ var peg$c0 = "$$";
154
+ var peg$c1 = "$";
155
+ var peg$c2 = "u";
156
+ var peg$c3 = "{";
157
+ var peg$c4 = "}";
158
+ var peg$c5 = "\\m{";
159
+ var peg$c6 = "${";
160
+ var peg$c7 = "$[1:";
161
+ var peg$c8 = "]";
162
+ var peg$c9 = "\\";
163
+ var peg$c10 = " ";
164
+ var peg$c11 = "\uF900";
165
+ var peg$c12 = "\r";
166
+ var peg$c13 = "\n";
167
+ var peg$r0 = /^[\n\r (-+\--.:?[\]-\^{-}\u3000\uF900]/;
168
+ var peg$r1 = /^[$\\]/;
169
+ var peg$r2 = /^[!-#%-',\/-9;->A-Z_-z~-\x7F]/;
170
+ var peg$r3 = /^[\n\r \u3000\uF900]/;
171
+ var peg$r4 = /^[0-9]/;
172
+ var peg$r5 = /^[!-#%-',\/;->_-`~-\x7F]/;
173
+ var peg$r6 = /^[A-Za-z]/;
174
+ var peg$r7 = /^[~-\uD7FF\uE000-\uFFFF]/;
175
+ var peg$r8 = /^[\uD800-\uDBFF]/;
176
+ var peg$r9 = /^[\uDC00-\uDFFF]/;
177
+ var peg$r10 = /^[0-9A-Z_a-z]/;
178
+ var peg$r11 = /^[a-f]/i;
179
+ var peg$r12 = /^[\--.0-9\xB7\u0300-\u036F\u203F-\u2040]/;
180
+ var peg$r13 = /^[A-F]/i;
181
+ var peg$r14 = /^[:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
182
+ var peg$e0 = peg$classExpectation(["\n", "\r", " ", ["(", "+"], ["-", "."], ":", "?", "[", ["]", "^"], ["{", "}"], "\u3000", "\uF900"], false, false);
183
+ var peg$e1 = peg$classExpectation(["$", "\\"], false, false);
184
+ var peg$e2 = peg$literalExpectation("$$", false);
185
+ var peg$e3 = peg$literalExpectation("$", false);
186
+ var peg$e4 = peg$literalExpectation("u", true);
187
+ var peg$e5 = peg$literalExpectation("{", false);
188
+ var peg$e6 = peg$literalExpectation("}", false);
189
+ var peg$e7 = peg$literalExpectation("\\m{", true);
190
+ var peg$e8 = peg$literalExpectation("${", false);
191
+ var peg$e9 = peg$literalExpectation("$[1:", false);
192
+ var peg$e10 = peg$literalExpectation("]", false);
193
+ var peg$e11 = peg$classExpectation([["!", "#"], ["%", "'"], ",", ["/", "9"], [";", ">"], ["A", "Z"], ["_", "z"], ["~", "\x7F"]], false, false);
194
+ var peg$e12 = peg$classExpectation(["\n", "\r", " ", "\u3000", "\uF900"], false, false);
195
+ var peg$e13 = peg$literalExpectation("\\", false);
196
+ var peg$e14 = peg$classExpectation([["0", "9"]], false, false);
197
+ var peg$e15 = peg$classExpectation([["!", "#"], ["%", "'"], ",", "/", [";", ">"], ["_", "`"], ["~", "\x7F"]], false, false);
198
+ var peg$e16 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false);
199
+ var peg$e17 = peg$classExpectation([["~", "\uD7FF"], ["\uE000", "\uFFFF"]], false, false);
200
+ var peg$e18 = peg$classExpectation([["\uD800", "\uDBFF"]], false, false);
201
+ var peg$e19 = peg$classExpectation([["\uDC00", "\uDFFF"]], false, false);
202
+ var peg$e20 = peg$literalExpectation(" ", false);
203
+ var peg$e21 = peg$literalExpectation("\uF900", false);
204
+ var peg$e22 = peg$literalExpectation("\r", false);
205
+ var peg$e23 = peg$literalExpectation("\n", false);
206
+ var peg$e24 = peg$classExpectation([["0", "9"], ["A", "Z"], "_", ["a", "z"]], false, false);
207
+ var peg$e25 = peg$classExpectation([["a", "f"]], false, true);
208
+ var peg$e26 = peg$classExpectation([["-", "."], ["0", "9"], "\xB7", ["\u0300", "\u036F"], ["\u203F", "\u2040"]], false, false);
209
+ var peg$e27 = peg$classExpectation([["A", "F"]], false, true);
210
+ var peg$e28 = peg$classExpectation([":", ["A", "Z"], "_", ["a", "z"], ["\xC0", "\xD6"], ["\xD8", "\xF6"], ["\xF8", "\u02FF"], ["\u0370", "\u037D"], ["\u037F", "\u1FFF"], ["\u200C", "\u200D"], ["\u2070", "\u218F"], ["\u2C00", "\u2FEF"], ["\u3001", "\uD7FF"], ["\uF900", "\uFDCF"], ["\uFDF0", "\uFFFD"]], false, false);
211
+ var peg$currPos = options.peg$currPos | 0;
212
+ var peg$savedPos = peg$currPos;
213
+ var peg$posDetailsCache = [{ line: 1, column: 1 }];
214
+ var peg$maxFailPos = peg$currPos;
215
+ var peg$maxFailExpected = options.peg$maxFailExpected || [];
216
+ var peg$silentFails = options.peg$silentFails | 0;
217
+ var peg$result;
218
+ if (options.startRule) {
219
+ if (!(options.startRule in peg$startRuleFunctions)) {
220
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
221
+ }
222
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
223
+ }
224
+ function text() {
225
+ return input.substring(peg$savedPos, peg$currPos);
226
+ }
227
+ function offset() {
228
+ return peg$savedPos;
229
+ }
230
+ function range() {
231
+ return {
232
+ source: peg$source,
233
+ start: peg$savedPos,
234
+ end: peg$currPos
235
+ };
236
+ }
237
+ function location() {
238
+ return peg$computeLocation(peg$savedPos, peg$currPos);
239
+ }
240
+ function expected(description, location) {
241
+ location = location !== undefined
242
+ ? location
243
+ : peg$computeLocation(peg$savedPos, peg$currPos);
244
+ throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
245
+ }
246
+ function error(message, location) {
247
+ location = location !== undefined
248
+ ? location
249
+ : peg$computeLocation(peg$savedPos, peg$currPos);
250
+ throw peg$buildSimpleError(message, location);
251
+ }
252
+ function peg$literalExpectation(text, ignoreCase) {
253
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
254
+ }
255
+ function peg$classExpectation(parts, inverted, ignoreCase) {
256
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
257
+ }
258
+ function peg$anyExpectation() {
259
+ return { type: "any" };
260
+ }
261
+ function peg$endExpectation() {
262
+ return { type: "end" };
263
+ }
264
+ function peg$otherExpectation(description) {
265
+ return { type: "other", description: description };
266
+ }
267
+ function peg$computePosDetails(pos) {
268
+ var details = peg$posDetailsCache[pos];
269
+ var p;
270
+ if (details) {
271
+ return details;
272
+ }
273
+ else {
274
+ if (pos >= peg$posDetailsCache.length) {
275
+ p = peg$posDetailsCache.length - 1;
276
+ }
277
+ else {
278
+ p = pos;
279
+ while (!peg$posDetailsCache[--p]) { }
280
+ }
281
+ details = peg$posDetailsCache[p];
282
+ details = {
283
+ line: details.line,
284
+ column: details.column
285
+ };
286
+ while (p < pos) {
287
+ if (input.charCodeAt(p) === 10) {
288
+ details.line++;
289
+ details.column = 1;
290
+ }
291
+ else {
292
+ details.column++;
293
+ }
294
+ p++;
295
+ }
296
+ peg$posDetailsCache[pos] = details;
297
+ return details;
298
+ }
299
+ }
300
+ function peg$computeLocation(startPos, endPos, offset) {
301
+ var startPosDetails = peg$computePosDetails(startPos);
302
+ var endPosDetails = peg$computePosDetails(endPos);
303
+ var res = {
304
+ source: peg$source,
305
+ start: {
306
+ offset: startPos,
307
+ line: startPosDetails.line,
308
+ column: startPosDetails.column
309
+ },
310
+ end: {
311
+ offset: endPos,
312
+ line: endPosDetails.line,
313
+ column: endPosDetails.column
314
+ }
315
+ };
316
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
317
+ res.start = peg$source.offset(res.start);
318
+ res.end = peg$source.offset(res.end);
319
+ }
320
+ return res;
321
+ }
322
+ function peg$fail(expected) {
323
+ if (peg$currPos < peg$maxFailPos) {
324
+ return;
325
+ }
326
+ if (peg$currPos > peg$maxFailPos) {
327
+ peg$maxFailPos = peg$currPos;
328
+ peg$maxFailExpected = [];
329
+ }
330
+ peg$maxFailExpected.push(expected);
331
+ }
332
+ function peg$buildSimpleError(message, location) {
333
+ return new peg$SyntaxError(message, null, null, location);
334
+ }
335
+ function peg$buildStructuredError(expected, found, location) {
336
+ return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
337
+ }
338
+ function peg$parseto_replacement() {
339
+ var s0;
340
+ s0 = peg$parseatoms();
341
+ return s0;
342
+ }
343
+ function peg$parseatoms() {
344
+ var s0, s1;
345
+ s0 = [];
346
+ s1 = peg$parseatom();
347
+ while (s1 !== peg$FAILED) {
348
+ s0.push(s1);
349
+ s1 = peg$parseatom();
350
+ }
351
+ return s0;
352
+ }
353
+ function peg$parseatom() {
354
+ var s0;
355
+ s0 = peg$parsereplacement_char();
356
+ if (s0 === peg$FAILED) {
357
+ s0 = peg$parseescaped_char();
358
+ if (s0 === peg$FAILED) {
359
+ s0 = peg$parsegroup_reference();
360
+ if (s0 === peg$FAILED) {
361
+ s0 = peg$parseescaped_codepoints();
362
+ if (s0 === peg$FAILED) {
363
+ s0 = peg$parsenamed_marker();
364
+ if (s0 === peg$FAILED) {
365
+ s0 = peg$parsestring_variable();
366
+ if (s0 === peg$FAILED) {
367
+ s0 = peg$parsemapped_set();
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+ }
374
+ return s0;
375
+ }
376
+ function peg$parsereplacement_char() {
377
+ var s0;
378
+ s0 = peg$parsecontent_char();
379
+ if (s0 === peg$FAILED) {
380
+ s0 = input.charAt(peg$currPos);
381
+ if (peg$r0.test(s0)) {
382
+ peg$currPos++;
383
+ }
384
+ else {
385
+ s0 = peg$FAILED;
386
+ if (peg$silentFails === 0) {
387
+ peg$fail(peg$e0);
388
+ }
389
+ }
390
+ }
391
+ return s0;
392
+ }
393
+ function peg$parseescaped_char() {
394
+ var s0, s1, s2;
395
+ s0 = peg$currPos;
396
+ s1 = peg$parsebackslash();
397
+ if (s1 !== peg$FAILED) {
398
+ s2 = input.charAt(peg$currPos);
399
+ if (peg$r1.test(s2)) {
400
+ peg$currPos++;
401
+ }
402
+ else {
403
+ s2 = peg$FAILED;
404
+ if (peg$silentFails === 0) {
405
+ peg$fail(peg$e1);
406
+ }
407
+ }
408
+ if (s2 !== peg$FAILED) {
409
+ s1 = [s1, s2];
410
+ s0 = s1;
411
+ }
412
+ else {
413
+ peg$currPos = s0;
414
+ s0 = peg$FAILED;
415
+ }
416
+ }
417
+ else {
418
+ peg$currPos = s0;
419
+ s0 = peg$FAILED;
420
+ }
421
+ if (s0 === peg$FAILED) {
422
+ if (input.substr(peg$currPos, 2) === peg$c0) {
423
+ s0 = peg$c0;
424
+ peg$currPos += 2;
425
+ }
426
+ else {
427
+ s0 = peg$FAILED;
428
+ if (peg$silentFails === 0) {
429
+ peg$fail(peg$e2);
430
+ }
431
+ }
432
+ }
433
+ return s0;
434
+ }
435
+ function peg$parsegroup_reference() {
436
+ var s0, s1, s2;
437
+ s0 = peg$currPos;
438
+ if (input.charCodeAt(peg$currPos) === 36) {
439
+ s1 = peg$c1;
440
+ peg$currPos++;
441
+ }
442
+ else {
443
+ s1 = peg$FAILED;
444
+ if (peg$silentFails === 0) {
445
+ peg$fail(peg$e3);
446
+ }
447
+ }
448
+ if (s1 !== peg$FAILED) {
449
+ s2 = peg$parseDIGIT();
450
+ if (s2 !== peg$FAILED) {
451
+ s1 = [s1, s2];
452
+ s0 = s1;
453
+ }
454
+ else {
455
+ peg$currPos = s0;
456
+ s0 = peg$FAILED;
457
+ }
458
+ }
459
+ else {
460
+ peg$currPos = s0;
461
+ s0 = peg$FAILED;
462
+ }
463
+ return s0;
464
+ }
465
+ function peg$parseescaped_codepoints() {
466
+ var s0, s1, s2, s3, s4, s5;
467
+ s0 = peg$currPos;
468
+ s1 = peg$parsebackslash();
469
+ if (s1 !== peg$FAILED) {
470
+ s2 = input.charAt(peg$currPos);
471
+ if (s2.toLowerCase() === peg$c2) {
472
+ peg$currPos++;
473
+ }
474
+ else {
475
+ s2 = peg$FAILED;
476
+ if (peg$silentFails === 0) {
477
+ peg$fail(peg$e4);
478
+ }
479
+ }
480
+ if (s2 !== peg$FAILED) {
481
+ if (input.charCodeAt(peg$currPos) === 123) {
482
+ s3 = peg$c3;
483
+ peg$currPos++;
484
+ }
485
+ else {
486
+ s3 = peg$FAILED;
487
+ if (peg$silentFails === 0) {
488
+ peg$fail(peg$e5);
489
+ }
490
+ }
491
+ if (s3 !== peg$FAILED) {
492
+ s4 = peg$parsecodepoints_hex();
493
+ if (s4 !== peg$FAILED) {
494
+ if (input.charCodeAt(peg$currPos) === 125) {
495
+ s5 = peg$c4;
496
+ peg$currPos++;
497
+ }
498
+ else {
499
+ s5 = peg$FAILED;
500
+ if (peg$silentFails === 0) {
501
+ peg$fail(peg$e6);
502
+ }
503
+ }
504
+ if (s5 !== peg$FAILED) {
505
+ s1 = [s1, s2, s3, s4, s5];
506
+ s0 = s1;
507
+ }
508
+ else {
509
+ peg$currPos = s0;
510
+ s0 = peg$FAILED;
511
+ }
512
+ }
513
+ else {
514
+ peg$currPos = s0;
515
+ s0 = peg$FAILED;
516
+ }
517
+ }
518
+ else {
519
+ peg$currPos = s0;
520
+ s0 = peg$FAILED;
521
+ }
522
+ }
523
+ else {
524
+ peg$currPos = s0;
525
+ s0 = peg$FAILED;
526
+ }
527
+ }
528
+ else {
529
+ peg$currPos = s0;
530
+ s0 = peg$FAILED;
531
+ }
532
+ return s0;
533
+ }
534
+ function peg$parsenamed_marker() {
535
+ var s0, s1, s2, s3;
536
+ s0 = peg$currPos;
537
+ s1 = input.substr(peg$currPos, 3);
538
+ if (s1.toLowerCase() === peg$c5) {
539
+ peg$currPos += 3;
540
+ }
541
+ else {
542
+ s1 = peg$FAILED;
543
+ if (peg$silentFails === 0) {
544
+ peg$fail(peg$e7);
545
+ }
546
+ }
547
+ if (s1 !== peg$FAILED) {
548
+ s2 = peg$parseNMTOKEN();
549
+ if (s2 !== peg$FAILED) {
550
+ if (input.charCodeAt(peg$currPos) === 125) {
551
+ s3 = peg$c4;
552
+ peg$currPos++;
553
+ }
554
+ else {
555
+ s3 = peg$FAILED;
556
+ if (peg$silentFails === 0) {
557
+ peg$fail(peg$e6);
558
+ }
559
+ }
560
+ if (s3 !== peg$FAILED) {
561
+ s1 = [s1, s2, s3];
562
+ s0 = s1;
563
+ }
564
+ else {
565
+ peg$currPos = s0;
566
+ s0 = peg$FAILED;
567
+ }
568
+ }
569
+ else {
570
+ peg$currPos = s0;
571
+ s0 = peg$FAILED;
572
+ }
573
+ }
574
+ else {
575
+ peg$currPos = s0;
576
+ s0 = peg$FAILED;
577
+ }
578
+ return s0;
579
+ }
580
+ function peg$parsestring_variable() {
581
+ var s0, s1, s2, s3;
582
+ s0 = peg$currPos;
583
+ if (input.substr(peg$currPos, 2) === peg$c6) {
584
+ s1 = peg$c6;
585
+ peg$currPos += 2;
586
+ }
587
+ else {
588
+ s1 = peg$FAILED;
589
+ if (peg$silentFails === 0) {
590
+ peg$fail(peg$e8);
591
+ }
592
+ }
593
+ if (s1 !== peg$FAILED) {
594
+ s2 = peg$parsevar_id();
595
+ if (s2 !== peg$FAILED) {
596
+ if (input.charCodeAt(peg$currPos) === 125) {
597
+ s3 = peg$c4;
598
+ peg$currPos++;
599
+ }
600
+ else {
601
+ s3 = peg$FAILED;
602
+ if (peg$silentFails === 0) {
603
+ peg$fail(peg$e6);
604
+ }
605
+ }
606
+ if (s3 !== peg$FAILED) {
607
+ s1 = [s1, s2, s3];
608
+ s0 = s1;
609
+ }
610
+ else {
611
+ peg$currPos = s0;
612
+ s0 = peg$FAILED;
613
+ }
614
+ }
615
+ else {
616
+ peg$currPos = s0;
617
+ s0 = peg$FAILED;
618
+ }
619
+ }
620
+ else {
621
+ peg$currPos = s0;
622
+ s0 = peg$FAILED;
623
+ }
624
+ return s0;
625
+ }
626
+ function peg$parsemapped_set() {
627
+ var s0, s1, s2, s3;
628
+ s0 = peg$currPos;
629
+ if (input.substr(peg$currPos, 4) === peg$c7) {
630
+ s1 = peg$c7;
631
+ peg$currPos += 4;
632
+ }
633
+ else {
634
+ s1 = peg$FAILED;
635
+ if (peg$silentFails === 0) {
636
+ peg$fail(peg$e9);
637
+ }
638
+ }
639
+ if (s1 !== peg$FAILED) {
640
+ s2 = peg$parsevar_id();
641
+ if (s2 !== peg$FAILED) {
642
+ if (input.charCodeAt(peg$currPos) === 93) {
643
+ s3 = peg$c8;
644
+ peg$currPos++;
645
+ }
646
+ else {
647
+ s3 = peg$FAILED;
648
+ if (peg$silentFails === 0) {
649
+ peg$fail(peg$e10);
650
+ }
651
+ }
652
+ if (s3 !== peg$FAILED) {
653
+ s1 = [s1, s2, s3];
654
+ s0 = s1;
655
+ }
656
+ else {
657
+ peg$currPos = s0;
658
+ s0 = peg$FAILED;
659
+ }
660
+ }
661
+ else {
662
+ peg$currPos = s0;
663
+ s0 = peg$FAILED;
664
+ }
665
+ }
666
+ else {
667
+ peg$currPos = s0;
668
+ s0 = peg$FAILED;
669
+ }
670
+ return s0;
671
+ }
672
+ function peg$parsecontent_char() {
673
+ var s0;
674
+ s0 = input.charAt(peg$currPos);
675
+ if (peg$r2.test(s0)) {
676
+ peg$currPos++;
677
+ }
678
+ else {
679
+ s0 = peg$FAILED;
680
+ if (peg$silentFails === 0) {
681
+ peg$fail(peg$e11);
682
+ }
683
+ }
684
+ if (s0 === peg$FAILED) {
685
+ s0 = peg$parseNON_ASCII();
686
+ }
687
+ return s0;
688
+ }
689
+ function peg$parsews() {
690
+ var s0;
691
+ s0 = input.charAt(peg$currPos);
692
+ if (peg$r3.test(s0)) {
693
+ peg$currPos++;
694
+ }
695
+ else {
696
+ s0 = peg$FAILED;
697
+ if (peg$silentFails === 0) {
698
+ peg$fail(peg$e12);
699
+ }
700
+ }
701
+ return s0;
702
+ }
703
+ function peg$parsebackslash() {
704
+ var s0;
705
+ if (input.charCodeAt(peg$currPos) === 92) {
706
+ s0 = peg$c9;
707
+ peg$currPos++;
708
+ }
709
+ else {
710
+ s0 = peg$FAILED;
711
+ if (peg$silentFails === 0) {
712
+ peg$fail(peg$e13);
713
+ }
714
+ }
715
+ return s0;
716
+ }
717
+ function peg$parseDIGIT() {
718
+ var s0;
719
+ s0 = input.charAt(peg$currPos);
720
+ if (peg$r4.test(s0)) {
721
+ peg$currPos++;
722
+ }
723
+ else {
724
+ s0 = peg$FAILED;
725
+ if (peg$silentFails === 0) {
726
+ peg$fail(peg$e14);
727
+ }
728
+ }
729
+ return s0;
730
+ }
731
+ function peg$parsecodepoints_hex() {
732
+ var s0, s1, s2, s3, s4, s5;
733
+ s0 = peg$currPos;
734
+ s1 = peg$parsecodepoint_hex();
735
+ if (s1 !== peg$FAILED) {
736
+ s2 = [];
737
+ s3 = peg$currPos;
738
+ s4 = peg$parseSP();
739
+ if (s4 !== peg$FAILED) {
740
+ s5 = peg$parsecodepoint_hex();
741
+ if (s5 !== peg$FAILED) {
742
+ s4 = [s4, s5];
743
+ s3 = s4;
744
+ }
745
+ else {
746
+ peg$currPos = s3;
747
+ s3 = peg$FAILED;
748
+ }
749
+ }
750
+ else {
751
+ peg$currPos = s3;
752
+ s3 = peg$FAILED;
753
+ }
754
+ while (s3 !== peg$FAILED) {
755
+ s2.push(s3);
756
+ s3 = peg$currPos;
757
+ s4 = peg$parseSP();
758
+ if (s4 !== peg$FAILED) {
759
+ s5 = peg$parsecodepoint_hex();
760
+ if (s5 !== peg$FAILED) {
761
+ s4 = [s4, s5];
762
+ s3 = s4;
763
+ }
764
+ else {
765
+ peg$currPos = s3;
766
+ s3 = peg$FAILED;
767
+ }
768
+ }
769
+ else {
770
+ peg$currPos = s3;
771
+ s3 = peg$FAILED;
772
+ }
773
+ }
774
+ s1 = [s1, s2];
775
+ s0 = s1;
776
+ }
777
+ else {
778
+ peg$currPos = s0;
779
+ s0 = peg$FAILED;
780
+ }
781
+ return s0;
782
+ }
783
+ function peg$parsevar_id() {
784
+ var s0, s1, s2;
785
+ s0 = peg$currPos;
786
+ s1 = [];
787
+ s2 = peg$parseIDCHAR();
788
+ while (s2 !== peg$FAILED) {
789
+ s1.push(s2);
790
+ if (s1.length >= 32) {
791
+ s2 = peg$FAILED;
792
+ }
793
+ else {
794
+ s2 = peg$parseIDCHAR();
795
+ }
796
+ }
797
+ if (s1.length < 1) {
798
+ peg$currPos = s0;
799
+ s0 = peg$FAILED;
800
+ }
801
+ else {
802
+ s0 = s1;
803
+ }
804
+ return s0;
805
+ }
806
+ function peg$parseASCII_PUNCT() {
807
+ var s0;
808
+ s0 = input.charAt(peg$currPos);
809
+ if (peg$r5.test(s0)) {
810
+ peg$currPos++;
811
+ }
812
+ else {
813
+ s0 = peg$FAILED;
814
+ if (peg$silentFails === 0) {
815
+ peg$fail(peg$e15);
816
+ }
817
+ }
818
+ return s0;
819
+ }
820
+ function peg$parseALPHA() {
821
+ var s0;
822
+ s0 = input.charAt(peg$currPos);
823
+ if (peg$r6.test(s0)) {
824
+ peg$currPos++;
825
+ }
826
+ else {
827
+ s0 = peg$FAILED;
828
+ if (peg$silentFails === 0) {
829
+ peg$fail(peg$e16);
830
+ }
831
+ }
832
+ return s0;
833
+ }
834
+ function peg$parseNON_ASCII() {
835
+ var s0, s1, s2;
836
+ s0 = input.charAt(peg$currPos);
837
+ if (peg$r7.test(s0)) {
838
+ peg$currPos++;
839
+ }
840
+ else {
841
+ s0 = peg$FAILED;
842
+ if (peg$silentFails === 0) {
843
+ peg$fail(peg$e17);
844
+ }
845
+ }
846
+ if (s0 === peg$FAILED) {
847
+ s0 = peg$currPos;
848
+ s1 = input.charAt(peg$currPos);
849
+ if (peg$r8.test(s1)) {
850
+ peg$currPos++;
851
+ }
852
+ else {
853
+ s1 = peg$FAILED;
854
+ if (peg$silentFails === 0) {
855
+ peg$fail(peg$e18);
856
+ }
857
+ }
858
+ if (s1 !== peg$FAILED) {
859
+ s2 = input.charAt(peg$currPos);
860
+ if (peg$r9.test(s2)) {
861
+ peg$currPos++;
862
+ }
863
+ else {
864
+ s2 = peg$FAILED;
865
+ if (peg$silentFails === 0) {
866
+ peg$fail(peg$e19);
867
+ }
868
+ }
869
+ if (s2 !== peg$FAILED) {
870
+ s1 = [s1, s2];
871
+ s0 = s1;
872
+ }
873
+ else {
874
+ peg$currPos = s0;
875
+ s0 = peg$FAILED;
876
+ }
877
+ }
878
+ else {
879
+ peg$currPos = s0;
880
+ s0 = peg$FAILED;
881
+ }
882
+ }
883
+ return s0;
884
+ }
885
+ function peg$parseSP() {
886
+ var s0;
887
+ if (input.charCodeAt(peg$currPos) === 32) {
888
+ s0 = peg$c10;
889
+ peg$currPos++;
890
+ }
891
+ else {
892
+ s0 = peg$FAILED;
893
+ if (peg$silentFails === 0) {
894
+ peg$fail(peg$e20);
895
+ }
896
+ }
897
+ return s0;
898
+ }
899
+ function peg$parseHTAB() {
900
+ var s0;
901
+ if (input.charCodeAt(peg$currPos) === 63744) {
902
+ s0 = peg$c11;
903
+ peg$currPos++;
904
+ }
905
+ else {
906
+ s0 = peg$FAILED;
907
+ if (peg$silentFails === 0) {
908
+ peg$fail(peg$e21);
909
+ }
910
+ }
911
+ return s0;
912
+ }
913
+ function peg$parseCR() {
914
+ var s0;
915
+ if (input.charCodeAt(peg$currPos) === 13) {
916
+ s0 = peg$c12;
917
+ peg$currPos++;
918
+ }
919
+ else {
920
+ s0 = peg$FAILED;
921
+ if (peg$silentFails === 0) {
922
+ peg$fail(peg$e22);
923
+ }
924
+ }
925
+ return s0;
926
+ }
927
+ function peg$parseLF() {
928
+ var s0;
929
+ if (input.charCodeAt(peg$currPos) === 10) {
930
+ s0 = peg$c13;
931
+ peg$currPos++;
932
+ }
933
+ else {
934
+ s0 = peg$FAILED;
935
+ if (peg$silentFails === 0) {
936
+ peg$fail(peg$e23);
937
+ }
938
+ }
939
+ return s0;
940
+ }
941
+ function peg$parsecodepoint_hex() {
942
+ var s0, s1, s2;
943
+ s0 = peg$currPos;
944
+ s1 = [];
945
+ s2 = peg$parseLHEXDIG();
946
+ while (s2 !== peg$FAILED) {
947
+ s1.push(s2);
948
+ if (s1.length >= 6) {
949
+ s2 = peg$FAILED;
950
+ }
951
+ else {
952
+ s2 = peg$parseLHEXDIG();
953
+ }
954
+ }
955
+ if (s1.length < 1) {
956
+ peg$currPos = s0;
957
+ s0 = peg$FAILED;
958
+ }
959
+ else {
960
+ s0 = s1;
961
+ }
962
+ return s0;
963
+ }
964
+ function peg$parseNMTOKEN() {
965
+ var s0, s1;
966
+ s0 = [];
967
+ s1 = peg$parseNAMECHAR();
968
+ if (s1 !== peg$FAILED) {
969
+ while (s1 !== peg$FAILED) {
970
+ s0.push(s1);
971
+ s1 = peg$parseNAMECHAR();
972
+ }
973
+ }
974
+ else {
975
+ s0 = peg$FAILED;
976
+ }
977
+ return s0;
978
+ }
979
+ function peg$parseIDCHAR() {
980
+ var s0;
981
+ s0 = input.charAt(peg$currPos);
982
+ if (peg$r10.test(s0)) {
983
+ peg$currPos++;
984
+ }
985
+ else {
986
+ s0 = peg$FAILED;
987
+ if (peg$silentFails === 0) {
988
+ peg$fail(peg$e24);
989
+ }
990
+ }
991
+ return s0;
992
+ }
993
+ function peg$parseLHEXDIG() {
994
+ var s0;
995
+ s0 = peg$parseHEXDIG();
996
+ if (s0 === peg$FAILED) {
997
+ s0 = input.charAt(peg$currPos);
998
+ if (peg$r11.test(s0)) {
999
+ peg$currPos++;
1000
+ }
1001
+ else {
1002
+ s0 = peg$FAILED;
1003
+ if (peg$silentFails === 0) {
1004
+ peg$fail(peg$e25);
1005
+ }
1006
+ }
1007
+ }
1008
+ return s0;
1009
+ }
1010
+ function peg$parseNAMECHAR() {
1011
+ var s0;
1012
+ s0 = peg$parseNAMESTARTCHAR();
1013
+ if (s0 === peg$FAILED) {
1014
+ s0 = input.charAt(peg$currPos);
1015
+ if (peg$r12.test(s0)) {
1016
+ peg$currPos++;
1017
+ }
1018
+ else {
1019
+ s0 = peg$FAILED;
1020
+ if (peg$silentFails === 0) {
1021
+ peg$fail(peg$e26);
1022
+ }
1023
+ }
1024
+ }
1025
+ return s0;
1026
+ }
1027
+ function peg$parseHEXDIG() {
1028
+ var s0;
1029
+ s0 = peg$parseDIGIT();
1030
+ if (s0 === peg$FAILED) {
1031
+ s0 = input.charAt(peg$currPos);
1032
+ if (peg$r13.test(s0)) {
1033
+ peg$currPos++;
1034
+ }
1035
+ else {
1036
+ s0 = peg$FAILED;
1037
+ if (peg$silentFails === 0) {
1038
+ peg$fail(peg$e27);
1039
+ }
1040
+ }
1041
+ }
1042
+ return s0;
1043
+ }
1044
+ function peg$parseNAMESTARTCHAR() {
1045
+ var s0, s1, s2;
1046
+ s0 = input.charAt(peg$currPos);
1047
+ if (peg$r14.test(s0)) {
1048
+ peg$currPos++;
1049
+ }
1050
+ else {
1051
+ s0 = peg$FAILED;
1052
+ if (peg$silentFails === 0) {
1053
+ peg$fail(peg$e28);
1054
+ }
1055
+ }
1056
+ if (s0 === peg$FAILED) {
1057
+ s0 = peg$currPos;
1058
+ s1 = input.charAt(peg$currPos);
1059
+ if (peg$r8.test(s1)) {
1060
+ peg$currPos++;
1061
+ }
1062
+ else {
1063
+ s1 = peg$FAILED;
1064
+ if (peg$silentFails === 0) {
1065
+ peg$fail(peg$e18);
1066
+ }
1067
+ }
1068
+ if (s1 !== peg$FAILED) {
1069
+ s2 = input.charAt(peg$currPos);
1070
+ if (peg$r9.test(s2)) {
1071
+ peg$currPos++;
1072
+ }
1073
+ else {
1074
+ s2 = peg$FAILED;
1075
+ if (peg$silentFails === 0) {
1076
+ peg$fail(peg$e19);
1077
+ }
1078
+ }
1079
+ if (s2 !== peg$FAILED) {
1080
+ s1 = [s1, s2];
1081
+ s0 = s1;
1082
+ }
1083
+ else {
1084
+ peg$currPos = s0;
1085
+ s0 = peg$FAILED;
1086
+ }
1087
+ }
1088
+ else {
1089
+ peg$currPos = s0;
1090
+ s0 = peg$FAILED;
1091
+ }
1092
+ }
1093
+ return s0;
1094
+ }
1095
+ peg$result = peg$startRuleFunction();
1096
+ if (options.peg$library) {
1097
+ return /** @type {any} */ ({
1098
+ peg$result,
1099
+ peg$currPos,
1100
+ peg$FAILED,
1101
+ peg$maxFailExpected,
1102
+ peg$maxFailPos
1103
+ });
1104
+ }
1105
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1106
+ return peg$result;
1107
+ }
1108
+ else {
1109
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1110
+ peg$fail(peg$endExpectation());
1111
+ }
1112
+ throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
1113
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1114
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
1115
+ }
1116
+ }
1117
+ const peg$allowedStartRules = [
1118
+ "to_replacement"
1119
+ ];
1120
+ export { peg$allowedStartRules as StartRules, peg$SyntaxError as SyntaxError, peg$parse as parse };
1121
+ //# sourceMappingURL=transform-to-required.js.map