@zokugun/regexp 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2810 @@
1
+ "use strict";
2
+ /*
3
+ * Generated by PEG.js 0.10.0.
4
+ *
5
+ * http://pegjs.org/
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.pegParse = void 0;
9
+ const types_js_1 = require("../types.cjs");
10
+ function peg$subclass(child, parent) {
11
+ function ctor() {
12
+ this.constructor = child;
13
+ }
14
+ ctor.prototype = parent.prototype;
15
+ child.prototype = new ctor();
16
+ }
17
+ function peg$SyntaxError(message, expected, found, location) {
18
+ // @ts-ignore
19
+ this.message = message;
20
+ // @ts-ignore
21
+ this.expected = expected;
22
+ // @ts-ignore
23
+ this.found = found;
24
+ // @ts-ignore
25
+ this.location = location;
26
+ // @ts-ignore
27
+ this.name = "SyntaxError";
28
+ if (typeof Error.captureStackTrace === "function") {
29
+ // @ts-ignore
30
+ Error.captureStackTrace(this, peg$SyntaxError);
31
+ }
32
+ }
33
+ peg$subclass(peg$SyntaxError, Error);
34
+ peg$SyntaxError.buildMessage = function (expected, found) {
35
+ var DESCRIBE_EXPECTATION_FNS = {
36
+ literal: function (expectation) {
37
+ return "\"" + literalEscape(expectation.text) + "\"";
38
+ },
39
+ "class": function (expectation) {
40
+ var escapedParts = "", i;
41
+ for (i = 0; i < expectation.parts.length; i++) {
42
+ escapedParts += expectation.parts[i] instanceof Array
43
+ ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
44
+ : classEscape(expectation.parts[i]);
45
+ }
46
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
47
+ },
48
+ any: function (expectation) {
49
+ return "any character";
50
+ },
51
+ end: function (expectation) {
52
+ return "end of input";
53
+ },
54
+ other: function (expectation) {
55
+ return expectation.description;
56
+ }
57
+ };
58
+ function hex(ch) {
59
+ return ch.charCodeAt(0).toString(16).toUpperCase();
60
+ }
61
+ function literalEscape(s) {
62
+ return s
63
+ .replace(/\\/g, '\\\\')
64
+ .replace(/"/g, '\\"')
65
+ .replace(/\0/g, '\\0')
66
+ .replace(/\t/g, '\\t')
67
+ .replace(/\n/g, '\\n')
68
+ .replace(/\r/g, '\\r')
69
+ .replace(/[\x00-\x0F]/g, function (ch) { return '\\x0' + hex(ch); })
70
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return '\\x' + hex(ch); });
71
+ }
72
+ function classEscape(s) {
73
+ return s
74
+ .replace(/\\/g, '\\\\')
75
+ .replace(/\]/g, '\\]')
76
+ .replace(/\^/g, '\\^')
77
+ .replace(/-/g, '\\-')
78
+ .replace(/\0/g, '\\0')
79
+ .replace(/\t/g, '\\t')
80
+ .replace(/\n/g, '\\n')
81
+ .replace(/\r/g, '\\r')
82
+ .replace(/[\x00-\x0F]/g, function (ch) { return '\\x0' + hex(ch); })
83
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return '\\x' + hex(ch); });
84
+ }
85
+ function describeExpectation(expectation) {
86
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
87
+ }
88
+ function describeExpected(expected) {
89
+ var descriptions = new Array(expected.length), i, j;
90
+ for (i = 0; i < expected.length; i++) {
91
+ descriptions[i] = describeExpectation(expected[i]);
92
+ }
93
+ descriptions.sort();
94
+ if (descriptions.length > 0) {
95
+ for (i = 1, j = 1; i < descriptions.length; i++) {
96
+ if (descriptions[i - 1] !== descriptions[i]) {
97
+ descriptions[j] = descriptions[i];
98
+ j++;
99
+ }
100
+ }
101
+ descriptions.length = j;
102
+ }
103
+ switch (descriptions.length) {
104
+ case 1:
105
+ return descriptions[0];
106
+ case 2:
107
+ return descriptions[0] + " or " + descriptions[1];
108
+ default:
109
+ return descriptions.slice(0, -1).join(", ")
110
+ + ", or "
111
+ + descriptions[descriptions.length - 1];
112
+ }
113
+ }
114
+ function describeFound(found) {
115
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
116
+ }
117
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
118
+ };
119
+ function peg$parse(input, options) {
120
+ options = options !== void 0 ? options : {};
121
+ var peg$FAILED = {}, peg$startRuleFunctions = { regexp: peg$parseregexp }, peg$startRuleFunction = peg$parseregexp, peg$c0 = "|", peg$c1 = peg$literalExpectation("|", false), peg$c2 = function (match, alternate) {
122
+ if (alternate) {
123
+ const body = alternate[1].type === types_js_1.TokenType.ALTERNATE ? [match, ...alternate[1].body] : [match, alternate[1]];
124
+ return { type: types_js_1.TokenType.ALTERNATE, body: body };
125
+ }
126
+ else {
127
+ return match;
128
+ }
129
+ }, peg$c3 = "/", peg$c4 = peg$literalExpectation("/", false), peg$c5 = function (body, modifiers) {
130
+ if (modifiers) {
131
+ return { type: types_js_1.TokenType.PATTERN, body: body, modifiers: modifiers };
132
+ }
133
+ else {
134
+ return { type: types_js_1.TokenType.PATTERN, body: body };
135
+ }
136
+ }, peg$c6 = "(", peg$c7 = peg$literalExpectation("(", false), peg$c8 = ")", peg$c9 = peg$literalExpectation(")", false), peg$c10 = function (modifier, begin, matches, end) {
137
+ const body = [];
138
+ if (modifier) {
139
+ body.push(modifier[1]);
140
+ }
141
+ if (begin) {
142
+ body.push(begin);
143
+ }
144
+ body.push(...matches.flat());
145
+ if (end) {
146
+ body.push(end);
147
+ }
148
+ return { type: types_js_1.TokenType.MATCH, body: body };
149
+ }, peg$c11 = "^", peg$c12 = peg$literalExpectation("^", false), peg$c13 = function () { return { type: types_js_1.TokenType.BEGIN }; }, peg$c14 = "$", peg$c15 = peg$literalExpectation("$", false), peg$c16 = function () { return { type: types_js_1.TokenType.END }; }, peg$c17 = "?", peg$c18 = peg$literalExpectation("?", false), peg$c19 = function (modifiers) { return { type: types_js_1.TokenType.MODIFIER, ...modifiers }; }, peg$c20 = /^[gimsuxyUJX]/, peg$c21 = peg$classExpectation(["g", "i", "m", "s", "u", "x", "y", "U", "J", "X"], false, false), peg$c22 = "-", peg$c23 = peg$literalExpectation("-", false), peg$c24 = function (positive, negative) { return { positive: positive, negative: negative }; }, peg$c25 = function (positive) { return { positive: positive, negative: [] }; }, peg$c26 = function (negative) { return { positive: [], negative: negative }; }, peg$c27 = function (submatch, quantifier) {
150
+ if (submatch.type === types_js_1.TokenType.LITERAL && submatch.text.length > 1) {
151
+ return [
152
+ { type: types_js_1.TokenType.LITERAL, text: submatch.text.substr(0, submatch.text.length - 1) },
153
+ { type: types_js_1.TokenType.QUANTIFIED, body: { type: types_js_1.TokenType.LITERAL, text: submatch.text.substr(-1) }, quantifier: quantifier }
154
+ ];
155
+ }
156
+ else {
157
+ return { type: types_js_1.TokenType.QUANTIFIED, body: submatch, quantifier: quantifier };
158
+ }
159
+ }, peg$c28 = peg$otherExpectation("Quantifier"), peg$c29 = function (quantity, notgreedy) { quantity.greedy = !notgreedy; return quantity; }, peg$c30 = "{", peg$c31 = peg$literalExpectation("{", false), peg$c32 = ",", peg$c33 = peg$literalExpectation(",", false), peg$c34 = "}", peg$c35 = peg$literalExpectation("}", false), peg$c36 = function (min, max) { return { type: types_js_1.TokenType.QUANTIFIER, min: min, max: max }; }, peg$c37 = ",}", peg$c38 = peg$literalExpectation(",}", false), peg$c39 = function (min) { return { type: types_js_1.TokenType.QUANTIFIER, min: min, max: Infinity }; }, peg$c40 = function (value) { return { type: types_js_1.TokenType.QUANTIFIER, min: value, max: value }; }, peg$c41 = "+", peg$c42 = peg$literalExpectation("+", false), peg$c43 = function () { return { type: types_js_1.TokenType.QUANTIFIER, min: 1, max: Infinity }; }, peg$c44 = "*", peg$c45 = peg$literalExpectation("*", false), peg$c46 = function () { return { type: types_js_1.TokenType.QUANTIFIER, min: 0, max: Infinity }; }, peg$c47 = function () { return { type: types_js_1.TokenType.QUANTIFIER, min: 0, max: 1 }; }, peg$c48 = /^[0-9]/, peg$c49 = peg$classExpectation([["0", "9"]], false, false), peg$c50 = function (num) { return +num.join(''); }, peg$c51 = function (body) { return body; }, peg$c52 = function (regexp) { return { type: types_js_1.TokenType.CAPTURE_GROUP, body: regexp }; }, peg$c53 = "?:", peg$c54 = peg$literalExpectation("?:", false), peg$c55 = function (regexp) { return { type: types_js_1.TokenType.NON_CAPTURE_GROUP, body: regexp }; }, peg$c56 = "?<", peg$c57 = peg$literalExpectation("?<", false), peg$c58 = /^[0-9a-zA-Z_]/, peg$c59 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], "_"], false, false), peg$c60 = ">", peg$c61 = peg$literalExpectation(">", false), peg$c62 = function (name, regexp) { return { type: types_js_1.TokenType.NAMED_GROUP, name: name.join(''), body: regexp }; }, peg$c63 = "?<=", peg$c64 = peg$literalExpectation("?<=", false), peg$c65 = function (regexp) { return { type: types_js_1.TokenType.POSITIVE_LOOKBEHIND, body: regexp }; }, peg$c66 = "?<!", peg$c67 = peg$literalExpectation("?<!", false), peg$c68 = function (regexp) { return { type: types_js_1.TokenType.NEGATIVE_LOOKBEHIND, body: regexp }; }, peg$c69 = "?=", peg$c70 = peg$literalExpectation("?=", false), peg$c71 = function (regexp) { return { type: types_js_1.TokenType.POSITIVE_LOOKAHEAD, body: regexp }; }, peg$c72 = "?!", peg$c73 = peg$literalExpectation("?!", false), peg$c74 = function (regexp) { return { type: types_js_1.TokenType.NEGATIVE_LOOKAHEAD, body: regexp }; }, peg$c75 = ":", peg$c76 = peg$literalExpectation(":", false), peg$c77 = function (modifiers, regexp) { return { type: types_js_1.TokenType.MODIFIED_GROUP, modifiers: modifiers, body: regexp }; }, peg$c78 = peg$otherExpectation("CharacterSet"), peg$c79 = "[", peg$c80 = peg$literalExpectation("[", false), peg$c81 = "]", peg$c82 = peg$literalExpectation("]", false), peg$c83 = function (negated, body) { return { type: types_js_1.TokenType.CHARSET, body: body, negated: !!negated }; }, peg$c84 = peg$otherExpectation("CharacterRange"), peg$c85 = function (begin, end) { return { type: types_js_1.TokenType.RANGE, begin: begin, end: end }; }, peg$c86 = peg$otherExpectation("Character"), peg$c87 = /^[^\\\]]/, peg$c88 = peg$classExpectation(["\\", "]"], true, false), peg$c89 = function (value) { return { type: types_js_1.TokenType.LITERAL, text: value }; }, peg$c90 = ".", peg$c91 = peg$literalExpectation(".", false), peg$c92 = function () { return { type: types_js_1.TokenType.ANY }; }, peg$c93 = peg$otherExpectation("Literal"), peg$c94 = /^[^|\\\/.[()?+*$\^]/, peg$c95 = peg$classExpectation(["|", "\\", "/", ".", "[", "(", ")", "?", "+", "*", "$", "^"], true, false), peg$c96 = function (value) { return { type: types_js_1.TokenType.LITERAL, text: value.join('') }; }, peg$c97 = "\\", peg$c98 = peg$literalExpectation("\\", false), peg$c99 = /^[1-9]/, peg$c100 = peg$classExpectation([["1", "9"]], false, false), peg$c101 = function (code) { return { type: types_js_1.TokenType.BACK_REFERENCE, code: code }; }, peg$c102 = "\\b", peg$c103 = peg$literalExpectation("\\b", false), peg$c104 = function () { return { type: types_js_1.TokenType.BACKSPACE }; }, peg$c105 = "\\r", peg$c106 = peg$literalExpectation("\\r", false), peg$c107 = function () { return { type: types_js_1.TokenType.CARRIAGE_RETURN }; }, peg$c108 = "\\c", peg$c109 = peg$literalExpectation("\\c", false), peg$c110 = peg$anyExpectation(), peg$c111 = function (code) { return { type: types_js_1.TokenType.CONTROL, code: code }; }, peg$c112 = "\\d", peg$c113 = peg$literalExpectation("\\d", false), peg$c114 = function () { return { type: types_js_1.TokenType.DIGIT }; }, peg$c115 = "\\D", peg$c116 = peg$literalExpectation("\\D", false), peg$c117 = function () { return { type: types_js_1.TokenType.NON_DIGIT }; }, peg$c118 = "\\f", peg$c119 = peg$literalExpectation("\\f", false), peg$c120 = function () { return { type: types_js_1.TokenType.FORM_FEED }; }, peg$c121 = "\\x", peg$c122 = peg$literalExpectation("\\x", false), peg$c123 = /^[0-9a-fA-F]/, peg$c124 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), peg$c125 = function (code) { return { type: types_js_1.TokenType.HEX, code: code.join('') }; }, peg$c126 = "\\n", peg$c127 = peg$literalExpectation("\\n", false), peg$c128 = function () { return { type: types_js_1.TokenType.LINE_FEED }; }, peg$c129 = "\\k<", peg$c130 = peg$literalExpectation("\\k<", false), peg$c131 = function (name) { return { type: types_js_1.TokenType.NAMED_BACK_REFERENCE, name: name }; }, peg$c132 = "\\0", peg$c133 = peg$literalExpectation("\\0", false), peg$c134 = function () { return { type: types_js_1.TokenType.NUL }; }, peg$c135 = /^[0-7]/, peg$c136 = peg$classExpectation([["0", "7"]], false, false), peg$c137 = function (code) { return { type: types_js_1.TokenType.OCTAL, code: code.join('') }; }, peg$c138 = "\\t", peg$c139 = peg$literalExpectation("\\t", false), peg$c140 = function () { return { type: types_js_1.TokenType.TAB }; }, peg$c141 = "\\u{", peg$c142 = peg$literalExpectation("\\u{", false), peg$c143 = function (code) { return { type: types_js_1.TokenType.UNICODE, code: code.join('') }; }, peg$c144 = "\\p{", peg$c145 = peg$literalExpectation("\\p{", false), peg$c146 = /^[0-9a-zA-Z_=]/, peg$c147 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], "_", "="], false, false), peg$c148 = function (property) { return { type: types_js_1.TokenType.UNICODE_PROPERTY, property: property.join('') }; }, peg$c149 = "\\P{", peg$c150 = peg$literalExpectation("\\P{", false), peg$c151 = function (property) { return { type: types_js_1.TokenType.NON_UNICODE_PROPERTY, property: property.join('') }; }, peg$c152 = "\\u", peg$c153 = peg$literalExpectation("\\u", false), peg$c154 = function (code) { return { type: types_js_1.TokenType.UTF16, code: code.join('') }; }, peg$c155 = "\\v", peg$c156 = peg$literalExpectation("\\v", false), peg$c157 = function () { return { type: types_js_1.TokenType.VERTICAL_TAB }; }, peg$c158 = "\\s", peg$c159 = peg$literalExpectation("\\s", false), peg$c160 = function () { return { type: types_js_1.TokenType.WHITE_SPACE }; }, peg$c161 = "\\S", peg$c162 = peg$literalExpectation("\\S", false), peg$c163 = function () { return { type: types_js_1.TokenType.NON_WHITE_SPACE }; }, peg$c164 = function () { return { type: types_js_1.TokenType.WORD_BOUNDARY }; }, peg$c165 = "\\B", peg$c166 = peg$literalExpectation("\\B", false), peg$c167 = function () { return { type: types_js_1.TokenType.NON_WORD_BOUNDARY }; }, peg$c168 = "\\w", peg$c169 = peg$literalExpectation("\\w", false), peg$c170 = function () { return { type: types_js_1.TokenType.WORD }; }, peg$c171 = "\\W", peg$c172 = peg$literalExpectation("\\W", false), peg$c173 = function () { return { type: types_js_1.TokenType.NON_WORD }; }, peg$c174 = function (code) { return { type: types_js_1.TokenType.ESCAPE, code: code }; }, peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result;
160
+ if ("startRule" in options) {
161
+ if (!(options.startRule in peg$startRuleFunctions)) {
162
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
163
+ }
164
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
165
+ }
166
+ // @ts-ignore
167
+ function text() {
168
+ return input.substring(peg$savedPos, peg$currPos);
169
+ }
170
+ // @ts-ignore
171
+ function location() {
172
+ return peg$computeLocation(peg$savedPos, peg$currPos);
173
+ }
174
+ // @ts-ignore
175
+ function expected(description, location) {
176
+ location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
177
+ throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
178
+ }
179
+ // @ts-ignore
180
+ function error(message, location) {
181
+ location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
182
+ throw peg$buildSimpleError(message, location);
183
+ }
184
+ function peg$literalExpectation(text, ignoreCase) {
185
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
186
+ }
187
+ function peg$classExpectation(parts, inverted, ignoreCase) {
188
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
189
+ }
190
+ function peg$anyExpectation() {
191
+ return { type: "any" };
192
+ }
193
+ function peg$endExpectation() {
194
+ return { type: "end" };
195
+ }
196
+ function peg$otherExpectation(description) {
197
+ return { type: "other", description: description };
198
+ }
199
+ function peg$computePosDetails(pos) {
200
+ var details = peg$posDetailsCache[pos], p;
201
+ if (details) {
202
+ return details;
203
+ }
204
+ else {
205
+ p = pos - 1;
206
+ while (!peg$posDetailsCache[p]) {
207
+ p--;
208
+ }
209
+ details = peg$posDetailsCache[p];
210
+ details = {
211
+ line: details.line,
212
+ column: details.column
213
+ };
214
+ while (p < pos) {
215
+ if (input.charCodeAt(p) === 10) {
216
+ details.line++;
217
+ details.column = 1;
218
+ }
219
+ else {
220
+ details.column++;
221
+ }
222
+ p++;
223
+ }
224
+ peg$posDetailsCache[pos] = details;
225
+ return details;
226
+ }
227
+ }
228
+ function peg$computeLocation(startPos, endPos) {
229
+ var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos);
230
+ return {
231
+ start: {
232
+ offset: startPos,
233
+ line: startPosDetails.line,
234
+ column: startPosDetails.column
235
+ },
236
+ end: {
237
+ offset: endPos,
238
+ line: endPosDetails.line,
239
+ column: endPosDetails.column
240
+ }
241
+ };
242
+ }
243
+ function peg$fail(expected) {
244
+ if (peg$currPos < peg$maxFailPos) {
245
+ return;
246
+ }
247
+ if (peg$currPos > peg$maxFailPos) {
248
+ peg$maxFailPos = peg$currPos;
249
+ peg$maxFailExpected = [];
250
+ }
251
+ peg$maxFailExpected.push(expected);
252
+ }
253
+ function peg$buildSimpleError(message, location) {
254
+ return new peg$SyntaxError(message, null, null, location);
255
+ }
256
+ function peg$buildStructuredError(expected, found, location) {
257
+ return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
258
+ }
259
+ function peg$parseregexp() {
260
+ var s0;
261
+ s0 = peg$parsepatternMod();
262
+ if (s0 === peg$FAILED) {
263
+ s0 = peg$parsepattern();
264
+ }
265
+ return s0;
266
+ }
267
+ function peg$parsepattern() {
268
+ var s0, s1, s2, s3, s4;
269
+ s0 = peg$currPos;
270
+ s1 = peg$parsematch();
271
+ if (s1 !== peg$FAILED) {
272
+ s2 = peg$currPos;
273
+ if (input.charCodeAt(peg$currPos) === 124) {
274
+ s3 = peg$c0;
275
+ peg$currPos++;
276
+ }
277
+ else {
278
+ s3 = peg$FAILED;
279
+ if (peg$silentFails === 0) {
280
+ peg$fail(peg$c1);
281
+ }
282
+ }
283
+ if (s3 !== peg$FAILED) {
284
+ s4 = peg$parsepattern();
285
+ if (s4 !== peg$FAILED) {
286
+ s3 = [s3, s4];
287
+ s2 = s3;
288
+ }
289
+ else {
290
+ peg$currPos = s2;
291
+ s2 = peg$FAILED;
292
+ }
293
+ }
294
+ else {
295
+ peg$currPos = s2;
296
+ s2 = peg$FAILED;
297
+ }
298
+ if (s2 === peg$FAILED) {
299
+ s2 = null;
300
+ }
301
+ if (s2 !== peg$FAILED) {
302
+ peg$savedPos = s0;
303
+ s1 = peg$c2(s1, s2);
304
+ s0 = s1;
305
+ }
306
+ else {
307
+ peg$currPos = s0;
308
+ s0 = peg$FAILED;
309
+ }
310
+ }
311
+ else {
312
+ peg$currPos = s0;
313
+ s0 = peg$FAILED;
314
+ }
315
+ return s0;
316
+ }
317
+ function peg$parsepatternMod() {
318
+ var s0, s1, s2, s3, s4;
319
+ s0 = peg$currPos;
320
+ if (input.charCodeAt(peg$currPos) === 47) {
321
+ s1 = peg$c3;
322
+ peg$currPos++;
323
+ }
324
+ else {
325
+ s1 = peg$FAILED;
326
+ if (peg$silentFails === 0) {
327
+ peg$fail(peg$c4);
328
+ }
329
+ }
330
+ if (s1 !== peg$FAILED) {
331
+ s2 = peg$parsepattern();
332
+ if (s2 !== peg$FAILED) {
333
+ if (input.charCodeAt(peg$currPos) === 47) {
334
+ s3 = peg$c3;
335
+ peg$currPos++;
336
+ }
337
+ else {
338
+ s3 = peg$FAILED;
339
+ if (peg$silentFails === 0) {
340
+ peg$fail(peg$c4);
341
+ }
342
+ }
343
+ if (s3 !== peg$FAILED) {
344
+ s4 = peg$parsemodifierPositive();
345
+ if (s4 === peg$FAILED) {
346
+ s4 = null;
347
+ }
348
+ if (s4 !== peg$FAILED) {
349
+ peg$savedPos = s0;
350
+ s1 = peg$c5(s2, s4);
351
+ s0 = s1;
352
+ }
353
+ else {
354
+ peg$currPos = s0;
355
+ s0 = peg$FAILED;
356
+ }
357
+ }
358
+ else {
359
+ peg$currPos = s0;
360
+ s0 = peg$FAILED;
361
+ }
362
+ }
363
+ else {
364
+ peg$currPos = s0;
365
+ s0 = peg$FAILED;
366
+ }
367
+ }
368
+ else {
369
+ peg$currPos = s0;
370
+ s0 = peg$FAILED;
371
+ }
372
+ return s0;
373
+ }
374
+ function peg$parsematch() {
375
+ var s0, s1, s2, s3, s4, s5;
376
+ s0 = peg$currPos;
377
+ s1 = peg$currPos;
378
+ if (input.charCodeAt(peg$currPos) === 40) {
379
+ s2 = peg$c6;
380
+ peg$currPos++;
381
+ }
382
+ else {
383
+ s2 = peg$FAILED;
384
+ if (peg$silentFails === 0) {
385
+ peg$fail(peg$c7);
386
+ }
387
+ }
388
+ if (s2 !== peg$FAILED) {
389
+ s3 = peg$parsemodifier();
390
+ if (s3 !== peg$FAILED) {
391
+ if (input.charCodeAt(peg$currPos) === 41) {
392
+ s4 = peg$c8;
393
+ peg$currPos++;
394
+ }
395
+ else {
396
+ s4 = peg$FAILED;
397
+ if (peg$silentFails === 0) {
398
+ peg$fail(peg$c9);
399
+ }
400
+ }
401
+ if (s4 !== peg$FAILED) {
402
+ s2 = [s2, s3, s4];
403
+ s1 = s2;
404
+ }
405
+ else {
406
+ peg$currPos = s1;
407
+ s1 = peg$FAILED;
408
+ }
409
+ }
410
+ else {
411
+ peg$currPos = s1;
412
+ s1 = peg$FAILED;
413
+ }
414
+ }
415
+ else {
416
+ peg$currPos = s1;
417
+ s1 = peg$FAILED;
418
+ }
419
+ if (s1 === peg$FAILED) {
420
+ s1 = null;
421
+ }
422
+ if (s1 !== peg$FAILED) {
423
+ s2 = peg$parsebegin();
424
+ if (s2 === peg$FAILED) {
425
+ s2 = null;
426
+ }
427
+ if (s2 !== peg$FAILED) {
428
+ s3 = peg$currPos;
429
+ peg$silentFails++;
430
+ s4 = peg$parsequantifier();
431
+ peg$silentFails--;
432
+ if (s4 === peg$FAILED) {
433
+ s3 = void 0;
434
+ }
435
+ else {
436
+ peg$currPos = s3;
437
+ s3 = peg$FAILED;
438
+ }
439
+ if (s3 !== peg$FAILED) {
440
+ s4 = [];
441
+ s5 = peg$parsequantified();
442
+ if (s5 === peg$FAILED) {
443
+ s5 = peg$parsesubmatch();
444
+ }
445
+ while (s5 !== peg$FAILED) {
446
+ s4.push(s5);
447
+ s5 = peg$parsequantified();
448
+ if (s5 === peg$FAILED) {
449
+ s5 = peg$parsesubmatch();
450
+ }
451
+ }
452
+ if (s4 !== peg$FAILED) {
453
+ s5 = peg$parseend();
454
+ if (s5 === peg$FAILED) {
455
+ s5 = null;
456
+ }
457
+ if (s5 !== peg$FAILED) {
458
+ peg$savedPos = s0;
459
+ s1 = peg$c10(s1, s2, s4, s5);
460
+ s0 = s1;
461
+ }
462
+ else {
463
+ peg$currPos = s0;
464
+ s0 = peg$FAILED;
465
+ }
466
+ }
467
+ else {
468
+ peg$currPos = s0;
469
+ s0 = peg$FAILED;
470
+ }
471
+ }
472
+ else {
473
+ peg$currPos = s0;
474
+ s0 = peg$FAILED;
475
+ }
476
+ }
477
+ else {
478
+ peg$currPos = s0;
479
+ s0 = peg$FAILED;
480
+ }
481
+ }
482
+ else {
483
+ peg$currPos = s0;
484
+ s0 = peg$FAILED;
485
+ }
486
+ return s0;
487
+ }
488
+ function peg$parsesubmatch() {
489
+ var s0;
490
+ s0 = peg$parsesubexp();
491
+ if (s0 === peg$FAILED) {
492
+ s0 = peg$parsecharset();
493
+ if (s0 === peg$FAILED) {
494
+ s0 = peg$parseterminal();
495
+ }
496
+ }
497
+ return s0;
498
+ }
499
+ function peg$parsebegin() {
500
+ // @ts-ignore
501
+ var s0, s1;
502
+ s0 = peg$currPos;
503
+ if (input.charCodeAt(peg$currPos) === 94) {
504
+ s1 = peg$c11;
505
+ peg$currPos++;
506
+ }
507
+ else {
508
+ s1 = peg$FAILED;
509
+ if (peg$silentFails === 0) {
510
+ peg$fail(peg$c12);
511
+ }
512
+ }
513
+ if (s1 !== peg$FAILED) {
514
+ peg$savedPos = s0;
515
+ s1 = peg$c13();
516
+ }
517
+ s0 = s1;
518
+ return s0;
519
+ }
520
+ function peg$parseend() {
521
+ // @ts-ignore
522
+ var s0, s1;
523
+ s0 = peg$currPos;
524
+ if (input.charCodeAt(peg$currPos) === 36) {
525
+ s1 = peg$c14;
526
+ peg$currPos++;
527
+ }
528
+ else {
529
+ s1 = peg$FAILED;
530
+ if (peg$silentFails === 0) {
531
+ peg$fail(peg$c15);
532
+ }
533
+ }
534
+ if (s1 !== peg$FAILED) {
535
+ peg$savedPos = s0;
536
+ s1 = peg$c16();
537
+ }
538
+ s0 = s1;
539
+ return s0;
540
+ }
541
+ function peg$parsemodifier() {
542
+ var s0, s1, s2;
543
+ s0 = peg$currPos;
544
+ if (input.charCodeAt(peg$currPos) === 63) {
545
+ s1 = peg$c17;
546
+ peg$currPos++;
547
+ }
548
+ else {
549
+ s1 = peg$FAILED;
550
+ if (peg$silentFails === 0) {
551
+ peg$fail(peg$c18);
552
+ }
553
+ }
554
+ if (s1 !== peg$FAILED) {
555
+ s2 = peg$parsemodifierSpec();
556
+ if (s2 !== peg$FAILED) {
557
+ peg$savedPos = s0;
558
+ s1 = peg$c19(s2);
559
+ s0 = s1;
560
+ }
561
+ else {
562
+ peg$currPos = s0;
563
+ s0 = peg$FAILED;
564
+ }
565
+ }
566
+ else {
567
+ peg$currPos = s0;
568
+ s0 = peg$FAILED;
569
+ }
570
+ return s0;
571
+ }
572
+ function peg$parsemodifierSpec() {
573
+ var s0;
574
+ s0 = peg$parsemodifierPositiveNegative();
575
+ if (s0 === peg$FAILED) {
576
+ s0 = peg$parsemodifierPositive();
577
+ if (s0 === peg$FAILED) {
578
+ s0 = peg$parsemodifierNegative();
579
+ }
580
+ }
581
+ return s0;
582
+ }
583
+ function peg$parsemodifierPositiveNegative() {
584
+ var s0, s1, s2, s3, s4;
585
+ s0 = peg$currPos;
586
+ s1 = [];
587
+ if (peg$c20.test(input.charAt(peg$currPos))) {
588
+ s2 = input.charAt(peg$currPos);
589
+ peg$currPos++;
590
+ }
591
+ else {
592
+ s2 = peg$FAILED;
593
+ if (peg$silentFails === 0) {
594
+ peg$fail(peg$c21);
595
+ }
596
+ }
597
+ if (s2 !== peg$FAILED) {
598
+ while (s2 !== peg$FAILED) {
599
+ s1.push(s2);
600
+ if (peg$c20.test(input.charAt(peg$currPos))) {
601
+ s2 = input.charAt(peg$currPos);
602
+ peg$currPos++;
603
+ }
604
+ else {
605
+ s2 = peg$FAILED;
606
+ if (peg$silentFails === 0) {
607
+ peg$fail(peg$c21);
608
+ }
609
+ }
610
+ }
611
+ }
612
+ else {
613
+ s1 = peg$FAILED;
614
+ }
615
+ if (s1 !== peg$FAILED) {
616
+ if (input.charCodeAt(peg$currPos) === 45) {
617
+ s2 = peg$c22;
618
+ peg$currPos++;
619
+ }
620
+ else {
621
+ s2 = peg$FAILED;
622
+ if (peg$silentFails === 0) {
623
+ peg$fail(peg$c23);
624
+ }
625
+ }
626
+ if (s2 !== peg$FAILED) {
627
+ s3 = [];
628
+ if (peg$c20.test(input.charAt(peg$currPos))) {
629
+ s4 = input.charAt(peg$currPos);
630
+ peg$currPos++;
631
+ }
632
+ else {
633
+ s4 = peg$FAILED;
634
+ if (peg$silentFails === 0) {
635
+ peg$fail(peg$c21);
636
+ }
637
+ }
638
+ if (s4 !== peg$FAILED) {
639
+ while (s4 !== peg$FAILED) {
640
+ s3.push(s4);
641
+ if (peg$c20.test(input.charAt(peg$currPos))) {
642
+ s4 = input.charAt(peg$currPos);
643
+ peg$currPos++;
644
+ }
645
+ else {
646
+ s4 = peg$FAILED;
647
+ if (peg$silentFails === 0) {
648
+ peg$fail(peg$c21);
649
+ }
650
+ }
651
+ }
652
+ }
653
+ else {
654
+ s3 = peg$FAILED;
655
+ }
656
+ if (s3 !== peg$FAILED) {
657
+ peg$savedPos = s0;
658
+ s1 = peg$c24(s1, s3);
659
+ s0 = s1;
660
+ }
661
+ else {
662
+ peg$currPos = s0;
663
+ s0 = peg$FAILED;
664
+ }
665
+ }
666
+ else {
667
+ peg$currPos = s0;
668
+ s0 = peg$FAILED;
669
+ }
670
+ }
671
+ else {
672
+ peg$currPos = s0;
673
+ s0 = peg$FAILED;
674
+ }
675
+ return s0;
676
+ }
677
+ function peg$parsemodifierPositive() {
678
+ var s0, s1, s2;
679
+ s0 = peg$currPos;
680
+ s1 = [];
681
+ if (peg$c20.test(input.charAt(peg$currPos))) {
682
+ s2 = input.charAt(peg$currPos);
683
+ peg$currPos++;
684
+ }
685
+ else {
686
+ s2 = peg$FAILED;
687
+ if (peg$silentFails === 0) {
688
+ peg$fail(peg$c21);
689
+ }
690
+ }
691
+ if (s2 !== peg$FAILED) {
692
+ while (s2 !== peg$FAILED) {
693
+ s1.push(s2);
694
+ if (peg$c20.test(input.charAt(peg$currPos))) {
695
+ s2 = input.charAt(peg$currPos);
696
+ peg$currPos++;
697
+ }
698
+ else {
699
+ s2 = peg$FAILED;
700
+ if (peg$silentFails === 0) {
701
+ peg$fail(peg$c21);
702
+ }
703
+ }
704
+ }
705
+ }
706
+ else {
707
+ s1 = peg$FAILED;
708
+ }
709
+ if (s1 !== peg$FAILED) {
710
+ peg$savedPos = s0;
711
+ s1 = peg$c25(s1);
712
+ }
713
+ s0 = s1;
714
+ return s0;
715
+ }
716
+ function peg$parsemodifierNegative() {
717
+ var s0, s1, s2, s3;
718
+ s0 = peg$currPos;
719
+ if (input.charCodeAt(peg$currPos) === 45) {
720
+ s1 = peg$c22;
721
+ peg$currPos++;
722
+ }
723
+ else {
724
+ s1 = peg$FAILED;
725
+ if (peg$silentFails === 0) {
726
+ peg$fail(peg$c23);
727
+ }
728
+ }
729
+ if (s1 !== peg$FAILED) {
730
+ s2 = [];
731
+ if (peg$c20.test(input.charAt(peg$currPos))) {
732
+ s3 = input.charAt(peg$currPos);
733
+ peg$currPos++;
734
+ }
735
+ else {
736
+ s3 = peg$FAILED;
737
+ if (peg$silentFails === 0) {
738
+ peg$fail(peg$c21);
739
+ }
740
+ }
741
+ if (s3 !== peg$FAILED) {
742
+ while (s3 !== peg$FAILED) {
743
+ s2.push(s3);
744
+ if (peg$c20.test(input.charAt(peg$currPos))) {
745
+ s3 = input.charAt(peg$currPos);
746
+ peg$currPos++;
747
+ }
748
+ else {
749
+ s3 = peg$FAILED;
750
+ if (peg$silentFails === 0) {
751
+ peg$fail(peg$c21);
752
+ }
753
+ }
754
+ }
755
+ }
756
+ else {
757
+ s2 = peg$FAILED;
758
+ }
759
+ if (s2 !== peg$FAILED) {
760
+ peg$savedPos = s0;
761
+ s1 = peg$c26(s2);
762
+ s0 = s1;
763
+ }
764
+ else {
765
+ peg$currPos = s0;
766
+ s0 = peg$FAILED;
767
+ }
768
+ }
769
+ else {
770
+ peg$currPos = s0;
771
+ s0 = peg$FAILED;
772
+ }
773
+ return s0;
774
+ }
775
+ function peg$parsequantified() {
776
+ var s0, s1, s2;
777
+ s0 = peg$currPos;
778
+ s1 = peg$parsesubmatch();
779
+ if (s1 !== peg$FAILED) {
780
+ s2 = peg$parsequantifier();
781
+ if (s2 !== peg$FAILED) {
782
+ peg$savedPos = s0;
783
+ s1 = peg$c27(s1, s2);
784
+ s0 = s1;
785
+ }
786
+ else {
787
+ peg$currPos = s0;
788
+ s0 = peg$FAILED;
789
+ }
790
+ }
791
+ else {
792
+ peg$currPos = s0;
793
+ s0 = peg$FAILED;
794
+ }
795
+ return s0;
796
+ }
797
+ function peg$parsequantifier() {
798
+ var s0, s1, s2;
799
+ peg$silentFails++;
800
+ s0 = peg$currPos;
801
+ s1 = peg$parsequantifierSpec();
802
+ if (s1 !== peg$FAILED) {
803
+ s2 = peg$parsegreedyFlag();
804
+ if (s2 === peg$FAILED) {
805
+ s2 = null;
806
+ }
807
+ if (s2 !== peg$FAILED) {
808
+ peg$savedPos = s0;
809
+ s1 = peg$c29(s1, s2);
810
+ s0 = s1;
811
+ }
812
+ else {
813
+ peg$currPos = s0;
814
+ s0 = peg$FAILED;
815
+ }
816
+ }
817
+ else {
818
+ peg$currPos = s0;
819
+ s0 = peg$FAILED;
820
+ }
821
+ peg$silentFails--;
822
+ if (s0 === peg$FAILED) {
823
+ s1 = peg$FAILED;
824
+ if (peg$silentFails === 0) {
825
+ peg$fail(peg$c28);
826
+ }
827
+ }
828
+ return s0;
829
+ }
830
+ function peg$parsequantifierSpec() {
831
+ var s0;
832
+ s0 = peg$parsequantifierSpecFull();
833
+ if (s0 === peg$FAILED) {
834
+ s0 = peg$parsequantifierSpecAtLeast();
835
+ if (s0 === peg$FAILED) {
836
+ s0 = peg$parsequantifierSpecExact();
837
+ if (s0 === peg$FAILED) {
838
+ s0 = peg$parsequantifierRequired();
839
+ if (s0 === peg$FAILED) {
840
+ s0 = peg$parsequantifierAny();
841
+ if (s0 === peg$FAILED) {
842
+ s0 = peg$parsequantifierOptional();
843
+ }
844
+ }
845
+ }
846
+ }
847
+ }
848
+ return s0;
849
+ }
850
+ function peg$parsequantifierSpecFull() {
851
+ var s0, s1, s2, s3, s4, s5;
852
+ s0 = peg$currPos;
853
+ if (input.charCodeAt(peg$currPos) === 123) {
854
+ s1 = peg$c30;
855
+ peg$currPos++;
856
+ }
857
+ else {
858
+ s1 = peg$FAILED;
859
+ if (peg$silentFails === 0) {
860
+ peg$fail(peg$c31);
861
+ }
862
+ }
863
+ if (s1 !== peg$FAILED) {
864
+ s2 = peg$parseinteger();
865
+ if (s2 !== peg$FAILED) {
866
+ if (input.charCodeAt(peg$currPos) === 44) {
867
+ s3 = peg$c32;
868
+ peg$currPos++;
869
+ }
870
+ else {
871
+ s3 = peg$FAILED;
872
+ if (peg$silentFails === 0) {
873
+ peg$fail(peg$c33);
874
+ }
875
+ }
876
+ if (s3 !== peg$FAILED) {
877
+ s4 = peg$parseinteger();
878
+ if (s4 !== peg$FAILED) {
879
+ if (input.charCodeAt(peg$currPos) === 125) {
880
+ s5 = peg$c34;
881
+ peg$currPos++;
882
+ }
883
+ else {
884
+ s5 = peg$FAILED;
885
+ if (peg$silentFails === 0) {
886
+ peg$fail(peg$c35);
887
+ }
888
+ }
889
+ if (s5 !== peg$FAILED) {
890
+ peg$savedPos = s0;
891
+ s1 = peg$c36(s2, s4);
892
+ s0 = s1;
893
+ }
894
+ else {
895
+ peg$currPos = s0;
896
+ s0 = peg$FAILED;
897
+ }
898
+ }
899
+ else {
900
+ peg$currPos = s0;
901
+ s0 = peg$FAILED;
902
+ }
903
+ }
904
+ else {
905
+ peg$currPos = s0;
906
+ s0 = peg$FAILED;
907
+ }
908
+ }
909
+ else {
910
+ peg$currPos = s0;
911
+ s0 = peg$FAILED;
912
+ }
913
+ }
914
+ else {
915
+ peg$currPos = s0;
916
+ s0 = peg$FAILED;
917
+ }
918
+ return s0;
919
+ }
920
+ function peg$parsequantifierSpecAtLeast() {
921
+ var s0, s1, s2, s3;
922
+ s0 = peg$currPos;
923
+ if (input.charCodeAt(peg$currPos) === 123) {
924
+ s1 = peg$c30;
925
+ peg$currPos++;
926
+ }
927
+ else {
928
+ s1 = peg$FAILED;
929
+ if (peg$silentFails === 0) {
930
+ peg$fail(peg$c31);
931
+ }
932
+ }
933
+ if (s1 !== peg$FAILED) {
934
+ s2 = peg$parseinteger();
935
+ if (s2 !== peg$FAILED) {
936
+ if (input.substr(peg$currPos, 2) === peg$c37) {
937
+ s3 = peg$c37;
938
+ peg$currPos += 2;
939
+ }
940
+ else {
941
+ s3 = peg$FAILED;
942
+ if (peg$silentFails === 0) {
943
+ peg$fail(peg$c38);
944
+ }
945
+ }
946
+ if (s3 !== peg$FAILED) {
947
+ peg$savedPos = s0;
948
+ s1 = peg$c39(s2);
949
+ s0 = s1;
950
+ }
951
+ else {
952
+ peg$currPos = s0;
953
+ s0 = peg$FAILED;
954
+ }
955
+ }
956
+ else {
957
+ peg$currPos = s0;
958
+ s0 = peg$FAILED;
959
+ }
960
+ }
961
+ else {
962
+ peg$currPos = s0;
963
+ s0 = peg$FAILED;
964
+ }
965
+ return s0;
966
+ }
967
+ function peg$parsequantifierSpecExact() {
968
+ var s0, s1, s2, s3;
969
+ s0 = peg$currPos;
970
+ if (input.charCodeAt(peg$currPos) === 123) {
971
+ s1 = peg$c30;
972
+ peg$currPos++;
973
+ }
974
+ else {
975
+ s1 = peg$FAILED;
976
+ if (peg$silentFails === 0) {
977
+ peg$fail(peg$c31);
978
+ }
979
+ }
980
+ if (s1 !== peg$FAILED) {
981
+ s2 = peg$parseinteger();
982
+ if (s2 !== peg$FAILED) {
983
+ if (input.charCodeAt(peg$currPos) === 125) {
984
+ s3 = peg$c34;
985
+ peg$currPos++;
986
+ }
987
+ else {
988
+ s3 = peg$FAILED;
989
+ if (peg$silentFails === 0) {
990
+ peg$fail(peg$c35);
991
+ }
992
+ }
993
+ if (s3 !== peg$FAILED) {
994
+ peg$savedPos = s0;
995
+ s1 = peg$c40(s2);
996
+ s0 = s1;
997
+ }
998
+ else {
999
+ peg$currPos = s0;
1000
+ s0 = peg$FAILED;
1001
+ }
1002
+ }
1003
+ else {
1004
+ peg$currPos = s0;
1005
+ s0 = peg$FAILED;
1006
+ }
1007
+ }
1008
+ else {
1009
+ peg$currPos = s0;
1010
+ s0 = peg$FAILED;
1011
+ }
1012
+ return s0;
1013
+ }
1014
+ function peg$parsequantifierRequired() {
1015
+ // @ts-ignore
1016
+ var s0, s1;
1017
+ s0 = peg$currPos;
1018
+ if (input.charCodeAt(peg$currPos) === 43) {
1019
+ s1 = peg$c41;
1020
+ peg$currPos++;
1021
+ }
1022
+ else {
1023
+ s1 = peg$FAILED;
1024
+ if (peg$silentFails === 0) {
1025
+ peg$fail(peg$c42);
1026
+ }
1027
+ }
1028
+ if (s1 !== peg$FAILED) {
1029
+ peg$savedPos = s0;
1030
+ s1 = peg$c43();
1031
+ }
1032
+ s0 = s1;
1033
+ return s0;
1034
+ }
1035
+ function peg$parsequantifierAny() {
1036
+ // @ts-ignore
1037
+ var s0, s1;
1038
+ s0 = peg$currPos;
1039
+ if (input.charCodeAt(peg$currPos) === 42) {
1040
+ s1 = peg$c44;
1041
+ peg$currPos++;
1042
+ }
1043
+ else {
1044
+ s1 = peg$FAILED;
1045
+ if (peg$silentFails === 0) {
1046
+ peg$fail(peg$c45);
1047
+ }
1048
+ }
1049
+ if (s1 !== peg$FAILED) {
1050
+ peg$savedPos = s0;
1051
+ s1 = peg$c46();
1052
+ }
1053
+ s0 = s1;
1054
+ return s0;
1055
+ }
1056
+ function peg$parsequantifierOptional() {
1057
+ // @ts-ignore
1058
+ var s0, s1;
1059
+ s0 = peg$currPos;
1060
+ if (input.charCodeAt(peg$currPos) === 63) {
1061
+ s1 = peg$c17;
1062
+ peg$currPos++;
1063
+ }
1064
+ else {
1065
+ s1 = peg$FAILED;
1066
+ if (peg$silentFails === 0) {
1067
+ peg$fail(peg$c18);
1068
+ }
1069
+ }
1070
+ if (s1 !== peg$FAILED) {
1071
+ peg$savedPos = s0;
1072
+ s1 = peg$c47();
1073
+ }
1074
+ s0 = s1;
1075
+ return s0;
1076
+ }
1077
+ function peg$parsegreedyFlag() {
1078
+ var s0;
1079
+ if (input.charCodeAt(peg$currPos) === 63) {
1080
+ s0 = peg$c17;
1081
+ peg$currPos++;
1082
+ }
1083
+ else {
1084
+ s0 = peg$FAILED;
1085
+ if (peg$silentFails === 0) {
1086
+ peg$fail(peg$c18);
1087
+ }
1088
+ }
1089
+ return s0;
1090
+ }
1091
+ function peg$parseinteger() {
1092
+ var s0, s1, s2;
1093
+ s0 = peg$currPos;
1094
+ s1 = [];
1095
+ if (peg$c48.test(input.charAt(peg$currPos))) {
1096
+ s2 = input.charAt(peg$currPos);
1097
+ peg$currPos++;
1098
+ }
1099
+ else {
1100
+ s2 = peg$FAILED;
1101
+ if (peg$silentFails === 0) {
1102
+ peg$fail(peg$c49);
1103
+ }
1104
+ }
1105
+ if (s2 !== peg$FAILED) {
1106
+ while (s2 !== peg$FAILED) {
1107
+ s1.push(s2);
1108
+ if (peg$c48.test(input.charAt(peg$currPos))) {
1109
+ s2 = input.charAt(peg$currPos);
1110
+ peg$currPos++;
1111
+ }
1112
+ else {
1113
+ s2 = peg$FAILED;
1114
+ if (peg$silentFails === 0) {
1115
+ peg$fail(peg$c49);
1116
+ }
1117
+ }
1118
+ }
1119
+ }
1120
+ else {
1121
+ s1 = peg$FAILED;
1122
+ }
1123
+ if (s1 !== peg$FAILED) {
1124
+ peg$savedPos = s0;
1125
+ s1 = peg$c50(s1);
1126
+ }
1127
+ s0 = s1;
1128
+ return s0;
1129
+ }
1130
+ function peg$parsesubexp() {
1131
+ var s0, s1, s2, s3;
1132
+ s0 = peg$currPos;
1133
+ if (input.charCodeAt(peg$currPos) === 40) {
1134
+ s1 = peg$c6;
1135
+ peg$currPos++;
1136
+ }
1137
+ else {
1138
+ s1 = peg$FAILED;
1139
+ if (peg$silentFails === 0) {
1140
+ peg$fail(peg$c7);
1141
+ }
1142
+ }
1143
+ if (s1 !== peg$FAILED) {
1144
+ s2 = peg$parsepositiveLookbehind();
1145
+ if (s2 === peg$FAILED) {
1146
+ s2 = peg$parsenegativeLookbehind();
1147
+ if (s2 === peg$FAILED) {
1148
+ s2 = peg$parsepositiveLookahead();
1149
+ if (s2 === peg$FAILED) {
1150
+ s2 = peg$parsenegativeLookahead();
1151
+ if (s2 === peg$FAILED) {
1152
+ s2 = peg$parsegroupNamed();
1153
+ if (s2 === peg$FAILED) {
1154
+ s2 = peg$parsegroupNoCapture();
1155
+ if (s2 === peg$FAILED) {
1156
+ s2 = peg$parsegroupModifiers();
1157
+ if (s2 === peg$FAILED) {
1158
+ s2 = peg$parsemodifier();
1159
+ if (s2 === peg$FAILED) {
1160
+ s2 = peg$parsegroupCapture();
1161
+ }
1162
+ }
1163
+ }
1164
+ }
1165
+ }
1166
+ }
1167
+ }
1168
+ }
1169
+ if (s2 !== peg$FAILED) {
1170
+ if (input.charCodeAt(peg$currPos) === 41) {
1171
+ s3 = peg$c8;
1172
+ peg$currPos++;
1173
+ }
1174
+ else {
1175
+ s3 = peg$FAILED;
1176
+ if (peg$silentFails === 0) {
1177
+ peg$fail(peg$c9);
1178
+ }
1179
+ }
1180
+ if (s3 !== peg$FAILED) {
1181
+ peg$savedPos = s0;
1182
+ s1 = peg$c51(s2);
1183
+ s0 = s1;
1184
+ }
1185
+ else {
1186
+ peg$currPos = s0;
1187
+ s0 = peg$FAILED;
1188
+ }
1189
+ }
1190
+ else {
1191
+ peg$currPos = s0;
1192
+ s0 = peg$FAILED;
1193
+ }
1194
+ }
1195
+ else {
1196
+ peg$currPos = s0;
1197
+ s0 = peg$FAILED;
1198
+ }
1199
+ return s0;
1200
+ }
1201
+ function peg$parsegroupCapture() {
1202
+ // @ts-ignore
1203
+ var s0, s1;
1204
+ s0 = peg$currPos;
1205
+ s1 = peg$parseregexp();
1206
+ if (s1 !== peg$FAILED) {
1207
+ peg$savedPos = s0;
1208
+ s1 = peg$c52(s1);
1209
+ }
1210
+ s0 = s1;
1211
+ return s0;
1212
+ }
1213
+ function peg$parsegroupNoCapture() {
1214
+ var s0, s1, s2;
1215
+ s0 = peg$currPos;
1216
+ if (input.substr(peg$currPos, 2) === peg$c53) {
1217
+ s1 = peg$c53;
1218
+ peg$currPos += 2;
1219
+ }
1220
+ else {
1221
+ s1 = peg$FAILED;
1222
+ if (peg$silentFails === 0) {
1223
+ peg$fail(peg$c54);
1224
+ }
1225
+ }
1226
+ if (s1 !== peg$FAILED) {
1227
+ s2 = peg$parseregexp();
1228
+ if (s2 !== peg$FAILED) {
1229
+ peg$savedPos = s0;
1230
+ s1 = peg$c55(s2);
1231
+ s0 = s1;
1232
+ }
1233
+ else {
1234
+ peg$currPos = s0;
1235
+ s0 = peg$FAILED;
1236
+ }
1237
+ }
1238
+ else {
1239
+ peg$currPos = s0;
1240
+ s0 = peg$FAILED;
1241
+ }
1242
+ return s0;
1243
+ }
1244
+ function peg$parsegroupNamed() {
1245
+ var s0, s1, s2, s3, s4;
1246
+ s0 = peg$currPos;
1247
+ if (input.substr(peg$currPos, 2) === peg$c56) {
1248
+ s1 = peg$c56;
1249
+ peg$currPos += 2;
1250
+ }
1251
+ else {
1252
+ s1 = peg$FAILED;
1253
+ if (peg$silentFails === 0) {
1254
+ peg$fail(peg$c57);
1255
+ }
1256
+ }
1257
+ if (s1 !== peg$FAILED) {
1258
+ s2 = [];
1259
+ if (peg$c58.test(input.charAt(peg$currPos))) {
1260
+ s3 = input.charAt(peg$currPos);
1261
+ peg$currPos++;
1262
+ }
1263
+ else {
1264
+ s3 = peg$FAILED;
1265
+ if (peg$silentFails === 0) {
1266
+ peg$fail(peg$c59);
1267
+ }
1268
+ }
1269
+ if (s3 !== peg$FAILED) {
1270
+ while (s3 !== peg$FAILED) {
1271
+ s2.push(s3);
1272
+ if (peg$c58.test(input.charAt(peg$currPos))) {
1273
+ s3 = input.charAt(peg$currPos);
1274
+ peg$currPos++;
1275
+ }
1276
+ else {
1277
+ s3 = peg$FAILED;
1278
+ if (peg$silentFails === 0) {
1279
+ peg$fail(peg$c59);
1280
+ }
1281
+ }
1282
+ }
1283
+ }
1284
+ else {
1285
+ s2 = peg$FAILED;
1286
+ }
1287
+ if (s2 !== peg$FAILED) {
1288
+ if (input.charCodeAt(peg$currPos) === 62) {
1289
+ s3 = peg$c60;
1290
+ peg$currPos++;
1291
+ }
1292
+ else {
1293
+ s3 = peg$FAILED;
1294
+ if (peg$silentFails === 0) {
1295
+ peg$fail(peg$c61);
1296
+ }
1297
+ }
1298
+ if (s3 !== peg$FAILED) {
1299
+ s4 = peg$parseregexp();
1300
+ if (s4 !== peg$FAILED) {
1301
+ peg$savedPos = s0;
1302
+ s1 = peg$c62(s2, s4);
1303
+ s0 = s1;
1304
+ }
1305
+ else {
1306
+ peg$currPos = s0;
1307
+ s0 = peg$FAILED;
1308
+ }
1309
+ }
1310
+ else {
1311
+ peg$currPos = s0;
1312
+ s0 = peg$FAILED;
1313
+ }
1314
+ }
1315
+ else {
1316
+ peg$currPos = s0;
1317
+ s0 = peg$FAILED;
1318
+ }
1319
+ }
1320
+ else {
1321
+ peg$currPos = s0;
1322
+ s0 = peg$FAILED;
1323
+ }
1324
+ return s0;
1325
+ }
1326
+ function peg$parsepositiveLookbehind() {
1327
+ var s0, s1, s2;
1328
+ s0 = peg$currPos;
1329
+ if (input.substr(peg$currPos, 3) === peg$c63) {
1330
+ s1 = peg$c63;
1331
+ peg$currPos += 3;
1332
+ }
1333
+ else {
1334
+ s1 = peg$FAILED;
1335
+ if (peg$silentFails === 0) {
1336
+ peg$fail(peg$c64);
1337
+ }
1338
+ }
1339
+ if (s1 !== peg$FAILED) {
1340
+ s2 = peg$parseregexp();
1341
+ if (s2 !== peg$FAILED) {
1342
+ peg$savedPos = s0;
1343
+ s1 = peg$c65(s2);
1344
+ s0 = s1;
1345
+ }
1346
+ else {
1347
+ peg$currPos = s0;
1348
+ s0 = peg$FAILED;
1349
+ }
1350
+ }
1351
+ else {
1352
+ peg$currPos = s0;
1353
+ s0 = peg$FAILED;
1354
+ }
1355
+ return s0;
1356
+ }
1357
+ function peg$parsenegativeLookbehind() {
1358
+ var s0, s1, s2;
1359
+ s0 = peg$currPos;
1360
+ if (input.substr(peg$currPos, 3) === peg$c66) {
1361
+ s1 = peg$c66;
1362
+ peg$currPos += 3;
1363
+ }
1364
+ else {
1365
+ s1 = peg$FAILED;
1366
+ if (peg$silentFails === 0) {
1367
+ peg$fail(peg$c67);
1368
+ }
1369
+ }
1370
+ if (s1 !== peg$FAILED) {
1371
+ s2 = peg$parseregexp();
1372
+ if (s2 !== peg$FAILED) {
1373
+ peg$savedPos = s0;
1374
+ s1 = peg$c68(s2);
1375
+ s0 = s1;
1376
+ }
1377
+ else {
1378
+ peg$currPos = s0;
1379
+ s0 = peg$FAILED;
1380
+ }
1381
+ }
1382
+ else {
1383
+ peg$currPos = s0;
1384
+ s0 = peg$FAILED;
1385
+ }
1386
+ return s0;
1387
+ }
1388
+ function peg$parsepositiveLookahead() {
1389
+ var s0, s1, s2;
1390
+ s0 = peg$currPos;
1391
+ if (input.substr(peg$currPos, 2) === peg$c69) {
1392
+ s1 = peg$c69;
1393
+ peg$currPos += 2;
1394
+ }
1395
+ else {
1396
+ s1 = peg$FAILED;
1397
+ if (peg$silentFails === 0) {
1398
+ peg$fail(peg$c70);
1399
+ }
1400
+ }
1401
+ if (s1 !== peg$FAILED) {
1402
+ s2 = peg$parseregexp();
1403
+ if (s2 !== peg$FAILED) {
1404
+ peg$savedPos = s0;
1405
+ s1 = peg$c71(s2);
1406
+ s0 = s1;
1407
+ }
1408
+ else {
1409
+ peg$currPos = s0;
1410
+ s0 = peg$FAILED;
1411
+ }
1412
+ }
1413
+ else {
1414
+ peg$currPos = s0;
1415
+ s0 = peg$FAILED;
1416
+ }
1417
+ return s0;
1418
+ }
1419
+ function peg$parsenegativeLookahead() {
1420
+ var s0, s1, s2;
1421
+ s0 = peg$currPos;
1422
+ if (input.substr(peg$currPos, 2) === peg$c72) {
1423
+ s1 = peg$c72;
1424
+ peg$currPos += 2;
1425
+ }
1426
+ else {
1427
+ s1 = peg$FAILED;
1428
+ if (peg$silentFails === 0) {
1429
+ peg$fail(peg$c73);
1430
+ }
1431
+ }
1432
+ if (s1 !== peg$FAILED) {
1433
+ s2 = peg$parseregexp();
1434
+ if (s2 !== peg$FAILED) {
1435
+ peg$savedPos = s0;
1436
+ s1 = peg$c74(s2);
1437
+ s0 = s1;
1438
+ }
1439
+ else {
1440
+ peg$currPos = s0;
1441
+ s0 = peg$FAILED;
1442
+ }
1443
+ }
1444
+ else {
1445
+ peg$currPos = s0;
1446
+ s0 = peg$FAILED;
1447
+ }
1448
+ return s0;
1449
+ }
1450
+ function peg$parsegroupModifiers() {
1451
+ var s0, s1, s2, s3, s4;
1452
+ s0 = peg$currPos;
1453
+ if (input.charCodeAt(peg$currPos) === 63) {
1454
+ s1 = peg$c17;
1455
+ peg$currPos++;
1456
+ }
1457
+ else {
1458
+ s1 = peg$FAILED;
1459
+ if (peg$silentFails === 0) {
1460
+ peg$fail(peg$c18);
1461
+ }
1462
+ }
1463
+ if (s1 !== peg$FAILED) {
1464
+ s2 = peg$parsemodifierSpec();
1465
+ if (s2 !== peg$FAILED) {
1466
+ if (input.charCodeAt(peg$currPos) === 58) {
1467
+ s3 = peg$c75;
1468
+ peg$currPos++;
1469
+ }
1470
+ else {
1471
+ s3 = peg$FAILED;
1472
+ if (peg$silentFails === 0) {
1473
+ peg$fail(peg$c76);
1474
+ }
1475
+ }
1476
+ if (s3 !== peg$FAILED) {
1477
+ s4 = peg$parseregexp();
1478
+ if (s4 !== peg$FAILED) {
1479
+ peg$savedPos = s0;
1480
+ s1 = peg$c77(s2, s4);
1481
+ s0 = s1;
1482
+ }
1483
+ else {
1484
+ peg$currPos = s0;
1485
+ s0 = peg$FAILED;
1486
+ }
1487
+ }
1488
+ else {
1489
+ peg$currPos = s0;
1490
+ s0 = peg$FAILED;
1491
+ }
1492
+ }
1493
+ else {
1494
+ peg$currPos = s0;
1495
+ s0 = peg$FAILED;
1496
+ }
1497
+ }
1498
+ else {
1499
+ peg$currPos = s0;
1500
+ s0 = peg$FAILED;
1501
+ }
1502
+ return s0;
1503
+ }
1504
+ function peg$parsecharset() {
1505
+ var s0, s1, s2, s3, s4;
1506
+ peg$silentFails++;
1507
+ s0 = peg$currPos;
1508
+ if (input.charCodeAt(peg$currPos) === 91) {
1509
+ s1 = peg$c79;
1510
+ peg$currPos++;
1511
+ }
1512
+ else {
1513
+ s1 = peg$FAILED;
1514
+ if (peg$silentFails === 0) {
1515
+ peg$fail(peg$c80);
1516
+ }
1517
+ }
1518
+ if (s1 !== peg$FAILED) {
1519
+ if (input.charCodeAt(peg$currPos) === 94) {
1520
+ s2 = peg$c11;
1521
+ peg$currPos++;
1522
+ }
1523
+ else {
1524
+ s2 = peg$FAILED;
1525
+ if (peg$silentFails === 0) {
1526
+ peg$fail(peg$c12);
1527
+ }
1528
+ }
1529
+ if (s2 === peg$FAILED) {
1530
+ s2 = null;
1531
+ }
1532
+ if (s2 !== peg$FAILED) {
1533
+ s3 = [];
1534
+ s4 = peg$parsecharsetRange();
1535
+ if (s4 === peg$FAILED) {
1536
+ s4 = peg$parsecharsetTerminal();
1537
+ }
1538
+ while (s4 !== peg$FAILED) {
1539
+ s3.push(s4);
1540
+ s4 = peg$parsecharsetRange();
1541
+ if (s4 === peg$FAILED) {
1542
+ s4 = peg$parsecharsetTerminal();
1543
+ }
1544
+ }
1545
+ if (s3 !== peg$FAILED) {
1546
+ if (input.charCodeAt(peg$currPos) === 93) {
1547
+ s4 = peg$c81;
1548
+ peg$currPos++;
1549
+ }
1550
+ else {
1551
+ s4 = peg$FAILED;
1552
+ if (peg$silentFails === 0) {
1553
+ peg$fail(peg$c82);
1554
+ }
1555
+ }
1556
+ if (s4 !== peg$FAILED) {
1557
+ peg$savedPos = s0;
1558
+ s1 = peg$c83(s2, s3);
1559
+ s0 = s1;
1560
+ }
1561
+ else {
1562
+ peg$currPos = s0;
1563
+ s0 = peg$FAILED;
1564
+ }
1565
+ }
1566
+ else {
1567
+ peg$currPos = s0;
1568
+ s0 = peg$FAILED;
1569
+ }
1570
+ }
1571
+ else {
1572
+ peg$currPos = s0;
1573
+ s0 = peg$FAILED;
1574
+ }
1575
+ }
1576
+ else {
1577
+ peg$currPos = s0;
1578
+ s0 = peg$FAILED;
1579
+ }
1580
+ peg$silentFails--;
1581
+ if (s0 === peg$FAILED) {
1582
+ s1 = peg$FAILED;
1583
+ if (peg$silentFails === 0) {
1584
+ peg$fail(peg$c78);
1585
+ }
1586
+ }
1587
+ return s0;
1588
+ }
1589
+ function peg$parsecharsetRange() {
1590
+ var s0, s1, s2, s3;
1591
+ peg$silentFails++;
1592
+ s0 = peg$currPos;
1593
+ s1 = peg$parsecharsetTerminal();
1594
+ if (s1 !== peg$FAILED) {
1595
+ if (input.charCodeAt(peg$currPos) === 45) {
1596
+ s2 = peg$c22;
1597
+ peg$currPos++;
1598
+ }
1599
+ else {
1600
+ s2 = peg$FAILED;
1601
+ if (peg$silentFails === 0) {
1602
+ peg$fail(peg$c23);
1603
+ }
1604
+ }
1605
+ if (s2 !== peg$FAILED) {
1606
+ s3 = peg$parsecharsetTerminal();
1607
+ if (s3 !== peg$FAILED) {
1608
+ peg$savedPos = s0;
1609
+ s1 = peg$c85(s1, s3);
1610
+ s0 = s1;
1611
+ }
1612
+ else {
1613
+ peg$currPos = s0;
1614
+ s0 = peg$FAILED;
1615
+ }
1616
+ }
1617
+ else {
1618
+ peg$currPos = s0;
1619
+ s0 = peg$FAILED;
1620
+ }
1621
+ }
1622
+ else {
1623
+ peg$currPos = s0;
1624
+ s0 = peg$FAILED;
1625
+ }
1626
+ peg$silentFails--;
1627
+ if (s0 === peg$FAILED) {
1628
+ s1 = peg$FAILED;
1629
+ if (peg$silentFails === 0) {
1630
+ peg$fail(peg$c84);
1631
+ }
1632
+ }
1633
+ return s0;
1634
+ }
1635
+ function peg$parsecharsetTerminal() {
1636
+ // @ts-ignore
1637
+ var s0, s1;
1638
+ peg$silentFails++;
1639
+ s0 = peg$parsecharsetEscapedCharacter();
1640
+ if (s0 === peg$FAILED) {
1641
+ s0 = peg$parsecharsetLiteral();
1642
+ }
1643
+ peg$silentFails--;
1644
+ if (s0 === peg$FAILED) {
1645
+ s1 = peg$FAILED;
1646
+ if (peg$silentFails === 0) {
1647
+ peg$fail(peg$c86);
1648
+ }
1649
+ }
1650
+ return s0;
1651
+ }
1652
+ function peg$parsecharsetLiteral() {
1653
+ // @ts-ignore
1654
+ var s0, s1;
1655
+ s0 = peg$currPos;
1656
+ if (peg$c87.test(input.charAt(peg$currPos))) {
1657
+ s1 = input.charAt(peg$currPos);
1658
+ peg$currPos++;
1659
+ }
1660
+ else {
1661
+ s1 = peg$FAILED;
1662
+ if (peg$silentFails === 0) {
1663
+ peg$fail(peg$c88);
1664
+ }
1665
+ }
1666
+ if (s1 !== peg$FAILED) {
1667
+ peg$savedPos = s0;
1668
+ s1 = peg$c89(s1);
1669
+ }
1670
+ s0 = s1;
1671
+ return s0;
1672
+ }
1673
+ function peg$parsecharsetEscapedCharacter() {
1674
+ var s0;
1675
+ s0 = peg$parsebackspaceCharacter();
1676
+ if (s0 === peg$FAILED) {
1677
+ s0 = peg$parsecontrolCharacter();
1678
+ if (s0 === peg$FAILED) {
1679
+ s0 = peg$parsedigitCharacter();
1680
+ if (s0 === peg$FAILED) {
1681
+ s0 = peg$parsenonDigitCharacter();
1682
+ if (s0 === peg$FAILED) {
1683
+ s0 = peg$parseformFeedCharacter();
1684
+ if (s0 === peg$FAILED) {
1685
+ s0 = peg$parselineFeedCharacter();
1686
+ if (s0 === peg$FAILED) {
1687
+ s0 = peg$parsecarriageReturnCharacter();
1688
+ if (s0 === peg$FAILED) {
1689
+ s0 = peg$parsewhiteSpaceCharacter();
1690
+ if (s0 === peg$FAILED) {
1691
+ s0 = peg$parsenonWhiteSpaceCharacter();
1692
+ if (s0 === peg$FAILED) {
1693
+ s0 = peg$parsetabCharacter();
1694
+ if (s0 === peg$FAILED) {
1695
+ s0 = peg$parseverticalTabCharacter();
1696
+ if (s0 === peg$FAILED) {
1697
+ s0 = peg$parsewordCharacter();
1698
+ if (s0 === peg$FAILED) {
1699
+ s0 = peg$parsenonWordCharacter();
1700
+ if (s0 === peg$FAILED) {
1701
+ s0 = peg$parseoctalCharacter();
1702
+ if (s0 === peg$FAILED) {
1703
+ s0 = peg$parsehexCharacter();
1704
+ if (s0 === peg$FAILED) {
1705
+ s0 = peg$parseutf16Character();
1706
+ if (s0 === peg$FAILED) {
1707
+ s0 = peg$parseunicodeCharacter();
1708
+ if (s0 === peg$FAILED) {
1709
+ s0 = peg$parsenullCharacter();
1710
+ if (s0 === peg$FAILED) {
1711
+ s0 = peg$parseotherEscaped();
1712
+ }
1713
+ }
1714
+ }
1715
+ }
1716
+ }
1717
+ }
1718
+ }
1719
+ }
1720
+ }
1721
+ }
1722
+ }
1723
+ }
1724
+ }
1725
+ }
1726
+ }
1727
+ }
1728
+ }
1729
+ }
1730
+ return s0;
1731
+ }
1732
+ function peg$parseterminal() {
1733
+ var s0;
1734
+ s0 = peg$parseanyCharacter();
1735
+ if (s0 === peg$FAILED) {
1736
+ s0 = peg$parseescapedCharacter();
1737
+ if (s0 === peg$FAILED) {
1738
+ s0 = peg$parseliteral();
1739
+ }
1740
+ }
1741
+ return s0;
1742
+ }
1743
+ function peg$parseanyCharacter() {
1744
+ // @ts-ignore
1745
+ var s0, s1;
1746
+ s0 = peg$currPos;
1747
+ if (input.charCodeAt(peg$currPos) === 46) {
1748
+ s1 = peg$c90;
1749
+ peg$currPos++;
1750
+ }
1751
+ else {
1752
+ s1 = peg$FAILED;
1753
+ if (peg$silentFails === 0) {
1754
+ peg$fail(peg$c91);
1755
+ }
1756
+ }
1757
+ if (s1 !== peg$FAILED) {
1758
+ peg$savedPos = s0;
1759
+ s1 = peg$c92();
1760
+ }
1761
+ s0 = s1;
1762
+ return s0;
1763
+ }
1764
+ function peg$parseliteral() {
1765
+ var s0, s1, s2;
1766
+ peg$silentFails++;
1767
+ s0 = peg$currPos;
1768
+ s1 = [];
1769
+ if (peg$c94.test(input.charAt(peg$currPos))) {
1770
+ s2 = input.charAt(peg$currPos);
1771
+ peg$currPos++;
1772
+ }
1773
+ else {
1774
+ s2 = peg$FAILED;
1775
+ if (peg$silentFails === 0) {
1776
+ peg$fail(peg$c95);
1777
+ }
1778
+ }
1779
+ if (s2 !== peg$FAILED) {
1780
+ while (s2 !== peg$FAILED) {
1781
+ s1.push(s2);
1782
+ if (peg$c94.test(input.charAt(peg$currPos))) {
1783
+ s2 = input.charAt(peg$currPos);
1784
+ peg$currPos++;
1785
+ }
1786
+ else {
1787
+ s2 = peg$FAILED;
1788
+ if (peg$silentFails === 0) {
1789
+ peg$fail(peg$c95);
1790
+ }
1791
+ }
1792
+ }
1793
+ }
1794
+ else {
1795
+ s1 = peg$FAILED;
1796
+ }
1797
+ if (s1 !== peg$FAILED) {
1798
+ peg$savedPos = s0;
1799
+ s1 = peg$c96(s1);
1800
+ }
1801
+ s0 = s1;
1802
+ peg$silentFails--;
1803
+ if (s0 === peg$FAILED) {
1804
+ s1 = peg$FAILED;
1805
+ if (peg$silentFails === 0) {
1806
+ peg$fail(peg$c93);
1807
+ }
1808
+ }
1809
+ return s0;
1810
+ }
1811
+ function peg$parseescapedCharacter() {
1812
+ var s0;
1813
+ s0 = peg$parsewordBoundaryCharacter();
1814
+ if (s0 === peg$FAILED) {
1815
+ s0 = peg$parsenonWordBoundaryCharacter();
1816
+ if (s0 === peg$FAILED) {
1817
+ s0 = peg$parsecontrolCharacter();
1818
+ if (s0 === peg$FAILED) {
1819
+ s0 = peg$parsedigitCharacter();
1820
+ if (s0 === peg$FAILED) {
1821
+ s0 = peg$parsenonDigitCharacter();
1822
+ if (s0 === peg$FAILED) {
1823
+ s0 = peg$parseformFeedCharacter();
1824
+ if (s0 === peg$FAILED) {
1825
+ s0 = peg$parselineFeedCharacter();
1826
+ if (s0 === peg$FAILED) {
1827
+ s0 = peg$parsecarriageReturnCharacter();
1828
+ if (s0 === peg$FAILED) {
1829
+ s0 = peg$parsewhiteSpaceCharacter();
1830
+ if (s0 === peg$FAILED) {
1831
+ s0 = peg$parsenonWhiteSpaceCharacter();
1832
+ if (s0 === peg$FAILED) {
1833
+ s0 = peg$parsetabCharacter();
1834
+ if (s0 === peg$FAILED) {
1835
+ s0 = peg$parseverticalTabCharacter();
1836
+ if (s0 === peg$FAILED) {
1837
+ s0 = peg$parsewordCharacter();
1838
+ if (s0 === peg$FAILED) {
1839
+ s0 = peg$parsenonWordCharacter();
1840
+ if (s0 === peg$FAILED) {
1841
+ s0 = peg$parsebackReference();
1842
+ if (s0 === peg$FAILED) {
1843
+ s0 = peg$parsenamedBackReference();
1844
+ if (s0 === peg$FAILED) {
1845
+ s0 = peg$parseoctalCharacter();
1846
+ if (s0 === peg$FAILED) {
1847
+ s0 = peg$parsehexCharacter();
1848
+ if (s0 === peg$FAILED) {
1849
+ s0 = peg$parseutf16Character();
1850
+ if (s0 === peg$FAILED) {
1851
+ s0 = peg$parseunicodeCharacter();
1852
+ if (s0 === peg$FAILED) {
1853
+ s0 = peg$parseunicodeProperty();
1854
+ if (s0 === peg$FAILED) {
1855
+ s0 = peg$parsenonUnicodeProperty();
1856
+ if (s0 === peg$FAILED) {
1857
+ s0 = peg$parsenullCharacter();
1858
+ if (s0 === peg$FAILED) {
1859
+ s0 = peg$parseotherEscaped();
1860
+ }
1861
+ }
1862
+ }
1863
+ }
1864
+ }
1865
+ }
1866
+ }
1867
+ }
1868
+ }
1869
+ }
1870
+ }
1871
+ }
1872
+ }
1873
+ }
1874
+ }
1875
+ }
1876
+ }
1877
+ }
1878
+ }
1879
+ }
1880
+ }
1881
+ }
1882
+ }
1883
+ return s0;
1884
+ }
1885
+ function peg$parsebackReference() {
1886
+ var s0, s1, s2;
1887
+ s0 = peg$currPos;
1888
+ if (input.charCodeAt(peg$currPos) === 92) {
1889
+ s1 = peg$c97;
1890
+ peg$currPos++;
1891
+ }
1892
+ else {
1893
+ s1 = peg$FAILED;
1894
+ if (peg$silentFails === 0) {
1895
+ peg$fail(peg$c98);
1896
+ }
1897
+ }
1898
+ if (s1 !== peg$FAILED) {
1899
+ if (peg$c99.test(input.charAt(peg$currPos))) {
1900
+ s2 = input.charAt(peg$currPos);
1901
+ peg$currPos++;
1902
+ }
1903
+ else {
1904
+ s2 = peg$FAILED;
1905
+ if (peg$silentFails === 0) {
1906
+ peg$fail(peg$c100);
1907
+ }
1908
+ }
1909
+ if (s2 !== peg$FAILED) {
1910
+ peg$savedPos = s0;
1911
+ s1 = peg$c101(s2);
1912
+ s0 = s1;
1913
+ }
1914
+ else {
1915
+ peg$currPos = s0;
1916
+ s0 = peg$FAILED;
1917
+ }
1918
+ }
1919
+ else {
1920
+ peg$currPos = s0;
1921
+ s0 = peg$FAILED;
1922
+ }
1923
+ return s0;
1924
+ }
1925
+ function peg$parsebackspaceCharacter() {
1926
+ // @ts-ignore
1927
+ var s0, s1;
1928
+ s0 = peg$currPos;
1929
+ if (input.substr(peg$currPos, 2) === peg$c102) {
1930
+ s1 = peg$c102;
1931
+ peg$currPos += 2;
1932
+ }
1933
+ else {
1934
+ s1 = peg$FAILED;
1935
+ if (peg$silentFails === 0) {
1936
+ peg$fail(peg$c103);
1937
+ }
1938
+ }
1939
+ if (s1 !== peg$FAILED) {
1940
+ peg$savedPos = s0;
1941
+ s1 = peg$c104();
1942
+ }
1943
+ s0 = s1;
1944
+ return s0;
1945
+ }
1946
+ function peg$parsecarriageReturnCharacter() {
1947
+ // @ts-ignore
1948
+ var s0, s1;
1949
+ s0 = peg$currPos;
1950
+ if (input.substr(peg$currPos, 2) === peg$c105) {
1951
+ s1 = peg$c105;
1952
+ peg$currPos += 2;
1953
+ }
1954
+ else {
1955
+ s1 = peg$FAILED;
1956
+ if (peg$silentFails === 0) {
1957
+ peg$fail(peg$c106);
1958
+ }
1959
+ }
1960
+ if (s1 !== peg$FAILED) {
1961
+ peg$savedPos = s0;
1962
+ s1 = peg$c107();
1963
+ }
1964
+ s0 = s1;
1965
+ return s0;
1966
+ }
1967
+ function peg$parsecontrolCharacter() {
1968
+ var s0, s1, s2;
1969
+ s0 = peg$currPos;
1970
+ if (input.substr(peg$currPos, 2) === peg$c108) {
1971
+ s1 = peg$c108;
1972
+ peg$currPos += 2;
1973
+ }
1974
+ else {
1975
+ s1 = peg$FAILED;
1976
+ if (peg$silentFails === 0) {
1977
+ peg$fail(peg$c109);
1978
+ }
1979
+ }
1980
+ if (s1 !== peg$FAILED) {
1981
+ if (input.length > peg$currPos) {
1982
+ s2 = input.charAt(peg$currPos);
1983
+ peg$currPos++;
1984
+ }
1985
+ else {
1986
+ s2 = peg$FAILED;
1987
+ if (peg$silentFails === 0) {
1988
+ peg$fail(peg$c110);
1989
+ }
1990
+ }
1991
+ if (s2 !== peg$FAILED) {
1992
+ peg$savedPos = s0;
1993
+ s1 = peg$c111(s2);
1994
+ s0 = s1;
1995
+ }
1996
+ else {
1997
+ peg$currPos = s0;
1998
+ s0 = peg$FAILED;
1999
+ }
2000
+ }
2001
+ else {
2002
+ peg$currPos = s0;
2003
+ s0 = peg$FAILED;
2004
+ }
2005
+ return s0;
2006
+ }
2007
+ function peg$parsedigitCharacter() {
2008
+ // @ts-ignore
2009
+ var s0, s1;
2010
+ s0 = peg$currPos;
2011
+ if (input.substr(peg$currPos, 2) === peg$c112) {
2012
+ s1 = peg$c112;
2013
+ peg$currPos += 2;
2014
+ }
2015
+ else {
2016
+ s1 = peg$FAILED;
2017
+ if (peg$silentFails === 0) {
2018
+ peg$fail(peg$c113);
2019
+ }
2020
+ }
2021
+ if (s1 !== peg$FAILED) {
2022
+ peg$savedPos = s0;
2023
+ s1 = peg$c114();
2024
+ }
2025
+ s0 = s1;
2026
+ return s0;
2027
+ }
2028
+ function peg$parsenonDigitCharacter() {
2029
+ // @ts-ignore
2030
+ var s0, s1;
2031
+ s0 = peg$currPos;
2032
+ if (input.substr(peg$currPos, 2) === peg$c115) {
2033
+ s1 = peg$c115;
2034
+ peg$currPos += 2;
2035
+ }
2036
+ else {
2037
+ s1 = peg$FAILED;
2038
+ if (peg$silentFails === 0) {
2039
+ peg$fail(peg$c116);
2040
+ }
2041
+ }
2042
+ if (s1 !== peg$FAILED) {
2043
+ peg$savedPos = s0;
2044
+ s1 = peg$c117();
2045
+ }
2046
+ s0 = s1;
2047
+ return s0;
2048
+ }
2049
+ function peg$parseformFeedCharacter() {
2050
+ // @ts-ignore
2051
+ var s0, s1;
2052
+ s0 = peg$currPos;
2053
+ if (input.substr(peg$currPos, 2) === peg$c118) {
2054
+ s1 = peg$c118;
2055
+ peg$currPos += 2;
2056
+ }
2057
+ else {
2058
+ s1 = peg$FAILED;
2059
+ if (peg$silentFails === 0) {
2060
+ peg$fail(peg$c119);
2061
+ }
2062
+ }
2063
+ if (s1 !== peg$FAILED) {
2064
+ peg$savedPos = s0;
2065
+ s1 = peg$c120();
2066
+ }
2067
+ s0 = s1;
2068
+ return s0;
2069
+ }
2070
+ function peg$parsehexCharacter() {
2071
+ var s0, s1, s2, s3;
2072
+ s0 = peg$currPos;
2073
+ if (input.substr(peg$currPos, 2) === peg$c121) {
2074
+ s1 = peg$c121;
2075
+ peg$currPos += 2;
2076
+ }
2077
+ else {
2078
+ s1 = peg$FAILED;
2079
+ if (peg$silentFails === 0) {
2080
+ peg$fail(peg$c122);
2081
+ }
2082
+ }
2083
+ if (s1 !== peg$FAILED) {
2084
+ s2 = [];
2085
+ if (peg$c123.test(input.charAt(peg$currPos))) {
2086
+ s3 = input.charAt(peg$currPos);
2087
+ peg$currPos++;
2088
+ }
2089
+ else {
2090
+ s3 = peg$FAILED;
2091
+ if (peg$silentFails === 0) {
2092
+ peg$fail(peg$c124);
2093
+ }
2094
+ }
2095
+ if (s3 !== peg$FAILED) {
2096
+ while (s3 !== peg$FAILED) {
2097
+ s2.push(s3);
2098
+ if (peg$c123.test(input.charAt(peg$currPos))) {
2099
+ s3 = input.charAt(peg$currPos);
2100
+ peg$currPos++;
2101
+ }
2102
+ else {
2103
+ s3 = peg$FAILED;
2104
+ if (peg$silentFails === 0) {
2105
+ peg$fail(peg$c124);
2106
+ }
2107
+ }
2108
+ }
2109
+ }
2110
+ else {
2111
+ s2 = peg$FAILED;
2112
+ }
2113
+ if (s2 !== peg$FAILED) {
2114
+ peg$savedPos = s0;
2115
+ s1 = peg$c125(s2);
2116
+ s0 = s1;
2117
+ }
2118
+ else {
2119
+ peg$currPos = s0;
2120
+ s0 = peg$FAILED;
2121
+ }
2122
+ }
2123
+ else {
2124
+ peg$currPos = s0;
2125
+ s0 = peg$FAILED;
2126
+ }
2127
+ return s0;
2128
+ }
2129
+ function peg$parselineFeedCharacter() {
2130
+ // @ts-ignore
2131
+ var s0, s1;
2132
+ s0 = peg$currPos;
2133
+ if (input.substr(peg$currPos, 2) === peg$c126) {
2134
+ s1 = peg$c126;
2135
+ peg$currPos += 2;
2136
+ }
2137
+ else {
2138
+ s1 = peg$FAILED;
2139
+ if (peg$silentFails === 0) {
2140
+ peg$fail(peg$c127);
2141
+ }
2142
+ }
2143
+ if (s1 !== peg$FAILED) {
2144
+ peg$savedPos = s0;
2145
+ s1 = peg$c128();
2146
+ }
2147
+ s0 = s1;
2148
+ return s0;
2149
+ }
2150
+ function peg$parsenamedBackReference() {
2151
+ var s0, s1, s2, s3;
2152
+ s0 = peg$currPos;
2153
+ if (input.substr(peg$currPos, 3) === peg$c129) {
2154
+ s1 = peg$c129;
2155
+ peg$currPos += 3;
2156
+ }
2157
+ else {
2158
+ s1 = peg$FAILED;
2159
+ if (peg$silentFails === 0) {
2160
+ peg$fail(peg$c130);
2161
+ }
2162
+ }
2163
+ if (s1 !== peg$FAILED) {
2164
+ s2 = [];
2165
+ if (peg$c58.test(input.charAt(peg$currPos))) {
2166
+ s3 = input.charAt(peg$currPos);
2167
+ peg$currPos++;
2168
+ }
2169
+ else {
2170
+ s3 = peg$FAILED;
2171
+ if (peg$silentFails === 0) {
2172
+ peg$fail(peg$c59);
2173
+ }
2174
+ }
2175
+ if (s3 !== peg$FAILED) {
2176
+ while (s3 !== peg$FAILED) {
2177
+ s2.push(s3);
2178
+ if (peg$c58.test(input.charAt(peg$currPos))) {
2179
+ s3 = input.charAt(peg$currPos);
2180
+ peg$currPos++;
2181
+ }
2182
+ else {
2183
+ s3 = peg$FAILED;
2184
+ if (peg$silentFails === 0) {
2185
+ peg$fail(peg$c59);
2186
+ }
2187
+ }
2188
+ }
2189
+ }
2190
+ else {
2191
+ s2 = peg$FAILED;
2192
+ }
2193
+ if (s2 !== peg$FAILED) {
2194
+ if (input.charCodeAt(peg$currPos) === 62) {
2195
+ s3 = peg$c60;
2196
+ peg$currPos++;
2197
+ }
2198
+ else {
2199
+ s3 = peg$FAILED;
2200
+ if (peg$silentFails === 0) {
2201
+ peg$fail(peg$c61);
2202
+ }
2203
+ }
2204
+ if (s3 !== peg$FAILED) {
2205
+ peg$savedPos = s0;
2206
+ s1 = peg$c131(s2);
2207
+ s0 = s1;
2208
+ }
2209
+ else {
2210
+ peg$currPos = s0;
2211
+ s0 = peg$FAILED;
2212
+ }
2213
+ }
2214
+ else {
2215
+ peg$currPos = s0;
2216
+ s0 = peg$FAILED;
2217
+ }
2218
+ }
2219
+ else {
2220
+ peg$currPos = s0;
2221
+ s0 = peg$FAILED;
2222
+ }
2223
+ return s0;
2224
+ }
2225
+ function peg$parsenullCharacter() {
2226
+ // @ts-ignore
2227
+ var s0, s1;
2228
+ s0 = peg$currPos;
2229
+ if (input.substr(peg$currPos, 2) === peg$c132) {
2230
+ s1 = peg$c132;
2231
+ peg$currPos += 2;
2232
+ }
2233
+ else {
2234
+ s1 = peg$FAILED;
2235
+ if (peg$silentFails === 0) {
2236
+ peg$fail(peg$c133);
2237
+ }
2238
+ }
2239
+ if (s1 !== peg$FAILED) {
2240
+ peg$savedPos = s0;
2241
+ s1 = peg$c134();
2242
+ }
2243
+ s0 = s1;
2244
+ return s0;
2245
+ }
2246
+ function peg$parseoctalCharacter() {
2247
+ var s0, s1, s2, s3;
2248
+ s0 = peg$currPos;
2249
+ if (input.substr(peg$currPos, 2) === peg$c132) {
2250
+ s1 = peg$c132;
2251
+ peg$currPos += 2;
2252
+ }
2253
+ else {
2254
+ s1 = peg$FAILED;
2255
+ if (peg$silentFails === 0) {
2256
+ peg$fail(peg$c133);
2257
+ }
2258
+ }
2259
+ if (s1 !== peg$FAILED) {
2260
+ s2 = [];
2261
+ if (peg$c135.test(input.charAt(peg$currPos))) {
2262
+ s3 = input.charAt(peg$currPos);
2263
+ peg$currPos++;
2264
+ }
2265
+ else {
2266
+ s3 = peg$FAILED;
2267
+ if (peg$silentFails === 0) {
2268
+ peg$fail(peg$c136);
2269
+ }
2270
+ }
2271
+ if (s3 !== peg$FAILED) {
2272
+ while (s3 !== peg$FAILED) {
2273
+ s2.push(s3);
2274
+ if (peg$c135.test(input.charAt(peg$currPos))) {
2275
+ s3 = input.charAt(peg$currPos);
2276
+ peg$currPos++;
2277
+ }
2278
+ else {
2279
+ s3 = peg$FAILED;
2280
+ if (peg$silentFails === 0) {
2281
+ peg$fail(peg$c136);
2282
+ }
2283
+ }
2284
+ }
2285
+ }
2286
+ else {
2287
+ s2 = peg$FAILED;
2288
+ }
2289
+ if (s2 !== peg$FAILED) {
2290
+ peg$savedPos = s0;
2291
+ s1 = peg$c137(s2);
2292
+ s0 = s1;
2293
+ }
2294
+ else {
2295
+ peg$currPos = s0;
2296
+ s0 = peg$FAILED;
2297
+ }
2298
+ }
2299
+ else {
2300
+ peg$currPos = s0;
2301
+ s0 = peg$FAILED;
2302
+ }
2303
+ return s0;
2304
+ }
2305
+ function peg$parsetabCharacter() {
2306
+ // @ts-ignore
2307
+ var s0, s1;
2308
+ s0 = peg$currPos;
2309
+ if (input.substr(peg$currPos, 2) === peg$c138) {
2310
+ s1 = peg$c138;
2311
+ peg$currPos += 2;
2312
+ }
2313
+ else {
2314
+ s1 = peg$FAILED;
2315
+ if (peg$silentFails === 0) {
2316
+ peg$fail(peg$c139);
2317
+ }
2318
+ }
2319
+ if (s1 !== peg$FAILED) {
2320
+ peg$savedPos = s0;
2321
+ s1 = peg$c140();
2322
+ }
2323
+ s0 = s1;
2324
+ return s0;
2325
+ }
2326
+ function peg$parseunicodeCharacter() {
2327
+ var s0, s1, s2, s3;
2328
+ s0 = peg$currPos;
2329
+ if (input.substr(peg$currPos, 3) === peg$c141) {
2330
+ s1 = peg$c141;
2331
+ peg$currPos += 3;
2332
+ }
2333
+ else {
2334
+ s1 = peg$FAILED;
2335
+ if (peg$silentFails === 0) {
2336
+ peg$fail(peg$c142);
2337
+ }
2338
+ }
2339
+ if (s1 !== peg$FAILED) {
2340
+ s2 = [];
2341
+ if (peg$c123.test(input.charAt(peg$currPos))) {
2342
+ s3 = input.charAt(peg$currPos);
2343
+ peg$currPos++;
2344
+ }
2345
+ else {
2346
+ s3 = peg$FAILED;
2347
+ if (peg$silentFails === 0) {
2348
+ peg$fail(peg$c124);
2349
+ }
2350
+ }
2351
+ if (s3 !== peg$FAILED) {
2352
+ while (s3 !== peg$FAILED) {
2353
+ s2.push(s3);
2354
+ if (peg$c123.test(input.charAt(peg$currPos))) {
2355
+ s3 = input.charAt(peg$currPos);
2356
+ peg$currPos++;
2357
+ }
2358
+ else {
2359
+ s3 = peg$FAILED;
2360
+ if (peg$silentFails === 0) {
2361
+ peg$fail(peg$c124);
2362
+ }
2363
+ }
2364
+ }
2365
+ }
2366
+ else {
2367
+ s2 = peg$FAILED;
2368
+ }
2369
+ if (s2 !== peg$FAILED) {
2370
+ if (input.charCodeAt(peg$currPos) === 125) {
2371
+ s3 = peg$c34;
2372
+ peg$currPos++;
2373
+ }
2374
+ else {
2375
+ s3 = peg$FAILED;
2376
+ if (peg$silentFails === 0) {
2377
+ peg$fail(peg$c35);
2378
+ }
2379
+ }
2380
+ if (s3 !== peg$FAILED) {
2381
+ peg$savedPos = s0;
2382
+ s1 = peg$c143(s2);
2383
+ s0 = s1;
2384
+ }
2385
+ else {
2386
+ peg$currPos = s0;
2387
+ s0 = peg$FAILED;
2388
+ }
2389
+ }
2390
+ else {
2391
+ peg$currPos = s0;
2392
+ s0 = peg$FAILED;
2393
+ }
2394
+ }
2395
+ else {
2396
+ peg$currPos = s0;
2397
+ s0 = peg$FAILED;
2398
+ }
2399
+ return s0;
2400
+ }
2401
+ function peg$parseunicodeProperty() {
2402
+ var s0, s1, s2, s3;
2403
+ s0 = peg$currPos;
2404
+ if (input.substr(peg$currPos, 3) === peg$c144) {
2405
+ s1 = peg$c144;
2406
+ peg$currPos += 3;
2407
+ }
2408
+ else {
2409
+ s1 = peg$FAILED;
2410
+ if (peg$silentFails === 0) {
2411
+ peg$fail(peg$c145);
2412
+ }
2413
+ }
2414
+ if (s1 !== peg$FAILED) {
2415
+ s2 = [];
2416
+ if (peg$c146.test(input.charAt(peg$currPos))) {
2417
+ s3 = input.charAt(peg$currPos);
2418
+ peg$currPos++;
2419
+ }
2420
+ else {
2421
+ s3 = peg$FAILED;
2422
+ if (peg$silentFails === 0) {
2423
+ peg$fail(peg$c147);
2424
+ }
2425
+ }
2426
+ if (s3 !== peg$FAILED) {
2427
+ while (s3 !== peg$FAILED) {
2428
+ s2.push(s3);
2429
+ if (peg$c146.test(input.charAt(peg$currPos))) {
2430
+ s3 = input.charAt(peg$currPos);
2431
+ peg$currPos++;
2432
+ }
2433
+ else {
2434
+ s3 = peg$FAILED;
2435
+ if (peg$silentFails === 0) {
2436
+ peg$fail(peg$c147);
2437
+ }
2438
+ }
2439
+ }
2440
+ }
2441
+ else {
2442
+ s2 = peg$FAILED;
2443
+ }
2444
+ if (s2 !== peg$FAILED) {
2445
+ if (input.charCodeAt(peg$currPos) === 125) {
2446
+ s3 = peg$c34;
2447
+ peg$currPos++;
2448
+ }
2449
+ else {
2450
+ s3 = peg$FAILED;
2451
+ if (peg$silentFails === 0) {
2452
+ peg$fail(peg$c35);
2453
+ }
2454
+ }
2455
+ if (s3 !== peg$FAILED) {
2456
+ peg$savedPos = s0;
2457
+ s1 = peg$c148(s2);
2458
+ s0 = s1;
2459
+ }
2460
+ else {
2461
+ peg$currPos = s0;
2462
+ s0 = peg$FAILED;
2463
+ }
2464
+ }
2465
+ else {
2466
+ peg$currPos = s0;
2467
+ s0 = peg$FAILED;
2468
+ }
2469
+ }
2470
+ else {
2471
+ peg$currPos = s0;
2472
+ s0 = peg$FAILED;
2473
+ }
2474
+ return s0;
2475
+ }
2476
+ function peg$parsenonUnicodeProperty() {
2477
+ var s0, s1, s2, s3;
2478
+ s0 = peg$currPos;
2479
+ if (input.substr(peg$currPos, 3) === peg$c149) {
2480
+ s1 = peg$c149;
2481
+ peg$currPos += 3;
2482
+ }
2483
+ else {
2484
+ s1 = peg$FAILED;
2485
+ if (peg$silentFails === 0) {
2486
+ peg$fail(peg$c150);
2487
+ }
2488
+ }
2489
+ if (s1 !== peg$FAILED) {
2490
+ s2 = [];
2491
+ if (peg$c146.test(input.charAt(peg$currPos))) {
2492
+ s3 = input.charAt(peg$currPos);
2493
+ peg$currPos++;
2494
+ }
2495
+ else {
2496
+ s3 = peg$FAILED;
2497
+ if (peg$silentFails === 0) {
2498
+ peg$fail(peg$c147);
2499
+ }
2500
+ }
2501
+ if (s3 !== peg$FAILED) {
2502
+ while (s3 !== peg$FAILED) {
2503
+ s2.push(s3);
2504
+ if (peg$c146.test(input.charAt(peg$currPos))) {
2505
+ s3 = input.charAt(peg$currPos);
2506
+ peg$currPos++;
2507
+ }
2508
+ else {
2509
+ s3 = peg$FAILED;
2510
+ if (peg$silentFails === 0) {
2511
+ peg$fail(peg$c147);
2512
+ }
2513
+ }
2514
+ }
2515
+ }
2516
+ else {
2517
+ s2 = peg$FAILED;
2518
+ }
2519
+ if (s2 !== peg$FAILED) {
2520
+ if (input.charCodeAt(peg$currPos) === 125) {
2521
+ s3 = peg$c34;
2522
+ peg$currPos++;
2523
+ }
2524
+ else {
2525
+ s3 = peg$FAILED;
2526
+ if (peg$silentFails === 0) {
2527
+ peg$fail(peg$c35);
2528
+ }
2529
+ }
2530
+ if (s3 !== peg$FAILED) {
2531
+ peg$savedPos = s0;
2532
+ s1 = peg$c151(s2);
2533
+ s0 = s1;
2534
+ }
2535
+ else {
2536
+ peg$currPos = s0;
2537
+ s0 = peg$FAILED;
2538
+ }
2539
+ }
2540
+ else {
2541
+ peg$currPos = s0;
2542
+ s0 = peg$FAILED;
2543
+ }
2544
+ }
2545
+ else {
2546
+ peg$currPos = s0;
2547
+ s0 = peg$FAILED;
2548
+ }
2549
+ return s0;
2550
+ }
2551
+ function peg$parseutf16Character() {
2552
+ var s0, s1, s2, s3;
2553
+ s0 = peg$currPos;
2554
+ if (input.substr(peg$currPos, 2) === peg$c152) {
2555
+ s1 = peg$c152;
2556
+ peg$currPos += 2;
2557
+ }
2558
+ else {
2559
+ s1 = peg$FAILED;
2560
+ if (peg$silentFails === 0) {
2561
+ peg$fail(peg$c153);
2562
+ }
2563
+ }
2564
+ if (s1 !== peg$FAILED) {
2565
+ s2 = [];
2566
+ if (peg$c123.test(input.charAt(peg$currPos))) {
2567
+ s3 = input.charAt(peg$currPos);
2568
+ peg$currPos++;
2569
+ }
2570
+ else {
2571
+ s3 = peg$FAILED;
2572
+ if (peg$silentFails === 0) {
2573
+ peg$fail(peg$c124);
2574
+ }
2575
+ }
2576
+ if (s3 !== peg$FAILED) {
2577
+ while (s3 !== peg$FAILED) {
2578
+ s2.push(s3);
2579
+ if (peg$c123.test(input.charAt(peg$currPos))) {
2580
+ s3 = input.charAt(peg$currPos);
2581
+ peg$currPos++;
2582
+ }
2583
+ else {
2584
+ s3 = peg$FAILED;
2585
+ if (peg$silentFails === 0) {
2586
+ peg$fail(peg$c124);
2587
+ }
2588
+ }
2589
+ }
2590
+ }
2591
+ else {
2592
+ s2 = peg$FAILED;
2593
+ }
2594
+ if (s2 !== peg$FAILED) {
2595
+ peg$savedPos = s0;
2596
+ s1 = peg$c154(s2);
2597
+ s0 = s1;
2598
+ }
2599
+ else {
2600
+ peg$currPos = s0;
2601
+ s0 = peg$FAILED;
2602
+ }
2603
+ }
2604
+ else {
2605
+ peg$currPos = s0;
2606
+ s0 = peg$FAILED;
2607
+ }
2608
+ return s0;
2609
+ }
2610
+ function peg$parseverticalTabCharacter() {
2611
+ // @ts-ignore
2612
+ var s0, s1;
2613
+ s0 = peg$currPos;
2614
+ if (input.substr(peg$currPos, 2) === peg$c155) {
2615
+ s1 = peg$c155;
2616
+ peg$currPos += 2;
2617
+ }
2618
+ else {
2619
+ s1 = peg$FAILED;
2620
+ if (peg$silentFails === 0) {
2621
+ peg$fail(peg$c156);
2622
+ }
2623
+ }
2624
+ if (s1 !== peg$FAILED) {
2625
+ peg$savedPos = s0;
2626
+ s1 = peg$c157();
2627
+ }
2628
+ s0 = s1;
2629
+ return s0;
2630
+ }
2631
+ function peg$parsewhiteSpaceCharacter() {
2632
+ // @ts-ignore
2633
+ var s0, s1;
2634
+ s0 = peg$currPos;
2635
+ if (input.substr(peg$currPos, 2) === peg$c158) {
2636
+ s1 = peg$c158;
2637
+ peg$currPos += 2;
2638
+ }
2639
+ else {
2640
+ s1 = peg$FAILED;
2641
+ if (peg$silentFails === 0) {
2642
+ peg$fail(peg$c159);
2643
+ }
2644
+ }
2645
+ if (s1 !== peg$FAILED) {
2646
+ peg$savedPos = s0;
2647
+ s1 = peg$c160();
2648
+ }
2649
+ s0 = s1;
2650
+ return s0;
2651
+ }
2652
+ function peg$parsenonWhiteSpaceCharacter() {
2653
+ // @ts-ignore
2654
+ var s0, s1;
2655
+ s0 = peg$currPos;
2656
+ if (input.substr(peg$currPos, 2) === peg$c161) {
2657
+ s1 = peg$c161;
2658
+ peg$currPos += 2;
2659
+ }
2660
+ else {
2661
+ s1 = peg$FAILED;
2662
+ if (peg$silentFails === 0) {
2663
+ peg$fail(peg$c162);
2664
+ }
2665
+ }
2666
+ if (s1 !== peg$FAILED) {
2667
+ peg$savedPos = s0;
2668
+ s1 = peg$c163();
2669
+ }
2670
+ s0 = s1;
2671
+ return s0;
2672
+ }
2673
+ function peg$parsewordBoundaryCharacter() {
2674
+ // @ts-ignore
2675
+ var s0, s1;
2676
+ s0 = peg$currPos;
2677
+ if (input.substr(peg$currPos, 2) === peg$c102) {
2678
+ s1 = peg$c102;
2679
+ peg$currPos += 2;
2680
+ }
2681
+ else {
2682
+ s1 = peg$FAILED;
2683
+ if (peg$silentFails === 0) {
2684
+ peg$fail(peg$c103);
2685
+ }
2686
+ }
2687
+ if (s1 !== peg$FAILED) {
2688
+ peg$savedPos = s0;
2689
+ s1 = peg$c164();
2690
+ }
2691
+ s0 = s1;
2692
+ return s0;
2693
+ }
2694
+ function peg$parsenonWordBoundaryCharacter() {
2695
+ // @ts-ignore
2696
+ var s0, s1;
2697
+ s0 = peg$currPos;
2698
+ if (input.substr(peg$currPos, 2) === peg$c165) {
2699
+ s1 = peg$c165;
2700
+ peg$currPos += 2;
2701
+ }
2702
+ else {
2703
+ s1 = peg$FAILED;
2704
+ if (peg$silentFails === 0) {
2705
+ peg$fail(peg$c166);
2706
+ }
2707
+ }
2708
+ if (s1 !== peg$FAILED) {
2709
+ peg$savedPos = s0;
2710
+ s1 = peg$c167();
2711
+ }
2712
+ s0 = s1;
2713
+ return s0;
2714
+ }
2715
+ function peg$parsewordCharacter() {
2716
+ // @ts-ignore
2717
+ var s0, s1;
2718
+ s0 = peg$currPos;
2719
+ if (input.substr(peg$currPos, 2) === peg$c168) {
2720
+ s1 = peg$c168;
2721
+ peg$currPos += 2;
2722
+ }
2723
+ else {
2724
+ s1 = peg$FAILED;
2725
+ if (peg$silentFails === 0) {
2726
+ peg$fail(peg$c169);
2727
+ }
2728
+ }
2729
+ if (s1 !== peg$FAILED) {
2730
+ peg$savedPos = s0;
2731
+ s1 = peg$c170();
2732
+ }
2733
+ s0 = s1;
2734
+ return s0;
2735
+ }
2736
+ function peg$parsenonWordCharacter() {
2737
+ // @ts-ignore
2738
+ var s0, s1;
2739
+ s0 = peg$currPos;
2740
+ if (input.substr(peg$currPos, 2) === peg$c171) {
2741
+ s1 = peg$c171;
2742
+ peg$currPos += 2;
2743
+ }
2744
+ else {
2745
+ s1 = peg$FAILED;
2746
+ if (peg$silentFails === 0) {
2747
+ peg$fail(peg$c172);
2748
+ }
2749
+ }
2750
+ if (s1 !== peg$FAILED) {
2751
+ peg$savedPos = s0;
2752
+ s1 = peg$c173();
2753
+ }
2754
+ s0 = s1;
2755
+ return s0;
2756
+ }
2757
+ function peg$parseotherEscaped() {
2758
+ var s0, s1, s2;
2759
+ s0 = peg$currPos;
2760
+ if (input.charCodeAt(peg$currPos) === 92) {
2761
+ s1 = peg$c97;
2762
+ peg$currPos++;
2763
+ }
2764
+ else {
2765
+ s1 = peg$FAILED;
2766
+ if (peg$silentFails === 0) {
2767
+ peg$fail(peg$c98);
2768
+ }
2769
+ }
2770
+ if (s1 !== peg$FAILED) {
2771
+ if (input.length > peg$currPos) {
2772
+ s2 = input.charAt(peg$currPos);
2773
+ peg$currPos++;
2774
+ }
2775
+ else {
2776
+ s2 = peg$FAILED;
2777
+ if (peg$silentFails === 0) {
2778
+ peg$fail(peg$c110);
2779
+ }
2780
+ }
2781
+ if (s2 !== peg$FAILED) {
2782
+ peg$savedPos = s0;
2783
+ s1 = peg$c174(s2);
2784
+ s0 = s1;
2785
+ }
2786
+ else {
2787
+ peg$currPos = s0;
2788
+ s0 = peg$FAILED;
2789
+ }
2790
+ }
2791
+ else {
2792
+ peg$currPos = s0;
2793
+ s0 = peg$FAILED;
2794
+ }
2795
+ return s0;
2796
+ }
2797
+ peg$result = peg$startRuleFunction();
2798
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
2799
+ return peg$result;
2800
+ }
2801
+ else {
2802
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
2803
+ peg$fail(peg$endExpectation());
2804
+ }
2805
+ throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
2806
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
2807
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
2808
+ }
2809
+ }
2810
+ exports.pegParse = peg$parse;