unexpectedly 1.0.0 → 3.0.3

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/testFile.peg.js CHANGED
@@ -1,303 +1,296 @@
1
- // Generated by Peggy 3.0.2.
1
+ // @generated by Peggy 5.0.6.
2
2
  //
3
3
  // https://peggyjs.org/
4
4
 
5
5
 
6
- import { mapObj } from './utils.js'
7
6
 
8
- function peg$subclass(child, parent) {
9
- function C() { this.constructor = child; }
10
- C.prototype = parent.prototype;
11
- child.prototype = new C();
12
- }
7
+ import { mapObj } from './utils.js'
13
8
 
14
- function peg$SyntaxError(message, expected, found, location) {
15
- var self = Error.call(this, message);
16
- // istanbul ignore next Check is a necessary evil to support older environments
17
- if (Object.setPrototypeOf) {
18
- Object.setPrototypeOf(self, peg$SyntaxError.prototype);
9
+ class peg$SyntaxError extends SyntaxError {
10
+ constructor(message, expected, found, location) {
11
+ super(message);
12
+ this.expected = expected;
13
+ this.found = found;
14
+ this.location = location;
15
+ this.name = "SyntaxError";
19
16
  }
20
- self.expected = expected;
21
- self.found = found;
22
- self.location = location;
23
- self.name = "SyntaxError";
24
- return self;
25
- }
26
17
 
27
- peg$subclass(peg$SyntaxError, Error);
28
-
29
- function peg$padEnd(str, targetLength, padString) {
30
- padString = padString || " ";
31
- if (str.length > targetLength) { return str; }
32
- targetLength -= str.length;
33
- padString += padString.repeat(targetLength);
34
- return str + padString.slice(0, targetLength);
35
- }
36
-
37
- peg$SyntaxError.prototype.format = function(sources) {
38
- var str = "Error: " + this.message;
39
- if (this.location) {
40
- var src = null;
41
- var k;
42
- for (k = 0; k < sources.length; k++) {
43
- if (sources[k].source === this.location.source) {
44
- src = sources[k].text.split(/\r\n|\n|\r/g);
45
- break;
18
+ format(sources) {
19
+ let str = "Error: " + this.message;
20
+ if (this.location) {
21
+ let src = null;
22
+ const st = sources.find(s => s.source === this.location.source);
23
+ if (st) {
24
+ src = st.text.split(/\r\n|\n|\r/g);
25
+ }
26
+ const s = this.location.start;
27
+ const offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
28
+ ? this.location.source.offset(s)
29
+ : s;
30
+ const loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
31
+ if (src) {
32
+ const e = this.location.end;
33
+ const filler = "".padEnd(offset_s.line.toString().length, " ");
34
+ const line = src[s.line - 1];
35
+ const last = s.line === e.line ? e.column : line.length + 1;
36
+ const hatLen = (last - s.column) || 1;
37
+ str += "\n --> " + loc + "\n"
38
+ + filler + " |\n"
39
+ + offset_s.line + " | " + line + "\n"
40
+ + filler + " | " + "".padEnd(s.column - 1, " ")
41
+ + "".padEnd(hatLen, "^");
42
+ } else {
43
+ str += "\n at " + loc;
46
44
  }
47
45
  }
48
- var s = this.location.start;
49
- var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
50
- ? this.location.source.offset(s)
51
- : s;
52
- var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
53
- if (src) {
54
- var e = this.location.end;
55
- var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
56
- var line = src[s.line - 1];
57
- var last = s.line === e.line ? e.column : line.length + 1;
58
- var hatLen = (last - s.column) || 1;
59
- str += "\n --> " + loc + "\n"
60
- + filler + " |\n"
61
- + offset_s.line + " | " + line + "\n"
62
- + filler + " | " + peg$padEnd("", s.column - 1, ' ')
63
- + peg$padEnd("", hatLen, "^");
64
- } else {
65
- str += "\n at " + loc;
66
- }
46
+ return str;
67
47
  }
68
- return str;
69
- };
70
48
 
71
- peg$SyntaxError.buildMessage = function(expected, found) {
72
- var DESCRIBE_EXPECTATION_FNS = {
73
- literal: function(expectation) {
74
- return "\"" + literalEscape(expectation.text) + "\"";
75
- },
49
+ static buildMessage(expected, found) {
50
+ function hex(ch) {
51
+ return ch.codePointAt(0).toString(16).toUpperCase();
52
+ }
76
53
 
77
- class: function(expectation) {
78
- var escapedParts = expectation.parts.map(function(part) {
79
- return Array.isArray(part)
80
- ? classEscape(part[0]) + "-" + classEscape(part[1])
81
- : classEscape(part);
82
- });
54
+ const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode")
55
+ ? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu")
56
+ : null;
57
+ function unicodeEscape(s) {
58
+ if (nonPrintable) {
59
+ return s.replace(nonPrintable, ch => "\\u{" + hex(ch) + "}");
60
+ }
61
+ return s;
62
+ }
83
63
 
84
- return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
85
- },
64
+ function literalEscape(s) {
65
+ return unicodeEscape(s
66
+ .replace(/\\/g, "\\\\")
67
+ .replace(/"/g, "\\\"")
68
+ .replace(/\0/g, "\\0")
69
+ .replace(/\t/g, "\\t")
70
+ .replace(/\n/g, "\\n")
71
+ .replace(/\r/g, "\\r")
72
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
73
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
74
+ }
86
75
 
87
- any: function() {
88
- return "any character";
89
- },
76
+ function classEscape(s) {
77
+ return unicodeEscape(s
78
+ .replace(/\\/g, "\\\\")
79
+ .replace(/\]/g, "\\]")
80
+ .replace(/\^/g, "\\^")
81
+ .replace(/-/g, "\\-")
82
+ .replace(/\0/g, "\\0")
83
+ .replace(/\t/g, "\\t")
84
+ .replace(/\n/g, "\\n")
85
+ .replace(/\r/g, "\\r")
86
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
87
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
88
+ }
90
89
 
91
- end: function() {
92
- return "end of input";
93
- },
90
+ const DESCRIBE_EXPECTATION_FNS = {
91
+ literal(expectation) {
92
+ return "\"" + literalEscape(expectation.text) + "\"";
93
+ },
94
94
 
95
- other: function(expectation) {
96
- return expectation.description;
97
- }
98
- };
95
+ class(expectation) {
96
+ const escapedParts = expectation.parts.map(
97
+ part => (Array.isArray(part)
98
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
99
+ : classEscape(part))
100
+ );
99
101
 
100
- function hex(ch) {
101
- return ch.charCodeAt(0).toString(16).toUpperCase();
102
- }
102
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]" + (expectation.unicode ? "u" : "");
103
+ },
103
104
 
104
- function literalEscape(s) {
105
- return s
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
- }
105
+ any() {
106
+ return "any character";
107
+ },
115
108
 
116
- function classEscape(s) {
117
- return s
118
- .replace(/\\/g, "\\\\")
119
- .replace(/\]/g, "\\]")
120
- .replace(/\^/g, "\\^")
121
- .replace(/-/g, "\\-")
122
- .replace(/\0/g, "\\0")
123
- .replace(/\t/g, "\\t")
124
- .replace(/\n/g, "\\n")
125
- .replace(/\r/g, "\\r")
126
- .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
127
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
128
- }
109
+ end() {
110
+ return "end of input";
111
+ },
129
112
 
130
- function describeExpectation(expectation) {
131
- return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
132
- }
113
+ other(expectation) {
114
+ return expectation.description;
115
+ },
116
+ };
133
117
 
134
- function describeExpected(expected) {
135
- var descriptions = expected.map(describeExpectation);
136
- var i, j;
118
+ function describeExpectation(expectation) {
119
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
120
+ }
137
121
 
138
- descriptions.sort();
122
+ function describeExpected(expected) {
123
+ const descriptions = expected.map(describeExpectation);
124
+ descriptions.sort();
139
125
 
140
- if (descriptions.length > 0) {
141
- for (i = 1, j = 1; i < descriptions.length; i++) {
142
- if (descriptions[i - 1] !== descriptions[i]) {
143
- descriptions[j] = descriptions[i];
144
- j++;
126
+ if (descriptions.length > 0) {
127
+ let j = 1;
128
+ for (let i = 1; i < descriptions.length; i++) {
129
+ if (descriptions[i - 1] !== descriptions[i]) {
130
+ descriptions[j] = descriptions[i];
131
+ j++;
132
+ }
145
133
  }
134
+ descriptions.length = j;
146
135
  }
147
- descriptions.length = j;
148
- }
149
136
 
150
- switch (descriptions.length) {
151
- case 1:
152
- return descriptions[0];
137
+ switch (descriptions.length) {
138
+ case 1:
139
+ return descriptions[0];
153
140
 
154
- case 2:
155
- return descriptions[0] + " or " + descriptions[1];
141
+ case 2:
142
+ return descriptions[0] + " or " + descriptions[1];
156
143
 
157
- default:
158
- return descriptions.slice(0, -1).join(", ")
159
- + ", or "
160
- + descriptions[descriptions.length - 1];
144
+ default:
145
+ return descriptions.slice(0, -1).join(", ")
146
+ + ", or "
147
+ + descriptions[descriptions.length - 1];
148
+ }
161
149
  }
162
- }
163
150
 
164
- function describeFound(found) {
165
- return found ? "\"" + literalEscape(found) + "\"" : "end of input";
166
- }
151
+ function describeFound(found) {
152
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
153
+ }
167
154
 
168
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
169
- };
155
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
156
+ }
157
+ }
170
158
 
171
159
  function peg$parse(input, options) {
172
160
  options = options !== undefined ? options : {};
173
161
 
174
- var peg$FAILED = {};
175
- var peg$source = options.grammarSource;
176
-
177
- var peg$startRuleFunctions = { start: peg$parsestart };
178
- var peg$startRuleFunction = peg$parsestart;
179
-
180
- var peg$c0 = "#!";
181
- var peg$c1 = "!";
182
- var peg$c2 = ":";
183
- var peg$c3 = "\"";
184
- var peg$c4 = "'";
185
- var peg$c5 = "`";
186
- var peg$c6 = "\\\"";
187
- var peg$c7 = "\\'";
188
- var peg$c8 = "\\`";
189
- var peg$c9 = "0x";
190
- var peg$c10 = "\\\\";
191
- var peg$c11 = "\\r";
192
- var peg$c12 = "\\n";
193
- var peg$c13 = "\\t";
194
- var peg$c14 = "\\#";
195
- var peg$c15 = "\\:";
196
- var peg$c16 = "\\ ";
197
- var peg$c17 = "#";
198
- var peg$c18 = "\n";
199
- var peg$c19 = "\r\n";
200
- var peg$c20 = "\r";
201
-
202
- var peg$r0 = /^[^\\"]/;
203
- var peg$r1 = /^[^\\']/;
204
- var peg$r2 = /^[^\\`]/;
205
- var peg$r3 = /^[a-fA-F0-9]/;
206
- var peg$r4 = /^[^ #:'"\t\r\n]/;
207
- var peg$r5 = /^[^\r\n]/;
208
- var peg$r6 = /^[ \t]/;
209
- var peg$r7 = /^[ \t\r\n]/;
210
-
211
- var peg$e0 = peg$literalExpectation("#!", false);
212
- var peg$e1 = peg$literalExpectation("!", false);
213
- var peg$e2 = peg$literalExpectation(":", false);
214
- var peg$e3 = peg$literalExpectation("\"", false);
215
- var peg$e4 = peg$literalExpectation("'", false);
216
- var peg$e5 = peg$literalExpectation("`", false);
217
- var peg$e6 = peg$otherExpectation("characters that go inside double quotes, including escaped dquotes");
218
- var peg$e7 = peg$literalExpectation("\\\"", false);
219
- var peg$e8 = peg$classExpectation(["\\", "\""], true, false);
220
- var peg$e9 = peg$otherExpectation("characters that go inside single quotes, including escaped squotes");
221
- var peg$e10 = peg$literalExpectation("\\'", false);
222
- var peg$e11 = peg$classExpectation(["\\", "'"], true, false);
223
- var peg$e12 = peg$otherExpectation("characters that go inside back quotes, including escaped bquotes");
224
- var peg$e13 = peg$literalExpectation("\\`", false);
225
- var peg$e14 = peg$classExpectation(["\\", "`"], true, false);
226
- var peg$e15 = peg$literalExpectation("0x", false);
227
- var peg$e16 = peg$classExpectation([["a", "f"], ["A", "F"], ["0", "9"]], false, false);
228
- var peg$e17 = peg$otherExpectation("words can contain quoted bits");
229
- var peg$e18 = peg$classExpectation([" ", "#", ":", "'", "\"", "\t", "\r", "\n"], true, false);
230
- var peg$e19 = peg$otherExpectation("other quoted characters, as needed");
231
- var peg$e20 = peg$literalExpectation("\\\\", false);
232
- var peg$e21 = peg$literalExpectation("\\r", false);
233
- var peg$e22 = peg$literalExpectation("\\n", false);
234
- var peg$e23 = peg$literalExpectation("\\t", false);
235
- var peg$e24 = peg$literalExpectation("\\#", false);
236
- var peg$e25 = peg$literalExpectation("\\:", false);
237
- var peg$e26 = peg$literalExpectation("\\ ", false);
238
- var peg$e27 = peg$literalExpectation("#", false);
239
- var peg$e28 = peg$classExpectation(["\r", "\n"], true, false);
240
- var peg$e29 = peg$otherExpectation("optional whitespace");
241
- var peg$e30 = peg$classExpectation([" ", "\t"], false, false);
242
- var peg$e31 = peg$otherExpectation("optional whitespace, including newlines");
243
- var peg$e32 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false);
244
- var peg$e33 = peg$otherExpectation("required whitespace");
245
- var peg$e34 = peg$otherExpectation("End of line");
246
- var peg$e35 = peg$literalExpectation("\n", false);
247
- var peg$e36 = peg$literalExpectation("\r\n", false);
248
- var peg$e37 = peg$literalExpectation("\r", false);
249
-
250
- var peg$f0 = function(all) {
251
- const vars = mapObj(all.filter(t => t && t.hasOwnProperty('name')),
252
- ({name, ...rest}) => [name, rest])
253
- return {
254
- tests: all.filter(t => t && t.hasOwnProperty('expected')),
255
- vars
256
- }
162
+ const peg$FAILED = {};
163
+ const peg$source = options.grammarSource;
164
+
165
+ const peg$startRuleFunctions = {
166
+ start: peg$parsestart,
257
167
  };
258
- var peg$f1 = function(env, name, value) {
259
- value.name = name;
168
+ let peg$startRuleFunction = peg$parsestart;
169
+
170
+ const peg$c0 = "#!";
171
+ const peg$c1 = "!";
172
+ const peg$c2 = ":";
173
+ const peg$c3 = "\"";
174
+ const peg$c4 = "'";
175
+ const peg$c5 = "`";
176
+ const peg$c6 = "\\\"";
177
+ const peg$c7 = "\\'";
178
+ const peg$c8 = "\\`";
179
+ const peg$c9 = "0x";
180
+ const peg$c10 = "\\\\";
181
+ const peg$c11 = "\\r";
182
+ const peg$c12 = "\\n";
183
+ const peg$c13 = "\\t";
184
+ const peg$c14 = "\\#";
185
+ const peg$c15 = "\\:";
186
+ const peg$c16 = "\\ ";
187
+ const peg$c17 = "#";
188
+ const peg$c18 = "\n";
189
+ const peg$c19 = "\r\n";
190
+ const peg$c20 = "\r";
191
+
192
+ const peg$r0 = /^[^\\"]/;
193
+ const peg$r1 = /^[^\\']/;
194
+ const peg$r2 = /^[^\\`]/;
195
+ const peg$r3 = /^[a-fA-F0-9]/;
196
+ const peg$r4 = /^[^ #:'"\t\r\n]/;
197
+ const peg$r5 = /^[^\r\n]/;
198
+ const peg$r6 = /^[ \t]/;
199
+ const peg$r7 = /^[ \t\r\n]/;
200
+
201
+ const peg$e0 = peg$literalExpectation("#!", false);
202
+ const peg$e1 = peg$literalExpectation("!", false);
203
+ const peg$e2 = peg$literalExpectation(":", false);
204
+ const peg$e3 = peg$literalExpectation("\"", false);
205
+ const peg$e4 = peg$literalExpectation("'", false);
206
+ const peg$e5 = peg$literalExpectation("`", false);
207
+ const peg$e6 = peg$otherExpectation("characters that go inside double quotes, including escaped dquotes");
208
+ const peg$e7 = peg$literalExpectation("\\\"", false);
209
+ const peg$e8 = peg$classExpectation(["\\", "\""], true, false, false);
210
+ const peg$e9 = peg$otherExpectation("characters that go inside single quotes, including escaped squotes");
211
+ const peg$e10 = peg$literalExpectation("\\'", false);
212
+ const peg$e11 = peg$classExpectation(["\\", "'"], true, false, false);
213
+ const peg$e12 = peg$otherExpectation("characters that go inside back quotes, including escaped bquotes");
214
+ const peg$e13 = peg$literalExpectation("\\`", false);
215
+ const peg$e14 = peg$classExpectation(["\\", "`"], true, false, false);
216
+ const peg$e15 = peg$literalExpectation("0x", false);
217
+ const peg$e16 = peg$classExpectation([["a", "f"], ["A", "F"], ["0", "9"]], false, false, false);
218
+ const peg$e17 = peg$otherExpectation("words can contain quoted bits");
219
+ const peg$e18 = peg$classExpectation([" ", "#", ":", "'", "\"", "\t", "\r", "\n"], true, false, false);
220
+ const peg$e19 = peg$otherExpectation("other quoted characters, as needed");
221
+ const peg$e20 = peg$literalExpectation("\\\\", false);
222
+ const peg$e21 = peg$literalExpectation("\\r", false);
223
+ const peg$e22 = peg$literalExpectation("\\n", false);
224
+ const peg$e23 = peg$literalExpectation("\\t", false);
225
+ const peg$e24 = peg$literalExpectation("\\#", false);
226
+ const peg$e25 = peg$literalExpectation("\\:", false);
227
+ const peg$e26 = peg$literalExpectation("\\ ", false);
228
+ const peg$e27 = peg$literalExpectation("#", false);
229
+ const peg$e28 = peg$classExpectation(["\r", "\n"], true, false, false);
230
+ const peg$e29 = peg$classExpectation([" ", "\t"], false, false, false);
231
+ const peg$e30 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false);
232
+ const peg$e31 = peg$otherExpectation("required whitespace");
233
+ const peg$e32 = peg$otherExpectation("End of line");
234
+ const peg$e33 = peg$literalExpectation("\n", false);
235
+ const peg$e34 = peg$literalExpectation("\r\n", false);
236
+ const peg$e35 = peg$literalExpectation("\r", false);
237
+
238
+ function peg$f0(all) {
239
+ return all.filter(t => t && t.hasOwnProperty('expected'));
240
+ }
241
+ function peg$f1(env, name, value) {
242
+ if (!value) {
243
+ const start = location().start;
244
+ value = {
245
+ value: undefined,
246
+ line: start.line,
247
+ column: start.column,
248
+ }
249
+ }
260
250
  value.env = Boolean(env);
261
- return value;
262
- };
263
- var peg$f2 = function(value) {
251
+ vars = {
252
+ ...vars,
253
+ [name]: value
254
+ }
255
+ }
256
+ function peg$f2(value) {
264
257
  const start = location().start;
265
258
  return { value, line: start.line, column: start.column}
266
- };
267
- var peg$f3 = function(expected, inputs) {
259
+ }
260
+ function peg$f3(expected, inputs) {
268
261
  const start = location().start;
269
- return { expected, inputs, line: start.line, column: start.column }
270
- };
271
- var peg$f4 = function() { return options.EXCEPTION || "!" };
272
- var peg$f5 = function(info) { return info.join('') };
273
- var peg$f6 = function(info) { return info.join('') };
274
- var peg$f7 = function(info) { return info.join('') };
275
- var peg$f8 = function() { return '"' };
276
- var peg$f9 = function() { return "'" };
277
- var peg$f10 = function() { return "`" };
278
- var peg$f11 = function(hx) { return '0x' + hx.toLowerCase(hx) };
279
- var peg$f12 = function(chars) { return chars.join('') };
280
- var peg$f13 = function() { return '\\' };
281
- var peg$f14 = function() { return '\r' };
282
- var peg$f15 = function() { return '\n' };
283
- var peg$f16 = function() { return '\t' };
284
- var peg$f17 = function() { return '#' };
285
- var peg$f18 = function() { return ':' };
286
- var peg$f19 = function() { return ' ' };
287
- var peg$f20 = function() { return undefined };
288
- var peg$f21 = function() { return undefined };
289
- var peg$f22 = function() { return undefined};
290
- var peg$f23 = function() { return undefined };
291
- var peg$currPos = 0;
292
- var peg$savedPos = 0;
293
- var peg$posDetailsCache = [{ line: 1, column: 1 }];
294
- var peg$maxFailPos = 0;
295
- var peg$maxFailExpected = [];
296
- var peg$silentFails = 0;
297
-
298
- var peg$result;
299
-
300
- if ("startRule" in options) {
262
+ return { expected, inputs, vars, line: start.line, column: start.column }
263
+ }
264
+ function peg$f4() { return options.EXCEPTION || "!" }
265
+ function peg$f5(info) { return info.join('') }
266
+ function peg$f6(info) { return info.join('') }
267
+ function peg$f7(info) { return info.join('') }
268
+ function peg$f8() { return '"' }
269
+ function peg$f9() { return "'" }
270
+ function peg$f10() { return "`" }
271
+ function peg$f11(hx) { return '0x' + hx.toLowerCase(hx) }
272
+ function peg$f12(chars) { return chars.join('') }
273
+ function peg$f13() { return '\\' }
274
+ function peg$f14() { return '\r' }
275
+ function peg$f15() { return '\n' }
276
+ function peg$f16() { return '\t' }
277
+ function peg$f17() { return '#' }
278
+ function peg$f18() { return ':' }
279
+ function peg$f19() { return ' ' }
280
+ function peg$f20() { return undefined }
281
+ function peg$f21() { return undefined }
282
+ function peg$f22() { return undefined }
283
+ function peg$f23() { return undefined }
284
+ let peg$currPos = options.peg$currPos | 0;
285
+ let peg$savedPos = peg$currPos;
286
+ const peg$posDetailsCache = [{ line: 1, column: 1 }];
287
+ let peg$maxFailPos = peg$currPos;
288
+ let peg$maxFailExpected = options.peg$maxFailExpected || [];
289
+ let peg$silentFails = options.peg$silentFails | 0;
290
+
291
+ let peg$result;
292
+
293
+ if (options.startRule) {
301
294
  if (!(options.startRule in peg$startRuleFunctions)) {
302
295
  throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
303
296
  }
@@ -317,7 +310,7 @@ function peg$parse(input, options) {
317
310
  return {
318
311
  source: peg$source,
319
312
  start: peg$savedPos,
320
- end: peg$currPos
313
+ end: peg$currPos,
321
314
  };
322
315
  }
323
316
 
@@ -345,12 +338,20 @@ function peg$parse(input, options) {
345
338
  throw peg$buildSimpleError(message, location);
346
339
  }
347
340
 
341
+ function peg$getUnicode(pos = peg$currPos) {
342
+ const cp = input.codePointAt(pos);
343
+ if (cp === undefined) {
344
+ return "";
345
+ }
346
+ return String.fromCodePoint(cp);
347
+ }
348
+
348
349
  function peg$literalExpectation(text, ignoreCase) {
349
- return { type: "literal", text: text, ignoreCase: ignoreCase };
350
+ return { type: "literal", text, ignoreCase };
350
351
  }
351
352
 
352
- function peg$classExpectation(parts, inverted, ignoreCase) {
353
- return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
353
+ function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
354
+ return { type: "class", parts, inverted, ignoreCase, unicode };
354
355
  }
355
356
 
356
357
  function peg$anyExpectation() {
@@ -362,25 +363,27 @@ function peg$parse(input, options) {
362
363
  }
363
364
 
364
365
  function peg$otherExpectation(description) {
365
- return { type: "other", description: description };
366
+ return { type: "other", description };
366
367
  }
367
368
 
368
369
  function peg$computePosDetails(pos) {
369
- var details = peg$posDetailsCache[pos];
370
- var p;
370
+ let details = peg$posDetailsCache[pos];
371
+ let p;
371
372
 
372
373
  if (details) {
373
374
  return details;
374
375
  } else {
375
- p = pos - 1;
376
- while (!peg$posDetailsCache[p]) {
377
- p--;
376
+ if (pos >= peg$posDetailsCache.length) {
377
+ p = peg$posDetailsCache.length - 1;
378
+ } else {
379
+ p = pos;
380
+ while (!peg$posDetailsCache[--p]) {}
378
381
  }
379
382
 
380
383
  details = peg$posDetailsCache[p];
381
384
  details = {
382
385
  line: details.line,
383
- column: details.column
386
+ column: details.column,
384
387
  };
385
388
 
386
389
  while (p < pos) {
@@ -401,21 +404,21 @@ function peg$parse(input, options) {
401
404
  }
402
405
 
403
406
  function peg$computeLocation(startPos, endPos, offset) {
404
- var startPosDetails = peg$computePosDetails(startPos);
405
- var endPosDetails = peg$computePosDetails(endPos);
407
+ const startPosDetails = peg$computePosDetails(startPos);
408
+ const endPosDetails = peg$computePosDetails(endPos);
406
409
 
407
- var res = {
410
+ const res = {
408
411
  source: peg$source,
409
412
  start: {
410
413
  offset: startPos,
411
414
  line: startPosDetails.line,
412
- column: startPosDetails.column
415
+ column: startPosDetails.column,
413
416
  },
414
417
  end: {
415
418
  offset: endPos,
416
419
  line: endPosDetails.line,
417
- column: endPosDetails.column
418
- }
420
+ column: endPosDetails.column,
421
+ },
419
422
  };
420
423
  if (offset && peg$source && (typeof peg$source.offset === "function")) {
421
424
  res.start = peg$source.offset(res.start);
@@ -449,7 +452,7 @@ function peg$parse(input, options) {
449
452
  }
450
453
 
451
454
  function peg$parsestart() {
452
- var s0, s1, s2, s3, s4, s5, s6;
455
+ let s0, s1, s2, s3, s4, s5, s6;
453
456
 
454
457
  s0 = peg$currPos;
455
458
  s1 = [];
@@ -487,7 +490,7 @@ function peg$parse(input, options) {
487
490
  }
488
491
 
489
492
  function peg$parseline() {
490
- var s0;
493
+ let s0;
491
494
 
492
495
  s0 = peg$parsevar();
493
496
  if (s0 === peg$FAILED) {
@@ -504,7 +507,7 @@ function peg$parse(input, options) {
504
507
  }
505
508
 
506
509
  function peg$parsevar() {
507
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
510
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
508
511
 
509
512
  s0 = peg$currPos;
510
513
  if (input.substr(peg$currPos, 2) === peg$c0) {
@@ -538,15 +541,20 @@ function peg$parse(input, options) {
538
541
  }
539
542
  if (s6 !== peg$FAILED) {
540
543
  s7 = peg$parse_();
541
- s8 = peg$parseval();
542
- if (s8 !== peg$FAILED) {
543
- s9 = peg$parse_();
544
- peg$savedPos = s0;
545
- s0 = peg$f1(s2, s4, s8);
544
+ s8 = peg$currPos;
545
+ s9 = peg$parseval();
546
+ if (s9 !== peg$FAILED) {
547
+ s10 = peg$parse_();
548
+ s8 = s9;
546
549
  } else {
547
- peg$currPos = s0;
548
- s0 = peg$FAILED;
550
+ peg$currPos = s8;
551
+ s8 = peg$FAILED;
552
+ }
553
+ if (s8 === peg$FAILED) {
554
+ s8 = null;
549
555
  }
556
+ peg$savedPos = s0;
557
+ s0 = peg$f1(s2, s4, s8);
550
558
  } else {
551
559
  peg$currPos = s0;
552
560
  s0 = peg$FAILED;
@@ -564,7 +572,7 @@ function peg$parse(input, options) {
564
572
  }
565
573
 
566
574
  function peg$parseval() {
567
- var s0, s1;
575
+ let s0, s1;
568
576
 
569
577
  s0 = peg$currPos;
570
578
  s1 = peg$parsechunk();
@@ -578,7 +586,7 @@ function peg$parse(input, options) {
578
586
  }
579
587
 
580
588
  function peg$parsetest() {
581
- var s0, s1, s2, s3, s4, s5;
589
+ let s0, s1, s2, s3, s4, s5;
582
590
 
583
591
  s0 = peg$currPos;
584
592
  s1 = peg$parseresults();
@@ -630,7 +638,7 @@ function peg$parse(input, options) {
630
638
  }
631
639
 
632
640
  function peg$parseresults() {
633
- var s0, s1;
641
+ let s0, s1;
634
642
 
635
643
  s0 = peg$currPos;
636
644
  if (input.charCodeAt(peg$currPos) === 33) {
@@ -653,7 +661,7 @@ function peg$parse(input, options) {
653
661
  }
654
662
 
655
663
  function peg$parsechunk() {
656
- var s0;
664
+ let s0;
657
665
 
658
666
  s0 = peg$parsequoted();
659
667
  if (s0 === peg$FAILED) {
@@ -667,7 +675,7 @@ function peg$parse(input, options) {
667
675
  }
668
676
 
669
677
  function peg$parsequoted() {
670
- var s0, s1, s2, s3;
678
+ let s0, s1, s2, s3;
671
679
 
672
680
  s0 = peg$currPos;
673
681
  if (input.charCodeAt(peg$currPos) === 34) {
@@ -777,7 +785,7 @@ function peg$parse(input, options) {
777
785
  }
778
786
 
779
787
  function peg$parsedqchar() {
780
- var s0, s1, s2;
788
+ let s0, s1, s2;
781
789
 
782
790
  peg$silentFails++;
783
791
  s0 = peg$currPos;
@@ -798,8 +806,8 @@ function peg$parse(input, options) {
798
806
  if (s0 === peg$FAILED) {
799
807
  s0 = peg$currPos;
800
808
  s1 = [];
801
- if (peg$r0.test(input.charAt(peg$currPos))) {
802
- s2 = input.charAt(peg$currPos);
809
+ s2 = input.charAt(peg$currPos);
810
+ if (peg$r0.test(s2)) {
803
811
  peg$currPos++;
804
812
  } else {
805
813
  s2 = peg$FAILED;
@@ -808,8 +816,8 @@ function peg$parse(input, options) {
808
816
  if (s2 !== peg$FAILED) {
809
817
  while (s2 !== peg$FAILED) {
810
818
  s1.push(s2);
811
- if (peg$r0.test(input.charAt(peg$currPos))) {
812
- s2 = input.charAt(peg$currPos);
819
+ s2 = input.charAt(peg$currPos);
820
+ if (peg$r0.test(s2)) {
813
821
  peg$currPos++;
814
822
  } else {
815
823
  s2 = peg$FAILED;
@@ -836,7 +844,7 @@ function peg$parse(input, options) {
836
844
  }
837
845
 
838
846
  function peg$parsesqchar() {
839
- var s0, s1, s2;
847
+ let s0, s1, s2;
840
848
 
841
849
  peg$silentFails++;
842
850
  s0 = peg$currPos;
@@ -857,8 +865,8 @@ function peg$parse(input, options) {
857
865
  if (s0 === peg$FAILED) {
858
866
  s0 = peg$currPos;
859
867
  s1 = [];
860
- if (peg$r1.test(input.charAt(peg$currPos))) {
861
- s2 = input.charAt(peg$currPos);
868
+ s2 = input.charAt(peg$currPos);
869
+ if (peg$r1.test(s2)) {
862
870
  peg$currPos++;
863
871
  } else {
864
872
  s2 = peg$FAILED;
@@ -867,8 +875,8 @@ function peg$parse(input, options) {
867
875
  if (s2 !== peg$FAILED) {
868
876
  while (s2 !== peg$FAILED) {
869
877
  s1.push(s2);
870
- if (peg$r1.test(input.charAt(peg$currPos))) {
871
- s2 = input.charAt(peg$currPos);
878
+ s2 = input.charAt(peg$currPos);
879
+ if (peg$r1.test(s2)) {
872
880
  peg$currPos++;
873
881
  } else {
874
882
  s2 = peg$FAILED;
@@ -895,7 +903,7 @@ function peg$parse(input, options) {
895
903
  }
896
904
 
897
905
  function peg$parsebqchar() {
898
- var s0, s1, s2;
906
+ let s0, s1, s2;
899
907
 
900
908
  peg$silentFails++;
901
909
  s0 = peg$currPos;
@@ -916,8 +924,8 @@ function peg$parse(input, options) {
916
924
  if (s0 === peg$FAILED) {
917
925
  s0 = peg$currPos;
918
926
  s1 = [];
919
- if (peg$r2.test(input.charAt(peg$currPos))) {
920
- s2 = input.charAt(peg$currPos);
927
+ s2 = input.charAt(peg$currPos);
928
+ if (peg$r2.test(s2)) {
921
929
  peg$currPos++;
922
930
  } else {
923
931
  s2 = peg$FAILED;
@@ -926,8 +934,8 @@ function peg$parse(input, options) {
926
934
  if (s2 !== peg$FAILED) {
927
935
  while (s2 !== peg$FAILED) {
928
936
  s1.push(s2);
929
- if (peg$r2.test(input.charAt(peg$currPos))) {
930
- s2 = input.charAt(peg$currPos);
937
+ s2 = input.charAt(peg$currPos);
938
+ if (peg$r2.test(s2)) {
931
939
  peg$currPos++;
932
940
  } else {
933
941
  s2 = peg$FAILED;
@@ -954,7 +962,7 @@ function peg$parse(input, options) {
954
962
  }
955
963
 
956
964
  function peg$parsehex() {
957
- var s0, s1, s2, s3, s4;
965
+ let s0, s1, s2, s3, s4;
958
966
 
959
967
  s0 = peg$currPos;
960
968
  if (input.substr(peg$currPos, 2) === peg$c9) {
@@ -967,8 +975,8 @@ function peg$parse(input, options) {
967
975
  if (s1 !== peg$FAILED) {
968
976
  s2 = peg$currPos;
969
977
  s3 = [];
970
- if (peg$r3.test(input.charAt(peg$currPos))) {
971
- s4 = input.charAt(peg$currPos);
978
+ s4 = input.charAt(peg$currPos);
979
+ if (peg$r3.test(s4)) {
972
980
  peg$currPos++;
973
981
  } else {
974
982
  s4 = peg$FAILED;
@@ -977,8 +985,8 @@ function peg$parse(input, options) {
977
985
  if (s4 !== peg$FAILED) {
978
986
  while (s4 !== peg$FAILED) {
979
987
  s3.push(s4);
980
- if (peg$r3.test(input.charAt(peg$currPos))) {
981
- s4 = input.charAt(peg$currPos);
988
+ s4 = input.charAt(peg$currPos);
989
+ if (peg$r3.test(s4)) {
982
990
  peg$currPos++;
983
991
  } else {
984
992
  s4 = peg$FAILED;
@@ -1009,7 +1017,7 @@ function peg$parse(input, options) {
1009
1017
  }
1010
1018
 
1011
1019
  function peg$parseword() {
1012
- var s0, s1, s2;
1020
+ let s0, s1, s2;
1013
1021
 
1014
1022
  s0 = peg$currPos;
1015
1023
  s1 = [];
@@ -1032,7 +1040,7 @@ function peg$parse(input, options) {
1032
1040
  }
1033
1041
 
1034
1042
  function peg$parsewchar() {
1035
- var s0, s1, s2;
1043
+ let s0, s1, s2;
1036
1044
 
1037
1045
  peg$silentFails++;
1038
1046
  s0 = [];
@@ -1048,8 +1056,8 @@ function peg$parse(input, options) {
1048
1056
  if (s0 === peg$FAILED) {
1049
1057
  s0 = peg$currPos;
1050
1058
  s1 = [];
1051
- if (peg$r4.test(input.charAt(peg$currPos))) {
1052
- s2 = input.charAt(peg$currPos);
1059
+ s2 = input.charAt(peg$currPos);
1060
+ if (peg$r4.test(s2)) {
1053
1061
  peg$currPos++;
1054
1062
  } else {
1055
1063
  s2 = peg$FAILED;
@@ -1058,8 +1066,8 @@ function peg$parse(input, options) {
1058
1066
  if (s2 !== peg$FAILED) {
1059
1067
  while (s2 !== peg$FAILED) {
1060
1068
  s1.push(s2);
1061
- if (peg$r4.test(input.charAt(peg$currPos))) {
1062
- s2 = input.charAt(peg$currPos);
1069
+ s2 = input.charAt(peg$currPos);
1070
+ if (peg$r4.test(s2)) {
1063
1071
  peg$currPos++;
1064
1072
  } else {
1065
1073
  s2 = peg$FAILED;
@@ -1085,7 +1093,7 @@ function peg$parse(input, options) {
1085
1093
  }
1086
1094
 
1087
1095
  function peg$parseqchar() {
1088
- var s0, s1;
1096
+ let s0, s1;
1089
1097
 
1090
1098
  peg$silentFails++;
1091
1099
  s0 = peg$currPos;
@@ -1201,7 +1209,7 @@ function peg$parse(input, options) {
1201
1209
  }
1202
1210
 
1203
1211
  function peg$parsecomment() {
1204
- var s0, s1, s2, s3, s4;
1212
+ let s0, s1, s2, s3, s4, s5;
1205
1213
 
1206
1214
  s0 = peg$currPos;
1207
1215
  s1 = peg$parseWS();
@@ -1213,26 +1221,47 @@ function peg$parse(input, options) {
1213
1221
  if (peg$silentFails === 0) { peg$fail(peg$e27); }
1214
1222
  }
1215
1223
  if (s2 !== peg$FAILED) {
1216
- s3 = [];
1217
- if (peg$r5.test(input.charAt(peg$currPos))) {
1218
- s4 = input.charAt(peg$currPos);
1224
+ s3 = peg$currPos;
1225
+ peg$silentFails++;
1226
+ if (input.charCodeAt(peg$currPos) === 33) {
1227
+ s4 = peg$c1;
1219
1228
  peg$currPos++;
1220
1229
  } else {
1221
1230
  s4 = peg$FAILED;
1222
- if (peg$silentFails === 0) { peg$fail(peg$e28); }
1231
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
1223
1232
  }
1224
- while (s4 !== peg$FAILED) {
1225
- s3.push(s4);
1226
- if (peg$r5.test(input.charAt(peg$currPos))) {
1227
- s4 = input.charAt(peg$currPos);
1233
+ peg$silentFails--;
1234
+ if (s4 === peg$FAILED) {
1235
+ s3 = undefined;
1236
+ } else {
1237
+ peg$currPos = s3;
1238
+ s3 = peg$FAILED;
1239
+ }
1240
+ if (s3 !== peg$FAILED) {
1241
+ s4 = [];
1242
+ s5 = input.charAt(peg$currPos);
1243
+ if (peg$r5.test(s5)) {
1228
1244
  peg$currPos++;
1229
1245
  } else {
1230
- s4 = peg$FAILED;
1246
+ s5 = peg$FAILED;
1231
1247
  if (peg$silentFails === 0) { peg$fail(peg$e28); }
1232
1248
  }
1249
+ while (s5 !== peg$FAILED) {
1250
+ s4.push(s5);
1251
+ s5 = input.charAt(peg$currPos);
1252
+ if (peg$r5.test(s5)) {
1253
+ peg$currPos++;
1254
+ } else {
1255
+ s5 = peg$FAILED;
1256
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
1257
+ }
1258
+ }
1259
+ peg$savedPos = s0;
1260
+ s0 = peg$f20();
1261
+ } else {
1262
+ peg$currPos = s0;
1263
+ s0 = peg$FAILED;
1233
1264
  }
1234
- peg$savedPos = s0;
1235
- s0 = peg$f20();
1236
1265
  } else {
1237
1266
  peg$currPos = s0;
1238
1267
  s0 = peg$FAILED;
@@ -1242,93 +1271,89 @@ function peg$parse(input, options) {
1242
1271
  }
1243
1272
 
1244
1273
  function peg$parse_() {
1245
- var s0, s1, s2;
1274
+ let s0, s1, s2;
1246
1275
 
1247
1276
  peg$silentFails++;
1248
1277
  s0 = peg$currPos;
1249
1278
  s1 = [];
1250
- if (peg$r6.test(input.charAt(peg$currPos))) {
1251
- s2 = input.charAt(peg$currPos);
1279
+ s2 = input.charAt(peg$currPos);
1280
+ if (peg$r6.test(s2)) {
1252
1281
  peg$currPos++;
1253
1282
  } else {
1254
1283
  s2 = peg$FAILED;
1255
- if (peg$silentFails === 0) { peg$fail(peg$e30); }
1284
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
1256
1285
  }
1257
1286
  while (s2 !== peg$FAILED) {
1258
1287
  s1.push(s2);
1259
- if (peg$r6.test(input.charAt(peg$currPos))) {
1260
- s2 = input.charAt(peg$currPos);
1288
+ s2 = input.charAt(peg$currPos);
1289
+ if (peg$r6.test(s2)) {
1261
1290
  peg$currPos++;
1262
1291
  } else {
1263
1292
  s2 = peg$FAILED;
1264
- if (peg$silentFails === 0) { peg$fail(peg$e30); }
1293
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
1265
1294
  }
1266
1295
  }
1267
1296
  peg$savedPos = s0;
1268
1297
  s1 = peg$f21();
1269
1298
  s0 = s1;
1270
1299
  peg$silentFails--;
1271
- s1 = peg$FAILED;
1272
- if (peg$silentFails === 0) { peg$fail(peg$e29); }
1273
1300
 
1274
1301
  return s0;
1275
1302
  }
1276
1303
 
1277
1304
  function peg$parseWS() {
1278
- var s0, s1, s2;
1305
+ let s0, s1, s2;
1279
1306
 
1280
1307
  peg$silentFails++;
1281
1308
  s0 = peg$currPos;
1282
1309
  s1 = [];
1283
- if (peg$r7.test(input.charAt(peg$currPos))) {
1284
- s2 = input.charAt(peg$currPos);
1310
+ s2 = input.charAt(peg$currPos);
1311
+ if (peg$r7.test(s2)) {
1285
1312
  peg$currPos++;
1286
1313
  } else {
1287
1314
  s2 = peg$FAILED;
1288
- if (peg$silentFails === 0) { peg$fail(peg$e32); }
1315
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
1289
1316
  }
1290
1317
  while (s2 !== peg$FAILED) {
1291
1318
  s1.push(s2);
1292
- if (peg$r7.test(input.charAt(peg$currPos))) {
1293
- s2 = input.charAt(peg$currPos);
1319
+ s2 = input.charAt(peg$currPos);
1320
+ if (peg$r7.test(s2)) {
1294
1321
  peg$currPos++;
1295
1322
  } else {
1296
1323
  s2 = peg$FAILED;
1297
- if (peg$silentFails === 0) { peg$fail(peg$e32); }
1324
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
1298
1325
  }
1299
1326
  }
1300
1327
  peg$savedPos = s0;
1301
1328
  s1 = peg$f22();
1302
1329
  s0 = s1;
1303
1330
  peg$silentFails--;
1304
- s1 = peg$FAILED;
1305
- if (peg$silentFails === 0) { peg$fail(peg$e31); }
1306
1331
 
1307
1332
  return s0;
1308
1333
  }
1309
1334
 
1310
1335
  function peg$parseLWS() {
1311
- var s0, s1, s2;
1336
+ let s0, s1, s2;
1312
1337
 
1313
1338
  peg$silentFails++;
1314
1339
  s0 = peg$currPos;
1315
1340
  s1 = [];
1316
- if (peg$r6.test(input.charAt(peg$currPos))) {
1317
- s2 = input.charAt(peg$currPos);
1341
+ s2 = input.charAt(peg$currPos);
1342
+ if (peg$r6.test(s2)) {
1318
1343
  peg$currPos++;
1319
1344
  } else {
1320
1345
  s2 = peg$FAILED;
1321
- if (peg$silentFails === 0) { peg$fail(peg$e30); }
1346
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
1322
1347
  }
1323
1348
  if (s2 !== peg$FAILED) {
1324
1349
  while (s2 !== peg$FAILED) {
1325
1350
  s1.push(s2);
1326
- if (peg$r6.test(input.charAt(peg$currPos))) {
1327
- s2 = input.charAt(peg$currPos);
1351
+ s2 = input.charAt(peg$currPos);
1352
+ if (peg$r6.test(s2)) {
1328
1353
  peg$currPos++;
1329
1354
  } else {
1330
1355
  s2 = peg$FAILED;
1331
- if (peg$silentFails === 0) { peg$fail(peg$e30); }
1356
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
1332
1357
  }
1333
1358
  }
1334
1359
  } else {
@@ -1342,14 +1367,14 @@ function peg$parse(input, options) {
1342
1367
  peg$silentFails--;
1343
1368
  if (s0 === peg$FAILED) {
1344
1369
  s1 = peg$FAILED;
1345
- if (peg$silentFails === 0) { peg$fail(peg$e33); }
1370
+ if (peg$silentFails === 0) { peg$fail(peg$e31); }
1346
1371
  }
1347
1372
 
1348
1373
  return s0;
1349
1374
  }
1350
1375
 
1351
1376
  function peg$parseEOL() {
1352
- var s0, s1;
1377
+ let s0, s1;
1353
1378
 
1354
1379
  peg$silentFails++;
1355
1380
  if (input.charCodeAt(peg$currPos) === 10) {
@@ -1357,7 +1382,7 @@ function peg$parse(input, options) {
1357
1382
  peg$currPos++;
1358
1383
  } else {
1359
1384
  s0 = peg$FAILED;
1360
- if (peg$silentFails === 0) { peg$fail(peg$e35); }
1385
+ if (peg$silentFails === 0) { peg$fail(peg$e33); }
1361
1386
  }
1362
1387
  if (s0 === peg$FAILED) {
1363
1388
  if (input.substr(peg$currPos, 2) === peg$c19) {
@@ -1365,7 +1390,7 @@ function peg$parse(input, options) {
1365
1390
  peg$currPos += 2;
1366
1391
  } else {
1367
1392
  s0 = peg$FAILED;
1368
- if (peg$silentFails === 0) { peg$fail(peg$e36); }
1393
+ if (peg$silentFails === 0) { peg$fail(peg$e34); }
1369
1394
  }
1370
1395
  if (s0 === peg$FAILED) {
1371
1396
  if (input.charCodeAt(peg$currPos) === 13) {
@@ -1373,40 +1398,62 @@ function peg$parse(input, options) {
1373
1398
  peg$currPos++;
1374
1399
  } else {
1375
1400
  s0 = peg$FAILED;
1376
- if (peg$silentFails === 0) { peg$fail(peg$e37); }
1401
+ if (peg$silentFails === 0) { peg$fail(peg$e35); }
1377
1402
  }
1378
1403
  }
1379
1404
  }
1380
1405
  peg$silentFails--;
1381
1406
  if (s0 === peg$FAILED) {
1382
1407
  s1 = peg$FAILED;
1383
- if (peg$silentFails === 0) { peg$fail(peg$e34); }
1408
+ if (peg$silentFails === 0) { peg$fail(peg$e32); }
1384
1409
  }
1385
1410
 
1386
1411
  return s0;
1387
1412
  }
1388
1413
 
1414
+
1415
+ let vars = {};
1416
+
1389
1417
  peg$result = peg$startRuleFunction();
1390
1418
 
1391
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1392
- return peg$result;
1393
- } else {
1419
+ const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
1420
+ function peg$throw() {
1394
1421
  if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1395
1422
  peg$fail(peg$endExpectation());
1396
1423
  }
1397
1424
 
1398
1425
  throw peg$buildStructuredError(
1399
1426
  peg$maxFailExpected,
1400
- peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1427
+ peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
1401
1428
  peg$maxFailPos < input.length
1402
1429
  ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1403
1430
  : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1404
1431
  );
1405
1432
  }
1433
+ if (options.peg$library) {
1434
+ return /** @type {any} */ ({
1435
+ peg$result,
1436
+ peg$currPos,
1437
+ peg$FAILED,
1438
+ peg$maxFailExpected,
1439
+ peg$maxFailPos,
1440
+ peg$success,
1441
+ peg$throw: peg$success ? undefined : peg$throw,
1442
+ });
1443
+ }
1444
+ if (peg$success) {
1445
+ return peg$result;
1446
+ } else {
1447
+ peg$throw();
1448
+ }
1406
1449
  }
1407
1450
 
1451
+ const peg$allowedStartRules = [
1452
+ "start"
1453
+ ];
1454
+
1408
1455
  export {
1456
+ peg$allowedStartRules as StartRules,
1409
1457
  peg$SyntaxError as SyntaxError,
1410
-
1411
1458
  peg$parse as parse
1412
1459
  };