@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.
- package/CHANGELOG.md +12 -0
- package/LICENSE +22 -0
- package/README.md +42 -0
- package/lib/ast.cjs +3952 -0
- package/lib/ast.d.ts +881 -0
- package/lib/ast.js +3952 -0
- package/package.json +52 -0
- package/src/ast.ts +8 -0
- package/src/builder/__snapshots__/create-element.test.ts.snap +166 -0
- package/src/builder/builder.test.ts +36 -0
- package/src/builder/builder.ts +44 -0
- package/src/builder/create-element.test.ts +110 -0
- package/src/builder/create-element.ts +13 -0
- package/src/builder/index.ts +3 -0
- package/src/builder/types.ts +226 -0
- package/src/dot-shim/index.ts +2 -0
- package/src/dot-shim/parser/__snapshots__/parse.test.ts.snap +2613 -0
- package/src/dot-shim/parser/dot.peggy +396 -0
- package/src/dot-shim/parser/index.ts +1 -0
- package/src/dot-shim/parser/parse.test.ts +263 -0
- package/src/dot-shim/parser/parse.ts +121 -0
- package/src/dot-shim/parser/peggy.options.json +15 -0
- package/src/dot-shim/printer/index.ts +6 -0
- package/src/dot-shim/printer/plugins/AttributeListPrintPlugin.ts +22 -0
- package/src/dot-shim/printer/plugins/AttributePrintPlugin.ts +11 -0
- package/src/dot-shim/printer/plugins/CommentPrintPlugin.ts +40 -0
- package/src/dot-shim/printer/plugins/DotPrintPlugin.ts +12 -0
- package/src/dot-shim/printer/plugins/EdgePrintPlugin.ts +27 -0
- package/src/dot-shim/printer/plugins/GraphPrintPlugin.ts +32 -0
- package/src/dot-shim/printer/plugins/LiteralPrintPlugin.ts +24 -0
- package/src/dot-shim/printer/plugins/NodePrintPlugin.ts +24 -0
- package/src/dot-shim/printer/plugins/NodeRefGroupPrintPlugin.ts +17 -0
- package/src/dot-shim/printer/plugins/NodeRefPrintPlugin.ts +18 -0
- package/src/dot-shim/printer/plugins/SubgraphPrintPlugin.ts +27 -0
- package/src/dot-shim/printer/plugins/index.ts +26 -0
- package/src/dot-shim/printer/plugins/utils/index.ts +1 -0
- package/src/dot-shim/printer/plugins/utils/tokens.ts +51 -0
- package/src/dot-shim/printer/printer.ts +46 -0
- package/src/dot-shim/printer/stringify.test.ts +823 -0
- package/src/dot-shim/printer/stringify.ts +19 -0
- package/src/dot-shim/printer/types.ts +74 -0
- package/src/model-shim/from-model/converter.ts +43 -0
- package/src/model-shim/from-model/from-model.ts +19 -0
- package/src/model-shim/from-model/index.ts +3 -0
- package/src/model-shim/from-model/plugins/AttributeListPlugin.ts +19 -0
- package/src/model-shim/from-model/plugins/EdgePlugin.ts +140 -0
- package/src/model-shim/from-model/plugins/GraphPlugin.ts +36 -0
- package/src/model-shim/from-model/plugins/NodePlugin.ts +33 -0
- package/src/model-shim/from-model/plugins/SubraphPlugin.ts +28 -0
- package/src/model-shim/from-model/plugins/index.ts +13 -0
- package/src/model-shim/from-model/plugins/utils/convert-attribute.ts +47 -0
- package/src/model-shim/from-model/plugins/utils/convert-cluster-children.ts +44 -0
- package/src/model-shim/from-model/plugins/utils/convert-comment.ts +16 -0
- package/src/model-shim/from-model/plugins/utils/index.ts +3 -0
- package/src/model-shim/from-model/types.ts +62 -0
- package/src/model-shim/index.ts +2 -0
- package/src/model-shim/to-model/converter.ts +42 -0
- package/src/model-shim/to-model/index.ts +3 -0
- package/src/model-shim/to-model/plugins/DotPlugin.ts +25 -0
- package/src/model-shim/to-model/plugins/EdgePlugin.ts +26 -0
- package/src/model-shim/to-model/plugins/GraphPlugin.ts +15 -0
- package/src/model-shim/to-model/plugins/NodePlugin.ts +25 -0
- package/src/model-shim/to-model/plugins/SubgraphPlugin.ts +14 -0
- package/src/model-shim/to-model/plugins/index.ts +13 -0
- package/src/model-shim/to-model/plugins/utils/apply-statments.ts +96 -0
- package/src/model-shim/to-model/plugins/utils/comment-holder.ts +31 -0
- package/src/model-shim/to-model/plugins/utils/convert-to-edge-target-tuple.ts +21 -0
- package/src/model-shim/to-model/to-model.test.ts +34 -0
- package/src/model-shim/to-model/to-model.ts +16 -0
- package/src/model-shim/to-model/types.ts +71 -0
- package/src/types.ts +370 -0
- package/tsconfig.json +8 -0
- package/typedoc.json +4 -0
- package/vite.config.ts +22 -0
package/lib/ast.js
ADDED
|
@@ -0,0 +1,3952 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
var __accessCheck = (obj, member, msg) => {
|
|
8
|
+
if (!member.has(obj))
|
|
9
|
+
throw TypeError("Cannot " + msg);
|
|
10
|
+
};
|
|
11
|
+
var __privateGet = (obj, member, getter) => {
|
|
12
|
+
__accessCheck(obj, member, "read from private field");
|
|
13
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
14
|
+
};
|
|
15
|
+
var __privateAdd = (obj, member, value) => {
|
|
16
|
+
if (member.has(obj))
|
|
17
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
18
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
19
|
+
};
|
|
20
|
+
var _plugins, _plugins2;
|
|
21
|
+
import { pipe, map, isNodeModel, isForwardRefNode, createModelsContext } from "@ts-graphviz/common";
|
|
22
|
+
class Builder {
|
|
23
|
+
/**
|
|
24
|
+
* Constructor of Builder
|
|
25
|
+
* @param options - Options to initialize Builder
|
|
26
|
+
*/
|
|
27
|
+
constructor(options) {
|
|
28
|
+
this.options = options;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the current file range or null
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
getLocation() {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
return ((_b = (_a = this.options) == null ? void 0 : _a.locationFunction) == null ? void 0 : _b.call(_a)) ?? null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create an {@link ASTNode} of the specified type
|
|
40
|
+
*
|
|
41
|
+
* @param type - Type of the {@link ASTNode}
|
|
42
|
+
* @param props - Properties of the {@link ASTNode}
|
|
43
|
+
* @param children - Children of the {@link ASTNode}
|
|
44
|
+
* @returns An {@link ASTNode}
|
|
45
|
+
*/
|
|
46
|
+
createElement(type, props, children = []) {
|
|
47
|
+
return {
|
|
48
|
+
location: this.getLocation(),
|
|
49
|
+
...props,
|
|
50
|
+
type,
|
|
51
|
+
children
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const createElement = Builder.prototype.createElement.bind(new Builder());
|
|
56
|
+
const EOL = /\r?\n/;
|
|
57
|
+
function joinBy(sep) {
|
|
58
|
+
return (value) => value.join(sep);
|
|
59
|
+
}
|
|
60
|
+
function wrapWith(wrapper) {
|
|
61
|
+
return (value) => wrapper + value + wrapper;
|
|
62
|
+
}
|
|
63
|
+
function wrapByPair(l, r) {
|
|
64
|
+
return (value) => l + value + r;
|
|
65
|
+
}
|
|
66
|
+
function leftPadWith(left) {
|
|
67
|
+
return (value) => left + value;
|
|
68
|
+
}
|
|
69
|
+
const escape = (value) => value.replace(/\\/g, "\\\\").replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/"/g, '\\"');
|
|
70
|
+
const splitByLine = (value) => value.split(EOL);
|
|
71
|
+
const indent = (style, size, eol) => pipe(
|
|
72
|
+
splitByLine,
|
|
73
|
+
map(leftPadWith(style === "space" ? " ".repeat(size) : "\n")),
|
|
74
|
+
joinBy(eol)
|
|
75
|
+
);
|
|
76
|
+
const endOfLine = (eol) => {
|
|
77
|
+
switch (eol) {
|
|
78
|
+
case "crlf":
|
|
79
|
+
return "\r\n";
|
|
80
|
+
case "lf":
|
|
81
|
+
return "\n";
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const AttributeListPrintPlugin = {
|
|
85
|
+
match(ast) {
|
|
86
|
+
return ast.type === "AttributeList";
|
|
87
|
+
},
|
|
88
|
+
print(context, ast) {
|
|
89
|
+
if (ast.children.length === 0) {
|
|
90
|
+
return `${ast.kind.toLocaleLowerCase()} [];`;
|
|
91
|
+
}
|
|
92
|
+
const eol = endOfLine(context.endOfLine);
|
|
93
|
+
return pipe(
|
|
94
|
+
map(context.print),
|
|
95
|
+
joinBy(eol),
|
|
96
|
+
indent(context.indentStyle, context.indentSize, eol),
|
|
97
|
+
wrapByPair(`${ast.kind.toLocaleLowerCase()} [${eol}`, `${eol}];`)
|
|
98
|
+
)(ast.children);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const AttributePrintPlugin = {
|
|
102
|
+
match(ast) {
|
|
103
|
+
return ast.type === "Attribute";
|
|
104
|
+
},
|
|
105
|
+
print(context, ast) {
|
|
106
|
+
return `${context.print(ast.key)} = ${context.print(ast.value)};`;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const CommentPrintPlugin = {
|
|
110
|
+
match(ast) {
|
|
111
|
+
return ast.type === "Comment";
|
|
112
|
+
},
|
|
113
|
+
print(context, ast) {
|
|
114
|
+
const eol = endOfLine(context.endOfLine);
|
|
115
|
+
switch (ast.kind) {
|
|
116
|
+
case "Block":
|
|
117
|
+
return pipe(
|
|
118
|
+
splitByLine,
|
|
119
|
+
map(leftPadWith(" * ")),
|
|
120
|
+
joinBy(eol),
|
|
121
|
+
wrapByPair(`/**${eol}`, `${eol} */`)
|
|
122
|
+
)(ast.value);
|
|
123
|
+
case "Macro":
|
|
124
|
+
return pipe(
|
|
125
|
+
splitByLine,
|
|
126
|
+
map(leftPadWith("# ")),
|
|
127
|
+
joinBy(eol)
|
|
128
|
+
)(ast.value);
|
|
129
|
+
default:
|
|
130
|
+
return pipe(
|
|
131
|
+
splitByLine,
|
|
132
|
+
map(leftPadWith("// ")),
|
|
133
|
+
joinBy(eol)
|
|
134
|
+
)(ast.value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const DotPrintPlugin = {
|
|
139
|
+
match(ast) {
|
|
140
|
+
return ast.type === "Dot";
|
|
141
|
+
},
|
|
142
|
+
print(context, ast) {
|
|
143
|
+
return ast.children.map(context.print).join(endOfLine(context.endOfLine));
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const EdgePrintPlugin = {
|
|
147
|
+
match(ast) {
|
|
148
|
+
return ast.type === "Edge";
|
|
149
|
+
},
|
|
150
|
+
print(context, ast) {
|
|
151
|
+
const targets = pipe(
|
|
152
|
+
map(context.print),
|
|
153
|
+
joinBy(context.directed ? " -> " : " -- ")
|
|
154
|
+
)(ast.targets);
|
|
155
|
+
if (ast.children.length === 0) {
|
|
156
|
+
return `${targets};`;
|
|
157
|
+
}
|
|
158
|
+
const eol = endOfLine(context.endOfLine);
|
|
159
|
+
const contents = pipe(
|
|
160
|
+
map(context.print),
|
|
161
|
+
joinBy(eol),
|
|
162
|
+
indent(context.indentStyle, context.indentSize, eol),
|
|
163
|
+
wrapByPair(`[${eol}`, `${eol}];`)
|
|
164
|
+
)(ast.children);
|
|
165
|
+
return `${targets} ${contents}`;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const GraphPrintPlugin = {
|
|
169
|
+
match(ast) {
|
|
170
|
+
return ast.type === "Graph";
|
|
171
|
+
},
|
|
172
|
+
print(context, ast) {
|
|
173
|
+
context.directed = ast.directed;
|
|
174
|
+
const parts = [];
|
|
175
|
+
if (ast.strict) {
|
|
176
|
+
parts.push("strict");
|
|
177
|
+
}
|
|
178
|
+
parts.push(ast.directed ? "digraph" : "graph");
|
|
179
|
+
if (ast.id) {
|
|
180
|
+
parts.push(context.print(ast.id));
|
|
181
|
+
}
|
|
182
|
+
if (ast.children.length === 0) {
|
|
183
|
+
return `${parts.join(" ")} {}`;
|
|
184
|
+
}
|
|
185
|
+
const eol = endOfLine(context.endOfLine);
|
|
186
|
+
const contents = pipe(
|
|
187
|
+
map(context.print),
|
|
188
|
+
joinBy(eol),
|
|
189
|
+
indent(context.indentStyle, context.indentSize, eol),
|
|
190
|
+
wrapByPair(`{${eol}`, `${eol}}`)
|
|
191
|
+
)(ast.children);
|
|
192
|
+
return `${parts.join(" ")} ${contents}`;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const quoteLiteralValue = pipe(escape, wrapWith('"'));
|
|
196
|
+
const quoteHTMLLikeLiteralValue = wrapByPair("<", ">");
|
|
197
|
+
const LiteralPrintPlugin = {
|
|
198
|
+
match(ast) {
|
|
199
|
+
return ast.type === "Literal";
|
|
200
|
+
},
|
|
201
|
+
print(context, ast) {
|
|
202
|
+
switch (ast.quoted) {
|
|
203
|
+
case "html":
|
|
204
|
+
return quoteHTMLLikeLiteralValue(ast.value);
|
|
205
|
+
case true:
|
|
206
|
+
return quoteLiteralValue(ast.value);
|
|
207
|
+
default:
|
|
208
|
+
return escape(ast.value);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const NodePrintPlugin = {
|
|
213
|
+
match(ast) {
|
|
214
|
+
return ast.type === "Node";
|
|
215
|
+
},
|
|
216
|
+
print(context, ast) {
|
|
217
|
+
const id = context.print(ast.id);
|
|
218
|
+
if (ast.children.length === 0) {
|
|
219
|
+
return `${id};`;
|
|
220
|
+
}
|
|
221
|
+
const eol = endOfLine(context.endOfLine);
|
|
222
|
+
const contents = pipe(
|
|
223
|
+
map(context.print),
|
|
224
|
+
joinBy(eol),
|
|
225
|
+
indent(context.indentStyle, context.indentSize, eol),
|
|
226
|
+
wrapByPair(`[${eol}`, `${eol}];`)
|
|
227
|
+
)(ast.children);
|
|
228
|
+
return `${id} ${contents}`;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const NodeRefGroupPrintPlugin = {
|
|
232
|
+
match(ast) {
|
|
233
|
+
return ast.type === "NodeRefGroup";
|
|
234
|
+
},
|
|
235
|
+
print(context, ast) {
|
|
236
|
+
return pipe(
|
|
237
|
+
map(context.print),
|
|
238
|
+
joinBy(" "),
|
|
239
|
+
wrapByPair("{", "}")
|
|
240
|
+
)(ast.children);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
const NodeRefPrintPlugin = {
|
|
244
|
+
match(ast) {
|
|
245
|
+
return ast.type === "NodeRef";
|
|
246
|
+
},
|
|
247
|
+
print(context, ast) {
|
|
248
|
+
const parts = [context.print(ast.id)];
|
|
249
|
+
if (ast.port) {
|
|
250
|
+
parts.push(context.print(ast.port));
|
|
251
|
+
}
|
|
252
|
+
if (ast.compass) {
|
|
253
|
+
parts.push(context.print(ast.compass));
|
|
254
|
+
}
|
|
255
|
+
return parts.join(":");
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
const SubgraphPrintPlugin = {
|
|
259
|
+
match(ast) {
|
|
260
|
+
return ast.type === "Subgraph";
|
|
261
|
+
},
|
|
262
|
+
print(context, ast) {
|
|
263
|
+
const parts = ["subgraph"];
|
|
264
|
+
if (ast.id) {
|
|
265
|
+
parts.push(context.print(ast.id));
|
|
266
|
+
}
|
|
267
|
+
if (ast.children.length === 0) {
|
|
268
|
+
return `${parts.join(" ")} {}`;
|
|
269
|
+
}
|
|
270
|
+
const eol = endOfLine(context.endOfLine);
|
|
271
|
+
const contents = pipe(
|
|
272
|
+
map(context.print),
|
|
273
|
+
joinBy(eol),
|
|
274
|
+
indent(context.indentStyle, context.indentSize, eol),
|
|
275
|
+
wrapByPair(`{${eol}`, `${eol}}`)
|
|
276
|
+
)(ast.children);
|
|
277
|
+
return `${parts.join(" ")} ${contents}`;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
const defaultPlugins$2 = [
|
|
281
|
+
AttributeListPrintPlugin,
|
|
282
|
+
AttributePrintPlugin,
|
|
283
|
+
CommentPrintPlugin,
|
|
284
|
+
DotPrintPlugin,
|
|
285
|
+
EdgePrintPlugin,
|
|
286
|
+
GraphPrintPlugin,
|
|
287
|
+
LiteralPrintPlugin,
|
|
288
|
+
NodePrintPlugin,
|
|
289
|
+
NodeRefGroupPrintPlugin,
|
|
290
|
+
NodeRefPrintPlugin,
|
|
291
|
+
SubgraphPrintPlugin
|
|
292
|
+
];
|
|
293
|
+
class Printer {
|
|
294
|
+
/**
|
|
295
|
+
* @param options Options to be used when generating the DOT string.
|
|
296
|
+
*/
|
|
297
|
+
constructor(options = {}) {
|
|
298
|
+
/** @internal */
|
|
299
|
+
__privateAdd(this, _plugins, [...defaultPlugins$2]);
|
|
300
|
+
this.options = options;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Generates a DOT string from an ASTNode.
|
|
304
|
+
* @param ast The ASTNode to be converted into a DOT string.
|
|
305
|
+
* @returns The DOT string generated from the ASTNode.
|
|
306
|
+
*/
|
|
307
|
+
print(ast) {
|
|
308
|
+
const plugins = [...__privateGet(this, _plugins)];
|
|
309
|
+
const {
|
|
310
|
+
indentSize = 2,
|
|
311
|
+
indentStyle = "space",
|
|
312
|
+
endOfLine: endOfLine2 = "lf"
|
|
313
|
+
} = this.options;
|
|
314
|
+
const context = {
|
|
315
|
+
directed: true,
|
|
316
|
+
indentSize,
|
|
317
|
+
indentStyle,
|
|
318
|
+
endOfLine: endOfLine2,
|
|
319
|
+
print(a) {
|
|
320
|
+
for (const plugin of plugins) {
|
|
321
|
+
if (plugin.match(a)) {
|
|
322
|
+
return plugin.print(context, a);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
throw Error();
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
return context.print(ast);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
_plugins = new WeakMap();
|
|
332
|
+
function stringify(ast, options) {
|
|
333
|
+
const result = new Printer(options).print(ast);
|
|
334
|
+
if (!result) {
|
|
335
|
+
throw new Error();
|
|
336
|
+
}
|
|
337
|
+
return result;
|
|
338
|
+
}
|
|
339
|
+
const peggyParser = (
|
|
340
|
+
// Generated by Peggy 3.0.2.
|
|
341
|
+
//
|
|
342
|
+
// https://peggyjs.org/
|
|
343
|
+
// @ts-ignore
|
|
344
|
+
function() {
|
|
345
|
+
function peg$subclass(child, parent) {
|
|
346
|
+
function C() {
|
|
347
|
+
this.constructor = child;
|
|
348
|
+
}
|
|
349
|
+
C.prototype = parent.prototype;
|
|
350
|
+
child.prototype = new C();
|
|
351
|
+
}
|
|
352
|
+
function peg$SyntaxError(message, expected, found, location) {
|
|
353
|
+
var self = Error.call(this, message);
|
|
354
|
+
if (Object.setPrototypeOf) {
|
|
355
|
+
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
|
|
356
|
+
}
|
|
357
|
+
self.expected = expected;
|
|
358
|
+
self.found = found;
|
|
359
|
+
self.location = location;
|
|
360
|
+
self.name = "SyntaxError";
|
|
361
|
+
return self;
|
|
362
|
+
}
|
|
363
|
+
peg$subclass(peg$SyntaxError, Error);
|
|
364
|
+
function peg$padEnd(str, targetLength, padString) {
|
|
365
|
+
padString = padString || " ";
|
|
366
|
+
if (str.length > targetLength) {
|
|
367
|
+
return str;
|
|
368
|
+
}
|
|
369
|
+
targetLength -= str.length;
|
|
370
|
+
padString += padString.repeat(targetLength);
|
|
371
|
+
return str + padString.slice(0, targetLength);
|
|
372
|
+
}
|
|
373
|
+
peg$SyntaxError.prototype.format = function(sources) {
|
|
374
|
+
var str = "Error: " + this.message;
|
|
375
|
+
if (this.location) {
|
|
376
|
+
var src = null;
|
|
377
|
+
var k;
|
|
378
|
+
for (k = 0; k < sources.length; k++) {
|
|
379
|
+
if (sources[k].source === this.location.source) {
|
|
380
|
+
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
var s = this.location.start;
|
|
385
|
+
var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
|
|
386
|
+
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
|
|
387
|
+
if (src) {
|
|
388
|
+
var e = this.location.end;
|
|
389
|
+
var filler = peg$padEnd("", offset_s.line.toString().length, " ");
|
|
390
|
+
var line = src[s.line - 1];
|
|
391
|
+
var last = s.line === e.line ? e.column : line.length + 1;
|
|
392
|
+
var hatLen = last - s.column || 1;
|
|
393
|
+
str += "\n --> " + loc + "\n" + filler + " |\n" + offset_s.line + " | " + line + "\n" + filler + " | " + peg$padEnd("", s.column - 1, " ") + peg$padEnd("", hatLen, "^");
|
|
394
|
+
} else {
|
|
395
|
+
str += "\n at " + loc;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return str;
|
|
399
|
+
};
|
|
400
|
+
peg$SyntaxError.buildMessage = function(expected, found) {
|
|
401
|
+
var DESCRIBE_EXPECTATION_FNS = {
|
|
402
|
+
// @ts-ignore
|
|
403
|
+
literal: function(expectation) {
|
|
404
|
+
return '"' + literalEscape(expectation.text) + '"';
|
|
405
|
+
},
|
|
406
|
+
// @ts-ignore
|
|
407
|
+
class: function(expectation) {
|
|
408
|
+
var escapedParts = expectation.parts.map(function(part) {
|
|
409
|
+
return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
|
|
410
|
+
});
|
|
411
|
+
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
|
|
412
|
+
},
|
|
413
|
+
// @ts-ignore
|
|
414
|
+
any: function() {
|
|
415
|
+
return "any character";
|
|
416
|
+
},
|
|
417
|
+
// @ts-ignore
|
|
418
|
+
end: function() {
|
|
419
|
+
return "end of input";
|
|
420
|
+
},
|
|
421
|
+
// @ts-ignore
|
|
422
|
+
other: function(expectation) {
|
|
423
|
+
return expectation.description;
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
function hex(ch) {
|
|
427
|
+
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
428
|
+
}
|
|
429
|
+
function literalEscape(s) {
|
|
430
|
+
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) {
|
|
431
|
+
return "\\x0" + hex(ch);
|
|
432
|
+
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
|
|
433
|
+
return "\\x" + hex(ch);
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function classEscape(s) {
|
|
437
|
+
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) {
|
|
438
|
+
return "\\x0" + hex(ch);
|
|
439
|
+
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
|
|
440
|
+
return "\\x" + hex(ch);
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
function describeExpectation(expectation) {
|
|
444
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
445
|
+
}
|
|
446
|
+
function describeExpected(expected2) {
|
|
447
|
+
var descriptions = expected2.map(describeExpectation);
|
|
448
|
+
var i, j;
|
|
449
|
+
descriptions.sort();
|
|
450
|
+
if (descriptions.length > 0) {
|
|
451
|
+
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
452
|
+
if (descriptions[i - 1] !== descriptions[i]) {
|
|
453
|
+
descriptions[j] = descriptions[i];
|
|
454
|
+
j++;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
descriptions.length = j;
|
|
458
|
+
}
|
|
459
|
+
switch (descriptions.length) {
|
|
460
|
+
case 1:
|
|
461
|
+
return descriptions[0];
|
|
462
|
+
case 2:
|
|
463
|
+
return descriptions[0] + " or " + descriptions[1];
|
|
464
|
+
default:
|
|
465
|
+
return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
function describeFound(found2) {
|
|
469
|
+
return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
|
|
470
|
+
}
|
|
471
|
+
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
472
|
+
};
|
|
473
|
+
function peg$parse(input, options) {
|
|
474
|
+
options = options !== void 0 ? options : {};
|
|
475
|
+
var peg$FAILED = {};
|
|
476
|
+
var peg$source = options.grammarSource;
|
|
477
|
+
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 };
|
|
478
|
+
var peg$startRuleFunction = peg$parseDot;
|
|
479
|
+
var peg$c0 = "strict";
|
|
480
|
+
var peg$c1 = "graph";
|
|
481
|
+
var peg$c2 = "digraph";
|
|
482
|
+
var peg$c3 = "{";
|
|
483
|
+
var peg$c4 = "}";
|
|
484
|
+
var peg$c5 = ";";
|
|
485
|
+
var peg$c6 = "node";
|
|
486
|
+
var peg$c7 = "edge";
|
|
487
|
+
var peg$c8 = "=";
|
|
488
|
+
var peg$c9 = ",";
|
|
489
|
+
var peg$c10 = "[";
|
|
490
|
+
var peg$c11 = "]";
|
|
491
|
+
var peg$c12 = "->";
|
|
492
|
+
var peg$c13 = "--";
|
|
493
|
+
var peg$c14 = ":";
|
|
494
|
+
var peg$c15 = "subgraph";
|
|
495
|
+
var peg$c16 = "n";
|
|
496
|
+
var peg$c17 = "ne";
|
|
497
|
+
var peg$c18 = "e";
|
|
498
|
+
var peg$c19 = "se";
|
|
499
|
+
var peg$c20 = "s";
|
|
500
|
+
var peg$c21 = "sw";
|
|
501
|
+
var peg$c22 = "w";
|
|
502
|
+
var peg$c23 = "nw";
|
|
503
|
+
var peg$c24 = '"';
|
|
504
|
+
var peg$c25 = "/*";
|
|
505
|
+
var peg$c26 = "*/";
|
|
506
|
+
var peg$c27 = "//";
|
|
507
|
+
var peg$c28 = "#";
|
|
508
|
+
var peg$c29 = "$";
|
|
509
|
+
var peg$c30 = "_";
|
|
510
|
+
var peg$c31 = "-";
|
|
511
|
+
var peg$c32 = ".";
|
|
512
|
+
var peg$c33 = "<";
|
|
513
|
+
var peg$c34 = ">";
|
|
514
|
+
var peg$c35 = "\\";
|
|
515
|
+
var peg$c36 = "\n";
|
|
516
|
+
var peg$c37 = "\r\n";
|
|
517
|
+
var peg$c38 = "\r";
|
|
518
|
+
var peg$c39 = "\u2028";
|
|
519
|
+
var peg$c40 = "\u2029";
|
|
520
|
+
var peg$r0 = /^[0-9]/;
|
|
521
|
+
var peg$r1 = /^[\n\r\u2028\u2029]/;
|
|
522
|
+
var peg$r3 = /^[\n\r]/;
|
|
523
|
+
var peg$r4 = /^[ \t]/;
|
|
524
|
+
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]/;
|
|
525
|
+
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]/;
|
|
526
|
+
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]/;
|
|
527
|
+
var peg$r8 = /^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/;
|
|
528
|
+
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]/;
|
|
529
|
+
var peg$r10 = /^[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/;
|
|
530
|
+
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]/;
|
|
531
|
+
var peg$e0 = peg$literalExpectation("strict", true);
|
|
532
|
+
var peg$e1 = peg$literalExpectation("graph", true);
|
|
533
|
+
var peg$e2 = peg$literalExpectation("digraph", true);
|
|
534
|
+
var peg$e3 = peg$literalExpectation("{", false);
|
|
535
|
+
var peg$e4 = peg$literalExpectation("}", false);
|
|
536
|
+
var peg$e5 = peg$literalExpectation(";", false);
|
|
537
|
+
var peg$e6 = peg$literalExpectation("node", true);
|
|
538
|
+
var peg$e7 = peg$literalExpectation("edge", true);
|
|
539
|
+
var peg$e8 = peg$literalExpectation("=", false);
|
|
540
|
+
var peg$e9 = peg$literalExpectation(",", false);
|
|
541
|
+
var peg$e10 = peg$literalExpectation("[", false);
|
|
542
|
+
var peg$e11 = peg$literalExpectation("]", false);
|
|
543
|
+
var peg$e12 = peg$literalExpectation("->", false);
|
|
544
|
+
var peg$e13 = peg$literalExpectation("--", false);
|
|
545
|
+
var peg$e14 = peg$otherExpectation("port");
|
|
546
|
+
var peg$e15 = peg$literalExpectation(":", false);
|
|
547
|
+
var peg$e16 = peg$literalExpectation("subgraph", true);
|
|
548
|
+
var peg$e17 = peg$literalExpectation("n", false);
|
|
549
|
+
var peg$e18 = peg$literalExpectation("ne", false);
|
|
550
|
+
var peg$e19 = peg$literalExpectation("e", false);
|
|
551
|
+
var peg$e20 = peg$literalExpectation("se", false);
|
|
552
|
+
var peg$e21 = peg$literalExpectation("s", false);
|
|
553
|
+
var peg$e22 = peg$literalExpectation("sw", false);
|
|
554
|
+
var peg$e23 = peg$literalExpectation("w", false);
|
|
555
|
+
var peg$e24 = peg$literalExpectation("nw", false);
|
|
556
|
+
var peg$e25 = peg$literalExpectation('"', false);
|
|
557
|
+
var peg$e26 = peg$literalExpectation("/*", false);
|
|
558
|
+
var peg$e27 = peg$literalExpectation("*/", false);
|
|
559
|
+
var peg$e28 = peg$anyExpectation();
|
|
560
|
+
var peg$e29 = peg$literalExpectation("//", false);
|
|
561
|
+
var peg$e30 = peg$literalExpectation("#", false);
|
|
562
|
+
var peg$e31 = peg$otherExpectation("UNICODE_STRING");
|
|
563
|
+
var peg$e32 = peg$literalExpectation("$", false);
|
|
564
|
+
var peg$e33 = peg$literalExpectation("_", false);
|
|
565
|
+
var peg$e34 = peg$otherExpectation("NUMBER");
|
|
566
|
+
var peg$e35 = peg$literalExpectation("-", false);
|
|
567
|
+
var peg$e36 = peg$literalExpectation(".", false);
|
|
568
|
+
var peg$e37 = peg$classExpectation([["0", "9"]], false, false);
|
|
569
|
+
var peg$e38 = peg$literalExpectation("<", false);
|
|
570
|
+
var peg$e39 = peg$literalExpectation(">", false);
|
|
571
|
+
var peg$e40 = peg$literalExpectation("\\", false);
|
|
572
|
+
var peg$e41 = peg$classExpectation(["\n", "\r", "\u2028", "\u2029"], false, false);
|
|
573
|
+
var peg$e42 = peg$otherExpectation("end of line");
|
|
574
|
+
var peg$e43 = peg$literalExpectation("\n", false);
|
|
575
|
+
var peg$e44 = peg$literalExpectation("\r\n", false);
|
|
576
|
+
var peg$e45 = peg$literalExpectation("\r", false);
|
|
577
|
+
var peg$e46 = peg$literalExpectation("\u2028", false);
|
|
578
|
+
var peg$e47 = peg$literalExpectation("\u2029", false);
|
|
579
|
+
var peg$e50 = peg$otherExpectation("whitespace");
|
|
580
|
+
var peg$e51 = peg$otherExpectation("WHITESPACE");
|
|
581
|
+
var peg$e52 = peg$classExpectation(["\n", "\r"], false, false);
|
|
582
|
+
var peg$e53 = peg$classExpectation([" ", " "], false, false);
|
|
583
|
+
var peg$e54 = peg$classExpectation([["a", "z"], "µ", ["ß", "ö"], ["ø", "ÿ"], "ā", "ă", "ą", "ć", "ĉ", "ċ", "č", "ď", "đ", "ē", "ĕ", "ė", "ę", "ě", "ĝ", "ğ", "ġ", "ģ", "ĥ", "ħ", "ĩ", "ī", "ĭ", "į", "ı", "ij", "ĵ", ["ķ", "ĸ"], "ĺ", "ļ", "ľ", "ŀ", "ł", "ń", "ņ", ["ň", "ʼn"], "ŋ", "ō", "ŏ", "ő", "œ", "ŕ", "ŗ", "ř", "ś", "ŝ", "ş", "š", "ţ", "ť", "ŧ", "ũ", "ū", "ŭ", "ů", "ű", "ų", "ŵ", "ŷ", "ź", "ż", ["ž", "ƀ"], "ƃ", "ƅ", "ƈ", ["ƌ", "ƍ"], "ƒ", "ƕ", ["ƙ", "ƛ"], "ƞ", "ơ", "ƣ", "ƥ", "ƨ", ["ƪ", "ƫ"], "ƭ", "ư", "ƴ", "ƶ", ["ƹ", "ƺ"], ["ƽ", "ƿ"], "dž", "lj", "nj", "ǎ", "ǐ", "ǒ", "ǔ", "ǖ", "ǘ", "ǚ", ["ǜ", "ǝ"], "ǟ", "ǡ", "ǣ", "ǥ", "ǧ", "ǩ", "ǫ", "ǭ", ["ǯ", "ǰ"], "dz", "ǵ", "ǹ", "ǻ", "ǽ", "ǿ", "ȁ", "ȃ", "ȅ", "ȇ", "ȉ", "ȋ", "ȍ", "ȏ", "ȑ", "ȓ", "ȕ", "ȗ", "ș", "ț", "ȝ", "ȟ", "ȡ", "ȣ", "ȥ", "ȧ", "ȩ", "ȫ", "ȭ", "ȯ", "ȱ", ["ȳ", "ȹ"], "ȼ", ["ȿ", "ɀ"], "ɂ", "ɇ", "ɉ", "ɋ", "ɍ", ["ɏ", "ʓ"], ["ʕ", "ʯ"], "ͱ", "ͳ", "ͷ", ["ͻ", "ͽ"], "ΐ", ["ά", "ώ"], ["ϐ", "ϑ"], ["ϕ", "ϗ"], "ϙ", "ϛ", "ϝ", "ϟ", "ϡ", "ϣ", "ϥ", "ϧ", "ϩ", "ϫ", "ϭ", ["ϯ", "ϳ"], "ϵ", "ϸ", ["ϻ", "ϼ"], ["а", "џ"], "ѡ", "ѣ", "ѥ", "ѧ", "ѩ", "ѫ", "ѭ", "ѯ", "ѱ", "ѳ", "ѵ", "ѷ", "ѹ", "ѻ", "ѽ", "ѿ", "ҁ", "ҋ", "ҍ", "ҏ", "ґ", "ғ", "ҕ", "җ", "ҙ", "қ", "ҝ", "ҟ", "ҡ", "ң", "ҥ", "ҧ", "ҩ", "ҫ", "ҭ", "ү", "ұ", "ҳ", "ҵ", "ҷ", "ҹ", "һ", "ҽ", "ҿ", "ӂ", "ӄ", "ӆ", "ӈ", "ӊ", "ӌ", ["ӎ", "ӏ"], "ӑ", "ӓ", "ӕ", "ӗ", "ә", "ӛ", "ӝ", "ӟ", "ӡ", "ӣ", "ӥ", "ӧ", "ө", "ӫ", "ӭ", "ӯ", "ӱ", "ӳ", "ӵ", "ӷ", "ӹ", "ӻ", "ӽ", "ӿ", "ԁ", "ԃ", "ԅ", "ԇ", "ԉ", "ԋ", "ԍ", "ԏ", "ԑ", "ԓ", "ԕ", "ԗ", "ԙ", "ԛ", "ԝ", "ԟ", "ԡ", "ԣ", "ԥ", "ԧ", ["ա", "և"], ["ᴀ", "ᴫ"], ["ᵫ", "ᵷ"], ["ᵹ", "ᶚ"], "ḁ", "ḃ", "ḅ", "ḇ", "ḉ", "ḋ", "ḍ", "ḏ", "ḑ", "ḓ", "ḕ", "ḗ", "ḙ", "ḛ", "ḝ", "ḟ", "ḡ", "ḣ", "ḥ", "ḧ", "ḩ", "ḫ", "ḭ", "ḯ", "ḱ", "ḳ", "ḵ", "ḷ", "ḹ", "ḻ", "ḽ", "ḿ", "ṁ", "ṃ", "ṅ", "ṇ", "ṉ", "ṋ", "ṍ", "ṏ", "ṑ", "ṓ", "ṕ", "ṗ", "ṙ", "ṛ", "ṝ", "ṟ", "ṡ", "ṣ", "ṥ", "ṧ", "ṩ", "ṫ", "ṭ", "ṯ", "ṱ", "ṳ", "ṵ", "ṷ", "ṹ", "ṻ", "ṽ", "ṿ", "ẁ", "ẃ", "ẅ", "ẇ", "ẉ", "ẋ", "ẍ", "ẏ", "ẑ", "ẓ", ["ẕ", "ẝ"], "ẟ", "ạ", "ả", "ấ", "ầ", "ẩ", "ẫ", "ậ", "ắ", "ằ", "ẳ", "ẵ", "ặ", "ẹ", "ẻ", "ẽ", "ế", "ề", "ể", "ễ", "ệ", "ỉ", "ị", "ọ", "ỏ", "ố", "ồ", "ổ", "ỗ", "ộ", "ớ", "ờ", "ở", "ỡ", "ợ", "ụ", "ủ", "ứ", "ừ", "ử", "ữ", "ự", "ỳ", "ỵ", "ỷ", "ỹ", "ỻ", "ỽ", ["ỿ", "ἇ"], ["ἐ", "ἕ"], ["ἠ", "ἧ"], ["ἰ", "ἷ"], ["ὀ", "ὅ"], ["ὐ", "ὗ"], ["ὠ", "ὧ"], ["ὰ", "ώ"], ["ᾀ", "ᾇ"], ["ᾐ", "ᾗ"], ["ᾠ", "ᾧ"], ["ᾰ", "ᾴ"], ["ᾶ", "ᾷ"], "ι", ["ῂ", "ῄ"], ["ῆ", "ῇ"], ["ῐ", "ΐ"], ["ῖ", "ῗ"], ["ῠ", "ῧ"], ["ῲ", "ῴ"], ["ῶ", "ῷ"], "ℊ", ["ℎ", "ℏ"], "ℓ", "ℯ", "ℴ", "ℹ", ["ℼ", "ℽ"], ["ⅆ", "ⅉ"], "ⅎ", "ↄ", ["ⰰ", "ⱞ"], "ⱡ", ["ⱥ", "ⱦ"], "ⱨ", "ⱪ", "ⱬ", "ⱱ", ["ⱳ", "ⱴ"], ["ⱶ", "ⱻ"], "ⲁ", "ⲃ", "ⲅ", "ⲇ", "ⲉ", "ⲋ", "ⲍ", "ⲏ", "ⲑ", "ⲓ", "ⲕ", "ⲗ", "ⲙ", "ⲛ", "ⲝ", "ⲟ", "ⲡ", "ⲣ", "ⲥ", "ⲧ", "ⲩ", "ⲫ", "ⲭ", "ⲯ", "ⲱ", "ⲳ", "ⲵ", "ⲷ", "ⲹ", "ⲻ", "ⲽ", "ⲿ", "ⳁ", "ⳃ", "ⳅ", "ⳇ", "ⳉ", "ⳋ", "ⳍ", "ⳏ", "ⳑ", "ⳓ", "ⳕ", "ⳗ", "ⳙ", "ⳛ", "ⳝ", "ⳟ", "ⳡ", ["ⳣ", "ⳤ"], "ⳬ", "ⳮ", "ⳳ", ["ⴀ", "ⴥ"], "ⴧ", "ⴭ", "ꙁ", "ꙃ", "ꙅ", "ꙇ", "ꙉ", "ꙋ", "ꙍ", "ꙏ", "ꙑ", "ꙓ", "ꙕ", "ꙗ", "ꙙ", "ꙛ", "ꙝ", "ꙟ", "ꙡ", "ꙣ", "ꙥ", "ꙧ", "ꙩ", "ꙫ", "ꙭ", "ꚁ", "ꚃ", "ꚅ", "ꚇ", "ꚉ", "ꚋ", "ꚍ", "ꚏ", "ꚑ", "ꚓ", "ꚕ", "ꚗ", "ꜣ", "ꜥ", "ꜧ", "ꜩ", "ꜫ", "ꜭ", ["ꜯ", "ꜱ"], "ꜳ", "ꜵ", "ꜷ", "ꜹ", "ꜻ", "ꜽ", "ꜿ", "ꝁ", "ꝃ", "ꝅ", "ꝇ", "ꝉ", "ꝋ", "ꝍ", "ꝏ", "ꝑ", "ꝓ", "ꝕ", "ꝗ", "ꝙ", "ꝛ", "ꝝ", "ꝟ", "ꝡ", "ꝣ", "ꝥ", "ꝧ", "ꝩ", "ꝫ", "ꝭ", "ꝯ", ["ꝱ", "ꝸ"], "ꝺ", "ꝼ", "ꝿ", "ꞁ", "ꞃ", "ꞅ", "ꞇ", "ꞌ", "ꞎ", "ꞑ", "ꞓ", "ꞡ", "ꞣ", "ꞥ", "ꞧ", "ꞩ", "ꟺ", ["ff", "st"], ["ﬓ", "ﬗ"], ["a", "z"]], false, false);
|
|
584
|
+
var peg$e55 = peg$classExpectation([["ʰ", "ˁ"], ["ˆ", "ˑ"], ["ˠ", "ˤ"], "ˬ", "ˮ", "ʹ", "ͺ", "ՙ", "ـ", ["ۥ", "ۦ"], ["ߴ", "ߵ"], "ߺ", "ࠚ", "ࠤ", "ࠨ", "ॱ", "ๆ", "ໆ", "ჼ", "ៗ", "ᡃ", "ᪧ", ["ᱸ", "ᱽ"], ["ᴬ", "ᵪ"], "ᵸ", ["ᶛ", "ᶿ"], "ⁱ", "ⁿ", ["ₐ", "ₜ"], ["ⱼ", "ⱽ"], "ⵯ", "ⸯ", "々", ["〱", "〵"], "〻", ["ゝ", "ゞ"], ["ー", "ヾ"], "ꀕ", ["ꓸ", "ꓽ"], "ꘌ", "ꙿ", ["ꜗ", "ꜟ"], "ꝰ", "ꞈ", ["ꟸ", "ꟹ"], "ꧏ", "ꩰ", "ꫝ", ["ꫳ", "ꫴ"], "ー", ["゙", "゚"]], false, false);
|
|
585
|
+
var peg$e56 = peg$classExpectation(["ª", "º", "ƻ", ["ǀ", "ǃ"], "ʔ", ["א", "ת"], ["װ", "ײ"], ["ؠ", "ؿ"], ["ف", "ي"], ["ٮ", "ٯ"], ["ٱ", "ۓ"], "ە", ["ۮ", "ۯ"], ["ۺ", "ۼ"], "ۿ", "ܐ", ["ܒ", "ܯ"], ["ݍ", "ޥ"], "ޱ", ["ߊ", "ߪ"], ["ࠀ", "ࠕ"], ["ࡀ", "ࡘ"], "ࢠ", ["ࢢ", "ࢬ"], ["ऄ", "ह"], "ऽ", "ॐ", ["क़", "ॡ"], ["ॲ", "ॷ"], ["ॹ", "ॿ"], ["অ", "ঌ"], ["এ", "ঐ"], ["ও", "ন"], ["প", "র"], "ল", ["শ", "হ"], "ঽ", "ৎ", ["ড়", "ঢ়"], ["য়", "ৡ"], ["ৰ", "ৱ"], ["ਅ", "ਊ"], ["ਏ", "ਐ"], ["ਓ", "ਨ"], ["ਪ", "ਰ"], ["ਲ", "ਲ਼"], ["ਵ", "ਸ਼"], ["ਸ", "ਹ"], ["ਖ਼", "ੜ"], "ਫ਼", ["ੲ", "ੴ"], ["અ", "ઍ"], ["એ", "ઑ"], ["ઓ", "ન"], ["પ", "ર"], ["લ", "ળ"], ["વ", "હ"], "ઽ", "ૐ", ["ૠ", "ૡ"], ["ଅ", "ଌ"], ["ଏ", "ଐ"], ["ଓ", "ନ"], ["ପ", "ର"], ["ଲ", "ଳ"], ["ଵ", "ହ"], "ଽ", ["ଡ଼", "ଢ଼"], ["ୟ", "ୡ"], "ୱ", "ஃ", ["அ", "ஊ"], ["எ", "ஐ"], ["ஒ", "க"], ["ங", "ச"], "ஜ", ["ஞ", "ட"], ["ண", "த"], ["ந", "ப"], ["ம", "ஹ"], "ௐ", ["అ", "ఌ"], ["ఎ", "ఐ"], ["ఒ", "న"], ["ప", "ళ"], ["వ", "హ"], "ఽ", ["ౘ", "ౙ"], ["ౠ", "ౡ"], ["ಅ", "ಌ"], ["ಎ", "ಐ"], ["ಒ", "ನ"], ["ಪ", "ಳ"], ["ವ", "ಹ"], "ಽ", "ೞ", ["ೠ", "ೡ"], ["ೱ", "ೲ"], ["അ", "ഌ"], ["എ", "ഐ"], ["ഒ", "ഺ"], "ഽ", "ൎ", ["ൠ", "ൡ"], ["ൺ", "ൿ"], ["අ", "ඖ"], ["ක", "න"], ["ඳ", "ර"], "ල", ["ව", "ෆ"], ["ก", "ะ"], ["า", "ำ"], ["เ", "ๅ"], ["ກ", "ຂ"], "ຄ", ["ງ", "ຈ"], "ຊ", "ຍ", ["ດ", "ທ"], ["ນ", "ຟ"], ["ມ", "ຣ"], "ລ", "ວ", ["ສ", "ຫ"], ["ອ", "ະ"], ["າ", "ຳ"], "ຽ", ["ເ", "ໄ"], ["ໜ", "ໟ"], "ༀ", ["ཀ", "ཇ"], ["ཉ", "ཬ"], ["ྈ", "ྌ"], ["က", "ဪ"], "ဿ", ["ၐ", "ၕ"], ["ၚ", "ၝ"], "ၡ", ["ၥ", "ၦ"], ["ၮ", "ၰ"], ["ၵ", "ႁ"], "ႎ", ["ა", "ჺ"], ["ჽ", "ቈ"], ["ቊ", "ቍ"], ["ቐ", "ቖ"], "ቘ", ["ቚ", "ቝ"], ["በ", "ኈ"], ["ኊ", "ኍ"], ["ነ", "ኰ"], ["ኲ", "ኵ"], ["ኸ", "ኾ"], "ዀ", ["ዂ", "ዅ"], ["ወ", "ዖ"], ["ዘ", "ጐ"], ["ጒ", "ጕ"], ["ጘ", "ፚ"], ["ᎀ", "ᎏ"], ["Ꭰ", "Ᏼ"], ["ᐁ", "ᙬ"], ["ᙯ", "ᙿ"], ["ᚁ", "ᚚ"], ["ᚠ", "ᛪ"], ["ᜀ", "ᜌ"], ["ᜎ", "ᜑ"], ["ᜠ", "ᜱ"], ["ᝀ", "ᝑ"], ["ᝠ", "ᝬ"], ["ᝮ", "ᝰ"], ["ក", "ឳ"], "ៜ", ["ᠠ", "ᡂ"], ["ᡄ", "ᡷ"], ["ᢀ", "ᢨ"], "ᢪ", ["ᢰ", "ᣵ"], ["ᤀ", "ᤜ"], ["ᥐ", "ᥭ"], ["ᥰ", "ᥴ"], ["ᦀ", "ᦫ"], ["ᧁ", "ᧇ"], ["ᨀ", "ᨖ"], ["ᨠ", "ᩔ"], ["ᬅ", "ᬳ"], ["ᭅ", "ᭋ"], ["ᮃ", "ᮠ"], ["ᮮ", "ᮯ"], ["ᮺ", "ᯥ"], ["ᰀ", "ᰣ"], ["ᱍ", "ᱏ"], ["ᱚ", "ᱷ"], ["ᳩ", "ᳬ"], ["ᳮ", "ᳱ"], ["ᳵ", "ᳶ"], ["ℵ", "ℸ"], ["ⴰ", "ⵧ"], ["ⶀ", "ⶖ"], ["ⶠ", "ⶦ"], ["ⶨ", "ⶮ"], ["ⶰ", "ⶶ"], ["ⶸ", "ⶾ"], ["ⷀ", "ⷆ"], ["ⷈ", "ⷎ"], ["ⷐ", "ⷖ"], ["ⷘ", "ⷞ"], "〆", "〼", ["ぁ", "ゖ"], "ゟ", ["ァ", "ヺ"], "ヿ", ["ㄅ", "ㄭ"], ["ㄱ", "ㆎ"], ["ㆠ", "ㆺ"], ["ㇰ", "ㇿ"], ["㐀", "䶵"], ["一", "鿌"], ["ꀀ", "ꀔ"], ["ꀖ", "ꒌ"], ["ꓐ", "ꓷ"], ["ꔀ", "ꘋ"], ["ꘐ", "ꘟ"], ["ꘪ", "ꘫ"], "ꙮ", ["ꚠ", "ꛥ"], ["ꟻ", "ꠁ"], ["ꠃ", "ꠅ"], ["ꠇ", "ꠊ"], ["ꠌ", "ꠢ"], ["ꡀ", "ꡳ"], ["ꢂ", "ꢳ"], ["ꣲ", "ꣷ"], "ꣻ", ["ꤊ", "ꤥ"], ["ꤰ", "ꥆ"], ["ꥠ", "ꥼ"], ["ꦄ", "ꦲ"], ["ꨀ", "ꨨ"], ["ꩀ", "ꩂ"], ["ꩄ", "ꩋ"], ["ꩠ", "ꩯ"], ["ꩱ", "ꩶ"], "ꩺ", ["ꪀ", "ꪯ"], "ꪱ", ["ꪵ", "ꪶ"], ["ꪹ", "ꪽ"], "ꫀ", "ꫂ", ["ꫛ", "ꫜ"], ["ꫠ", "ꫪ"], "ꫲ", ["ꬁ", "ꬆ"], ["ꬉ", "ꬎ"], ["ꬑ", "ꬖ"], ["ꬠ", "ꬦ"], ["ꬨ", "ꬮ"], ["ꯀ", "ꯢ"], ["가", "힣"], ["ힰ", "ퟆ"], ["ퟋ", "ퟻ"], ["豈", "舘"], ["並", "龎"], "יִ", ["ײַ", "ﬨ"], ["שׁ", "זּ"], ["טּ", "לּ"], "מּ", ["נּ", "סּ"], ["ףּ", "פּ"], ["צּ", "ﮱ"], ["ﯓ", "ﴽ"], ["ﵐ", "ﶏ"], ["ﶒ", "ﷇ"], ["ﷰ", "ﷻ"], ["ﹰ", "ﹴ"], ["ﹶ", "ﻼ"], ["ヲ", "ッ"], ["ア", "ン"], ["ᅠ", "ᄒ"], ["ᅡ", "ᅦ"], ["ᅧ", "ᅬ"], ["ᅭ", "ᅲ"], ["ᅳ", "ᅵ"]], false, false);
|
|
586
|
+
var peg$e57 = peg$classExpectation(["Dž", "Lj", "Nj", "Dz", ["ᾈ", "ᾏ"], ["ᾘ", "ᾟ"], ["ᾨ", "ᾯ"], "ᾼ", "ῌ", "ῼ"], false, false);
|
|
587
|
+
var peg$e58 = peg$classExpectation([["A", "Z"], ["À", "Ö"], ["Ø", "Þ"], "Ā", "Ă", "Ą", "Ć", "Ĉ", "Ċ", "Č", "Ď", "Đ", "Ē", "Ĕ", "Ė", "Ę", "Ě", "Ĝ", "Ğ", "Ġ", "Ģ", "Ĥ", "Ħ", "Ĩ", "Ī", "Ĭ", "Į", "İ", "IJ", "Ĵ", "Ķ", "Ĺ", "Ļ", "Ľ", "Ŀ", "Ł", "Ń", "Ņ", "Ň", "Ŋ", "Ō", "Ŏ", "Ő", "Œ", "Ŕ", "Ŗ", "Ř", "Ś", "Ŝ", "Ş", "Š", "Ţ", "Ť", "Ŧ", "Ũ", "Ū", "Ŭ", "Ů", "Ű", "Ų", "Ŵ", "Ŷ", ["Ÿ", "Ź"], "Ż", "Ž", ["Ɓ", "Ƃ"], "Ƅ", ["Ɔ", "Ƈ"], ["Ɖ", "Ƌ"], ["Ǝ", "Ƒ"], ["Ɠ", "Ɣ"], ["Ɩ", "Ƙ"], ["Ɯ", "Ɲ"], ["Ɵ", "Ơ"], "Ƣ", "Ƥ", ["Ʀ", "Ƨ"], "Ʃ", "Ƭ", ["Ʈ", "Ư"], ["Ʊ", "Ƴ"], "Ƶ", ["Ʒ", "Ƹ"], "Ƽ", "DŽ", "LJ", "NJ", "Ǎ", "Ǐ", "Ǒ", "Ǔ", "Ǖ", "Ǘ", "Ǚ", "Ǜ", "Ǟ", "Ǡ", "Ǣ", "Ǥ", "Ǧ", "Ǩ", "Ǫ", "Ǭ", "Ǯ", "DZ", "Ǵ", ["Ƕ", "Ǹ"], "Ǻ", "Ǽ", "Ǿ", "Ȁ", "Ȃ", "Ȅ", "Ȇ", "Ȉ", "Ȋ", "Ȍ", "Ȏ", "Ȑ", "Ȓ", "Ȕ", "Ȗ", "Ș", "Ț", "Ȝ", "Ȟ", "Ƞ", "Ȣ", "Ȥ", "Ȧ", "Ȩ", "Ȫ", "Ȭ", "Ȯ", "Ȱ", "Ȳ", ["Ⱥ", "Ȼ"], ["Ƚ", "Ⱦ"], "Ɂ", ["Ƀ", "Ɇ"], "Ɉ", "Ɋ", "Ɍ", "Ɏ", "Ͱ", "Ͳ", "Ͷ", "Ά", ["Έ", "Ί"], "Ό", ["Ύ", "Ώ"], ["Α", "Ρ"], ["Σ", "Ϋ"], "Ϗ", ["ϒ", "ϔ"], "Ϙ", "Ϛ", "Ϝ", "Ϟ", "Ϡ", "Ϣ", "Ϥ", "Ϧ", "Ϩ", "Ϫ", "Ϭ", "Ϯ", "ϴ", "Ϸ", ["Ϲ", "Ϻ"], ["Ͻ", "Я"], "Ѡ", "Ѣ", "Ѥ", "Ѧ", "Ѩ", "Ѫ", "Ѭ", "Ѯ", "Ѱ", "Ѳ", "Ѵ", "Ѷ", "Ѹ", "Ѻ", "Ѽ", "Ѿ", "Ҁ", "Ҋ", "Ҍ", "Ҏ", "Ґ", "Ғ", "Ҕ", "Җ", "Ҙ", "Қ", "Ҝ", "Ҟ", "Ҡ", "Ң", "Ҥ", "Ҧ", "Ҩ", "Ҫ", "Ҭ", "Ү", "Ұ", "Ҳ", "Ҵ", "Ҷ", "Ҹ", "Һ", "Ҽ", "Ҿ", ["Ӏ", "Ӂ"], "Ӄ", "Ӆ", "Ӈ", "Ӊ", "Ӌ", "Ӎ", "Ӑ", "Ӓ", "Ӕ", "Ӗ", "Ә", "Ӛ", "Ӝ", "Ӟ", "Ӡ", "Ӣ", "Ӥ", "Ӧ", "Ө", "Ӫ", "Ӭ", "Ӯ", "Ӱ", "Ӳ", "Ӵ", "Ӷ", "Ӹ", "Ӻ", "Ӽ", "Ӿ", "Ԁ", "Ԃ", "Ԅ", "Ԇ", "Ԉ", "Ԋ", "Ԍ", "Ԏ", "Ԑ", "Ԓ", "Ԕ", "Ԗ", "Ԙ", "Ԛ", "Ԝ", "Ԟ", "Ԡ", "Ԣ", "Ԥ", "Ԧ", ["Ա", "Ֆ"], ["Ⴀ", "Ⴥ"], "Ⴧ", "Ⴭ", "Ḁ", "Ḃ", "Ḅ", "Ḇ", "Ḉ", "Ḋ", "Ḍ", "Ḏ", "Ḑ", "Ḓ", "Ḕ", "Ḗ", "Ḙ", "Ḛ", "Ḝ", "Ḟ", "Ḡ", "Ḣ", "Ḥ", "Ḧ", "Ḩ", "Ḫ", "Ḭ", "Ḯ", "Ḱ", "Ḳ", "Ḵ", "Ḷ", "Ḹ", "Ḻ", "Ḽ", "Ḿ", "Ṁ", "Ṃ", "Ṅ", "Ṇ", "Ṉ", "Ṋ", "Ṍ", "Ṏ", "Ṑ", "Ṓ", "Ṕ", "Ṗ", "Ṙ", "Ṛ", "Ṝ", "Ṟ", "Ṡ", "Ṣ", "Ṥ", "Ṧ", "Ṩ", "Ṫ", "Ṭ", "Ṯ", "Ṱ", "Ṳ", "Ṵ", "Ṷ", "Ṹ", "Ṻ", "Ṽ", "Ṿ", "Ẁ", "Ẃ", "Ẅ", "Ẇ", "Ẉ", "Ẋ", "Ẍ", "Ẏ", "Ẑ", "Ẓ", "Ẕ", "ẞ", "Ạ", "Ả", "Ấ", "Ầ", "Ẩ", "Ẫ", "Ậ", "Ắ", "Ằ", "Ẳ", "Ẵ", "Ặ", "Ẹ", "Ẻ", "Ẽ", "Ế", "Ề", "Ể", "Ễ", "Ệ", "Ỉ", "Ị", "Ọ", "Ỏ", "Ố", "Ồ", "Ổ", "Ỗ", "Ộ", "Ớ", "Ờ", "Ở", "Ỡ", "Ợ", "Ụ", "Ủ", "Ứ", "Ừ", "Ử", "Ữ", "Ự", "Ỳ", "Ỵ", "Ỷ", "Ỹ", "Ỻ", "Ỽ", "Ỿ", ["Ἀ", "Ἇ"], ["Ἐ", "Ἕ"], ["Ἠ", "Ἧ"], ["Ἰ", "Ἷ"], ["Ὀ", "Ὅ"], "Ὑ", "Ὓ", "Ὕ", "Ὗ", ["Ὠ", "Ὧ"], ["Ᾰ", "Ά"], ["Ὲ", "Ή"], ["Ῐ", "Ί"], ["Ῠ", "Ῥ"], ["Ὸ", "Ώ"], "ℂ", "ℇ", ["ℋ", "ℍ"], ["ℐ", "ℒ"], "ℕ", ["ℙ", "ℝ"], "ℤ", "Ω", "ℨ", ["K", "ℭ"], ["ℰ", "ℳ"], ["ℾ", "ℿ"], "ⅅ", "Ↄ", ["Ⰰ", "Ⱞ"], "Ⱡ", ["Ɫ", "Ɽ"], "Ⱨ", "Ⱪ", "Ⱬ", ["Ɑ", "Ɒ"], "Ⱳ", "Ⱶ", ["Ȿ", "Ⲁ"], "Ⲃ", "Ⲅ", "Ⲇ", "Ⲉ", "Ⲋ", "Ⲍ", "Ⲏ", "Ⲑ", "Ⲓ", "Ⲕ", "Ⲗ", "Ⲙ", "Ⲛ", "Ⲝ", "Ⲟ", "Ⲡ", "Ⲣ", "Ⲥ", "Ⲧ", "Ⲩ", "Ⲫ", "Ⲭ", "Ⲯ", "Ⲱ", "Ⲳ", "Ⲵ", "Ⲷ", "Ⲹ", "Ⲻ", "Ⲽ", "Ⲿ", "Ⳁ", "Ⳃ", "Ⳅ", "Ⳇ", "Ⳉ", "Ⳋ", "Ⳍ", "Ⳏ", "Ⳑ", "Ⳓ", "Ⳕ", "Ⳗ", "Ⳙ", "Ⳛ", "Ⳝ", "Ⳟ", "Ⳡ", "Ⳣ", "Ⳬ", "Ⳮ", "Ⳳ", "Ꙁ", "Ꙃ", "Ꙅ", "Ꙇ", "Ꙉ", "Ꙋ", "Ꙍ", "Ꙏ", "Ꙑ", "Ꙓ", "Ꙕ", "Ꙗ", "Ꙙ", "Ꙛ", "Ꙝ", "Ꙟ", "Ꙡ", "Ꙣ", "Ꙥ", "Ꙧ", "Ꙩ", "Ꙫ", "Ꙭ", "Ꚁ", "Ꚃ", "Ꚅ", "Ꚇ", "Ꚉ", "Ꚋ", "Ꚍ", "Ꚏ", "Ꚑ", "Ꚓ", "Ꚕ", "Ꚗ", "Ꜣ", "Ꜥ", "Ꜧ", "Ꜩ", "Ꜫ", "Ꜭ", "Ꜯ", "Ꜳ", "Ꜵ", "Ꜷ", "Ꜹ", "Ꜻ", "Ꜽ", "Ꜿ", "Ꝁ", "Ꝃ", "Ꝅ", "Ꝇ", "Ꝉ", "Ꝋ", "Ꝍ", "Ꝏ", "Ꝑ", "Ꝓ", "Ꝕ", "Ꝗ", "Ꝙ", "Ꝛ", "Ꝝ", "Ꝟ", "Ꝡ", "Ꝣ", "Ꝥ", "Ꝧ", "Ꝩ", "Ꝫ", "Ꝭ", "Ꝯ", "Ꝺ", "Ꝼ", ["Ᵹ", "Ꝿ"], "Ꞁ", "Ꞃ", "Ꞅ", "Ꞇ", "Ꞌ", "Ɥ", "Ꞑ", "Ꞓ", "Ꞡ", "Ꞣ", "Ꞥ", "Ꞧ", "Ꞩ", "Ɦ", ["A", "Z"]], false, false);
|
|
588
|
+
var peg$e59 = peg$classExpectation([["ᛮ", "ᛰ"], ["Ⅰ", "ↂ"], ["ↅ", "ↈ"], "〇", ["〡", "〩"], ["〸", "〺"], ["ꛦ", "ꛯ"]], false, false);
|
|
589
|
+
var peg$e60 = peg$classExpectation([["0", "9"], ["٠", "٩"], ["۰", "۹"], ["߀", "߉"], ["०", "९"], ["০", "৯"], ["੦", "੯"], ["૦", "૯"], ["୦", "୯"], ["௦", "௯"], ["౦", "౯"], ["೦", "೯"], ["൦", "൯"], ["๐", "๙"], ["໐", "໙"], ["༠", "༩"], ["၀", "၉"], ["႐", "႙"], ["០", "៩"], ["᠐", "᠙"], ["᥆", "᥏"], ["᧐", "᧙"], ["᪀", "᪉"], ["᪐", "᪙"], ["᭐", "᭙"], ["᮰", "᮹"], ["᱀", "᱉"], ["᱐", "᱙"], ["꘠", "꘩"], ["꣐", "꣙"], ["꤀", "꤉"], ["꧐", "꧙"], ["꩐", "꩙"], ["꯰", "꯹"], ["0", "9"]], false, false);
|
|
590
|
+
var peg$f0 = function(v) {
|
|
591
|
+
return v;
|
|
592
|
+
};
|
|
593
|
+
var peg$f1 = function(v) {
|
|
594
|
+
return v;
|
|
595
|
+
};
|
|
596
|
+
var peg$f2 = function(v) {
|
|
597
|
+
return v;
|
|
598
|
+
};
|
|
599
|
+
var peg$f3 = function(v) {
|
|
600
|
+
return v;
|
|
601
|
+
};
|
|
602
|
+
var peg$f4 = function(v) {
|
|
603
|
+
return v;
|
|
604
|
+
};
|
|
605
|
+
var peg$f5 = function(v) {
|
|
606
|
+
return v;
|
|
607
|
+
};
|
|
608
|
+
var peg$f6 = function(v) {
|
|
609
|
+
return v;
|
|
610
|
+
};
|
|
611
|
+
var peg$f7 = function(v) {
|
|
612
|
+
return v;
|
|
613
|
+
};
|
|
614
|
+
var peg$f8 = function(v) {
|
|
615
|
+
return v;
|
|
616
|
+
};
|
|
617
|
+
var peg$f9 = function(v) {
|
|
618
|
+
return v;
|
|
619
|
+
};
|
|
620
|
+
var peg$f10 = function(c1, graph, c2) {
|
|
621
|
+
return b.createElement("Dot", {}, [...c1, graph, ...c2]);
|
|
622
|
+
};
|
|
623
|
+
var peg$f11 = function(_strict, _kind, id, children) {
|
|
624
|
+
const strict = !!_strict;
|
|
625
|
+
const kind = _kind.toLowerCase();
|
|
626
|
+
const directed = kind === "digraph";
|
|
627
|
+
for (const edgeop of edgeops) {
|
|
628
|
+
if (directed) {
|
|
629
|
+
if (edgeop.operator !== "->") {
|
|
630
|
+
error(`In digraph, it's necessary to describe with "->" operator to create edge.`, edgeop.location);
|
|
631
|
+
}
|
|
632
|
+
} else {
|
|
633
|
+
if (edgeop.operator !== "--") {
|
|
634
|
+
error(`In graph, it's necessary to describe with "--" operator to create edge.`, edgeop.location);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return b.createElement(
|
|
639
|
+
// @ts-ignore
|
|
640
|
+
"Graph",
|
|
641
|
+
// @ts-ignore
|
|
642
|
+
id !== null ? {
|
|
643
|
+
// @ts-ignore
|
|
644
|
+
id,
|
|
645
|
+
// @ts-ignore
|
|
646
|
+
directed,
|
|
647
|
+
// @ts-ignore
|
|
648
|
+
strict
|
|
649
|
+
} : {
|
|
650
|
+
// @ts-ignore
|
|
651
|
+
directed,
|
|
652
|
+
// @ts-ignore
|
|
653
|
+
strict
|
|
654
|
+
},
|
|
655
|
+
// @ts-ignore
|
|
656
|
+
children
|
|
657
|
+
);
|
|
658
|
+
};
|
|
659
|
+
var peg$f12 = function(keyValue) {
|
|
660
|
+
return b.createElement(
|
|
661
|
+
// @ts-ignore
|
|
662
|
+
"Attribute",
|
|
663
|
+
{
|
|
664
|
+
// @ts-ignore
|
|
665
|
+
...keyValue
|
|
666
|
+
},
|
|
667
|
+
[]
|
|
668
|
+
);
|
|
669
|
+
};
|
|
670
|
+
var peg$f13 = function(_kind, children) {
|
|
671
|
+
return b.createElement(
|
|
672
|
+
// @ts-ignore
|
|
673
|
+
"AttributeList",
|
|
674
|
+
{
|
|
675
|
+
// @ts-ignore
|
|
676
|
+
kind: `${_kind.slice(0, 1).toUpperCase()}${_kind.slice(1).toLowerCase()}`
|
|
677
|
+
},
|
|
678
|
+
// @ts-ignore
|
|
679
|
+
children
|
|
680
|
+
);
|
|
681
|
+
};
|
|
682
|
+
var peg$f14 = function(id, rhs, _children) {
|
|
683
|
+
return b.createElement(
|
|
684
|
+
// @ts-ignore
|
|
685
|
+
// @ts-ignore
|
|
686
|
+
"Edge",
|
|
687
|
+
{
|
|
688
|
+
// @ts-ignore
|
|
689
|
+
targets: [id, ...rhs]
|
|
690
|
+
},
|
|
691
|
+
// @ts-ignore
|
|
692
|
+
_children ?? []
|
|
693
|
+
);
|
|
694
|
+
};
|
|
695
|
+
var peg$f15 = function(id, _children) {
|
|
696
|
+
return b.createElement(
|
|
697
|
+
// @ts-ignore
|
|
698
|
+
"Node",
|
|
699
|
+
{
|
|
700
|
+
// @ts-ignore
|
|
701
|
+
id
|
|
702
|
+
},
|
|
703
|
+
// @ts-ignore
|
|
704
|
+
_children ?? []
|
|
705
|
+
);
|
|
706
|
+
};
|
|
707
|
+
var peg$f16 = function(key, value) {
|
|
708
|
+
return { key, value };
|
|
709
|
+
};
|
|
710
|
+
var peg$f17 = function(kv) {
|
|
711
|
+
return b.createElement(
|
|
712
|
+
// @ts-ignore
|
|
713
|
+
"Attribute",
|
|
714
|
+
{
|
|
715
|
+
// @ts-ignore
|
|
716
|
+
...kv,
|
|
717
|
+
// @ts-ignore
|
|
718
|
+
location: location()
|
|
719
|
+
},
|
|
720
|
+
[]
|
|
721
|
+
);
|
|
722
|
+
};
|
|
723
|
+
var peg$f18 = function(list) {
|
|
724
|
+
return list;
|
|
725
|
+
};
|
|
726
|
+
var peg$f19 = function(id, v) {
|
|
727
|
+
return v;
|
|
728
|
+
};
|
|
729
|
+
var peg$f20 = function(id, rest) {
|
|
730
|
+
return b.createElement("NodeRefGroup", {}, [id, ...rest]);
|
|
731
|
+
};
|
|
732
|
+
var peg$f21 = function(operator) {
|
|
733
|
+
return { operator, location: location() };
|
|
734
|
+
};
|
|
735
|
+
var peg$f22 = function(edgeop, id, rest) {
|
|
736
|
+
edgeops.push(edgeop);
|
|
737
|
+
return [id].concat(rest || []);
|
|
738
|
+
};
|
|
739
|
+
var peg$f23 = function(id, port) {
|
|
740
|
+
return b.createElement(
|
|
741
|
+
// @ts-ignore
|
|
742
|
+
"NodeRef",
|
|
743
|
+
{
|
|
744
|
+
// @ts-ignore
|
|
745
|
+
id,
|
|
746
|
+
// @ts-ignore
|
|
747
|
+
...port
|
|
748
|
+
},
|
|
749
|
+
[]
|
|
750
|
+
);
|
|
751
|
+
};
|
|
752
|
+
var peg$f24 = function(port, compass) {
|
|
753
|
+
return compass;
|
|
754
|
+
};
|
|
755
|
+
var peg$f25 = function(port, compass) {
|
|
756
|
+
if (["n", "ne", "e", "se", "s", "sw", "w", "nw"].includes(port)) {
|
|
757
|
+
return { compass: port };
|
|
758
|
+
} else if (compass) {
|
|
759
|
+
return { port, compass };
|
|
760
|
+
}
|
|
761
|
+
return { port };
|
|
762
|
+
};
|
|
763
|
+
var peg$f26 = function(id) {
|
|
764
|
+
return id;
|
|
765
|
+
};
|
|
766
|
+
var peg$f27 = function(id, _children) {
|
|
767
|
+
const children = _children ?? [];
|
|
768
|
+
return b.createElement("Subgraph", id ? { id } : {}, children);
|
|
769
|
+
};
|
|
770
|
+
var peg$f28 = function(value) {
|
|
771
|
+
return { value, quoted: false };
|
|
772
|
+
};
|
|
773
|
+
var peg$f29 = function(value) {
|
|
774
|
+
return { value, quoted: true };
|
|
775
|
+
};
|
|
776
|
+
var peg$f30 = function(v) {
|
|
777
|
+
return b.createElement(
|
|
778
|
+
// @ts-ignore
|
|
779
|
+
"Literal",
|
|
780
|
+
{
|
|
781
|
+
// @ts-ignore
|
|
782
|
+
...v
|
|
783
|
+
},
|
|
784
|
+
[]
|
|
785
|
+
);
|
|
786
|
+
};
|
|
787
|
+
var peg$f31 = function(value) {
|
|
788
|
+
return b.createElement(
|
|
789
|
+
// @ts-ignore
|
|
790
|
+
"Literal",
|
|
791
|
+
{
|
|
792
|
+
// @ts-ignore
|
|
793
|
+
value,
|
|
794
|
+
// @ts-ignore
|
|
795
|
+
quoted: false
|
|
796
|
+
},
|
|
797
|
+
[]
|
|
798
|
+
);
|
|
799
|
+
};
|
|
800
|
+
var peg$f32 = function(v) {
|
|
801
|
+
return v;
|
|
802
|
+
};
|
|
803
|
+
var peg$f33 = function(v) {
|
|
804
|
+
return b.createElement(
|
|
805
|
+
// @ts-ignore
|
|
806
|
+
"Comment",
|
|
807
|
+
{
|
|
808
|
+
// @ts-ignore
|
|
809
|
+
kind: "Block",
|
|
810
|
+
// @ts-ignore
|
|
811
|
+
value: dedent(v.join("").replace(/[ \t]*\*/g, ""))
|
|
812
|
+
},
|
|
813
|
+
[]
|
|
814
|
+
);
|
|
815
|
+
};
|
|
816
|
+
var peg$f34 = function(lines) {
|
|
817
|
+
return b.createElement(
|
|
818
|
+
// @ts-ignore
|
|
819
|
+
"Comment",
|
|
820
|
+
{
|
|
821
|
+
// @ts-ignore
|
|
822
|
+
kind: "Slash",
|
|
823
|
+
// @ts-ignore
|
|
824
|
+
value: dedent(lines.join("\n"))
|
|
825
|
+
},
|
|
826
|
+
[]
|
|
827
|
+
);
|
|
828
|
+
};
|
|
829
|
+
var peg$f35 = function(v) {
|
|
830
|
+
return v;
|
|
831
|
+
};
|
|
832
|
+
var peg$f36 = function(v) {
|
|
833
|
+
return v.join("");
|
|
834
|
+
};
|
|
835
|
+
var peg$f37 = function(lines) {
|
|
836
|
+
return b.createElement(
|
|
837
|
+
// @ts-ignore
|
|
838
|
+
"Comment",
|
|
839
|
+
{
|
|
840
|
+
// @ts-ignore
|
|
841
|
+
kind: "Macro",
|
|
842
|
+
// @ts-ignore
|
|
843
|
+
value: dedent(lines.join("\n"))
|
|
844
|
+
},
|
|
845
|
+
[]
|
|
846
|
+
);
|
|
847
|
+
};
|
|
848
|
+
var peg$f38 = function(v) {
|
|
849
|
+
return v;
|
|
850
|
+
};
|
|
851
|
+
var peg$f39 = function(v) {
|
|
852
|
+
return v.join("");
|
|
853
|
+
};
|
|
854
|
+
var peg$f40 = function(first, rest) {
|
|
855
|
+
return first + rest.join("");
|
|
856
|
+
};
|
|
857
|
+
var peg$f41 = function(first, rest) {
|
|
858
|
+
return first + rest;
|
|
859
|
+
};
|
|
860
|
+
var peg$f42 = function(n) {
|
|
861
|
+
return text();
|
|
862
|
+
};
|
|
863
|
+
var peg$f43 = function(v) {
|
|
864
|
+
return b.createElement(
|
|
865
|
+
// @ts-ignore
|
|
866
|
+
"Literal",
|
|
867
|
+
{
|
|
868
|
+
// @ts-ignore
|
|
869
|
+
value: v.slice(1, v.length - 1),
|
|
870
|
+
// @ts-ignore
|
|
871
|
+
quoted: "html"
|
|
872
|
+
},
|
|
873
|
+
[]
|
|
874
|
+
);
|
|
875
|
+
};
|
|
876
|
+
var peg$f44 = function(v) {
|
|
877
|
+
return "<" + v.join("") + ">";
|
|
878
|
+
};
|
|
879
|
+
var peg$f45 = function(v) {
|
|
880
|
+
return v;
|
|
881
|
+
};
|
|
882
|
+
var peg$f46 = function(v) {
|
|
883
|
+
return v.join("");
|
|
884
|
+
};
|
|
885
|
+
var peg$f47 = function(chars) {
|
|
886
|
+
return b.createElement(
|
|
887
|
+
// @ts-ignore
|
|
888
|
+
"Literal",
|
|
889
|
+
{
|
|
890
|
+
// @ts-ignore
|
|
891
|
+
value: chars.join(""),
|
|
892
|
+
// @ts-ignore
|
|
893
|
+
quoted: true
|
|
894
|
+
},
|
|
895
|
+
[]
|
|
896
|
+
);
|
|
897
|
+
};
|
|
898
|
+
var peg$f48 = function() {
|
|
899
|
+
return text();
|
|
900
|
+
};
|
|
901
|
+
var peg$f49 = function(v) {
|
|
902
|
+
return v[1] === '"' ? '"' : v[0] + v[1];
|
|
903
|
+
};
|
|
904
|
+
var peg$f50 = function() {
|
|
905
|
+
return "";
|
|
906
|
+
};
|
|
907
|
+
var peg$currPos = 0;
|
|
908
|
+
var peg$savedPos = 0;
|
|
909
|
+
var peg$posDetailsCache = [{ line: 1, column: 1 }];
|
|
910
|
+
var peg$maxFailPos = 0;
|
|
911
|
+
var peg$maxFailExpected = [];
|
|
912
|
+
var peg$silentFails = 0;
|
|
913
|
+
var peg$result;
|
|
914
|
+
if ("startRule" in options) {
|
|
915
|
+
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
916
|
+
throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
|
|
917
|
+
}
|
|
918
|
+
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
919
|
+
}
|
|
920
|
+
function text() {
|
|
921
|
+
return input.substring(peg$savedPos, peg$currPos);
|
|
922
|
+
}
|
|
923
|
+
function location() {
|
|
924
|
+
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
925
|
+
}
|
|
926
|
+
function error(message, location2) {
|
|
927
|
+
location2 = location2 !== void 0 ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
928
|
+
throw peg$buildSimpleError(message, location2);
|
|
929
|
+
}
|
|
930
|
+
function peg$literalExpectation(text2, ignoreCase) {
|
|
931
|
+
return { type: "literal", text: text2, ignoreCase };
|
|
932
|
+
}
|
|
933
|
+
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
934
|
+
return { type: "class", parts, inverted, ignoreCase };
|
|
935
|
+
}
|
|
936
|
+
function peg$anyExpectation() {
|
|
937
|
+
return { type: "any" };
|
|
938
|
+
}
|
|
939
|
+
function peg$endExpectation() {
|
|
940
|
+
return { type: "end" };
|
|
941
|
+
}
|
|
942
|
+
function peg$otherExpectation(description) {
|
|
943
|
+
return { type: "other", description };
|
|
944
|
+
}
|
|
945
|
+
function peg$computePosDetails(pos) {
|
|
946
|
+
var details = peg$posDetailsCache[pos];
|
|
947
|
+
var p;
|
|
948
|
+
if (details) {
|
|
949
|
+
return details;
|
|
950
|
+
} else {
|
|
951
|
+
p = pos - 1;
|
|
952
|
+
while (!peg$posDetailsCache[p]) {
|
|
953
|
+
p--;
|
|
954
|
+
}
|
|
955
|
+
details = peg$posDetailsCache[p];
|
|
956
|
+
details = {
|
|
957
|
+
// @ts-ignore
|
|
958
|
+
line: details.line,
|
|
959
|
+
// @ts-ignore
|
|
960
|
+
column: details.column
|
|
961
|
+
};
|
|
962
|
+
while (p < pos) {
|
|
963
|
+
if (input.charCodeAt(p) === 10) {
|
|
964
|
+
details.line++;
|
|
965
|
+
details.column = 1;
|
|
966
|
+
} else {
|
|
967
|
+
details.column++;
|
|
968
|
+
}
|
|
969
|
+
p++;
|
|
970
|
+
}
|
|
971
|
+
peg$posDetailsCache[pos] = details;
|
|
972
|
+
return details;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
function peg$computeLocation(startPos, endPos, offset2) {
|
|
976
|
+
var startPosDetails = peg$computePosDetails(startPos);
|
|
977
|
+
var endPosDetails = peg$computePosDetails(endPos);
|
|
978
|
+
var res = {
|
|
979
|
+
// @ts-ignore
|
|
980
|
+
source: peg$source,
|
|
981
|
+
// @ts-ignore
|
|
982
|
+
start: {
|
|
983
|
+
// @ts-ignore
|
|
984
|
+
offset: startPos,
|
|
985
|
+
// @ts-ignore
|
|
986
|
+
line: startPosDetails.line,
|
|
987
|
+
// @ts-ignore
|
|
988
|
+
column: startPosDetails.column
|
|
989
|
+
},
|
|
990
|
+
// @ts-ignore
|
|
991
|
+
end: {
|
|
992
|
+
// @ts-ignore
|
|
993
|
+
offset: endPos,
|
|
994
|
+
// @ts-ignore
|
|
995
|
+
line: endPosDetails.line,
|
|
996
|
+
// @ts-ignore
|
|
997
|
+
column: endPosDetails.column
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
if (offset2 && peg$source && typeof peg$source.offset === "function") {
|
|
1001
|
+
res.start = peg$source.offset(res.start);
|
|
1002
|
+
res.end = peg$source.offset(res.end);
|
|
1003
|
+
}
|
|
1004
|
+
return res;
|
|
1005
|
+
}
|
|
1006
|
+
function peg$fail(expected2) {
|
|
1007
|
+
if (peg$currPos < peg$maxFailPos) {
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
if (peg$currPos > peg$maxFailPos) {
|
|
1011
|
+
peg$maxFailPos = peg$currPos;
|
|
1012
|
+
peg$maxFailExpected = [];
|
|
1013
|
+
}
|
|
1014
|
+
peg$maxFailExpected.push(expected2);
|
|
1015
|
+
}
|
|
1016
|
+
function peg$buildSimpleError(message, location2) {
|
|
1017
|
+
return new peg$SyntaxError(message, null, null, location2);
|
|
1018
|
+
}
|
|
1019
|
+
function peg$buildStructuredError(expected2, found, location2) {
|
|
1020
|
+
return new peg$SyntaxError(
|
|
1021
|
+
// @ts-ignore
|
|
1022
|
+
peg$SyntaxError.buildMessage(expected2, found),
|
|
1023
|
+
// @ts-ignore
|
|
1024
|
+
expected2,
|
|
1025
|
+
// @ts-ignore
|
|
1026
|
+
found,
|
|
1027
|
+
// @ts-ignore
|
|
1028
|
+
location2
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
function peg$parseDot() {
|
|
1032
|
+
var s0, s2;
|
|
1033
|
+
s0 = peg$currPos;
|
|
1034
|
+
peg$parse__();
|
|
1035
|
+
s2 = peg$parse_dot();
|
|
1036
|
+
if (s2 !== peg$FAILED) {
|
|
1037
|
+
peg$parse__();
|
|
1038
|
+
peg$savedPos = s0;
|
|
1039
|
+
s0 = peg$f0(s2);
|
|
1040
|
+
} else {
|
|
1041
|
+
peg$currPos = s0;
|
|
1042
|
+
s0 = peg$FAILED;
|
|
1043
|
+
}
|
|
1044
|
+
return s0;
|
|
1045
|
+
}
|
|
1046
|
+
function peg$parseGraph() {
|
|
1047
|
+
var s0, s2;
|
|
1048
|
+
s0 = peg$currPos;
|
|
1049
|
+
peg$parse__();
|
|
1050
|
+
s2 = peg$parse_graph();
|
|
1051
|
+
if (s2 !== peg$FAILED) {
|
|
1052
|
+
peg$parse__();
|
|
1053
|
+
peg$savedPos = s0;
|
|
1054
|
+
s0 = peg$f1(s2);
|
|
1055
|
+
} else {
|
|
1056
|
+
peg$currPos = s0;
|
|
1057
|
+
s0 = peg$FAILED;
|
|
1058
|
+
}
|
|
1059
|
+
return s0;
|
|
1060
|
+
}
|
|
1061
|
+
function peg$parseNode() {
|
|
1062
|
+
var s0, s2;
|
|
1063
|
+
s0 = peg$currPos;
|
|
1064
|
+
peg$parse__();
|
|
1065
|
+
s2 = peg$parse_node();
|
|
1066
|
+
if (s2 !== peg$FAILED) {
|
|
1067
|
+
peg$parse__();
|
|
1068
|
+
peg$savedPos = s0;
|
|
1069
|
+
s0 = peg$f2(s2);
|
|
1070
|
+
} else {
|
|
1071
|
+
peg$currPos = s0;
|
|
1072
|
+
s0 = peg$FAILED;
|
|
1073
|
+
}
|
|
1074
|
+
return s0;
|
|
1075
|
+
}
|
|
1076
|
+
function peg$parseAttributeList() {
|
|
1077
|
+
var s0, s2;
|
|
1078
|
+
s0 = peg$currPos;
|
|
1079
|
+
peg$parse__();
|
|
1080
|
+
s2 = peg$parse_attributes();
|
|
1081
|
+
if (s2 !== peg$FAILED) {
|
|
1082
|
+
peg$parse__();
|
|
1083
|
+
peg$savedPos = s0;
|
|
1084
|
+
s0 = peg$f3(s2);
|
|
1085
|
+
} else {
|
|
1086
|
+
peg$currPos = s0;
|
|
1087
|
+
s0 = peg$FAILED;
|
|
1088
|
+
}
|
|
1089
|
+
return s0;
|
|
1090
|
+
}
|
|
1091
|
+
function peg$parseAttribute() {
|
|
1092
|
+
var s0, s2;
|
|
1093
|
+
s0 = peg$currPos;
|
|
1094
|
+
peg$parse__();
|
|
1095
|
+
s2 = peg$parse_attribute();
|
|
1096
|
+
if (s2 !== peg$FAILED) {
|
|
1097
|
+
peg$parse__();
|
|
1098
|
+
peg$savedPos = s0;
|
|
1099
|
+
s0 = peg$f4(s2);
|
|
1100
|
+
} else {
|
|
1101
|
+
peg$currPos = s0;
|
|
1102
|
+
s0 = peg$FAILED;
|
|
1103
|
+
}
|
|
1104
|
+
return s0;
|
|
1105
|
+
}
|
|
1106
|
+
function peg$parseEdge() {
|
|
1107
|
+
var s0, s2;
|
|
1108
|
+
s0 = peg$currPos;
|
|
1109
|
+
peg$parse__();
|
|
1110
|
+
s2 = peg$parse_edge();
|
|
1111
|
+
if (s2 !== peg$FAILED) {
|
|
1112
|
+
peg$parse__();
|
|
1113
|
+
peg$savedPos = s0;
|
|
1114
|
+
s0 = peg$f5(s2);
|
|
1115
|
+
} else {
|
|
1116
|
+
peg$currPos = s0;
|
|
1117
|
+
s0 = peg$FAILED;
|
|
1118
|
+
}
|
|
1119
|
+
return s0;
|
|
1120
|
+
}
|
|
1121
|
+
function peg$parseSubgraph() {
|
|
1122
|
+
var s0, s2;
|
|
1123
|
+
s0 = peg$currPos;
|
|
1124
|
+
peg$parse__();
|
|
1125
|
+
s2 = peg$parse_subgraph();
|
|
1126
|
+
if (s2 !== peg$FAILED) {
|
|
1127
|
+
peg$parse__();
|
|
1128
|
+
peg$savedPos = s0;
|
|
1129
|
+
s0 = peg$f6(s2);
|
|
1130
|
+
} else {
|
|
1131
|
+
peg$currPos = s0;
|
|
1132
|
+
s0 = peg$FAILED;
|
|
1133
|
+
}
|
|
1134
|
+
return s0;
|
|
1135
|
+
}
|
|
1136
|
+
function peg$parseNodeRef() {
|
|
1137
|
+
var s0, s2;
|
|
1138
|
+
s0 = peg$currPos;
|
|
1139
|
+
peg$parse__();
|
|
1140
|
+
s2 = peg$parse_node_ref();
|
|
1141
|
+
if (s2 !== peg$FAILED) {
|
|
1142
|
+
peg$parse__();
|
|
1143
|
+
peg$savedPos = s0;
|
|
1144
|
+
s0 = peg$f7(s2);
|
|
1145
|
+
} else {
|
|
1146
|
+
peg$currPos = s0;
|
|
1147
|
+
s0 = peg$FAILED;
|
|
1148
|
+
}
|
|
1149
|
+
return s0;
|
|
1150
|
+
}
|
|
1151
|
+
function peg$parseAttibutesItem() {
|
|
1152
|
+
var s0, s2;
|
|
1153
|
+
s0 = peg$currPos;
|
|
1154
|
+
peg$parse__();
|
|
1155
|
+
s2 = peg$parse_attibutes_item();
|
|
1156
|
+
if (s2 !== peg$FAILED) {
|
|
1157
|
+
peg$parse__();
|
|
1158
|
+
peg$savedPos = s0;
|
|
1159
|
+
s0 = peg$f8(s2);
|
|
1160
|
+
} else {
|
|
1161
|
+
peg$currPos = s0;
|
|
1162
|
+
s0 = peg$FAILED;
|
|
1163
|
+
}
|
|
1164
|
+
return s0;
|
|
1165
|
+
}
|
|
1166
|
+
function peg$parseComment() {
|
|
1167
|
+
var s0, s2;
|
|
1168
|
+
s0 = peg$currPos;
|
|
1169
|
+
peg$parse__();
|
|
1170
|
+
s2 = peg$parse_comment();
|
|
1171
|
+
if (s2 !== peg$FAILED) {
|
|
1172
|
+
peg$parse__();
|
|
1173
|
+
peg$savedPos = s0;
|
|
1174
|
+
s0 = peg$f9(s2);
|
|
1175
|
+
} else {
|
|
1176
|
+
peg$currPos = s0;
|
|
1177
|
+
s0 = peg$FAILED;
|
|
1178
|
+
}
|
|
1179
|
+
return s0;
|
|
1180
|
+
}
|
|
1181
|
+
function peg$parseClusterStatements() {
|
|
1182
|
+
var s0, s1;
|
|
1183
|
+
s0 = [];
|
|
1184
|
+
s1 = peg$parseAttribute();
|
|
1185
|
+
if (s1 === peg$FAILED) {
|
|
1186
|
+
s1 = peg$parseAttributeList();
|
|
1187
|
+
if (s1 === peg$FAILED) {
|
|
1188
|
+
s1 = peg$parseEdge();
|
|
1189
|
+
if (s1 === peg$FAILED) {
|
|
1190
|
+
s1 = peg$parseSubgraph();
|
|
1191
|
+
if (s1 === peg$FAILED) {
|
|
1192
|
+
s1 = peg$parseNode();
|
|
1193
|
+
if (s1 === peg$FAILED) {
|
|
1194
|
+
s1 = peg$parseComment();
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
while (s1 !== peg$FAILED) {
|
|
1201
|
+
s0.push(s1);
|
|
1202
|
+
s1 = peg$parseAttribute();
|
|
1203
|
+
if (s1 === peg$FAILED) {
|
|
1204
|
+
s1 = peg$parseAttributeList();
|
|
1205
|
+
if (s1 === peg$FAILED) {
|
|
1206
|
+
s1 = peg$parseEdge();
|
|
1207
|
+
if (s1 === peg$FAILED) {
|
|
1208
|
+
s1 = peg$parseSubgraph();
|
|
1209
|
+
if (s1 === peg$FAILED) {
|
|
1210
|
+
s1 = peg$parseNode();
|
|
1211
|
+
if (s1 === peg$FAILED) {
|
|
1212
|
+
s1 = peg$parseComment();
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
return s0;
|
|
1220
|
+
}
|
|
1221
|
+
function peg$parse_dot() {
|
|
1222
|
+
var s0, s1, s2, s3, s4;
|
|
1223
|
+
s0 = peg$currPos;
|
|
1224
|
+
s1 = [];
|
|
1225
|
+
s2 = peg$parseComment();
|
|
1226
|
+
while (s2 !== peg$FAILED) {
|
|
1227
|
+
s1.push(s2);
|
|
1228
|
+
s2 = peg$parseComment();
|
|
1229
|
+
}
|
|
1230
|
+
s2 = peg$parseGraph();
|
|
1231
|
+
if (s2 !== peg$FAILED) {
|
|
1232
|
+
s3 = [];
|
|
1233
|
+
s4 = peg$parseComment();
|
|
1234
|
+
while (s4 !== peg$FAILED) {
|
|
1235
|
+
s3.push(s4);
|
|
1236
|
+
s4 = peg$parseComment();
|
|
1237
|
+
}
|
|
1238
|
+
peg$savedPos = s0;
|
|
1239
|
+
s0 = peg$f10(s1, s2, s3);
|
|
1240
|
+
} else {
|
|
1241
|
+
peg$currPos = s0;
|
|
1242
|
+
s0 = peg$FAILED;
|
|
1243
|
+
}
|
|
1244
|
+
return s0;
|
|
1245
|
+
}
|
|
1246
|
+
function peg$parse_graph() {
|
|
1247
|
+
var s0, s1, s3, s5, s7, s8, s10;
|
|
1248
|
+
s0 = peg$currPos;
|
|
1249
|
+
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c0) {
|
|
1250
|
+
s1 = input.substr(peg$currPos, 6);
|
|
1251
|
+
peg$currPos += 6;
|
|
1252
|
+
} else {
|
|
1253
|
+
s1 = peg$FAILED;
|
|
1254
|
+
if (peg$silentFails === 0) {
|
|
1255
|
+
peg$fail(peg$e0);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
if (s1 === peg$FAILED) {
|
|
1259
|
+
s1 = null;
|
|
1260
|
+
}
|
|
1261
|
+
peg$parse_();
|
|
1262
|
+
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c1) {
|
|
1263
|
+
s3 = input.substr(peg$currPos, 5);
|
|
1264
|
+
peg$currPos += 5;
|
|
1265
|
+
} else {
|
|
1266
|
+
s3 = peg$FAILED;
|
|
1267
|
+
if (peg$silentFails === 0) {
|
|
1268
|
+
peg$fail(peg$e1);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
if (s3 === peg$FAILED) {
|
|
1272
|
+
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c2) {
|
|
1273
|
+
s3 = input.substr(peg$currPos, 7);
|
|
1274
|
+
peg$currPos += 7;
|
|
1275
|
+
} else {
|
|
1276
|
+
s3 = peg$FAILED;
|
|
1277
|
+
if (peg$silentFails === 0) {
|
|
1278
|
+
peg$fail(peg$e2);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
if (s3 !== peg$FAILED) {
|
|
1283
|
+
peg$parse_();
|
|
1284
|
+
s5 = peg$parse_literal();
|
|
1285
|
+
if (s5 === peg$FAILED) {
|
|
1286
|
+
s5 = null;
|
|
1287
|
+
}
|
|
1288
|
+
peg$parse__();
|
|
1289
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
|
1290
|
+
s7 = peg$c3;
|
|
1291
|
+
peg$currPos++;
|
|
1292
|
+
} else {
|
|
1293
|
+
s7 = peg$FAILED;
|
|
1294
|
+
if (peg$silentFails === 0) {
|
|
1295
|
+
peg$fail(peg$e3);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
if (s7 !== peg$FAILED) {
|
|
1299
|
+
s8 = peg$parseClusterStatements();
|
|
1300
|
+
peg$parse__();
|
|
1301
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
1302
|
+
s10 = peg$c4;
|
|
1303
|
+
peg$currPos++;
|
|
1304
|
+
} else {
|
|
1305
|
+
s10 = peg$FAILED;
|
|
1306
|
+
if (peg$silentFails === 0) {
|
|
1307
|
+
peg$fail(peg$e4);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
if (s10 !== peg$FAILED) {
|
|
1311
|
+
peg$savedPos = s0;
|
|
1312
|
+
s0 = peg$f11(s1, s3, s5, s8);
|
|
1313
|
+
} else {
|
|
1314
|
+
peg$currPos = s0;
|
|
1315
|
+
s0 = peg$FAILED;
|
|
1316
|
+
}
|
|
1317
|
+
} else {
|
|
1318
|
+
peg$currPos = s0;
|
|
1319
|
+
s0 = peg$FAILED;
|
|
1320
|
+
}
|
|
1321
|
+
} else {
|
|
1322
|
+
peg$currPos = s0;
|
|
1323
|
+
s0 = peg$FAILED;
|
|
1324
|
+
}
|
|
1325
|
+
return s0;
|
|
1326
|
+
}
|
|
1327
|
+
function peg$parse_attribute() {
|
|
1328
|
+
var s0, s1;
|
|
1329
|
+
s0 = peg$currPos;
|
|
1330
|
+
s1 = peg$parse_key_value();
|
|
1331
|
+
if (s1 !== peg$FAILED) {
|
|
1332
|
+
peg$parse_();
|
|
1333
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
1334
|
+
peg$currPos++;
|
|
1335
|
+
} else {
|
|
1336
|
+
if (peg$silentFails === 0) {
|
|
1337
|
+
peg$fail(peg$e5);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
peg$savedPos = s0;
|
|
1341
|
+
s0 = peg$f12(s1);
|
|
1342
|
+
} else {
|
|
1343
|
+
peg$currPos = s0;
|
|
1344
|
+
s0 = peg$FAILED;
|
|
1345
|
+
}
|
|
1346
|
+
return s0;
|
|
1347
|
+
}
|
|
1348
|
+
function peg$parse_attributes() {
|
|
1349
|
+
var s0, s1, s2;
|
|
1350
|
+
s0 = peg$currPos;
|
|
1351
|
+
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c1) {
|
|
1352
|
+
s1 = input.substr(peg$currPos, 5);
|
|
1353
|
+
peg$currPos += 5;
|
|
1354
|
+
} else {
|
|
1355
|
+
s1 = peg$FAILED;
|
|
1356
|
+
if (peg$silentFails === 0) {
|
|
1357
|
+
peg$fail(peg$e1);
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
if (s1 === peg$FAILED) {
|
|
1361
|
+
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c6) {
|
|
1362
|
+
s1 = input.substr(peg$currPos, 4);
|
|
1363
|
+
peg$currPos += 4;
|
|
1364
|
+
} else {
|
|
1365
|
+
s1 = peg$FAILED;
|
|
1366
|
+
if (peg$silentFails === 0) {
|
|
1367
|
+
peg$fail(peg$e6);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
if (s1 === peg$FAILED) {
|
|
1371
|
+
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c7) {
|
|
1372
|
+
s1 = input.substr(peg$currPos, 4);
|
|
1373
|
+
peg$currPos += 4;
|
|
1374
|
+
} else {
|
|
1375
|
+
s1 = peg$FAILED;
|
|
1376
|
+
if (peg$silentFails === 0) {
|
|
1377
|
+
peg$fail(peg$e7);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
if (s1 !== peg$FAILED) {
|
|
1383
|
+
s2 = peg$parse_attribute_list();
|
|
1384
|
+
if (s2 !== peg$FAILED) {
|
|
1385
|
+
peg$parse_();
|
|
1386
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
1387
|
+
peg$currPos++;
|
|
1388
|
+
} else {
|
|
1389
|
+
if (peg$silentFails === 0) {
|
|
1390
|
+
peg$fail(peg$e5);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
peg$savedPos = s0;
|
|
1394
|
+
s0 = peg$f13(s1, s2);
|
|
1395
|
+
} else {
|
|
1396
|
+
peg$currPos = s0;
|
|
1397
|
+
s0 = peg$FAILED;
|
|
1398
|
+
}
|
|
1399
|
+
} else {
|
|
1400
|
+
peg$currPos = s0;
|
|
1401
|
+
s0 = peg$FAILED;
|
|
1402
|
+
}
|
|
1403
|
+
return s0;
|
|
1404
|
+
}
|
|
1405
|
+
function peg$parse_edge() {
|
|
1406
|
+
var s0, s1, s2, s3;
|
|
1407
|
+
s0 = peg$currPos;
|
|
1408
|
+
s1 = peg$parse_edge_target();
|
|
1409
|
+
if (s1 !== peg$FAILED) {
|
|
1410
|
+
s2 = peg$parse_edge_rhs();
|
|
1411
|
+
if (s2 !== peg$FAILED) {
|
|
1412
|
+
s3 = peg$parse_attribute_list();
|
|
1413
|
+
if (s3 === peg$FAILED) {
|
|
1414
|
+
s3 = null;
|
|
1415
|
+
}
|
|
1416
|
+
peg$parse_();
|
|
1417
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
1418
|
+
peg$currPos++;
|
|
1419
|
+
} else {
|
|
1420
|
+
if (peg$silentFails === 0) {
|
|
1421
|
+
peg$fail(peg$e5);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
peg$savedPos = s0;
|
|
1425
|
+
s0 = peg$f14(s1, s2, s3);
|
|
1426
|
+
} else {
|
|
1427
|
+
peg$currPos = s0;
|
|
1428
|
+
s0 = peg$FAILED;
|
|
1429
|
+
}
|
|
1430
|
+
} else {
|
|
1431
|
+
peg$currPos = s0;
|
|
1432
|
+
s0 = peg$FAILED;
|
|
1433
|
+
}
|
|
1434
|
+
return s0;
|
|
1435
|
+
}
|
|
1436
|
+
function peg$parse_node() {
|
|
1437
|
+
var s0, s1, s3;
|
|
1438
|
+
s0 = peg$currPos;
|
|
1439
|
+
s1 = peg$parse_literal();
|
|
1440
|
+
if (s1 !== peg$FAILED) {
|
|
1441
|
+
peg$parse_();
|
|
1442
|
+
s3 = peg$parse_attribute_list();
|
|
1443
|
+
if (s3 === peg$FAILED) {
|
|
1444
|
+
s3 = null;
|
|
1445
|
+
}
|
|
1446
|
+
peg$parse_();
|
|
1447
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
1448
|
+
peg$currPos++;
|
|
1449
|
+
} else {
|
|
1450
|
+
if (peg$silentFails === 0) {
|
|
1451
|
+
peg$fail(peg$e5);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
peg$savedPos = s0;
|
|
1455
|
+
s0 = peg$f15(s1, s3);
|
|
1456
|
+
} else {
|
|
1457
|
+
peg$currPos = s0;
|
|
1458
|
+
s0 = peg$FAILED;
|
|
1459
|
+
}
|
|
1460
|
+
return s0;
|
|
1461
|
+
}
|
|
1462
|
+
function peg$parse_key_value() {
|
|
1463
|
+
var s0, s1, s3, s5;
|
|
1464
|
+
s0 = peg$currPos;
|
|
1465
|
+
s1 = peg$parse_literal();
|
|
1466
|
+
if (s1 !== peg$FAILED) {
|
|
1467
|
+
peg$parse_();
|
|
1468
|
+
if (input.charCodeAt(peg$currPos) === 61) {
|
|
1469
|
+
s3 = peg$c8;
|
|
1470
|
+
peg$currPos++;
|
|
1471
|
+
} else {
|
|
1472
|
+
s3 = peg$FAILED;
|
|
1473
|
+
if (peg$silentFails === 0) {
|
|
1474
|
+
peg$fail(peg$e8);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
if (s3 !== peg$FAILED) {
|
|
1478
|
+
peg$parse_();
|
|
1479
|
+
s5 = peg$parse_literal();
|
|
1480
|
+
if (s5 !== peg$FAILED) {
|
|
1481
|
+
peg$savedPos = s0;
|
|
1482
|
+
s0 = peg$f16(s1, s5);
|
|
1483
|
+
} else {
|
|
1484
|
+
peg$currPos = s0;
|
|
1485
|
+
s0 = peg$FAILED;
|
|
1486
|
+
}
|
|
1487
|
+
} else {
|
|
1488
|
+
peg$currPos = s0;
|
|
1489
|
+
s0 = peg$FAILED;
|
|
1490
|
+
}
|
|
1491
|
+
} else {
|
|
1492
|
+
peg$currPos = s0;
|
|
1493
|
+
s0 = peg$FAILED;
|
|
1494
|
+
}
|
|
1495
|
+
return s0;
|
|
1496
|
+
}
|
|
1497
|
+
function peg$parse_attibutes_item() {
|
|
1498
|
+
var s0, s1, s3;
|
|
1499
|
+
s0 = peg$currPos;
|
|
1500
|
+
s1 = peg$parse_key_value();
|
|
1501
|
+
if (s1 !== peg$FAILED) {
|
|
1502
|
+
peg$parse_();
|
|
1503
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
1504
|
+
s3 = peg$c9;
|
|
1505
|
+
peg$currPos++;
|
|
1506
|
+
} else {
|
|
1507
|
+
s3 = peg$FAILED;
|
|
1508
|
+
if (peg$silentFails === 0) {
|
|
1509
|
+
peg$fail(peg$e9);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
if (s3 === peg$FAILED) {
|
|
1513
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
1514
|
+
s3 = peg$c5;
|
|
1515
|
+
peg$currPos++;
|
|
1516
|
+
} else {
|
|
1517
|
+
s3 = peg$FAILED;
|
|
1518
|
+
if (peg$silentFails === 0) {
|
|
1519
|
+
peg$fail(peg$e5);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
if (s3 === peg$FAILED) {
|
|
1524
|
+
s3 = null;
|
|
1525
|
+
}
|
|
1526
|
+
peg$savedPos = s0;
|
|
1527
|
+
s0 = peg$f17(s1);
|
|
1528
|
+
} else {
|
|
1529
|
+
peg$currPos = s0;
|
|
1530
|
+
s0 = peg$FAILED;
|
|
1531
|
+
}
|
|
1532
|
+
return s0;
|
|
1533
|
+
}
|
|
1534
|
+
function peg$parse_attribute_list() {
|
|
1535
|
+
var s0, s2, s3, s4, s5;
|
|
1536
|
+
s0 = peg$currPos;
|
|
1537
|
+
peg$parse_();
|
|
1538
|
+
if (input.charCodeAt(peg$currPos) === 91) {
|
|
1539
|
+
s2 = peg$c10;
|
|
1540
|
+
peg$currPos++;
|
|
1541
|
+
} else {
|
|
1542
|
+
s2 = peg$FAILED;
|
|
1543
|
+
if (peg$silentFails === 0) {
|
|
1544
|
+
peg$fail(peg$e10);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
if (s2 !== peg$FAILED) {
|
|
1548
|
+
s3 = [];
|
|
1549
|
+
s4 = peg$parseAttibutesItem();
|
|
1550
|
+
if (s4 === peg$FAILED) {
|
|
1551
|
+
s4 = peg$parseComment();
|
|
1552
|
+
}
|
|
1553
|
+
while (s4 !== peg$FAILED) {
|
|
1554
|
+
s3.push(s4);
|
|
1555
|
+
s4 = peg$parseAttibutesItem();
|
|
1556
|
+
if (s4 === peg$FAILED) {
|
|
1557
|
+
s4 = peg$parseComment();
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
s4 = peg$parse__();
|
|
1561
|
+
if (input.charCodeAt(peg$currPos) === 93) {
|
|
1562
|
+
s5 = peg$c11;
|
|
1563
|
+
peg$currPos++;
|
|
1564
|
+
} else {
|
|
1565
|
+
s5 = peg$FAILED;
|
|
1566
|
+
if (peg$silentFails === 0) {
|
|
1567
|
+
peg$fail(peg$e11);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
if (s5 !== peg$FAILED) {
|
|
1571
|
+
peg$savedPos = s0;
|
|
1572
|
+
s0 = peg$f18(s3);
|
|
1573
|
+
} else {
|
|
1574
|
+
peg$currPos = s0;
|
|
1575
|
+
s0 = peg$FAILED;
|
|
1576
|
+
}
|
|
1577
|
+
} else {
|
|
1578
|
+
peg$currPos = s0;
|
|
1579
|
+
s0 = peg$FAILED;
|
|
1580
|
+
}
|
|
1581
|
+
return s0;
|
|
1582
|
+
}
|
|
1583
|
+
function peg$parse_edge_target_group() {
|
|
1584
|
+
var s0, s1, s2, s3, s4, s5, s6;
|
|
1585
|
+
s0 = peg$currPos;
|
|
1586
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
|
1587
|
+
s1 = peg$c3;
|
|
1588
|
+
peg$currPos++;
|
|
1589
|
+
} else {
|
|
1590
|
+
s1 = peg$FAILED;
|
|
1591
|
+
if (peg$silentFails === 0) {
|
|
1592
|
+
peg$fail(peg$e3);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
if (s1 !== peg$FAILED) {
|
|
1596
|
+
s2 = peg$parseNodeRef();
|
|
1597
|
+
if (s2 !== peg$FAILED) {
|
|
1598
|
+
s3 = [];
|
|
1599
|
+
s4 = peg$currPos;
|
|
1600
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
1601
|
+
s5 = peg$c9;
|
|
1602
|
+
peg$currPos++;
|
|
1603
|
+
} else {
|
|
1604
|
+
s5 = peg$FAILED;
|
|
1605
|
+
if (peg$silentFails === 0) {
|
|
1606
|
+
peg$fail(peg$e9);
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
if (s5 === peg$FAILED) {
|
|
1610
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
1611
|
+
s5 = peg$c5;
|
|
1612
|
+
peg$currPos++;
|
|
1613
|
+
} else {
|
|
1614
|
+
s5 = peg$FAILED;
|
|
1615
|
+
if (peg$silentFails === 0) {
|
|
1616
|
+
peg$fail(peg$e5);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
if (s5 === peg$FAILED) {
|
|
1621
|
+
s5 = null;
|
|
1622
|
+
}
|
|
1623
|
+
s6 = peg$parseNodeRef();
|
|
1624
|
+
if (s6 !== peg$FAILED) {
|
|
1625
|
+
peg$savedPos = s4;
|
|
1626
|
+
s4 = peg$f19(s2, s6);
|
|
1627
|
+
} else {
|
|
1628
|
+
peg$currPos = s4;
|
|
1629
|
+
s4 = peg$FAILED;
|
|
1630
|
+
}
|
|
1631
|
+
while (s4 !== peg$FAILED) {
|
|
1632
|
+
s3.push(s4);
|
|
1633
|
+
s4 = peg$currPos;
|
|
1634
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
1635
|
+
s5 = peg$c9;
|
|
1636
|
+
peg$currPos++;
|
|
1637
|
+
} else {
|
|
1638
|
+
s5 = peg$FAILED;
|
|
1639
|
+
if (peg$silentFails === 0) {
|
|
1640
|
+
peg$fail(peg$e9);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
if (s5 === peg$FAILED) {
|
|
1644
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
1645
|
+
s5 = peg$c5;
|
|
1646
|
+
peg$currPos++;
|
|
1647
|
+
} else {
|
|
1648
|
+
s5 = peg$FAILED;
|
|
1649
|
+
if (peg$silentFails === 0) {
|
|
1650
|
+
peg$fail(peg$e5);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
if (s5 === peg$FAILED) {
|
|
1655
|
+
s5 = null;
|
|
1656
|
+
}
|
|
1657
|
+
s6 = peg$parseNodeRef();
|
|
1658
|
+
if (s6 !== peg$FAILED) {
|
|
1659
|
+
peg$savedPos = s4;
|
|
1660
|
+
s4 = peg$f19(s2, s6);
|
|
1661
|
+
} else {
|
|
1662
|
+
peg$currPos = s4;
|
|
1663
|
+
s4 = peg$FAILED;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
1667
|
+
s4 = peg$c9;
|
|
1668
|
+
peg$currPos++;
|
|
1669
|
+
} else {
|
|
1670
|
+
s4 = peg$FAILED;
|
|
1671
|
+
if (peg$silentFails === 0) {
|
|
1672
|
+
peg$fail(peg$e9);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
if (s4 === peg$FAILED) {
|
|
1676
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
1677
|
+
s4 = peg$c5;
|
|
1678
|
+
peg$currPos++;
|
|
1679
|
+
} else {
|
|
1680
|
+
s4 = peg$FAILED;
|
|
1681
|
+
if (peg$silentFails === 0) {
|
|
1682
|
+
peg$fail(peg$e5);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
if (s4 === peg$FAILED) {
|
|
1687
|
+
s4 = null;
|
|
1688
|
+
}
|
|
1689
|
+
s5 = peg$parse__();
|
|
1690
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
1691
|
+
s6 = peg$c4;
|
|
1692
|
+
peg$currPos++;
|
|
1693
|
+
} else {
|
|
1694
|
+
s6 = peg$FAILED;
|
|
1695
|
+
if (peg$silentFails === 0) {
|
|
1696
|
+
peg$fail(peg$e4);
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
if (s6 !== peg$FAILED) {
|
|
1700
|
+
peg$savedPos = s0;
|
|
1701
|
+
s0 = peg$f20(s2, s3);
|
|
1702
|
+
} else {
|
|
1703
|
+
peg$currPos = s0;
|
|
1704
|
+
s0 = peg$FAILED;
|
|
1705
|
+
}
|
|
1706
|
+
} else {
|
|
1707
|
+
peg$currPos = s0;
|
|
1708
|
+
s0 = peg$FAILED;
|
|
1709
|
+
}
|
|
1710
|
+
} else {
|
|
1711
|
+
peg$currPos = s0;
|
|
1712
|
+
s0 = peg$FAILED;
|
|
1713
|
+
}
|
|
1714
|
+
return s0;
|
|
1715
|
+
}
|
|
1716
|
+
function peg$parse_edge_target() {
|
|
1717
|
+
var s0;
|
|
1718
|
+
s0 = peg$parse_edge_target_group();
|
|
1719
|
+
if (s0 === peg$FAILED) {
|
|
1720
|
+
s0 = peg$parseNodeRef();
|
|
1721
|
+
}
|
|
1722
|
+
return s0;
|
|
1723
|
+
}
|
|
1724
|
+
function peg$parse_edge_operator() {
|
|
1725
|
+
var s0, s1;
|
|
1726
|
+
s0 = peg$currPos;
|
|
1727
|
+
if (input.substr(peg$currPos, 2) === peg$c12) {
|
|
1728
|
+
s1 = peg$c12;
|
|
1729
|
+
peg$currPos += 2;
|
|
1730
|
+
} else {
|
|
1731
|
+
s1 = peg$FAILED;
|
|
1732
|
+
if (peg$silentFails === 0) {
|
|
1733
|
+
peg$fail(peg$e12);
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
if (s1 === peg$FAILED) {
|
|
1737
|
+
if (input.substr(peg$currPos, 2) === peg$c13) {
|
|
1738
|
+
s1 = peg$c13;
|
|
1739
|
+
peg$currPos += 2;
|
|
1740
|
+
} else {
|
|
1741
|
+
s1 = peg$FAILED;
|
|
1742
|
+
if (peg$silentFails === 0) {
|
|
1743
|
+
peg$fail(peg$e13);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
if (s1 !== peg$FAILED) {
|
|
1748
|
+
peg$savedPos = s0;
|
|
1749
|
+
s1 = peg$f21(s1);
|
|
1750
|
+
}
|
|
1751
|
+
s0 = s1;
|
|
1752
|
+
return s0;
|
|
1753
|
+
}
|
|
1754
|
+
function peg$parse_edge_rhs() {
|
|
1755
|
+
var s0, s2, s4, s6;
|
|
1756
|
+
s0 = peg$currPos;
|
|
1757
|
+
peg$parse_();
|
|
1758
|
+
s2 = peg$parse_edge_operator();
|
|
1759
|
+
if (s2 !== peg$FAILED) {
|
|
1760
|
+
peg$parse_();
|
|
1761
|
+
s4 = peg$parse_edge_target();
|
|
1762
|
+
if (s4 !== peg$FAILED) {
|
|
1763
|
+
peg$parse_();
|
|
1764
|
+
s6 = peg$parse_edge_rhs();
|
|
1765
|
+
if (s6 === peg$FAILED) {
|
|
1766
|
+
s6 = null;
|
|
1767
|
+
}
|
|
1768
|
+
peg$savedPos = s0;
|
|
1769
|
+
s0 = peg$f22(s2, s4, s6);
|
|
1770
|
+
} else {
|
|
1771
|
+
peg$currPos = s0;
|
|
1772
|
+
s0 = peg$FAILED;
|
|
1773
|
+
}
|
|
1774
|
+
} else {
|
|
1775
|
+
peg$currPos = s0;
|
|
1776
|
+
s0 = peg$FAILED;
|
|
1777
|
+
}
|
|
1778
|
+
return s0;
|
|
1779
|
+
}
|
|
1780
|
+
function peg$parse_node_ref() {
|
|
1781
|
+
var s0, s1, s2;
|
|
1782
|
+
s0 = peg$currPos;
|
|
1783
|
+
s1 = peg$parse_literal();
|
|
1784
|
+
if (s1 !== peg$FAILED) {
|
|
1785
|
+
s2 = peg$parse_port();
|
|
1786
|
+
if (s2 === peg$FAILED) {
|
|
1787
|
+
s2 = null;
|
|
1788
|
+
}
|
|
1789
|
+
peg$savedPos = s0;
|
|
1790
|
+
s0 = peg$f23(s1, s2);
|
|
1791
|
+
} else {
|
|
1792
|
+
peg$currPos = s0;
|
|
1793
|
+
s0 = peg$FAILED;
|
|
1794
|
+
}
|
|
1795
|
+
return s0;
|
|
1796
|
+
}
|
|
1797
|
+
function peg$parse_port() {
|
|
1798
|
+
var s0, s1, s2, s3, s4, s5;
|
|
1799
|
+
peg$silentFails++;
|
|
1800
|
+
s0 = peg$currPos;
|
|
1801
|
+
if (input.charCodeAt(peg$currPos) === 58) {
|
|
1802
|
+
s1 = peg$c14;
|
|
1803
|
+
peg$currPos++;
|
|
1804
|
+
} else {
|
|
1805
|
+
s1 = peg$FAILED;
|
|
1806
|
+
if (peg$silentFails === 0) {
|
|
1807
|
+
peg$fail(peg$e15);
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
if (s1 !== peg$FAILED) {
|
|
1811
|
+
s2 = peg$parse_literal();
|
|
1812
|
+
if (s2 !== peg$FAILED) {
|
|
1813
|
+
s3 = peg$currPos;
|
|
1814
|
+
if (input.charCodeAt(peg$currPos) === 58) {
|
|
1815
|
+
s4 = peg$c14;
|
|
1816
|
+
peg$currPos++;
|
|
1817
|
+
} else {
|
|
1818
|
+
s4 = peg$FAILED;
|
|
1819
|
+
if (peg$silentFails === 0) {
|
|
1820
|
+
peg$fail(peg$e15);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
if (s4 !== peg$FAILED) {
|
|
1824
|
+
s5 = peg$parse_compass();
|
|
1825
|
+
if (s5 !== peg$FAILED) {
|
|
1826
|
+
peg$savedPos = s3;
|
|
1827
|
+
s3 = peg$f24(s2, s5);
|
|
1828
|
+
} else {
|
|
1829
|
+
peg$currPos = s3;
|
|
1830
|
+
s3 = peg$FAILED;
|
|
1831
|
+
}
|
|
1832
|
+
} else {
|
|
1833
|
+
peg$currPos = s3;
|
|
1834
|
+
s3 = peg$FAILED;
|
|
1835
|
+
}
|
|
1836
|
+
if (s3 === peg$FAILED) {
|
|
1837
|
+
s3 = null;
|
|
1838
|
+
}
|
|
1839
|
+
peg$savedPos = s0;
|
|
1840
|
+
s0 = peg$f25(s2, s3);
|
|
1841
|
+
} else {
|
|
1842
|
+
peg$currPos = s0;
|
|
1843
|
+
s0 = peg$FAILED;
|
|
1844
|
+
}
|
|
1845
|
+
} else {
|
|
1846
|
+
peg$currPos = s0;
|
|
1847
|
+
s0 = peg$FAILED;
|
|
1848
|
+
}
|
|
1849
|
+
peg$silentFails--;
|
|
1850
|
+
if (s0 === peg$FAILED) {
|
|
1851
|
+
s1 = peg$FAILED;
|
|
1852
|
+
if (peg$silentFails === 0) {
|
|
1853
|
+
peg$fail(peg$e14);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
return s0;
|
|
1857
|
+
}
|
|
1858
|
+
function peg$parse_subgraph_id() {
|
|
1859
|
+
var s0, s1, s3;
|
|
1860
|
+
s0 = peg$currPos;
|
|
1861
|
+
if (input.substr(peg$currPos, 8).toLowerCase() === peg$c15) {
|
|
1862
|
+
s1 = input.substr(peg$currPos, 8);
|
|
1863
|
+
peg$currPos += 8;
|
|
1864
|
+
} else {
|
|
1865
|
+
s1 = peg$FAILED;
|
|
1866
|
+
if (peg$silentFails === 0) {
|
|
1867
|
+
peg$fail(peg$e16);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
if (s1 !== peg$FAILED) {
|
|
1871
|
+
peg$parse_();
|
|
1872
|
+
s3 = peg$parse_literal();
|
|
1873
|
+
if (s3 === peg$FAILED) {
|
|
1874
|
+
s3 = null;
|
|
1875
|
+
}
|
|
1876
|
+
peg$parse_();
|
|
1877
|
+
peg$savedPos = s0;
|
|
1878
|
+
s0 = peg$f26(s3);
|
|
1879
|
+
} else {
|
|
1880
|
+
peg$currPos = s0;
|
|
1881
|
+
s0 = peg$FAILED;
|
|
1882
|
+
}
|
|
1883
|
+
return s0;
|
|
1884
|
+
}
|
|
1885
|
+
function peg$parse_subgraph() {
|
|
1886
|
+
var s0, s1, s2, s3, s5;
|
|
1887
|
+
s0 = peg$currPos;
|
|
1888
|
+
s1 = peg$parse_subgraph_id();
|
|
1889
|
+
if (s1 === peg$FAILED) {
|
|
1890
|
+
s1 = null;
|
|
1891
|
+
}
|
|
1892
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
|
1893
|
+
s2 = peg$c3;
|
|
1894
|
+
peg$currPos++;
|
|
1895
|
+
} else {
|
|
1896
|
+
s2 = peg$FAILED;
|
|
1897
|
+
if (peg$silentFails === 0) {
|
|
1898
|
+
peg$fail(peg$e3);
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
if (s2 !== peg$FAILED) {
|
|
1902
|
+
s3 = peg$parseClusterStatements();
|
|
1903
|
+
if (s3 === peg$FAILED) {
|
|
1904
|
+
s3 = null;
|
|
1905
|
+
}
|
|
1906
|
+
peg$parse__();
|
|
1907
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
1908
|
+
s5 = peg$c4;
|
|
1909
|
+
peg$currPos++;
|
|
1910
|
+
} else {
|
|
1911
|
+
s5 = peg$FAILED;
|
|
1912
|
+
if (peg$silentFails === 0) {
|
|
1913
|
+
peg$fail(peg$e4);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
if (s5 !== peg$FAILED) {
|
|
1917
|
+
peg$savedPos = s0;
|
|
1918
|
+
s0 = peg$f27(s1, s3);
|
|
1919
|
+
} else {
|
|
1920
|
+
peg$currPos = s0;
|
|
1921
|
+
s0 = peg$FAILED;
|
|
1922
|
+
}
|
|
1923
|
+
} else {
|
|
1924
|
+
peg$currPos = s0;
|
|
1925
|
+
s0 = peg$FAILED;
|
|
1926
|
+
}
|
|
1927
|
+
return s0;
|
|
1928
|
+
}
|
|
1929
|
+
function peg$parse_compass_keyword() {
|
|
1930
|
+
var s0;
|
|
1931
|
+
if (input.charCodeAt(peg$currPos) === 110) {
|
|
1932
|
+
s0 = peg$c16;
|
|
1933
|
+
peg$currPos++;
|
|
1934
|
+
} else {
|
|
1935
|
+
s0 = peg$FAILED;
|
|
1936
|
+
if (peg$silentFails === 0) {
|
|
1937
|
+
peg$fail(peg$e17);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
if (s0 === peg$FAILED) {
|
|
1941
|
+
if (input.substr(peg$currPos, 2) === peg$c17) {
|
|
1942
|
+
s0 = peg$c17;
|
|
1943
|
+
peg$currPos += 2;
|
|
1944
|
+
} else {
|
|
1945
|
+
s0 = peg$FAILED;
|
|
1946
|
+
if (peg$silentFails === 0) {
|
|
1947
|
+
peg$fail(peg$e18);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
if (s0 === peg$FAILED) {
|
|
1951
|
+
if (input.charCodeAt(peg$currPos) === 101) {
|
|
1952
|
+
s0 = peg$c18;
|
|
1953
|
+
peg$currPos++;
|
|
1954
|
+
} else {
|
|
1955
|
+
s0 = peg$FAILED;
|
|
1956
|
+
if (peg$silentFails === 0) {
|
|
1957
|
+
peg$fail(peg$e19);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
if (s0 === peg$FAILED) {
|
|
1961
|
+
if (input.substr(peg$currPos, 2) === peg$c19) {
|
|
1962
|
+
s0 = peg$c19;
|
|
1963
|
+
peg$currPos += 2;
|
|
1964
|
+
} else {
|
|
1965
|
+
s0 = peg$FAILED;
|
|
1966
|
+
if (peg$silentFails === 0) {
|
|
1967
|
+
peg$fail(peg$e20);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
if (s0 === peg$FAILED) {
|
|
1971
|
+
if (input.charCodeAt(peg$currPos) === 115) {
|
|
1972
|
+
s0 = peg$c20;
|
|
1973
|
+
peg$currPos++;
|
|
1974
|
+
} else {
|
|
1975
|
+
s0 = peg$FAILED;
|
|
1976
|
+
if (peg$silentFails === 0) {
|
|
1977
|
+
peg$fail(peg$e21);
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
if (s0 === peg$FAILED) {
|
|
1981
|
+
if (input.substr(peg$currPos, 2) === peg$c21) {
|
|
1982
|
+
s0 = peg$c21;
|
|
1983
|
+
peg$currPos += 2;
|
|
1984
|
+
} else {
|
|
1985
|
+
s0 = peg$FAILED;
|
|
1986
|
+
if (peg$silentFails === 0) {
|
|
1987
|
+
peg$fail(peg$e22);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
if (s0 === peg$FAILED) {
|
|
1991
|
+
if (input.charCodeAt(peg$currPos) === 119) {
|
|
1992
|
+
s0 = peg$c22;
|
|
1993
|
+
peg$currPos++;
|
|
1994
|
+
} else {
|
|
1995
|
+
s0 = peg$FAILED;
|
|
1996
|
+
if (peg$silentFails === 0) {
|
|
1997
|
+
peg$fail(peg$e23);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
if (s0 === peg$FAILED) {
|
|
2001
|
+
if (input.substr(peg$currPos, 2) === peg$c23) {
|
|
2002
|
+
s0 = peg$c23;
|
|
2003
|
+
peg$currPos += 2;
|
|
2004
|
+
} else {
|
|
2005
|
+
s0 = peg$FAILED;
|
|
2006
|
+
if (peg$silentFails === 0) {
|
|
2007
|
+
peg$fail(peg$e24);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
return s0;
|
|
2018
|
+
}
|
|
2019
|
+
function peg$parse_compass() {
|
|
2020
|
+
var s0, s1, s2, s3, s4;
|
|
2021
|
+
s0 = peg$currPos;
|
|
2022
|
+
s1 = peg$currPos;
|
|
2023
|
+
s2 = peg$parse_compass_keyword();
|
|
2024
|
+
if (s2 !== peg$FAILED) {
|
|
2025
|
+
peg$savedPos = s1;
|
|
2026
|
+
s2 = peg$f28(s2);
|
|
2027
|
+
}
|
|
2028
|
+
s1 = s2;
|
|
2029
|
+
if (s1 === peg$FAILED) {
|
|
2030
|
+
s1 = peg$currPos;
|
|
2031
|
+
if (input.charCodeAt(peg$currPos) === 34) {
|
|
2032
|
+
s2 = peg$c24;
|
|
2033
|
+
peg$currPos++;
|
|
2034
|
+
} else {
|
|
2035
|
+
s2 = peg$FAILED;
|
|
2036
|
+
if (peg$silentFails === 0) {
|
|
2037
|
+
peg$fail(peg$e25);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
if (s2 !== peg$FAILED) {
|
|
2041
|
+
s3 = peg$parse_compass_keyword();
|
|
2042
|
+
if (s3 !== peg$FAILED) {
|
|
2043
|
+
if (input.charCodeAt(peg$currPos) === 34) {
|
|
2044
|
+
s4 = peg$c24;
|
|
2045
|
+
peg$currPos++;
|
|
2046
|
+
} else {
|
|
2047
|
+
s4 = peg$FAILED;
|
|
2048
|
+
if (peg$silentFails === 0) {
|
|
2049
|
+
peg$fail(peg$e25);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
if (s4 !== peg$FAILED) {
|
|
2053
|
+
peg$savedPos = s1;
|
|
2054
|
+
s1 = peg$f29(s3);
|
|
2055
|
+
} else {
|
|
2056
|
+
peg$currPos = s1;
|
|
2057
|
+
s1 = peg$FAILED;
|
|
2058
|
+
}
|
|
2059
|
+
} else {
|
|
2060
|
+
peg$currPos = s1;
|
|
2061
|
+
s1 = peg$FAILED;
|
|
2062
|
+
}
|
|
2063
|
+
} else {
|
|
2064
|
+
peg$currPos = s1;
|
|
2065
|
+
s1 = peg$FAILED;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
if (s1 !== peg$FAILED) {
|
|
2069
|
+
peg$savedPos = s0;
|
|
2070
|
+
s1 = peg$f30(s1);
|
|
2071
|
+
}
|
|
2072
|
+
s0 = s1;
|
|
2073
|
+
return s0;
|
|
2074
|
+
}
|
|
2075
|
+
function peg$parse_literal() {
|
|
2076
|
+
var s0, s1;
|
|
2077
|
+
s0 = peg$parseQUOTED_STRING();
|
|
2078
|
+
if (s0 === peg$FAILED) {
|
|
2079
|
+
s0 = peg$parseHTML_STRING();
|
|
2080
|
+
if (s0 === peg$FAILED) {
|
|
2081
|
+
s0 = peg$currPos;
|
|
2082
|
+
s1 = peg$parseSTRING();
|
|
2083
|
+
if (s1 === peg$FAILED) {
|
|
2084
|
+
s1 = peg$parseNUMBER_STRING();
|
|
2085
|
+
if (s1 === peg$FAILED) {
|
|
2086
|
+
s1 = peg$parseNUMBER();
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
if (s1 !== peg$FAILED) {
|
|
2090
|
+
peg$savedPos = s0;
|
|
2091
|
+
s1 = peg$f31(s1);
|
|
2092
|
+
}
|
|
2093
|
+
s0 = s1;
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
return s0;
|
|
2097
|
+
}
|
|
2098
|
+
function peg$parse_comment() {
|
|
2099
|
+
var s0;
|
|
2100
|
+
s0 = peg$parse_block_comment();
|
|
2101
|
+
if (s0 === peg$FAILED) {
|
|
2102
|
+
s0 = peg$parse_slash_comment();
|
|
2103
|
+
if (s0 === peg$FAILED) {
|
|
2104
|
+
s0 = peg$parse_macro_comment();
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
return s0;
|
|
2108
|
+
}
|
|
2109
|
+
function peg$parse_block_comment() {
|
|
2110
|
+
var s0, s1, s2, s3, s4, s5;
|
|
2111
|
+
s0 = peg$currPos;
|
|
2112
|
+
if (input.substr(peg$currPos, 2) === peg$c25) {
|
|
2113
|
+
s1 = peg$c25;
|
|
2114
|
+
peg$currPos += 2;
|
|
2115
|
+
} else {
|
|
2116
|
+
s1 = peg$FAILED;
|
|
2117
|
+
if (peg$silentFails === 0) {
|
|
2118
|
+
peg$fail(peg$e26);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
if (s1 !== peg$FAILED) {
|
|
2122
|
+
s2 = [];
|
|
2123
|
+
s3 = peg$currPos;
|
|
2124
|
+
s4 = peg$currPos;
|
|
2125
|
+
peg$silentFails++;
|
|
2126
|
+
if (input.substr(peg$currPos, 2) === peg$c26) {
|
|
2127
|
+
s5 = peg$c26;
|
|
2128
|
+
peg$currPos += 2;
|
|
2129
|
+
} else {
|
|
2130
|
+
s5 = peg$FAILED;
|
|
2131
|
+
if (peg$silentFails === 0) {
|
|
2132
|
+
peg$fail(peg$e27);
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
peg$silentFails--;
|
|
2136
|
+
if (s5 === peg$FAILED) {
|
|
2137
|
+
s4 = void 0;
|
|
2138
|
+
} else {
|
|
2139
|
+
peg$currPos = s4;
|
|
2140
|
+
s4 = peg$FAILED;
|
|
2141
|
+
}
|
|
2142
|
+
if (s4 !== peg$FAILED) {
|
|
2143
|
+
if (input.length > peg$currPos) {
|
|
2144
|
+
s5 = input.charAt(peg$currPos);
|
|
2145
|
+
peg$currPos++;
|
|
2146
|
+
} else {
|
|
2147
|
+
s5 = peg$FAILED;
|
|
2148
|
+
if (peg$silentFails === 0) {
|
|
2149
|
+
peg$fail(peg$e28);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
if (s5 !== peg$FAILED) {
|
|
2153
|
+
peg$savedPos = s3;
|
|
2154
|
+
s3 = peg$f32(s5);
|
|
2155
|
+
} else {
|
|
2156
|
+
peg$currPos = s3;
|
|
2157
|
+
s3 = peg$FAILED;
|
|
2158
|
+
}
|
|
2159
|
+
} else {
|
|
2160
|
+
peg$currPos = s3;
|
|
2161
|
+
s3 = peg$FAILED;
|
|
2162
|
+
}
|
|
2163
|
+
while (s3 !== peg$FAILED) {
|
|
2164
|
+
s2.push(s3);
|
|
2165
|
+
s3 = peg$currPos;
|
|
2166
|
+
s4 = peg$currPos;
|
|
2167
|
+
peg$silentFails++;
|
|
2168
|
+
if (input.substr(peg$currPos, 2) === peg$c26) {
|
|
2169
|
+
s5 = peg$c26;
|
|
2170
|
+
peg$currPos += 2;
|
|
2171
|
+
} else {
|
|
2172
|
+
s5 = peg$FAILED;
|
|
2173
|
+
if (peg$silentFails === 0) {
|
|
2174
|
+
peg$fail(peg$e27);
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
peg$silentFails--;
|
|
2178
|
+
if (s5 === peg$FAILED) {
|
|
2179
|
+
s4 = void 0;
|
|
2180
|
+
} else {
|
|
2181
|
+
peg$currPos = s4;
|
|
2182
|
+
s4 = peg$FAILED;
|
|
2183
|
+
}
|
|
2184
|
+
if (s4 !== peg$FAILED) {
|
|
2185
|
+
if (input.length > peg$currPos) {
|
|
2186
|
+
s5 = input.charAt(peg$currPos);
|
|
2187
|
+
peg$currPos++;
|
|
2188
|
+
} else {
|
|
2189
|
+
s5 = peg$FAILED;
|
|
2190
|
+
if (peg$silentFails === 0) {
|
|
2191
|
+
peg$fail(peg$e28);
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
if (s5 !== peg$FAILED) {
|
|
2195
|
+
peg$savedPos = s3;
|
|
2196
|
+
s3 = peg$f32(s5);
|
|
2197
|
+
} else {
|
|
2198
|
+
peg$currPos = s3;
|
|
2199
|
+
s3 = peg$FAILED;
|
|
2200
|
+
}
|
|
2201
|
+
} else {
|
|
2202
|
+
peg$currPos = s3;
|
|
2203
|
+
s3 = peg$FAILED;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
if (input.substr(peg$currPos, 2) === peg$c26) {
|
|
2207
|
+
s3 = peg$c26;
|
|
2208
|
+
peg$currPos += 2;
|
|
2209
|
+
} else {
|
|
2210
|
+
s3 = peg$FAILED;
|
|
2211
|
+
if (peg$silentFails === 0) {
|
|
2212
|
+
peg$fail(peg$e27);
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
if (s3 !== peg$FAILED) {
|
|
2216
|
+
peg$savedPos = s0;
|
|
2217
|
+
s0 = peg$f33(s2);
|
|
2218
|
+
} else {
|
|
2219
|
+
peg$currPos = s0;
|
|
2220
|
+
s0 = peg$FAILED;
|
|
2221
|
+
}
|
|
2222
|
+
} else {
|
|
2223
|
+
peg$currPos = s0;
|
|
2224
|
+
s0 = peg$FAILED;
|
|
2225
|
+
}
|
|
2226
|
+
return s0;
|
|
2227
|
+
}
|
|
2228
|
+
function peg$parse_slash_comment() {
|
|
2229
|
+
var s0, s1, s2;
|
|
2230
|
+
s0 = peg$currPos;
|
|
2231
|
+
s1 = [];
|
|
2232
|
+
s2 = peg$parse_slash_comment_line();
|
|
2233
|
+
if (s2 !== peg$FAILED) {
|
|
2234
|
+
while (s2 !== peg$FAILED) {
|
|
2235
|
+
s1.push(s2);
|
|
2236
|
+
s2 = peg$parse_slash_comment_line();
|
|
2237
|
+
}
|
|
2238
|
+
} else {
|
|
2239
|
+
s1 = peg$FAILED;
|
|
2240
|
+
}
|
|
2241
|
+
if (s1 !== peg$FAILED) {
|
|
2242
|
+
peg$savedPos = s0;
|
|
2243
|
+
s1 = peg$f34(s1);
|
|
2244
|
+
}
|
|
2245
|
+
s0 = s1;
|
|
2246
|
+
return s0;
|
|
2247
|
+
}
|
|
2248
|
+
function peg$parse_slash_comment_line() {
|
|
2249
|
+
var s0, s2, s3, s4, s5, s6;
|
|
2250
|
+
s0 = peg$currPos;
|
|
2251
|
+
peg$parse_();
|
|
2252
|
+
if (input.substr(peg$currPos, 2) === peg$c27) {
|
|
2253
|
+
s2 = peg$c27;
|
|
2254
|
+
peg$currPos += 2;
|
|
2255
|
+
} else {
|
|
2256
|
+
s2 = peg$FAILED;
|
|
2257
|
+
if (peg$silentFails === 0) {
|
|
2258
|
+
peg$fail(peg$e29);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
if (s2 !== peg$FAILED) {
|
|
2262
|
+
s3 = [];
|
|
2263
|
+
s4 = peg$currPos;
|
|
2264
|
+
s5 = peg$currPos;
|
|
2265
|
+
peg$silentFails++;
|
|
2266
|
+
s6 = peg$parse_newline();
|
|
2267
|
+
peg$silentFails--;
|
|
2268
|
+
if (s6 === peg$FAILED) {
|
|
2269
|
+
s5 = void 0;
|
|
2270
|
+
} else {
|
|
2271
|
+
peg$currPos = s5;
|
|
2272
|
+
s5 = peg$FAILED;
|
|
2273
|
+
}
|
|
2274
|
+
if (s5 !== peg$FAILED) {
|
|
2275
|
+
if (input.length > peg$currPos) {
|
|
2276
|
+
s6 = input.charAt(peg$currPos);
|
|
2277
|
+
peg$currPos++;
|
|
2278
|
+
} else {
|
|
2279
|
+
s6 = peg$FAILED;
|
|
2280
|
+
if (peg$silentFails === 0) {
|
|
2281
|
+
peg$fail(peg$e28);
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
if (s6 !== peg$FAILED) {
|
|
2285
|
+
peg$savedPos = s4;
|
|
2286
|
+
s4 = peg$f35(s6);
|
|
2287
|
+
} else {
|
|
2288
|
+
peg$currPos = s4;
|
|
2289
|
+
s4 = peg$FAILED;
|
|
2290
|
+
}
|
|
2291
|
+
} else {
|
|
2292
|
+
peg$currPos = s4;
|
|
2293
|
+
s4 = peg$FAILED;
|
|
2294
|
+
}
|
|
2295
|
+
while (s4 !== peg$FAILED) {
|
|
2296
|
+
s3.push(s4);
|
|
2297
|
+
s4 = peg$currPos;
|
|
2298
|
+
s5 = peg$currPos;
|
|
2299
|
+
peg$silentFails++;
|
|
2300
|
+
s6 = peg$parse_newline();
|
|
2301
|
+
peg$silentFails--;
|
|
2302
|
+
if (s6 === peg$FAILED) {
|
|
2303
|
+
s5 = void 0;
|
|
2304
|
+
} else {
|
|
2305
|
+
peg$currPos = s5;
|
|
2306
|
+
s5 = peg$FAILED;
|
|
2307
|
+
}
|
|
2308
|
+
if (s5 !== peg$FAILED) {
|
|
2309
|
+
if (input.length > peg$currPos) {
|
|
2310
|
+
s6 = input.charAt(peg$currPos);
|
|
2311
|
+
peg$currPos++;
|
|
2312
|
+
} else {
|
|
2313
|
+
s6 = peg$FAILED;
|
|
2314
|
+
if (peg$silentFails === 0) {
|
|
2315
|
+
peg$fail(peg$e28);
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
if (s6 !== peg$FAILED) {
|
|
2319
|
+
peg$savedPos = s4;
|
|
2320
|
+
s4 = peg$f35(s6);
|
|
2321
|
+
} else {
|
|
2322
|
+
peg$currPos = s4;
|
|
2323
|
+
s4 = peg$FAILED;
|
|
2324
|
+
}
|
|
2325
|
+
} else {
|
|
2326
|
+
peg$currPos = s4;
|
|
2327
|
+
s4 = peg$FAILED;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
s4 = peg$parse_newline();
|
|
2331
|
+
if (s4 === peg$FAILED) {
|
|
2332
|
+
s4 = null;
|
|
2333
|
+
}
|
|
2334
|
+
peg$savedPos = s0;
|
|
2335
|
+
s0 = peg$f36(s3);
|
|
2336
|
+
} else {
|
|
2337
|
+
peg$currPos = s0;
|
|
2338
|
+
s0 = peg$FAILED;
|
|
2339
|
+
}
|
|
2340
|
+
return s0;
|
|
2341
|
+
}
|
|
2342
|
+
function peg$parse_macro_comment() {
|
|
2343
|
+
var s0, s1, s2;
|
|
2344
|
+
s0 = peg$currPos;
|
|
2345
|
+
s1 = [];
|
|
2346
|
+
s2 = peg$parse_macro_comment_line();
|
|
2347
|
+
if (s2 !== peg$FAILED) {
|
|
2348
|
+
while (s2 !== peg$FAILED) {
|
|
2349
|
+
s1.push(s2);
|
|
2350
|
+
s2 = peg$parse_macro_comment_line();
|
|
2351
|
+
}
|
|
2352
|
+
} else {
|
|
2353
|
+
s1 = peg$FAILED;
|
|
2354
|
+
}
|
|
2355
|
+
if (s1 !== peg$FAILED) {
|
|
2356
|
+
peg$savedPos = s0;
|
|
2357
|
+
s1 = peg$f37(s1);
|
|
2358
|
+
}
|
|
2359
|
+
s0 = s1;
|
|
2360
|
+
return s0;
|
|
2361
|
+
}
|
|
2362
|
+
function peg$parse_macro_comment_line() {
|
|
2363
|
+
var s0, s2, s3, s4, s5, s6;
|
|
2364
|
+
s0 = peg$currPos;
|
|
2365
|
+
peg$parse_();
|
|
2366
|
+
if (input.charCodeAt(peg$currPos) === 35) {
|
|
2367
|
+
s2 = peg$c28;
|
|
2368
|
+
peg$currPos++;
|
|
2369
|
+
} else {
|
|
2370
|
+
s2 = peg$FAILED;
|
|
2371
|
+
if (peg$silentFails === 0) {
|
|
2372
|
+
peg$fail(peg$e30);
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
if (s2 !== peg$FAILED) {
|
|
2376
|
+
s3 = [];
|
|
2377
|
+
s4 = peg$currPos;
|
|
2378
|
+
s5 = peg$currPos;
|
|
2379
|
+
peg$silentFails++;
|
|
2380
|
+
s6 = peg$parse_newline();
|
|
2381
|
+
peg$silentFails--;
|
|
2382
|
+
if (s6 === peg$FAILED) {
|
|
2383
|
+
s5 = void 0;
|
|
2384
|
+
} else {
|
|
2385
|
+
peg$currPos = s5;
|
|
2386
|
+
s5 = peg$FAILED;
|
|
2387
|
+
}
|
|
2388
|
+
if (s5 !== peg$FAILED) {
|
|
2389
|
+
if (input.length > peg$currPos) {
|
|
2390
|
+
s6 = input.charAt(peg$currPos);
|
|
2391
|
+
peg$currPos++;
|
|
2392
|
+
} else {
|
|
2393
|
+
s6 = peg$FAILED;
|
|
2394
|
+
if (peg$silentFails === 0) {
|
|
2395
|
+
peg$fail(peg$e28);
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
if (s6 !== peg$FAILED) {
|
|
2399
|
+
peg$savedPos = s4;
|
|
2400
|
+
s4 = peg$f38(s6);
|
|
2401
|
+
} else {
|
|
2402
|
+
peg$currPos = s4;
|
|
2403
|
+
s4 = peg$FAILED;
|
|
2404
|
+
}
|
|
2405
|
+
} else {
|
|
2406
|
+
peg$currPos = s4;
|
|
2407
|
+
s4 = peg$FAILED;
|
|
2408
|
+
}
|
|
2409
|
+
while (s4 !== peg$FAILED) {
|
|
2410
|
+
s3.push(s4);
|
|
2411
|
+
s4 = peg$currPos;
|
|
2412
|
+
s5 = peg$currPos;
|
|
2413
|
+
peg$silentFails++;
|
|
2414
|
+
s6 = peg$parse_newline();
|
|
2415
|
+
peg$silentFails--;
|
|
2416
|
+
if (s6 === peg$FAILED) {
|
|
2417
|
+
s5 = void 0;
|
|
2418
|
+
} else {
|
|
2419
|
+
peg$currPos = s5;
|
|
2420
|
+
s5 = peg$FAILED;
|
|
2421
|
+
}
|
|
2422
|
+
if (s5 !== peg$FAILED) {
|
|
2423
|
+
if (input.length > peg$currPos) {
|
|
2424
|
+
s6 = input.charAt(peg$currPos);
|
|
2425
|
+
peg$currPos++;
|
|
2426
|
+
} else {
|
|
2427
|
+
s6 = peg$FAILED;
|
|
2428
|
+
if (peg$silentFails === 0) {
|
|
2429
|
+
peg$fail(peg$e28);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
if (s6 !== peg$FAILED) {
|
|
2433
|
+
peg$savedPos = s4;
|
|
2434
|
+
s4 = peg$f38(s6);
|
|
2435
|
+
} else {
|
|
2436
|
+
peg$currPos = s4;
|
|
2437
|
+
s4 = peg$FAILED;
|
|
2438
|
+
}
|
|
2439
|
+
} else {
|
|
2440
|
+
peg$currPos = s4;
|
|
2441
|
+
s4 = peg$FAILED;
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
s4 = peg$parse_newline();
|
|
2445
|
+
if (s4 === peg$FAILED) {
|
|
2446
|
+
s4 = null;
|
|
2447
|
+
}
|
|
2448
|
+
peg$savedPos = s0;
|
|
2449
|
+
s0 = peg$f39(s3);
|
|
2450
|
+
} else {
|
|
2451
|
+
peg$currPos = s0;
|
|
2452
|
+
s0 = peg$FAILED;
|
|
2453
|
+
}
|
|
2454
|
+
return s0;
|
|
2455
|
+
}
|
|
2456
|
+
function peg$parseSTRING() {
|
|
2457
|
+
var s0, s1, s2, s3;
|
|
2458
|
+
peg$silentFails++;
|
|
2459
|
+
s0 = peg$currPos;
|
|
2460
|
+
s1 = peg$parseStringStart();
|
|
2461
|
+
if (s1 !== peg$FAILED) {
|
|
2462
|
+
s2 = [];
|
|
2463
|
+
s3 = peg$parseStringPart();
|
|
2464
|
+
while (s3 !== peg$FAILED) {
|
|
2465
|
+
s2.push(s3);
|
|
2466
|
+
s3 = peg$parseStringPart();
|
|
2467
|
+
}
|
|
2468
|
+
peg$savedPos = s0;
|
|
2469
|
+
s0 = peg$f40(s1, s2);
|
|
2470
|
+
} else {
|
|
2471
|
+
peg$currPos = s0;
|
|
2472
|
+
s0 = peg$FAILED;
|
|
2473
|
+
}
|
|
2474
|
+
peg$silentFails--;
|
|
2475
|
+
if (s0 === peg$FAILED) {
|
|
2476
|
+
s1 = peg$FAILED;
|
|
2477
|
+
if (peg$silentFails === 0) {
|
|
2478
|
+
peg$fail(peg$e31);
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
return s0;
|
|
2482
|
+
}
|
|
2483
|
+
function peg$parseNUMBER_STRING() {
|
|
2484
|
+
var s0, s1, s2;
|
|
2485
|
+
s0 = peg$currPos;
|
|
2486
|
+
s1 = peg$parseNUMBER();
|
|
2487
|
+
if (s1 !== peg$FAILED) {
|
|
2488
|
+
s2 = peg$parseSTRING();
|
|
2489
|
+
if (s2 !== peg$FAILED) {
|
|
2490
|
+
peg$savedPos = s0;
|
|
2491
|
+
s0 = peg$f41(s1, s2);
|
|
2492
|
+
} else {
|
|
2493
|
+
peg$currPos = s0;
|
|
2494
|
+
s0 = peg$FAILED;
|
|
2495
|
+
}
|
|
2496
|
+
} else {
|
|
2497
|
+
peg$currPos = s0;
|
|
2498
|
+
s0 = peg$FAILED;
|
|
2499
|
+
}
|
|
2500
|
+
return s0;
|
|
2501
|
+
}
|
|
2502
|
+
function peg$parseStringStart() {
|
|
2503
|
+
var s0;
|
|
2504
|
+
s0 = peg$parseUnicodeLetter();
|
|
2505
|
+
if (s0 === peg$FAILED) {
|
|
2506
|
+
if (input.charCodeAt(peg$currPos) === 36) {
|
|
2507
|
+
s0 = peg$c29;
|
|
2508
|
+
peg$currPos++;
|
|
2509
|
+
} else {
|
|
2510
|
+
s0 = peg$FAILED;
|
|
2511
|
+
if (peg$silentFails === 0) {
|
|
2512
|
+
peg$fail(peg$e32);
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
if (s0 === peg$FAILED) {
|
|
2516
|
+
if (input.charCodeAt(peg$currPos) === 95) {
|
|
2517
|
+
s0 = peg$c30;
|
|
2518
|
+
peg$currPos++;
|
|
2519
|
+
} else {
|
|
2520
|
+
s0 = peg$FAILED;
|
|
2521
|
+
if (peg$silentFails === 0) {
|
|
2522
|
+
peg$fail(peg$e33);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
return s0;
|
|
2528
|
+
}
|
|
2529
|
+
function peg$parseStringPart() {
|
|
2530
|
+
var s0;
|
|
2531
|
+
s0 = peg$parseStringStart();
|
|
2532
|
+
if (s0 === peg$FAILED) {
|
|
2533
|
+
s0 = peg$parseNd();
|
|
2534
|
+
}
|
|
2535
|
+
return s0;
|
|
2536
|
+
}
|
|
2537
|
+
function peg$parseNUMBER() {
|
|
2538
|
+
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
|
2539
|
+
peg$silentFails++;
|
|
2540
|
+
s0 = peg$currPos;
|
|
2541
|
+
s1 = peg$currPos;
|
|
2542
|
+
if (input.charCodeAt(peg$currPos) === 45) {
|
|
2543
|
+
s2 = peg$c31;
|
|
2544
|
+
peg$currPos++;
|
|
2545
|
+
} else {
|
|
2546
|
+
s2 = peg$FAILED;
|
|
2547
|
+
if (peg$silentFails === 0) {
|
|
2548
|
+
peg$fail(peg$e35);
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
if (s2 === peg$FAILED) {
|
|
2552
|
+
s2 = null;
|
|
2553
|
+
}
|
|
2554
|
+
s3 = peg$currPos;
|
|
2555
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
|
2556
|
+
s4 = peg$c32;
|
|
2557
|
+
peg$currPos++;
|
|
2558
|
+
} else {
|
|
2559
|
+
s4 = peg$FAILED;
|
|
2560
|
+
if (peg$silentFails === 0) {
|
|
2561
|
+
peg$fail(peg$e36);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
if (s4 !== peg$FAILED) {
|
|
2565
|
+
s5 = [];
|
|
2566
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
2567
|
+
s6 = input.charAt(peg$currPos);
|
|
2568
|
+
peg$currPos++;
|
|
2569
|
+
} else {
|
|
2570
|
+
s6 = peg$FAILED;
|
|
2571
|
+
if (peg$silentFails === 0) {
|
|
2572
|
+
peg$fail(peg$e37);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
if (s6 !== peg$FAILED) {
|
|
2576
|
+
while (s6 !== peg$FAILED) {
|
|
2577
|
+
s5.push(s6);
|
|
2578
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
2579
|
+
s6 = input.charAt(peg$currPos);
|
|
2580
|
+
peg$currPos++;
|
|
2581
|
+
} else {
|
|
2582
|
+
s6 = peg$FAILED;
|
|
2583
|
+
if (peg$silentFails === 0) {
|
|
2584
|
+
peg$fail(peg$e37);
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
} else {
|
|
2589
|
+
s5 = peg$FAILED;
|
|
2590
|
+
}
|
|
2591
|
+
if (s5 !== peg$FAILED) {
|
|
2592
|
+
s4 = [s4, s5];
|
|
2593
|
+
s3 = s4;
|
|
2594
|
+
} else {
|
|
2595
|
+
peg$currPos = s3;
|
|
2596
|
+
s3 = peg$FAILED;
|
|
2597
|
+
}
|
|
2598
|
+
} else {
|
|
2599
|
+
peg$currPos = s3;
|
|
2600
|
+
s3 = peg$FAILED;
|
|
2601
|
+
}
|
|
2602
|
+
if (s3 === peg$FAILED) {
|
|
2603
|
+
s3 = peg$currPos;
|
|
2604
|
+
s4 = [];
|
|
2605
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
2606
|
+
s5 = input.charAt(peg$currPos);
|
|
2607
|
+
peg$currPos++;
|
|
2608
|
+
} else {
|
|
2609
|
+
s5 = peg$FAILED;
|
|
2610
|
+
if (peg$silentFails === 0) {
|
|
2611
|
+
peg$fail(peg$e37);
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
if (s5 !== peg$FAILED) {
|
|
2615
|
+
while (s5 !== peg$FAILED) {
|
|
2616
|
+
s4.push(s5);
|
|
2617
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
2618
|
+
s5 = input.charAt(peg$currPos);
|
|
2619
|
+
peg$currPos++;
|
|
2620
|
+
} else {
|
|
2621
|
+
s5 = peg$FAILED;
|
|
2622
|
+
if (peg$silentFails === 0) {
|
|
2623
|
+
peg$fail(peg$e37);
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
} else {
|
|
2628
|
+
s4 = peg$FAILED;
|
|
2629
|
+
}
|
|
2630
|
+
if (s4 !== peg$FAILED) {
|
|
2631
|
+
s5 = peg$currPos;
|
|
2632
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
|
2633
|
+
s6 = peg$c32;
|
|
2634
|
+
peg$currPos++;
|
|
2635
|
+
} else {
|
|
2636
|
+
s6 = peg$FAILED;
|
|
2637
|
+
if (peg$silentFails === 0) {
|
|
2638
|
+
peg$fail(peg$e36);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
if (s6 !== peg$FAILED) {
|
|
2642
|
+
s7 = [];
|
|
2643
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
2644
|
+
s8 = input.charAt(peg$currPos);
|
|
2645
|
+
peg$currPos++;
|
|
2646
|
+
} else {
|
|
2647
|
+
s8 = peg$FAILED;
|
|
2648
|
+
if (peg$silentFails === 0) {
|
|
2649
|
+
peg$fail(peg$e37);
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
while (s8 !== peg$FAILED) {
|
|
2653
|
+
s7.push(s8);
|
|
2654
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
2655
|
+
s8 = input.charAt(peg$currPos);
|
|
2656
|
+
peg$currPos++;
|
|
2657
|
+
} else {
|
|
2658
|
+
s8 = peg$FAILED;
|
|
2659
|
+
if (peg$silentFails === 0) {
|
|
2660
|
+
peg$fail(peg$e37);
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
s6 = [s6, s7];
|
|
2665
|
+
s5 = s6;
|
|
2666
|
+
} else {
|
|
2667
|
+
peg$currPos = s5;
|
|
2668
|
+
s5 = peg$FAILED;
|
|
2669
|
+
}
|
|
2670
|
+
if (s5 === peg$FAILED) {
|
|
2671
|
+
s5 = null;
|
|
2672
|
+
}
|
|
2673
|
+
s4 = [s4, s5];
|
|
2674
|
+
s3 = s4;
|
|
2675
|
+
} else {
|
|
2676
|
+
peg$currPos = s3;
|
|
2677
|
+
s3 = peg$FAILED;
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
if (s3 !== peg$FAILED) {
|
|
2681
|
+
s2 = [s2, s3];
|
|
2682
|
+
s1 = s2;
|
|
2683
|
+
} else {
|
|
2684
|
+
peg$currPos = s1;
|
|
2685
|
+
s1 = peg$FAILED;
|
|
2686
|
+
}
|
|
2687
|
+
if (s1 !== peg$FAILED) {
|
|
2688
|
+
peg$savedPos = s0;
|
|
2689
|
+
s1 = peg$f42();
|
|
2690
|
+
}
|
|
2691
|
+
s0 = s1;
|
|
2692
|
+
peg$silentFails--;
|
|
2693
|
+
if (s0 === peg$FAILED) {
|
|
2694
|
+
s1 = peg$FAILED;
|
|
2695
|
+
if (peg$silentFails === 0) {
|
|
2696
|
+
peg$fail(peg$e34);
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
return s0;
|
|
2700
|
+
}
|
|
2701
|
+
function peg$parseHTML_STRING() {
|
|
2702
|
+
var s0, s1;
|
|
2703
|
+
s0 = peg$currPos;
|
|
2704
|
+
s1 = peg$parsehtml_raw_string();
|
|
2705
|
+
if (s1 !== peg$FAILED) {
|
|
2706
|
+
peg$savedPos = s0;
|
|
2707
|
+
s1 = peg$f43(s1);
|
|
2708
|
+
}
|
|
2709
|
+
s0 = s1;
|
|
2710
|
+
return s0;
|
|
2711
|
+
}
|
|
2712
|
+
function peg$parsehtml_raw_string() {
|
|
2713
|
+
var s0, s1, s2, s3;
|
|
2714
|
+
s0 = peg$currPos;
|
|
2715
|
+
if (input.charCodeAt(peg$currPos) === 60) {
|
|
2716
|
+
s1 = peg$c33;
|
|
2717
|
+
peg$currPos++;
|
|
2718
|
+
} else {
|
|
2719
|
+
s1 = peg$FAILED;
|
|
2720
|
+
if (peg$silentFails === 0) {
|
|
2721
|
+
peg$fail(peg$e38);
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
if (s1 !== peg$FAILED) {
|
|
2725
|
+
s2 = [];
|
|
2726
|
+
s3 = peg$parsehtml_char();
|
|
2727
|
+
if (s3 === peg$FAILED) {
|
|
2728
|
+
s3 = peg$parsehtml_raw_string();
|
|
2729
|
+
}
|
|
2730
|
+
while (s3 !== peg$FAILED) {
|
|
2731
|
+
s2.push(s3);
|
|
2732
|
+
s3 = peg$parsehtml_char();
|
|
2733
|
+
if (s3 === peg$FAILED) {
|
|
2734
|
+
s3 = peg$parsehtml_raw_string();
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2737
|
+
if (input.charCodeAt(peg$currPos) === 62) {
|
|
2738
|
+
s3 = peg$c34;
|
|
2739
|
+
peg$currPos++;
|
|
2740
|
+
} else {
|
|
2741
|
+
s3 = peg$FAILED;
|
|
2742
|
+
if (peg$silentFails === 0) {
|
|
2743
|
+
peg$fail(peg$e39);
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
if (s3 !== peg$FAILED) {
|
|
2747
|
+
peg$savedPos = s0;
|
|
2748
|
+
s0 = peg$f44(s2);
|
|
2749
|
+
} else {
|
|
2750
|
+
peg$currPos = s0;
|
|
2751
|
+
s0 = peg$FAILED;
|
|
2752
|
+
}
|
|
2753
|
+
} else {
|
|
2754
|
+
peg$currPos = s0;
|
|
2755
|
+
s0 = peg$FAILED;
|
|
2756
|
+
}
|
|
2757
|
+
return s0;
|
|
2758
|
+
}
|
|
2759
|
+
function peg$parsehtml_char() {
|
|
2760
|
+
var s0, s1, s2, s3, s4;
|
|
2761
|
+
s0 = peg$currPos;
|
|
2762
|
+
s1 = [];
|
|
2763
|
+
s2 = peg$currPos;
|
|
2764
|
+
s3 = peg$currPos;
|
|
2765
|
+
peg$silentFails++;
|
|
2766
|
+
if (input.charCodeAt(peg$currPos) === 62) {
|
|
2767
|
+
s4 = peg$c34;
|
|
2768
|
+
peg$currPos++;
|
|
2769
|
+
} else {
|
|
2770
|
+
s4 = peg$FAILED;
|
|
2771
|
+
if (peg$silentFails === 0) {
|
|
2772
|
+
peg$fail(peg$e39);
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
if (s4 === peg$FAILED) {
|
|
2776
|
+
if (input.charCodeAt(peg$currPos) === 60) {
|
|
2777
|
+
s4 = peg$c33;
|
|
2778
|
+
peg$currPos++;
|
|
2779
|
+
} else {
|
|
2780
|
+
s4 = peg$FAILED;
|
|
2781
|
+
if (peg$silentFails === 0) {
|
|
2782
|
+
peg$fail(peg$e38);
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
peg$silentFails--;
|
|
2787
|
+
if (s4 === peg$FAILED) {
|
|
2788
|
+
s3 = void 0;
|
|
2789
|
+
} else {
|
|
2790
|
+
peg$currPos = s3;
|
|
2791
|
+
s3 = peg$FAILED;
|
|
2792
|
+
}
|
|
2793
|
+
if (s3 !== peg$FAILED) {
|
|
2794
|
+
if (input.length > peg$currPos) {
|
|
2795
|
+
s4 = input.charAt(peg$currPos);
|
|
2796
|
+
peg$currPos++;
|
|
2797
|
+
} else {
|
|
2798
|
+
s4 = peg$FAILED;
|
|
2799
|
+
if (peg$silentFails === 0) {
|
|
2800
|
+
peg$fail(peg$e28);
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
if (s4 !== peg$FAILED) {
|
|
2804
|
+
peg$savedPos = s2;
|
|
2805
|
+
s2 = peg$f45(s4);
|
|
2806
|
+
} else {
|
|
2807
|
+
peg$currPos = s2;
|
|
2808
|
+
s2 = peg$FAILED;
|
|
2809
|
+
}
|
|
2810
|
+
} else {
|
|
2811
|
+
peg$currPos = s2;
|
|
2812
|
+
s2 = peg$FAILED;
|
|
2813
|
+
}
|
|
2814
|
+
if (s2 !== peg$FAILED) {
|
|
2815
|
+
while (s2 !== peg$FAILED) {
|
|
2816
|
+
s1.push(s2);
|
|
2817
|
+
s2 = peg$currPos;
|
|
2818
|
+
s3 = peg$currPos;
|
|
2819
|
+
peg$silentFails++;
|
|
2820
|
+
if (input.charCodeAt(peg$currPos) === 62) {
|
|
2821
|
+
s4 = peg$c34;
|
|
2822
|
+
peg$currPos++;
|
|
2823
|
+
} else {
|
|
2824
|
+
s4 = peg$FAILED;
|
|
2825
|
+
if (peg$silentFails === 0) {
|
|
2826
|
+
peg$fail(peg$e39);
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
if (s4 === peg$FAILED) {
|
|
2830
|
+
if (input.charCodeAt(peg$currPos) === 60) {
|
|
2831
|
+
s4 = peg$c33;
|
|
2832
|
+
peg$currPos++;
|
|
2833
|
+
} else {
|
|
2834
|
+
s4 = peg$FAILED;
|
|
2835
|
+
if (peg$silentFails === 0) {
|
|
2836
|
+
peg$fail(peg$e38);
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
peg$silentFails--;
|
|
2841
|
+
if (s4 === peg$FAILED) {
|
|
2842
|
+
s3 = void 0;
|
|
2843
|
+
} else {
|
|
2844
|
+
peg$currPos = s3;
|
|
2845
|
+
s3 = peg$FAILED;
|
|
2846
|
+
}
|
|
2847
|
+
if (s3 !== peg$FAILED) {
|
|
2848
|
+
if (input.length > peg$currPos) {
|
|
2849
|
+
s4 = input.charAt(peg$currPos);
|
|
2850
|
+
peg$currPos++;
|
|
2851
|
+
} else {
|
|
2852
|
+
s4 = peg$FAILED;
|
|
2853
|
+
if (peg$silentFails === 0) {
|
|
2854
|
+
peg$fail(peg$e28);
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
if (s4 !== peg$FAILED) {
|
|
2858
|
+
peg$savedPos = s2;
|
|
2859
|
+
s2 = peg$f45(s4);
|
|
2860
|
+
} else {
|
|
2861
|
+
peg$currPos = s2;
|
|
2862
|
+
s2 = peg$FAILED;
|
|
2863
|
+
}
|
|
2864
|
+
} else {
|
|
2865
|
+
peg$currPos = s2;
|
|
2866
|
+
s2 = peg$FAILED;
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
} else {
|
|
2870
|
+
s1 = peg$FAILED;
|
|
2871
|
+
}
|
|
2872
|
+
if (s1 !== peg$FAILED) {
|
|
2873
|
+
peg$savedPos = s0;
|
|
2874
|
+
s1 = peg$f46(s1);
|
|
2875
|
+
}
|
|
2876
|
+
s0 = s1;
|
|
2877
|
+
return s0;
|
|
2878
|
+
}
|
|
2879
|
+
function peg$parseQUOTED_STRING() {
|
|
2880
|
+
var s0, s1, s2, s3;
|
|
2881
|
+
s0 = peg$currPos;
|
|
2882
|
+
if (input.charCodeAt(peg$currPos) === 34) {
|
|
2883
|
+
s1 = peg$c24;
|
|
2884
|
+
peg$currPos++;
|
|
2885
|
+
} else {
|
|
2886
|
+
s1 = peg$FAILED;
|
|
2887
|
+
if (peg$silentFails === 0) {
|
|
2888
|
+
peg$fail(peg$e25);
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
if (s1 !== peg$FAILED) {
|
|
2892
|
+
s2 = [];
|
|
2893
|
+
s3 = peg$parseDoubleStringCharacter();
|
|
2894
|
+
while (s3 !== peg$FAILED) {
|
|
2895
|
+
s2.push(s3);
|
|
2896
|
+
s3 = peg$parseDoubleStringCharacter();
|
|
2897
|
+
}
|
|
2898
|
+
if (input.charCodeAt(peg$currPos) === 34) {
|
|
2899
|
+
s3 = peg$c24;
|
|
2900
|
+
peg$currPos++;
|
|
2901
|
+
} else {
|
|
2902
|
+
s3 = peg$FAILED;
|
|
2903
|
+
if (peg$silentFails === 0) {
|
|
2904
|
+
peg$fail(peg$e25);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
if (s3 !== peg$FAILED) {
|
|
2908
|
+
peg$savedPos = s0;
|
|
2909
|
+
s0 = peg$f47(s2);
|
|
2910
|
+
} else {
|
|
2911
|
+
peg$currPos = s0;
|
|
2912
|
+
s0 = peg$FAILED;
|
|
2913
|
+
}
|
|
2914
|
+
} else {
|
|
2915
|
+
peg$currPos = s0;
|
|
2916
|
+
s0 = peg$FAILED;
|
|
2917
|
+
}
|
|
2918
|
+
return s0;
|
|
2919
|
+
}
|
|
2920
|
+
function peg$parseDoubleStringCharacter() {
|
|
2921
|
+
var s0, s1, s2;
|
|
2922
|
+
s0 = peg$parseQuoteEscape();
|
|
2923
|
+
if (s0 === peg$FAILED) {
|
|
2924
|
+
s0 = peg$currPos;
|
|
2925
|
+
s1 = peg$currPos;
|
|
2926
|
+
peg$silentFails++;
|
|
2927
|
+
if (input.charCodeAt(peg$currPos) === 34) {
|
|
2928
|
+
s2 = peg$c24;
|
|
2929
|
+
peg$currPos++;
|
|
2930
|
+
} else {
|
|
2931
|
+
s2 = peg$FAILED;
|
|
2932
|
+
if (peg$silentFails === 0) {
|
|
2933
|
+
peg$fail(peg$e25);
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
if (s2 === peg$FAILED) {
|
|
2937
|
+
s2 = peg$parseLineTerminator();
|
|
2938
|
+
}
|
|
2939
|
+
peg$silentFails--;
|
|
2940
|
+
if (s2 === peg$FAILED) {
|
|
2941
|
+
s1 = void 0;
|
|
2942
|
+
} else {
|
|
2943
|
+
peg$currPos = s1;
|
|
2944
|
+
s1 = peg$FAILED;
|
|
2945
|
+
}
|
|
2946
|
+
if (s1 !== peg$FAILED) {
|
|
2947
|
+
s2 = peg$parseSourceCharacter();
|
|
2948
|
+
if (s2 !== peg$FAILED) {
|
|
2949
|
+
peg$savedPos = s0;
|
|
2950
|
+
s0 = peg$f48();
|
|
2951
|
+
} else {
|
|
2952
|
+
peg$currPos = s0;
|
|
2953
|
+
s0 = peg$FAILED;
|
|
2954
|
+
}
|
|
2955
|
+
} else {
|
|
2956
|
+
peg$currPos = s0;
|
|
2957
|
+
s0 = peg$FAILED;
|
|
2958
|
+
}
|
|
2959
|
+
if (s0 === peg$FAILED) {
|
|
2960
|
+
s0 = peg$parseLineContinuation();
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
return s0;
|
|
2964
|
+
}
|
|
2965
|
+
function peg$parseQuoteEscape() {
|
|
2966
|
+
var s0, s1, s2, s3;
|
|
2967
|
+
s0 = peg$currPos;
|
|
2968
|
+
s1 = peg$currPos;
|
|
2969
|
+
if (input.charCodeAt(peg$currPos) === 92) {
|
|
2970
|
+
s2 = peg$c35;
|
|
2971
|
+
peg$currPos++;
|
|
2972
|
+
} else {
|
|
2973
|
+
s2 = peg$FAILED;
|
|
2974
|
+
if (peg$silentFails === 0) {
|
|
2975
|
+
peg$fail(peg$e40);
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
if (s2 !== peg$FAILED) {
|
|
2979
|
+
if (input.length > peg$currPos) {
|
|
2980
|
+
s3 = input.charAt(peg$currPos);
|
|
2981
|
+
peg$currPos++;
|
|
2982
|
+
} else {
|
|
2983
|
+
s3 = peg$FAILED;
|
|
2984
|
+
if (peg$silentFails === 0) {
|
|
2985
|
+
peg$fail(peg$e28);
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
if (s3 !== peg$FAILED) {
|
|
2989
|
+
s2 = [s2, s3];
|
|
2990
|
+
s1 = s2;
|
|
2991
|
+
} else {
|
|
2992
|
+
peg$currPos = s1;
|
|
2993
|
+
s1 = peg$FAILED;
|
|
2994
|
+
}
|
|
2995
|
+
} else {
|
|
2996
|
+
peg$currPos = s1;
|
|
2997
|
+
s1 = peg$FAILED;
|
|
2998
|
+
}
|
|
2999
|
+
if (s1 !== peg$FAILED) {
|
|
3000
|
+
peg$savedPos = s0;
|
|
3001
|
+
s1 = peg$f49(s1);
|
|
3002
|
+
}
|
|
3003
|
+
s0 = s1;
|
|
3004
|
+
return s0;
|
|
3005
|
+
}
|
|
3006
|
+
function peg$parseLineContinuation() {
|
|
3007
|
+
var s0, s1, s2;
|
|
3008
|
+
s0 = peg$currPos;
|
|
3009
|
+
if (input.charCodeAt(peg$currPos) === 92) {
|
|
3010
|
+
s1 = peg$c35;
|
|
3011
|
+
peg$currPos++;
|
|
3012
|
+
} else {
|
|
3013
|
+
s1 = peg$FAILED;
|
|
3014
|
+
if (peg$silentFails === 0) {
|
|
3015
|
+
peg$fail(peg$e40);
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
if (s1 !== peg$FAILED) {
|
|
3019
|
+
s2 = peg$parseLineTerminatorSequence();
|
|
3020
|
+
if (s2 !== peg$FAILED) {
|
|
3021
|
+
peg$savedPos = s0;
|
|
3022
|
+
s0 = peg$f50();
|
|
3023
|
+
} else {
|
|
3024
|
+
peg$currPos = s0;
|
|
3025
|
+
s0 = peg$FAILED;
|
|
3026
|
+
}
|
|
3027
|
+
} else {
|
|
3028
|
+
peg$currPos = s0;
|
|
3029
|
+
s0 = peg$FAILED;
|
|
3030
|
+
}
|
|
3031
|
+
return s0;
|
|
3032
|
+
}
|
|
3033
|
+
function peg$parseLineTerminator() {
|
|
3034
|
+
var s0;
|
|
3035
|
+
if (peg$r1.test(input.charAt(peg$currPos))) {
|
|
3036
|
+
s0 = input.charAt(peg$currPos);
|
|
3037
|
+
peg$currPos++;
|
|
3038
|
+
} else {
|
|
3039
|
+
s0 = peg$FAILED;
|
|
3040
|
+
if (peg$silentFails === 0) {
|
|
3041
|
+
peg$fail(peg$e41);
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
return s0;
|
|
3045
|
+
}
|
|
3046
|
+
function peg$parseLineTerminatorSequence() {
|
|
3047
|
+
var s0;
|
|
3048
|
+
peg$silentFails++;
|
|
3049
|
+
if (input.charCodeAt(peg$currPos) === 10) {
|
|
3050
|
+
s0 = peg$c36;
|
|
3051
|
+
peg$currPos++;
|
|
3052
|
+
} else {
|
|
3053
|
+
s0 = peg$FAILED;
|
|
3054
|
+
if (peg$silentFails === 0) {
|
|
3055
|
+
peg$fail(peg$e43);
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
if (s0 === peg$FAILED) {
|
|
3059
|
+
if (input.substr(peg$currPos, 2) === peg$c37) {
|
|
3060
|
+
s0 = peg$c37;
|
|
3061
|
+
peg$currPos += 2;
|
|
3062
|
+
} else {
|
|
3063
|
+
s0 = peg$FAILED;
|
|
3064
|
+
if (peg$silentFails === 0) {
|
|
3065
|
+
peg$fail(peg$e44);
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
if (s0 === peg$FAILED) {
|
|
3069
|
+
if (input.charCodeAt(peg$currPos) === 13) {
|
|
3070
|
+
s0 = peg$c38;
|
|
3071
|
+
peg$currPos++;
|
|
3072
|
+
} else {
|
|
3073
|
+
s0 = peg$FAILED;
|
|
3074
|
+
if (peg$silentFails === 0) {
|
|
3075
|
+
peg$fail(peg$e45);
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
if (s0 === peg$FAILED) {
|
|
3079
|
+
if (input.charCodeAt(peg$currPos) === 8232) {
|
|
3080
|
+
s0 = peg$c39;
|
|
3081
|
+
peg$currPos++;
|
|
3082
|
+
} else {
|
|
3083
|
+
s0 = peg$FAILED;
|
|
3084
|
+
if (peg$silentFails === 0) {
|
|
3085
|
+
peg$fail(peg$e46);
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
if (s0 === peg$FAILED) {
|
|
3089
|
+
if (input.charCodeAt(peg$currPos) === 8233) {
|
|
3090
|
+
s0 = peg$c40;
|
|
3091
|
+
peg$currPos++;
|
|
3092
|
+
} else {
|
|
3093
|
+
s0 = peg$FAILED;
|
|
3094
|
+
if (peg$silentFails === 0) {
|
|
3095
|
+
peg$fail(peg$e47);
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
peg$silentFails--;
|
|
3103
|
+
if (s0 === peg$FAILED) {
|
|
3104
|
+
if (peg$silentFails === 0) {
|
|
3105
|
+
peg$fail(peg$e42);
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
return s0;
|
|
3109
|
+
}
|
|
3110
|
+
function peg$parseSourceCharacter() {
|
|
3111
|
+
var s0;
|
|
3112
|
+
if (input.length > peg$currPos) {
|
|
3113
|
+
s0 = input.charAt(peg$currPos);
|
|
3114
|
+
peg$currPos++;
|
|
3115
|
+
} else {
|
|
3116
|
+
s0 = peg$FAILED;
|
|
3117
|
+
if (peg$silentFails === 0) {
|
|
3118
|
+
peg$fail(peg$e28);
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
return s0;
|
|
3122
|
+
}
|
|
3123
|
+
function peg$parse_() {
|
|
3124
|
+
var s0, s1;
|
|
3125
|
+
peg$silentFails++;
|
|
3126
|
+
s0 = [];
|
|
3127
|
+
s1 = peg$parse_whitespace();
|
|
3128
|
+
while (s1 !== peg$FAILED) {
|
|
3129
|
+
s0.push(s1);
|
|
3130
|
+
s1 = peg$parse_whitespace();
|
|
3131
|
+
}
|
|
3132
|
+
peg$silentFails--;
|
|
3133
|
+
s1 = peg$FAILED;
|
|
3134
|
+
if (peg$silentFails === 0) {
|
|
3135
|
+
peg$fail(peg$e50);
|
|
3136
|
+
}
|
|
3137
|
+
return s0;
|
|
3138
|
+
}
|
|
3139
|
+
function peg$parse__() {
|
|
3140
|
+
var s0, s1;
|
|
3141
|
+
peg$silentFails++;
|
|
3142
|
+
s0 = [];
|
|
3143
|
+
s1 = peg$parse_whitespace();
|
|
3144
|
+
if (s1 === peg$FAILED) {
|
|
3145
|
+
s1 = peg$parse_newline();
|
|
3146
|
+
}
|
|
3147
|
+
while (s1 !== peg$FAILED) {
|
|
3148
|
+
s0.push(s1);
|
|
3149
|
+
s1 = peg$parse_whitespace();
|
|
3150
|
+
if (s1 === peg$FAILED) {
|
|
3151
|
+
s1 = peg$parse_newline();
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
peg$silentFails--;
|
|
3155
|
+
s1 = peg$FAILED;
|
|
3156
|
+
if (peg$silentFails === 0) {
|
|
3157
|
+
peg$fail(peg$e51);
|
|
3158
|
+
}
|
|
3159
|
+
return s0;
|
|
3160
|
+
}
|
|
3161
|
+
function peg$parse_newline() {
|
|
3162
|
+
var s0;
|
|
3163
|
+
if (peg$r3.test(input.charAt(peg$currPos))) {
|
|
3164
|
+
s0 = input.charAt(peg$currPos);
|
|
3165
|
+
peg$currPos++;
|
|
3166
|
+
} else {
|
|
3167
|
+
s0 = peg$FAILED;
|
|
3168
|
+
if (peg$silentFails === 0) {
|
|
3169
|
+
peg$fail(peg$e52);
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
return s0;
|
|
3173
|
+
}
|
|
3174
|
+
function peg$parse_whitespace() {
|
|
3175
|
+
var s0;
|
|
3176
|
+
if (peg$r4.test(input.charAt(peg$currPos))) {
|
|
3177
|
+
s0 = input.charAt(peg$currPos);
|
|
3178
|
+
peg$currPos++;
|
|
3179
|
+
} else {
|
|
3180
|
+
s0 = peg$FAILED;
|
|
3181
|
+
if (peg$silentFails === 0) {
|
|
3182
|
+
peg$fail(peg$e53);
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
return s0;
|
|
3186
|
+
}
|
|
3187
|
+
function peg$parseUnicodeLetter() {
|
|
3188
|
+
var s0;
|
|
3189
|
+
s0 = peg$parseLu();
|
|
3190
|
+
if (s0 === peg$FAILED) {
|
|
3191
|
+
s0 = peg$parseLl();
|
|
3192
|
+
if (s0 === peg$FAILED) {
|
|
3193
|
+
s0 = peg$parseLt();
|
|
3194
|
+
if (s0 === peg$FAILED) {
|
|
3195
|
+
s0 = peg$parseLm();
|
|
3196
|
+
if (s0 === peg$FAILED) {
|
|
3197
|
+
s0 = peg$parseLo();
|
|
3198
|
+
if (s0 === peg$FAILED) {
|
|
3199
|
+
s0 = peg$parseNl();
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
return s0;
|
|
3206
|
+
}
|
|
3207
|
+
function peg$parseLl() {
|
|
3208
|
+
var s0;
|
|
3209
|
+
if (peg$r5.test(input.charAt(peg$currPos))) {
|
|
3210
|
+
s0 = input.charAt(peg$currPos);
|
|
3211
|
+
peg$currPos++;
|
|
3212
|
+
} else {
|
|
3213
|
+
s0 = peg$FAILED;
|
|
3214
|
+
if (peg$silentFails === 0) {
|
|
3215
|
+
peg$fail(peg$e54);
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
return s0;
|
|
3219
|
+
}
|
|
3220
|
+
function peg$parseLm() {
|
|
3221
|
+
var s0;
|
|
3222
|
+
if (peg$r6.test(input.charAt(peg$currPos))) {
|
|
3223
|
+
s0 = input.charAt(peg$currPos);
|
|
3224
|
+
peg$currPos++;
|
|
3225
|
+
} else {
|
|
3226
|
+
s0 = peg$FAILED;
|
|
3227
|
+
if (peg$silentFails === 0) {
|
|
3228
|
+
peg$fail(peg$e55);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
return s0;
|
|
3232
|
+
}
|
|
3233
|
+
function peg$parseLo() {
|
|
3234
|
+
var s0;
|
|
3235
|
+
if (peg$r7.test(input.charAt(peg$currPos))) {
|
|
3236
|
+
s0 = input.charAt(peg$currPos);
|
|
3237
|
+
peg$currPos++;
|
|
3238
|
+
} else {
|
|
3239
|
+
s0 = peg$FAILED;
|
|
3240
|
+
if (peg$silentFails === 0) {
|
|
3241
|
+
peg$fail(peg$e56);
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
return s0;
|
|
3245
|
+
}
|
|
3246
|
+
function peg$parseLt() {
|
|
3247
|
+
var s0;
|
|
3248
|
+
if (peg$r8.test(input.charAt(peg$currPos))) {
|
|
3249
|
+
s0 = input.charAt(peg$currPos);
|
|
3250
|
+
peg$currPos++;
|
|
3251
|
+
} else {
|
|
3252
|
+
s0 = peg$FAILED;
|
|
3253
|
+
if (peg$silentFails === 0) {
|
|
3254
|
+
peg$fail(peg$e57);
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
return s0;
|
|
3258
|
+
}
|
|
3259
|
+
function peg$parseLu() {
|
|
3260
|
+
var s0;
|
|
3261
|
+
if (peg$r9.test(input.charAt(peg$currPos))) {
|
|
3262
|
+
s0 = input.charAt(peg$currPos);
|
|
3263
|
+
peg$currPos++;
|
|
3264
|
+
} else {
|
|
3265
|
+
s0 = peg$FAILED;
|
|
3266
|
+
if (peg$silentFails === 0) {
|
|
3267
|
+
peg$fail(peg$e58);
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
return s0;
|
|
3271
|
+
}
|
|
3272
|
+
function peg$parseNl() {
|
|
3273
|
+
var s0;
|
|
3274
|
+
if (peg$r10.test(input.charAt(peg$currPos))) {
|
|
3275
|
+
s0 = input.charAt(peg$currPos);
|
|
3276
|
+
peg$currPos++;
|
|
3277
|
+
} else {
|
|
3278
|
+
s0 = peg$FAILED;
|
|
3279
|
+
if (peg$silentFails === 0) {
|
|
3280
|
+
peg$fail(peg$e59);
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
return s0;
|
|
3284
|
+
}
|
|
3285
|
+
function peg$parseNd() {
|
|
3286
|
+
var s0;
|
|
3287
|
+
if (peg$r11.test(input.charAt(peg$currPos))) {
|
|
3288
|
+
s0 = input.charAt(peg$currPos);
|
|
3289
|
+
peg$currPos++;
|
|
3290
|
+
} else {
|
|
3291
|
+
s0 = peg$FAILED;
|
|
3292
|
+
if (peg$silentFails === 0) {
|
|
3293
|
+
peg$fail(peg$e60);
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
return s0;
|
|
3297
|
+
}
|
|
3298
|
+
function dedent(value) {
|
|
3299
|
+
const str = value.trim();
|
|
3300
|
+
const matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
3301
|
+
if (matches) {
|
|
3302
|
+
const indentLengths = matches.map((match) => {
|
|
3303
|
+
var _a;
|
|
3304
|
+
return ((_a = match.match(/[\t ]/g)) == null ? void 0 : _a.length) ?? 0;
|
|
3305
|
+
});
|
|
3306
|
+
const pattern = new RegExp(`
|
|
3307
|
+
[ ]{${Math.min(...indentLengths)}}`, "g");
|
|
3308
|
+
return str.replace(pattern, "\n");
|
|
3309
|
+
}
|
|
3310
|
+
return str;
|
|
3311
|
+
}
|
|
3312
|
+
const edgeops = [];
|
|
3313
|
+
const b = new Builder({
|
|
3314
|
+
// @ts-ignore
|
|
3315
|
+
locationFunction: location
|
|
3316
|
+
});
|
|
3317
|
+
peg$result = peg$startRuleFunction();
|
|
3318
|
+
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
3319
|
+
return peg$result;
|
|
3320
|
+
} else {
|
|
3321
|
+
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
3322
|
+
peg$fail(peg$endExpectation());
|
|
3323
|
+
}
|
|
3324
|
+
throw peg$buildStructuredError(
|
|
3325
|
+
// @ts-ignore
|
|
3326
|
+
peg$maxFailExpected,
|
|
3327
|
+
// @ts-ignore
|
|
3328
|
+
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
|
|
3329
|
+
// @ts-ignore
|
|
3330
|
+
peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
|
|
3331
|
+
);
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
return {
|
|
3335
|
+
SyntaxError: peg$SyntaxError,
|
|
3336
|
+
parse: peg$parse
|
|
3337
|
+
};
|
|
3338
|
+
}()
|
|
3339
|
+
);
|
|
3340
|
+
peggyParser.SyntaxError.prototype.name = "PeggySyntaxError";
|
|
3341
|
+
const parse$1 = peggyParser.parse;
|
|
3342
|
+
const PeggySyntaxError = peggyParser.SyntaxError;
|
|
3343
|
+
function parse(input, options) {
|
|
3344
|
+
try {
|
|
3345
|
+
return parse$1(input, options);
|
|
3346
|
+
} catch (e) {
|
|
3347
|
+
if (e instanceof PeggySyntaxError) {
|
|
3348
|
+
throw new DotSyntaxError(e.message, e.expected, e.found, e.location);
|
|
3349
|
+
}
|
|
3350
|
+
throw e;
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
class DotSyntaxError extends PeggySyntaxError {
|
|
3354
|
+
constructor(...args) {
|
|
3355
|
+
super(...args);
|
|
3356
|
+
this.name = "DotSyntaxError";
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
function convertAttribute(key, value) {
|
|
3360
|
+
if (typeof value === "string") {
|
|
3361
|
+
const trimmed = value.trim();
|
|
3362
|
+
const isHTMLLike = /^<.+>$/ms.test(trimmed);
|
|
3363
|
+
if (isHTMLLike) {
|
|
3364
|
+
return createElement(
|
|
3365
|
+
"Attribute",
|
|
3366
|
+
{
|
|
3367
|
+
key: createElement("Literal", { value: key, quoted: false }, []),
|
|
3368
|
+
value: createElement(
|
|
3369
|
+
"Literal",
|
|
3370
|
+
{ value: trimmed.slice(1, trimmed.length - 1), quoted: "html" },
|
|
3371
|
+
[]
|
|
3372
|
+
)
|
|
3373
|
+
},
|
|
3374
|
+
[]
|
|
3375
|
+
);
|
|
3376
|
+
}
|
|
3377
|
+
return createElement(
|
|
3378
|
+
"Attribute",
|
|
3379
|
+
{
|
|
3380
|
+
key: createElement("Literal", { value: key, quoted: false }, []),
|
|
3381
|
+
value: createElement("Literal", { value, quoted: true }, [])
|
|
3382
|
+
},
|
|
3383
|
+
[]
|
|
3384
|
+
);
|
|
3385
|
+
}
|
|
3386
|
+
return createElement(
|
|
3387
|
+
"Attribute",
|
|
3388
|
+
{
|
|
3389
|
+
key: createElement("Literal", { value: key, quoted: false }, []),
|
|
3390
|
+
value: createElement(
|
|
3391
|
+
"Literal",
|
|
3392
|
+
{ value: String(value), quoted: false },
|
|
3393
|
+
[]
|
|
3394
|
+
)
|
|
3395
|
+
},
|
|
3396
|
+
[]
|
|
3397
|
+
);
|
|
3398
|
+
}
|
|
3399
|
+
function convertComment(value, kind) {
|
|
3400
|
+
return createElement(
|
|
3401
|
+
"Comment",
|
|
3402
|
+
{
|
|
3403
|
+
kind,
|
|
3404
|
+
value
|
|
3405
|
+
},
|
|
3406
|
+
[]
|
|
3407
|
+
);
|
|
3408
|
+
}
|
|
3409
|
+
function convertClusterChildren(context, model) {
|
|
3410
|
+
return Array.from(
|
|
3411
|
+
function* () {
|
|
3412
|
+
for (const [key, value] of model.values) {
|
|
3413
|
+
yield convertAttribute(key, value);
|
|
3414
|
+
}
|
|
3415
|
+
for (const attrs of Object.values(model.attributes)) {
|
|
3416
|
+
if (attrs.size > 0) {
|
|
3417
|
+
if (attrs.comment) {
|
|
3418
|
+
yield convertComment(attrs.comment, context.commentKind);
|
|
3419
|
+
}
|
|
3420
|
+
yield context.convert(attrs);
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
for (const node of model.nodes) {
|
|
3424
|
+
if (node.comment) {
|
|
3425
|
+
yield convertComment(node.comment, context.commentKind);
|
|
3426
|
+
}
|
|
3427
|
+
yield context.convert(node);
|
|
3428
|
+
}
|
|
3429
|
+
for (const subgraph of model.subgraphs) {
|
|
3430
|
+
if (subgraph.comment) {
|
|
3431
|
+
yield convertComment(subgraph.comment, context.commentKind);
|
|
3432
|
+
}
|
|
3433
|
+
yield context.convert(subgraph);
|
|
3434
|
+
}
|
|
3435
|
+
for (const edge of model.edges) {
|
|
3436
|
+
if (edge.comment) {
|
|
3437
|
+
yield convertComment(edge.comment, context.commentKind);
|
|
3438
|
+
}
|
|
3439
|
+
yield context.convert(edge);
|
|
3440
|
+
}
|
|
3441
|
+
}()
|
|
3442
|
+
);
|
|
3443
|
+
}
|
|
3444
|
+
const AttributeListPlugin = {
|
|
3445
|
+
match(model) {
|
|
3446
|
+
return model.$$type === "AttributeList";
|
|
3447
|
+
},
|
|
3448
|
+
convert(context, model) {
|
|
3449
|
+
return createElement(
|
|
3450
|
+
"AttributeList",
|
|
3451
|
+
{
|
|
3452
|
+
kind: model.$$kind
|
|
3453
|
+
},
|
|
3454
|
+
model.values.map(([key, value]) => convertAttribute(key, value))
|
|
3455
|
+
);
|
|
3456
|
+
}
|
|
3457
|
+
};
|
|
3458
|
+
const EdgePlugin$1 = {
|
|
3459
|
+
match(model) {
|
|
3460
|
+
return model.$$type === "Edge";
|
|
3461
|
+
},
|
|
3462
|
+
convert(context, model) {
|
|
3463
|
+
return createElement(
|
|
3464
|
+
"Edge",
|
|
3465
|
+
{
|
|
3466
|
+
targets: model.targets.map((target) => {
|
|
3467
|
+
if (isNodeModel(target)) {
|
|
3468
|
+
return createElement(
|
|
3469
|
+
"NodeRef",
|
|
3470
|
+
{
|
|
3471
|
+
id: createElement(
|
|
3472
|
+
"Literal",
|
|
3473
|
+
{
|
|
3474
|
+
value: target.id,
|
|
3475
|
+
quoted: true
|
|
3476
|
+
},
|
|
3477
|
+
[]
|
|
3478
|
+
)
|
|
3479
|
+
},
|
|
3480
|
+
[]
|
|
3481
|
+
);
|
|
3482
|
+
}
|
|
3483
|
+
if (isForwardRefNode(target)) {
|
|
3484
|
+
return createElement(
|
|
3485
|
+
"NodeRef",
|
|
3486
|
+
{
|
|
3487
|
+
id: createElement(
|
|
3488
|
+
"Literal",
|
|
3489
|
+
{
|
|
3490
|
+
value: target.id,
|
|
3491
|
+
quoted: true
|
|
3492
|
+
},
|
|
3493
|
+
[]
|
|
3494
|
+
),
|
|
3495
|
+
port: target.port ? createElement(
|
|
3496
|
+
"Literal",
|
|
3497
|
+
{
|
|
3498
|
+
value: target.port,
|
|
3499
|
+
quoted: true
|
|
3500
|
+
},
|
|
3501
|
+
[]
|
|
3502
|
+
) : void 0,
|
|
3503
|
+
compass: target.compass ? createElement(
|
|
3504
|
+
"Literal",
|
|
3505
|
+
{
|
|
3506
|
+
value: target.compass,
|
|
3507
|
+
quoted: true
|
|
3508
|
+
},
|
|
3509
|
+
[]
|
|
3510
|
+
) : void 0
|
|
3511
|
+
},
|
|
3512
|
+
[]
|
|
3513
|
+
);
|
|
3514
|
+
}
|
|
3515
|
+
return createElement(
|
|
3516
|
+
"NodeRefGroup",
|
|
3517
|
+
{},
|
|
3518
|
+
target.map((n) => {
|
|
3519
|
+
if (isNodeModel(n)) {
|
|
3520
|
+
return createElement(
|
|
3521
|
+
"NodeRef",
|
|
3522
|
+
{
|
|
3523
|
+
id: createElement(
|
|
3524
|
+
"Literal",
|
|
3525
|
+
{
|
|
3526
|
+
value: n.id,
|
|
3527
|
+
quoted: true
|
|
3528
|
+
},
|
|
3529
|
+
[]
|
|
3530
|
+
)
|
|
3531
|
+
},
|
|
3532
|
+
[]
|
|
3533
|
+
);
|
|
3534
|
+
}
|
|
3535
|
+
return createElement(
|
|
3536
|
+
"NodeRef",
|
|
3537
|
+
{
|
|
3538
|
+
id: createElement(
|
|
3539
|
+
"Literal",
|
|
3540
|
+
{
|
|
3541
|
+
value: n.id,
|
|
3542
|
+
quoted: true
|
|
3543
|
+
},
|
|
3544
|
+
[]
|
|
3545
|
+
),
|
|
3546
|
+
port: n.port ? createElement(
|
|
3547
|
+
"Literal",
|
|
3548
|
+
{
|
|
3549
|
+
value: n.port,
|
|
3550
|
+
quoted: true
|
|
3551
|
+
},
|
|
3552
|
+
[]
|
|
3553
|
+
) : void 0,
|
|
3554
|
+
compass: n.compass ? createElement(
|
|
3555
|
+
"Literal",
|
|
3556
|
+
{
|
|
3557
|
+
value: n.compass,
|
|
3558
|
+
quoted: true
|
|
3559
|
+
},
|
|
3560
|
+
[]
|
|
3561
|
+
) : void 0
|
|
3562
|
+
},
|
|
3563
|
+
[]
|
|
3564
|
+
);
|
|
3565
|
+
})
|
|
3566
|
+
);
|
|
3567
|
+
})
|
|
3568
|
+
},
|
|
3569
|
+
[
|
|
3570
|
+
...model.attributes.comment ? [convertComment(model.attributes.comment, context.commentKind)] : [],
|
|
3571
|
+
...model.attributes.values.map(
|
|
3572
|
+
([key, value]) => convertAttribute(key, value)
|
|
3573
|
+
)
|
|
3574
|
+
]
|
|
3575
|
+
);
|
|
3576
|
+
}
|
|
3577
|
+
};
|
|
3578
|
+
const GraphPlugin$1 = {
|
|
3579
|
+
match(model) {
|
|
3580
|
+
return model.$$type === "Graph";
|
|
3581
|
+
},
|
|
3582
|
+
convert(context, model) {
|
|
3583
|
+
return createElement("Dot", {}, [
|
|
3584
|
+
...model.comment ? [convertComment(model.comment, context.commentKind)] : [],
|
|
3585
|
+
createElement(
|
|
3586
|
+
"Graph",
|
|
3587
|
+
{
|
|
3588
|
+
directed: model.directed,
|
|
3589
|
+
strict: model.strict,
|
|
3590
|
+
id: model.id ? createElement(
|
|
3591
|
+
"Literal",
|
|
3592
|
+
{
|
|
3593
|
+
value: model.id,
|
|
3594
|
+
quoted: true
|
|
3595
|
+
},
|
|
3596
|
+
[]
|
|
3597
|
+
) : void 0
|
|
3598
|
+
},
|
|
3599
|
+
convertClusterChildren(context, model)
|
|
3600
|
+
)
|
|
3601
|
+
]);
|
|
3602
|
+
}
|
|
3603
|
+
};
|
|
3604
|
+
const NodePlugin$1 = {
|
|
3605
|
+
match(model) {
|
|
3606
|
+
return model.$$type === "Node";
|
|
3607
|
+
},
|
|
3608
|
+
convert(context, model) {
|
|
3609
|
+
return createElement(
|
|
3610
|
+
"Node",
|
|
3611
|
+
{
|
|
3612
|
+
id: createElement(
|
|
3613
|
+
"Literal",
|
|
3614
|
+
{
|
|
3615
|
+
value: model.id,
|
|
3616
|
+
quoted: true
|
|
3617
|
+
},
|
|
3618
|
+
[]
|
|
3619
|
+
)
|
|
3620
|
+
},
|
|
3621
|
+
[
|
|
3622
|
+
...model.attributes.comment ? [convertComment(model.attributes.comment, context.commentKind)] : [],
|
|
3623
|
+
...model.attributes.values.map(
|
|
3624
|
+
([key, value]) => convertAttribute(key, value)
|
|
3625
|
+
)
|
|
3626
|
+
]
|
|
3627
|
+
);
|
|
3628
|
+
}
|
|
3629
|
+
};
|
|
3630
|
+
const SubgraphPlugin$1 = {
|
|
3631
|
+
match(model) {
|
|
3632
|
+
return model.$$type === "Subgraph";
|
|
3633
|
+
},
|
|
3634
|
+
convert(context, model) {
|
|
3635
|
+
return createElement(
|
|
3636
|
+
"Subgraph",
|
|
3637
|
+
{
|
|
3638
|
+
id: model.id ? createElement(
|
|
3639
|
+
"Literal",
|
|
3640
|
+
{
|
|
3641
|
+
value: model.id,
|
|
3642
|
+
quoted: true
|
|
3643
|
+
},
|
|
3644
|
+
[]
|
|
3645
|
+
) : void 0
|
|
3646
|
+
},
|
|
3647
|
+
convertClusterChildren(context, model)
|
|
3648
|
+
);
|
|
3649
|
+
}
|
|
3650
|
+
};
|
|
3651
|
+
const defaultPlugins$1 = [
|
|
3652
|
+
AttributeListPlugin,
|
|
3653
|
+
EdgePlugin$1,
|
|
3654
|
+
NodePlugin$1,
|
|
3655
|
+
GraphPlugin$1,
|
|
3656
|
+
SubgraphPlugin$1
|
|
3657
|
+
];
|
|
3658
|
+
class FromModelConverter {
|
|
3659
|
+
constructor(options = {}) {
|
|
3660
|
+
/** @hidden */
|
|
3661
|
+
__privateAdd(this, _plugins2, [...defaultPlugins$1]);
|
|
3662
|
+
this.options = options;
|
|
3663
|
+
}
|
|
3664
|
+
/**
|
|
3665
|
+
* Converts a DotObjectModel into an AST.
|
|
3666
|
+
*
|
|
3667
|
+
* @param model The {@link DotObjectModel} to be converted.
|
|
3668
|
+
* @returns The AST generated from the model.
|
|
3669
|
+
*/
|
|
3670
|
+
convert(model) {
|
|
3671
|
+
const plugins = [...__privateGet(this, _plugins2)];
|
|
3672
|
+
const { commentKind = "Slash" } = this.options;
|
|
3673
|
+
const context = {
|
|
3674
|
+
commentKind,
|
|
3675
|
+
convert(m) {
|
|
3676
|
+
for (const plugin of plugins) {
|
|
3677
|
+
if (plugin.match(m)) {
|
|
3678
|
+
return plugin.convert(context, m);
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
throw Error();
|
|
3682
|
+
}
|
|
3683
|
+
};
|
|
3684
|
+
return context.convert(model);
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
_plugins2 = new WeakMap();
|
|
3688
|
+
function fromModel(model, options) {
|
|
3689
|
+
return new FromModelConverter(options).convert(model);
|
|
3690
|
+
}
|
|
3691
|
+
class CommentHolder {
|
|
3692
|
+
constructor() {
|
|
3693
|
+
__publicField(this, "comment", null);
|
|
3694
|
+
}
|
|
3695
|
+
set(comment) {
|
|
3696
|
+
this.comment = comment;
|
|
3697
|
+
}
|
|
3698
|
+
reset() {
|
|
3699
|
+
this.comment = null;
|
|
3700
|
+
}
|
|
3701
|
+
apply(model, location) {
|
|
3702
|
+
var _a, _b, _c;
|
|
3703
|
+
if (location && ((_a = this.comment) == null ? void 0 : _a.location)) {
|
|
3704
|
+
if (((_b = this.comment) == null ? void 0 : _b.kind) === "Block") {
|
|
3705
|
+
if (this.comment.location.end.line === location.start.line - 1) {
|
|
3706
|
+
model.comment = this.comment.value;
|
|
3707
|
+
}
|
|
3708
|
+
} else {
|
|
3709
|
+
if (this.comment.location.end.line === location.start.line) {
|
|
3710
|
+
model.comment = this.comment.value;
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3713
|
+
} else {
|
|
3714
|
+
model.comment = (_c = this.comment) == null ? void 0 : _c.value;
|
|
3715
|
+
}
|
|
3716
|
+
this.reset();
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
const DotPlugin = {
|
|
3720
|
+
match(ast) {
|
|
3721
|
+
return ast.type === "Dot";
|
|
3722
|
+
},
|
|
3723
|
+
convert(context, ast) {
|
|
3724
|
+
const commentHolder = new CommentHolder();
|
|
3725
|
+
for (const stmt of ast.children) {
|
|
3726
|
+
switch (stmt.type) {
|
|
3727
|
+
case "Comment":
|
|
3728
|
+
commentHolder.set(stmt);
|
|
3729
|
+
break;
|
|
3730
|
+
case "Graph": {
|
|
3731
|
+
const graph = context.convert(stmt);
|
|
3732
|
+
commentHolder.apply(graph, stmt.location);
|
|
3733
|
+
return graph;
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
throw Error();
|
|
3738
|
+
}
|
|
3739
|
+
};
|
|
3740
|
+
function convertToEdgeTargetTuple(edge) {
|
|
3741
|
+
return edge.targets.map((t) => {
|
|
3742
|
+
var _a, _b;
|
|
3743
|
+
switch (t.type) {
|
|
3744
|
+
case "NodeRef":
|
|
3745
|
+
return {
|
|
3746
|
+
id: t.id.value,
|
|
3747
|
+
port: (_a = t.port) == null ? void 0 : _a.value,
|
|
3748
|
+
compass: (_b = t.compass) == null ? void 0 : _b.value
|
|
3749
|
+
};
|
|
3750
|
+
case "NodeRefGroup":
|
|
3751
|
+
return t.children.map((t2) => {
|
|
3752
|
+
var _a2, _b2;
|
|
3753
|
+
return {
|
|
3754
|
+
id: t2.id.value,
|
|
3755
|
+
port: (_a2 = t2.port) == null ? void 0 : _a2.value,
|
|
3756
|
+
compass: (_b2 = t2.compass) == null ? void 0 : _b2.value
|
|
3757
|
+
};
|
|
3758
|
+
});
|
|
3759
|
+
}
|
|
3760
|
+
});
|
|
3761
|
+
}
|
|
3762
|
+
const EdgePlugin = {
|
|
3763
|
+
match(ast) {
|
|
3764
|
+
return ast.type === "Edge";
|
|
3765
|
+
},
|
|
3766
|
+
convert(context, ast) {
|
|
3767
|
+
const edge = new context.models.Edge(
|
|
3768
|
+
convertToEdgeTargetTuple(ast),
|
|
3769
|
+
ast.children.filter(
|
|
3770
|
+
(v) => v.type === "Attribute"
|
|
3771
|
+
).reduce(
|
|
3772
|
+
(acc, curr) => {
|
|
3773
|
+
acc[curr.key.value] = curr.value.value;
|
|
3774
|
+
return acc;
|
|
3775
|
+
},
|
|
3776
|
+
{}
|
|
3777
|
+
)
|
|
3778
|
+
);
|
|
3779
|
+
return edge;
|
|
3780
|
+
}
|
|
3781
|
+
};
|
|
3782
|
+
function applyStatements(graph, statements) {
|
|
3783
|
+
const commentHolder = new CommentHolder();
|
|
3784
|
+
for (const stmt of statements) {
|
|
3785
|
+
switch (stmt.type) {
|
|
3786
|
+
case "Subgraph": {
|
|
3787
|
+
const subgraph = stmt.id ? graph.subgraph(stmt.id.value) : graph.subgraph();
|
|
3788
|
+
applyStatements(subgraph, stmt.children);
|
|
3789
|
+
commentHolder.apply(subgraph, stmt.location);
|
|
3790
|
+
break;
|
|
3791
|
+
}
|
|
3792
|
+
case "Attribute":
|
|
3793
|
+
graph.set(stmt.key.value, stmt.value.value);
|
|
3794
|
+
commentHolder.reset();
|
|
3795
|
+
break;
|
|
3796
|
+
case "Node":
|
|
3797
|
+
commentHolder.apply(
|
|
3798
|
+
graph.node(
|
|
3799
|
+
stmt.id.value,
|
|
3800
|
+
stmt.children.filter(
|
|
3801
|
+
(v) => v.type === "Attribute"
|
|
3802
|
+
).reduce(
|
|
3803
|
+
(acc, curr) => {
|
|
3804
|
+
acc[curr.key.value] = curr.value.value;
|
|
3805
|
+
return acc;
|
|
3806
|
+
},
|
|
3807
|
+
{}
|
|
3808
|
+
)
|
|
3809
|
+
),
|
|
3810
|
+
stmt.location
|
|
3811
|
+
);
|
|
3812
|
+
break;
|
|
3813
|
+
case "Edge":
|
|
3814
|
+
commentHolder.apply(
|
|
3815
|
+
graph.edge(
|
|
3816
|
+
convertToEdgeTargetTuple(stmt),
|
|
3817
|
+
stmt.children.filter(
|
|
3818
|
+
(v) => v.type === "Attribute"
|
|
3819
|
+
).reduce(
|
|
3820
|
+
(acc, curr) => {
|
|
3821
|
+
acc[curr.key.value] = curr.value.value;
|
|
3822
|
+
return acc;
|
|
3823
|
+
},
|
|
3824
|
+
{}
|
|
3825
|
+
)
|
|
3826
|
+
),
|
|
3827
|
+
stmt.location
|
|
3828
|
+
);
|
|
3829
|
+
break;
|
|
3830
|
+
case "AttributeList": {
|
|
3831
|
+
const attrs = stmt.children.filter(
|
|
3832
|
+
(v) => v.type === "Attribute"
|
|
3833
|
+
).reduce(
|
|
3834
|
+
(acc, curr) => {
|
|
3835
|
+
acc[curr.key.value] = curr.value.value;
|
|
3836
|
+
return acc;
|
|
3837
|
+
},
|
|
3838
|
+
{}
|
|
3839
|
+
);
|
|
3840
|
+
switch (stmt.kind) {
|
|
3841
|
+
case "Edge":
|
|
3842
|
+
graph.edge(attrs);
|
|
3843
|
+
break;
|
|
3844
|
+
case "Node":
|
|
3845
|
+
graph.node(attrs);
|
|
3846
|
+
break;
|
|
3847
|
+
case "Graph":
|
|
3848
|
+
graph.graph(attrs);
|
|
3849
|
+
break;
|
|
3850
|
+
}
|
|
3851
|
+
commentHolder.reset();
|
|
3852
|
+
break;
|
|
3853
|
+
}
|
|
3854
|
+
case "Comment":
|
|
3855
|
+
commentHolder.set(stmt);
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
const GraphPlugin = {
|
|
3860
|
+
match(ast) {
|
|
3861
|
+
return ast.type === "Graph";
|
|
3862
|
+
},
|
|
3863
|
+
convert(context, ast) {
|
|
3864
|
+
var _a;
|
|
3865
|
+
const G = ast.directed ? context.models.Digraph : context.models.Graph;
|
|
3866
|
+
const graph = new G((_a = ast.id) == null ? void 0 : _a.value, ast.strict);
|
|
3867
|
+
applyStatements(graph, ast.children);
|
|
3868
|
+
return graph;
|
|
3869
|
+
}
|
|
3870
|
+
};
|
|
3871
|
+
const NodePlugin = {
|
|
3872
|
+
match(ast) {
|
|
3873
|
+
return ast.type === "Node";
|
|
3874
|
+
},
|
|
3875
|
+
convert(context, ast) {
|
|
3876
|
+
const node = new context.models.Node(
|
|
3877
|
+
ast.id.value,
|
|
3878
|
+
ast.children.filter(
|
|
3879
|
+
(v) => v.type === "Attribute"
|
|
3880
|
+
).reduce(
|
|
3881
|
+
(acc, curr) => {
|
|
3882
|
+
acc[curr.key.value] = curr.value.value;
|
|
3883
|
+
return acc;
|
|
3884
|
+
},
|
|
3885
|
+
{}
|
|
3886
|
+
)
|
|
3887
|
+
);
|
|
3888
|
+
return node;
|
|
3889
|
+
}
|
|
3890
|
+
};
|
|
3891
|
+
const SubgraphPlugin = {
|
|
3892
|
+
match(ast) {
|
|
3893
|
+
return ast.type === "Subgraph";
|
|
3894
|
+
},
|
|
3895
|
+
convert(context, ast) {
|
|
3896
|
+
var _a;
|
|
3897
|
+
const subgraph = new context.models.Subgraph((_a = ast.id) == null ? void 0 : _a.value);
|
|
3898
|
+
applyStatements(subgraph, ast.children);
|
|
3899
|
+
return subgraph;
|
|
3900
|
+
}
|
|
3901
|
+
};
|
|
3902
|
+
const defaultPlugins = [
|
|
3903
|
+
NodePlugin,
|
|
3904
|
+
EdgePlugin,
|
|
3905
|
+
SubgraphPlugin,
|
|
3906
|
+
GraphPlugin,
|
|
3907
|
+
DotPlugin
|
|
3908
|
+
];
|
|
3909
|
+
class ToModelConverter {
|
|
3910
|
+
constructor(options = {}) {
|
|
3911
|
+
/** @hidden */
|
|
3912
|
+
__publicField(this, "plugins", [
|
|
3913
|
+
...defaultPlugins
|
|
3914
|
+
]);
|
|
3915
|
+
this.options = options;
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* Convert AST to Model.
|
|
3919
|
+
*
|
|
3920
|
+
* @param ast AST node.
|
|
3921
|
+
*/
|
|
3922
|
+
convert(ast) {
|
|
3923
|
+
const plugins = [...this.plugins];
|
|
3924
|
+
const context = {
|
|
3925
|
+
models: createModelsContext(this.options.models ?? {}),
|
|
3926
|
+
convert(m) {
|
|
3927
|
+
for (const plugin of plugins) {
|
|
3928
|
+
if (plugin.match(m)) {
|
|
3929
|
+
return plugin.convert(context, m);
|
|
3930
|
+
}
|
|
3931
|
+
}
|
|
3932
|
+
throw Error();
|
|
3933
|
+
}
|
|
3934
|
+
};
|
|
3935
|
+
return context.convert(ast);
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
function toModel(ast, options) {
|
|
3939
|
+
return new ToModelConverter(options).convert(ast);
|
|
3940
|
+
}
|
|
3941
|
+
export {
|
|
3942
|
+
Builder,
|
|
3943
|
+
DotSyntaxError,
|
|
3944
|
+
FromModelConverter,
|
|
3945
|
+
Printer,
|
|
3946
|
+
ToModelConverter,
|
|
3947
|
+
createElement,
|
|
3948
|
+
fromModel,
|
|
3949
|
+
parse,
|
|
3950
|
+
stringify,
|
|
3951
|
+
toModel
|
|
3952
|
+
};
|