unexpectedly 0.0.6 → 1.0.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.
package/testFile.peg.js CHANGED
@@ -1,62 +1,101 @@
1
- /*
2
- * Generated by PEG.js 0.10.0.
3
- *
4
- * http://pegjs.org/
5
- */
1
+ // Generated by Peggy 3.0.2.
2
+ //
3
+ // https://peggyjs.org/
6
4
 
7
- "use strict";
5
+
6
+ import { mapObj } from './utils.js'
8
7
 
9
8
  function peg$subclass(child, parent) {
10
- function ctor() { this.constructor = child; }
11
- ctor.prototype = parent.prototype;
12
- child.prototype = new ctor();
9
+ function C() { this.constructor = child; }
10
+ C.prototype = parent.prototype;
11
+ child.prototype = new C();
13
12
  }
14
13
 
15
14
  function peg$SyntaxError(message, expected, found, location) {
16
- this.message = message;
17
- this.expected = expected;
18
- this.found = found;
19
- this.location = location;
20
- this.name = "SyntaxError";
21
-
22
- if (typeof Error.captureStackTrace === "function") {
23
- Error.captureStackTrace(this, peg$SyntaxError);
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);
24
19
  }
20
+ self.expected = expected;
21
+ self.found = found;
22
+ self.location = location;
23
+ self.name = "SyntaxError";
24
+ return self;
25
25
  }
26
26
 
27
27
  peg$subclass(peg$SyntaxError, Error);
28
28
 
29
- peg$SyntaxError.buildMessage = function(expected, found) {
30
- var DESCRIBE_EXPECTATION_FNS = {
31
- literal: function(expectation) {
32
- return "\"" + literalEscape(expectation.text) + "\"";
33
- },
34
-
35
- "class": function(expectation) {
36
- var escapedParts = "",
37
- i;
38
-
39
- for (i = 0; i < expectation.parts.length; i++) {
40
- escapedParts += expectation.parts[i] instanceof Array
41
- ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
42
- : classEscape(expectation.parts[i]);
43
- }
44
-
45
- return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
46
- },
47
-
48
- any: function(expectation) {
49
- return "any character";
50
- },
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
+ }
51
36
 
52
- end: function(expectation) {
53
- return "end of input";
54
- },
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;
46
+ }
47
+ }
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
+ }
67
+ }
68
+ return str;
69
+ };
55
70
 
56
- other: function(expectation) {
57
- return expectation.description;
58
- }
59
- };
71
+ peg$SyntaxError.buildMessage = function(expected, found) {
72
+ var DESCRIBE_EXPECTATION_FNS = {
73
+ literal: function(expectation) {
74
+ return "\"" + literalEscape(expectation.text) + "\"";
75
+ },
76
+
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
+ });
83
+
84
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
85
+ },
86
+
87
+ any: function() {
88
+ return "any character";
89
+ },
90
+
91
+ end: function() {
92
+ return "end of input";
93
+ },
94
+
95
+ other: function(expectation) {
96
+ return expectation.description;
97
+ }
98
+ };
60
99
 
61
100
  function hex(ch) {
62
101
  return ch.charCodeAt(0).toString(16).toUpperCase();
@@ -64,28 +103,28 @@ peg$SyntaxError.buildMessage = function(expected, found) {
64
103
 
65
104
  function literalEscape(s) {
66
105
  return s
67
- .replace(/\\/g, '\\\\')
68
- .replace(/"/g, '\\"')
69
- .replace(/\0/g, '\\0')
70
- .replace(/\t/g, '\\t')
71
- .replace(/\n/g, '\\n')
72
- .replace(/\r/g, '\\r')
73
- .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
74
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
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); });
75
114
  }
76
115
 
77
116
  function classEscape(s) {
78
117
  return s
79
- .replace(/\\/g, '\\\\')
80
- .replace(/\]/g, '\\]')
81
- .replace(/\^/g, '\\^')
82
- .replace(/-/g, '\\-')
83
- .replace(/\0/g, '\\0')
84
- .replace(/\t/g, '\\t')
85
- .replace(/\n/g, '\\n')
86
- .replace(/\r/g, '\\r')
87
- .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
88
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
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); });
89
128
  }
90
129
 
