@ts-graphviz/ast 0.0.0-pr956-20240225073457

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +22 -0
  3. package/README.md +42 -0
  4. package/lib/ast.cjs +3952 -0
  5. package/lib/ast.d.ts +881 -0
  6. package/lib/ast.js +3952 -0
  7. package/package.json +52 -0
  8. package/src/ast.ts +8 -0
  9. package/src/builder/__snapshots__/create-element.test.ts.snap +166 -0
  10. package/src/builder/builder.test.ts +36 -0
  11. package/src/builder/builder.ts +44 -0
  12. package/src/builder/create-element.test.ts +110 -0
  13. package/src/builder/create-element.ts +13 -0
  14. package/src/builder/index.ts +3 -0
  15. package/src/builder/types.ts +226 -0
  16. package/src/dot-shim/index.ts +2 -0
  17. package/src/dot-shim/parser/__snapshots__/parse.test.ts.snap +2613 -0
  18. package/src/dot-shim/parser/dot.peggy +396 -0
  19. package/src/dot-shim/parser/index.ts +1 -0
  20. package/src/dot-shim/parser/parse.test.ts +263 -0
  21. package/src/dot-shim/parser/parse.ts +121 -0
  22. package/src/dot-shim/parser/peggy.options.json +15 -0
  23. package/src/dot-shim/printer/index.ts +6 -0
  24. package/src/dot-shim/printer/plugins/AttributeListPrintPlugin.ts +22 -0
  25. package/src/dot-shim/printer/plugins/AttributePrintPlugin.ts +11 -0
  26. package/src/dot-shim/printer/plugins/CommentPrintPlugin.ts +40 -0
  27. package/src/dot-shim/printer/plugins/DotPrintPlugin.ts +12 -0
  28. package/src/dot-shim/printer/plugins/EdgePrintPlugin.ts +27 -0
  29. package/src/dot-shim/printer/plugins/GraphPrintPlugin.ts +32 -0
  30. package/src/dot-shim/printer/plugins/LiteralPrintPlugin.ts +24 -0
  31. package/src/dot-shim/printer/plugins/NodePrintPlugin.ts +24 -0
  32. package/src/dot-shim/printer/plugins/NodeRefGroupPrintPlugin.ts +17 -0
  33. package/src/dot-shim/printer/plugins/NodeRefPrintPlugin.ts +18 -0
  34. package/src/dot-shim/printer/plugins/SubgraphPrintPlugin.ts +27 -0
  35. package/src/dot-shim/printer/plugins/index.ts +26 -0
  36. package/src/dot-shim/printer/plugins/utils/index.ts +1 -0
  37. package/src/dot-shim/printer/plugins/utils/tokens.ts +51 -0
  38. package/src/dot-shim/printer/printer.ts +46 -0
  39. package/src/dot-shim/printer/stringify.test.ts +823 -0
  40. package/src/dot-shim/printer/stringify.ts +19 -0
  41. package/src/dot-shim/printer/types.ts +74 -0
  42. package/src/model-shim/from-model/converter.ts +43 -0
  43. package/src/model-shim/from-model/from-model.ts +19 -0
  44. package/src/model-shim/from-model/index.ts +3 -0
  45. package/src/model-shim/from-model/plugins/AttributeListPlugin.ts +19 -0
  46. package/src/model-shim/from-model/plugins/EdgePlugin.ts +140 -0
  47. package/src/model-shim/from-model/plugins/GraphPlugin.ts +36 -0
  48. package/src/model-shim/from-model/plugins/NodePlugin.ts +33 -0
  49. package/src/model-shim/from-model/plugins/SubraphPlugin.ts +28 -0
  50. package/src/model-shim/from-model/plugins/index.ts +13 -0
  51. package/src/model-shim/from-model/plugins/utils/convert-attribute.ts +47 -0
  52. package/src/model-shim/from-model/plugins/utils/convert-cluster-children.ts +44 -0
  53. package/src/model-shim/from-model/plugins/utils/convert-comment.ts +16 -0
  54. package/src/model-shim/from-model/plugins/utils/index.ts +3 -0
  55. package/src/model-shim/from-model/types.ts +62 -0
  56. package/src/model-shim/index.ts +2 -0
  57. package/src/model-shim/to-model/converter.ts +42 -0
  58. package/src/model-shim/to-model/index.ts +3 -0
  59. package/src/model-shim/to-model/plugins/DotPlugin.ts +25 -0
  60. package/src/model-shim/to-model/plugins/EdgePlugin.ts +26 -0
  61. package/src/model-shim/to-model/plugins/GraphPlugin.ts +15 -0
  62. package/src/model-shim/to-model/plugins/NodePlugin.ts +25 -0
  63. package/src/model-shim/to-model/plugins/SubgraphPlugin.ts +14 -0
  64. package/src/model-shim/to-model/plugins/index.ts +13 -0
  65. package/src/model-shim/to-model/plugins/utils/apply-statments.ts +96 -0
  66. package/src/model-shim/to-model/plugins/utils/comment-holder.ts +31 -0
  67. package/src/model-shim/to-model/plugins/utils/convert-to-edge-target-tuple.ts +21 -0
  68. package/src/model-shim/to-model/to-model.test.ts +34 -0
  69. package/src/model-shim/to-model/to-model.ts +16 -0
  70. package/src/model-shim/to-model/types.ts +71 -0
  71. package/src/types.ts +370 -0
  72. package/tsconfig.json +8 -0
  73. package/typedoc.json +4 -0
  74. package/vite.config.ts +22 -0
