@lumjs/tests 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,996 @@
1
+ // Generated by Peggy 2.0.1.
2
+ //
3
+ // https://peggyjs.org/
4
+
5
+ "use strict";
6
+
7
+ function peg$subclass(child, parent) {
8
+ function C() { this.constructor = child; }
9
+ C.prototype = parent.prototype;
10
+ child.prototype = new C();
11
+ }
12
+
13
+ function peg$SyntaxError(message, expected, found, location) {
14
+ var self = Error.call(this, message);
15
+ // istanbul ignore next Check is a necessary evil to support older environments
16
+ if (Object.setPrototypeOf) {
17
+ Object.setPrototypeOf(self, peg$SyntaxError.prototype);
18
+ }
19
+ self.expected = expected;
20
+ self.found = found;
21
+ self.location = location;
22
+ self.name = "SyntaxError";
23
+ return self;
24
+ }
25
+
26
+ peg$subclass(peg$SyntaxError, Error);
27
+
28
+ function peg$padEnd(str, targetLength, padString) {
29
+ padString = padString || " ";
30
+ if (str.length > targetLength) { return str; }
31
+ targetLength -= str.length;
32
+ padString += padString.repeat(targetLength);
33
+ return str + padString.slice(0, targetLength);
34
+ }
35
+
36
+ peg$SyntaxError.prototype.format = function(sources) {
37
+ var str = "Error: " + this.message;
38
+ if (this.location) {
39
+ var src = null;
40
+ var k;
41
+ for (k = 0; k < sources.length; k++) {
42
+ if (sources[k].source === this.location.source) {
43
+ src = sources[k].text.split(/\r\n|\n|\r/g);
44
+ break;
45
+ }
46
+ }
47
+ var s = this.location.start;
48
+ var loc = this.location.source + ":" + s.line + ":" + s.column;
49
+ if (src) {
50
+ var e = this.location.end;
51
+ var filler = peg$padEnd("", s.line.toString().length, ' ');
52
+ var line = src[s.line - 1];
53
+ var last = s.line === e.line ? e.column : line.length + 1;
54
+ var hatLen = (last - s.column) || 1;
55
+ str += "\n --> " + loc + "\n"
56
+ + filler + " |\n"
57
+ + s.line + " | " + line + "\n"
58
+ + filler + " | " + peg$padEnd("", s.column - 1, ' ')
59
+ + peg$padEnd("", hatLen, "^");
60
+ } else {
61
+ str += "\n at " + loc;
62
+ }
63
+ }
64
+ return str;
65
+ };
66
+
67
+ peg$SyntaxError.buildMessage = function(expected, found) {
68
+ var DESCRIBE_EXPECTATION_FNS = {
69
+ literal: function(expectation) {
70
+ return "\"" + literalEscape(expectation.text) + "\"";
71
+ },
72
+
73
+ class: function(expectation) {
74
+ var escapedParts = expectation.parts.map(function(part) {
75
+ return Array.isArray(part)
76
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
77
+ : classEscape(part);
78
+ });
79
+
80
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
81
+ },
82
+
83
+ any: function() {
84
+ return "any character";
85
+ },
86
+
87
+ end: function() {
88
+ return "end of input";
89
+ },
90
+
91
+ other: function(expectation) {
92
+ return expectation.description;
93
+ }
94
+ };
95
+
96
+ function hex(ch) {
97
+ return ch.charCodeAt(0).toString(16).toUpperCase();
98
+ }
99
+
100
+ function literalEscape(s) {
101
+ return s
102
+ .replace(/\\/g, "\\\\")
103
+ .replace(/"/g, "\\\"")
104
+ .replace(/\0/g, "\\0")
105
+ .replace(/\t/g, "\\t")
106
+ .replace(/\n/g, "\\n")
107
+ .replace(/\r/g, "\\r")
108
+ .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
109
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
110
+ }
111
+
112
+ function classEscape(s) {
113
+ return s
114
+ .replace(/\\/g, "\\\\")
115
+ .replace(/\]/g, "\\]")
116
+ .replace(/\^/g, "\\^")
117
+ .replace(/-/g, "\\-")
118
+ .replace(/\0/g, "\\0")
119
+ .replace(/\t/g, "\\t")
120
+ .replace(/\n/g, "\\n")
121
+ .replace(/\r/g, "\\r")
122
+ .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
123
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
124
+ }
125
+
126
+ function describeExpectation(expectation) {
127
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
128
+ }
129
+
130
+ function describeExpected(expected) {
131
+ var descriptions = expected.map(describeExpectation);
132
+ var i, j;
133
+
134
+ descriptions.sort();
135
+
136
+ if (descriptions.length > 0) {
137
+ for (i = 1, j = 1; i < descriptions.length; i++) {
138
+ if (descriptions[i - 1] !== descriptions[i]) {
139
+ descriptions[j] = descriptions[i];
140
+ j++;
141
+ }
142
+ }
143
+ descriptions.length = j;
144
+ }
145
+
146
+ switch (descriptions.length) {
147
+ case 1:
148
+ return descriptions[0];
149
+
150
+ case 2:
151
+ return descriptions[0] + " or " + descriptions[1];
152
+
153
+ default:
154
+ return descriptions.slice(0, -1).join(", ")
155
+ + ", or "
156
+ + descriptions[descriptions.length - 1];
157
+ }
158
+ }
159
+
160
+ function describeFound(found) {
161
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
162
+ }
163
+
164
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
165
+ };
166
+
167
+ function peg$parse(input, options) {
168
+ options = options !== undefined ? options : {};
169
+
170
+ var peg$FAILED = {};
171
+ var peg$source = options.grammarSource;
172
+
173
+ var peg$startRuleFunctions = { TAP: peg$parseTAP };
174
+ var peg$startRuleFunction = peg$parseTAP;
175
+
176
+ var peg$c0 = "1..";
177
+ var peg$c1 = "not";
178
+ var peg$c2 = "ok";
179
+ var peg$c3 = "-";
180
+ var peg$c4 = "#";
181
+ var peg$c5 = "SKIP";
182
+ var peg$c6 = "TODO";
183
+ var peg$c7 = "got";
184
+ var peg$c8 = "expected";
185
+ var peg$c9 = "op";
186
+ var peg$c10 = ":";
187
+
188
+ var peg$r0 = /^[^\n\r]/;
189
+ var peg$r1 = /^[ \t]/;
190
+ var peg$r2 = /^[\n\r]/;
191
+ var peg$r3 = /^[0-9]/;
192
+ var peg$r4 = /^[^#\n\r]/;
193
+ var peg$r5 = /^[~\-]/;
194
+
195
+ var peg$e0 = peg$otherExpectation("text");
196
+ var peg$e1 = peg$classExpectation(["\n", "\r"], true, false);
197
+ var peg$e2 = peg$otherExpectation("x-space");
198
+ var peg$e3 = peg$classExpectation([" ", "\t"], false, false);
199
+ var peg$e4 = peg$otherExpectation("linebreak");
200
+ var peg$e5 = peg$classExpectation(["\n", "\r"], false, false);
201
+ var peg$e6 = peg$otherExpectation("integer");
202
+ var peg$e7 = peg$classExpectation([["0", "9"]], false, false);
203
+ var peg$e8 = peg$literalExpectation("1..", false);
204
+ var peg$e9 = peg$literalExpectation("not", false);
205
+ var peg$e10 = peg$literalExpectation("ok", false);
206
+ var peg$e11 = peg$literalExpectation("-", false);
207
+ var peg$e12 = peg$classExpectation(["#", "\n", "\r"], true, false);
208
+ var peg$e13 = peg$literalExpectation("#", false);
209
+ var peg$e14 = peg$literalExpectation("SKIP", false);
210
+ var peg$e15 = peg$literalExpectation("TODO", false);
211
+ var peg$e16 = peg$classExpectation(["~", "-"], false, false);
212
+ var peg$e17 = peg$literalExpectation("got", false);
213
+ var peg$e18 = peg$literalExpectation("expected", false);
214
+ var peg$e19 = peg$literalExpectation("op", false);
215
+ var peg$e20 = peg$literalExpectation(":", false);
216
+
217
+ var peg$f0 = function(plan, items) {
218
+ return {plan, items};
219
+ };
220
+ var peg$f1 = function() {
221
+ return parseInt(text(), 10);
222
+ };
223
+ var peg$f2 = function(num) { return num; };
224
+ var peg$f3 = function(not, num, desc, cmt) {
225
+ let comment = null;
226
+ let isSkip = false;
227
+ let isTodo = false;
228
+
229
+ if (cmt !== null)
230
+ {
231
+ comment = cmt.text;
232
+ skip = (cmt.cmd === 'SKIP');
233
+ todo = (cmt.cmd === 'TODO');
234
+ }
235
+
236
+ return(
237
+ {
238
+ is: 'test',
239
+ id: num,
240
+ ok: (not === null),
241
+ desc,
242
+ comment,
243
+ skip,
244
+ todo,
245
+ });
246
+ };
247
+ var peg$f4 = function(text) {
248
+ return text.trim();
249
+ };
250
+ var peg$f5 = function(cmd, text) {
251
+ return {cmd, text};
252
+ };
253
+ var peg$f6 = function(stmt, cmd, cmt) {
254
+ const data = {};
255
+
256
+ if (stmt === '~')
257
+ { // A meta information log
258
+ data.type = 'meta';
259
+ }
260
+ else if (stmt === '-')
261
+ { // An array log item
262
+ data.type = 'item';
263
+ }
264
+ else if (cmd !== null)
265
+ { // Extended log information
266
+ data.type = 'info';
267
+ data.info = cmd;
268
+ }
269
+ else
270
+ { // Just a regular old comment
271
+ data.type = 'comment';
272
+ }
273
+
274
+ data.text = cmt.trim();
275
+ return data;
276
+ };
277
+ var peg$f7 = function(cmd) { return cmd; };
278
+ var peg$f8 = function(text) {
279
+ return({type: 'other', text: text.trim()});
280
+ };
281
+ var peg$currPos = 0;
282
+ var peg$savedPos = 0;
283
+ var peg$posDetailsCache = [{ line: 1, column: 1 }];
284
+ var peg$maxFailPos = 0;
285
+ var peg$maxFailExpected = [];
286
+ var peg$silentFails = 0;
287
+
288
+ var peg$result;
289
+
290
+ if ("startRule" in options) {
291
+ if (!(options.startRule in peg$startRuleFunctions)) {
292
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
293
+ }
294
+
295
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
296
+ }
297
+
298
+ function text() {
299
+ return input.substring(peg$savedPos, peg$currPos);
300
+ }
301
+
302
+ function offset() {
303
+ return peg$savedPos;
304
+ }
305
+
306
+ function range() {
307
+ return {
308
+ source: peg$source,
309
+ start: peg$savedPos,
310
+ end: peg$currPos
311
+ };
312
+ }
313
+
314
+ function location() {
315
+ return peg$computeLocation(peg$savedPos, peg$currPos);
316
+ }
317
+
318
+ function expected(description, location) {
319
+ location = location !== undefined
320
+ ? location
321
+ : peg$computeLocation(peg$savedPos, peg$currPos);
322
+
323
+ throw peg$buildStructuredError(
324
+ [peg$otherExpectation(description)],
325
+ input.substring(peg$savedPos, peg$currPos),
326
+ location
327
+ );
328
+ }
329
+
330
+ function error(message, location) {
331
+ location = location !== undefined
332
+ ? location
333
+ : peg$computeLocation(peg$savedPos, peg$currPos);
334
+
335
+ throw peg$buildSimpleError(message, location);
336
+ }
337
+
338
+ function peg$literalExpectation(text, ignoreCase) {
339
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
340
+ }
341
+
342
+ function peg$classExpectation(parts, inverted, ignoreCase) {
343
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
344
+ }
345
+
346
+ function peg$anyExpectation() {
347
+ return { type: "any" };
348
+ }
349
+
350
+ function peg$endExpectation() {
351
+ return { type: "end" };
352
+ }
353
+
354
+ function peg$otherExpectation(description) {
355
+ return { type: "other", description: description };
356
+ }
357
+
358
+ function peg$computePosDetails(pos) {
359
+ var details = peg$posDetailsCache[pos];
360
+ var p;
361
+
362
+ if (details) {
363
+ return details;
364
+ } else {
365
+ p = pos - 1;
366
+ while (!peg$posDetailsCache[p]) {
367
+ p--;
368
+ }
369
+
370
+ details = peg$posDetailsCache[p];
371
+ details = {
372
+ line: details.line,
373
+ column: details.column
374
+ };
375
+
376
+ while (p < pos) {
377
+ if (input.charCodeAt(p) === 10) {
378
+ details.line++;
379
+ details.column = 1;
380
+ } else {
381
+ details.column++;
382
+ }
383
+
384
+ p++;
385
+ }
386
+
387
+ peg$posDetailsCache[pos] = details;
388
+
389
+ return details;
390
+ }
391
+ }
392
+
393
+ function peg$computeLocation(startPos, endPos) {
394
+ var startPosDetails = peg$computePosDetails(startPos);
395
+ var endPosDetails = peg$computePosDetails(endPos);
396
+
397
+ return {
398
+ source: peg$source,
399
+ start: {
400
+ offset: startPos,
401
+ line: startPosDetails.line,
402
+ column: startPosDetails.column
403
+ },
404
+ end: {
405
+ offset: endPos,
406
+ line: endPosDetails.line,
407
+ column: endPosDetails.column
408
+ }
409
+ };
410
+ }
411
+
412
+ function peg$fail(expected) {
413
+ if (peg$currPos < peg$maxFailPos) { return; }
414
+
415
+ if (peg$currPos > peg$maxFailPos) {
416
+ peg$maxFailPos = peg$currPos;
417
+ peg$maxFailExpected = [];
418
+ }
419
+
420
+ peg$maxFailExpected.push(expected);
421
+ }
422
+
423
+ function peg$buildSimpleError(message, location) {
424
+ return new peg$SyntaxError(message, null, null, location);
425
+ }
426
+
427
+ function peg$buildStructuredError(expected, found, location) {
428
+ return new peg$SyntaxError(
429
+ peg$SyntaxError.buildMessage(expected, found),
430
+ expected,
431
+ found,
432
+ location
433
+ );
434
+ }
435
+
436
+ function peg$parseTAP() {
437
+ var s0, s1, s2, s3;
438
+
439
+ s0 = peg$currPos;
440
+ s1 = peg$parseplan();
441
+ if (s1 === peg$FAILED) {
442
+ s1 = null;
443
+ }
444
+ s2 = [];
445
+ s3 = peg$parsetapline();
446
+ if (s3 !== peg$FAILED) {
447
+ while (s3 !== peg$FAILED) {
448
+ s2.push(s3);
449
+ s3 = peg$parsetapline();
450
+ }
451
+ } else {
452
+ s2 = peg$FAILED;
453
+ }
454
+ if (s2 !== peg$FAILED) {
455
+ peg$savedPos = s0;
456
+ s0 = peg$f0(s1, s2);
457
+ } else {
458
+ peg$currPos = s0;
459
+ s0 = peg$FAILED;
460
+ }
461
+
462
+ return s0;
463
+ }
464
+
465
+ function peg$parsetext() {
466
+ var s0, s1;
467
+
468
+ peg$silentFails++;
469
+ if (peg$r0.test(input.charAt(peg$currPos))) {
470
+ s0 = input.charAt(peg$currPos);
471
+ peg$currPos++;
472
+ } else {
473
+ s0 = peg$FAILED;
474
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
475
+ }
476
+ peg$silentFails--;
477
+ if (s0 === peg$FAILED) {
478
+ s1 = peg$FAILED;
479
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
480
+ }
481
+
482
+ return s0;
483
+ }
484
+
485
+ function peg$parseanytext() {
486
+ var s0, s1, s2;
487
+
488
+ peg$silentFails++;
489
+ s0 = peg$currPos;
490
+ s1 = [];
491
+ s2 = peg$parsetext();
492
+ while (s2 !== peg$FAILED) {
493
+ s1.push(s2);
494
+ s2 = peg$parsetext();
495
+ }
496
+ s0 = input.substring(s0, peg$currPos);
497
+ peg$silentFails--;
498
+ s1 = peg$FAILED;
499
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
500
+
501
+ return s0;
502
+ }
503
+
504
+ function peg$parsehastext() {
505
+ var s0, s1, s2;
506
+
507
+ peg$silentFails++;
508
+ s0 = peg$currPos;
509
+ s1 = [];
510
+ s2 = peg$parsetext();
511
+ if (s2 !== peg$FAILED) {
512
+ while (s2 !== peg$FAILED) {
513
+ s1.push(s2);
514
+ s2 = peg$parsetext();
515
+ }
516
+ } else {
517
+ s1 = peg$FAILED;
518
+ }
519
+ if (s1 !== peg$FAILED) {
520
+ s0 = input.substring(s0, peg$currPos);
521
+ } else {
522
+ s0 = s1;
523
+ }
524
+ peg$silentFails--;
525
+ if (s0 === peg$FAILED) {
526
+ s1 = peg$FAILED;
527
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
528
+ }
529
+
530
+ return s0;
531
+ }
532
+
533
+ function peg$parsews() {
534
+ var s0, s1;
535
+
536
+ peg$silentFails++;
537
+ if (peg$r1.test(input.charAt(peg$currPos))) {
538
+ s0 = input.charAt(peg$currPos);
539
+ peg$currPos++;
540
+ } else {
541
+ s0 = peg$FAILED;
542
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
543
+ }
544
+ peg$silentFails--;
545
+ if (s0 === peg$FAILED) {
546
+ s1 = peg$FAILED;
547
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
548
+ }
549
+
550
+ return s0;
551
+ }
552
+
553
+ function peg$parse_() {
554
+ var s0, s1;
555
+
556
+ peg$silentFails++;
557
+ s0 = [];
558
+ s1 = peg$parsews();
559
+ while (s1 !== peg$FAILED) {
560
+ s0.push(s1);
561
+ s1 = peg$parsews();
562
+ }
563
+ peg$silentFails--;
564
+ s1 = peg$FAILED;
565
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
566
+
567
+ return s0;
568
+ }
569
+
570
+ function peg$parsenl() {
571
+ var s0, s1;
572
+
573
+ peg$silentFails++;
574
+ s0 = [];
575
+ if (peg$r2.test(input.charAt(peg$currPos))) {
576
+ s1 = input.charAt(peg$currPos);
577
+ peg$currPos++;
578
+ } else {
579
+ s1 = peg$FAILED;
580
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
581
+ }
582
+ if (s1 !== peg$FAILED) {
583
+ while (s1 !== peg$FAILED) {
584
+ s0.push(s1);
585
+ if (peg$r2.test(input.charAt(peg$currPos))) {
586
+ s1 = input.charAt(peg$currPos);
587
+ peg$currPos++;
588
+ } else {
589
+ s1 = peg$FAILED;
590
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
591
+ }
592
+ }
593
+ } else {
594
+ s0 = peg$FAILED;
595
+ }
596
+ peg$silentFails--;
597
+ if (s0 === peg$FAILED) {
598
+ s1 = peg$FAILED;
599
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
600
+ }
601
+
602
+ return s0;
603
+ }
604
+
605
+ function peg$parseint() {
606
+ var s0, s1, s2;
607
+
608
+ peg$silentFails++;
609
+ s0 = peg$currPos;
610
+ s1 = [];
611
+ if (peg$r3.test(input.charAt(peg$currPos))) {
612
+ s2 = input.charAt(peg$currPos);
613
+ peg$currPos++;
614
+ } else {
615
+ s2 = peg$FAILED;
616
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
617
+ }
618
+ if (s2 !== peg$FAILED) {
619
+ while (s2 !== peg$FAILED) {
620
+ s1.push(s2);
621
+ if (peg$r3.test(input.charAt(peg$currPos))) {
622
+ s2 = input.charAt(peg$currPos);
623
+ peg$currPos++;
624
+ } else {
625
+ s2 = peg$FAILED;
626
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
627
+ }
628
+ }
629
+ } else {
630
+ s1 = peg$FAILED;
631
+ }
632
+ if (s1 !== peg$FAILED) {
633
+ peg$savedPos = s0;
634
+ s1 = peg$f1();
635
+ }
636
+ s0 = s1;
637
+ peg$silentFails--;
638
+ if (s0 === peg$FAILED) {
639
+ s1 = peg$FAILED;
640
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
641
+ }
642
+
643
+ return s0;
644
+ }
645
+
646
+ function peg$parseplan() {
647
+ var s0, s1, s2, s3;
648
+
649
+ s0 = peg$currPos;
650
+ if (input.substr(peg$currPos, 3) === peg$c0) {
651
+ s1 = peg$c0;
652
+ peg$currPos += 3;
653
+ } else {
654
+ s1 = peg$FAILED;
655
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
656
+ }
657
+ if (s1 !== peg$FAILED) {
658
+ s2 = peg$parseint();
659
+ if (s2 !== peg$FAILED) {
660
+ s3 = peg$parsenl();
661
+ if (s3 !== peg$FAILED) {
662
+ peg$savedPos = s0;
663
+ s0 = peg$f2(s2);
664
+ } else {
665
+ peg$currPos = s0;
666
+ s0 = peg$FAILED;
667
+ }
668
+ } else {
669
+ peg$currPos = s0;
670
+ s0 = peg$FAILED;
671
+ }
672
+ } else {
673
+ peg$currPos = s0;
674
+ s0 = peg$FAILED;
675
+ }
676
+
677
+ return s0;
678
+ }
679
+
680
+ function peg$parsetapline() {
681
+ var s0;
682
+
683
+ s0 = peg$parsetestline();
684
+ if (s0 === peg$FAILED) {
685
+ s0 = peg$parsecomment();
686
+ if (s0 === peg$FAILED) {
687
+ s0 = peg$parseother();
688
+ }
689
+ }
690
+
691
+ return s0;
692
+ }
693
+
694
+ function peg$parsetestline() {
695
+ var s0, s1, s2, s3, s4, s5, s6, s7;
696
+
697
+ s0 = peg$currPos;
698
+ s1 = peg$currPos;
699
+ if (input.substr(peg$currPos, 3) === peg$c1) {
700
+ s2 = peg$c1;
701
+ peg$currPos += 3;
702
+ } else {
703
+ s2 = peg$FAILED;
704
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
705
+ }
706
+ if (s2 !== peg$FAILED) {
707
+ s3 = [];
708
+ s4 = peg$parsews();
709
+ if (s4 !== peg$FAILED) {
710
+ while (s4 !== peg$FAILED) {
711
+ s3.push(s4);
712
+ s4 = peg$parsews();
713
+ }
714
+ } else {
715
+ s3 = peg$FAILED;
716
+ }
717
+ if (s3 !== peg$FAILED) {
718
+ s2 = [s2, s3];
719
+ s1 = s2;
720
+ } else {
721
+ peg$currPos = s1;
722
+ s1 = peg$FAILED;
723
+ }
724
+ } else {
725
+ peg$currPos = s1;
726
+ s1 = peg$FAILED;
727
+ }
728
+ if (s1 === peg$FAILED) {
729
+ s1 = null;
730
+ }
731
+ if (input.substr(peg$currPos, 2) === peg$c2) {
732
+ s2 = peg$c2;
733
+ peg$currPos += 2;
734
+ } else {
735
+ s2 = peg$FAILED;
736
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
737
+ }
738
+ if (s2 !== peg$FAILED) {
739
+ s3 = peg$parse_();
740
+ s4 = peg$parseint();
741
+ if (s4 !== peg$FAILED) {
742
+ s5 = peg$parsedesc();
743
+ if (s5 === peg$FAILED) {
744
+ s5 = null;
745
+ }
746
+ s6 = peg$parsetestcomment();
747
+ if (s6 === peg$FAILED) {
748
+ s6 = null;
749
+ }
750
+ s7 = peg$parsenl();
751
+ if (s7 === peg$FAILED) {
752
+ s7 = null;
753
+ }
754
+ peg$savedPos = s0;
755
+ s0 = peg$f3(s1, s4, s5, s6);
756
+ } else {
757
+ peg$currPos = s0;
758
+ s0 = peg$FAILED;
759
+ }
760
+ } else {
761
+ peg$currPos = s0;
762
+ s0 = peg$FAILED;
763
+ }
764
+
765
+ return s0;
766
+ }
767
+
768
+ function peg$parsedesc() {
769
+ var s0, s1, s2, s3, s4, s5, s6;
770
+
771
+ s0 = peg$currPos;
772
+ s1 = peg$parse_();
773
+ if (input.charCodeAt(peg$currPos) === 45) {
774
+ s2 = peg$c3;
775
+ peg$currPos++;
776
+ } else {
777
+ s2 = peg$FAILED;
778
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
779
+ }
780
+ if (s2 !== peg$FAILED) {
781
+ s3 = peg$parse_();
782
+ s4 = peg$currPos;
783
+ s5 = [];
784
+ if (peg$r4.test(input.charAt(peg$currPos))) {
785
+ s6 = input.charAt(peg$currPos);
786
+ peg$currPos++;
787
+ } else {
788
+ s6 = peg$FAILED;
789
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
790
+ }
791
+ while (s6 !== peg$FAILED) {
792
+ s5.push(s6);
793
+ if (peg$r4.test(input.charAt(peg$currPos))) {
794
+ s6 = input.charAt(peg$currPos);
795
+ peg$currPos++;
796
+ } else {
797
+ s6 = peg$FAILED;
798
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
799
+ }
800
+ }
801
+ s4 = input.substring(s4, peg$currPos);
802
+ peg$savedPos = s0;
803
+ s0 = peg$f4(s4);
804
+ } else {
805
+ peg$currPos = s0;
806
+ s0 = peg$FAILED;
807
+ }
808
+
809
+ return s0;
810
+ }
811
+
812
+ function peg$parsetestcomment() {
813
+ var s0, s1, s2, s3, s4, s5, s6;
814
+
815
+ s0 = peg$currPos;
816
+ s1 = peg$parse_();
817
+ if (input.charCodeAt(peg$currPos) === 35) {
818
+ s2 = peg$c4;
819
+ peg$currPos++;
820
+ } else {
821
+ s2 = peg$FAILED;
822
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
823
+ }
824
+ if (s2 !== peg$FAILED) {
825
+ s3 = peg$parse_();
826
+ if (input.substr(peg$currPos, 4) === peg$c5) {
827
+ s4 = peg$c5;
828
+ peg$currPos += 4;
829
+ } else {
830
+ s4 = peg$FAILED;
831
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
832
+ }
833
+ if (s4 === peg$FAILED) {
834
+ if (input.substr(peg$currPos, 4) === peg$c6) {
835
+ s4 = peg$c6;
836
+ peg$currPos += 4;
837
+ } else {
838
+ s4 = peg$FAILED;
839
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
840
+ }
841
+ }
842
+ if (s4 === peg$FAILED) {
843
+ s4 = null;
844
+ }
845
+ s5 = peg$parse_();
846
+ s6 = peg$parseanytext();
847
+ peg$savedPos = s0;
848
+ s0 = peg$f5(s4, s6);
849
+ } else {
850
+ peg$currPos = s0;
851
+ s0 = peg$FAILED;
852
+ }
853
+
854
+ return s0;
855
+ }
856
+
857
+ function peg$parsecomment() {
858
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
859
+
860
+ s0 = peg$currPos;
861
+ s1 = peg$parse_();
862
+ if (input.charCodeAt(peg$currPos) === 35) {
863
+ s2 = peg$c4;
864
+ peg$currPos++;
865
+ } else {
866
+ s2 = peg$FAILED;
867
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
868
+ }
869
+ if (s2 !== peg$FAILED) {
870
+ s3 = peg$parse_();
871
+ if (peg$r5.test(input.charAt(peg$currPos))) {
872
+ s4 = input.charAt(peg$currPos);
873
+ peg$currPos++;
874
+ } else {
875
+ s4 = peg$FAILED;
876
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
877
+ }
878
+ if (s4 === peg$FAILED) {
879
+ s4 = null;
880
+ }
881
+ s5 = peg$parse_();
882
+ s6 = peg$parsecinfo();
883
+ if (s6 === peg$FAILED) {
884
+ s6 = null;
885
+ }
886
+ s7 = peg$parse_();
887
+ s8 = peg$parseanytext();
888
+ s9 = peg$parsenl();
889
+ if (s9 === peg$FAILED) {
890
+ s9 = null;
891
+ }
892
+ peg$savedPos = s0;
893
+ s0 = peg$f6(s4, s6, s8);
894
+ } else {
895
+ peg$currPos = s0;
896
+ s0 = peg$FAILED;
897
+ }
898
+
899
+ return s0;
900
+ }
901
+
902
+ function peg$parsecinfo() {
903
+ var s0, s1, s2;
904
+
905
+ s0 = peg$currPos;
906
+ if (input.substr(peg$currPos, 3) === peg$c7) {
907
+ s1 = peg$c7;
908
+ peg$currPos += 3;
909
+ } else {
910
+ s1 = peg$FAILED;
911
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
912
+ }
913
+ if (s1 === peg$FAILED) {
914
+ if (input.substr(peg$currPos, 8) === peg$c8) {
915
+ s1 = peg$c8;
916
+ peg$currPos += 8;
917
+ } else {
918
+ s1 = peg$FAILED;
919
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
920
+ }
921
+ if (s1 === peg$FAILED) {
922
+ if (input.substr(peg$currPos, 2) === peg$c9) {
923
+ s1 = peg$c9;
924
+ peg$currPos += 2;
925
+ } else {
926
+ s1 = peg$FAILED;
927
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
928
+ }
929
+ }
930
+ }
931
+ if (s1 !== peg$FAILED) {
932
+ if (input.charCodeAt(peg$currPos) === 58) {
933
+ s2 = peg$c10;
934
+ peg$currPos++;
935
+ } else {
936
+ s2 = peg$FAILED;
937
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
938
+ }
939
+ if (s2 !== peg$FAILED) {
940
+ peg$savedPos = s0;
941
+ s0 = peg$f7(s1);
942
+ } else {
943
+ peg$currPos = s0;
944
+ s0 = peg$FAILED;
945
+ }
946
+ } else {
947
+ peg$currPos = s0;
948
+ s0 = peg$FAILED;
949
+ }
950
+
951
+ return s0;
952
+ }
953
+
954
+ function peg$parseother() {
955
+ var s0, s1, s2;
956
+
957
+ s0 = peg$currPos;
958
+ s1 = peg$parsehastext();
959
+ if (s1 !== peg$FAILED) {
960
+ s2 = peg$parsenl();
961
+ if (s2 === peg$FAILED) {
962
+ s2 = null;
963
+ }
964
+ peg$savedPos = s0;
965
+ s0 = peg$f8(s1);
966
+ } else {
967
+ peg$currPos = s0;
968
+ s0 = peg$FAILED;
969
+ }
970
+
971
+ return s0;
972
+ }
973
+
974
+ peg$result = peg$startRuleFunction();
975
+
976
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
977
+ return peg$result;
978
+ } else {
979
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
980
+ peg$fail(peg$endExpectation());
981
+ }
982
+
983
+ throw peg$buildStructuredError(
984
+ peg$maxFailExpected,
985
+ peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
986
+ peg$maxFailPos < input.length
987
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
988
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
989
+ );
990
+ }
991
+ }
992
+
993
+ module.exports = {
994
+ SyntaxError: peg$SyntaxError,
995
+ parse: peg$parse
996
+ };