91
130
  function describeExpectation(expectation) {
@@ -93,12 +132,8 @@ peg$SyntaxError.buildMessage = function(expected, found) {
93
132
  }
94
133
 
95
134
  function describeExpected(expected) {
96
- var descriptions = new Array(expected.length),
97
- i, j;
98
-
99
- for (i = 0; i < expected.length; i++) {
100
- descriptions[i] = describeExpectation(expected[i]);
101
- }
135
+ var descriptions = expected.map(describeExpectation);
136
+ var i, j;
102
137
 
103
138
  descriptions.sort();
104
139
 
@@ -134,126 +169,133 @@ peg$SyntaxError.buildMessage = function(expected, found) {
134
169
  };
135
170
 
136
171
  function peg$parse(input, options) {
137
- options = options !== void 0 ? options : {};
138
-
139
- var peg$FAILED = {},
140
-
141
- peg$startRuleFunctions = { start: peg$parsestart },
142
- peg$startRuleFunction = peg$parsestart,
143
-
144
- peg$c0 = function(h) { return h },
145
- peg$c1 = function(head, l) {return l},
146
- peg$c2 = function(head, tail) {
147
- const all = list(head, tail)
148
- const vars = mapObj(all.filter(t => t && t.hasOwnProperty('name')),
149
- ({name, ...rest}) => [name, rest])
150
- return {
151
- tests: all.filter(t => t && t.hasOwnProperty('expected')),
152
- vars
153
- }
154
- },
155
- peg$c3 = "",
156
- peg$c4 = "#!",
157
- peg$c5 = peg$literalExpectation("#!", false),
158
- peg$c6 = ":",
159
- peg$c7 = peg$literalExpectation(":", false),
160
- peg$c8 = function(name, c) { return { value: c, line: location().start.line, column: location().start.column}},
161
- peg$c9 = function(name, value) {
162
- value.name = name;
163
- return value;
164
- },
165
- peg$c10 = function(expected, inp) { return inp},
166
- peg$c11 = function(expected, inputs) {
167
- return { expected, inputs, line: location().start.line }
168
- },
169
- peg$c12 = "!",
170
- peg$c13 = peg$literalExpectation("!", false),
171
- peg$c14 = function() { return options.EXCEPTION || "!" },
172
- peg$c15 = "\"",
173
- peg$c16 = peg$literalExpectation("\"", false),
174
- peg$c17 = function(info) { return info.join('') },
175
- peg$c18 = "'",
176
- peg$c19 = peg$literalExpectation("'", false),
177
- peg$c20 = "`",
178
- peg$c21 = peg$literalExpectation("`", false),
179
- peg$c22 = peg$otherExpectation("characters that go inside double quotes, including escaped dquotes"),
180
- peg$c23 = "\\\"",
181
- peg$c24 = peg$literalExpectation("\\\"", false),
182
- peg$c25 = function() { return '"' },
183
- peg$c26 = /^[^\\"]/,
184
- peg$c27 = peg$classExpectation(["\\", "\""], true, false),
185
- peg$c28 = peg$otherExpectation("characters that go inside single quotes, including escaped squotes"),
186
- peg$c29 = "\\'",
187
- peg$c30 = peg$literalExpectation("\\'", false),
188
- peg$c31 = function() { return "'" },
189
- peg$c32 = /^[^\\']/,
190
- peg$c33 = peg$classExpectation(["\\", "'"], true, false),
191
- peg$c34 = peg$otherExpectation("characters that go inside back quotes, including escaped bquotes"),
192
- peg$c35 = "\\`",
193
- peg$c36 = peg$literalExpectation("\\`", false),
194
- peg$c37 = function() { return "`" },
195
- peg$c38 = /^[^\\`]/,
196
- peg$c39 = peg$classExpectation(["\\", "`"], true, false),
197
- peg$c40 = "0x",
198
- peg$c41 = peg$literalExpectation("0x", false),
199
- peg$c42 = /^[a-fA-F0-9]/,
200
- peg$c43 = peg$classExpectation([["a", "f"], ["A", "F"], ["0", "9"]], false, false),
201
- peg$c44 = function(hx) { return '0x' + hx.toLowerCase(hx) },
202
- peg$c45 = function(chars) { return chars.join('') },
203
- peg$c46 = peg$otherExpectation("words can contain quoted bits"),
204
- peg$c47 = /^[^ #:'"\t\r\n]/,
205
- peg$c48 = peg$classExpectation([" ", "#", ":", "'", "\"", "\t", "\r", "\n"], true, false),
206
- peg$c49 = peg$otherExpectation("other quoted characters, as needed"),
207
- peg$c50 = "\\\\",
208
- peg$c51 = peg$literalExpectation("\\\\", false),
209
- peg$c52 = function() { return '\\' },
210
- peg$c53 = "\\r",
211
- peg$c54 = peg$literalExpectation("\\r", false),
212
- peg$c55 = function() { return '\r' },
213
- peg$c56 = "\\n",
214
- peg$c57 = peg$literalExpectation("\\n", false),
215
- peg$c58 = function() { return '\n' },
216
- peg$c59 = "\\t",
217
- peg$c60 = peg$literalExpectation("\\t", false),
218
- peg$c61 = function() { return '\t' },
219
- peg$c62 = "\\#",
220
- peg$c63 = peg$literalExpectation("\\#", false),
221
- peg$c64 = function() { return '#' },
222
- peg$c65 = "\\:",
223
- peg$c66 = peg$literalExpectation("\\:", false),
224
- peg$c67 = function() { return ':' },
225
- peg$c68 = "\\ ",
226
- peg$c69 = peg$literalExpectation("\\ ", false),
227
- peg$c70 = function() { return ' ' },
228
- peg$c71 = "#",
229
- peg$c72 = peg$literalExpectation("#", false),
230
- peg$c73 = /^[^\r\n]/,
231
- peg$c74 = peg$classExpectation(["\r", "\n"], true, false),
232
- peg$c75 = function() { return undefined },
233
- peg$c76 = peg$otherExpectation("optional whitespace"),
234
- peg$c77 = /^[ \t]/,
235
- peg$c78 = peg$classExpectation([" ", "\t"], false, false),
236
- peg$c79 = peg$otherExpectation("optional whitespace, including newlines"),
237
- peg$c80 = /^[ \t\r\n]/,
238
- peg$c81 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false),
239
- peg$c82 = function() { return undefined},
240
- peg$c83 = peg$otherExpectation("required whitespace"),
241
- peg$c84 = peg$otherExpectation("End of line"),
242
- peg$c85 = "\n",
243
- peg$c86 = peg$literalExpectation("\n", false),
244
- peg$c87 = "\r\n",
245
- peg$c88 = peg$literalExpectation("\r\n", false),
246
- peg$c89 = "\r",
247
- peg$c90 = peg$literalExpectation("\r", false),
248
-
249
- peg$currPos = 0,
250
- peg$savedPos = 0,
251
- peg$posDetailsCache = [{ line: 1, column: 1 }],
252
- peg$maxFailPos = 0,
253
- peg$maxFailExpected = [],
254
- peg$silentFails = 0,
255
-
256
- peg$result;
172
+ options = options !== undefined ? options : {};
173
+
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
+ }
257
+ };
258
+ var peg$f1 = function(env, name, value) {
259
+ value.name = name;
260
+ value.env = Boolean(env);
261
+ return value;
262
+ };
263
+ var peg$f2 = function(value) {
264
+ const start = location().start;
265
+ return { value, line: start.line, column: start.column}
266
+ };
267
+ var peg$f3 = function(expected, inputs) {
268
+ 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;
257
299
 
258
300
  if ("startRule" in options) {
259
301
  if (!(options.startRule in peg$startRuleFunctions)) {
@@ -267,12 +309,26 @@ function peg$parse(input, options) {
267
309
  return input.substring(peg$savedPos, peg$currPos);
268
310
  }
269
311
 
312
+ function offset() {
313
+ return peg$savedPos;
314
+ }
315
+
316
+ function range() {
317
+ return {
318
+ source: peg$source,
319
+ start: peg$savedPos,
320
+ end: peg$currPos
321
+ };
322
+ }
323
+
270
324
  function location() {
271
325
  return peg$computeLocation(peg$savedPos, peg$currPos);
272
326
  }
273
327
 
274
328
  function expected(description, location) {
275
- location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
329
+ location = location !== undefined
330
+ ? location
331
+ : peg$computeLocation(peg$savedPos, peg$currPos);
276
332
 
277
333
  throw peg$buildStructuredError(
278
334
  [peg$otherExpectation(description)],
@@ -282,7 +338,9 @@ function peg$parse(input, options) {
282
338
  }
283
339
 
284
340
  function error(message, location) {
285
- location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
341
+ location = location !== undefined
342
+ ? location
343
+ : peg$computeLocation(peg$savedPos, peg$currPos);
286
344
 
287
345
  throw peg$buildSimpleError(message, location);
288
346
  }
@@ -308,7 +366,8 @@ function peg$parse(input, options) {
308
366
  }
309
367
 
310
368
  function peg$computePosDetails(pos) {
311
- var details = peg$posDetailsCache[pos], p;
369
+ var details = peg$posDetailsCache[pos];
370
+ var p;
312
371
 
313
372
  if (details) {
314
373
  return details;
@@ -320,7 +379,7 @@ function peg$parse(input, options) {
320
379
 
321
380
  details = peg$posDetailsCache[p];
322
381
  details = {
323
- line: details.line,
382
+ line: details.line,
324
383
  column: details.column
325
384
  };
326
385
 
@@ -336,26 +395,33 @@ function peg$parse(input, options) {
336
395
  }
337
396
 
338
397
  peg$posDetailsCache[pos] = details;
398
+
339
399
  return details;
340
400
  }
341
401
  }
342
402
 
343
- function peg$computeLocation(startPos, endPos) {
344
- var startPosDetails = peg$computePosDetails(startPos),
345
- endPosDetails = peg$computePosDetails(endPos);
403
+ function peg$computeLocation(startPos, endPos, offset) {
404
+ var startPosDetails = peg$computePosDetails(startPos);
405
+ var endPosDetails = peg$computePosDetails(endPos);
346
406
 
347
- return {
407
+ var res = {
408
+ source: peg$source,
348
409
  start: {
349
410
  offset: startPos,
350
- line: startPosDetails.line,
411
+ line: startPosDetails.line,
351
412
  column: startPosDetails.column
352
413
  },
353
414
  end: {
354
415
  offset: endPos,
355
- line: endPosDetails.line,
416
+ line: endPosDetails.line,
356
417
  column: endPosDetails.column
357
418
  }
358
419
  };
420
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
421
+ res.start = peg$source.offset(res.start);
422
+ res.end = peg$source.offset(res.end);
423
+ }
424
+ return res;
359
425
  }
360
426
 
361
427
  function peg$fail(expected) {
@@ -383,107 +449,39 @@ function peg$parse(input, options) {
383
449
  }
384
450
 
385
451
  function peg$parsestart() {
386
- var s0, s1, s2, s3, s4, s5, s6, s7;
452
+ var s0, s1, s2, s3, s4, s5, s6;
387
453
 
388
454
  s0 = peg$currPos;
389
- s1 = peg$currPos;
390
- s2 = peg$parseWS();
391
- if (s2 !== peg$FAILED) {
392
- s3 = peg$parseline();
393
- if (s3 === peg$FAILED) {
394
- s3 = null;
395
- }
396
- if (s3 !== peg$FAILED) {
397
- s4 = peg$parse_();
398
- if (s4 !== peg$FAILED) {
399
- peg$savedPos = s1;
400
- s2 = peg$c0(s3);
401
- s1 = s2;
402
- } else {
403
- peg$currPos = s1;
404
- s1 = peg$FAILED;
405
- }
406
- } else {
407
- peg$currPos = s1;
408
- s1 = peg$FAILED;
409
- }
410
- } else {
411
- peg$currPos = s1;
412
- s1 = peg$FAILED;
455
+ s1 = [];
456
+ s2 = peg$currPos;
457
+ s3 = peg$parseWS();
458
+ s4 = peg$parseline();
459
+ if (s4 === peg$FAILED) {
460
+ s4 = null;
413
461
  }
414
- if (s1 !== peg$FAILED) {
415
- s2 = [];
416
- s3 = peg$currPos;
417
- s4 = peg$parseEOL();
418
- if (s4 !== peg$FAILED) {
419
- s5 = peg$parseWS();
420
- if (s5 !== peg$FAILED) {
421
- s6 = peg$parseline();
422
- if (s6 !== peg$FAILED) {
423
- s7 = peg$parse_();
424
- if (s7 !== peg$FAILED) {
425
- peg$savedPos = s3;
426
- s4 = peg$c1(s1, s6);
427
- s3 = s4;
428
- } else {
429
- peg$currPos = s3;
430
- s3 = peg$FAILED;
431
- }
432
- } else {
433
- peg$currPos = s3;
434
- s3 = peg$FAILED;
435
- }
436
- } else {
437
- peg$currPos = s3;
438
- s3 = peg$FAILED;
439
- }
440
- } else {
441
- peg$currPos = s3;
442
- s3 = peg$FAILED;
443
- }
444
- while (s3 !== peg$FAILED) {
445
- s2.push(s3);
462
+ s5 = peg$parse_();
463
+ s2 = s4;
464
+ while (s2 !== peg$FAILED) {
465
+ s1.push(s2);
466
+ s2 = peg$currPos;
467
+ s3 = peg$parseEOL();
468
+ if (s3 !== peg$FAILED) {
446
469
  s3 = peg$currPos;
447
- s4 = peg$parseEOL();
448
- if (s4 !== peg$FAILED) {
449
- s5 = peg$parseWS();
450
- if (s5 !== peg$FAILED) {
451
- s6 = peg$parseline();
452
- if (s6 !== peg$FAILED) {
453
- s7 = peg$parse_();
454
- if (s7 !== peg$FAILED) {
455
- peg$savedPos = s3;
456
- s4 = peg$c1(s1, s6);
457
- s3 = s4;
458
- } else {
459
- peg$currPos = s3;
460
- s3 = peg$FAILED;
461
- }
462
- } else {
463
- peg$currPos = s3;
464
- s3 = peg$FAILED;
465
- }
466
- } else {
467
- peg$currPos = s3;
468
- s3 = peg$FAILED;
469
- }
470
- } else {
471
- peg$currPos = s3;
472
- s3 = peg$FAILED;
470
+ s4 = peg$parseWS();
471
+ s5 = peg$parseline();
472
+ if (s5 === peg$FAILED) {
473
+ s5 = null;
473
474
  }
474
- }
475
- if (s2 !== peg$FAILED) {
476
- peg$savedPos = s0;
477
- s1 = peg$c2(s1, s2);
478
- s0 = s1;
475
+ s6 = peg$parse_();
476
+ s3 = s5;
477
+ s2 = s3;
479
478
  } else {
480
- peg$currPos = s0;
481
- s0 = peg$FAILED;
479
+ s2 = s3;
482
480
  }
483
- } else {
484
- peg$currPos = s0;
485
- s0 = peg$FAILED;
486
481
  }
482
+ peg$savedPos = s0;
483
+ s1 = peg$f0(s1);
484
+ s0 = s1;
487
485
 
488
486
  return s0;
489
487
  }
@@ -497,7 +495,7 @@ function peg$parse(input, options) {
497
495
  if (s0 === peg$FAILED) {
498
496
  s0 = peg$parsetest();
499
497
  if (s0 === peg$FAILED) {
500
- s0 = peg$c3;
498
+ s0 = '';
501
499
  }
502
500
  }
503
501
  }
@@ -506,62 +504,45 @@ function peg$parse(input, options) {
506
504
  }
507
505
 
508
506
  function peg$parsevar() {
509
- var s0, s1, s2, s3, s4, s5, s6, s7, s8;
507
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
510
508
 
511
509
  s0 = peg$currPos;
512
- if (input.substr(peg$currPos, 2) === peg$c4) {
513
- s1 = peg$c4;
510
+ if (input.substr(peg$currPos, 2) === peg$c0) {
511
+ s1 = peg$c0;
514
512
  peg$currPos += 2;
515
513
  } else {
516
514
  s1 = peg$FAILED;
517
- if (peg$silentFails === 0) { peg$fail(peg$c5); }
515
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
518
516
  }
519
517
  if (s1 !== peg$FAILED) {
520
- s2 = peg$parse_();
521
- if (s2 !== peg$FAILED) {
522
- s3 = peg$parsechunk();
523
- if (s3 !== peg$FAILED) {
524
- s4 = peg$parse_();
525
- if (s4 !== peg$FAILED) {
526
- if (input.charCodeAt(peg$currPos) === 58) {
527
- s5 = peg$c6;
528
- peg$currPos++;
529
- } else {
530
- s5 = peg$FAILED;
531
- if (peg$silentFails === 0) { peg$fail(peg$c7); }
532
- }
533
- if (s5 !== peg$FAILED) {
534
- s6 = peg$parse_();
535
- if (s6 !== peg$FAILED) {
536
- s7 = peg$currPos;
537
- s8 = peg$parsechunk();
538
- if (s8 !== peg$FAILED) {
539
- peg$savedPos = s7;
540
- s8 = peg$c8(s3, s8);
541
- }
542
- s7 = s8;
543
- if (s7 !== peg$FAILED) {
544
- s8 = peg$parse_();
545
- if (s8 !== peg$FAILED) {
546
- peg$savedPos = s0;
547
- s1 = peg$c9(s3, s7);
548
- s0 = s1;
549
- } else {
550
- peg$currPos = s0;
551
- s0 = peg$FAILED;
552
- }
553
- } else {
554
- peg$currPos = s0;
555
- s0 = peg$FAILED;
556
- }
557
- } else {
558
- peg$currPos = s0;
559
- s0 = peg$FAILED;
560
- }
561
- } else {
562
- peg$currPos = s0;
563
- s0 = peg$FAILED;
564
- }
518
+ if (input.charCodeAt(peg$currPos) === 33) {
519
+ s2 = peg$c1;
520
+ peg$currPos++;
521
+ } else {
522
+ s2 = peg$FAILED;
523
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
524
+ }
525
+ if (s2 === peg$FAILED) {
526
+ s2 = null;
527
+ }
528
+ s3 = peg$parse_();
529
+ s4 = peg$parsechunk();
530
+ if (s4 !== peg$FAILED) {
531
+ s5 = peg$parse_();
532
+ if (input.charCodeAt(peg$currPos) === 58) {
533
+ s6 = peg$c2;
534
+ peg$currPos++;
535
+ } else {
536
+ s6 = peg$FAILED;
537
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
538
+ }
539
+ if (s6 !== peg$FAILED) {
540
+ 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);
565
546
  } else {
566
547
  peg$currPos = s0;
567
548
  s0 = peg$FAILED;
@@ -582,6 +563,20 @@ function peg$parse(input, options) {
582
563
  return s0;
583
564
  }
584
565
 
566
+ function peg$parseval() {
567
+ var s0, s1;
568
+
569
+ s0 = peg$currPos;
570
+ s1 = peg$parsechunk();
571
+ if (s1 !== peg$FAILED) {
572
+ peg$savedPos = s0;
573
+ s1 = peg$f2(s1);
574
+ }
575
+ s0 = s1;
576
+
577
+ return s0;
578
+ }
579
+
585
580
  function peg$parsetest() {
586
581
  var s0, s1, s2, s3, s4, s5;
587
582
 
@@ -594,9 +589,7 @@ function peg$parse(input, options) {
594
589
  if (s4 !== peg$FAILED) {
595
590
  s5 = peg$parsechunk();
596
591
  if (s5 !== peg$FAILED) {
597
- peg$savedPos = s3;
598
- s4 = peg$c10(s1, s5);
599
- s3 = s4;
592
+ s3 = s5;
600
593
  } else {
601
594
  peg$currPos = s3;
602
595
  s3 = peg$FAILED;
@@ -612,9 +605,7 @@ function peg$parse(input, options) {
612
605
  if (s4 !== peg$FAILED) {
613
606
  s5 = peg$parsechunk();
614
607
  if (s5 !== peg$FAILED) {
615
- peg$savedPos = s3;
616
- s4 = peg$c10(s1, s5);
617
- s3 = s4;
608
+ s3 = s5;
618
609
  } else {
619
610
  peg$currPos = s3;
620
611
  s3 = peg$FAILED;
@@ -624,23 +615,12 @@ function peg$parse(input, options) {
624
615
  s3 = peg$FAILED;
625
616
  }
626
617
  }
627
- if (s2 !== peg$FAILED) {
628
- s3 = peg$parsecomment();
629
- if (s3 === peg$FAILED) {
630
- s3 = null;
631
- }
632
- if (s3 !== peg$FAILED) {
633
- peg$savedPos = s0;
634
- s1 = peg$c11(s1, s2);
635
- s0 = s1;
636
- } else {
637
- peg$currPos = s0;
638
- s0 = peg$FAILED;
639
- }
640
- } else {
641
- peg$currPos = s0;
642
- s0 = peg$FAILED;
618
+ s3 = peg$parsecomment();
619
+ if (s3 === peg$FAILED) {
620
+ s3 = null;
643
621
  }
622
+ peg$savedPos = s0;
623
+ s0 = peg$f3(s1, s2);
644
624
  } else {
645
625
  peg$currPos = s0;
646
626
  s0 = peg$FAILED;
@@ -654,15 +634,15 @@ function peg$parse(input, options) {
654
634
 
655
635
  s0 = peg$currPos;
656
636
  if (input.charCodeAt(peg$currPos) === 33) {
657
- s1 = peg$c12;
637
+ s1 = peg$c1;
658
638
  peg$currPos++;
659
639
  } else {
660
640
  s1 = peg$FAILED;
661
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
641
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
662
642
  }
663
643
  if (s1 !== peg$FAILED) {
664
644
  peg$savedPos = s0;
665
- s1 = peg$c14();
645
+ s1 = peg$f4();
666
646
  }
667
647
  s0 = s1;
668
648
  if (s0 === peg$FAILED) {
@@ -691,11 +671,11 @@ function peg$parse(input, options) {
691
671
 
692
672
  s0 = peg$currPos;
693
673
  if (input.charCodeAt(peg$currPos) === 34) {
694
- s1 = peg$c15;
674
+ s1 = peg$c3;
695
675
  peg$currPos++;
696
676
  } else {
697
677
  s1 = peg$FAILED;
698
- if (peg$silentFails === 0) { peg$fail(peg$c16); }
678
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
699
679
  }
700
680
  if (s1 !== peg$FAILED) {
701
681
  s2 = [];
@@ -704,22 +684,16 @@ function peg$parse(input, options) {
704
684
  s2.push(s3);
705
685
  s3 = peg$parsedqchar();
706
686
  }
707
- if (s2 !== peg$FAILED) {
708
- if (input.charCodeAt(peg$currPos) === 34) {
709
- s3 = peg$c15;
710
- peg$currPos++;
711
- } else {
712
- s3 = peg$FAILED;
713
- if (peg$silentFails === 0) { peg$fail(peg$c16); }
714
- }
715
- if (s3 !== peg$FAILED) {
716
- peg$savedPos = s0;
717
- s1 = peg$c17(s2);
718
- s0 = s1;
719
- } else {
720
- peg$currPos = s0;
721
- s0 = peg$FAILED;
722
- }
687
+ if (input.charCodeAt(peg$currPos) === 34) {
688
+ s3 = peg$c3;
689
+ peg$currPos++;
690
+ } else {
691
+ s3 = peg$FAILED;
692
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
693
+ }
694
+ if (s3 !== peg$FAILED) {
695
+ peg$savedPos = s0;
696
+ s0 = peg$f5(s2);
723
697
  } else {
724
698
  peg$currPos = s0;
725
699
  s0 = peg$FAILED;
@@ -731,11 +705,11 @@ function peg$parse(input, options) {
731
705
  if (s0 === peg$FAILED) {
732
706
  s0 = peg$currPos;
733
707
  if (input.charCodeAt(peg$currPos) === 39) {
734
- s1 = peg$c18;
708
+ s1 = peg$c4;
735
709
  peg$currPos++;
736
710
  } else {
737
711
  s1 = peg$FAILED;
738
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
712
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
739
713
  }
740
714
  if (s1 !== peg$FAILED) {
741
715
  s2 = [];
@@ -744,22 +718,16 @@ function peg$parse(input, options) {
744
718
  s2.push(s3);
745
719
  s3 = peg$parsesqchar();
746
720
  }
747
- if (s2 !== peg$FAILED) {
748
- if (input.charCodeAt(peg$currPos) === 39) {
749
- s3 = peg$c18;
750
- peg$currPos++;
751
- } else {
752
- s3 = peg$FAILED;
753
- if (peg$silentFails === 0) { peg$fail(peg$c19); }
754
- }
755
- if (s3 !== peg$FAILED) {
756
- peg$savedPos = s0;
757
- s1 = peg$c17(s2);
758
- s0 = s1;
759
- } else {
760
- peg$currPos = s0;
761
- s0 = peg$FAILED;
762
- }
721
+ if (input.charCodeAt(peg$currPos) === 39) {
722
+ s3 = peg$c4;
723
+ peg$currPos++;
724
+ } else {
725
+ s3 = peg$FAILED;
726
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
727
+ }
728
+ if (s3 !== peg$FAILED) {
729
+ peg$savedPos = s0;
730
+ s0 = peg$f6(s2);
763
731
  } else {
764
732
  peg$currPos = s0;
765
733
  s0 = peg$FAILED;
@@ -771,11 +739,11 @@ function peg$parse(input, options) {
771
739
  if (s0 === peg$FAILED) {
772
740
  s0 = peg$currPos;
773
741
  if (input.charCodeAt(peg$currPos) === 96) {
774
- s1 = peg$c20;
742
+ s1 = peg$c5;
775
743
  peg$currPos++;
776
744
  } else {
777
745
  s1 = peg$FAILED;
778
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
746
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
779
747
  }
780
748
  if (s1 !== peg$FAILED) {
781
749
  s2 = [];
@@ -784,22 +752,16 @@ function peg$parse(input, options) {
784
752
  s2.push(s3);
785
753
  s3 = peg$parsebqchar();
786
754
  }
787
- if (s2 !== peg$FAILED) {
788
- if (input.charCodeAt(peg$currPos) === 96) {
789
- s3 = peg$c20;
790
- peg$currPos++;
791
- } else {
792
- s3 = peg$FAILED;
793
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
794
- }
795
- if (s3 !== peg$FAILED) {
796
- peg$savedPos = s0;
797
- s1 = peg$c17(s2);
798
- s0 = s1;
799
- } else {
800
- peg$currPos = s0;
801
- s0 = peg$FAILED;
802
- }
755
+ if (input.charCodeAt(peg$currPos) === 96) {
756
+ s3 = peg$c5;
757
+ peg$currPos++;
758
+ } else {
759
+ s3 = peg$FAILED;
760
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
761
+ }
762
+ if (s3 !== peg$FAILED) {
763
+ peg$savedPos = s0;
764
+ s0 = peg$f7(s2);
803
765
  } else {
804
766
  peg$currPos = s0;
805
767
  s0 = peg$FAILED;
@@ -819,16 +781,16 @@ function peg$parse(input, options) {
819
781
 
820
782
  peg$silentFails++;
821
783
  s0 = peg$currPos;
822
- if (input.substr(peg$currPos, 2) === peg$c23) {
823
- s1 = peg$c23;
784
+ if (input.substr(peg$currPos, 2) === peg$c6) {
785
+ s1 = peg$c6;
824
786
  peg$currPos += 2;
825
787
  } else {
826
788
  s1 = peg$FAILED;
827
- if (peg$silentFails === 0) { peg$fail(peg$c24); }
789
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
828
790
  }
829
791
  if (s1 !== peg$FAILED) {
830
792
  peg$savedPos = s0;
831
- s1 = peg$c25();
793
+ s1 = peg$f8();
832
794
  }
833
795
  s0 = s1;
834
796
  if (s0 === peg$FAILED) {
@@ -836,22 +798,22 @@ function peg$parse(input, options) {
836
798
  if (s0 === peg$FAILED) {
837
799
  s0 = peg$currPos;
838
800
  s1 = [];
839
- if (peg$c26.test(input.charAt(peg$currPos))) {
801
+ if (peg$r0.test(input.charAt(peg$currPos))) {
840
802
  s2 = input.charAt(peg$currPos);
841
803
  peg$currPos++;
842
804
  } else {
843
805
  s2 = peg$FAILED;
844
- if (peg$silentFails === 0) { peg$fail(peg$c27); }
806
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
845
807
  }
846
808
  if (s2 !== peg$FAILED) {
847
809
  while (s2 !== peg$FAILED) {
848
810
  s1.push(s2);
849
- if (peg$c26.test(input.charAt(peg$currPos))) {
811
+ if (peg$r0.test(input.charAt(peg$currPos))) {
850
812
  s2 = input.charAt(peg$currPos);
851
813
  peg$currPos++;
852
814
  } else {
853
815
  s2 = peg$FAILED;
854
- if (peg$silentFails === 0) { peg$fail(peg$c27); }
816
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
855
817
  }
856
818
  }
857
819
  } else {
@@ -867,7 +829,7 @@ function peg$parse(input, options) {
867
829
  peg$silentFails--;
868
830
  if (s0 === peg$FAILED) {
869
831
  s1 = peg$FAILED;
870
- if (peg$silentFails === 0) { peg$fail(peg$c22); }
832
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
871
833
  }
872
834
 
873
835
  return s0;
@@ -878,16 +840,16 @@ function peg$parse(input, options) {
878
840
 
879
841
  peg$silentFails++;
880
842
  s0 = peg$currPos;
881
- if (input.substr(peg$currPos, 2) === peg$c29) {
882
- s1 = peg$c29;
843
+ if (input.substr(peg$currPos, 2) === peg$c7) {
844
+ s1 = peg$c7;
883
845
  peg$currPos += 2;
884
846
  } else {
885
847
  s1 = peg$FAILED;
886
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
848
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
887
849
  }
888
850
  if (s1 !== peg$FAILED) {
889
851
  peg$savedPos = s0;
890
- s1 = peg$c31();
852
+ s1 = peg$f9();
891
853
  }
892
854
  s0 = s1;
893
855
  if (s0 === peg$FAILED) {
@@ -895,22 +857,22 @@ function peg$parse(input, options) {
895
857
  if (s0 === peg$FAILED) {
896
858
  s0 = peg$currPos;
897
859
  s1 = [];
898
- if (peg$c32.test(input.charAt(peg$currPos))) {
860
+ if (peg$r1.test(input.charAt(peg$currPos))) {
899
861
  s2 = input.charAt(peg$currPos);
900
862
  peg$currPos++;
901
863
  } else {
902
864
  s2 = peg$FAILED;
903
- if (peg$silentFails === 0) { peg$fail(peg$c33); }
865
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
904
866
  }
905
867
  if (s2 !== peg$FAILED) {
906
868
  while (s2 !== peg$FAILED) {
907
869
  s1.push(s2);
908
- if (peg$c32.test(input.charAt(peg$currPos))) {
870
+ if (peg$r1.test(input.charAt(peg$currPos))) {
909
871
  s2 = input.charAt(peg$currPos);
910
872
  peg$currPos++;
911
873
  } else {
912
874
  s2 = peg$FAILED;
913
- if (peg$silentFails === 0) { peg$fail(peg$c33); }
875
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
914
876
  }
915
877
  }
916
878
  } else {
@@ -926,7 +888,7 @@ function peg$parse(input, options) {
926
888
  peg$silentFails--;
927
889
  if (s0 === peg$FAILED) {
928
890
  s1 = peg$FAILED;
929
- if (peg$silentFails === 0) { peg$fail(peg$c28); }
891
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
930
892
  }
931
893
 
932
894
  return s0;
@@ -937,16 +899,16 @@ function peg$parse(input, options) {
937
899
 
938
900
  peg$silentFails++;
939
901
  s0 = peg$currPos;
940
- if (input.substr(peg$currPos, 2) === peg$c35) {
941
- s1 = peg$c35;
902
+ if (input.substr(peg$currPos, 2) === peg$c8) {
903
+ s1 = peg$c8;
942
904
  peg$currPos += 2;
943
905
  } else {
944
906
  s1 = peg$FAILED;
945
- if (peg$silentFails === 0) { peg$fail(peg$c36); }
907
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
946
908
  }
947
909
  if (s1 !== peg$FAILED) {
948
910
  peg$savedPos = s0;
949
- s1 = peg$c37();
911
+ s1 = peg$f10();
950
912
  }
951
913
  s0 = s1;
952
914
  if (s0 === peg$FAILED) {
@@ -954,22 +916,22 @@ function peg$parse(input, options) {
954
916
  if (s0 === peg$FAILED) {
955
917
  s0 = peg$currPos;
956
918
  s1 = [];
957
- if (peg$c38.test(input.charAt(peg$currPos))) {
919
+ if (peg$r2.test(input.charAt(peg$currPos))) {
958
920
  s2 = input.charAt(peg$currPos);
959
921
  peg$currPos++;
960
922
  } else {
961
923
  s2 = peg$FAILED;
962
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
924
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
963
925
  }
964
926
  if (s2 !== peg$FAILED) {
965
927
  while (s2 !== peg$FAILED) {
966
928
  s1.push(s2);
967
- if (peg$c38.test(input.charAt(peg$currPos))) {
929
+ if (peg$r2.test(input.charAt(peg$currPos))) {
968
930
  s2 = input.charAt(peg$currPos);
969
931
  peg$currPos++;
970
932
  } else {
971
933
  s2 = peg$FAILED;
972
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
934
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
973
935
  }
974
936
  }
975
937
  } else {
@@ -985,7 +947,7 @@ function peg$parse(input, options) {
985
947
  peg$silentFails--;
986
948
  if (s0 === peg$FAILED) {
987
949
  s1 = peg$FAILED;
988
- if (peg$silentFails === 0) { peg$fail(peg$c34); }
950
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
989
951
  }
990
952
 
991
953
  return s0;
@@ -995,32 +957,32 @@ function peg$parse(input, options) {
995
957
  var s0, s1, s2, s3, s4;
996
958
 
997
959
  s0 = peg$currPos;
998
- if (input.substr(peg$currPos, 2) === peg$c40) {
999
- s1 = peg$c40;
960
+ if (input.substr(peg$currPos, 2) === peg$c9) {
961
+ s1 = peg$c9;
1000
962
  peg$currPos += 2;
1001
963
  } else {
1002
964
  s1 = peg$FAILED;
1003
- if (peg$silentFails === 0) { peg$fail(peg$c41); }
965
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1004
966
  }
1005
967
  if (s1 !== peg$FAILED) {
1006
968
  s2 = peg$currPos;
1007
969
  s3 = [];
1008
- if (peg$c42.test(input.charAt(peg$currPos))) {
970
+ if (peg$r3.test(input.charAt(peg$currPos))) {
1009
971
  s4 = input.charAt(peg$currPos);
1010
972
  peg$currPos++;
1011
973
  } else {
1012
974
  s4 = peg$FAILED;
1013
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
975
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1014
976
  }
1015
977
  if (s4 !== peg$FAILED) {
1016
978
  while (s4 !== peg$FAILED) {
1017
979
  s3.push(s4);
1018
- if (peg$c42.test(input.charAt(peg$currPos))) {
980
+ if (peg$r3.test(input.charAt(peg$currPos))) {
1019
981
  s4 = input.charAt(peg$currPos);
1020
982
  peg$currPos++;
1021
983
  } else {
1022
984
  s4 = peg$FAILED;
1023
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
985
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1024
986
  }
1025
987
  }
1026
988
  } else {
@@ -1033,8 +995,7 @@ function peg$parse(input, options) {
1033
995
  }
1034
996
  if (s2 !== peg$FAILED) {
1035
997
  peg$savedPos = s0;
1036
- s1 = peg$c44(s2);
1037
- s0 = s1;
998
+ s0 = peg$f11(s2);
1038
999
  } else {
1039
1000
  peg$currPos = s0;
1040
1001
  s0 = peg$FAILED;
@@ -1063,7 +1024,7 @@ function peg$parse(input, options) {
1063
1024
  }
1064
1025
  if (s1 !== peg$FAILED) {
1065
1026
  peg$savedPos = s0;
1066
- s1 = peg$c45(s1);
1027
+ s1 = peg$f12(s1);
1067
1028
  }
1068
1029
  s0 = s1;
1069
1030
 
@@ -1087,22 +1048,22 @@ function peg$parse(input, options) {
1087
1048
  if (s0 === peg$FAILED) {
1088
1049
  s0 = peg$currPos;
1089
1050
  s1 = [];
1090
- if (peg$c47.test(input.charAt(peg$currPos))) {
1051
+ if (peg$r4.test(input.charAt(peg$currPos))) {
1091
1052
  s2 = input.charAt(peg$currPos);
1092
1053
  peg$currPos++;
1093
1054
  } else {
1094
1055
  s2 = peg$FAILED;
1095
- if (peg$silentFails === 0) { peg$fail(peg$c48); }
1056
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1096
1057
  }
1097
1058
  if (s2 !== peg$FAILED) {
1098
1059
  while (s2 !== peg$FAILED) {
1099
1060
  s1.push(s2);
1100
- if (peg$c47.test(input.charAt(peg$currPos))) {
1061
+ if (peg$r4.test(input.charAt(peg$currPos))) {
1101
1062
  s2 = input.charAt(peg$currPos);
1102
1063
  peg$currPos++;
1103
1064
  } else {
1104
1065
  s2 = peg$FAILED;
1105
- if (peg$silentFails === 0) { peg$fail(peg$c48); }
1066
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1106
1067
  }
1107
1068
  }
1108
1069
  } else {
@@ -1117,7 +1078,7 @@ function peg$parse(input, options) {
1117
1078
  peg$silentFails--;
1118
1079
  if (s0 === peg$FAILED) {
1119
1080
  s1 = peg$FAILED;
1120
- if (peg$silentFails === 0) { peg$fail(peg$c46); }
1081
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1121
1082
  }
1122
1083
 
1123
1084
  return s0;
@@ -1128,100 +1089,100 @@ function peg$parse(input, options) {
1128
1089
 
1129
1090
  peg$silentFails++;
1130
1091
  s0 = peg$currPos;
1131
- if (input.substr(peg$currPos, 2) === peg$c50) {
1132
- s1 = peg$c50;
1092
+ if (input.substr(peg$currPos, 2) === peg$c10) {
1093
+ s1 = peg$c10;
1133
1094
  peg$currPos += 2;
1134
1095
  } else {
1135
1096
  s1 = peg$FAILED;
1136
- if (peg$silentFails === 0) { peg$fail(peg$c51); }
1097
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
1137
1098
  }
1138
1099
  if (s1 !== peg$FAILED) {
1139
1100
  peg$savedPos = s0;
1140
- s1 = peg$c52();
1101
+ s1 = peg$f13();
1141
1102
  }
1142
1103
  s0 = s1;
1143
1104
  if (s0 === peg$FAILED) {
1144
1105
  s0 = peg$currPos;
1145
- if (input.substr(peg$currPos, 2) === peg$c53) {
1146
- s1 = peg$c53;
1106
+ if (input.substr(peg$currPos, 2) === peg$c11) {
1107
+ s1 = peg$c11;
1147
1108
  peg$currPos += 2;
1148
1109
  } else {
1149
1110
  s1 = peg$FAILED;
1150
- if (peg$silentFails === 0) { peg$fail(peg$c54); }
1111
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
1151
1112
  }
1152
1113
  if (s1 !== peg$FAILED) {
1153
1114
  peg$savedPos = s0;
1154
- s1 = peg$c55();
1115
+ s1 = peg$f14();
1155
1116
  }
1156
1117
  s0 = s1;
1157
1118
  if (s0 === peg$FAILED) {
1158
1119
  s0 = peg$currPos;
1159
- if (input.substr(peg$currPos, 2) === peg$c56) {
1160
- s1 = peg$c56;
1120
+ if (input.substr(peg$currPos, 2) === peg$c12) {
1121
+ s1 = peg$c12;
1161
1122
  peg$currPos += 2;
1162
1123
  } else {
1163
1124
  s1 = peg$FAILED;
1164
- if (peg$silentFails === 0) { peg$fail(peg$c57); }
1125
+ if (peg$silentFails === 0) { peg$fail(peg$e22); }
1165
1126
  }
1166
1127
  if (s1 !== peg$FAILED) {
1167
1128
  peg$savedPos = s0;
1168
- s1 = peg$c58();
1129
+ s1 = peg$f15();
1169
1130
  }
1170
1131
  s0 = s1;
1171
1132
  if (s0 === peg$FAILED) {
1172
1133
  s0 = peg$currPos;
1173
- if (input.substr(peg$currPos, 2) === peg$c59) {
1174
- s1 = peg$c59;
1134
+ if (input.substr(peg$currPos, 2) === peg$c13) {
1135
+ s1 = peg$c13;
1175
1136
  peg$currPos += 2;
1176
1137
  } else {
1177
1138
  s1 = peg$FAILED;
1178
- if (peg$silentFails === 0) { peg$fail(peg$c60); }
1139
+ if (peg$silentFails === 0) { peg$fail(peg$e23); }
1179
1140
  }
1180
1141
  if (s1 !== peg$FAILED) {
1181
1142
  peg$savedPos = s0;
1182
- s1 = peg$c61();
1143
+ s1 = peg$f16();
1183
1144
  }
1184
1145
  s0 = s1;
1185
1146
  if (s0 === peg$FAILED) {
1186
1147
  s0 = peg$currPos;
1187
- if (input.substr(peg$currPos, 2) === peg$c62) {
1188
- s1 = peg$c62;
1148
+ if (input.substr(peg$currPos, 2) === peg$c14) {
1149
+ s1 = peg$c14;
1189
1150
  peg$currPos += 2;
1190
1151
  } else {
1191
1152
  s1 = peg$FAILED;
1192
- if (peg$silentFails === 0) { peg$fail(peg$c63); }
1153
+ if (peg$silentFails === 0) { peg$fail(peg$e24); }
1193
1154
  }
1194
1155
  if (s1 !== peg$FAILED) {
1195
1156
  peg$savedPos = s0;
1196
- s1 = peg$c64();
1157
+ s1 = peg$f17();
1197
1158
  }
1198
1159
  s0 = s1;
1199
1160
  if (s0 === peg$FAILED) {
1200
1161
  s0 = peg$currPos;
1201
- if (input.substr(peg$currPos, 2) === peg$c65) {
1202
- s1 = peg$c65;
1162
+ if (input.substr(peg$currPos, 2) === peg$c15) {
1163
+ s1 = peg$c15;
1203
1164
  peg$currPos += 2;
1204
1165
  } else {
1205
1166
  s1 = peg$FAILED;
1206
- if (peg$silentFails === 0) { peg$fail(peg$c66); }
1167
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
1207
1168
  }
1208
1169
  if (s1 !== peg$FAILED) {
1209
1170
  peg$savedPos = s0;
1210
- s1 = peg$c67();
1171
+ s1 = peg$f18();
1211
1172
  }
1212
1173
  s0 = s1;
1213
1174
  if (s0 === peg$FAILED) {
1214
1175
  s0 = peg$currPos;
1215
- if (input.substr(peg$currPos, 2) === peg$c68) {
1216
- s1 = peg$c68;
1176
+ if (input.substr(peg$currPos, 2) === peg$c16) {
1177
+ s1 = peg$c16;
1217
1178
  peg$currPos += 2;
1218
1179
  } else {
1219
1180
  s1 = peg$FAILED;
1220
- if (peg$silentFails === 0) { peg$fail(peg$c69); }
1181
+ if (peg$silentFails === 0) { peg$fail(peg$e26); }
1221
1182
  }
1222
1183
  if (s1 !== peg$FAILED) {
1223
1184
  peg$savedPos = s0;
1224
- s1 = peg$c70();
1185
+ s1 = peg$f19();
1225
1186
  }
1226
1187
  s0 = s1;
1227
1188
  }
@@ -1233,7 +1194,7 @@ function peg$parse(input, options) {
1233
1194
  peg$silentFails--;
1234
1195
  if (s0 === peg$FAILED) {
1235
1196
  s1 = peg$FAILED;
1236
- if (peg$silentFails === 0) { peg$fail(peg$c49); }
1197
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
1237
1198
  }
1238
1199
 
1239
1200
  return s0;
@@ -1244,45 +1205,34 @@ function peg$parse(input, options) {
1244
1205
 
1245
1206
  s0 = peg$currPos;
1246
1207
  s1 = peg$parseWS();
1247
- if (s1 !== peg$FAILED) {
1248
- if (input.charCodeAt(peg$currPos) === 35) {
1249
- s2 = peg$c71;
1208
+ if (input.charCodeAt(peg$currPos) === 35) {
1209
+ s2 = peg$c17;
1210
+ peg$currPos++;
1211
+ } else {
1212
+ s2 = peg$FAILED;
1213
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
1214
+ }
1215
+ if (s2 !== peg$FAILED) {
1216
+ s3 = [];
1217
+ if (peg$r5.test(input.charAt(peg$currPos))) {
1218
+ s4 = input.charAt(peg$currPos);
1250
1219
  peg$currPos++;
1251
1220
  } else {
1252
- s2 = peg$FAILED;
1253
- if (peg$silentFails === 0) { peg$fail(peg$c72); }
1221
+ s4 = peg$FAILED;
1222
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
1254
1223
  }
1255
- if (s2 !== peg$FAILED) {
1256
- s3 = [];
1257
- if (peg$c73.test(input.charAt(peg$currPos))) {
1224
+ while (s4 !== peg$FAILED) {
1225
+ s3.push(s4);
1226
+ if (peg$r5.test(input.charAt(peg$currPos))) {
1258
1227
  s4 = input.charAt(peg$currPos);
1259
1228
  peg$currPos++;
1260
1229
  } else {
1261
1230
  s4 = peg$FAILED;
1262
- if (peg$silentFails === 0) { peg$fail(peg$c74); }
1263
- }
1264
- while (s4 !== peg$FAILED) {
1265
- s3.push(s4);
1266
- if (peg$c73.test(input.charAt(peg$currPos))) {
1267
- s4 = input.charAt(peg$currPos);
1268
- peg$currPos++;
1269
- } else {
1270
- s4 = peg$FAILED;
1271
- if (peg$silentFails === 0) { peg$fail(peg$c74); }
1272
- }
1231
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
1273
1232
  }
1274
- if (s3 !== peg$FAILED) {
1275
- peg$savedPos = s0;
1276
- s1 = peg$c75();
1277
- s0 = s1;
1278
- } else {
1279
- peg$currPos = s0;
1280
- s0 = peg$FAILED;
1281
- }
1282
- } else {
1283
- peg$currPos = s0;
1284
- s0 = peg$FAILED;
1285
1233
  }
1234
+ peg$savedPos = s0;
1235
+ s0 = peg$f20();
1286
1236
  } else {
1287
1237
  peg$currPos = s0;
1288
1238
  s0 = peg$FAILED;
@@ -1297,33 +1247,29 @@ function peg$parse(input, options) {
1297
1247
  peg$silentFails++;
1298
1248
  s0 = peg$currPos;
1299
1249
  s1 = [];
1300
- if (peg$c77.test(input.charAt(peg$currPos))) {
1250
+ if (peg$r6.test(input.charAt(peg$currPos))) {
1301
1251
  s2 = input.charAt(peg$currPos);
1302
1252
  peg$currPos++;
1303
1253
  } else {
1304
1254
  s2 = peg$FAILED;
1305
- if (peg$silentFails === 0) { peg$fail(peg$c78); }
1255
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
1306
1256
  }
1307
1257
  while (s2 !== peg$FAILED) {
1308
1258
  s1.push(s2);
1309
- if (peg$c77.test(input.charAt(peg$currPos))) {
1259
+ if (peg$r6.test(input.charAt(peg$currPos))) {
1310
1260
  s2 = input.charAt(peg$currPos);
1311
1261
  peg$currPos++;
1312
1262
  } else {
1313
1263
  s2 = peg$FAILED;
1314
- if (peg$silentFails === 0) { peg$fail(peg$c78); }
1264
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
1315
1265
  }
1316
1266
  }
1317
- if (s1 !== peg$FAILED) {
1318
- peg$savedPos = s0;
1319
- s1 = peg$c75();
1320
- }
1267
+ peg$savedPos = s0;
1268
+ s1 = peg$f21();
1321
1269
  s0 = s1;
1322
1270
  peg$silentFails--;
1323
- if (s0 === peg$FAILED) {
1324
- s1 = peg$FAILED;
1325
- if (peg$silentFails === 0) { peg$fail(peg$c76); }
1326
- }
1271
+ s1 = peg$FAILED;
1272
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
1327
1273
 
1328
1274
  return s0;
1329
1275
  }
@@ -1334,33 +1280,29 @@ function peg$parse(input, options) {
1334
1280
  peg$silentFails++;
1335
1281
  s0 = peg$currPos;
1336
1282
  s1 = [];
1337
- if (peg$c80.test(input.charAt(peg$currPos))) {
1283
+ if (peg$r7.test(input.charAt(peg$currPos))) {
1338
1284
  s2 = input.charAt(peg$currPos);
1339
1285
  peg$currPos++;
1340
1286
  } else {
1341
1287
  s2 = peg$FAILED;
1342
- if (peg$silentFails === 0) { peg$fail(peg$c81); }
1288
+ if (peg$silentFails === 0) { peg$fail(peg$e32); }
1343
1289
  }
1344
1290
  while (s2 !== peg$FAILED) {
1345
1291
  s1.push(s2);
1346
- if (peg$c80.test(input.charAt(peg$currPos))) {
1292
+ if (peg$r7.test(input.charAt(peg$currPos))) {
1347
1293
  s2 = input.charAt(peg$currPos);
1348
1294
  peg$currPos++;
1349
1295
  } else {
1350
1296
  s2 = peg$FAILED;
1351
- if (peg$silentFails === 0) { peg$fail(peg$c81); }
1297
+ if (peg$silentFails === 0) { peg$fail(peg$e32); }
1352
1298
  }
1353
1299
  }
1354
- if (s1 !== peg$FAILED) {
1355
- peg$savedPos = s0;
1356
- s1 = peg$c82();
1357
- }
1300
+ peg$savedPos = s0;
1301
+ s1 = peg$f22();
1358
1302
  s0 = s1;
1359
1303
  peg$silentFails--;
1360
- if (s0 === peg$FAILED) {
1361
- s1 = peg$FAILED;
1362
- if (peg$silentFails === 0) { peg$fail(peg$c79); }
1363
- }
1304
+ s1 = peg$FAILED;
1305
+ if (peg$silentFails === 0) { peg$fail(peg$e31); }
1364
1306
 
1365
1307
  return s0;
1366
1308
  }
@@ -1371,22 +1313,22 @@ function peg$parse(input, options) {
1371
1313
  peg$silentFails++;
1372
1314
  s0 = peg$currPos;
1373
1315
  s1 = [];
1374
- if (peg$c77.test(input.charAt(peg$currPos))) {
1316
+ if (peg$r6.test(input.charAt(peg$currPos))) {
1375
1317
  s2 = input.charAt(peg$currPos);
1376
1318
  peg$currPos++;
1377
1319
  } else {
1378
1320
  s2 = peg$FAILED;
1379
- if (peg$silentFails === 0) { peg$fail(peg$c78); }
1321
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
1380
1322
  }
1381
1323
  if (s2 !== peg$FAILED) {
1382
1324
  while (s2 !== peg$FAILED) {
1383
1325
  s1.push(s2);
1384
- if (peg$c77.test(input.charAt(peg$currPos))) {
1326
+ if (peg$r6.test(input.charAt(peg$currPos))) {
1385
1327
  s2 = input.charAt(peg$currPos);
1386
1328
  peg$currPos++;
1387
1329
  } else {
1388
1330
  s2 = peg$FAILED;
1389
- if (peg$silentFails === 0) { peg$fail(peg$c78); }
1331
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
1390
1332
  }
1391
1333
  }
1392
1334
  } else {
@@ -1394,13 +1336,13 @@ function peg$parse(input, options) {
1394
1336
  }
1395
1337
  if (s1 !== peg$FAILED) {
1396
1338
  peg$savedPos = s0;
1397
- s1 = peg$c75();
1339
+ s1 = peg$f23();
1398
1340
  }
1399
1341
  s0 = s1;
1400
1342
  peg$silentFails--;
1401
1343
  if (s0 === peg$FAILED) {
1402
1344
  s1 = peg$FAILED;
1403
- if (peg$silentFails === 0) { peg$fail(peg$c83); }
1345
+ if (peg$silentFails === 0) { peg$fail(peg$e33); }
1404
1346
  }
1405
1347
 
1406
1348
  return s0;
@@ -1411,47 +1353,39 @@ function peg$parse(input, options) {
1411
1353
 
1412
1354
  peg$silentFails++;
1413
1355
  if (input.charCodeAt(peg$currPos) === 10) {
1414
- s0 = peg$c85;
1356
+ s0 = peg$c18;
1415
1357
  peg$currPos++;
1416
1358
  } else {
1417
1359
  s0 = peg$FAILED;
1418
- if (peg$silentFails === 0) { peg$fail(peg$c86); }
1360
+ if (peg$silentFails === 0) { peg$fail(peg$e35); }
1419
1361
  }
1420
1362
  if (s0 === peg$FAILED) {
1421
- if (input.substr(peg$currPos, 2) === peg$c87) {
1422
- s0 = peg$c87;
1363
+ if (input.substr(peg$currPos, 2) === peg$c19) {
1364
+ s0 = peg$c19;
1423
1365
  peg$currPos += 2;
1424
1366
  } else {
1425
1367
  s0 = peg$FAILED;
1426
- if (peg$silentFails === 0) { peg$fail(peg$c88); }
1368
+ if (peg$silentFails === 0) { peg$fail(peg$e36); }
1427
1369
  }
1428
1370
  if (s0 === peg$FAILED) {
1429
1371
  if (input.charCodeAt(peg$currPos) === 13) {
1430
- s0 = peg$c89;
1372
+ s0 = peg$c20;
1431
1373
  peg$currPos++;
1432
1374
  } else {
1433
1375
  s0 = peg$FAILED;
1434
- if (peg$silentFails === 0) { peg$fail(peg$c90); }
1376
+ if (peg$silentFails === 0) { peg$fail(peg$e37); }
1435
1377
  }
1436
1378
  }
1437
1379
  }
1438
1380
  peg$silentFails--;
1439
1381
  if (s0 === peg$FAILED) {
1440
1382
  s1 = peg$FAILED;
1441
- if (peg$silentFails === 0) { peg$fail(peg$c84); }
1383
+ if (peg$silentFails === 0) { peg$fail(peg$e34); }
1442
1384
  }
1443
1385
 
1444
1386
  return s0;
1445
1387
  }
1446
1388
 
1447
-
1448
- const { mapObj } = require('./utils')
1449
- function list (head, tail) {
1450
- tail.unshift(head)
1451
- return tail
1452
- }
1453
-
1454
-
1455
1389
  peg$result = peg$startRuleFunction();
1456
1390
 
1457
1391
  if (peg$result !== peg$FAILED && peg$currPos === input.length) {
@@ -1471,7 +1405,8 @@ function peg$parse(input, options) {
1471
1405
  }
1472
1406
  }
1473
1407
 
1474
- module.exports = {
1475
- SyntaxError: peg$SyntaxError,
1476
- parse: peg$parse
1408
+ export {
1409
+ peg$SyntaxError as SyntaxError,
1410
+
1411
+ peg$parse as parse
1477
1412
  };