package/lib/ast.cjs ADDED
@@ -0,0 +1,3952 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+ var __accessCheck = (obj, member, msg) => {
9
+ if (!member.has(obj))
10
+ throw TypeError("Cannot " + msg);
11
+ };
12
+ var __privateGet = (obj, member, getter) => {
13
+ __accessCheck(obj, member, "read from private field");
14
+ return getter ? getter.call(obj) : member.get(obj);
15
+ };
16
+ var __privateAdd = (obj, member, value) => {
17
+ if (member.has(obj))
18
+ throw TypeError("Cannot add the same private member more than once");
19
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
20
+ };
21
+ var _plugins, _plugins2;
22
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
23
+ const common = require("@ts-graphviz/common");
24
+ class Builder {
25
+ /**
26
+ * Constructor of Builder
27
+ * @param options - Options to initialize Builder
28
+ */
29
+ constructor(options) {
30
+ this.options = options;
31
+ }
32
+ /**
33
+ * Get the current file range or null
34
+ * @internal
35
+ */
36
+ getLocation() {
37
+ var _a, _b;
38
+ return ((_b = (_a = this.options) == null ? void 0 : _a.locationFunction) == null ? void 0 : _b.call(_a)) ?? null;
39
+ }
40
+ /**
41
+ * Create an {@link ASTNode} of the specified type
42
+ *
43
+ * @param type - Type of the {@link ASTNode}
44
+ * @param props - Properties of the {@link ASTNode}
45
+ * @param children - Children of the {@link ASTNode}
46
+ * @returns An {@link ASTNode}
47
+ */
48
+ createElement(type, props, children = []) {
49
+ return {
50
+ location: this.getLocation(),
51
+ ...props,
52
+ type,
53
+ children
54
+ };
55
+ }
56
+ }
57
+ const createElement = Builder.prototype.createElement.bind(new Builder());
58
+ const EOL = /\r?\n/;
59
+ function joinBy(sep) {
60
+ return (value) => value.join(sep);
61
+ }
62
+ function wrapWith(wrapper) {
63
+ return (value) => wrapper + value + wrapper;
64
+ }
65
+ function wrapByPair(l, r) {
66
+ return (value) => l + value + r;
67
+ }
68
+ function leftPadWith(left) {
69
+ return (value) => left + value;
70
+ }
71
+ const escape = (value) => value.replace(/\\/g, "\\\\").replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/"/g, '\\"');
72
+ const splitByLine = (value) => value.split(EOL);
73
+ const indent = (style, size, eol) => common.pipe(
74
+ splitByLine,
75
+ common.map(leftPadWith(style === "space" ? " ".repeat(size) : "\n")),
76
+ joinBy(eol)
77
+ );
78
+ const endOfLine = (eol) => {
79
+ switch (eol) {
80
+ case "crlf":
81
+ return "\r\n";
82
+ case "lf":
83
+ return "\n";
84
+ }
85
+ };
86
+ const AttributeListPrintPlugin = {
87
+ match(ast) {
88
+ return ast.type === "AttributeList";
89
+ },
90
+ print(context, ast) {
91
+ if (ast.children.length === 0) {
92
+ return `${ast.kind.toLocaleLowerCase()} [];`;
93
+ }
94
+ const eol = endOfLine(context.endOfLine);
95
+ return common.pipe(
96
+ common.map(context.print),
97
+ joinBy(eol),
98
+ indent(context.indentStyle, context.indentSize, eol),
99
+ wrapByPair(`${ast.kind.toLocaleLowerCase()} [${eol}`, `${eol}];`)
100
+ )(ast.children);
101
+ }
102
+ };
103
+ const AttributePrintPlugin = {
104
+ match(ast) {
105
+ return ast.type === "Attribute";
106
+ },
107
+ print(context, ast) {
108
+ return `${context.print(ast.key)} = ${context.print(ast.value)};`;
109
+ }
110
+ };
111
+ const CommentPrintPlugin = {
112
+ match(ast) {
113
+ return ast.type === "Comment";
114
+ },
115
+ print(context, ast) {
116
+ const eol = endOfLine(context.endOfLine);
117
+ switch (ast.kind) {
118
+ case "Block":
119
+ return common.pipe(
120
+ splitByLine,
121
+ common.map(leftPadWith(" * ")),
122
+ joinBy(eol),
123
+ wrapByPair(`/**${eol}`, `${eol} */`)
124
+ )(ast.value);
125
+ case "Macro":
126
+ return common.pipe(
127
+ splitByLine,
128
+ common.map(leftPadWith("# ")),
129
+ joinBy(eol)
130
+ )(ast.value);
131
+ default:
132
+ return common.pipe(
133
+ splitByLine,
134
+ common.map(leftPadWith("// ")),
135
+ joinBy(eol)
136
+ )(ast.value);
137
+ }
138
+ }
139
+ };
140
+ const DotPrintPlugin = {
141
+ match(ast) {
142
+ return ast.type === "Dot";
143
+ },
144
+ print(context, ast) {
145
+ return ast.children.map(context.print).join(endOfLine(context.endOfLine));
146
+ }
147
+ };
148
+ const EdgePrintPlugin = {
149
+ match(ast) {
150
+ return ast.type === "Edge";
151
+ },
152
+ print(context, ast) {
153
+ const targets = common.pipe(
154
+ common.map(context.print),
155
+ joinBy(context.directed ? " -> " : " -- ")
156
+ )(ast.targets);
157
+ if (ast.children.length === 0) {
158
+ return `${targets};`;
159
+ }
160
+ const eol = endOfLine(context.endOfLine);
161
+ const contents = common.pipe(
162
+ common.map(context.print),
163
+ joinBy(eol),
164
+ indent(context.indentStyle, context.indentSize, eol),
165
+ wrapByPair(`[${eol}`, `${eol}];`)
166
+ )(ast.children);
167
+ return `${targets} ${contents}`;
168
+ }
169
+ };
170
+ const GraphPrintPlugin = {
171
+ match(ast) {
172
+ return ast.type === "Graph";
173
+ },
174
+ print(context, ast) {
175
+ context.directed = ast.directed;
176
+ const parts = [];
177
+ if (ast.strict) {
178
+ parts.push("strict");
179
+ }
180
+ parts.push(ast.directed ? "digraph" : "graph");
181
+ if (ast.id) {
182
+ parts.push(context.print(ast.id));
183
+ }
184
+ if (ast.children.length === 0) {
185
+ return `${parts.join(" ")} {}`;
186
+ }
187
+ const eol = endOfLine(context.endOfLine);
188
+ const contents = common.pipe(
189
+ common.map(context.print),
190
+ joinBy(eol),
191
+ indent(context.indentStyle, context.indentSize, eol),
192
+ wrapByPair(`{${eol}`, `${eol}}`)
193
+ )(ast.children);
194
+ return `${parts.join(" ")} ${contents}`;
195
+ }
196
+ };
197
+ const quoteLiteralValue = common.pipe(escape, wrapWith('"'));
198
+ const quoteHTMLLikeLiteralValue = wrapByPair("<", ">");
199
+ const LiteralPrintPlugin = {
200
+ match(ast) {
201
+ return ast.type === "Literal";
202
+ },
203
+ print(context, ast) {
204
+ switch (ast.quoted) {
205
+ case "html":
206
+ return quoteHTMLLikeLiteralValue(ast.value);
207
+ case true:
208
+ return quoteLiteralValue(ast.value);
209
+ default:
210
+ return escape(ast.value);
211
+ }
212
+ }
213
+ };
214
+ const NodePrintPlugin = {
215
+ match(ast) {
216
+ return ast.type === "Node";
217
+ },
218
+ print(context, ast) {
219
+ const id = context.print(ast.id);
220
+ if (ast.children.length === 0) {
221
+ return `${id};`;
222
+ }
223
+ const eol = endOfLine(context.endOfLine);
224
+ const contents = common.pipe(
225
+ common.map(context.print),
226
+ joinBy(eol),
227
+ indent(context.indentStyle, context.indentSize, eol),
228
+ wrapByPair(`[${eol}`, `${eol}];`)
229
+ )(ast.children);
230
+ return `${id} ${contents}`;
231
+ }
232
+ };
233
+ const NodeRefGroupPrintPlugin = {
234
+ match(ast) {
235
+ return ast.type === "NodeRefGroup";
236
+ },
237
+ print(context, ast) {
238
+ return common.pipe(
239
+ common.map(context.print),
240
+ joinBy(" "),
241
+ wrapByPair("{", "}")
242
+ )(ast.children);
243
+ }
244
+ };
245
+ const NodeRefPrintPlugin = {
246
+ match(ast) {
247
+ return ast.type === "NodeRef";
248
+ },
249
+ print(context, ast) {
250
+ const parts = [context.print(ast.id)];
251
+ if (ast.port) {
252
+ parts.push(context.print(ast.port));
253
+ }
254
+ if (ast.compass) {
255
+ parts.push(context.print(ast.compass));
256
+ }
257
+ return parts.join(":");
258
+ }
259
+ };
260
+ const SubgraphPrintPlugin = {
261
+ match(ast) {
262
+ return ast.type === "Subgraph";
263
+ },
264
+ print(context, ast) {
265
+ const parts = ["subgraph"];
266
+ if (ast.id) {
267
+ parts.push(context.print(ast.id));
268
+ }
269
+ if (ast.children.length === 0) {
270
+ return `${parts.join(" ")} {}`;
271
+ }
272
+ const eol = endOfLine(context.endOfLine);
273
+ const contents = common.pipe(
274
+ common.map(context.print),
275
+ joinBy(eol),
276
+ indent(context.indentStyle, context.indentSize, eol),
277
+ wrapByPair(`{${eol}`, `${eol}}`)
278
+ )(ast.children);
279
+ return `${parts.join(" ")} ${contents}`;
280
+ }
281
+ };
282
+ const defaultPlugins$2 = [
283
+ AttributeListPrintPlugin,
284
+ AttributePrintPlugin,
285
+ CommentPrintPlugin,
286
+ DotPrintPlugin,
287
+ EdgePrintPlugin,
288
+ GraphPrintPlugin,
289
+ LiteralPrintPlugin,
290
+ NodePrintPlugin,
291
+ NodeRefGroupPrintPlugin,
292
+ NodeRefPrintPlugin,
293
+ SubgraphPrintPlugin
294
+ ];
295
+ class Printer {
296
+ /**
297
+ * @param options Options to be used when generating the DOT string.
298
+ */
299
+ constructor(options = {}) {
300
+ /** @internal */
301
+ __privateAdd(this, _plugins, [...defaultPlugins$2]);
302
+ this.options = options;
303
+ }
304
+ /**
305
+ * Generates a DOT string from an ASTNode.
306
+ * @param ast The ASTNode to be converted into a DOT string.
307
+ * @returns The DOT string generated from the ASTNode.
308
+ */
309
+ print(ast) {
310
+ const plugins = [...__privateGet(this, _plugins)];
311
+ const {
312
+ indentSize = 2,
313
+ indentStyle = "space",
314
+ endOfLine: endOfLine2 = "lf"
315
+ } = this.options;
316
+ const context = {
317
+ directed: true,
318
+ indentSize,
319
+ indentStyle,
320
+ endOfLine: endOfLine2,
321
+ print(a) {
322
+ for (const plugin of plugins) {
323
+ if (plugin.match(a)) {
324
+ return plugin.print(context, a);
325
+ }
326
+ }
327
+ throw Error();
328
+ }
329
+ };
330
+ return context.print(ast);
331
+ }
332
+ }
333
+ _plugins = new WeakMap();
334
+ function stringify(ast, options) {
335
+ const result = new Printer(options).print(ast);
336
+ if (!result) {
337
+ throw new Error();
338
+ }
339
+ return result;
340
+ }
341
+ const peggyParser = (
342
+ // Generated by Peggy 3.0.2.
343
+ //
344
+ // https://peggyjs.org/
345
+ // @ts-ignore
346
+ function() {
347
+ function peg$subclass(child, parent) {
348
+ function C() {
349
+ this.constructor = child;
350
+ }
351
+ C.prototype = parent.prototype;
352
+ child.prototype = new C();
353
+ }
354
+ function peg$SyntaxError(message, expected, found, location) {
355
+ var self = Error.call(this, message);
356
+ if (Object.setPrototypeOf) {
357
+ Object.setPrototypeOf(self, peg$SyntaxError.prototype);
358
+ }
359
+ self.expected = expected;
360
+ self.found = found;
361
+ self.location = location;
362
+ self.name = "SyntaxError";
363
+ return self;
364
+ }
365
+ peg$subclass(peg$SyntaxError, Error);
366
+ function peg$padEnd(str, targetLength, padString) {
367
+ padString = padString || " ";
368
+ if (str.length > targetLength) {
369
+ return str;
370
+ }
371
+ targetLength -= str.length;
372
+ padString += padString.repeat(targetLength);
373
+ return str + padString.slice(0, targetLength);
374
+ }
375
+ peg$SyntaxError.prototype.format = function(sources) {
376
+ var str = "Error: " + this.message;
377
+ if (this.location) {
378
+ var src = null;
379
+ var k;
380
+ for (k = 0; k < sources.length; k++) {
381
+ if (sources[k].source === this.location.source) {
382
+ src = sources[k].text.split(/\r\n|\n|\r/g);
383
+ break;
384
+ }
385
+ }
386
+ var s = this.location.start;
387
+ var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
388
+ var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
389
+ if (src) {
390
+ var e = this.location.end;
391
+ var filler = peg$padEnd("", offset_s.line.toString().length, " ");
392
+ var line = src[s.line - 1];
393
+ var last = s.line === e.line ? e.column : line.length + 1;
394
+ var hatLen = last - s.column || 1;
395
+ str += "\n --> " + loc + "\n" + filler + " |\n" + offset_s.line + " | " + line + "\n" + filler + " | " + peg$padEnd("", s.column - 1, " ") + peg$padEnd("", hatLen, "^");
396
+ } else {
397
+ str += "\n at " + loc;
398
+ }
399
+ }
400
+ return str;
401
+ };
402
+ peg$SyntaxError.buildMessage = function(expected, found) {
403
+ var DESCRIBE_EXPECTATION_FNS = {
404
+ // @ts-ignore
405
+ literal: function(expectation) {
406
+ return '"' + literalEscape(expectation.text) + '"';
407
+ },
408
+ // @ts-ignore
409
+ class: function(expectation) {
410
+ var escapedParts = expectation.parts.map(function(part) {
411
+ return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
412
+ });
413
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
414
+ },
415
+ // @ts-ignore
416
+ any: function() {
417
+ return "any character";
418
+ },
419
+ // @ts-ignore
420
+ end: function() {
421
+ return "end of input";
422
+ },
423
+ // @ts-ignore
424
+ other: function(expectation) {
425
+ return expectation.description;
426
+ }
427
+ };
428
+ function hex(ch) {
429
+ return ch.charCodeAt(0).toString(16).toUpperCase();
430
+ }
431
+ function literalEscape(s) {
432
+ return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
433
+ return "\\x0" + hex(ch);
434
+ }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
435
+ return "\\x" + hex(ch);
436
+ });
437
+ }
438
+ function classEscape(s) {
439
+ return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
440
+ return "\\x0" + hex(ch);
441
+ }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
442
+ return "\\x" + hex(ch);
443
+ });
444
+ }
445
+ function describeExpectation(expectation) {
446
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
447
+ }
448
+ function describeExpected(expected2) {
449
+ var descriptions = expected2.map(describeExpectation);
450
+ var i, j;
451
+ descriptions.sort();
452
+ if (descriptions.length > 0) {
453
+ for (i = 1, j = 1; i < descriptions.length; i++) {
454
+ if (descriptions[i - 1] !== descriptions[i]) {
455
+ descriptions[j] = descriptions[i];
456
+ j++;
457
+ }
458
+ }
459
+ descriptions.length = j;
460
+ }
461
+ switch (descriptions.length) {
462
+ case 1:
463
+ return descriptions[0];
464
+ case 2:
465
+ return descriptions[0] + " or " + descriptions[1];
466
+ default:
467
+ return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
468
+ }
469
+ }
470
+ function describeFound(found2) {
471
+ return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
472
+ }
473
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
474
+ };
475
+ function peg$parse(input, options) {
476
+ options = options !== void 0 ? options : {};
477
+ var peg$FAILED = {};
478
+ var peg$source = options.grammarSource;
479
+ var peg$startRuleFunctions = { Dot: peg$parseDot, Graph: peg$parseGraph, Subgraph: peg$parseSubgraph, Node: peg$parseNode, Edge: peg$parseEdge, AttributeList: peg$parseAttributeList, Attribute: peg$parseAttribute, ClusterStatements: peg$parseClusterStatements };
480
+ var peg$startRuleFunction = peg$parseDot;
481
+ var peg$c0 = "strict";
482
+ var peg$c1 = "graph";
483
+ var peg$c2 = "digraph";
484
+ var peg$c3 = "{";
485
+ var peg$c4 = "}";
486
+ var peg$c5 = ";";
487
+ var peg$c6 = "node";
488
+ var peg$c7 = "edge";
489
+ var peg$c8 = "=";
490
+ var peg$c9 = ",";
491
+ var peg$c10 = "[";
492
+ var peg$c11 = "]";
493
+ var peg$c12 = "->";
494
+ var peg$c13 = "--";
495
+ var peg$c14 = ":";
496
+ var peg$c15 = "subgraph";
497
+ var peg$c16 = "n";
498
+ var peg$c17 = "ne";
499
+ var peg$c18 = "e";
500
+ var peg$c19 = "se";
501
+ var peg$c20 = "s";
502
+ var peg$c21 = "sw";
503
+ var peg$c22 = "w";
504
+ var peg$c23 = "nw";
505
+ var peg$c24 = '"';
506
+ var peg$c25 = "/*";
507
+ var peg$c26 = "*/";
508
+ var peg$c27 = "//";
509
+ var peg$c28 = "#";
510
+ var peg$c29 = "$";
511
+ var peg$c30 = "_";
512
+ var peg$c31 = "-";
513
+ var peg$c32 = ".";
514
+ var peg$c33 = "<";
515
+ var peg$c34 = ">";
516
+ var peg$c35 = "\\";
517
+ var peg$c36 = "\n";
518
+ var peg$c37 = "\r\n";
519
+ var peg$c38 = "\r";
520
+ var peg$c39 = "\u2028";
521
+ var peg$c40 = "\u2029";
522
+ var peg$r0 = /^[0-9]/;
523
+ var peg$r1 = /^[\n\r\u2028\u2029]/;
524
+ var peg$r3 = /^[\n\r]/;
525
+ var peg$r4 = /^[ \t]/;
526
+ var peg$r5 = /^[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137-\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148-\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C-\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA-\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9-\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC-\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF-\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F-\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0-\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB-\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE-\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6-\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FC7\u1FD0-\u1FD3\u1FD6-\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6-\u1FF7\u210A\u210E-\u210F\u2113\u212F\u2134\u2139\u213C-\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65-\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73-\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3-\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]/;
527
+ var peg$r6 = /^[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5-\u06E6\u07F4-\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C-\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D-\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA717-\uA71F\uA770\uA788\uA7F8-\uA7F9\uA9CF\uAA70\uAADD\uAAF3-\uAAF4\uFF70\uFF9E-\uFF9F]/;
528
+ var peg$r7 = /^[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0977\u0979-\u097F\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58-\u0C59\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A-\uA62B\uA66E\uA6A0-\uA6E5\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/;
529
+ var peg$r8 = /^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/;
530
+ var peg$r9 = /^[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178-\u0179\u017B\u017D\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018B\u018E-\u0191\u0193-\u0194\u0196-\u0198\u019C-\u019D\u019F-\u01A0\u01A2\u01A4\u01A6-\u01A7\u01A9\u01AC\u01AE-\u01AF\u01B1-\u01B3\u01B5\u01B7-\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A-\u023B\u023D-\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u0386\u0388-\u038A\u038C\u038E-\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9-\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0-\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E-\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D-\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA\uFF21-\uFF3A]/;
531
+ var peg$r10 = /^[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/;
532
+ var peg$r11 = /^[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]/;
533
+ var peg$e0 = peg$literalExpectation("strict", true);
534
+ var peg$e1 = peg$literalExpectation("graph", true);
535
+ var peg$e2 = peg$literalExpectation("digraph", true);
536
+ var peg$e3 = peg$literalExpectation("{", false);
537
+ var peg$e4 = peg$literalExpectation("}", false);
538
+ var peg$e5 = peg$literalExpectation(";", false);
539
+ var peg$e6 = peg$literalExpectation("node", true);
540
+ var peg$e7 = peg$literalExpectation("edge", true);
541
+ var peg$e8 = peg$literalExpectation("=", false);
542
+ var peg$e9 = peg$literalExpectation(",", false);
543
+ var peg$e10 = peg$literalExpectation("[", false);
544
+ var peg$e11 = peg$literalExpectation("]", false);
545
+ var peg$e12 = peg$literalExpectation("->", false);
546
+ var peg$e13 = peg$literalExpectation("--", false);
547
+ var peg$e14 = peg$otherExpectation("port");
548
+ var peg$e15 = peg$literalExpectation(":", false);
549
+ var peg$e16 = peg$literalExpectation("subgraph", true);
550
+ var peg$e17 = peg$literalExpectation("n", false);
551
+ var peg$e18 = peg$literalExpectation("ne", false);
552
+ var peg$e19 = peg$literalExpectation("e", false);
553
+ var peg$e20 = peg$literalExpectation("se", false);
554
+ var peg$e21 = peg$literalExpectation("s", false);
555
+ var peg$e22 = peg$literalExpectation("sw", false);
556
+ var peg$e23 = peg$literalExpectation("w", false);
557
+ var peg$e24 = peg$literalExpectation("nw", false);
558
+ var peg$e25 = peg$literalExpectation('"', false);
559
+ var peg$e26 = peg$literalExpectation("/*", false);
560
+ var peg$e27 = peg$literalExpectation("*/", false);
561
+ var peg$e28 = peg$anyExpectation();
562
+ var peg$e29 = peg$literalExpectation("//", false);
563
+ var peg$e30 = peg$literalExpectation("#", false);
564
+ var peg$e31 = peg$otherExpectation("UNICODE_STRING");
565
+ var peg$e32 = peg$literalExpectation("$", false);
566
+ var peg$e33 = peg$literalExpectation("_", false);
567
+ var peg$e34 = peg$otherExpectation("NUMBER");
568
+ var peg$e35 = peg$literalExpectation("-", false);
569
+ var peg$e36 = peg$literalExpectation(".", false);
570
+ var peg$e37 = peg$classExpectation([["0", "9"]], false, false);
571
+ var peg$e38 = peg$literalExpectation("<", false);
572
+ var peg$e39 = peg$literalExpectation(">", false);
573
+ var peg$e40 = peg$literalExpectation("\\", false);
574
+ var peg$e41 = peg$classExpectation(["\n", "\r", "\u2028", "\u2029"], false, false);
575
+ var peg$e42 = peg$otherExpectation("end of line");
576
+ var peg$e43 = peg$literalExpectation("\n", false);
577
+ var peg$e44 = peg$literalExpectation("\r\n", false);
578
+ var peg$e45 = peg$literalExpectation("\r", false);
579
+ var peg$e46 = peg$literalExpectation("\u2028", false);
580
+ var peg$e47 = peg$literalExpectation("\u2029", false);
581
+ var peg$e50 = peg$otherExpectation("whitespace");
582
+ var peg$e51 = peg$otherExpectation("WHITESPACE");
583
+ var peg$e52 = peg$classExpectation(["\n", "\r"], false, false);
584
+ var peg$e53 = peg$classExpectation([" ", " "], false, false);
585
+ var peg$e54 = peg$classExpectation([["a", "z"], "µ", ["ß", "ö"], ["ø", "ÿ"], "ā", "ă", "ą", "ć", "ĉ", "ċ", "č", "ď", "đ", "ē", "ĕ", "ė", "ę", "ě", "ĝ", "ğ", "ġ", "ģ", "ĥ", "ħ", "ĩ", "ī", "ĭ", "į", "ı", "ij", "ĵ", ["ķ", "ĸ"], "ĺ", "ļ", "ľ", "ŀ", "ł", "ń", "ņ", ["ň", "ʼn"], "ŋ", "ō", "ŏ", "ő", "œ", "ŕ", "ŗ", "ř", "ś", "ŝ", "ş", "š", "ţ", "ť", "ŧ", "ũ", "ū", "ŭ", "ů", "ű", "ų", "ŵ", "ŷ", "ź", "ż", ["ž", "ƀ"], "ƃ", "ƅ", "ƈ", ["ƌ", "ƍ"], "ƒ", "ƕ", ["ƙ", "ƛ"], "ƞ", "ơ", "ƣ", "ƥ", "ƨ", ["ƪ", "ƫ"], "ƭ", "ư", "ƴ", "ƶ", ["ƹ", "ƺ"], ["ƽ", "ƿ"], "dž", "lj", "nj", "ǎ", "ǐ", "ǒ", "ǔ", "ǖ", "ǘ", "ǚ", ["ǜ", "ǝ"], "ǟ", "ǡ", "ǣ", "ǥ", "ǧ", "ǩ", "ǫ", "ǭ", ["ǯ", "ǰ"], "dz", "ǵ", "ǹ", "ǻ", "ǽ", "ǿ", "ȁ", "ȃ", "ȅ", "ȇ", "ȉ", "ȋ", "ȍ", "ȏ", "ȑ", "ȓ", "ȕ", "ȗ", "ș", "ț", "ȝ", "ȟ", "ȡ", "ȣ", "ȥ", "ȧ", "ȩ", "ȫ", "ȭ", "ȯ", "ȱ", ["ȳ", "ȹ"], "ȼ", ["ȿ", "ɀ"], "ɂ", "ɇ", "ɉ", "ɋ", "ɍ", ["ɏ", "ʓ"], ["ʕ", "ʯ"], "ͱ", "ͳ", "ͷ", ["ͻ", "ͽ"], "ΐ", ["ά", "ώ"], ["ϐ", "ϑ"], ["ϕ", "ϗ"], "ϙ", "ϛ", "ϝ", "ϟ", "ϡ", "ϣ", "ϥ", "ϧ", "ϩ", "ϫ", "ϭ", ["ϯ", "ϳ"], "ϵ", "ϸ", ["ϻ", "ϼ"], ["а", "џ"], "ѡ", "ѣ", "ѥ", "ѧ", "ѩ", "ѫ", "ѭ", "ѯ", "ѱ", "ѳ", "ѵ", "ѷ", "ѹ", "ѻ", "ѽ", "ѿ", "ҁ", "ҋ", "ҍ", "ҏ", "ґ", "ғ", "ҕ", "җ", "ҙ", "қ", "ҝ", "ҟ", "ҡ", "ң", "ҥ", "ҧ", "ҩ", "ҫ", "ҭ", "ү", "ұ", "ҳ", "ҵ", "ҷ", "ҹ", "һ", "ҽ", "ҿ", "ӂ", "ӄ", "ӆ", "ӈ", "ӊ", "ӌ", ["ӎ", "ӏ"], "ӑ", "ӓ", "ӕ", "ӗ", "ә", "ӛ", "ӝ", "ӟ", "ӡ", "ӣ", "ӥ", "ӧ", "ө", "ӫ", "ӭ", "ӯ", "ӱ", "ӳ", "ӵ", "ӷ", "ӹ", "ӻ", "ӽ", "ӿ", "ԁ", "ԃ", "ԅ", "ԇ", "ԉ", "ԋ", "ԍ", "ԏ", "ԑ", "ԓ", "ԕ", "ԗ", "ԙ", "ԛ", "ԝ", "ԟ", "ԡ", "ԣ", "ԥ", "ԧ", ["ա", "և"], ["ᴀ", "ᴫ"], ["ᵫ", "ᵷ"], ["ᵹ", "ᶚ"], "ḁ", "ḃ", "ḅ", "ḇ", "ḉ", "ḋ", "ḍ", "ḏ", "ḑ", "ḓ", "ḕ", "ḗ", "ḙ", "ḛ", "ḝ", "ḟ", "ḡ", "ḣ", "ḥ", "ḧ", "ḩ", "ḫ", "ḭ", "ḯ", "ḱ", "ḳ", "ḵ", "ḷ", "ḹ", "ḻ", "ḽ", "ḿ", "ṁ", "ṃ", "ṅ", "ṇ", "ṉ", "ṋ", "ṍ", "ṏ", "ṑ", "ṓ", "ṕ", "ṗ", "ṙ", "ṛ", "ṝ", "ṟ", "ṡ", "ṣ", "ṥ", "ṧ", "ṩ", "ṫ", "ṭ", "ṯ", "ṱ", "ṳ", "ṵ", "ṷ", "ṹ", "ṻ", "ṽ", "ṿ", "ẁ", "ẃ", "ẅ", "ẇ", "ẉ", "ẋ", "ẍ", "ẏ", "ẑ", "ẓ", ["ẕ", "ẝ"], "ẟ", "ạ", "ả", "ấ", "ầ", "ẩ", "ẫ", "ậ", "ắ", "ằ", "ẳ", "ẵ", "ặ", "ẹ", "ẻ", "ẽ", "ế", "ề", "ể", "ễ", "ệ", "ỉ", "ị", "ọ", "ỏ", "ố", "ồ", "ổ", "ỗ", "ộ", "ớ", "ờ", "ở", "ỡ", "ợ", "ụ", "ủ", "ứ", "ừ", "ử", "ữ", "ự", "ỳ", "ỵ", "ỷ", "ỹ", "ỻ", "ỽ", ["ỿ", "ἇ"], ["ἐ", "ἕ"], ["ἠ", "ἧ"], ["ἰ", "ἷ"], ["ὀ", "ὅ"], ["ὐ", "ὗ"], ["ὠ", "ὧ"], ["ὰ", "ώ"], ["ᾀ", "ᾇ"], ["ᾐ", "ᾗ"], ["ᾠ", "ᾧ"], ["ᾰ", "ᾴ"], ["ᾶ", "ᾷ"], "ι", ["ῂ", "ῄ"], ["ῆ", "ῇ"], ["ῐ", "ΐ"], ["ῖ", "ῗ"], ["ῠ", "ῧ"], ["ῲ", "ῴ"], ["ῶ", "ῷ"], "ℊ", ["ℎ", "ℏ"], "ℓ", "ℯ", "ℴ", "ℹ", ["ℼ", "ℽ"], ["ⅆ", "ⅉ"], "ⅎ", "ↄ", ["ⰰ", "ⱞ"], "ⱡ", ["ⱥ", "ⱦ"], "ⱨ", "ⱪ", "ⱬ", "ⱱ", ["ⱳ", "ⱴ"], ["ⱶ", "ⱻ"], "ⲁ", "ⲃ", "ⲅ", "ⲇ", "ⲉ", "ⲋ", "ⲍ", "ⲏ", "ⲑ", "ⲓ", "ⲕ", "ⲗ", "ⲙ", "ⲛ", "ⲝ", "ⲟ", "ⲡ", "ⲣ", "ⲥ", "ⲧ", "ⲩ", "ⲫ", "ⲭ", "ⲯ", "ⲱ", "ⲳ", "ⲵ", "ⲷ", "ⲹ", "ⲻ", "ⲽ", "ⲿ", "ⳁ", "ⳃ", "ⳅ", "ⳇ", "ⳉ", "ⳋ", "ⳍ", "ⳏ", "ⳑ", "ⳓ", "ⳕ", "ⳗ", "ⳙ", "ⳛ", "ⳝ", "ⳟ", "ⳡ", ["ⳣ", "ⳤ"], "ⳬ", "ⳮ", "ⳳ", ["ⴀ", "ⴥ"], "ⴧ", "ⴭ", "ꙁ", "ꙃ", "ꙅ", "ꙇ", "ꙉ", "ꙋ", "ꙍ", "ꙏ", "ꙑ", "ꙓ", "ꙕ", "ꙗ", "ꙙ", "ꙛ", "ꙝ", "ꙟ", "ꙡ", "ꙣ", "ꙥ", "ꙧ", "ꙩ", "ꙫ", "ꙭ", "ꚁ", "ꚃ", "ꚅ", "ꚇ", "ꚉ", "ꚋ", "ꚍ", "ꚏ", "ꚑ", "ꚓ", "ꚕ", "ꚗ", "ꜣ", "ꜥ", "ꜧ", "ꜩ", "ꜫ", "ꜭ", ["ꜯ", "ꜱ"], "ꜳ", "ꜵ", "ꜷ", "ꜹ", "ꜻ", "ꜽ", "ꜿ", "ꝁ", "ꝃ", "ꝅ", "ꝇ", "ꝉ", "ꝋ", "ꝍ", "ꝏ", "ꝑ", "ꝓ", "ꝕ", "ꝗ", "ꝙ", "ꝛ", "ꝝ", "ꝟ", "ꝡ", "ꝣ", "ꝥ", "ꝧ", "ꝩ", "ꝫ", "ꝭ", "ꝯ", ["ꝱ", "ꝸ"], "ꝺ", "ꝼ", "ꝿ", "ꞁ", "ꞃ", "ꞅ", "ꞇ", "ꞌ", "ꞎ", "ꞑ", "ꞓ", "ꞡ", "ꞣ", "ꞥ", "ꞧ", "ꞩ", "ꟺ", ["ff", "st"], ["ﬓ", "ﬗ"], ["a", "z"]], false, false);
586
+ var peg$e55 = peg$classExpectation([["ʰ", "ˁ"], ["ˆ", "ˑ"], ["ˠ", "ˤ"], "ˬ", "ˮ", "ʹ", "ͺ", "ՙ", "ـ", ["ۥ", "ۦ"], ["ߴ", "ߵ"], "ߺ", "ࠚ", "ࠤ", "ࠨ", "ॱ", "ๆ", "ໆ", "ჼ", "ៗ", "ᡃ", "ᪧ", ["ᱸ", "ᱽ"], ["ᴬ", "ᵪ"], "ᵸ", ["ᶛ", "ᶿ"], "ⁱ", "ⁿ", ["ₐ", "ₜ"], ["ⱼ", "ⱽ"], "ⵯ", "ⸯ", "々", ["〱", "〵"], "〻", ["ゝ", "ゞ"], ["ー", "ヾ"], "ꀕ", ["ꓸ", "ꓽ"], "ꘌ", "ꙿ", ["ꜗ", "ꜟ"], "ꝰ", "ꞈ", ["ꟸ", "ꟹ"], "ꧏ", "ꩰ", "ꫝ", ["ꫳ", "ꫴ"], "ー", ["゙", "゚"]], false, false);
587
+ var peg$e56 = peg$classExpectation(["ª", "º", "ƻ", ["ǀ", "ǃ"], "ʔ", ["א", "ת"], ["װ", "ײ"], ["ؠ", "ؿ"], ["ف", "ي"], ["ٮ", "ٯ"], ["ٱ", "ۓ"], "ە", ["ۮ", "ۯ"], ["ۺ", "ۼ"], "ۿ", "ܐ", ["ܒ", "ܯ"], ["ݍ", "ޥ"], "ޱ", ["ߊ", "ߪ"], ["ࠀ", "ࠕ"], ["ࡀ", "ࡘ"], "ࢠ", ["ࢢ", "ࢬ"], ["ऄ", "ह"], "ऽ", "ॐ", ["क़", "ॡ"], ["ॲ", "ॷ"], ["ॹ", "ॿ"], ["অ", "ঌ"], ["এ", "ঐ"], ["ও", "ন"], ["প", "র"], "ল", ["শ", "হ"], "ঽ", "ৎ", ["ড়", "ঢ়"], ["য়", "ৡ"], ["ৰ", "ৱ"], ["ਅ", "ਊ"], ["ਏ", "ਐ"], ["ਓ", "ਨ"], ["ਪ", "ਰ"], ["ਲ", "ਲ਼"], ["ਵ", "ਸ਼"], ["ਸ", "ਹ"], ["ਖ਼", "ੜ"], "ਫ਼", ["ੲ", "ੴ"], ["અ", "ઍ"], ["એ", "ઑ"], ["ઓ", "ન"], ["પ", "ર"], ["લ", "ળ"], ["વ", "હ"], "ઽ", "ૐ", ["ૠ", "ૡ"], ["ଅ", "ଌ"], ["ଏ", "ଐ"], ["ଓ", "ନ"], ["ପ", "ର"], ["ଲ", "ଳ"], ["ଵ", "ହ"], "ଽ", ["ଡ଼", "ଢ଼"], ["ୟ", "ୡ"], "ୱ", "ஃ", ["அ", "ஊ"], ["எ", "ஐ"], ["ஒ", "க"], ["ங", "ச"], "ஜ", ["ஞ", "ட"], ["ண", "த"], ["ந", "ப"], ["ம", "ஹ"], "ௐ", ["అ", "ఌ"], ["ఎ", "ఐ"], ["ఒ", "న"], ["ప", "ళ"], ["వ", "హ"], "ఽ", ["ౘ", "ౙ"], ["ౠ", "ౡ"], ["ಅ", "ಌ"], ["ಎ", "ಐ"], ["ಒ", "ನ"], ["ಪ", "ಳ"], ["ವ", "ಹ"], "ಽ", "ೞ", ["ೠ", "ೡ"], ["ೱ", "ೲ"], ["അ", "ഌ"], ["എ", "ഐ"], ["ഒ", "ഺ"], "ഽ", "ൎ", ["ൠ", "ൡ"], ["ൺ", "ൿ"], ["අ", "ඖ"], ["ක", "න"], ["ඳ", "ර"], "ල", ["ව", "ෆ"], ["ก", "ะ"], ["า", "ำ"], ["เ", "ๅ"], ["ກ", "ຂ"], "ຄ", ["ງ", "ຈ"], "ຊ", "ຍ", ["ດ", "ທ"], ["ນ", "ຟ"], ["ມ", "ຣ"], "ລ", "ວ", ["ສ", "ຫ"], ["ອ", "ະ"], ["າ", "ຳ"], "ຽ", ["ເ", "ໄ"], ["ໜ", "ໟ"], "ༀ", ["ཀ", "ཇ"], ["ཉ", "ཬ"], ["ྈ", "ྌ"], ["က", "ဪ"], "ဿ", ["ၐ", "ၕ"], ["ၚ", "ၝ"], "ၡ", ["ၥ", "ၦ"], ["ၮ", "ၰ"], ["ၵ", "ႁ"], "ႎ", ["ა", "ჺ"], ["ჽ", "ቈ"], ["ቊ", "ቍ"], ["ቐ", "ቖ"], "ቘ", ["ቚ", "ቝ"], ["በ", "ኈ"], ["ኊ", "ኍ"], ["ነ", "ኰ"], ["ኲ", "ኵ"], ["ኸ", "ኾ"], "ዀ", ["ዂ", "ዅ"], ["ወ", "ዖ"], ["ዘ", "ጐ"], ["ጒ", "ጕ"], ["ጘ", "ፚ"], ["ᎀ", "ᎏ"], ["Ꭰ", "Ᏼ"], ["ᐁ", "ᙬ"], ["ᙯ", "ᙿ"], ["ᚁ", "ᚚ"], ["ᚠ", "ᛪ"], ["ᜀ", "ᜌ"], ["ᜎ", "ᜑ"], ["ᜠ", "ᜱ"], ["ᝀ", "ᝑ"], ["ᝠ", "ᝬ"], ["ᝮ", "ᝰ"], ["ក", "ឳ"], "ៜ", ["ᠠ", "ᡂ"], ["ᡄ", "ᡷ"], ["ᢀ", "ᢨ"], "ᢪ", ["ᢰ", "ᣵ"], ["ᤀ", "ᤜ"], ["ᥐ", "ᥭ"], ["ᥰ", "ᥴ"], ["ᦀ", "ᦫ"], ["ᧁ", "ᧇ"], ["ᨀ", "ᨖ"], ["ᨠ", "ᩔ"], ["ᬅ", "ᬳ"], ["ᭅ", "ᭋ"], ["ᮃ", "ᮠ"], ["ᮮ", "ᮯ"], ["ᮺ", "ᯥ"], ["ᰀ", "ᰣ"], ["ᱍ", "ᱏ"], ["ᱚ", "ᱷ"], ["ᳩ", "ᳬ"], ["ᳮ", "ᳱ"], ["ᳵ", "ᳶ"], ["ℵ", "ℸ"], ["ⴰ", "ⵧ"], ["ⶀ", "ⶖ"], ["ⶠ", "ⶦ"], ["ⶨ", "ⶮ"], ["ⶰ", "ⶶ"], ["ⶸ", "ⶾ"], ["ⷀ", "ⷆ"], ["ⷈ", "ⷎ"], ["ⷐ", "ⷖ"], ["ⷘ", "ⷞ"], "〆", "〼", ["ぁ", "ゖ"], "ゟ", ["ァ", "ヺ"], "ヿ", ["ㄅ", "ㄭ"], ["ㄱ", "ㆎ"], ["ㆠ", "ㆺ"], ["ㇰ", "ㇿ"], ["㐀", "䶵"], ["一", "鿌"], ["ꀀ", "ꀔ"], ["ꀖ", "ꒌ"], ["ꓐ", "ꓷ"], ["ꔀ", "ꘋ"], ["ꘐ", "ꘟ"], ["ꘪ", "ꘫ"], "ꙮ", ["ꚠ", "ꛥ"], ["ꟻ", "ꠁ"], ["ꠃ", "ꠅ"], ["ꠇ", "ꠊ"], ["ꠌ", "ꠢ"], ["ꡀ", "ꡳ"], ["ꢂ", "ꢳ"], ["ꣲ", "ꣷ"], "ꣻ", ["ꤊ", "ꤥ"], ["ꤰ", "ꥆ"], ["ꥠ", "ꥼ"], ["ꦄ", "ꦲ"], ["ꨀ", "ꨨ"], ["ꩀ", "ꩂ"], ["ꩄ", "ꩋ"], ["ꩠ", "ꩯ"], ["ꩱ", "ꩶ"], "ꩺ", ["ꪀ", "ꪯ"], "ꪱ", ["ꪵ", "ꪶ"], ["ꪹ", "ꪽ"], "ꫀ", "ꫂ", ["ꫛ", "ꫜ"], ["ꫠ", "ꫪ"], "ꫲ", ["ꬁ", "ꬆ"], ["ꬉ", "ꬎ"], ["ꬑ", "ꬖ"], ["ꬠ", "ꬦ"], ["ꬨ", "ꬮ"], ["ꯀ", "ꯢ"], ["가", "힣"], ["ힰ", "ퟆ"], ["ퟋ", "ퟻ"], ["豈", "舘"], ["並", "龎"], "יִ", ["ײַ", "ﬨ"], ["שׁ", "זּ"], ["טּ", "לּ"], "מּ", ["נּ", "סּ"], ["ףּ", "פּ"], ["צּ", "ﮱ"], ["ﯓ", "ﴽ"], ["ﵐ", "ﶏ"], ["ﶒ", "ﷇ"], ["ﷰ", "ﷻ"], ["ﹰ", "ﹴ"], ["ﹶ", "ﻼ"], ["ヲ", "ッ"], ["ア", "ン"], ["ᅠ", "ᄒ"], ["ᅡ", "ᅦ"], ["ᅧ", "ᅬ"], ["ᅭ", "ᅲ"], ["ᅳ", "ᅵ"]], false, false);
588
+ var peg$e57 = peg$classExpectation(["Dž", "Lj", "Nj", "Dz", ["ᾈ", "ᾏ"], ["ᾘ", "ᾟ"], ["ᾨ", "ᾯ"], "ᾼ", "ῌ", "ῼ"], false, false);
589
+ var peg$e58 = peg$classExpectation([["A", "Z"], ["À", "Ö"], ["Ø", "Þ"], "Ā", "Ă", "Ą", "Ć", "Ĉ", "Ċ", "Č", "Ď", "Đ", "Ē", "Ĕ", "Ė", "Ę", "Ě", "Ĝ", "Ğ", "Ġ", "Ģ", "Ĥ", "Ħ", "Ĩ", "Ī", "Ĭ", "Į", "İ", "IJ", "Ĵ", "Ķ", "Ĺ", "Ļ", "Ľ", "Ŀ", "Ł", "Ń", "Ņ", "Ň", "Ŋ", "Ō", "Ŏ", "Ő", "Œ", "Ŕ", "Ŗ", "Ř", "Ś", "Ŝ", "Ş", "Š", "Ţ", "Ť", "Ŧ", "Ũ", "Ū", "Ŭ", "Ů", "Ű", "Ų", "Ŵ", "Ŷ", ["Ÿ", "Ź"], "Ż", "Ž", ["Ɓ", "Ƃ"], "Ƅ", ["Ɔ", "Ƈ"], ["Ɖ", "Ƌ"], ["Ǝ", "Ƒ"], ["Ɠ", "Ɣ"], ["Ɩ", "Ƙ"], ["Ɯ", "Ɲ"], ["Ɵ", "Ơ"], "Ƣ", "Ƥ", ["Ʀ", "Ƨ"], "Ʃ", "Ƭ", ["Ʈ", "Ư"], ["Ʊ", "Ƴ"], "Ƶ", ["Ʒ", "Ƹ"], "Ƽ", "DŽ", "LJ", "NJ", "Ǎ", "Ǐ", "Ǒ", "Ǔ", "Ǖ", "Ǘ", "Ǚ", "Ǜ", "Ǟ", "Ǡ", "Ǣ", "Ǥ", "Ǧ", "Ǩ", "Ǫ", "Ǭ", "Ǯ", "DZ", "Ǵ", ["Ƕ", "Ǹ"], "Ǻ", "Ǽ", "Ǿ", "Ȁ", "Ȃ", "Ȅ", "Ȇ", "Ȉ", "Ȋ", "Ȍ", "Ȏ", "Ȑ", "Ȓ", "Ȕ", "Ȗ", "Ș", "Ț", "Ȝ", "Ȟ", "Ƞ", "Ȣ", "Ȥ", "Ȧ", "Ȩ", "Ȫ", "Ȭ", "Ȯ", "Ȱ", "Ȳ", ["Ⱥ", "Ȼ"], ["Ƚ", "Ⱦ"], "Ɂ", ["Ƀ", "Ɇ"], "Ɉ", "Ɋ", "Ɍ", "Ɏ", "Ͱ", "Ͳ", "Ͷ", "Ά", ["Έ", "Ί"], "Ό", ["Ύ", "Ώ"], ["Α", "Ρ"], ["Σ", "Ϋ"], "Ϗ", ["ϒ", "ϔ"], "Ϙ", "Ϛ", "Ϝ", "Ϟ", "Ϡ", "Ϣ", "Ϥ", "Ϧ", "Ϩ", "Ϫ", "Ϭ", "Ϯ", "ϴ", "Ϸ", ["Ϲ", "Ϻ"], ["Ͻ", "Я"], "Ѡ", "Ѣ", "Ѥ", "Ѧ", "Ѩ", "Ѫ", "Ѭ", "Ѯ", "Ѱ", "Ѳ", "Ѵ", "Ѷ", "Ѹ", "Ѻ", "Ѽ", "Ѿ", "Ҁ", "Ҋ", "Ҍ", "Ҏ", "Ґ", "Ғ", "Ҕ", "Җ", "Ҙ", "Қ", "Ҝ", "Ҟ", "Ҡ", "Ң", "Ҥ", "Ҧ", "Ҩ", "Ҫ", "Ҭ", "Ү", "Ұ", "Ҳ", "Ҵ", "Ҷ", "Ҹ", "Һ", "Ҽ", "Ҿ", ["Ӏ", "Ӂ"], "Ӄ", "Ӆ", "Ӈ", "Ӊ", "Ӌ", "Ӎ", "Ӑ", "Ӓ", "Ӕ", "Ӗ", "Ә", "Ӛ", "Ӝ", "Ӟ", "Ӡ", "Ӣ", "Ӥ", "Ӧ", "Ө", "Ӫ", "Ӭ", "Ӯ", "Ӱ", "Ӳ", "Ӵ", "Ӷ", "Ӹ", "Ӻ", "Ӽ", "Ӿ", "Ԁ", "Ԃ", "Ԅ", "Ԇ", "Ԉ", "Ԋ", "Ԍ", "Ԏ", "Ԑ", "Ԓ", "Ԕ", "Ԗ", "Ԙ", "Ԛ", "Ԝ", "Ԟ", "Ԡ", "Ԣ", "Ԥ", "Ԧ", ["Ա", "Ֆ"], ["Ⴀ", "Ⴥ"], "Ⴧ", "Ⴭ", "Ḁ", "Ḃ", "Ḅ", "Ḇ", "Ḉ", "Ḋ", "Ḍ", "Ḏ", "Ḑ", "Ḓ", "Ḕ", "Ḗ", "Ḙ", "Ḛ", "Ḝ", "Ḟ", "Ḡ", "Ḣ", "Ḥ", "Ḧ", "Ḩ", "Ḫ", "Ḭ", "Ḯ", "Ḱ", "Ḳ", "Ḵ", "Ḷ", "Ḹ", "Ḻ", "Ḽ", "Ḿ", "Ṁ", "Ṃ", "Ṅ", "Ṇ", "Ṉ", "Ṋ", "Ṍ", "Ṏ", "Ṑ", "Ṓ", "Ṕ", "Ṗ", "Ṙ", "Ṛ", "Ṝ", "Ṟ", "Ṡ", "Ṣ", "Ṥ", "Ṧ", "Ṩ", "Ṫ", "Ṭ", "Ṯ", "Ṱ", "Ṳ", "Ṵ", "Ṷ", "Ṹ", "Ṻ", "Ṽ", "Ṿ", "Ẁ", "Ẃ", "Ẅ", "Ẇ", "Ẉ", "Ẋ", "Ẍ", "Ẏ", "Ẑ", "Ẓ", "Ẕ", "ẞ", "Ạ", "Ả", "Ấ", "Ầ", "Ẩ", "Ẫ", "Ậ", "Ắ", "Ằ", "Ẳ", "Ẵ", "Ặ", "Ẹ", "Ẻ", "Ẽ", "Ế", "Ề", "Ể", "Ễ", "Ệ", "Ỉ", "Ị", "Ọ", "Ỏ", "Ố", "Ồ", "Ổ", "Ỗ", "Ộ", "Ớ", "Ờ", "Ở", "Ỡ", "Ợ", "Ụ", "Ủ", "Ứ", "Ừ", "Ử", "Ữ", "Ự", "Ỳ", "Ỵ", "Ỷ", "Ỹ", "Ỻ", "Ỽ", "Ỿ", ["Ἀ", "Ἇ"], ["Ἐ", "Ἕ"], ["Ἠ", "Ἧ"], ["Ἰ", "Ἷ"], ["Ὀ", "Ὅ"], "Ὑ", "Ὓ", "Ὕ", "Ὗ", ["Ὠ", "Ὧ"], ["Ᾰ", "Ά"], ["Ὲ", "Ή"], ["Ῐ", "Ί"], ["Ῠ", "Ῥ"], ["Ὸ", "Ώ"], "ℂ", "ℇ", ["ℋ", "ℍ"], ["ℐ", "ℒ"], "ℕ", ["ℙ", "ℝ"], "ℤ", "Ω", "ℨ", ["K", "ℭ"], ["ℰ", "ℳ"], ["ℾ", "ℿ"], "ⅅ", "Ↄ", ["Ⰰ", "Ⱞ"], "Ⱡ", ["Ɫ", "Ɽ"], "Ⱨ", "Ⱪ", "Ⱬ", ["Ɑ", "Ɒ"], "Ⱳ", "Ⱶ", ["Ȿ", "Ⲁ"], "Ⲃ", "Ⲅ", "Ⲇ", "Ⲉ", "Ⲋ", "Ⲍ", "Ⲏ", "Ⲑ", "Ⲓ", "Ⲕ", "Ⲗ", "Ⲙ", "Ⲛ", "Ⲝ", "Ⲟ", "Ⲡ", "Ⲣ", "Ⲥ", "Ⲧ", "Ⲩ", "Ⲫ", "Ⲭ", "Ⲯ", "Ⲱ", "Ⲳ", "Ⲵ", "Ⲷ", "Ⲹ", "Ⲻ", "Ⲽ", "Ⲿ", "Ⳁ", "Ⳃ", "Ⳅ", "Ⳇ", "Ⳉ", "Ⳋ", "Ⳍ", "Ⳏ", "Ⳑ", "Ⳓ", "Ⳕ", "Ⳗ", "Ⳙ", "Ⳛ", "Ⳝ", "Ⳟ", "Ⳡ", "Ⳣ", "Ⳬ", "Ⳮ", "Ⳳ", "Ꙁ", "Ꙃ", "Ꙅ", "Ꙇ", "Ꙉ", "Ꙋ", "Ꙍ", "Ꙏ", "Ꙑ", "Ꙓ", "Ꙕ", "Ꙗ", "Ꙙ", "Ꙛ", "Ꙝ", "Ꙟ", "Ꙡ", "Ꙣ", "Ꙥ", "Ꙧ", "Ꙩ", "Ꙫ", "Ꙭ", "Ꚁ", "Ꚃ", "Ꚅ", "Ꚇ", "Ꚉ", "Ꚋ", "Ꚍ", "Ꚏ", "Ꚑ", "Ꚓ", "Ꚕ", "Ꚗ", "Ꜣ", "Ꜥ", "Ꜧ", "Ꜩ", "Ꜫ", "Ꜭ", "Ꜯ", "Ꜳ", "Ꜵ", "Ꜷ", "Ꜹ", "Ꜻ", "Ꜽ", "Ꜿ", "Ꝁ", "Ꝃ", "Ꝅ", "Ꝇ", "Ꝉ", "Ꝋ", "Ꝍ", "Ꝏ", "Ꝑ", "Ꝓ", "Ꝕ", "Ꝗ", "Ꝙ", "Ꝛ", "Ꝝ", "Ꝟ", "Ꝡ", "Ꝣ", "Ꝥ", "Ꝧ", "Ꝩ", "Ꝫ", "Ꝭ", "Ꝯ", "Ꝺ", "Ꝼ", ["Ᵹ", "Ꝿ"], "Ꞁ", "Ꞃ", "Ꞅ", "Ꞇ", "Ꞌ", "Ɥ", "Ꞑ", "Ꞓ", "Ꞡ", "Ꞣ", "Ꞥ", "Ꞧ", "Ꞩ", "Ɦ", ["A", "Z"]], false, false);
590
+ var peg$e59 = peg$classExpectation([["ᛮ", "ᛰ"], ["Ⅰ", "ↂ"], ["ↅ", "ↈ"], "〇", ["〡", "〩"], ["〸", "〺"], ["ꛦ", "ꛯ"]], false, false);
591
+ var peg$e60 = peg$classExpectation([["0", "9"], ["٠", "٩"], ["۰", "۹"], ["߀", "߉"], ["०", "९"], ["০", "৯"], ["੦", "੯"], ["૦", "૯"], ["୦", "୯"], ["௦", "௯"], ["౦", "౯"], ["೦", "೯"], ["൦", "൯"], ["๐", "๙"], ["໐", "໙"], ["༠", "༩"], ["၀", "၉"], ["႐", "႙"], ["០", "៩"], ["᠐", "᠙"], ["᥆", "᥏"], ["᧐", "᧙"], ["᪀", "᪉"], ["᪐", "᪙"], ["᭐", "᭙"], ["᮰", "᮹"], ["᱀", "᱉"], ["᱐", "᱙"], ["꘠", "꘩"], ["꣐", "꣙"], ["꤀", "꤉"], ["꧐", "꧙"], ["꩐", "꩙"], ["꯰", "꯹"], ["0", "9"]], false, false);
592
+ var peg$f0 = function(v) {
593
+ return v;
594
+ };
595
+ var peg$f1 = function(v) {
596
+ return v;
597
+ };
598
+ var peg$f2 = function(v) {
599
+ return v;
600
+ };
601
+ var peg$f3 = function(v) {
602
+ return v;
603
+ };
604
+ var peg$f4 = function(v) {
605
+ return v;
606
+ };
607
+ var peg$f5 = function(v) {
608
+ return v;
609
+ };
610
+ var peg$f6 = function(v) {
611
+ return v;
612
+ };
613
+ var peg$f7 = function(v) {
614
+ return v;
615
+ };
616
+ var peg$f8 = function(v) {
617
+ return v;
618
+ };
619
+ var peg$f9 = function(v) {
620
+ return v;
621
+ };
622
+ var peg$f10 = function(c1, graph, c2) {
623
+ return b.createElement("Dot", {}, [...c1, graph, ...c2]);
624
+ };
625
+ var peg$f11 = function(_strict, _kind, id, children) {
626
+ const strict = !!_strict;
627
+ const kind = _kind.toLowerCase();
628
+ const directed = kind === "digraph";
629
+ for (const edgeop of edgeops) {
630
+ if (directed) {
631
+ if (edgeop.operator !== "->") {
632
+ error(`In digraph, it's necessary to describe with "->" operator to create edge.`, edgeop.location);
633
+ }
634
+ } else {
635
+ if (edgeop.operator !== "--") {
636
+ error(`In graph, it's necessary to describe with "--" operator to create edge.`, edgeop.location);
637
+ }
638
+ }
639
+ }
640
+ return b.createElement(
641
+ // @ts-ignore
642
+ "Graph",
643
+ // @ts-ignore
644
+ id !== null ? {
645
+ // @ts-ignore
646
+ id,
647
+ // @ts-ignore
648
+ directed,
649
+ // @ts-ignore
650
+ strict
651
+ } : {
652
+ // @ts-ignore
653
+ directed,
654
+ // @ts-ignore
655
+ strict
656
+ },
657
+ // @ts-ignore
658
+ children
659
+ );
660
+ };
661
+ var peg$f12 = function(keyValue) {
662
+ return b.createElement(
663
+ // @ts-ignore
664
+ "Attribute",
665
+ {
666
+ // @ts-ignore
667
+ ...keyValue
668
+ },
669
+ []
670
+ );
671
+ };
672
+ var peg$f13 = function(_kind, children) {
673
+ return b.createElement(
674
+ // @ts-ignore
675
+ "AttributeList",
676
+ {
677
+ // @ts-ignore
678
+ kind: `${_kind.slice(0, 1).toUpperCase()}${_kind.slice(1).toLowerCase()}`
679
+ },
680
+ // @ts-ignore
681
+ children
682
+ );
683
+ };
684
+ var peg$f14 = function(id, rhs, _children) {
685
+ return b.createElement(
686
+ // @ts-ignore
687
+ // @ts-ignore
688
+ "Edge",
689
+ {
690
+ // @ts-ignore
691
+ targets: [id, ...rhs]
692
+ },
693
+ // @ts-ignore
694
+ _children ?? []
695
+ );
696
+ };
697
+ var peg$f15 = function(id, _children) {
698
+ return b.createElement(
699
+ // @ts-ignore
700
+ "Node",
701
+ {
702
+ // @ts-ignore
703
+ id
704
+ },
705
+ // @ts-ignore
706
+ _children ?? []
707
+ );
708
+ };
709
+ var peg$f16 = function(key, value) {
710
+ return { key, value };
711
+ };
712
+ var peg$f17 = function(kv) {
713
+ return b.createElement(
714
+ // @ts-ignore
715
+ "Attribute",
716
+ {
717
+ // @ts-ignore
718
+ ...kv,
719
+ // @ts-ignore
720
+ location: location()
721
+ },
722
+ []
723
+ );
724
+ };
725
+ var peg$f18 = function(list) {
726
+ return list;
727
+ };
728
+ var peg$f19 = function(id, v) {
729
+ return v;
730
+ };
731
+ var peg$f20 = function(id, rest) {
732
+ return b.createElement("NodeRefGroup", {}, [id, ...rest]);
733
+ };
734
+ var peg$f21 = function(operator) {
735
+ return { operator, location: location() };
736
+ };
737
+ var peg$f22 = function(edgeop, id, rest) {
738
+ edgeops.push(edgeop);
739
+ return [id].concat(rest || []);
740
+ };
741
+ var peg$f23 = function(id, port) {
742
+ return b.createElement(
743
+ // @ts-ignore
744
+ "NodeRef",
745
+ {
746
+ // @ts-ignore
747
+ id,
748
+ // @ts-ignore
749
+ ...port
750
+ },
751
+ []
752
+ );
753
+ };
754
+ var peg$f24 = function(port, compass) {
755
+ return compass;
756
+ };
757
+ var peg$f25 = function(port, compass) {
758
+ if (["n", "ne", "e", "se", "s", "sw", "w", "nw"].includes(port)) {
759
+ return { compass: port };
760
+ } else if (compass) {
761
+ return { port, compass };
762
+ }
763
+ return { port };
764
+ };
765
+ var peg$f26 = function(id) {
766
+ return id;
767
+ };
768
+ var peg$f27 = function(id, _children) {
769
+ const children = _children ?? [];
770
+ return b.createElement("Subgraph", id ? { id } : {}, children);
771
+ };
772
+ var peg$f28 = function(value) {
773
+ return { value, quoted: false };
774
+ };
775
+ var peg$f29 = function(value) {
776
+ return { value, quoted: true };
777
+ };
778
+ var peg$f30 = function(v) {
779
+ return b.createElement(
780
+ // @ts-ignore
781
+ "Literal",
782
+ {
783
+ // @ts-ignore
784
+ ...v
785
+ },
786
+ []
787
+ );
788
+ };
789
+ var peg$f31 = function(value) {
790
+ return b.createElement(
791
+ // @ts-ignore
792
+ "Literal",
793
+ {
794
+ // @ts-ignore
795
+ value,
796
+ // @ts-ignore
797
+ quoted: false
798
+ },
799
+ []
800
+ );
801
+ };
802
+ var peg$f32 = function(v) {
803
+ return v;
804
+ };
805
+ var peg$f33 = function(v) {
806
+ return b.createElement(
807
+ // @ts-ignore
808
+ "Comment",
809
+ {
810
+ // @ts-ignore
811
+ kind: "Block",
812
+ // @ts-ignore
813
+ value: dedent(v.join("").replace(/[ \t]*\*/g, ""))
814
+ },
815
+ []
816
+ );
817
+ };
818
+ var peg$f34 = function(lines) {
819
+ return b.createElement(
820
+ // @ts-ignore
821
+ "Comment",
822
+ {
823
+ // @ts-ignore
824
+ kind: "Slash",
825
+ // @ts-ignore
826
+ value: dedent(lines.join("\n"))
827
+ },
828
+ []
829
+ );
830
+ };
831
+ var peg$f35 = function(v) {
832
+ return v;
833
+ };
834
+ var peg$f36 = function(v) {
835
+ return v.join("");
836
+ };
837
+ var peg$f37 = function(lines) {
838
+ return b.createElement(
839
+ // @ts-ignore
840
+ "Comment",
841
+ {
842
+ // @ts-ignore
843
+ kind: "Macro",
844
+ // @ts-ignore
845
+ value: dedent(lines.join("\n"))
846
+ },
847
+ []
848
+ );
849
+ };
850
+ var peg$f38 = function(v) {
851
+ return v;
852
+ };
853
+ var peg$f39 = function(v) {
854
+ return v.join("");
855
+ };
856
+ var peg$f40 = function(first, rest) {
857
+ return first + rest.join("");
858
+ };
859
+ var peg$f41 = function(first, rest) {
860
+ return first + rest;
861
+ };
862
+ var peg$f42 = function(n) {
863
+ return text();
864
+ };
865
+ var peg$f43 = function(v) {
866
+ return b.createElement(
867
+ // @ts-ignore
868
+ "Literal",
869
+ {
870
+ // @ts-ignore
871
+ value: v.slice(1, v.length - 1),
872
+ // @ts-ignore
873
+ quoted: "html"
874
+ },
875
+ []
876
+ );
877
+ };
878
+ var peg$f44 = function(v) {
879
+ return "<" + v.join("") + ">";
880
+ };
881
+ var peg$f45 = function(v) {
882
+ return v;
883
+ };
884
+ var peg$f46 = function(v) {
885
+ return v.join("");
886
+ };
887
+ var peg$f47 = function(chars) {
888
+ return b.createElement(
889
+ // @ts-ignore
890
+ "Literal",
891
+ {
892
+ // @ts-ignore
893
+ value: chars.join(""),
894
+ // @ts-ignore
895
+ quoted: true
896
+ },
897
+ []
898
+ );
899
+ };
900
+ var peg$f48 = function() {
901
+ return text();
902
+ };
903
+ var peg$f49 = function(v) {
904
+ return v[1] === '"' ? '"' : v[0] + v[1];
905
+ };
906
+ var peg$f50 = function() {
907
+ return "";
908
+ };
909
+ var peg$currPos = 0;
910
+ var peg$savedPos = 0;
911
+ var peg$posDetailsCache = [{ line: 1, column: 1 }];
912
+ var peg$maxFailPos = 0;
913
+ var peg$maxFailExpected = [];
914
+ var peg$silentFails = 0;
915
+ var peg$result;
916
+ if ("startRule" in options) {
917
+ if (!(options.startRule in peg$startRuleFunctions)) {
918
+ throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
919
+ }
920
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
921
+ }
922
+ function text() {
923
+ return input.substring(peg$savedPos, peg$currPos);
924
+ }
925
+ function location() {
926
+ return peg$computeLocation(peg$savedPos, peg$currPos);
927
+ }
928
+ function error(message, location2) {
929
+ location2 = location2 !== void 0 ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
930
+ throw peg$buildSimpleError(message, location2);
931
+ }
932
+ function peg$literalExpectation(text2, ignoreCase) {
933
+ return { type: "literal", text: text2, ignoreCase };
934
+ }
935
+ function peg$classExpectation(parts, inverted, ignoreCase) {
936
+ return { type: "class", parts, inverted, ignoreCase };
937
+ }
938
+ function peg$anyExpectation() {
939
+ return { type: "any" };
940
+ }
941
+ function peg$endExpectation() {
942
+ return { type: "end" };
943
+ }
944
+ function peg$otherExpectation(description) {
945
+ return { type: "other", description };
946
+ }
947
+ function peg$computePosDetails(pos) {
948
+ var details = peg$posDetailsCache[pos];
949
+ var p;
950
+ if (details) {
951
+ return details;
952
+ } else {
953
+ p = pos - 1;
954
+ while (!peg$posDetailsCache[p]) {
955
+ p--;
956
+ }
957
+ details = peg$posDetailsCache[p];
958
+ details = {
959
+ // @ts-ignore
960
+ line: details.line,
961
+ // @ts-ignore
962
+ column: details.column
963
+ };
964
+ while (p < pos) {
965
+ if (input.charCodeAt(p) === 10) {
966
+ details.line++;
967
+ details.column = 1;
968
+ } else {
969
+ details.column++;
970
+ }
971
+ p++;
972
+ }
973
+ peg$posDetailsCache[pos] = details;
974
+ return details;
975
+ }
976
+ }
977
+ function peg$computeLocation(startPos, endPos, offset2) {
978
+ var startPosDetails = peg$computePosDetails(startPos);
979
+ var endPosDetails = peg$computePosDetails(endPos);
980
+ var res = {
981
+ // @ts-ignore
982
+ source: peg$source,
983
+ // @ts-ignore
984
+ start: {
985
+ // @ts-ignore
986
+ offset: startPos,
987
+ // @ts-ignore
988
+ line: startPosDetails.line,
989
+ // @ts-ignore
990
+ column: startPosDetails.column
991
+ },
992
+ // @ts-ignore
993
+ end: {
994
+ // @ts-ignore
995
+ offset: endPos,
996
+ // @ts-ignore
997
+ line: endPosDetails.line,
998
+ // @ts-ignore
999
+ column: endPosDetails.column
1000
+ }
1001
+ };
1002
+ if (offset2 && peg$source && typeof peg$source.offset === "function") {
1003
+ res.start = peg$source.offset(res.start);
1004
+ res.end = peg$source.offset(res.end);
1005
+ }
1006
+ return res;
1007
+ }
1008
+ function peg$fail(expected2) {
1009
+ if (peg$currPos < peg$maxFailPos) {
1010
+ return;
1011
+ }
1012
+ if (peg$currPos > peg$maxFailPos) {
1013
+ peg$maxFailPos = peg$currPos;
1014
+ peg$maxFailExpected = [];
1015
+ }
1016
+ peg$maxFailExpected.push(expected2);
1017
+ }
1018
+ function peg$buildSimpleError(message, location2) {
1019
+ return new peg$SyntaxError(message, null, null, location2);
1020
+ }
1021
+ function peg$buildStructuredError(expected2, found, location2) {
1022
+ return new peg$SyntaxError(
1023
+ // @ts-ignore
1024
+ peg$SyntaxError.buildMessage(expected2, found),
1025
+ // @ts-ignore
1026
+ expected2,
1027
+ // @ts-ignore
1028
+ found,
1029
+ // @ts-ignore
1030
+ location2
1031
+ );
1032
+ }
1033
+ function peg$parseDot() {
1034
+ var s0, s2;
1035
+ s0 = peg$currPos;
1036
+ peg$parse__();
1037
+ s2 = peg$parse_dot();
1038
+ if (s2 !== peg$FAILED) {
1039
+ peg$parse__();
1040
+ peg$savedPos = s0;
1041
+ s0 = peg$f0(s2);
1042
+ } else {
1043
+ peg$currPos = s0;
1044
+ s0 = peg$FAILED;
1045
+ }
1046
+ return s0;
1047
+ }
1048
+ function peg$parseGraph() {
1049
+ var s0, s2;
1050
+ s0 = peg$currPos;
1051
+ peg$parse__();
1052
+ s2 = peg$parse_graph();
1053
+ if (s2 !== peg$FAILED) {
1054
+ peg$parse__();
1055
+ peg$savedPos = s0;
1056
+ s0 = peg$f1(s2);
1057
+ } else {
1058
+ peg$currPos = s0;
1059
+ s0 = peg$FAILED;
1060
+ }
1061
+ return s0;
1062
+ }
1063
+ function peg$parseNode() {
1064
+ var s0, s2;
1065
+ s0 = peg$currPos;
1066
+ peg$parse__();
1067
+ s2 = peg$parse_node();
1068
+ if (s2 !== peg$FAILED) {
1069
+ peg$parse__();
1070
+ peg$savedPos = s0;
1071
+ s0 = peg$f2(s2);
1072
+ } else {
1073
+ peg$currPos = s0;
1074
+ s0 = peg$FAILED;
1075
+ }
1076
+ return s0;
1077
+ }
1078
+ function peg$parseAttributeList() {
1079
+ var s0, s2;
1080
+ s0 = peg$currPos;
1081
+ peg$parse__();
1082
+ s2 = peg$parse_attributes();
1083
+ if (s2 !== peg$FAILED) {
1084
+ peg$parse__();
1085
+ peg$savedPos = s0;
1086
+ s0 = peg$f3(s2);
1087
+ } else {
1088
+ peg$currPos = s0;
1089
+ s0 = peg$FAILED;
1090
+ }
1091
+ return s0;
1092
+ }
1093
+ function peg$parseAttribute() {
1094
+ var s0, s2;
1095
+ s0 = peg$currPos;
1096
+ peg$parse__();
1097
+ s2 = peg$parse_attribute();
1098
+ if (s2 !== peg$FAILED) {
1099
+ peg$parse__();
1100
+ peg$savedPos = s0;
1101
+ s0 = peg$f4(s2);
1102
+ } else {
1103
+ peg$currPos = s0;
1104
+ s0 = peg$FAILED;
1105
+ }
1106
+ return s0;
1107
+ }
1108
+ function peg$parseEdge() {
1109
+ var s0, s2;
1110
+ s0 = peg$currPos;
1111
+ peg$parse__();
1112
+ s2 = peg$parse_edge();
1113
+ if (s2 !== peg$FAILED) {
1114
+ peg$parse__();
1115
+ peg$savedPos = s0;
1116
+ s0 = peg$f5(s2);
1117
+ } else {
1118
+ peg$currPos = s0;
1119
+ s0 = peg$FAILED;
1120
+ }
1121
+ return s0;
1122
+ }
1123
+ function peg$parseSubgraph() {
1124
+ var s0, s2;
1125
+ s0 = peg$currPos;
1126
+ peg$parse__();
1127
+ s2 = peg$parse_subgraph();
1128
+ if (s2 !== peg$FAILED) {
1129
+ peg$parse__();
1130
+ peg$savedPos = s0;
1131
+ s0 = peg$f6(s2);
1132
+ } else {
1133
+ peg$currPos = s0;
1134
+ s0 = peg$FAILED;
1135
+ }
1136
+ return s0;
1137
+ }
1138
+ function peg$parseNodeRef() {
1139
+ var s0, s2;
1140
+ s0 = peg$currPos;
1141
+ peg$parse__();
1142
+ s2 = peg$parse_node_ref();
1143
+ if (s2 !== peg$FAILED) {
1144
+ peg$parse__();
1145
+ peg$savedPos = s0;
1146
+ s0 = peg$f7(s2);
1147
+ } else {
1148
+ peg$currPos = s0;
1149
+ s0 = peg$FAILED;
1150
+ }
1151
+ return s0;
1152
+ }
1153
+ function peg$parseAttibutesItem() {
1154
+ var s0, s2;
1155
+ s0 = peg$currPos;
1156
+ peg$parse__();
1157
+ s2 = peg$parse_attibutes_item();
1158
+ if (s2 !== peg$FAILED) {
1159
+ peg$parse__();
1160
+ peg$savedPos = s0;
1161
+ s0 = peg$f8(s2);
1162
+ } else {
1163
+ peg$currPos = s0;
1164
+ s0 = peg$FAILED;
1165
+ }
1166
+ return s0;
1167
+ }
1168
+ function peg$parseComment() {
1169
+ var s0, s2;
1170
+ s0 = peg$currPos;
1171
+ peg$parse__();
1172
+ s2 = peg$parse_comment();
1173
+ if (s2 !== peg$FAILED) {
1174
+ peg$parse__();
1175
+ peg$savedPos = s0;
1176
+ s0 = peg$f9(s2);
1177
+ } else {
1178
+ peg$currPos = s0;
1179
+ s0 = peg$FAILED;
1180
+ }
1181
+ return s0;
1182
+ }
1183
+ function peg$parseClusterStatements() {
1184
+ var s0, s1;
1185
+ s0 = [];
1186
+ s1 = peg$parseAttribute();
1187
+ if (s1 === peg$FAILED) {
1188
+ s1 = peg$parseAttributeList();
1189
+ if (s1 === peg$FAILED) {
1190
+ s1 = peg$parseEdge();
1191
+ if (s1 === peg$FAILED) {
1192
+ s1 = peg$parseSubgraph();
1193
+ if (s1 === peg$FAILED) {
1194
+ s1 = peg$parseNode();
1195
+ if (s1 === peg$FAILED) {
1196
+ s1 = peg$parseComment();
1197
+ }
1198
+ }
1199
+ }
1200
+ }
1201
+ }
1202
+ while (s1 !== peg$FAILED) {
1203
+ s0.push(s1);
1204
+ s1 = peg$parseAttribute();
1205
+ if (s1 === peg$FAILED) {
1206
+ s1 = peg$parseAttributeList();
1207
+ if (s1 === peg$FAILED) {
1208
+ s1 = peg$parseEdge();
1209
+ if (s1 === peg$FAILED) {
1210
+ s1 = peg$parseSubgraph();
1211
+ if (s1 === peg$FAILED) {
1212
+ s1 = peg$parseNode();
1213
+ if (s1 === peg$FAILED) {
1214
+ s1 = peg$parseComment();
1215
+ }
1216
+ }
1217
+ }
1218
+ }
1219
+ }
1220
+ }
1221
+ return s0;
1222
+ }
1223
+ function peg$parse_dot() {
1224
+ var s0, s1, s2, s3, s4;
1225
+ s0 = peg$currPos;
1226
+ s1 = [];
1227
+ s2 = peg$parseComment();
1228
+ while (s2 !== peg$FAILED) {
1229
+ s1.push(s2);
1230
+ s2 = peg$parseComment();
1231
+ }
1232
+ s2 = peg$parseGraph();
1233
+ if (s2 !== peg$FAILED) {
1234
+ s3 = [];
1235
+ s4 = peg$parseComment();
1236
+ while (s4 !== peg$FAILED) {
1237
+ s3.push(s4);
1238
+ s4 = peg$parseComment();
1239
+ }
1240
+ peg$savedPos = s0;
1241
+ s0 = peg$f10(s1, s2, s3);
1242
+ } else {
1243
+ peg$currPos = s0;
1244
+ s0 = peg$FAILED;
1245
+ }
1246
+ return s0;
1247
+ }
1248
+ function peg$parse_graph() {
1249
+ var s0, s1, s3, s5, s7, s8, s10;
1250
+ s0 = peg$currPos;
1251
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c0) {
1252
+ s1 = input.substr(peg$currPos, 6);
1253
+ peg$currPos += 6;
1254
+ } else {
1255
+ s1 = peg$FAILED;
1256
+ if (peg$silentFails === 0) {
1257
+ peg$fail(peg$e0);
1258
+ }
1259
+ }
1260
+ if (s1 === peg$FAILED) {
1261
+ s1 = null;
1262
+ }
1263
+ peg$parse_();
1264
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c1) {
1265
+ s3 = input.substr(peg$currPos, 5);
1266
+ peg$currPos += 5;
1267
+ } else {
1268
+ s3 = peg$FAILED;
1269
+ if (peg$silentFails === 0) {
1270
+ peg$fail(peg$e1);
1271
+ }
1272
+ }
1273
+ if (s3 === peg$FAILED) {
1274
+ if (input.substr(peg$currPos, 7).toLowerCase() === peg$c2) {
1275
+ s3 = input.substr(peg$currPos, 7);
1276
+ peg$currPos += 7;
1277
+ } else {
1278
+ s3 = peg$FAILED;
1279
+ if (peg$silentFails === 0) {
1280
+ peg$fail(peg$e2);
1281
+ }
1282
+ }
1283
+ }
1284
+ if (s3 !== peg$FAILED) {
1285
+ peg$parse_();
1286
+ s5 = peg$parse_literal();
1287
+ if (s5 === peg$FAILED) {
1288
+ s5 = null;
1289
+ }
1290
+ peg$parse__();
1291
+ if (input.charCodeAt(peg$currPos) === 123) {
1292
+ s7 = peg$c3;
1293
+ peg$currPos++;
1294
+ } else {
1295
+ s7 = peg$FAILED;
1296
+ if (peg$silentFails === 0) {
1297
+ peg$fail(peg$e3);
1298
+ }
1299
+ }
1300
+ if (s7 !== peg$FAILED) {
1301
+ s8 = peg$parseClusterStatements();
1302
+ peg$parse__();
1303
+ if (input.charCodeAt(peg$currPos) === 125) {
1304
+ s10 = peg$c4;
1305
+ peg$currPos++;
1306
+ } else {
1307
+ s10 = peg$FAILED;
1308
+ if (peg$silentFails === 0) {
1309
+ peg$fail(peg$e4);
1310
+ }
1311
+ }
1312
+ if (s10 !== peg$FAILED) {
1313
+ peg$savedPos = s0;
1314
+ s0 = peg$f11(s1, s3, s5, s8);
1315
+ } else {
1316
+ peg$currPos = s0;
1317
+ s0 = peg$FAILED;
1318
+ }
1319
+ } else {
1320
+ peg$currPos = s0;
1321
+ s0 = peg$FAILED;
1322
+ }
1323
+ } else {
1324
+ peg$currPos = s0;
1325
+ s0 = peg$FAILED;
1326
+ }
1327
+ return s0;
1328
+ }
1329
+ function peg$parse_attribute() {
1330
+ var s0, s1;
1331
+ s0 = peg$currPos;
1332
+ s1 = peg$parse_key_value();
1333
+ if (s1 !== peg$FAILED) {
1334
+ peg$parse_();
1335
+ if (input.charCodeAt(peg$currPos) === 59) {
1336
+ peg$currPos++;
1337
+ } else {
1338
+ if (peg$silentFails === 0) {
1339
+ peg$fail(peg$e5);
1340
+ }
1341
+ }
1342
+ peg$savedPos = s0;
1343
+ s0 = peg$f12(s1);
1344
+ } else {
1345
+ peg$currPos = s0;
1346
+ s0 = peg$FAILED;
1347
+ }
1348
+ return s0;
1349
+ }
1350
+ function peg$parse_attributes() {
1351
+ var s0, s1, s2;
1352
+ s0 = peg$currPos;
1353
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c1) {
1354
+ s1 = input.substr(peg$currPos, 5);
1355
+ peg$currPos += 5;
1356
+ } else {
1357
+ s1 = peg$FAILED;
1358
+ if (peg$silentFails === 0) {
1359
+ peg$fail(peg$e1);
1360
+ }
1361
+ }
1362
+ if (s1 === peg$FAILED) {
1363
+ if (input.substr(peg$currPos, 4).toLowerCase() === peg$c6) {
1364
+ s1 = input.substr(peg$currPos, 4);
1365
+ peg$currPos += 4;
1366
+ } else {
1367
+ s1 = peg$FAILED;
1368
+ if (peg$silentFails === 0) {
1369
+ peg$fail(peg$e6);
1370
+ }
1371
+ }
1372
+ if (s1 === peg$FAILED) {
1373
+ if (input.substr(peg$currPos, 4).toLowerCase() === peg$c7) {
1374
+ s1 = input.substr(peg$currPos, 4);
1375
+ peg$currPos += 4;
1376
+ } else {
1377
+ s1 = peg$FAILED;
1378
+ if (peg$silentFails === 0) {
1379
+ peg$fail(peg$e7);
1380
+ }
1381
+ }
1382
+ }
1383
+ }
1384
+ if (s1 !== peg$FAILED) {
1385
+ s2 = peg$parse_attribute_list();
1386
+ if (s2 !== peg$FAILED) {
1387
+ peg$parse_();
1388
+ if (input.charCodeAt(peg$currPos) === 59) {
1389
+ peg$currPos++;
1390
+ } else {
1391
+ if (peg$silentFails === 0) {
1392
+ peg$fail(peg$e5);
1393
+ }
1394
+ }
1395
+ peg$savedPos = s0;
1396
+ s0 = peg$f13(s1, s2);
1397
+ } else {
1398
+ peg$currPos = s0;
1399
+ s0 = peg$FAILED;
1400
+ }
1401
+ } else {
1402
+ peg$currPos = s0;
1403
+ s0 = peg$FAILED;
1404
+ }
1405
+ return s0;
1406
+ }
1407
+ function peg$parse_edge() {
1408
+ var s0, s1, s2, s3;
1409
+ s0 = peg$currPos;
1410
+ s1 = peg$parse_edge_target();
1411
+ if (s1 !== peg$FAILED) {
1412
+ s2 = peg$parse_edge_rhs();
1413
+ if (s2 !== peg$FAILED) {
1414
+ s3 = peg$parse_attribute_list();
1415
+ if (s3 === peg$FAILED) {
1416
+ s3 = null;
1417
+ }
1418
+ peg$parse_();
1419
+ if (input.charCodeAt(peg$currPos) === 59) {
1420
+ peg$currPos++;
1421
+ } else {
1422
+ if (peg$silentFails === 0) {
1423
+ peg$fail(peg$e5);
1424
+ }
1425
+ }
1426
+ peg$savedPos = s0;
1427
+ s0 = peg$f14(s1, s2, s3);
1428
+ } else {
1429
+ peg$currPos = s0;
1430
+ s0 = peg$FAILED;
1431
+ }
1432
+ } else {
1433
+ peg$currPos = s0;
1434
+ s0 = peg$FAILED;
1435
+ }
1436
+ return s0;
1437
+ }
1438
+ function peg$parse_node() {
1439
+ var s0, s1, s3;
1440
+ s0 = peg$currPos;
1441
+ s1 = peg$parse_literal();
1442
+ if (s1 !== peg$FAILED) {
1443
+ peg$parse_();
1444
+ s3 = peg$parse_attribute_list();
1445
+ if (s3 === peg$FAILED) {
1446
+ s3 = null;
1447
+ }
1448
+ peg$parse_();
1449
+ if (input.charCodeAt(peg$currPos) === 59) {
1450
+ peg$currPos++;
1451
+ } else {
1452
+ if (peg$silentFails === 0) {
1453
+ peg$fail(peg$e5);
1454
+ }
1455
+ }
1456
+ peg$savedPos = s0;
1457
+ s0 = peg$f15(s1, s3);
1458
+ } else {
1459
+ peg$currPos = s0;
1460
+ s0 = peg$FAILED;
1461
+ }
1462
+ return s0;
1463
+ }
1464
+ function peg$parse_key_value() {
1465
+ var s0, s1, s3, s5;
1466
+ s0 = peg$currPos;
1467
+ s1 = peg$parse_literal();
1468
+ if (s1 !== peg$FAILED) {
1469
+ peg$parse_();
1470
+ if (input.charCodeAt(peg$currPos) === 61) {
1471
+ s3 = peg$c8;
1472
+ peg$currPos++;
1473
+ } else {
1474
+ s3 = peg$FAILED;
1475
+ if (peg$silentFails === 0) {
1476
+ peg$fail(peg$e8);
1477
+ }
1478
+ }
1479
+ if (s3 !== peg$FAILED) {
1480
+ peg$parse_();
1481
+ s5 = peg$parse_literal();
1482
+ if (s5 !== peg$FAILED) {
1483
+ peg$savedPos = s0;
1484
+ s0 = peg$f16(s1, s5);
1485
+ } else {
1486
+ peg$currPos = s0;
1487
+ s0 = peg$FAILED;
1488
+ }
1489
+ } else {
1490
+ peg$currPos = s0;
1491
+ s0 = peg$FAILED;
1492
+ }
1493
+ } else {
1494
+ peg$currPos = s0;
1495
+ s0 = peg$FAILED;
1496
+ }
1497
+ return s0;
1498
+ }
1499
+ function peg$parse_attibutes_item() {
1500
+ var s0, s1, s3;
1501
+ s0 = peg$currPos;
1502
+ s1 = peg$parse_key_value();
1503
+ if (s1 !== peg$FAILED) {
1504
+ peg$parse_();
1505
+ if (input.charCodeAt(peg$currPos) === 44) {
1506
+ s3 = peg$c9;
1507
+ peg$currPos++;
1508
+ } else {
1509
+ s3 = peg$FAILED;
1510
+ if (peg$silentFails === 0) {
1511
+ peg$fail(peg$e9);
1512
+ }
1513
+ }
1514
+ if (s3 === peg$FAILED) {
1515
+ if (input.charCodeAt(peg$currPos) === 59) {
1516
+ s3 = peg$c5;
1517
+ peg$currPos++;
1518
+ } else {
1519
+ s3 = peg$FAILED;
1520
+ if (peg$silentFails === 0) {
1521
+ peg$fail(peg$e5);
1522
+ }
1523
+ }
1524
+ }
1525
+ if (s3 === peg$FAILED) {
1526
+ s3 = null;
1527
+ }
1528
+ peg$savedPos = s0;
1529
+ s0 = peg$f17(s1);
1530
+ } else {
1531
+ peg$currPos = s0;
1532
+ s0 = peg$FAILED;
1533
+ }
1534
+ return s0;
1535
+ }
1536
+ function peg$parse_attribute_list() {
1537
+ var s0, s2, s3, s4, s5;
1538
+ s0 = peg$currPos;
1539
+ peg$parse_();
1540
+ if (input.charCodeAt(peg$currPos) === 91) {
1541
+ s2 = peg$c10;
1542
+ peg$currPos++;
1543
+ } else {
1544
+ s2 = peg$FAILED;
1545
+ if (peg$silentFails === 0) {
1546
+ peg$fail(peg$e10);
1547
+ }
1548
+ }
1549
+ if (s2 !== peg$FAILED) {
1550
+ s3 = [];
1551
+ s4 = peg$parseAttibutesItem();
1552
+ if (s4 === peg$FAILED) {
1553
+ s4 = peg$parseComment();
1554
+ }
1555
+ while (s4 !== peg$FAILED) {
1556
+ s3.push(s4);
1557
+ s4 = peg$parseAttibutesItem();
1558
+ if (s4 === peg$FAILED) {
1559
+ s4 = peg$parseComment();
1560
+ }
1561
+ }
1562
+ s4 = peg$parse__();
1563
+ if (input.charCodeAt(peg$currPos) === 93) {
1564
+ s5 = peg$c11;
1565
+ peg$currPos++;
1566
+ } else {
1567
+ s5 = peg$FAILED;
1568
+ if (peg$silentFails === 0) {
1569
+ peg$fail(peg$e11);
1570
+ }
1571
+ }
1572
+ if (s5 !== peg$FAILED) {
1573
+ peg$savedPos = s0;
1574
+ s0 = peg$f18(s3);
1575
+ } else {
1576
+ peg$currPos = s0;
1577
+ s0 = peg$FAILED;
1578
+ }
1579
+ } else {
1580
+ peg$currPos = s0;
1581
+ s0 = peg$FAILED;
1582
+ }
1583
+ return s0;
1584
+ }
1585
+ function peg$parse_edge_target_group() {
1586
+ var s0, s1, s2, s3, s4, s5, s6;
1587
+ s0 = peg$currPos;
1588
+ if (input.charCodeAt(peg$currPos) === 123) {
1589
+ s1 = peg$c3;
1590
+ peg$currPos++;
1591
+ } else {
1592
+ s1 = peg$FAILED;
1593
+ if (peg$silentFails === 0) {
1594
+ peg$fail(peg$e3);
1595
+ }
1596
+ }
1597
+ if (s1 !== peg$FAILED) {
1598
+ s2 = peg$parseNodeRef();
1599
+ if (s2 !== peg$FAILED) {
1600
+ s3 = [];
1601
+ s4 = peg$currPos;
1602
+ if (input.charCodeAt(peg$currPos) === 44) {
1603
+ s5 = peg$c9;
1604
+ peg$currPos++;
1605
+ } else {
1606
+ s5 = peg$FAILED;
1607
+ if (peg$silentFails === 0) {
1608
+ peg$fail(peg$e9);
1609
+ }
1610
+ }
1611
+ if (s5 === peg$FAILED) {
1612
+ if (input.charCodeAt(peg$currPos) === 59) {
1613
+ s5 = peg$c5;
1614
+ peg$currPos++;
1615
+ } else {
1616
+ s5 = peg$FAILED;
1617
+ if (peg$silentFails === 0) {
1618
+ peg$fail(peg$e5);
1619
+ }
1620
+ }
1621
+ }
1622
+ if (s5 === peg$FAILED) {
1623
+ s5 = null;
1624
+ }
1625
+ s6 = peg$parseNodeRef();
1626
+ if (s6 !== peg$FAILED) {
1627
+ peg$savedPos = s4;
1628
+ s4 = peg$f19(s2, s6);
1629
+ } else {
1630
+ peg$currPos = s4;
1631
+ s4 = peg$FAILED;
1632
+ }
1633
+ while (s4 !== peg$FAILED) {
1634
+ s3.push(s4);
1635
+ s4 = peg$currPos;
1636
+ if (input.charCodeAt(peg$currPos) === 44) {
1637
+ s5 = peg$c9;
1638
+ peg$currPos++;
1639
+ } else {
1640
+ s5 = peg$FAILED;
1641
+ if (peg$silentFails === 0) {
1642
+ peg$fail(peg$e9);
1643
+ }
1644
+ }
1645
+ if (s5 === peg$FAILED) {
1646
+ if (input.charCodeAt(peg$currPos) === 59) {
1647
+ s5 = peg$c5;
1648
+ peg$currPos++;
1649
+ } else {
1650
+ s5 = peg$FAILED;
1651
+ if (peg$silentFails === 0) {
1652
+ peg$fail(peg$e5);
1653
+ }
1654
+ }
1655
+ }
1656
+ if (s5 === peg$FAILED) {
1657
+ s5 = null;
1658
+ }
1659
+ s6 = peg$parseNodeRef();
1660
+ if (s6 !== peg$FAILED) {
1661
+ peg$savedPos = s4;
1662
+ s4 = peg$f19(s2, s6);
1663
+ } else {
1664
+ peg$currPos = s4;
1665
+ s4 = peg$FAILED;
1666
+ }
1667
+ }
1668
+ if (input.charCodeAt(peg$currPos) === 44) {
1669
+ s4 = peg$c9;
1670
+ peg$currPos++;
1671
+ } else {
1672
+ s4 = peg$FAILED;
1673
+ if (peg$silentFails === 0) {
1674
+ peg$fail(peg$e9);
1675
+ }
1676
+ }
1677
+ if (s4 === peg$FAILED) {
1678
+ if (input.charCodeAt(peg$currPos) === 59) {
1679
+ s4 = peg$c5;
1680
+ peg$currPos++;
1681
+ } else {
1682
+ s4 = peg$FAILED;
1683
+ if (peg$silentFails === 0) {
1684
+ peg$fail(peg$e5);
1685
+ }
1686
+ }
1687
+ }
1688
+ if (s4 === peg$FAILED) {
1689
+ s4 = null;
1690
+ }
1691
+ s5 = peg$parse__();
1692
+ if (input.charCodeAt(peg$currPos) === 125) {
1693
+ s6 = peg$c4;
1694
+ peg$currPos++;
1695
+ } else {
1696
+ s6 = peg$FAILED;
1697
+ if (peg$silentFails === 0) {
1698
+ peg$fail(peg$e4);
1699
+ }
1700
+ }
1701
+ if (s6 !== peg$FAILED) {
1702
+ peg$savedPos = s0;
1703
+ s0 = peg$f20(s2, s3);
1704
+ } else {
1705
+ peg$currPos = s0;
1706
+ s0 = peg$FAILED;
1707
+ }
1708
+ } else {
1709
+ peg$currPos = s0;
1710
+ s0 = peg$FAILED;
1711
+ }
1712
+ } else {
1713
+ peg$currPos = s0;
1714
+ s0 = peg$FAILED;
1715
+ }
1716
+ return s0;
1717
+ }
1718
+ function peg$parse_edge_target() {
1719
+ var s0;
1720
+ s0 = peg$parse_edge_target_group();
1721
+ if (s0 === peg$FAILED) {
1722
+ s0 = peg$parseNodeRef();
1723
+ }
1724
+ return s0;
1725
+ }
1726
+ function peg$parse_edge_operator() {
1727
+ var s0, s1;
1728
+ s0 = peg$currPos;
1729
+ if (input.substr(peg$currPos, 2) === peg$c12) {
1730
+ s1 = peg$c12;
1731
+ peg$currPos += 2;
1732
+ } else {
1733
+ s1 = peg$FAILED;
1734
+ if (peg$silentFails === 0) {
1735
+ peg$fail(peg$e12);
1736
+ }
1737
+ }
1738
+ if (s1 === peg$FAILED) {
1739
+ if (input.substr(peg$currPos, 2) === peg$c13) {
1740
+ s1 = peg$c13;
1741
+ peg$currPos += 2;
1742
+ } else {
1743
+ s1 = peg$FAILED;
1744
+ if (peg$silentFails === 0) {
1745
+ peg$fail(peg$e13);
1746
+ }
1747
+ }
1748
+ }
1749
+ if (s1 !== peg$FAILED) {
1750
+ peg$savedPos = s0;
1751
+ s1 = peg$f21(s1);
1752
+ }
1753
+ s0 = s1;
1754
+ return s0;
1755
+ }
1756
+ function peg$parse_edge_rhs() {
1757
+ var s0, s2, s4, s6;
1758
+ s0 = peg$currPos;
1759
+ peg$parse_();
1760
+ s2 = peg$parse_edge_operator();
1761
+ if (s2 !== peg$FAILED) {
1762
+ peg$parse_();
1763
+ s4 = peg$parse_edge_target();
1764
+ if (s4 !== peg$FAILED) {
1765
+ peg$parse_();
1766
+ s6 = peg$parse_edge_rhs();
1767
+ if (s6 === peg$FAILED) {
1768
+ s6 = null;
1769
+ }
1770
+ peg$savedPos = s0;
1771
+ s0 = peg$f22(s2, s4, s6);
1772
+ } else {
1773
+ peg$currPos = s0;
1774
+ s0 = peg$FAILED;
1775
+ }
1776
+ } else {
1777
+ peg$currPos = s0;
1778
+ s0 = peg$FAILED;
1779
+ }
1780
+ return s0;
1781
+ }
1782
+ function peg$parse_node_ref() {
1783
+ var s0, s1, s2;
1784
+ s0 = peg$currPos;
1785
+ s1 = peg$parse_literal();
1786
+ if (s1 !== peg$FAILED) {
1787
+ s2 = peg$parse_port();
1788
+ if (s2 === peg$FAILED) {
1789
+ s2 = null;
1790
+ }
1791
+ peg$savedPos = s0;
1792
+ s0 = peg$f23(s1, s2);
1793
+ } else {
1794
+ peg$currPos = s0;
1795
+ s0 = peg$FAILED;
1796
+ }
1797
+ return s0;
1798
+ }
1799
+ function peg$parse_port() {
1800
+ var s0, s1, s2, s3, s4, s5;
1801
+ peg$silentFails++;
1802
+ s0 = peg$currPos;
1803
+ if (input.charCodeAt(peg$currPos) === 58) {
1804
+ s1 = peg$c14;
1805
+ peg$currPos++;
1806
+ } else {
1807
+ s1 = peg$FAILED;
1808
+ if (peg$silentFails === 0) {
1809
+ peg$fail(peg$e15);
1810
+ }
1811
+ }
1812
+ if (s1 !== peg$FAILED) {
1813
+ s2 = peg$parse_literal();
1814
+ if (s2 !== peg$FAILED) {
1815
+ s3 = peg$currPos;
1816
+ if (input.charCodeAt(peg$currPos) === 58) {
1817
+ s4 = peg$c14;
1818
+ peg$currPos++;
1819
+ } else {
1820
+ s4 = peg$FAILED;
1821
+ if (peg$silentFails === 0) {
1822
+ peg$fail(peg$e15);
1823
+ }
1824
+ }
1825
+ if (s4 !== peg$FAILED) {
1826
+ s5 = peg$parse_compass();
1827
+ if (s5 !== peg$FAILED) {
1828
+ peg$savedPos = s3;
1829
+ s3 = peg$f24(s2, s5);
1830
+ } else {
1831
+ peg$currPos = s3;
1832
+ s3 = peg$FAILED;
1833
+ }
1834
+ } else {
1835
+ peg$currPos = s3;
1836
+ s3 = peg$FAILED;
1837
+ }
1838
+ if (s3 === peg$FAILED) {
1839
+ s3 = null;
1840
+ }
1841
+ peg$savedPos = s0;
1842
+ s0 = peg$f25(s2, s3);
1843
+ } else {
1844
+ peg$currPos = s0;
1845
+ s0 = peg$FAILED;
1846
+ }
1847
+ } else {
1848
+ peg$currPos = s0;
1849
+ s0 = peg$FAILED;
1850
+ }
1851
+ peg$silentFails--;
1852
+ if (s0 === peg$FAILED) {
1853
+ s1 = peg$FAILED;
1854
+ if (peg$silentFails === 0) {
1855
+ peg$fail(peg$e14);
1856
+ }
1857
+ }
1858
+ return s0;
1859
+ }
1860
+ function peg$parse_subgraph_id() {
1861
+ var s0, s1, s3;
1862
+ s0 = peg$currPos;
1863
+ if (input.substr(peg$currPos, 8).toLowerCase() === peg$c15) {
1864
+ s1 = input.substr(peg$currPos, 8);
1865
+ peg$currPos += 8;
1866
+ } else {
1867
+ s1 = peg$FAILED;
1868
+ if (peg$silentFails === 0) {
1869
+ peg$fail(peg$e16);
1870
+ }
1871
+ }
1872
+ if (s1 !== peg$FAILED) {
1873
+ peg$parse_();
1874
+ s3 = peg$parse_literal();
1875
+ if (s3 === peg$FAILED) {
1876
+ s3 = null;
1877
+ }
1878
+ peg$parse_();
1879
+ peg$savedPos = s0;
1880
+ s0 = peg$f26(s3);
1881
+ } else {
1882
+ peg$currPos = s0;
1883
+ s0 = peg$FAILED;
1884
+ }
1885
+ return s0;
1886
+ }
1887
+ function peg$parse_subgraph() {
1888
+ var s0, s1, s2, s3, s5;
1889
+ s0 = peg$currPos;
1890
+ s1 = peg$parse_subgraph_id();
1891
+ if (s1 === peg$FAILED) {
1892
+ s1 = null;
1893
+ }
1894
+ if (input.charCodeAt(peg$currPos) === 123) {
1895
+ s2 = peg$c3;
1896
+ peg$currPos++;
1897
+ } else {
1898
+ s2 = peg$FAILED;
1899
+ if (peg$silentFails === 0) {
1900
+ peg$fail(peg$e3);
1901
+ }
1902
+ }
1903
+ if (s2 !== peg$FAILED) {
1904
+ s3 = peg$parseClusterStatements();
1905
+ if (s3 === peg$FAILED) {
1906
+ s3 = null;
1907
+ }
1908
+ peg$parse__();
1909
+ if (input.charCodeAt(peg$currPos) === 125) {
1910
+ s5 = peg$c4;
1911
+ peg$currPos++;
1912
+ } else {
1913
+ s5 = peg$FAILED;
1914
+ if (peg$silentFails === 0) {
1915
+ peg$fail(peg$e4);
1916
+ }
1917
+ }
1918
+ if (s5 !== peg$FAILED) {
1919
+ peg$savedPos = s0;
1920
+ s0 = peg$f27(s1, s3);
1921
+ } else {
1922
+ peg$currPos = s0;
1923
+ s0 = peg$FAILED;
1924
+ }
1925
+ } else {
1926
+ peg$currPos = s0;
1927
+ s0 = peg$FAILED;
1928
+ }
1929
+ return s0;
1930
+ }
1931
+ function peg$parse_compass_keyword() {
1932
+ var s0;
1933
+ if (input.charCodeAt(peg$currPos) === 110) {
1934
+ s0 = peg$c16;
1935
+ peg$currPos++;
1936
+ } else {
1937
+ s0 = peg$FAILED;
1938
+ if (peg$silentFails === 0) {
1939
+ peg$fail(peg$e17);
1940
+ }
1941
+ }
1942
+ if (s0 === peg$FAILED) {
1943
+ if (input.substr(peg$currPos, 2) === peg$c17) {
1944
+ s0 = peg$c17;
1945
+ peg$currPos += 2;
1946
+ } else {
1947
+ s0 = peg$FAILED;
1948
+ if (peg$silentFails === 0) {
1949
+ peg$fail(peg$e18);
1950
+ }
1951
+ }
1952
+ if (s0 === peg$FAILED) {
1953
+ if (input.charCodeAt(peg$currPos) === 101) {
1954
+ s0 = peg$c18;
1955
+ peg$currPos++;
1956
+ } else {
1957
+ s0 = peg$FAILED;
1958
+ if (peg$silentFails === 0) {
1959
+ peg$fail(peg$e19);
1960
+ }
1961
+ }
1962
+ if (s0 === peg$FAILED) {
1963
+ if (input.substr(peg$currPos, 2) === peg$c19) {
1964
+ s0 = peg$c19;
1965
+ peg$currPos += 2;
1966
+ } else {
1967
+ s0 = peg$FAILED;
1968
+ if (peg$silentFails === 0) {
1969
+ peg$fail(peg$e20);
1970
+ }
1971
+ }
1972
+ if (s0 === peg$FAILED) {
1973
+ if (input.charCodeAt(peg$currPos) === 115) {
1974
+ s0 = peg$c20;
1975
+ peg$currPos++;
1976
+ } else {
1977
+ s0 = peg$FAILED;
1978
+ if (peg$silentFails === 0) {
1979
+ peg$fail(peg$e21);
1980
+ }
1981
+ }
1982
+ if (s0 === peg$FAILED) {
1983
+ if (input.substr(peg$currPos, 2) === peg$c21) {
1984
+ s0 = peg$c21;
1985
+ peg$currPos += 2;
1986
+ } else {
1987
+ s0 = peg$FAILED;
1988
+ if (peg$silentFails === 0) {
1989
+ peg$fail(peg$e22);
1990
+ }
1991
+ }
1992
+ if (s0 === peg$FAILED) {
1993
+ if (input.charCodeAt(peg$currPos) === 119) {
1994
+ s0 = peg$c22;
1995
+ peg$currPos++;
1996
+ } else {
1997
+ s0 = peg$FAILED;
1998
+ if (peg$silentFails === 0) {
1999
+ peg$fail(peg$e23);
2000
+ }
2001
+ }
2002
+ if (s0 === peg$FAILED) {
2003
+ if (input.substr(peg$currPos, 2) === peg$c23) {
2004
+ s0 = peg$c23;
2005
+ peg$currPos += 2;
2006
+ } else {
2007
+ s0 = peg$FAILED;
2008
+ if (peg$silentFails === 0) {
2009
+ peg$fail(peg$e24);
2010
+ }
2011
+ }
2012
+ }
2013
+ }
2014
+ }
2015
+ }
2016
+ }
2017
+ }
2018
+ }
2019
+ return s0;
2020
+ }
2021
+ function peg$parse_compass() {
2022
+ var s0, s1, s2, s3, s4;
2023
+ s0 = peg$currPos;
2024
+ s1 = peg$currPos;
2025
+ s2 = peg$parse_compass_keyword();
2026
+ if (s2 !== peg$FAILED) {
2027
+ peg$savedPos = s1;
2028
+ s2 = peg$f28(s2);
2029
+ }
2030
+ s1 = s2;
2031
+ if (s1 === peg$FAILED) {
2032
+ s1 = peg$currPos;
2033
+ if (input.charCodeAt(peg$currPos) === 34) {
2034
+ s2 = peg$c24;
2035
+ peg$currPos++;
2036
+ } else {
2037
+ s2 = peg$FAILED;
2038
+ if (peg$silentFails === 0) {
2039
+ peg$fail(peg$e25);
2040
+ }
2041
+ }
2042
+ if (s2 !== peg$FAILED) {
2043
+ s3 = peg$parse_compass_keyword();
2044
+ if (s3 !== peg$FAILED) {
2045
+ if (input.charCodeAt(peg$currPos) === 34) {
2046
+ s4 = peg$c24;
2047
+ peg$currPos++;
2048
+ } else {
2049
+ s4 = peg$FAILED;
2050
+ if (peg$silentFails === 0) {
2051
+ peg$fail(peg$e25);
2052
+ }
2053
+ }
2054
+ if (s4 !== peg$FAILED) {
2055
+ peg$savedPos = s1;
2056
+ s1 = peg$f29(s3);
2057
+ } else {
2058
+ peg$currPos = s1;
2059
+ s1 = peg$FAILED;
2060
+ }
2061
+ } else {
2062
+ peg$currPos = s1;
2063
+ s1 = peg$FAILED;
2064
+ }
2065
+ } else {
2066
+ peg$currPos = s1;
2067
+ s1 = peg$FAILED;
2068
+ }
2069
+ }
2070
+ if (s1 !== peg$FAILED) {
2071
+ peg$savedPos = s0;
2072
+ s1 = peg$f30(s1);
2073
+ }
2074
+ s0 = s1;
2075
+ return s0;
2076
+ }
2077
+ function peg$parse_literal() {
2078
+ var s0, s1;
2079
+ s0 = peg$parseQUOTED_STRING();
2080
+ if (s0 === peg$FAILED) {
2081
+ s0 = peg$parseHTML_STRING();
2082
+ if (s0 === peg$FAILED) {
2083
+ s0 = peg$currPos;
2084
+ s1 = peg$parseSTRING();
2085
+ if (s1 === peg$FAILED) {
2086
+ s1 = peg$parseNUMBER_STRING();
2087
+ if (s1 === peg$FAILED) {
2088
+ s1 = peg$parseNUMBER();
2089
+ }
2090
+ }
2091
+ if (s1 !== peg$FAILED) {
2092
+ peg$savedPos = s0;
2093
+ s1 = peg$f31(s1);
2094
+ }
2095
+ s0 = s1;
2096
+ }
2097
+ }
2098
+ return s0;
2099
+ }
2100
+ function peg$parse_comment() {
2101
+ var s0;
2102
+ s0 = peg$parse_block_comment();
2103
+ if (s0 === peg$FAILED) {
2104
+ s0 = peg$parse_slash_comment();
2105
+ if (s0 === peg$FAILED) {
2106
+ s0 = peg$parse_macro_comment();
2107
+ }
2108
+ }
2109
+ return s0;
2110
+ }
2111
+ function peg$parse_block_comment() {
2112
+ var s0, s1, s2, s3, s4, s5;
2113
+ s0 = peg$currPos;
2114
+ if (input.substr(peg$currPos, 2) === peg$c25) {
2115
+ s1 = peg$c25;
2116
+ peg$currPos += 2;
2117
+ } else {
2118
+ s1 = peg$FAILED;
2119
+ if (peg$silentFails === 0) {
2120
+ peg$fail(peg$e26);
2121
+ }
2122
+ }
2123
+ if (s1 !== peg$FAILED) {
2124
+ s2 = [];
2125
+ s3 = peg$currPos;
2126
+ s4 = peg$currPos;
2127
+ peg$silentFails++;
2128
+ if (input.substr(peg$currPos, 2) === peg$c26) {
2129
+ s5 = peg$c26;
2130
+ peg$currPos += 2;
2131
+ } else {
2132
+ s5 = peg$FAILED;
2133
+ if (peg$silentFails === 0) {
2134
+ peg$fail(peg$e27);
2135
+ }
2136
+ }
2137
+ peg$silentFails--;
2138
+ if (s5 === peg$FAILED) {
2139
+ s4 = void 0;
2140
+ } else {
2141
+ peg$currPos = s4;
2142
+ s4 = peg$FAILED;
2143
+ }
2144
+ if (s4 !== peg$FAILED) {
2145
+ if (input.length > peg$currPos) {
2146
+ s5 = input.charAt(peg$currPos);
2147
+ peg$currPos++;
2148
+ } else {
2149
+ s5 = peg$FAILED;
2150
+ if (peg$silentFails === 0) {
2151
+ peg$fail(peg$e28);
2152
+ }
2153
+ }
2154
+ if (s5 !== peg$FAILED) {
2155
+ peg$savedPos = s3;
2156
+ s3 = peg$f32(s5);
2157
+ } else {
2158
+ peg$currPos = s3;
2159
+ s3 = peg$FAILED;
2160
+ }
2161
+ } else {
2162
+ peg$currPos = s3;
2163
+ s3 = peg$FAILED;
2164
+ }
2165
+ while (s3 !== peg$FAILED) {
2166
+ s2.push(s3);
2167
+ s3 = peg$currPos;
2168
+ s4 = peg$currPos;
2169
+ peg$silentFails++;
2170
+ if (input.substr(peg$currPos, 2) === peg$c26) {
2171
+ s5 = peg$c26;
2172
+ peg$currPos += 2;
2173
+ } else {
2174
+ s5 = peg$FAILED;
2175
+ if (peg$silentFails === 0) {
2176
+ peg$fail(peg$e27);
2177
+ }
2178
+ }
2179
+ peg$silentFails--;
2180
+ if (s5 === peg$FAILED) {
2181
+ s4 = void 0;
2182
+ } else {
2183
+ peg$currPos = s4;
2184
+ s4 = peg$FAILED;
2185
+ }
2186
+ if (s4 !== peg$FAILED) {
2187
+ if (input.length > peg$currPos) {
2188
+ s5 = input.charAt(peg$currPos);
2189
+ peg$currPos++;
2190
+ } else {
2191
+ s5 = peg$FAILED;
2192
+ if (peg$silentFails === 0) {
2193
+ peg$fail(peg$e28);
2194
+ }
2195
+ }
2196
+ if (s5 !== peg$FAILED) {
2197
+ peg$savedPos = s3;
2198
+ s3 = peg$f32(s5);
2199
+ } else {
2200
+ peg$currPos = s3;
2201
+ s3 = peg$FAILED;
2202
+ }
2203
+ } else {
2204
+ peg$currPos = s3;
2205
+ s3 = peg$FAILED;
2206
+ }
2207
+ }
2208
+ if (input.substr(peg$currPos, 2) === peg$c26) {
2209
+ s3 = peg$c26;
2210
+ peg$currPos += 2;
2211
+ } else {
2212
+ s3 = peg$FAILED;
2213
+ if (peg$silentFails === 0) {
2214
+ peg$fail(peg$e27);
2215
+ }
2216
+ }
2217
+ if (s3 !== peg$FAILED) {
2218
+ peg$savedPos = s0;
2219
+ s0 = peg$f33(s2);
2220
+ } else {
2221
+ peg$currPos = s0;
2222
+ s0 = peg$FAILED;
2223
+ }
2224
+ } else {
2225
+ peg$currPos = s0;
2226
+ s0 = peg$FAILED;
2227
+ }
2228
+ return s0;
2229
+ }
2230
+ function peg$parse_slash_comment() {
2231
+ var s0, s1, s2;
2232
+ s0 = peg$currPos;
2233
+ s1 = [];
2234
+ s2 = peg$parse_slash_comment_line();
2235
+ if (s2 !== peg$FAILED) {
2236
+ while (s2 !== peg$FAILED) {
2237
+ s1.push(s2);
2238
+ s2 = peg$parse_slash_comment_line();
2239
+ }
2240
+ } else {
2241
+ s1 = peg$FAILED;
2242
+ }
2243
+ if (s1 !== peg$FAILED) {
2244
+ peg$savedPos = s0;
2245
+ s1 = peg$f34(s1);
2246
+ }
2247
+ s0 = s1;
2248
+ return s0;
2249
+ }
2250
+ function peg$parse_slash_comment_line() {
2251
+ var s0, s2, s3, s4, s5, s6;
2252
+ s0 = peg$currPos;
2253
+ peg$parse_();
2254
+ if (input.substr(peg$currPos, 2) === peg$c27) {
2255
+ s2 = peg$c27;
2256
+ peg$currPos += 2;
2257
+ } else {
2258
+ s2 = peg$FAILED;
2259
+ if (peg$silentFails === 0) {
2260
+ peg$fail(peg$e29);
2261
+ }
2262
+ }
2263
+ if (s2 !== peg$FAILED) {
2264
+ s3 = [];
2265
+ s4 = peg$currPos;
2266
+ s5 = peg$currPos;
2267
+ peg$silentFails++;
2268
+ s6 = peg$parse_newline();
2269
+ peg$silentFails--;
2270
+ if (s6 === peg$FAILED) {
2271
+ s5 = void 0;
2272
+ } else {
2273
+ peg$currPos = s5;
2274
+ s5 = peg$FAILED;
2275
+ }
2276
+ if (s5 !== peg$FAILED) {
2277
+ if (input.length > peg$currPos) {
2278
+ s6 = input.charAt(peg$currPos);
2279
+ peg$currPos++;
2280
+ } else {
2281
+ s6 = peg$FAILED;
2282
+ if (peg$silentFails === 0) {
2283
+ peg$fail(peg$e28);
2284
+ }
2285
+ }
2286
+ if (s6 !== peg$FAILED) {
2287
+ peg$savedPos = s4;
2288
+ s4 = peg$f35(s6);
2289
+ } else {
2290
+ peg$currPos = s4;
2291
+ s4 = peg$FAILED;
2292
+ }
2293
+ } else {
2294
+ peg$currPos = s4;
2295
+ s4 = peg$FAILED;
2296
+ }
2297
+ while (s4 !== peg$FAILED) {
2298
+ s3.push(s4);
2299
+ s4 = peg$currPos;
2300
+ s5 = peg$currPos;
2301
+ peg$silentFails++;
2302
+ s6 = peg$parse_newline();
2303
+ peg$silentFails--;
2304
+ if (s6 === peg$FAILED) {
2305
+ s5 = void 0;
2306
+ } else {
2307
+ peg$currPos = s5;
2308
+ s5 = peg$FAILED;
2309
+ }
2310
+ if (s5 !== peg$FAILED) {
2311
+ if (input.length > peg$currPos) {
2312
+ s6 = input.charAt(peg$currPos);
2313
+ peg$currPos++;
2314
+ } else {
2315
+ s6 = peg$FAILED;
2316
+ if (peg$silentFails === 0) {
2317
+ peg$fail(peg$e28);
2318
+ }
2319
+ }
2320
+ if (s6 !== peg$FAILED) {
2321
+ peg$savedPos = s4;
2322
+ s4 = peg$f35(s6);
2323
+ } else {
2324
+ peg$currPos = s4;
2325
+ s4 = peg$FAILED;
2326
+ }
2327
+ } else {
2328
+ peg$currPos = s4;
2329
+ s4 = peg$FAILED;
2330
+ }
2331
+ }
2332
+ s4 = peg$parse_newline();
2333
+ if (s4 === peg$FAILED) {
2334
+ s4 = null;
2335
+ }
2336
+ peg$savedPos = s0;
2337
+ s0 = peg$f36(s3);
2338
+ } else {
2339
+ peg$currPos = s0;
2340
+ s0 = peg$FAILED;
2341
+ }
2342
+ return s0;
2343
+ }
2344
+ function peg$parse_macro_comment() {
2345
+ var s0, s1, s2;
2346
+ s0 = peg$currPos;
2347
+ s1 = [];
2348
+ s2 = peg$parse_macro_comment_line();
2349
+ if (s2 !== peg$FAILED) {
2350
+ while (s2 !== peg$FAILED) {
2351
+ s1.push(s2);
2352
+ s2 = peg$parse_macro_comment_line();
2353
+ }
2354
+ } else {
2355
+ s1 = peg$FAILED;
2356
+ }
2357
+ if (s1 !== peg$FAILED) {
2358
+ peg$savedPos = s0;
2359
+ s1 = peg$f37(s1);
2360
+ }
2361
+ s0 = s1;
2362
+ return s0;
2363
+ }
2364
+ function peg$parse_macro_comment_line() {
2365
+ var s0, s2, s3, s4, s5, s6;
2366
+ s0 = peg$currPos;
2367
+ peg$parse_();
2368
+ if (input.charCodeAt(peg$currPos) === 35) {
2369
+ s2 = peg$c28;
2370
+ peg$currPos++;
2371
+ } else {
2372
+ s2 = peg$FAILED;
2373
+ if (peg$silentFails === 0) {
2374
+ peg$fail(peg$e30);
2375
+ }
2376
+ }
2377
+ if (s2 !== peg$FAILED) {
2378
+ s3 = [];
2379
+ s4 = peg$currPos;
2380
+ s5 = peg$currPos;
2381
+ peg$silentFails++;
2382
+ s6 = peg$parse_newline();
2383
+ peg$silentFails--;
2384
+ if (s6 === peg$FAILED) {
2385
+ s5 = void 0;
2386
+ } else {
2387
+ peg$currPos = s5;
2388
+ s5 = peg$FAILED;
2389
+ }
2390
+ if (s5 !== peg$FAILED) {
2391
+ if (input.length > peg$currPos) {
2392
+ s6 = input.charAt(peg$currPos);
2393
+ peg$currPos++;
2394
+ } else {
2395
+ s6 = peg$FAILED;
2396
+ if (peg$silentFails === 0) {
2397
+ peg$fail(peg$e28);
2398
+ }
2399
+ }
2400
+ if (s6 !== peg$FAILED) {
2401
+ peg$savedPos = s4;
2402
+ s4 = peg$f38(s6);
2403
+ } else {
2404
+ peg$currPos = s4;
2405
+ s4 = peg$FAILED;
2406
+ }
2407
+ } else {
2408
+ peg$currPos = s4;
2409
+ s4 = peg$FAILED;
2410
+ }
2411
+ while (s4 !== peg$FAILED) {
2412
+ s3.push(s4);
2413
+ s4 = peg$currPos;
2414
+ s5 = peg$currPos;
2415
+ peg$silentFails++;
2416
+ s6 = peg$parse_newline();
2417
+ peg$silentFails--;
2418
+ if (s6 === peg$FAILED) {
2419
+ s5 = void 0;
2420
+ } else {
2421
+ peg$currPos = s5;
2422
+ s5 = peg$FAILED;
2423
+ }
2424
+ if (s5 !== peg$FAILED) {
2425
+ if (input.length > peg$currPos) {
2426
+ s6 = input.charAt(peg$currPos);
2427
+ peg$currPos++;
2428
+ } else {
2429
+ s6 = peg$FAILED;
2430
+ if (peg$silentFails === 0) {
2431
+ peg$fail(peg$e28);
2432
+ }
2433
+ }
2434
+ if (s6 !== peg$FAILED) {
2435
+ peg$savedPos = s4;
2436
+ s4 = peg$f38(s6);
2437
+ } else {
2438
+ peg$currPos = s4;
2439
+ s4 = peg$FAILED;
2440
+ }
2441
+ } else {
2442
+ peg$currPos = s4;
2443
+ s4 = peg$FAILED;
2444
+ }
2445
+ }
2446
+ s4 = peg$parse_newline();
2447
+ if (s4 === peg$FAILED) {
2448
+ s4 = null;
2449
+ }
2450
+ peg$savedPos = s0;
2451
+ s0 = peg$f39(s3);
2452
+ } else {
2453
+ peg$currPos = s0;
2454
+ s0 = peg$FAILED;
2455
+ }
2456
+ return s0;
2457
+ }
2458
+ function peg$parseSTRING() {
2459
+ var s0, s1, s2, s3;
2460
+ peg$silentFails++;
2461
+ s0 = peg$currPos;
2462
+ s1 = peg$parseStringStart();
2463
+ if (s1 !== peg$FAILED) {
2464
+ s2 = [];
2465
+ s3 = peg$parseStringPart();
2466
+ while (s3 !== peg$FAILED) {
2467
+ s2.push(s3);
2468
+ s3 = peg$parseStringPart();
2469
+ }
2470
+ peg$savedPos = s0;
2471
+ s0 = peg$f40(s1, s2);
2472
+ } else {
2473
+ peg$currPos = s0;
2474
+ s0 = peg$FAILED;
2475
+ }
2476
+ peg$silentFails--;
2477
+ if (s0 === peg$FAILED) {
2478
+ s1 = peg$FAILED;
2479
+ if (peg$silentFails === 0) {
2480
+ peg$fail(peg$e31);
2481
+ }
2482
+ }
2483
+ return s0;
2484
+ }
2485
+ function peg$parseNUMBER_STRING() {
2486
+ var s0, s1, s2;
2487
+ s0 = peg$currPos;
2488
+ s1 = peg$parseNUMBER();
2489
+ if (s1 !== peg$FAILED) {
2490
+ s2 = peg$parseSTRING();
2491
+ if (s2 !== peg$FAILED) {
2492
+ peg$savedPos = s0;
2493
+ s0 = peg$f41(s1, s2);
2494
+ } else {
2495
+ peg$currPos = s0;
2496
+ s0 = peg$FAILED;
2497
+ }
2498
+ } else {
2499
+ peg$currPos = s0;
2500
+ s0 = peg$FAILED;
2501
+ }
2502
+ return s0;
2503
+ }
2504
+ function peg$parseStringStart() {
2505
+ var s0;
2506
+ s0 = peg$parseUnicodeLetter();
2507
+ if (s0 === peg$FAILED) {
2508
+ if (input.charCodeAt(peg$currPos) === 36) {
2509
+ s0 = peg$c29;
2510
+ peg$currPos++;
2511
+ } else {
2512
+ s0 = peg$FAILED;
2513
+ if (peg$silentFails === 0) {
2514
+ peg$fail(peg$e32);
2515
+ }
2516
+ }
2517
+ if (s0 === peg$FAILED) {
2518
+ if (input.charCodeAt(peg$currPos) === 95) {
2519
+ s0 = peg$c30;
2520
+ peg$currPos++;
2521
+ } else {
2522
+ s0 = peg$FAILED;
2523
+ if (peg$silentFails === 0) {
2524
+ peg$fail(peg$e33);
2525
+ }
2526
+ }
2527
+ }
2528
+ }
2529
+ return s0;
2530
+ }
2531
+ function peg$parseStringPart() {
2532
+ var s0;
2533
+ s0 = peg$parseStringStart();
2534
+ if (s0 === peg$FAILED) {
2535
+ s0 = peg$parseNd();
2536
+ }
2537
+ return s0;
2538
+ }
2539
+ function peg$parseNUMBER() {
2540
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8;
2541
+ peg$silentFails++;
2542
+ s0 = peg$currPos;
2543
+ s1 = peg$currPos;
2544
+ if (input.charCodeAt(peg$currPos) === 45) {
2545
+ s2 = peg$c31;
2546
+ peg$currPos++;
2547
+ } else {
2548
+ s2 = peg$FAILED;
2549
+ if (peg$silentFails === 0) {
2550
+ peg$fail(peg$e35);
2551
+ }
2552
+ }
2553
+ if (s2 === peg$FAILED) {
2554
+ s2 = null;
2555
+ }
2556
+ s3 = peg$currPos;
2557
+ if (input.charCodeAt(peg$currPos) === 46) {
2558
+ s4 = peg$c32;
2559
+ peg$currPos++;
2560
+ } else {
2561
+ s4 = peg$FAILED;
2562
+ if (peg$silentFails === 0) {
2563
+ peg$fail(peg$e36);
2564
+ }
2565
+ }
2566
+ if (s4 !== peg$FAILED) {
2567
+ s5 = [];
2568
+ if (peg$r0.test(input.charAt(peg$currPos))) {
2569
+ s6 = input.charAt(peg$currPos);
2570
+ peg$currPos++;
2571
+ } else {
2572
+ s6 = peg$FAILED;
2573
+ if (peg$silentFails === 0) {
2574
+ peg$fail(peg$e37);
2575
+ }
2576
+ }
2577
+ if (s6 !== peg$FAILED) {
2578
+ while (s6 !== peg$FAILED) {
2579
+ s5.push(s6);
2580
+ if (peg$r0.test(input.charAt(peg$currPos))) {
2581
+ s6 = input.charAt(peg$currPos);
2582
+ peg$currPos++;
2583
+ } else {
2584
+ s6 = peg$FAILED;
2585
+ if (peg$silentFails === 0) {
2586
+ peg$fail(peg$e37);
2587
+ }
2588
+ }
2589
+ }
2590
+ } else {
2591
+ s5 = peg$FAILED;
2592
+ }
2593
+ if (s5 !== peg$FAILED) {
2594
+ s4 = [s4, s5];
2595
+ s3 = s4;
2596
+ } else {
2597
+ peg$currPos = s3;
2598
+ s3 = peg$FAILED;
2599
+ }
2600
+ } else {
2601
+ peg$currPos = s3;
2602
+ s3 = peg$FAILED;
2603
+ }
2604
+ if (s3 === peg$FAILED) {
2605
+ s3 = peg$currPos;
2606
+ s4 = [];
2607
+ if (peg$r0.test(input.charAt(peg$currPos))) {
2608
+ s5 = input.charAt(peg$currPos);
2609
+ peg$currPos++;
2610
+ } else {
2611
+ s5 = peg$FAILED;
2612
+ if (peg$silentFails === 0) {
2613
+ peg$fail(peg$e37);
2614
+ }
2615
+ }
2616
+ if (s5 !== peg$FAILED) {
2617
+ while (s5 !== peg$FAILED) {
2618
+ s4.push(s5);
2619
+ if (peg$r0.test(input.charAt(peg$currPos))) {
2620
+ s5 = input.charAt(peg$currPos);
2621
+ peg$currPos++;
2622
+ } else {
2623
+ s5 = peg$FAILED;
2624
+ if (peg$silentFails === 0) {
2625
+ peg$fail(peg$e37);
2626
+ }
2627
+ }
2628
+ }
2629
+ } else {
2630
+ s4 = peg$FAILED;
2631
+ }
2632
+ if (s4 !== peg$FAILED) {
2633
+ s5 = peg$currPos;
2634
+ if (input.charCodeAt(peg$currPos) === 46) {
2635
+ s6 = peg$c32;
2636
+ peg$currPos++;
2637
+ } else {
2638
+ s6 = peg$FAILED;
2639
+ if (peg$silentFails === 0) {
2640
+ peg$fail(peg$e36);
2641
+ }
2642
+ }
2643
+ if (s6 !== peg$FAILED) {
2644
+ s7 = [];
2645
+ if (peg$r0.test(input.charAt(peg$currPos))) {
2646
+ s8 = input.charAt(peg$currPos);
2647
+ peg$currPos++;
2648
+ } else {
2649
+ s8 = peg$FAILED;
2650
+ if (peg$silentFails === 0) {
2651
+ peg$fail(peg$e37);
2652
+ }
2653
+ }
2654
+ while (s8 !== peg$FAILED) {
2655
+ s7.push(s8);
2656
+ if (peg$r0.test(input.charAt(peg$currPos))) {
2657
+ s8 = input.charAt(peg$currPos);
2658
+ peg$currPos++;
2659
+ } else {
2660
+ s8 = peg$FAILED;
2661
+ if (peg$silentFails === 0) {
2662
+ peg$fail(peg$e37);
2663
+ }
2664
+ }
2665
+ }
2666
+ s6 = [s6, s7];
2667
+ s5 = s6;
2668
+ } else {
2669
+ peg$currPos = s5;
2670
+ s5 = peg$FAILED;
2671
+ }
2672
+ if (s5 === peg$FAILED) {
2673
+ s5 = null;
2674
+ }
2675
+ s4 = [s4, s5];
2676
+ s3 = s4;
2677
+ } else {
2678
+ peg$currPos = s3;
2679
+ s3 = peg$FAILED;
2680
+ }
2681
+ }
2682
+ if (s3 !== peg$FAILED) {
2683
+ s2 = [s2, s3];
2684
+ s1 = s2;
2685
+ } else {
2686
+ peg$currPos = s1;
2687
+ s1 = peg$FAILED;
2688
+ }
2689
+ if (s1 !== peg$FAILED) {
2690
+ peg$savedPos = s0;
2691
+ s1 = peg$f42();
2692
+ }
2693
+ s0 = s1;
2694
+ peg$silentFails--;
2695
+ if (s0 === peg$FAILED) {
2696
+ s1 = peg$FAILED;
2697
+ if (peg$silentFails === 0) {
2698
+ peg$fail(peg$e34);
2699
+ }
2700
+ }
2701
+ return s0;
2702
+ }
2703
+ function peg$parseHTML_STRING() {
2704
+ var s0, s1;
2705
+ s0 = peg$currPos;
2706
+ s1 = peg$parsehtml_raw_string();
2707
+ if (s1 !== peg$FAILED) {
2708
+ peg$savedPos = s0;
2709
+ s1 = peg$f43(s1);
2710
+ }
2711
+ s0 = s1;
2712
+ return s0;
2713
+ }
2714
+ function peg$parsehtml_raw_string() {
2715
+ var s0, s1, s2, s3;
2716
+ s0 = peg$currPos;
2717
+ if (input.charCodeAt(peg$currPos) === 60) {
2718
+ s1 = peg$c33;
2719
+ peg$currPos++;
2720
+ } else {
2721
+ s1 = peg$FAILED;
2722
+ if (peg$silentFails === 0) {
2723
+ peg$fail(peg$e38);
2724
+ }
2725
+ }
2726
+ if (s1 !== peg$FAILED) {
2727
+ s2 = [];
2728
+ s3 = peg$parsehtml_char();
2729
+ if (s3 === peg$FAILED) {
2730
+ s3 = peg$parsehtml_raw_string();
2731
+ }
2732
+ while (s3 !== peg$FAILED) {
2733
+ s2.push(s3);
2734
+ s3 = peg$parsehtml_char();
2735
+ if (s3 === peg$FAILED) {
2736
+ s3 = peg$parsehtml_raw_string();
2737
+ }
2738
+ }
2739
+ if (input.charCodeAt(peg$currPos) === 62) {
2740
+ s3 = peg$c34;
2741
+ peg$currPos++;
2742
+ } else {
2743
+ s3 = peg$FAILED;
2744
+ if (peg$silentFails === 0) {
2745
+ peg$fail(peg$e39);
2746
+ }
2747
+ }
2748
+ if (s3 !== peg$FAILED) {
2749
+ peg$savedPos = s0;
2750
+ s0 = peg$f44(s2);
2751
+ } else {
2752
+ peg$currPos = s0;
2753
+ s0 = peg$FAILED;
2754
+ }
2755
+ } else {
2756
+ peg$currPos = s0;
2757
+ s0 = peg$FAILED;
2758
+ }
2759
+ return s0;
2760
+ }
2761
+ function peg$parsehtml_char() {
2762
+ var s0, s1, s2, s3, s4;
2763
+ s0 = peg$currPos;
2764
+ s1 = [];
2765
+ s2 = peg$currPos;
2766
+ s3 = peg$currPos;
2767
+ peg$silentFails++;
2768
+ if (input.charCodeAt(peg$currPos) === 62) {
2769
+ s4 = peg$c34;
2770
+ peg$currPos++;
2771
+ } else {
2772
+ s4 = peg$FAILED;
2773
+ if (peg$silentFails === 0) {
2774
+ peg$fail(peg$e39);
2775
+ }
2776
+ }
2777
+ if (s4 === peg$FAILED) {
2778
+ if (input.charCodeAt(peg$currPos) === 60) {
2779
+ s4 = peg$c33;
2780
+ peg$currPos++;
2781
+ } else {
2782
+ s4 = peg$FAILED;
2783
+ if (peg$silentFails === 0) {
2784
+ peg$fail(peg$e38);
2785
+ }
2786
+ }
2787
+ }
2788
+ peg$silentFails--;
2789
+ if (s4 === peg$FAILED) {
2790
+ s3 = void 0;
2791
+ } else {
2792
+ peg$currPos = s3;
2793
+ s3 = peg$FAILED;
2794
+ }
2795
+ if (s3 !== peg$FAILED) {
2796
+ if (input.length > peg$currPos) {
2797
+ s4 = input.charAt(peg$currPos);
2798
+ peg$currPos++;
2799
+ } else {
2800
+ s4 = peg$FAILED;
2801
+ if (peg$silentFails === 0) {
2802
+ peg$fail(peg$e28);
2803
+ }
2804
+ }
2805
+ if (s4 !== peg$FAILED) {
2806
+ peg$savedPos = s2;
2807
+ s2 = peg$f45(s4);
2808
+ } else {
2809
+ peg$currPos = s2;
2810
+ s2 = peg$FAILED;
2811
+ }
2812
+ } else {
2813
+ peg$currPos = s2;
2814
+ s2 = peg$FAILED;
2815
+ }
2816
+ if (s2 !== peg$FAILED) {
2817
+ while (s2 !== peg$FAILED) {
2818
+ s1.push(s2);
2819
+ s2 = peg$currPos;
2820
+ s3 = peg$currPos;
2821
+ peg$silentFails++;
2822
+ if (input.charCodeAt(peg$currPos) === 62) {
2823
+ s4 = peg$c34;
2824
+ peg$currPos++;
2825
+ } else {
2826
+ s4 = peg$FAILED;
2827
+ if (peg$silentFails === 0) {
2828
+ peg$fail(peg$e39);
2829
+ }
2830
+ }
2831
+ if (s4 === peg$FAILED) {
2832
+ if (input.charCodeAt(peg$currPos) === 60) {
2833
+ s4 = peg$c33;
2834
+ peg$currPos++;
2835
+ } else {
2836
+ s4 = peg$FAILED;
2837
+ if (peg$silentFails === 0) {
2838
+ peg$fail(peg$e38);
2839
+ }
2840
+ }
2841
+ }
2842
+ peg$silentFails--;
2843
+ if (s4 === peg$FAILED) {
2844
+ s3 = void 0;
2845
+ } else {
2846
+ peg$currPos = s3;
2847
+ s3 = peg$FAILED;
2848
+ }
2849
+ if (s3 !== peg$FAILED) {
2850
+ if (input.length > peg$currPos) {
2851
+ s4 = input.charAt(peg$currPos);
2852
+ peg$currPos++;
2853
+ } else {
2854
+ s4 = peg$FAILED;
2855
+ if (peg$silentFails === 0) {
2856
+ peg$fail(peg$e28);
2857
+ }
2858
+ }
2859
+ if (s4 !== peg$FAILED) {
2860
+ peg$savedPos = s2;
2861
+ s2 = peg$f45(s4);
2862
+ } else {
2863
+ peg$currPos = s2;
2864
+ s2 = peg$FAILED;
2865
+ }
2866
+ } else {
2867
+ peg$currPos = s2;
2868
+ s2 = peg$FAILED;
2869
+ }
2870
+ }
2871
+ } else {
2872
+ s1 = peg$FAILED;
2873
+ }
2874
+ if (s1 !== peg$FAILED) {
2875
+ peg$savedPos = s0;
2876
+ s1 = peg$f46(s1);
2877
+ }
2878
+ s0 = s1;
2879
+ return s0;
2880
+ }
2881
+ function peg$parseQUOTED_STRING() {
2882
+ var s0, s1, s2, s3;
2883
+ s0 = peg$currPos;
2884
+ if (input.charCodeAt(peg$currPos) === 34) {
2885
+ s1 = peg$c24;
2886
+ peg$currPos++;
2887
+ } else {
2888
+ s1 = peg$FAILED;
2889
+ if (peg$silentFails === 0) {
2890
+ peg$fail(peg$e25);
2891
+ }
2892
+ }
2893
+ if (s1 !== peg$FAILED) {
2894
+ s2 = [];
2895
+ s3 = peg$parseDoubleStringCharacter();
2896
+ while (s3 !== peg$FAILED) {
2897
+ s2.push(s3);
2898
+ s3 = peg$parseDoubleStringCharacter();
2899
+ }
2900
+ if (input.charCodeAt(peg$currPos) === 34) {
2901
+ s3 = peg$c24;
2902
+ peg$currPos++;
2903
+ } else {
2904
+ s3 = peg$FAILED;
2905
+ if (peg$silentFails === 0) {
2906
+ peg$fail(peg$e25);
2907
+ }
2908
+ }
2909
+ if (s3 !== peg$FAILED) {
2910
+ peg$savedPos = s0;
2911
+ s0 = peg$f47(s2);
2912
+ } else {
2913
+ peg$currPos = s0;
2914
+ s0 = peg$FAILED;
2915
+ }
2916
+ } else {
2917
+ peg$currPos = s0;
2918
+ s0 = peg$FAILED;
2919
+ }
2920
+ return s0;
2921
+ }
2922
+ function peg$parseDoubleStringCharacter() {
2923
+ var s0, s1, s2;
2924
+ s0 = peg$parseQuoteEscape();
2925
+ if (s0 === peg$FAILED) {
2926
+ s0 = peg$currPos;
2927
+ s1 = peg$currPos;
2928
+ peg$silentFails++;
2929
+ if (input.charCodeAt(peg$currPos) === 34) {
2930
+ s2 = peg$c24;
2931
+ peg$currPos++;
2932
+ } else {
2933
+ s2 = peg$FAILED;
2934
+ if (peg$silentFails === 0) {
2935
+ peg$fail(peg$e25);
2936
+ }
2937
+ }
2938
+ if (s2 === peg$FAILED) {
2939
+ s2 = peg$parseLineTerminator();
2940
+ }
2941
+ peg$silentFails--;
2942
+ if (s2 === peg$FAILED) {
2943
+ s1 = void 0;
2944
+ } else {
2945
+ peg$currPos = s1;
2946
+ s1 = peg$FAILED;
2947
+ }
2948
+ if (s1 !== peg$FAILED) {
2949
+ s2 = peg$parseSourceCharacter();
2950
+ if (s2 !== peg$FAILED) {
2951
+ peg$savedPos = s0;
2952
+ s0 = peg$f48();
2953
+ } else {
2954
+ peg$currPos = s0;
2955
+ s0 = peg$FAILED;
2956
+ }
2957
+ } else {
2958
+ peg$currPos = s0;
2959
+ s0 = peg$FAILED;
2960
+ }
2961
+ if (s0 === peg$FAILED) {
2962
+ s0 = peg$parseLineContinuation();
2963
+ }
2964
+ }
2965
+ return s0;
2966
+ }
2967
+ function peg$parseQuoteEscape() {
2968
+ var s0, s1, s2, s3;
2969
+ s0 = peg$currPos;
2970
+ s1 = peg$currPos;
2971
+ if (input.charCodeAt(peg$currPos) === 92) {
2972
+ s2 = peg$c35;
2973
+ peg$currPos++;
2974
+ } else {
2975
+ s2 = peg$FAILED;
2976
+ if (peg$silentFails === 0) {
2977
+ peg$fail(peg$e40);
2978
+ }
2979
+ }
2980
+ if (s2 !== peg$FAILED) {
2981
+ if (input.length > peg$currPos) {
2982
+ s3 = input.charAt(peg$currPos);
2983
+ peg$currPos++;
2984
+ } else {
2985
+ s3 = peg$FAILED;
2986
+ if (peg$silentFails === 0) {
2987
+ peg$fail(peg$e28);
2988
+ }
2989
+ }
2990
+ if (s3 !== peg$FAILED) {
2991
+ s2 = [s2, s3];
2992
+ s1 = s2;
2993
+ } else {
2994
+ peg$currPos = s1;
2995
+ s1 = peg$FAILED;
2996
+ }
2997
+ } else {
2998
+ peg$currPos = s1;
2999
+ s1 = peg$FAILED;
3000
+ }
3001
+ if (s1 !== peg$FAILED) {
3002
+ peg$savedPos = s0;
3003
+ s1 = peg$f49(s1);
3004
+ }
3005
+ s0 = s1;
3006
+ return s0;
3007
+ }
3008
+ function peg$parseLineContinuation() {
3009
+ var s0, s1, s2;
3010
+ s0 = peg$currPos;
3011
+ if (input.charCodeAt(peg$currPos) === 92) {
3012
+ s1 = peg$c35;
3013
+ peg$currPos++;
3014
+ } else {
3015
+ s1 = peg$FAILED;
3016
+ if (peg$silentFails === 0) {
3017
+ peg$fail(peg$e40);
3018
+ }
3019
+ }
3020
+ if (s1 !== peg$FAILED) {
3021
+ s2 = peg$parseLineTerminatorSequence();
3022
+ if (s2 !== peg$FAILED) {
3023
+ peg$savedPos = s0;
3024
+ s0 = peg$f50();
3025
+ } else {
3026
+ peg$currPos = s0;
3027
+ s0 = peg$FAILED;
3028
+ }
3029
+ } else {
3030
+ peg$currPos = s0;
3031
+ s0 = peg$FAILED;
3032
+ }
3033
+ return s0;
3034
+ }
3035
+ function peg$parseLineTerminator() {
3036
+ var s0;
3037
+ if (peg$r1.test(input.charAt(peg$currPos))) {
3038
+ s0 = input.charAt(peg$currPos);
3039
+ peg$currPos++;
3040
+ } else {
3041
+ s0 = peg$FAILED;
3042
+ if (peg$silentFails === 0) {
3043
+ peg$fail(peg$e41);
3044
+ }
3045
+ }
3046
+ return s0;
3047
+ }
3048
+ function peg$parseLineTerminatorSequence() {
3049
+ var s0;
3050
+ peg$silentFails++;
3051
+ if (input.charCodeAt(peg$currPos) === 10) {
3052
+ s0 = peg$c36;
3053
+ peg$currPos++;
3054
+ } else {
3055
+ s0 = peg$FAILED;
3056
+ if (peg$silentFails === 0) {
3057
+ peg$fail(peg$e43);
3058
+ }
3059
+ }
3060
+ if (s0 === peg$FAILED) {
3061
+ if (input.substr(peg$currPos, 2) === peg$c37) {
3062
+ s0 = peg$c37;
3063
+ peg$currPos += 2;
3064
+ } else {
3065
+ s0 = peg$FAILED;
3066
+ if (peg$silentFails === 0) {
3067
+ peg$fail(peg$e44);
3068
+ }
3069
+ }
3070
+ if (s0 === peg$FAILED) {
3071
+ if (input.charCodeAt(peg$currPos) === 13) {
3072
+ s0 = peg$c38;
3073
+ peg$currPos++;
3074
+ } else {
3075
+ s0 = peg$FAILED;
3076
+ if (peg$silentFails === 0) {
3077
+ peg$fail(peg$e45);
3078
+ }
3079
+ }
3080
+ if (s0 === peg$FAILED) {
3081
+ if (input.charCodeAt(peg$currPos) === 8232) {
3082
+ s0 = peg$c39;
3083
+ peg$currPos++;
3084
+ } else {
3085
+ s0 = peg$FAILED;
3086
+ if (peg$silentFails === 0) {
3087
+ peg$fail(peg$e46);
3088
+ }
3089
+ }
3090
+ if (s0 === peg$FAILED) {
3091
+ if (input.charCodeAt(peg$currPos) === 8233) {
3092
+ s0 = peg$c40;
3093
+ peg$currPos++;
3094
+ } else {
3095
+ s0 = peg$FAILED;
3096
+ if (peg$silentFails === 0) {
3097
+ peg$fail(peg$e47);
3098
+ }
3099
+ }
3100
+ }
3101
+ }
3102
+ }
3103
+ }
3104
+ peg$silentFails--;
3105
+ if (s0 === peg$FAILED) {
3106
+ if (peg$silentFails === 0) {
3107
+ peg$fail(peg$e42);
3108
+ }
3109
+ }
3110
+ return s0;
3111
+ }
3112
+ function peg$parseSourceCharacter() {
3113
+ var s0;
3114
+ if (input.length > peg$currPos) {
3115
+ s0 = input.charAt(peg$currPos);
3116
+ peg$currPos++;
3117
+ } else {
3118
+ s0 = peg$FAILED;
3119
+ if (peg$silentFails === 0) {
3120
+ peg$fail(peg$e28);
3121
+ }
3122
+ }
3123
+ return s0;
3124
+ }
3125
+ function peg$parse_() {
3126
+ var s0, s1;
3127
+ peg$silentFails++;
3128
+ s0 = [];
3129
+ s1 = peg$parse_whitespace();
3130
+ while (s1 !== peg$FAILED) {
3131
+ s0.push(s1);
3132
+ s1 = peg$parse_whitespace();
3133
+ }
3134
+ peg$silentFails--;
3135
+ s1 = peg$FAILED;
3136
+ if (peg$silentFails === 0) {
3137
+ peg$fail(peg$e50);
3138
+ }
3139
+ return s0;
3140
+ }
3141
+ function peg$parse__() {
3142
+ var s0, s1;
3143
+ peg$silentFails++;
3144
+ s0 = [];
3145
+ s1 = peg$parse_whitespace();
3146
+ if (s1 === peg$FAILED) {
3147
+ s1 = peg$parse_newline();
3148
+ }
3149
+ while (s1 !== peg$FAILED) {
3150
+ s0.push(s1);
3151
+ s1 = peg$parse_whitespace();
3152
+ if (s1 === peg$FAILED) {
3153
+ s1 = peg$parse_newline();
3154
+ }
3155
+ }
3156
+ peg$silentFails--;
3157
+ s1 = peg$FAILED;
3158
+ if (peg$silentFails === 0) {
3159
+ peg$fail(peg$e51);
3160
+ }
3161
+ return s0;
3162
+ }
3163
+ function peg$parse_newline() {
3164
+ var s0;
3165
+ if (peg$r3.test(input.charAt(peg$currPos))) {
3166
+ s0 = input.charAt(peg$currPos);
3167
+ peg$currPos++;
3168
+ } else {
3169
+ s0 = peg$FAILED;
3170
+ if (peg$silentFails === 0) {
3171
+ peg$fail(peg$e52);
3172
+ }
3173
+ }
3174
+ return s0;
3175
+ }
3176
+ function peg$parse_whitespace() {
3177
+ var s0;
3178
+ if (peg$r4.test(input.charAt(peg$currPos))) {
3179
+ s0 = input.charAt(peg$currPos);
3180
+ peg$currPos++;
3181
+ } else {
3182
+ s0 = peg$FAILED;
3183
+ if (peg$silentFails === 0) {
3184
+ peg$fail(peg$e53);
3185
+ }
3186
+ }
3187
+ return s0;
3188
+ }
3189
+ function peg$parseUnicodeLetter() {
3190
+ var s0;
3191
+ s0 = peg$parseLu();
3192
+ if (s0 === peg$FAILED) {
3193
+ s0 = peg$parseLl();
3194
+ if (s0 === peg$FAILED) {
3195
+ s0 = peg$parseLt();
3196
+ if (s0 === peg$FAILED) {
3197
+ s0 = peg$parseLm();
3198
+ if (s0 === peg$FAILED) {
3199
+ s0 = peg$parseLo();
3200
+ if (s0 === peg$FAILED) {
3201
+ s0 = peg$parseNl();
3202
+ }
3203
+ }
3204
+ }
3205
+ }
3206
+ }
3207
+ return s0;
3208
+ }
3209
+ function peg$parseLl() {
3210
+ var s0;
3211
+ if (peg$r5.test(input.charAt(peg$currPos))) {
3212
+ s0 = input.charAt(peg$currPos);
3213
+ peg$currPos++;
3214
+ } else {
3215
+ s0 = peg$FAILED;
3216
+ if (peg$silentFails === 0) {
3217
+ peg$fail(peg$e54);
3218
+ }
3219
+ }
3220
+ return s0;
3221
+ }
3222
+ function peg$parseLm() {
3223
+ var s0;
3224
+ if (peg$r6.test(input.charAt(peg$currPos))) {
3225
+ s0 = input.charAt(peg$currPos);
3226
+ peg$currPos++;
3227
+ } else {
3228
+ s0 = peg$FAILED;
3229
+ if (peg$silentFails === 0) {
3230
+ peg$fail(peg$e55);
3231
+ }
3232
+ }
3233
+ return s0;
3234
+ }
3235
+ function peg$parseLo() {
3236
+ var s0;
3237
+ if (peg$r7.test(input.charAt(peg$currPos))) {
3238
+ s0 = input.charAt(peg$currPos);
3239
+ peg$currPos++;
3240
+ } else {
3241
+ s0 = peg$FAILED;
3242
+ if (peg$silentFails === 0) {
3243
+ peg$fail(peg$e56);
3244
+ }
3245
+ }
3246
+ return s0;
3247
+ }
3248
+ function peg$parseLt() {
3249
+ var s0;
3250
+ if (peg$r8.test(input.charAt(peg$currPos))) {
3251
+ s0 = input.charAt(peg$currPos);
3252
+ peg$currPos++;
3253
+ } else {
3254
+ s0 = peg$FAILED;
3255
+ if (peg$silentFails === 0) {
3256
+ peg$fail(peg$e57);
3257
+ }
3258
+ }
3259
+ return s0;
3260
+ }
3261
+ function peg$parseLu() {
3262
+ var s0;
3263
+ if (peg$r9.test(input.charAt(peg$currPos))) {
3264
+ s0 = input.charAt(peg$currPos);
3265
+ peg$currPos++;
3266
+ } else {
3267
+ s0 = peg$FAILED;
3268
+ if (peg$silentFails === 0) {
3269
+ peg$fail(peg$e58);
3270
+ }
3271
+ }
3272
+ return s0;
3273
+ }
3274
+ function peg$parseNl() {
3275
+ var s0;
3276
+ if (peg$r10.test(input.charAt(peg$currPos))) {
3277
+ s0 = input.charAt(peg$currPos);
3278
+ peg$currPos++;
3279
+ } else {
3280
+ s0 = peg$FAILED;
3281
+ if (peg$silentFails === 0) {
3282
+ peg$fail(peg$e59);
3283
+ }
3284
+ }
3285
+ return s0;
3286
+ }
3287
+ function peg$parseNd() {
3288
+ var s0;
3289
+ if (peg$r11.test(input.charAt(peg$currPos))) {
3290
+ s0 = input.charAt(peg$currPos);
3291
+ peg$currPos++;
3292
+ } else {
3293
+ s0 = peg$FAILED;
3294
+ if (peg$silentFails === 0) {
3295
+ peg$fail(peg$e60);
3296
+ }
3297
+ }
3298
+ return s0;
3299
+ }
3300
+ function dedent(value) {
3301
+ const str = value.trim();
3302
+ const matches = str.match(/\n([\t ]+|(?!\s).)/g);
3303
+ if (matches) {
3304
+ const indentLengths = matches.map((match) => {
3305
+ var _a;
3306
+ return ((_a = match.match(/[\t ]/g)) == null ? void 0 : _a.length) ?? 0;
3307
+ });
3308
+ const pattern = new RegExp(`
3309
+ [ ]{${Math.min(...indentLengths)}}`, "g");
3310
+ return str.replace(pattern, "\n");
3311
+ }
3312
+ return str;
3313
+ }
3314
+ const edgeops = [];
3315
+ const b = new Builder({
3316
+ // @ts-ignore
3317
+ locationFunction: location
3318
+ });
3319
+ peg$result = peg$startRuleFunction();
3320
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
3321
+ return peg$result;
3322
+ } else {
3323
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
3324
+ peg$fail(peg$endExpectation());
3325
+ }
3326
+ throw peg$buildStructuredError(
3327
+ // @ts-ignore
3328
+ peg$maxFailExpected,
3329
+ // @ts-ignore
3330
+ peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
3331
+ // @ts-ignore
3332
+ peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
3333
+ );
3334
+ }
3335
+ }
3336
+ return {
3337
+ SyntaxError: peg$SyntaxError,
3338
+ parse: peg$parse
3339
+ };
3340
+ }()
3341
+ );
3342
+ peggyParser.SyntaxError.prototype.name = "PeggySyntaxError";
3343
+ const parse$1 = peggyParser.parse;
3344
+ const PeggySyntaxError = peggyParser.SyntaxError;
3345
+ function parse(input, options) {
3346
+ try {
3347
+ return parse$1(input, options);
3348
+ } catch (e) {
3349
+ if (e instanceof PeggySyntaxError) {
3350
+ throw new DotSyntaxError(e.message, e.expected, e.found, e.location);
3351
+ }
3352
+ throw e;
3353
+ }
3354
+ }
3355
+ class DotSyntaxError extends PeggySyntaxError {
3356
+ constructor(...args) {
3357
+ super(...args);
3358
+ this.name = "DotSyntaxError";
3359
+ }
3360
+ }
3361
+ function convertAttribute(key, value) {
3362
+ if (typeof value === "string") {
3363
+ const trimmed = value.trim();
3364
+ const isHTMLLike = /^<.+>$/ms.test(trimmed);
3365
+ if (isHTMLLike) {
3366
+ return createElement(
3367
+ "Attribute",
3368
+ {
3369
+ key: createElement("Literal", { value: key, quoted: false }, []),
3370
+ value: createElement(
3371
+ "Literal",
3372
+ { value: trimmed.slice(1, trimmed.length - 1), quoted: "html" },
3373
+ []
3374
+ )
3375
+ },
3376
+ []
3377
+ );
3378
+ }
3379
+ return createElement(
3380
+ "Attribute",
3381
+ {
3382
+ key: createElement("Literal", { value: key, quoted: false }, []),
3383
+ value: createElement("Literal", { value, quoted: true }, [])
3384
+ },
3385
+ []
3386
+ );
3387
+ }
3388
+ return createElement(
3389
+ "Attribute",
3390
+ {
3391
+ key: createElement("Literal", { value: key, quoted: false }, []),
3392
+ value: createElement(
3393
+ "Literal",
3394
+ { value: String(value), quoted: false },
3395
+ []
3396
+ )
3397
+ },
3398
+ []
3399
+ );
3400
+ }
3401
+ function convertComment(value, kind) {
3402
+ return createElement(
3403
+ "Comment",
3404
+ {
3405
+ kind,
3406
+ value
3407
+ },
3408
+ []
3409
+ );
3410
+ }
3411
+ function convertClusterChildren(context, model) {
3412
+ return Array.from(
3413
+ function* () {
3414
+ for (const [key, value] of model.values) {
3415
+ yield convertAttribute(key, value);
3416
+ }
3417
+ for (const attrs of Object.values(model.attributes)) {
3418
+ if (attrs.size > 0) {
3419
+ if (attrs.comment) {
3420
+ yield convertComment(attrs.comment, context.commentKind);
3421
+ }
3422
+ yield context.convert(attrs);
3423
+ }
3424
+ }
3425
+ for (const node of model.nodes) {
3426
+ if (node.comment) {
3427
+ yield convertComment(node.comment, context.commentKind);
3428
+ }
3429
+ yield context.convert(node);
3430
+ }
3431
+ for (const subgraph of model.subgraphs) {
3432
+ if (subgraph.comment) {
3433
+ yield convertComment(subgraph.comment, context.commentKind);
3434
+ }
3435
+ yield context.convert(subgraph);
3436
+ }
3437
+ for (const edge of model.edges) {
3438
+ if (edge.comment) {
3439
+ yield convertComment(edge.comment, context.commentKind);
3440
+ }
3441
+ yield context.convert(edge);
3442
+ }
3443
+ }()
3444
+ );
3445
+ }
3446
+ const AttributeListPlugin = {
3447
+ match(model) {
3448
+ return model.$$type === "AttributeList";
3449
+ },
3450
+ convert(context, model) {
3451
+ return createElement(
3452
+ "AttributeList",
3453
+ {
3454
+ kind: model.$$kind
3455
+ },
3456
+ model.values.map(([key, value]) => convertAttribute(key, value))
3457
+ );
3458
+ }
3459
+ };
3460
+ const EdgePlugin$1 = {
3461
+ match(model) {
3462
+ return model.$$type === "Edge";
3463
+ },
3464
+ convert(context, model) {
3465
+ return createElement(
3466
+ "Edge",
3467
+ {
3468
+ targets: model.targets.map((target) => {
3469
+ if (common.isNodeModel(target)) {
3470
+ return createElement(
3471
+ "NodeRef",
3472
+ {
3473
+ id: createElement(
3474
+ "Literal",
3475
+ {
3476
+ value: target.id,
3477
+ quoted: true
3478
+ },
3479
+ []
3480
+ )
3481
+ },
3482
+ []
3483
+ );
3484
+ }
3485
+ if (common.isForwardRefNode(target)) {
3486
+ return createElement(
3487
+ "NodeRef",
3488
+ {
3489
+ id: createElement(
3490
+ "Literal",
3491
+ {
3492
+ value: target.id,
3493
+ quoted: true
3494
+ },
3495
+ []
3496
+ ),
3497
+ port: target.port ? createElement(
3498
+ "Literal",
3499
+ {
3500
+ value: target.port,
3501
+ quoted: true
3502
+ },
3503
+ []
3504
+ ) : void 0,
3505
+ compass: target.compass ? createElement(
3506
+ "Literal",
3507
+ {
3508
+ value: target.compass,
3509
+ quoted: true
3510
+ },
3511
+ []
3512
+ ) : void 0
3513
+ },
3514
+ []
3515
+ );
3516
+ }
3517
+ return createElement(
3518
+ "NodeRefGroup",
3519
+ {},
3520
+ target.map((n) => {
3521
+ if (common.isNodeModel(n)) {
3522
+ return createElement(
3523
+ "NodeRef",
3524
+ {
3525
+ id: createElement(
3526
+ "Literal",
3527
+ {
3528
+ value: n.id,
3529
+ quoted: true
3530
+ },
3531
+ []
3532
+ )
3533
+ },
3534
+ []
3535
+ );
3536
+ }
3537
+ return createElement(
3538
+ "NodeRef",
3539
+ {
3540
+ id: createElement(
3541
+ "Literal",
3542
+ {
3543
+ value: n.id,
3544
+ quoted: true
3545
+ },
3546
+ []
3547
+ ),
3548
+ port: n.port ? createElement(
3549
+ "Literal",
3550
+ {
3551
+ value: n.port,
3552
+ quoted: true
3553
+ },
3554
+ []
3555
+ ) : void 0,
3556
+ compass: n.compass ? createElement(
3557
+ "Literal",
3558
+ {
3559
+ value: n.compass,
3560
+ quoted: true
3561
+ },
3562
+ []
3563
+ ) : void 0
3564
+ },
3565
+ []
3566
+ );
3567
+ })
3568
+ );
3569
+ })
3570
+ },
3571
+ [
3572
+ ...model.attributes.comment ? [convertComment(model.attributes.comment, context.commentKind)] : [],
3573
+ ...model.attributes.values.map(
3574
+ ([key, value]) => convertAttribute(key, value)
3575
+ )
3576
+ ]
3577
+ );
3578
+ }
3579
+ };
3580
+ const GraphPlugin$1 = {
3581
+ match(model) {
3582
+ return model.$$type === "Graph";
3583
+ },
3584
+ convert(context, model) {
3585
+ return createElement("Dot", {}, [
3586
+ ...model.comment ? [convertComment(model.comment, context.commentKind)] : [],
3587
+ createElement(
3588
+ "Graph",
3589
+ {
3590
+ directed: model.directed,
3591
+ strict: model.strict,
3592
+ id: model.id ? createElement(
3593
+ "Literal",
3594
+ {
3595
+ value: model.id,
3596
+ quoted: true
3597
+ },
3598
+ []
3599
+ ) : void 0
3600
+ },
3601
+ convertClusterChildren(context, model)
3602
+ )
3603
+ ]);
3604
+ }
3605
+ };
3606
+ const NodePlugin$1 = {
3607
+ match(model) {
3608
+ return model.$$type === "Node";
3609
+ },
3610
+ convert(context, model) {
3611
+ return createElement(
3612
+ "Node",
3613
+ {
3614
+ id: createElement(
3615
+ "Literal",
3616
+ {
3617
+ value: model.id,
3618
+ quoted: true
3619
+ },
3620
+ []
3621
+ )
3622
+ },
3623
+ [
3624
+ ...model.attributes.comment ? [convertComment(model.attributes.comment, context.commentKind)] : [],
3625
+ ...model.attributes.values.map(
3626
+ ([key, value]) => convertAttribute(key, value)
3627
+ )
3628
+ ]
3629
+ );
3630
+ }
3631
+ };
3632
+ const SubgraphPlugin$1 = {
3633
+ match(model) {
3634
+ return model.$$type === "Subgraph";
3635
+ },
3636
+ convert(context, model) {
3637
+ return createElement(
3638
+ "Subgraph",
3639
+ {
3640
+ id: model.id ? createElement(
3641
+ "Literal",
3642
+ {
3643
+ value: model.id,
3644
+ quoted: true
3645
+ },
3646
+ []
3647
+ ) : void 0
3648
+ },
3649
+ convertClusterChildren(context, model)
3650
+ );
3651
+ }
3652
+ };
3653
+ const defaultPlugins$1 = [
3654
+ AttributeListPlugin,
3655
+ EdgePlugin$1,
3656
+ NodePlugin$1,
3657
+ GraphPlugin$1,
3658
+ SubgraphPlugin$1
3659
+ ];
3660
+ class FromModelConverter {
3661
+ constructor(options = {}) {
3662
+ /** @hidden */
3663
+ __privateAdd(this, _plugins2, [...defaultPlugins$1]);
3664
+ this.options = options;
3665
+ }
3666
+ /**
3667
+ * Converts a DotObjectModel into an AST.
3668
+ *
3669
+ * @param model The {@link DotObjectModel} to be converted.
3670
+ * @returns The AST generated from the model.
3671
+ */
3672
+ convert(model) {
3673
+ const plugins = [...__privateGet(this, _plugins2)];
3674
+ const { commentKind = "Slash" } = this.options;
3675
+ const context = {
3676
+ commentKind,
3677
+ convert(m) {
3678
+ for (const plugin of plugins) {
3679
+ if (plugin.match(m)) {
3680
+ return plugin.convert(context, m);
3681
+ }
3682
+ }
3683
+ throw Error();
3684
+ }
3685
+ };
3686
+ return context.convert(model);
3687
+ }
3688
+ }
3689
+ _plugins2 = new WeakMap();
3690
+ function fromModel(model, options) {
3691
+ return new FromModelConverter(options).convert(model);
3692
+ }
3693
+ class CommentHolder {
3694
+ constructor() {
3695
+ __publicField(this, "comment", null);
3696
+ }
3697
+ set(comment) {
3698
+ this.comment = comment;
3699
+ }
3700
+ reset() {
3701
+ this.comment = null;
3702
+ }
3703
+ apply(model, location) {
3704
+ var _a, _b, _c;
3705
+ if (location && ((_a = this.comment) == null ? void 0 : _a.location)) {
3706
+ if (((_b = this.comment) == null ? void 0 : _b.kind) === "Block") {
3707
+ if (this.comment.location.end.line === location.start.line - 1) {
3708
+ model.comment = this.comment.value;
3709
+ }
3710
+ } else {
3711
+ if (this.comment.location.end.line === location.start.line) {
3712
+ model.comment = this.comment.value;
3713
+ }
3714
+ }
3715
+ } else {
3716
+ model.comment = (_c = this.comment) == null ? void 0 : _c.value;
3717
+ }
3718
+ this.reset();
3719
+ }
3720
+ }
3721
+ const DotPlugin = {
3722
+ match(ast) {
3723
+ return ast.type === "Dot";
3724
+ },
3725
+ convert(context, ast) {
3726
+ const commentHolder = new CommentHolder();
3727
+ for (const stmt of ast.children) {
3728
+ switch (stmt.type) {
3729
+ case "Comment":
3730
+ commentHolder.set(stmt);
3731
+ break;
3732
+ case "Graph": {
3733
+ const graph = context.convert(stmt);
3734
+ commentHolder.apply(graph, stmt.location);
3735
+ return graph;
3736
+ }
3737
+ }
3738
+ }
3739
+ throw Error();
3740
+ }
3741
+ };
3742
+ function convertToEdgeTargetTuple(edge) {
3743
+ return edge.targets.map((t) => {
3744
+ var _a, _b;
3745
+ switch (t.type) {
3746
+ case "NodeRef":
3747
+ return {
3748
+ id: t.id.value,
3749
+ port: (_a = t.port) == null ? void 0 : _a.value,
3750
+ compass: (_b = t.compass) == null ? void 0 : _b.value
3751
+ };
3752
+ case "NodeRefGroup":
3753
+ return t.children.map((t2) => {
3754
+ var _a2, _b2;
3755
+ return {
3756
+ id: t2.id.value,
3757
+ port: (_a2 = t2.port) == null ? void 0 : _a2.value,
3758
+ compass: (_b2 = t2.compass) == null ? void 0 : _b2.value
3759
+ };
3760
+ });
3761
+ }
3762
+ });
3763
+ }
3764
+ const EdgePlugin = {
3765
+ match(ast) {
3766
+ return ast.type === "Edge";
3767
+ },
3768
+ convert(context, ast) {
3769
+ const edge = new context.models.Edge(
3770
+ convertToEdgeTargetTuple(ast),
3771
+ ast.children.filter(
3772
+ (v) => v.type === "Attribute"
3773
+ ).reduce(
3774
+ (acc, curr) => {
3775
+ acc[curr.key.value] = curr.value.value;
3776
+ return acc;
3777
+ },
3778
+ {}
3779
+ )
3780
+ );
3781
+ return edge;
3782
+ }
3783
+ };
3784
+ function applyStatements(graph, statements) {
3785
+ const commentHolder = new CommentHolder();
3786
+ for (const stmt of statements) {
3787
+ switch (stmt.type) {
3788
+ case "Subgraph": {
3789
+ const subgraph = stmt.id ? graph.subgraph(stmt.id.value) : graph.subgraph();
3790
+ applyStatements(subgraph, stmt.children);
3791
+ commentHolder.apply(subgraph, stmt.location);
3792
+ break;
3793
+ }
3794
+ case "Attribute":
3795
+ graph.set(stmt.key.value, stmt.value.value);
3796
+ commentHolder.reset();
3797
+ break;
3798
+ case "Node":
3799
+ commentHolder.apply(
3800
+ graph.node(
3801
+ stmt.id.value,
3802
+ stmt.children.filter(
3803
+ (v) => v.type === "Attribute"
3804
+ ).reduce(
3805
+ (acc, curr) => {
3806
+ acc[curr.key.value] = curr.value.value;
3807
+ return acc;
3808
+ },
3809
+ {}
3810
+ )
3811
+ ),
3812
+ stmt.location
3813
+ );
3814
+ break;
3815
+ case "Edge":
3816
+ commentHolder.apply(
3817
+ graph.edge(
3818
+ convertToEdgeTargetTuple(stmt),
3819
+ stmt.children.filter(
3820
+ (v) => v.type === "Attribute"
3821
+ ).reduce(
3822
+ (acc, curr) => {
3823
+ acc[curr.key.value] = curr.value.value;
3824
+ return acc;
3825
+ },
3826
+ {}
3827
+ )
3828
+ ),
3829
+ stmt.location
3830
+ );
3831
+ break;
3832
+ case "AttributeList": {
3833
+ const attrs = stmt.children.filter(
3834
+ (v) => v.type === "Attribute"
3835
+ ).reduce(
3836
+ (acc, curr) => {
3837
+ acc[curr.key.value] = curr.value.value;
3838
+ return acc;
3839
+ },
3840
+ {}
3841
+ );
3842
+ switch (stmt.kind) {
3843
+ case "Edge":
3844
+ graph.edge(attrs);
3845
+ break;
3846
+ case "Node":
3847
+ graph.node(attrs);
3848
+ break;
3849
+ case "Graph":
3850
+ graph.graph(attrs);
3851
+ break;
3852
+ }
3853
+ commentHolder.reset();
3854
+ break;
3855
+ }
3856
+ case "Comment":
3857
+ commentHolder.set(stmt);
3858
+ }
3859
+ }
3860
+ }
3861
+ const GraphPlugin = {
3862
+ match(ast) {
3863
+ return ast.type === "Graph";
3864
+ },
3865
+ convert(context, ast) {
3866
+ var _a;
3867
+ const G = ast.directed ? context.models.Digraph : context.models.Graph;
3868
+ const graph = new G((_a = ast.id) == null ? void 0 : _a.value, ast.strict);
3869
+ applyStatements(graph, ast.children);
3870
+ return graph;
3871
+ }
3872
+ };
3873
+ const NodePlugin = {
3874
+ match(ast) {
3875
+ return ast.type === "Node";
3876
+ },
3877
+ convert(context, ast) {
3878
+ const node = new context.models.Node(
3879
+ ast.id.value,
3880
+ ast.children.filter(
3881
+ (v) => v.type === "Attribute"
3882
+ ).reduce(
3883
+ (acc, curr) => {
3884
+ acc[curr.key.value] = curr.value.value;
3885
+ return acc;
3886
+ },
3887
+ {}
3888
+ )
3889
+ );
3890
+ return node;
3891
+ }
3892
+ };
3893
+ const SubgraphPlugin = {
3894
+ match(ast) {
3895
+ return ast.type === "Subgraph";
3896
+ },
3897
+ convert(context, ast) {
3898
+ var _a;
3899
+ const subgraph = new context.models.Subgraph((_a = ast.id) == null ? void 0 : _a.value);
3900
+ applyStatements(subgraph, ast.children);
3901
+ return subgraph;
3902
+ }
3903
+ };
3904
+ const defaultPlugins = [
3905
+ NodePlugin,
3906
+ EdgePlugin,
3907
+ SubgraphPlugin,
3908
+ GraphPlugin,
3909
+ DotPlugin
3910
+ ];
3911
+ class ToModelConverter {
3912
+ constructor(options = {}) {
3913
+ /** @hidden */
3914
+ __publicField(this, "plugins", [
3915
+ ...defaultPlugins
3916
+ ]);
3917
+ this.options = options;
3918
+ }
3919
+ /**
3920
+ * Convert AST to Model.
3921
+ *
3922
+ * @param ast AST node.
3923
+ */
3924
+ convert(ast) {
3925
+ const plugins = [...this.plugins];
3926
+ const context = {
3927
+ models: common.createModelsContext(this.options.models ?? {}),
3928
+ convert(m) {
3929
+ for (const plugin of plugins) {
3930
+ if (plugin.match(m)) {
3931
+ return plugin.convert(context, m);
3932
+ }
3933
+ }
3934
+ throw Error();
3935
+ }
3936
+ };
3937
+ return context.convert(ast);
3938
+ }
3939
+ }
3940
+ function toModel(ast, options) {
3941
+ return new ToModelConverter(options).convert(ast);
3942
+ }
3943
+ exports.Builder = Builder;
3944
+ exports.DotSyntaxError = DotSyntaxError;
3945
+ exports.FromModelConverter = FromModelConverter;
3946
+ exports.Printer = Printer;
3947
+ exports.ToModelConverter = ToModelConverter;
3948
+ exports.createElement = createElement;
3949
+ exports.fromModel = fromModel;
3950
+ exports.parse = parse;
3951
+ exports.stringify = stringify;
3952
+ exports.toModel = toModel;