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