state-machine-cat 10.1.9 → 10.1.10

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