@arach/arc 0.4.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/arc-mcp.mjs +31826 -0
- package/docs/llm.txt +208 -0
- package/lib/MarkupPanel-CroO7O49.js +182 -0
- package/lib/arc.css +1 -1
- package/lib/arc.es.js +31 -27
- package/lib/arc.umd.js +156 -143
- package/lib/index-B4esAiHG.js +1006 -0
- package/lib/index-BtUi_w1W.js +964 -0
- package/lib/index-CI-w1U9t.js +2725 -0
- package/lib/index-CQhCoaVM.js +77 -0
- package/lib/index-CVhUGF67.js +1309 -0
- package/lib/{index-Ctu8395c.js → index-CbEv7M-m.js} +27251 -25424
- package/lib/index-Cg52_-j6.js +959 -0
- package/lib/index-Cmm99d2_.js +1925 -0
- package/lib/index-CnGsbmkP.js +7884 -0
- package/lib/index-CvsZLy9v.js +2344 -0
- package/lib/index-DBTOQDAV.js +1886 -0
- package/lib/index-Ds2bIH9V.js +967 -0
- package/lib/{index-z7-999ZD.js → index-gm9Hs3ZB.js} +1 -1
- package/lib/index.d.ts +79 -8
- package/package.json +33 -6
- package/skills/arc-diagrams/SKILL.md +218 -0
- package/src/types/diagram.ts +197 -0
- package/lib/commands_hudsonkit_false-tNYQZ4nZ.js +0 -5
- package/lib/highlight_hudsonkit_false-CGjCyNxW.js +0 -5
- package/lib/lang-css_hudsonkit_false-oeV3Hq1J.js +0 -5
- package/lib/lang-html_hudsonkit_false-CCxA3CYh.js +0 -5
- package/lib/lang-javascript_hudsonkit_false-SQgz3iJM.js +0 -5
- package/lib/lang-json_hudsonkit_false-BksH8zxC.js +0 -5
- package/lib/lang-markdown_hudsonkit_false-B5TeQsd5.js +0 -5
- package/lib/language_hudsonkit_false-D4r7WoC5.js +0 -5
- package/lib/state_hudsonkit_false-Rl5x6lAJ.js +0 -5
- package/lib/view_hudsonkit_false-Cv9f7Eek.js +0 -5
|
@@ -0,0 +1,2344 @@
|
|
|
1
|
+
const ct = 1024;
|
|
2
|
+
let Je = 0;
|
|
3
|
+
class H {
|
|
4
|
+
constructor(e, t) {
|
|
5
|
+
this.from = e, this.to = t;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class A {
|
|
9
|
+
/**
|
|
10
|
+
Create a new node prop type.
|
|
11
|
+
*/
|
|
12
|
+
constructor(e = {}) {
|
|
13
|
+
this.id = Je++, this.perNode = !!e.perNode, this.deserialize = e.deserialize || (() => {
|
|
14
|
+
throw new Error("This node type doesn't define a deserialize function");
|
|
15
|
+
}), this.combine = e.combine || null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
This is meant to be used with
|
|
19
|
+
[`NodeSet.extend`](#common.NodeSet.extend) or
|
|
20
|
+
[`LRParser.configure`](#lr.ParserConfig.props) to compute
|
|
21
|
+
prop values for each node type in the set. Takes a [match
|
|
22
|
+
object](#common.NodeType^match) or function that returns undefined
|
|
23
|
+
if the node type doesn't get this prop, and the prop's value if
|
|
24
|
+
it does.
|
|
25
|
+
*/
|
|
26
|
+
add(e) {
|
|
27
|
+
if (this.perNode)
|
|
28
|
+
throw new RangeError("Can't add per-node props to node types");
|
|
29
|
+
return typeof e != "function" && (e = L.match(e)), (t) => {
|
|
30
|
+
let r = e(t);
|
|
31
|
+
return r === void 0 ? null : [this, r];
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
A.closedBy = new A({ deserialize: (l) => l.split(" ") });
|
|
36
|
+
A.openedBy = new A({ deserialize: (l) => l.split(" ") });
|
|
37
|
+
A.group = new A({ deserialize: (l) => l.split(" ") });
|
|
38
|
+
A.isolate = new A({ deserialize: (l) => {
|
|
39
|
+
if (l && l != "rtl" && l != "ltr" && l != "auto")
|
|
40
|
+
throw new RangeError("Invalid value for isolate: " + l);
|
|
41
|
+
return l || "auto";
|
|
42
|
+
} });
|
|
43
|
+
A.contextHash = new A({ perNode: !0 });
|
|
44
|
+
A.lookAhead = new A({ perNode: !0 });
|
|
45
|
+
A.mounted = new A({ perNode: !0 });
|
|
46
|
+
class re {
|
|
47
|
+
constructor(e, t, r, i = !1) {
|
|
48
|
+
this.tree = e, this.overlay = t, this.parser = r, this.bracketed = i;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
@internal
|
|
52
|
+
*/
|
|
53
|
+
static get(e) {
|
|
54
|
+
return e && e.props && e.props[A.mounted.id];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const Ke = /* @__PURE__ */ Object.create(null);
|
|
58
|
+
class L {
|
|
59
|
+
/**
|
|
60
|
+
@internal
|
|
61
|
+
*/
|
|
62
|
+
constructor(e, t, r, i = 0) {
|
|
63
|
+
this.name = e, this.props = t, this.id = r, this.flags = i;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
Define a node type.
|
|
67
|
+
*/
|
|
68
|
+
static define(e) {
|
|
69
|
+
let t = e.props && e.props.length ? /* @__PURE__ */ Object.create(null) : Ke, r = (e.top ? 1 : 0) | (e.skipped ? 2 : 0) | (e.error ? 4 : 0) | (e.name == null ? 8 : 0), i = new L(e.name || "", t, e.id, r);
|
|
70
|
+
if (e.props) {
|
|
71
|
+
for (let n of e.props)
|
|
72
|
+
if (Array.isArray(n) || (n = n(i)), n) {
|
|
73
|
+
if (n[0].perNode)
|
|
74
|
+
throw new RangeError("Can't store a per-node prop on a node type");
|
|
75
|
+
t[n[0].id] = n[1];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return i;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
Retrieves a node prop for this type. Will return `undefined` if
|
|
82
|
+
the prop isn't present on this node.
|
|
83
|
+
*/
|
|
84
|
+
prop(e) {
|
|
85
|
+
return this.props[e.id];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
True when this is the top node of a grammar.
|
|
89
|
+
*/
|
|
90
|
+
get isTop() {
|
|
91
|
+
return (this.flags & 1) > 0;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
True when this node is produced by a skip rule.
|
|
95
|
+
*/
|
|
96
|
+
get isSkipped() {
|
|
97
|
+
return (this.flags & 2) > 0;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
Indicates whether this is an error node.
|
|
101
|
+
*/
|
|
102
|
+
get isError() {
|
|
103
|
+
return (this.flags & 4) > 0;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
When true, this node type doesn't correspond to a user-declared
|
|
107
|
+
named node, for example because it is used to cache repetition.
|
|
108
|
+
*/
|
|
109
|
+
get isAnonymous() {
|
|
110
|
+
return (this.flags & 8) > 0;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
Returns true when this node's name or one of its
|
|
114
|
+
[groups](#common.NodeProp^group) matches the given string.
|
|
115
|
+
*/
|
|
116
|
+
is(e) {
|
|
117
|
+
if (typeof e == "string") {
|
|
118
|
+
if (this.name == e)
|
|
119
|
+
return !0;
|
|
120
|
+
let t = this.prop(A.group);
|
|
121
|
+
return t ? t.indexOf(e) > -1 : !1;
|
|
122
|
+
}
|
|
123
|
+
return this.id == e;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
Create a function from node types to arbitrary values by
|
|
127
|
+
specifying an object whose property names are node or
|
|
128
|
+
[group](#common.NodeProp^group) names. Often useful with
|
|
129
|
+
[`NodeProp.add`](#common.NodeProp.add). You can put multiple
|
|
130
|
+
names, separated by spaces, in a single property name to map
|
|
131
|
+
multiple node names to a single value.
|
|
132
|
+
*/
|
|
133
|
+
static match(e) {
|
|
134
|
+
let t = /* @__PURE__ */ Object.create(null);
|
|
135
|
+
for (let r in e)
|
|
136
|
+
for (let i of r.split(" "))
|
|
137
|
+
t[i] = e[r];
|
|
138
|
+
return (r) => {
|
|
139
|
+
for (let i = r.prop(A.group), n = -1; n < (i ? i.length : 0); n++) {
|
|
140
|
+
let s = t[n < 0 ? r.name : i[n]];
|
|
141
|
+
if (s)
|
|
142
|
+
return s;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
L.none = new L(
|
|
148
|
+
"",
|
|
149
|
+
/* @__PURE__ */ Object.create(null),
|
|
150
|
+
0,
|
|
151
|
+
8
|
|
152
|
+
/* NodeFlag.Anonymous */
|
|
153
|
+
);
|
|
154
|
+
class je {
|
|
155
|
+
/**
|
|
156
|
+
Create a set with the given types. The `id` property of each
|
|
157
|
+
type should correspond to its position within the array.
|
|
158
|
+
*/
|
|
159
|
+
constructor(e) {
|
|
160
|
+
this.types = e;
|
|
161
|
+
for (let t = 0; t < e.length; t++)
|
|
162
|
+
if (e[t].id != t)
|
|
163
|
+
throw new RangeError("Node type ids should correspond to array positions when creating a node set");
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
Create a copy of this set with some node properties added. The
|
|
167
|
+
arguments to this method can be created with
|
|
168
|
+
[`NodeProp.add`](#common.NodeProp.add).
|
|
169
|
+
*/
|
|
170
|
+
extend(...e) {
|
|
171
|
+
let t = [];
|
|
172
|
+
for (let r of this.types) {
|
|
173
|
+
let i = null;
|
|
174
|
+
for (let n of e) {
|
|
175
|
+
let s = n(r);
|
|
176
|
+
if (s) {
|
|
177
|
+
i || (i = Object.assign({}, r.props));
|
|
178
|
+
let o = s[1], a = s[0];
|
|
179
|
+
a.combine && a.id in i && (o = a.combine(i[a.id], o)), i[a.id] = o;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
t.push(i ? new L(r.name, i, r.id, r.flags) : r);
|
|
183
|
+
}
|
|
184
|
+
return new je(t);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const he = /* @__PURE__ */ new WeakMap(), Ne = /* @__PURE__ */ new WeakMap();
|
|
188
|
+
var v;
|
|
189
|
+
(function(l) {
|
|
190
|
+
l[l.ExcludeBuffers = 1] = "ExcludeBuffers", l[l.IncludeAnonymous = 2] = "IncludeAnonymous", l[l.IgnoreMounts = 4] = "IgnoreMounts", l[l.IgnoreOverlays = 8] = "IgnoreOverlays", l[l.EnterBracketed = 16] = "EnterBracketed";
|
|
191
|
+
})(v || (v = {}));
|
|
192
|
+
class R {
|
|
193
|
+
/**
|
|
194
|
+
Construct a new tree. See also [`Tree.build`](#common.Tree^build).
|
|
195
|
+
*/
|
|
196
|
+
constructor(e, t, r, i, n) {
|
|
197
|
+
if (this.type = e, this.children = t, this.positions = r, this.length = i, this.props = null, n && n.length) {
|
|
198
|
+
this.props = /* @__PURE__ */ Object.create(null);
|
|
199
|
+
for (let [s, o] of n)
|
|
200
|
+
this.props[typeof s == "number" ? s : s.id] = o;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
@internal
|
|
205
|
+
*/
|
|
206
|
+
toString() {
|
|
207
|
+
let e = re.get(this);
|
|
208
|
+
if (e && !e.overlay)
|
|
209
|
+
return e.tree.toString();
|
|
210
|
+
let t = "";
|
|
211
|
+
for (let r of this.children) {
|
|
212
|
+
let i = r.toString();
|
|
213
|
+
i && (t && (t += ","), t += i);
|
|
214
|
+
}
|
|
215
|
+
return this.type.name ? (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (t.length ? "(" + t + ")" : "") : t;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
Get a [tree cursor](#common.TreeCursor) positioned at the top of
|
|
219
|
+
the tree. Mode can be used to [control](#common.IterMode) which
|
|
220
|
+
nodes the cursor visits.
|
|
221
|
+
*/
|
|
222
|
+
cursor(e = 0) {
|
|
223
|
+
return new ge(this.topNode, e);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
Get a [tree cursor](#common.TreeCursor) pointing into this tree
|
|
227
|
+
at the given position and side (see
|
|
228
|
+
[`moveTo`](#common.TreeCursor.moveTo).
|
|
229
|
+
*/
|
|
230
|
+
cursorAt(e, t = 0, r = 0) {
|
|
231
|
+
let i = he.get(this) || this.topNode, n = new ge(i);
|
|
232
|
+
return n.moveTo(e, t), he.set(this, n._tree), n;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
Get a [syntax node](#common.SyntaxNode) object for the top of the
|
|
236
|
+
tree.
|
|
237
|
+
*/
|
|
238
|
+
get topNode() {
|
|
239
|
+
return new T(this, 0, 0, null);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
Get the [syntax node](#common.SyntaxNode) at the given position.
|
|
243
|
+
If `side` is -1, this will move into nodes that end at the
|
|
244
|
+
position. If 1, it'll move into nodes that start at the
|
|
245
|
+
position. With 0, it'll only enter nodes that cover the position
|
|
246
|
+
from both sides.
|
|
247
|
+
|
|
248
|
+
Note that this will not enter
|
|
249
|
+
[overlays](#common.MountedTree.overlay), and you often want
|
|
250
|
+
[`resolveInner`](#common.Tree.resolveInner) instead.
|
|
251
|
+
*/
|
|
252
|
+
resolve(e, t = 0) {
|
|
253
|
+
let r = se(he.get(this) || this.topNode, e, t, !1);
|
|
254
|
+
return he.set(this, r), r;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
Like [`resolve`](#common.Tree.resolve), but will enter
|
|
258
|
+
[overlaid](#common.MountedTree.overlay) nodes, producing a syntax node
|
|
259
|
+
pointing into the innermost overlaid tree at the given position
|
|
260
|
+
(with parent links going through all parent structure, including
|
|
261
|
+
the host trees).
|
|
262
|
+
*/
|
|
263
|
+
resolveInner(e, t = 0) {
|
|
264
|
+
let r = se(Ne.get(this) || this.topNode, e, t, !0);
|
|
265
|
+
return Ne.set(this, r), r;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
In some situations, it can be useful to iterate through all
|
|
269
|
+
nodes around a position, including those in overlays that don't
|
|
270
|
+
directly cover the position. This method gives you an iterator
|
|
271
|
+
that will produce all nodes, from small to big, around the given
|
|
272
|
+
position.
|
|
273
|
+
*/
|
|
274
|
+
resolveStack(e, t = 0) {
|
|
275
|
+
return Ge(this, e, t);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
Iterate over the tree and its children, calling `enter` for any
|
|
279
|
+
node that touches the `from`/`to` region (if given) before
|
|
280
|
+
running over such a node's children, and `leave` (if given) when
|
|
281
|
+
leaving the node. When `enter` returns `false`, that node will
|
|
282
|
+
not have its children iterated over (or `leave` called).
|
|
283
|
+
*/
|
|
284
|
+
iterate(e) {
|
|
285
|
+
let { enter: t, leave: r, from: i = 0, to: n = this.length } = e, s = e.mode || 0, o = (s & v.IncludeAnonymous) > 0;
|
|
286
|
+
for (let a = this.cursor(s | v.IncludeAnonymous); ; ) {
|
|
287
|
+
let h = !1;
|
|
288
|
+
if (a.from <= n && a.to >= i && (!o && a.type.isAnonymous || t(a) !== !1)) {
|
|
289
|
+
if (a.firstChild())
|
|
290
|
+
continue;
|
|
291
|
+
h = !0;
|
|
292
|
+
}
|
|
293
|
+
for (; h && r && (o || !a.type.isAnonymous) && r(a), !a.nextSibling(); ) {
|
|
294
|
+
if (!a.parent())
|
|
295
|
+
return;
|
|
296
|
+
h = !0;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
Get the value of the given [node prop](#common.NodeProp) for this
|
|
302
|
+
node. Works with both per-node and per-type props.
|
|
303
|
+
*/
|
|
304
|
+
prop(e) {
|
|
305
|
+
return e.perNode ? this.props ? this.props[e.id] : void 0 : this.type.prop(e);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
Returns the node's [per-node props](#common.NodeProp.perNode) in a
|
|
309
|
+
format that can be passed to the [`Tree`](#common.Tree)
|
|
310
|
+
constructor.
|
|
311
|
+
*/
|
|
312
|
+
get propValues() {
|
|
313
|
+
let e = [];
|
|
314
|
+
if (this.props)
|
|
315
|
+
for (let t in this.props)
|
|
316
|
+
e.push([+t, this.props[t]]);
|
|
317
|
+
return e;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
Balance the direct children of this tree, producing a copy of
|
|
321
|
+
which may have children grouped into subtrees with type
|
|
322
|
+
[`NodeType.none`](#common.NodeType^none).
|
|
323
|
+
*/
|
|
324
|
+
balance(e = {}) {
|
|
325
|
+
return this.children.length <= 8 ? this : Ae(L.none, this.children, this.positions, 0, this.children.length, 0, this.length, (t, r, i) => new R(this.type, t, r, i, this.propValues), e.makeTree || ((t, r, i) => new R(L.none, t, r, i)));
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
Build a tree from a postfix-ordered buffer of node information,
|
|
329
|
+
or a cursor over such a buffer.
|
|
330
|
+
*/
|
|
331
|
+
static build(e) {
|
|
332
|
+
return Qe(e);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
R.empty = new R(L.none, [], [], 0);
|
|
336
|
+
class we {
|
|
337
|
+
constructor(e, t) {
|
|
338
|
+
this.buffer = e, this.index = t;
|
|
339
|
+
}
|
|
340
|
+
get id() {
|
|
341
|
+
return this.buffer[this.index - 4];
|
|
342
|
+
}
|
|
343
|
+
get start() {
|
|
344
|
+
return this.buffer[this.index - 3];
|
|
345
|
+
}
|
|
346
|
+
get end() {
|
|
347
|
+
return this.buffer[this.index - 2];
|
|
348
|
+
}
|
|
349
|
+
get size() {
|
|
350
|
+
return this.buffer[this.index - 1];
|
|
351
|
+
}
|
|
352
|
+
get pos() {
|
|
353
|
+
return this.index;
|
|
354
|
+
}
|
|
355
|
+
next() {
|
|
356
|
+
this.index -= 4;
|
|
357
|
+
}
|
|
358
|
+
fork() {
|
|
359
|
+
return new we(this.buffer, this.index);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
class X {
|
|
363
|
+
/**
|
|
364
|
+
Create a tree buffer.
|
|
365
|
+
*/
|
|
366
|
+
constructor(e, t, r) {
|
|
367
|
+
this.buffer = e, this.length = t, this.set = r;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
@internal
|
|
371
|
+
*/
|
|
372
|
+
get type() {
|
|
373
|
+
return L.none;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
@internal
|
|
377
|
+
*/
|
|
378
|
+
toString() {
|
|
379
|
+
let e = [];
|
|
380
|
+
for (let t = 0; t < this.buffer.length; )
|
|
381
|
+
e.push(this.childString(t)), t = this.buffer[t + 3];
|
|
382
|
+
return e.join(",");
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
@internal
|
|
386
|
+
*/
|
|
387
|
+
childString(e) {
|
|
388
|
+
let t = this.buffer[e], r = this.buffer[e + 3], i = this.set.types[t], n = i.name;
|
|
389
|
+
if (/\W/.test(n) && !i.isError && (n = JSON.stringify(n)), e += 4, r == e)
|
|
390
|
+
return n;
|
|
391
|
+
let s = [];
|
|
392
|
+
for (; e < r; )
|
|
393
|
+
s.push(this.childString(e)), e = this.buffer[e + 3];
|
|
394
|
+
return n + "(" + s.join(",") + ")";
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
@internal
|
|
398
|
+
*/
|
|
399
|
+
findChild(e, t, r, i, n) {
|
|
400
|
+
let { buffer: s } = this, o = -1;
|
|
401
|
+
for (let a = e; a != t && !(Fe(n, i, s[a + 1], s[a + 2]) && (o = a, r > 0)); a = s[a + 3])
|
|
402
|
+
;
|
|
403
|
+
return o;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
@internal
|
|
407
|
+
*/
|
|
408
|
+
slice(e, t, r) {
|
|
409
|
+
let i = this.buffer, n = new Uint16Array(t - e), s = 0;
|
|
410
|
+
for (let o = e, a = 0; o < t; ) {
|
|
411
|
+
n[a++] = i[o++], n[a++] = i[o++] - r;
|
|
412
|
+
let h = n[a++] = i[o++] - r;
|
|
413
|
+
n[a++] = i[o++] - e, s = Math.max(s, h);
|
|
414
|
+
}
|
|
415
|
+
return new X(n, s, this.set);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function Fe(l, e, t, r) {
|
|
419
|
+
switch (l) {
|
|
420
|
+
case -2:
|
|
421
|
+
return t < e;
|
|
422
|
+
case -1:
|
|
423
|
+
return r >= e && t < e;
|
|
424
|
+
case 0:
|
|
425
|
+
return t < e && r > e;
|
|
426
|
+
case 1:
|
|
427
|
+
return t <= e && r > e;
|
|
428
|
+
case 2:
|
|
429
|
+
return r > e;
|
|
430
|
+
case 4:
|
|
431
|
+
return !0;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function se(l, e, t, r) {
|
|
435
|
+
for (var i; l.from == l.to || (t < 1 ? l.from >= e : l.from > e) || (t > -1 ? l.to <= e : l.to < e); ) {
|
|
436
|
+
let s = !r && l instanceof T && l.index < 0 ? null : l.parent;
|
|
437
|
+
if (!s)
|
|
438
|
+
return l;
|
|
439
|
+
l = s;
|
|
440
|
+
}
|
|
441
|
+
let n = r ? 0 : v.IgnoreOverlays;
|
|
442
|
+
if (r)
|
|
443
|
+
for (let s = l, o = s.parent; o; s = o, o = s.parent)
|
|
444
|
+
s instanceof T && s.index < 0 && ((i = o.enter(e, t, n)) === null || i === void 0 ? void 0 : i.from) != s.from && (l = o);
|
|
445
|
+
for (; ; ) {
|
|
446
|
+
let s = l.enter(e, t, n);
|
|
447
|
+
if (!s)
|
|
448
|
+
return l;
|
|
449
|
+
l = s;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
class De {
|
|
453
|
+
cursor(e = 0) {
|
|
454
|
+
return new ge(this, e);
|
|
455
|
+
}
|
|
456
|
+
getChild(e, t = null, r = null) {
|
|
457
|
+
let i = _e(this, e, t, r);
|
|
458
|
+
return i.length ? i[0] : null;
|
|
459
|
+
}
|
|
460
|
+
getChildren(e, t = null, r = null) {
|
|
461
|
+
return _e(this, e, t, r);
|
|
462
|
+
}
|
|
463
|
+
resolve(e, t = 0) {
|
|
464
|
+
return se(this, e, t, !1);
|
|
465
|
+
}
|
|
466
|
+
resolveInner(e, t = 0) {
|
|
467
|
+
return se(this, e, t, !0);
|
|
468
|
+
}
|
|
469
|
+
matchContext(e) {
|
|
470
|
+
return be(this.parent, e);
|
|
471
|
+
}
|
|
472
|
+
enterUnfinishedNodesBefore(e) {
|
|
473
|
+
let t = this.childBefore(e), r = this;
|
|
474
|
+
for (; t; ) {
|
|
475
|
+
let i = t.lastChild;
|
|
476
|
+
if (!i || i.to != t.to)
|
|
477
|
+
break;
|
|
478
|
+
i.type.isError && i.from == i.to ? (r = t, t = i.prevSibling) : t = i;
|
|
479
|
+
}
|
|
480
|
+
return r;
|
|
481
|
+
}
|
|
482
|
+
get node() {
|
|
483
|
+
return this;
|
|
484
|
+
}
|
|
485
|
+
get next() {
|
|
486
|
+
return this.parent;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
class T extends De {
|
|
490
|
+
constructor(e, t, r, i) {
|
|
491
|
+
super(), this._tree = e, this.from = t, this.index = r, this._parent = i;
|
|
492
|
+
}
|
|
493
|
+
get type() {
|
|
494
|
+
return this._tree.type;
|
|
495
|
+
}
|
|
496
|
+
get name() {
|
|
497
|
+
return this._tree.type.name;
|
|
498
|
+
}
|
|
499
|
+
get to() {
|
|
500
|
+
return this.from + this._tree.length;
|
|
501
|
+
}
|
|
502
|
+
nextChild(e, t, r, i, n = 0) {
|
|
503
|
+
for (let s = this; ; ) {
|
|
504
|
+
for (let { children: o, positions: a } = s._tree, h = t > 0 ? o.length : -1; e != h; e += t) {
|
|
505
|
+
let u = o[e], p = a[e] + s.from, c;
|
|
506
|
+
if (!(!(n & v.EnterBracketed && u instanceof R && (c = re.get(u)) && !c.overlay && c.bracketed && r >= p && r <= p + u.length) && !Fe(i, r, p, p + u.length))) {
|
|
507
|
+
if (u instanceof X) {
|
|
508
|
+
if (n & v.ExcludeBuffers)
|
|
509
|
+
continue;
|
|
510
|
+
let m = u.findChild(0, u.buffer.length, t, r - p, i);
|
|
511
|
+
if (m > -1)
|
|
512
|
+
return new K(new Ve(s, u, e, p), null, m);
|
|
513
|
+
} else if (n & v.IncludeAnonymous || !u.type.isAnonymous || ve(u)) {
|
|
514
|
+
let m;
|
|
515
|
+
if (!(n & v.IgnoreMounts) && (m = re.get(u)) && !m.overlay)
|
|
516
|
+
return new T(m.tree, p, e, s);
|
|
517
|
+
let k = new T(u, p, e, s);
|
|
518
|
+
return n & v.IncludeAnonymous || !k.type.isAnonymous ? k : k.nextChild(t < 0 ? u.children.length - 1 : 0, t, r, i, n);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (n & v.IncludeAnonymous || !s.type.isAnonymous || (s.index >= 0 ? e = s.index + t : e = t < 0 ? -1 : s._parent._tree.children.length, s = s._parent, !s))
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
get firstChild() {
|
|
527
|
+
return this.nextChild(
|
|
528
|
+
0,
|
|
529
|
+
1,
|
|
530
|
+
0,
|
|
531
|
+
4
|
|
532
|
+
/* Side.DontCare */
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
get lastChild() {
|
|
536
|
+
return this.nextChild(
|
|
537
|
+
this._tree.children.length - 1,
|
|
538
|
+
-1,
|
|
539
|
+
0,
|
|
540
|
+
4
|
|
541
|
+
/* Side.DontCare */
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
childAfter(e) {
|
|
545
|
+
return this.nextChild(
|
|
546
|
+
0,
|
|
547
|
+
1,
|
|
548
|
+
e,
|
|
549
|
+
2
|
|
550
|
+
/* Side.After */
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
childBefore(e) {
|
|
554
|
+
return this.nextChild(
|
|
555
|
+
this._tree.children.length - 1,
|
|
556
|
+
-1,
|
|
557
|
+
e,
|
|
558
|
+
-2
|
|
559
|
+
/* Side.Before */
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
prop(e) {
|
|
563
|
+
return this._tree.prop(e);
|
|
564
|
+
}
|
|
565
|
+
enter(e, t, r = 0) {
|
|
566
|
+
let i;
|
|
567
|
+
if (!(r & v.IgnoreOverlays) && (i = re.get(this._tree)) && i.overlay) {
|
|
568
|
+
let n = e - this.from, s = r & v.EnterBracketed && i.bracketed;
|
|
569
|
+
for (let { from: o, to: a } of i.overlay)
|
|
570
|
+
if ((t > 0 || s ? o <= n : o < n) && (t < 0 || s ? a >= n : a > n))
|
|
571
|
+
return new T(i.tree, i.overlay[0].from + this.from, -1, this);
|
|
572
|
+
}
|
|
573
|
+
return this.nextChild(0, 1, e, t, r);
|
|
574
|
+
}
|
|
575
|
+
nextSignificantParent() {
|
|
576
|
+
let e = this;
|
|
577
|
+
for (; e.type.isAnonymous && e._parent; )
|
|
578
|
+
e = e._parent;
|
|
579
|
+
return e;
|
|
580
|
+
}
|
|
581
|
+
get parent() {
|
|
582
|
+
return this._parent ? this._parent.nextSignificantParent() : null;
|
|
583
|
+
}
|
|
584
|
+
get nextSibling() {
|
|
585
|
+
return this._parent && this.index >= 0 ? this._parent.nextChild(
|
|
586
|
+
this.index + 1,
|
|
587
|
+
1,
|
|
588
|
+
0,
|
|
589
|
+
4
|
|
590
|
+
/* Side.DontCare */
|
|
591
|
+
) : null;
|
|
592
|
+
}
|
|
593
|
+
get prevSibling() {
|
|
594
|
+
return this._parent && this.index >= 0 ? this._parent.nextChild(
|
|
595
|
+
this.index - 1,
|
|
596
|
+
-1,
|
|
597
|
+
0,
|
|
598
|
+
4
|
|
599
|
+
/* Side.DontCare */
|
|
600
|
+
) : null;
|
|
601
|
+
}
|
|
602
|
+
get tree() {
|
|
603
|
+
return this._tree;
|
|
604
|
+
}
|
|
605
|
+
toTree() {
|
|
606
|
+
return this._tree;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
@internal
|
|
610
|
+
*/
|
|
611
|
+
toString() {
|
|
612
|
+
return this._tree.toString();
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function _e(l, e, t, r) {
|
|
616
|
+
let i = l.cursor(), n = [];
|
|
617
|
+
if (!i.firstChild())
|
|
618
|
+
return n;
|
|
619
|
+
if (t != null) {
|
|
620
|
+
for (let s = !1; !s; )
|
|
621
|
+
if (s = i.type.is(t), !i.nextSibling())
|
|
622
|
+
return n;
|
|
623
|
+
}
|
|
624
|
+
for (; ; ) {
|
|
625
|
+
if (r != null && i.type.is(r))
|
|
626
|
+
return n;
|
|
627
|
+
if (i.type.is(e) && n.push(i.node), !i.nextSibling())
|
|
628
|
+
return r == null ? n : [];
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
function be(l, e, t = e.length - 1) {
|
|
632
|
+
for (let r = l; t >= 0; r = r.parent) {
|
|
633
|
+
if (!r)
|
|
634
|
+
return !1;
|
|
635
|
+
if (!r.type.isAnonymous) {
|
|
636
|
+
if (e[t] && e[t] != r.name)
|
|
637
|
+
return !1;
|
|
638
|
+
t--;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return !0;
|
|
642
|
+
}
|
|
643
|
+
class Ve {
|
|
644
|
+
constructor(e, t, r, i) {
|
|
645
|
+
this.parent = e, this.buffer = t, this.index = r, this.start = i;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
class K extends De {
|
|
649
|
+
get name() {
|
|
650
|
+
return this.type.name;
|
|
651
|
+
}
|
|
652
|
+
get from() {
|
|
653
|
+
return this.context.start + this.context.buffer.buffer[this.index + 1];
|
|
654
|
+
}
|
|
655
|
+
get to() {
|
|
656
|
+
return this.context.start + this.context.buffer.buffer[this.index + 2];
|
|
657
|
+
}
|
|
658
|
+
constructor(e, t, r) {
|
|
659
|
+
super(), this.context = e, this._parent = t, this.index = r, this.type = e.buffer.set.types[e.buffer.buffer[r]];
|
|
660
|
+
}
|
|
661
|
+
child(e, t, r) {
|
|
662
|
+
let { buffer: i } = this.context, n = i.findChild(this.index + 4, i.buffer[this.index + 3], e, t - this.context.start, r);
|
|
663
|
+
return n < 0 ? null : new K(this.context, this, n);
|
|
664
|
+
}
|
|
665
|
+
get firstChild() {
|
|
666
|
+
return this.child(
|
|
667
|
+
1,
|
|
668
|
+
0,
|
|
669
|
+
4
|
|
670
|
+
/* Side.DontCare */
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
get lastChild() {
|
|
674
|
+
return this.child(
|
|
675
|
+
-1,
|
|
676
|
+
0,
|
|
677
|
+
4
|
|
678
|
+
/* Side.DontCare */
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
childAfter(e) {
|
|
682
|
+
return this.child(
|
|
683
|
+
1,
|
|
684
|
+
e,
|
|
685
|
+
2
|
|
686
|
+
/* Side.After */
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
childBefore(e) {
|
|
690
|
+
return this.child(
|
|
691
|
+
-1,
|
|
692
|
+
e,
|
|
693
|
+
-2
|
|
694
|
+
/* Side.Before */
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
prop(e) {
|
|
698
|
+
return this.type.prop(e);
|
|
699
|
+
}
|
|
700
|
+
enter(e, t, r = 0) {
|
|
701
|
+
if (r & v.ExcludeBuffers)
|
|
702
|
+
return null;
|
|
703
|
+
let { buffer: i } = this.context, n = i.findChild(this.index + 4, i.buffer[this.index + 3], t > 0 ? 1 : -1, e - this.context.start, t);
|
|
704
|
+
return n < 0 ? null : new K(this.context, this, n);
|
|
705
|
+
}
|
|
706
|
+
get parent() {
|
|
707
|
+
return this._parent || this.context.parent.nextSignificantParent();
|
|
708
|
+
}
|
|
709
|
+
externalSibling(e) {
|
|
710
|
+
return this._parent ? null : this.context.parent.nextChild(
|
|
711
|
+
this.context.index + e,
|
|
712
|
+
e,
|
|
713
|
+
0,
|
|
714
|
+
4
|
|
715
|
+
/* Side.DontCare */
|
|
716
|
+
);
|
|
717
|
+
}
|
|
718
|
+
get nextSibling() {
|
|
719
|
+
let { buffer: e } = this.context, t = e.buffer[this.index + 3];
|
|
720
|
+
return t < (this._parent ? e.buffer[this._parent.index + 3] : e.buffer.length) ? new K(this.context, this._parent, t) : this.externalSibling(1);
|
|
721
|
+
}
|
|
722
|
+
get prevSibling() {
|
|
723
|
+
let { buffer: e } = this.context, t = this._parent ? this._parent.index + 4 : 0;
|
|
724
|
+
return this.index == t ? this.externalSibling(-1) : new K(this.context, this._parent, e.findChild(
|
|
725
|
+
t,
|
|
726
|
+
this.index,
|
|
727
|
+
-1,
|
|
728
|
+
0,
|
|
729
|
+
4
|
|
730
|
+
/* Side.DontCare */
|
|
731
|
+
));
|
|
732
|
+
}
|
|
733
|
+
get tree() {
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
736
|
+
toTree() {
|
|
737
|
+
let e = [], t = [], { buffer: r } = this.context, i = this.index + 4, n = r.buffer[this.index + 3];
|
|
738
|
+
if (n > i) {
|
|
739
|
+
let s = r.buffer[this.index + 1];
|
|
740
|
+
e.push(r.slice(i, n, s)), t.push(0);
|
|
741
|
+
}
|
|
742
|
+
return new R(this.type, e, t, this.to - this.from);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
@internal
|
|
746
|
+
*/
|
|
747
|
+
toString() {
|
|
748
|
+
return this.context.buffer.childString(this.index);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function He(l) {
|
|
752
|
+
if (!l.length)
|
|
753
|
+
return null;
|
|
754
|
+
let e = 0, t = l[0];
|
|
755
|
+
for (let n = 1; n < l.length; n++) {
|
|
756
|
+
let s = l[n];
|
|
757
|
+
(s.from > t.from || s.to < t.to) && (t = s, e = n);
|
|
758
|
+
}
|
|
759
|
+
let r = t instanceof T && t.index < 0 ? null : t.parent, i = l.slice();
|
|
760
|
+
return r ? i[e] = r : i.splice(e, 1), new $e(i, t);
|
|
761
|
+
}
|
|
762
|
+
class $e {
|
|
763
|
+
constructor(e, t) {
|
|
764
|
+
this.heads = e, this.node = t;
|
|
765
|
+
}
|
|
766
|
+
get next() {
|
|
767
|
+
return He(this.heads);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
function Ge(l, e, t) {
|
|
771
|
+
let r = l.resolveInner(e, t), i = null;
|
|
772
|
+
for (let n = r instanceof T ? r : r.context.parent; n; n = n.parent)
|
|
773
|
+
if (n.index < 0) {
|
|
774
|
+
let s = n.parent;
|
|
775
|
+
(i || (i = [r])).push(s.resolve(e, t)), n = s;
|
|
776
|
+
} else {
|
|
777
|
+
let s = re.get(n.tree);
|
|
778
|
+
if (s && s.overlay && s.overlay[0].from <= e && s.overlay[s.overlay.length - 1].to >= e) {
|
|
779
|
+
let o = new T(s.tree, s.overlay[0].from + n.from, -1, n);
|
|
780
|
+
(i || (i = [r])).push(se(o, e, t, !1));
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
return i ? He(i) : r;
|
|
784
|
+
}
|
|
785
|
+
class ge {
|
|
786
|
+
/**
|
|
787
|
+
Shorthand for `.type.name`.
|
|
788
|
+
*/
|
|
789
|
+
get name() {
|
|
790
|
+
return this.type.name;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
@internal
|
|
794
|
+
*/
|
|
795
|
+
constructor(e, t = 0) {
|
|
796
|
+
if (this.buffer = null, this.stack = [], this.index = 0, this.bufferNode = null, this.mode = t & ~v.EnterBracketed, e instanceof T)
|
|
797
|
+
this.yieldNode(e);
|
|
798
|
+
else {
|
|
799
|
+
this._tree = e.context.parent, this.buffer = e.context;
|
|
800
|
+
for (let r = e._parent; r; r = r._parent)
|
|
801
|
+
this.stack.unshift(r.index);
|
|
802
|
+
this.bufferNode = e, this.yieldBuf(e.index);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
yieldNode(e) {
|
|
806
|
+
return e ? (this._tree = e, this.type = e.type, this.from = e.from, this.to = e.to, !0) : !1;
|
|
807
|
+
}
|
|
808
|
+
yieldBuf(e, t) {
|
|
809
|
+
this.index = e;
|
|
810
|
+
let { start: r, buffer: i } = this.buffer;
|
|
811
|
+
return this.type = t || i.set.types[i.buffer[e]], this.from = r + i.buffer[e + 1], this.to = r + i.buffer[e + 2], !0;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
@internal
|
|
815
|
+
*/
|
|
816
|
+
yield(e) {
|
|
817
|
+
return e ? e instanceof T ? (this.buffer = null, this.yieldNode(e)) : (this.buffer = e.context, this.yieldBuf(e.index, e.type)) : !1;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
@internal
|
|
821
|
+
*/
|
|
822
|
+
toString() {
|
|
823
|
+
return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
@internal
|
|
827
|
+
*/
|
|
828
|
+
enterChild(e, t, r) {
|
|
829
|
+
if (!this.buffer)
|
|
830
|
+
return this.yield(this._tree.nextChild(e < 0 ? this._tree._tree.children.length - 1 : 0, e, t, r, this.mode));
|
|
831
|
+
let { buffer: i } = this.buffer, n = i.findChild(this.index + 4, i.buffer[this.index + 3], e, t - this.buffer.start, r);
|
|
832
|
+
return n < 0 ? !1 : (this.stack.push(this.index), this.yieldBuf(n));
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
Move the cursor to this node's first child. When this returns
|
|
836
|
+
false, the node has no child, and the cursor has not been moved.
|
|
837
|
+
*/
|
|
838
|
+
firstChild() {
|
|
839
|
+
return this.enterChild(
|
|
840
|
+
1,
|
|
841
|
+
0,
|
|
842
|
+
4
|
|
843
|
+
/* Side.DontCare */
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
Move the cursor to this node's last child.
|
|
848
|
+
*/
|
|
849
|
+
lastChild() {
|
|
850
|
+
return this.enterChild(
|
|
851
|
+
-1,
|
|
852
|
+
0,
|
|
853
|
+
4
|
|
854
|
+
/* Side.DontCare */
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
Move the cursor to the first child that ends after `pos`.
|
|
859
|
+
*/
|
|
860
|
+
childAfter(e) {
|
|
861
|
+
return this.enterChild(
|
|
862
|
+
1,
|
|
863
|
+
e,
|
|
864
|
+
2
|
|
865
|
+
/* Side.After */
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
Move to the last child that starts before `pos`.
|
|
870
|
+
*/
|
|
871
|
+
childBefore(e) {
|
|
872
|
+
return this.enterChild(
|
|
873
|
+
-1,
|
|
874
|
+
e,
|
|
875
|
+
-2
|
|
876
|
+
/* Side.Before */
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
Move the cursor to the child around `pos`. If side is -1 the
|
|
881
|
+
child may end at that position, when 1 it may start there. This
|
|
882
|
+
will also enter [overlaid](#common.MountedTree.overlay)
|
|
883
|
+
[mounted](#common.NodeProp^mounted) trees unless `overlays` is
|
|
884
|
+
set to false.
|
|
885
|
+
*/
|
|
886
|
+
enter(e, t, r = this.mode) {
|
|
887
|
+
return this.buffer ? r & v.ExcludeBuffers ? !1 : this.enterChild(1, e, t) : this.yield(this._tree.enter(e, t, r));
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
Move to the node's parent node, if this isn't the top node.
|
|
891
|
+
*/
|
|
892
|
+
parent() {
|
|
893
|
+
if (!this.buffer)
|
|
894
|
+
return this.yieldNode(this.mode & v.IncludeAnonymous ? this._tree._parent : this._tree.parent);
|
|
895
|
+
if (this.stack.length)
|
|
896
|
+
return this.yieldBuf(this.stack.pop());
|
|
897
|
+
let e = this.mode & v.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent();
|
|
898
|
+
return this.buffer = null, this.yieldNode(e);
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
@internal
|
|
902
|
+
*/
|
|
903
|
+
sibling(e) {
|
|
904
|
+
if (!this.buffer)
|
|
905
|
+
return this._tree._parent ? this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + e, e, 0, 4, this.mode)) : !1;
|
|
906
|
+
let { buffer: t } = this.buffer, r = this.stack.length - 1;
|
|
907
|
+
if (e < 0) {
|
|
908
|
+
let i = r < 0 ? 0 : this.stack[r] + 4;
|
|
909
|
+
if (this.index != i)
|
|
910
|
+
return this.yieldBuf(t.findChild(
|
|
911
|
+
i,
|
|
912
|
+
this.index,
|
|
913
|
+
-1,
|
|
914
|
+
0,
|
|
915
|
+
4
|
|
916
|
+
/* Side.DontCare */
|
|
917
|
+
));
|
|
918
|
+
} else {
|
|
919
|
+
let i = t.buffer[this.index + 3];
|
|
920
|
+
if (i < (r < 0 ? t.buffer.length : t.buffer[this.stack[r] + 3]))
|
|
921
|
+
return this.yieldBuf(i);
|
|
922
|
+
}
|
|
923
|
+
return r < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + e, e, 0, 4, this.mode)) : !1;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
Move to this node's next sibling, if any.
|
|
927
|
+
*/
|
|
928
|
+
nextSibling() {
|
|
929
|
+
return this.sibling(1);
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
Move to this node's previous sibling, if any.
|
|
933
|
+
*/
|
|
934
|
+
prevSibling() {
|
|
935
|
+
return this.sibling(-1);
|
|
936
|
+
}
|
|
937
|
+
atLastNode(e) {
|
|
938
|
+
let t, r, { buffer: i } = this;
|
|
939
|
+
if (i) {
|
|
940
|
+
if (e > 0) {
|
|
941
|
+
if (this.index < i.buffer.buffer.length)
|
|
942
|
+
return !1;
|
|
943
|
+
} else
|
|
944
|
+
for (let n = 0; n < this.index; n++)
|
|
945
|
+
if (i.buffer.buffer[n + 3] < this.index)
|
|
946
|
+
return !1;
|
|
947
|
+
({ index: t, parent: r } = i);
|
|
948
|
+
} else
|
|
949
|
+
({ index: t, _parent: r } = this._tree);
|
|
950
|
+
for (; r; { index: t, _parent: r } = r)
|
|
951
|
+
if (t > -1)
|
|
952
|
+
for (let n = t + e, s = e < 0 ? -1 : r._tree.children.length; n != s; n += e) {
|
|
953
|
+
let o = r._tree.children[n];
|
|
954
|
+
if (this.mode & v.IncludeAnonymous || o instanceof X || !o.type.isAnonymous || ve(o))
|
|
955
|
+
return !1;
|
|
956
|
+
}
|
|
957
|
+
return !0;
|
|
958
|
+
}
|
|
959
|
+
move(e, t) {
|
|
960
|
+
if (t && this.enterChild(
|
|
961
|
+
e,
|
|
962
|
+
0,
|
|
963
|
+
4
|
|
964
|
+
/* Side.DontCare */
|
|
965
|
+
))
|
|
966
|
+
return !0;
|
|
967
|
+
for (; ; ) {
|
|
968
|
+
if (this.sibling(e))
|
|
969
|
+
return !0;
|
|
970
|
+
if (this.atLastNode(e) || !this.parent())
|
|
971
|
+
return !1;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
Move to the next node in a
|
|
976
|
+
[pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)
|
|
977
|
+
traversal, going from a node to its first child or, if the
|
|
978
|
+
current node is empty or `enter` is false, its next sibling or
|
|
979
|
+
the next sibling of the first parent node that has one.
|
|
980
|
+
*/
|
|
981
|
+
next(e = !0) {
|
|
982
|
+
return this.move(1, e);
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
Move to the next node in a last-to-first pre-order traversal. A
|
|
986
|
+
node is followed by its last child or, if it has none, its
|
|
987
|
+
previous sibling or the previous sibling of the first parent
|
|
988
|
+
node that has one.
|
|
989
|
+
*/
|
|
990
|
+
prev(e = !0) {
|
|
991
|
+
return this.move(-1, e);
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
Move the cursor to the innermost node that covers `pos`. If
|
|
995
|
+
`side` is -1, it will enter nodes that end at `pos`. If it is 1,
|
|
996
|
+
it will enter nodes that start at `pos`.
|
|
997
|
+
*/
|
|
998
|
+
moveTo(e, t = 0) {
|
|
999
|
+
for (; (this.from == this.to || (t < 1 ? this.from >= e : this.from > e) || (t > -1 ? this.to <= e : this.to < e)) && this.parent(); )
|
|
1000
|
+
;
|
|
1001
|
+
for (; this.enterChild(1, e, t); )
|
|
1002
|
+
;
|
|
1003
|
+
return this;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
Get a [syntax node](#common.SyntaxNode) at the cursor's current
|
|
1007
|
+
position.
|
|
1008
|
+
*/
|
|
1009
|
+
get node() {
|
|
1010
|
+
if (!this.buffer)
|
|
1011
|
+
return this._tree;
|
|
1012
|
+
let e = this.bufferNode, t = null, r = 0;
|
|
1013
|
+
if (e && e.context == this.buffer)
|
|
1014
|
+
e: for (let i = this.index, n = this.stack.length; n >= 0; ) {
|
|
1015
|
+
for (let s = e; s; s = s._parent)
|
|
1016
|
+
if (s.index == i) {
|
|
1017
|
+
if (i == this.index)
|
|
1018
|
+
return s;
|
|
1019
|
+
t = s, r = n + 1;
|
|
1020
|
+
break e;
|
|
1021
|
+
}
|
|
1022
|
+
i = this.stack[--n];
|
|
1023
|
+
}
|
|
1024
|
+
for (let i = r; i < this.stack.length; i++)
|
|
1025
|
+
t = new K(this.buffer, t, this.stack[i]);
|
|
1026
|
+
return this.bufferNode = new K(this.buffer, t, this.index);
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
Get the [tree](#common.Tree) that represents the current node, if
|
|
1030
|
+
any. Will return null when the node is in a [tree
|
|
1031
|
+
buffer](#common.TreeBuffer).
|
|
1032
|
+
*/
|
|
1033
|
+
get tree() {
|
|
1034
|
+
return this.buffer ? null : this._tree._tree;
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
Iterate over the current node and all its descendants, calling
|
|
1038
|
+
`enter` when entering a node and `leave`, if given, when leaving
|
|
1039
|
+
one. When `enter` returns `false`, any children of that node are
|
|
1040
|
+
skipped, and `leave` isn't called for it.
|
|
1041
|
+
*/
|
|
1042
|
+
iterate(e, t) {
|
|
1043
|
+
for (let r = 0; ; ) {
|
|
1044
|
+
let i = !1;
|
|
1045
|
+
if (this.type.isAnonymous || e(this) !== !1) {
|
|
1046
|
+
if (this.firstChild()) {
|
|
1047
|
+
r++;
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
this.type.isAnonymous || (i = !0);
|
|
1051
|
+
}
|
|
1052
|
+
for (; ; ) {
|
|
1053
|
+
if (i && t && t(this), i = this.type.isAnonymous, !r)
|
|
1054
|
+
return;
|
|
1055
|
+
if (this.nextSibling())
|
|
1056
|
+
break;
|
|
1057
|
+
this.parent(), r--, i = !0;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
Test whether the current node matches a given context—a sequence
|
|
1063
|
+
of direct parent node names. Empty strings in the context array
|
|
1064
|
+
are treated as wildcards.
|
|
1065
|
+
*/
|
|
1066
|
+
matchContext(e) {
|
|
1067
|
+
if (!this.buffer)
|
|
1068
|
+
return be(this.node.parent, e);
|
|
1069
|
+
let { buffer: t } = this.buffer, { types: r } = t.set;
|
|
1070
|
+
for (let i = e.length - 1, n = this.stack.length - 1; i >= 0; n--) {
|
|
1071
|
+
if (n < 0)
|
|
1072
|
+
return be(this._tree, e, i);
|
|
1073
|
+
let s = r[t.buffer[this.stack[n]]];
|
|
1074
|
+
if (!s.isAnonymous) {
|
|
1075
|
+
if (e[i] && e[i] != s.name)
|
|
1076
|
+
return !1;
|
|
1077
|
+
i--;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
return !0;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function ve(l) {
|
|
1084
|
+
return l.children.some((e) => e instanceof X || !e.type.isAnonymous || ve(e));
|
|
1085
|
+
}
|
|
1086
|
+
function Qe(l) {
|
|
1087
|
+
var e;
|
|
1088
|
+
let { buffer: t, nodeSet: r, maxBufferLength: i = 1024, reused: n = [], minRepeatType: s = r.types.length } = l, o = Array.isArray(t) ? new we(t, t.length) : t, a = r.types, h = 0, u = 0;
|
|
1089
|
+
function p(x, N, d, B, w, I) {
|
|
1090
|
+
let { id: b, start: g, end: S, size: _ } = o, O = u, $ = h;
|
|
1091
|
+
if (_ < 0)
|
|
1092
|
+
if (o.next(), _ == -1) {
|
|
1093
|
+
let V = n[b];
|
|
1094
|
+
d.push(V), B.push(g - x);
|
|
1095
|
+
return;
|
|
1096
|
+
} else if (_ == -3) {
|
|
1097
|
+
h = b;
|
|
1098
|
+
return;
|
|
1099
|
+
} else if (_ == -4) {
|
|
1100
|
+
u = b;
|
|
1101
|
+
return;
|
|
1102
|
+
} else
|
|
1103
|
+
throw new RangeError(`Unrecognized record size: ${_}`);
|
|
1104
|
+
let ie = a[b], ae, Y, Ce = g - x;
|
|
1105
|
+
if (S - g <= i && (Y = M(o.pos - N, w))) {
|
|
1106
|
+
let V = new Uint16Array(Y.size - Y.skip), D = o.pos - Y.size, W = V.length;
|
|
1107
|
+
for (; o.pos > D; )
|
|
1108
|
+
W = E(Y.start, V, W);
|
|
1109
|
+
ae = new X(V, S - Y.start, r), Ce = Y.start - x;
|
|
1110
|
+
} else {
|
|
1111
|
+
let V = o.pos - _;
|
|
1112
|
+
o.next();
|
|
1113
|
+
let D = [], W = [], Z = b >= s ? b : -1, te = 0, fe = S;
|
|
1114
|
+
for (; o.pos > V; )
|
|
1115
|
+
Z >= 0 && o.id == Z && o.size >= 0 ? (o.end <= fe - i && (k(D, W, g, te, o.end, fe, Z, O, $), te = D.length, fe = o.end), o.next()) : I > 2500 ? c(g, V, D, W) : p(g, V, D, W, Z, I + 1);
|
|
1116
|
+
if (Z >= 0 && te > 0 && te < D.length && k(D, W, g, te, g, fe, Z, O, $), D.reverse(), W.reverse(), Z > -1 && te > 0) {
|
|
1117
|
+
let Se = m(ie, $);
|
|
1118
|
+
ae = Ae(ie, D, W, 0, D.length, 0, S - g, Se, Se);
|
|
1119
|
+
} else
|
|
1120
|
+
ae = P(ie, D, W, S - g, O - S, $);
|
|
1121
|
+
}
|
|
1122
|
+
d.push(ae), B.push(Ce);
|
|
1123
|
+
}
|
|
1124
|
+
function c(x, N, d, B) {
|
|
1125
|
+
let w = [], I = 0, b = -1;
|
|
1126
|
+
for (; o.pos > N; ) {
|
|
1127
|
+
let { id: g, start: S, end: _, size: O } = o;
|
|
1128
|
+
if (O > 4)
|
|
1129
|
+
o.next();
|
|
1130
|
+
else {
|
|
1131
|
+
if (b > -1 && S < b)
|
|
1132
|
+
break;
|
|
1133
|
+
b < 0 && (b = _ - i), w.push(g, S, _), I++, o.next();
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
if (I) {
|
|
1137
|
+
let g = new Uint16Array(I * 4), S = w[w.length - 2];
|
|
1138
|
+
for (let _ = w.length - 3, O = 0; _ >= 0; _ -= 3)
|
|
1139
|
+
g[O++] = w[_], g[O++] = w[_ + 1] - S, g[O++] = w[_ + 2] - S, g[O++] = O;
|
|
1140
|
+
d.push(new X(g, w[2] - S, r)), B.push(S - x);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
function m(x, N) {
|
|
1144
|
+
return (d, B, w) => {
|
|
1145
|
+
let I = 0, b = d.length - 1, g, S;
|
|
1146
|
+
if (b >= 0 && (g = d[b]) instanceof R) {
|
|
1147
|
+
if (!b && g.type == x && g.length == w)
|
|
1148
|
+
return g;
|
|
1149
|
+
(S = g.prop(A.lookAhead)) && (I = B[b] + g.length + S);
|
|
1150
|
+
}
|
|
1151
|
+
return P(x, d, B, w, I, N);
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
function k(x, N, d, B, w, I, b, g, S) {
|
|
1155
|
+
let _ = [], O = [];
|
|
1156
|
+
for (; x.length > B; )
|
|
1157
|
+
_.push(x.pop()), O.push(N.pop() + d - w);
|
|
1158
|
+
x.push(P(r.types[b], _, O, I - w, g - I, S)), N.push(w - d);
|
|
1159
|
+
}
|
|
1160
|
+
function P(x, N, d, B, w, I, b) {
|
|
1161
|
+
if (I) {
|
|
1162
|
+
let g = [A.contextHash, I];
|
|
1163
|
+
b = b ? [g].concat(b) : [g];
|
|
1164
|
+
}
|
|
1165
|
+
if (w > 25) {
|
|
1166
|
+
let g = [A.lookAhead, w];
|
|
1167
|
+
b = b ? [g].concat(b) : [g];
|
|
1168
|
+
}
|
|
1169
|
+
return new R(x, N, d, B, b);
|
|
1170
|
+
}
|
|
1171
|
+
function M(x, N) {
|
|
1172
|
+
let d = o.fork(), B = 0, w = 0, I = 0, b = d.end - i, g = { size: 0, start: 0, skip: 0 };
|
|
1173
|
+
e: for (let S = d.pos - x; d.pos > S; ) {
|
|
1174
|
+
let _ = d.size;
|
|
1175
|
+
if (d.id == N && _ >= 0) {
|
|
1176
|
+
g.size = B, g.start = w, g.skip = I, I += 4, B += 4, d.next();
|
|
1177
|
+
continue;
|
|
1178
|
+
}
|
|
1179
|
+
let O = d.pos - _;
|
|
1180
|
+
if (_ < 0 || O < S || d.start < b)
|
|
1181
|
+
break;
|
|
1182
|
+
let $ = d.id >= s ? 4 : 0, ie = d.start;
|
|
1183
|
+
for (d.next(); d.pos > O; ) {
|
|
1184
|
+
if (d.size < 0)
|
|
1185
|
+
if (d.size == -3 || d.size == -4)
|
|
1186
|
+
$ += 4;
|
|
1187
|
+
else
|
|
1188
|
+
break e;
|
|
1189
|
+
else d.id >= s && ($ += 4);
|
|
1190
|
+
d.next();
|
|
1191
|
+
}
|
|
1192
|
+
w = ie, B += _, I += $;
|
|
1193
|
+
}
|
|
1194
|
+
return (N < 0 || B == x) && (g.size = B, g.start = w, g.skip = I), g.size > 4 ? g : void 0;
|
|
1195
|
+
}
|
|
1196
|
+
function E(x, N, d) {
|
|
1197
|
+
let { id: B, start: w, end: I, size: b } = o;
|
|
1198
|
+
if (o.next(), b >= 0 && B < s) {
|
|
1199
|
+
let g = d;
|
|
1200
|
+
if (b > 4) {
|
|
1201
|
+
let S = o.pos - (b - 4);
|
|
1202
|
+
for (; o.pos > S; )
|
|
1203
|
+
d = E(x, N, d);
|
|
1204
|
+
}
|
|
1205
|
+
N[--d] = g, N[--d] = I - x, N[--d] = w - x, N[--d] = B;
|
|
1206
|
+
} else b == -3 ? h = B : b == -4 && (u = B);
|
|
1207
|
+
return d;
|
|
1208
|
+
}
|
|
1209
|
+
let z = [], C = [];
|
|
1210
|
+
for (; o.pos > 0; )
|
|
1211
|
+
p(l.start || 0, l.bufferStart || 0, z, C, -1, 0);
|
|
1212
|
+
let F = (e = l.length) !== null && e !== void 0 ? e : z.length ? C[0] + z[0].length : 0;
|
|
1213
|
+
return new R(a[l.topID], z.reverse(), C.reverse(), F);
|
|
1214
|
+
}
|
|
1215
|
+
const Be = /* @__PURE__ */ new WeakMap();
|
|
1216
|
+
function de(l, e) {
|
|
1217
|
+
if (!l.isAnonymous || e instanceof X || e.type != l)
|
|
1218
|
+
return 1;
|
|
1219
|
+
let t = Be.get(e);
|
|
1220
|
+
if (t == null) {
|
|
1221
|
+
t = 1;
|
|
1222
|
+
for (let r of e.children) {
|
|
1223
|
+
if (r.type != l || !(r instanceof R)) {
|
|
1224
|
+
t = 1;
|
|
1225
|
+
break;
|
|
1226
|
+
}
|
|
1227
|
+
t += de(l, r);
|
|
1228
|
+
}
|
|
1229
|
+
Be.set(e, t);
|
|
1230
|
+
}
|
|
1231
|
+
return t;
|
|
1232
|
+
}
|
|
1233
|
+
function Ae(l, e, t, r, i, n, s, o, a) {
|
|
1234
|
+
let h = 0;
|
|
1235
|
+
for (let k = r; k < i; k++)
|
|
1236
|
+
h += de(l, e[k]);
|
|
1237
|
+
let u = Math.ceil(
|
|
1238
|
+
h * 1.5 / 8
|
|
1239
|
+
/* Balance.BranchFactor */
|
|
1240
|
+
), p = [], c = [];
|
|
1241
|
+
function m(k, P, M, E, z) {
|
|
1242
|
+
for (let C = M; C < E; ) {
|
|
1243
|
+
let F = C, x = P[C], N = de(l, k[C]);
|
|
1244
|
+
for (C++; C < E; C++) {
|
|
1245
|
+
let d = de(l, k[C]);
|
|
1246
|
+
if (N + d >= u)
|
|
1247
|
+
break;
|
|
1248
|
+
N += d;
|
|
1249
|
+
}
|
|
1250
|
+
if (C == F + 1) {
|
|
1251
|
+
if (N > u) {
|
|
1252
|
+
let d = k[F];
|
|
1253
|
+
m(d.children, d.positions, 0, d.children.length, P[F] + z);
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
p.push(k[F]);
|
|
1257
|
+
} else {
|
|
1258
|
+
let d = P[C - 1] + k[C - 1].length - x;
|
|
1259
|
+
p.push(Ae(l, k, P, F, C, x, d, null, a));
|
|
1260
|
+
}
|
|
1261
|
+
c.push(x + z - n);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
return m(e, t, r, i, 0), (o || a)(p, c, s);
|
|
1265
|
+
}
|
|
1266
|
+
class dt {
|
|
1267
|
+
constructor() {
|
|
1268
|
+
this.map = /* @__PURE__ */ new WeakMap();
|
|
1269
|
+
}
|
|
1270
|
+
setBuffer(e, t, r) {
|
|
1271
|
+
let i = this.map.get(e);
|
|
1272
|
+
i || this.map.set(e, i = /* @__PURE__ */ new Map()), i.set(t, r);
|
|
1273
|
+
}
|
|
1274
|
+
getBuffer(e, t) {
|
|
1275
|
+
let r = this.map.get(e);
|
|
1276
|
+
return r && r.get(t);
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
Set the value for this syntax node.
|
|
1280
|
+
*/
|
|
1281
|
+
set(e, t) {
|
|
1282
|
+
e instanceof K ? this.setBuffer(e.context.buffer, e.index, t) : e instanceof T && this.map.set(e.tree, t);
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
Retrieve value for this syntax node, if it exists in the map.
|
|
1286
|
+
*/
|
|
1287
|
+
get(e) {
|
|
1288
|
+
return e instanceof K ? this.getBuffer(e.context.buffer, e.index) : e instanceof T ? this.map.get(e.tree) : void 0;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
Set the value for the node that a cursor currently points to.
|
|
1292
|
+
*/
|
|
1293
|
+
cursorSet(e, t) {
|
|
1294
|
+
e.buffer ? this.setBuffer(e.buffer.buffer, e.index, t) : this.map.set(e.tree, t);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
Retrieve the value for the node that a cursor currently points
|
|
1298
|
+
to.
|
|
1299
|
+
*/
|
|
1300
|
+
cursorGet(e) {
|
|
1301
|
+
return e.buffer ? this.getBuffer(e.buffer.buffer, e.index) : this.map.get(e.tree);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
class le {
|
|
1305
|
+
/**
|
|
1306
|
+
Construct a tree fragment. You'll usually want to use
|
|
1307
|
+
[`addTree`](#common.TreeFragment^addTree) and
|
|
1308
|
+
[`applyChanges`](#common.TreeFragment^applyChanges) instead of
|
|
1309
|
+
calling this directly.
|
|
1310
|
+
*/
|
|
1311
|
+
constructor(e, t, r, i, n = !1, s = !1) {
|
|
1312
|
+
this.from = e, this.to = t, this.tree = r, this.offset = i, this.open = (n ? 1 : 0) | (s ? 2 : 0);
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
Whether the start of the fragment represents the start of a
|
|
1316
|
+
parse, or the end of a change. (In the second case, it may not
|
|
1317
|
+
be safe to reuse some nodes at the start, depending on the
|
|
1318
|
+
parsing algorithm.)
|
|
1319
|
+
*/
|
|
1320
|
+
get openStart() {
|
|
1321
|
+
return (this.open & 1) > 0;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
Whether the end of the fragment represents the end of a
|
|
1325
|
+
full-document parse, or the start of a change.
|
|
1326
|
+
*/
|
|
1327
|
+
get openEnd() {
|
|
1328
|
+
return (this.open & 2) > 0;
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
Create a set of fragments from a freshly parsed tree, or update
|
|
1332
|
+
an existing set of fragments by replacing the ones that overlap
|
|
1333
|
+
with a tree with content from the new tree. When `partial` is
|
|
1334
|
+
true, the parse is treated as incomplete, and the resulting
|
|
1335
|
+
fragment has [`openEnd`](#common.TreeFragment.openEnd) set to
|
|
1336
|
+
true.
|
|
1337
|
+
*/
|
|
1338
|
+
static addTree(e, t = [], r = !1) {
|
|
1339
|
+
let i = [new le(0, e.length, e, 0, !1, r)];
|
|
1340
|
+
for (let n of t)
|
|
1341
|
+
n.to > e.length && i.push(n);
|
|
1342
|
+
return i;
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
Apply a set of edits to an array of fragments, removing or
|
|
1346
|
+
splitting fragments as necessary to remove edited ranges, and
|
|
1347
|
+
adjusting offsets for fragments that moved.
|
|
1348
|
+
*/
|
|
1349
|
+
static applyChanges(e, t, r = 128) {
|
|
1350
|
+
if (!t.length)
|
|
1351
|
+
return e;
|
|
1352
|
+
let i = [], n = 1, s = e.length ? e[0] : null;
|
|
1353
|
+
for (let o = 0, a = 0, h = 0; ; o++) {
|
|
1354
|
+
let u = o < t.length ? t[o] : null, p = u ? u.fromA : 1e9;
|
|
1355
|
+
if (p - a >= r)
|
|
1356
|
+
for (; s && s.from < p; ) {
|
|
1357
|
+
let c = s;
|
|
1358
|
+
if (a >= c.from || p <= c.to || h) {
|
|
1359
|
+
let m = Math.max(c.from, a) - h, k = Math.min(c.to, p) - h;
|
|
1360
|
+
c = m >= k ? null : new le(m, k, c.tree, c.offset + h, o > 0, !!u);
|
|
1361
|
+
}
|
|
1362
|
+
if (c && i.push(c), s.to > p)
|
|
1363
|
+
break;
|
|
1364
|
+
s = n < e.length ? e[n++] : null;
|
|
1365
|
+
}
|
|
1366
|
+
if (!u)
|
|
1367
|
+
break;
|
|
1368
|
+
a = u.toA, h = u.toA - u.toB;
|
|
1369
|
+
}
|
|
1370
|
+
return i;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
class gt {
|
|
1374
|
+
/**
|
|
1375
|
+
Start a parse, returning a [partial parse](#common.PartialParse)
|
|
1376
|
+
object. [`fragments`](#common.TreeFragment) can be passed in to
|
|
1377
|
+
make the parse incremental.
|
|
1378
|
+
|
|
1379
|
+
By default, the entire input is parsed. You can pass `ranges`,
|
|
1380
|
+
which should be a sorted array of non-empty, non-overlapping
|
|
1381
|
+
ranges, to parse only those ranges. The tree returned in that
|
|
1382
|
+
case will start at `ranges[0].from`.
|
|
1383
|
+
*/
|
|
1384
|
+
startParse(e, t, r) {
|
|
1385
|
+
return typeof e == "string" && (e = new Xe(e)), r = r ? r.length ? r.map((i) => new H(i.from, i.to)) : [new H(0, 0)] : [new H(0, e.length)], this.createParse(e, t || [], r);
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
Run a full parse, returning the resulting tree.
|
|
1389
|
+
*/
|
|
1390
|
+
parse(e, t, r) {
|
|
1391
|
+
let i = this.startParse(e, t, r);
|
|
1392
|
+
for (; ; ) {
|
|
1393
|
+
let n = i.advance();
|
|
1394
|
+
if (n)
|
|
1395
|
+
return n;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
class Xe {
|
|
1400
|
+
constructor(e) {
|
|
1401
|
+
this.string = e;
|
|
1402
|
+
}
|
|
1403
|
+
get length() {
|
|
1404
|
+
return this.string.length;
|
|
1405
|
+
}
|
|
1406
|
+
chunk(e) {
|
|
1407
|
+
return this.string.slice(e);
|
|
1408
|
+
}
|
|
1409
|
+
get lineChunks() {
|
|
1410
|
+
return !1;
|
|
1411
|
+
}
|
|
1412
|
+
read(e, t) {
|
|
1413
|
+
return this.string.slice(e, t);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
function mt(l) {
|
|
1417
|
+
return (e, t, r, i) => new Ze(e, l, t, r, i);
|
|
1418
|
+
}
|
|
1419
|
+
class Ie {
|
|
1420
|
+
constructor(e, t, r, i, n, s) {
|
|
1421
|
+
this.parser = e, this.parse = t, this.overlay = r, this.bracketed = i, this.target = n, this.from = s;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
function Pe(l) {
|
|
1425
|
+
if (!l.length || l.some((e) => e.from >= e.to))
|
|
1426
|
+
throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(l));
|
|
1427
|
+
}
|
|
1428
|
+
class Ye {
|
|
1429
|
+
constructor(e, t, r, i, n, s, o, a) {
|
|
1430
|
+
this.parser = e, this.predicate = t, this.mounts = r, this.index = i, this.start = n, this.bracketed = s, this.target = o, this.prev = a, this.depth = 0, this.ranges = [];
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
const xe = new A({ perNode: !0 });
|
|
1434
|
+
class Ze {
|
|
1435
|
+
constructor(e, t, r, i, n) {
|
|
1436
|
+
this.nest = t, this.input = r, this.fragments = i, this.ranges = n, this.inner = [], this.innerDone = 0, this.baseTree = null, this.stoppedAt = null, this.baseParse = e;
|
|
1437
|
+
}
|
|
1438
|
+
advance() {
|
|
1439
|
+
if (this.baseParse) {
|
|
1440
|
+
let r = this.baseParse.advance();
|
|
1441
|
+
if (!r)
|
|
1442
|
+
return null;
|
|
1443
|
+
if (this.baseParse = null, this.baseTree = r, this.startInner(), this.stoppedAt != null)
|
|
1444
|
+
for (let i of this.inner)
|
|
1445
|
+
i.parse.stopAt(this.stoppedAt);
|
|
1446
|
+
}
|
|
1447
|
+
if (this.innerDone == this.inner.length) {
|
|
1448
|
+
let r = this.baseTree;
|
|
1449
|
+
return this.stoppedAt != null && (r = new R(r.type, r.children, r.positions, r.length, r.propValues.concat([[xe, this.stoppedAt]]))), r;
|
|
1450
|
+
}
|
|
1451
|
+
let e = this.inner[this.innerDone], t = e.parse.advance();
|
|
1452
|
+
if (t) {
|
|
1453
|
+
this.innerDone++;
|
|
1454
|
+
let r = Object.assign(/* @__PURE__ */ Object.create(null), e.target.props);
|
|
1455
|
+
r[A.mounted.id] = new re(t, e.overlay, e.parser, e.bracketed), e.target.props = r;
|
|
1456
|
+
}
|
|
1457
|
+
return null;
|
|
1458
|
+
}
|
|
1459
|
+
get parsedPos() {
|
|
1460
|
+
if (this.baseParse)
|
|
1461
|
+
return 0;
|
|
1462
|
+
let e = this.input.length;
|
|
1463
|
+
for (let t = this.innerDone; t < this.inner.length; t++)
|
|
1464
|
+
this.inner[t].from < e && (e = Math.min(e, this.inner[t].parse.parsedPos));
|
|
1465
|
+
return e;
|
|
1466
|
+
}
|
|
1467
|
+
stopAt(e) {
|
|
1468
|
+
if (this.stoppedAt = e, this.baseParse)
|
|
1469
|
+
this.baseParse.stopAt(e);
|
|
1470
|
+
else
|
|
1471
|
+
for (let t = this.innerDone; t < this.inner.length; t++)
|
|
1472
|
+
this.inner[t].parse.stopAt(e);
|
|
1473
|
+
}
|
|
1474
|
+
startInner() {
|
|
1475
|
+
let e = new rt(this.fragments), t = null, r = null, i = new ge(new T(this.baseTree, this.ranges[0].from, 0, null), v.IncludeAnonymous | v.IgnoreMounts);
|
|
1476
|
+
e: for (let n, s; ; ) {
|
|
1477
|
+
let o = !0, a;
|
|
1478
|
+
if (this.stoppedAt != null && i.from >= this.stoppedAt)
|
|
1479
|
+
o = !1;
|
|
1480
|
+
else if (e.hasNode(i)) {
|
|
1481
|
+
if (t) {
|
|
1482
|
+
let h = t.mounts.find((u) => u.frag.from <= i.from && u.frag.to >= i.to && u.mount.overlay);
|
|
1483
|
+
if (h)
|
|
1484
|
+
for (let u of h.mount.overlay) {
|
|
1485
|
+
let p = u.from + h.pos, c = u.to + h.pos;
|
|
1486
|
+
p >= i.from && c <= i.to && !t.ranges.some((m) => m.from < c && m.to > p) && t.ranges.push({ from: p, to: c });
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
o = !1;
|
|
1490
|
+
} else if (r && (s = et(r.ranges, i.from, i.to)))
|
|
1491
|
+
o = s != 2;
|
|
1492
|
+
else if (!i.type.isAnonymous && (n = this.nest(i, this.input)) && (i.from < i.to || !n.overlay)) {
|
|
1493
|
+
i.tree || (tt(i), t && t.depth++, r && r.depth++);
|
|
1494
|
+
let h = e.findMounts(i.from, n.parser);
|
|
1495
|
+
if (typeof n.overlay == "function")
|
|
1496
|
+
t = new Ye(n.parser, n.overlay, h, this.inner.length, i.from, !!n.bracketed, i.tree, t);
|
|
1497
|
+
else {
|
|
1498
|
+
let u = Ee(this.ranges, n.overlay || (i.from < i.to ? [new H(i.from, i.to)] : []));
|
|
1499
|
+
u.length && Pe(u), (u.length || !n.overlay) && this.inner.push(new Ie(n.parser, u.length ? n.parser.startParse(this.input, Oe(h, u), u) : n.parser.startParse(""), n.overlay ? n.overlay.map((p) => new H(p.from - i.from, p.to - i.from)) : null, !!n.bracketed, i.tree, u.length ? u[0].from : i.from)), n.overlay ? u.length && (r = { ranges: u, depth: 0, prev: r }) : o = !1;
|
|
1500
|
+
}
|
|
1501
|
+
} else if (t && (a = t.predicate(i)) && (a === !0 && (a = new H(i.from, i.to)), a.from < a.to)) {
|
|
1502
|
+
let h = t.ranges.length - 1;
|
|
1503
|
+
h >= 0 && t.ranges[h].to == a.from ? t.ranges[h] = { from: t.ranges[h].from, to: a.to } : t.ranges.push(a);
|
|
1504
|
+
}
|
|
1505
|
+
if (o && i.firstChild())
|
|
1506
|
+
t && t.depth++, r && r.depth++;
|
|
1507
|
+
else
|
|
1508
|
+
for (; !i.nextSibling(); ) {
|
|
1509
|
+
if (!i.parent())
|
|
1510
|
+
break e;
|
|
1511
|
+
if (t && !--t.depth) {
|
|
1512
|
+
let h = Ee(this.ranges, t.ranges);
|
|
1513
|
+
h.length && (Pe(h), this.inner.splice(t.index, 0, new Ie(t.parser, t.parser.startParse(this.input, Oe(t.mounts, h), h), t.ranges.map((u) => new H(u.from - t.start, u.to - t.start)), t.bracketed, t.target, h[0].from))), t = t.prev;
|
|
1514
|
+
}
|
|
1515
|
+
r && !--r.depth && (r = r.prev);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
function et(l, e, t) {
|
|
1521
|
+
for (let r of l) {
|
|
1522
|
+
if (r.from >= t)
|
|
1523
|
+
break;
|
|
1524
|
+
if (r.to > e)
|
|
1525
|
+
return r.from <= e && r.to >= t ? 2 : 1;
|
|
1526
|
+
}
|
|
1527
|
+
return 0;
|
|
1528
|
+
}
|
|
1529
|
+
function Me(l, e, t, r, i, n) {
|
|
1530
|
+
if (e < t) {
|
|
1531
|
+
let s = l.buffer[e + 1];
|
|
1532
|
+
r.push(l.slice(e, t, s)), i.push(s - n);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
function tt(l) {
|
|
1536
|
+
let { node: e } = l, t = [], r = e.context.buffer;
|
|
1537
|
+
do
|
|
1538
|
+
t.push(l.index), l.parent();
|
|
1539
|
+
while (!l.tree);
|
|
1540
|
+
let i = l.tree, n = i.children.indexOf(r), s = i.children[n], o = s.buffer, a = [n];
|
|
1541
|
+
function h(u, p, c, m, k, P) {
|
|
1542
|
+
let M = t[P], E = [], z = [];
|
|
1543
|
+
Me(s, u, M, E, z, m);
|
|
1544
|
+
let C = o[M + 1], F = o[M + 2];
|
|
1545
|
+
a.push(E.length);
|
|
1546
|
+
let x = P ? h(M + 4, o[M + 3], s.set.types[o[M]], C, F - C, P - 1) : e.toTree();
|
|
1547
|
+
return E.push(x), z.push(C - m), Me(s, o[M + 3], p, E, z, m), new R(c, E, z, k);
|
|
1548
|
+
}
|
|
1549
|
+
i.children[n] = h(0, o.length, L.none, 0, s.length, t.length - 1);
|
|
1550
|
+
for (let u of a) {
|
|
1551
|
+
let p = l.tree.children[u], c = l.tree.positions[u];
|
|
1552
|
+
l.yield(new T(p, c + l.from, u, l._tree));
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
class ze {
|
|
1556
|
+
constructor(e, t) {
|
|
1557
|
+
this.offset = t, this.done = !1, this.cursor = e.cursor(v.IncludeAnonymous | v.IgnoreMounts);
|
|
1558
|
+
}
|
|
1559
|
+
// Move to the first node (in pre-order) that starts at or after `pos`.
|
|
1560
|
+
moveTo(e) {
|
|
1561
|
+
let { cursor: t } = this, r = e - this.offset;
|
|
1562
|
+
for (; !this.done && t.from < r; )
|
|
1563
|
+
if (!(t.to >= e && t.enter(r, 1, v.IgnoreOverlays | v.ExcludeBuffers))) if (t.to <= e)
|
|
1564
|
+
t.next(!1) || (this.done = !0);
|
|
1565
|
+
else
|
|
1566
|
+
break;
|
|
1567
|
+
}
|
|
1568
|
+
hasNode(e) {
|
|
1569
|
+
if (this.moveTo(e.from), !this.done && this.cursor.from + this.offset == e.from && this.cursor.tree)
|
|
1570
|
+
for (let t = this.cursor.tree; ; ) {
|
|
1571
|
+
if (t == e.tree)
|
|
1572
|
+
return !0;
|
|
1573
|
+
if (t.children.length && t.positions[0] == 0 && t.children[0] instanceof R)
|
|
1574
|
+
t = t.children[0];
|
|
1575
|
+
else
|
|
1576
|
+
break;
|
|
1577
|
+
}
|
|
1578
|
+
return !1;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
class rt {
|
|
1582
|
+
constructor(e) {
|
|
1583
|
+
var t;
|
|
1584
|
+
if (this.fragments = e, this.curTo = 0, this.fragI = 0, e.length) {
|
|
1585
|
+
let r = this.curFrag = e[0];
|
|
1586
|
+
this.curTo = (t = r.tree.prop(xe)) !== null && t !== void 0 ? t : r.to, this.inner = new ze(r.tree, -r.offset);
|
|
1587
|
+
} else
|
|
1588
|
+
this.curFrag = this.inner = null;
|
|
1589
|
+
}
|
|
1590
|
+
hasNode(e) {
|
|
1591
|
+
for (; this.curFrag && e.from >= this.curTo; )
|
|
1592
|
+
this.nextFrag();
|
|
1593
|
+
return this.curFrag && this.curFrag.from <= e.from && this.curTo >= e.to && this.inner.hasNode(e);
|
|
1594
|
+
}
|
|
1595
|
+
nextFrag() {
|
|
1596
|
+
var e;
|
|
1597
|
+
if (this.fragI++, this.fragI == this.fragments.length)
|
|
1598
|
+
this.curFrag = this.inner = null;
|
|
1599
|
+
else {
|
|
1600
|
+
let t = this.curFrag = this.fragments[this.fragI];
|
|
1601
|
+
this.curTo = (e = t.tree.prop(xe)) !== null && e !== void 0 ? e : t.to, this.inner = new ze(t.tree, -t.offset);
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
findMounts(e, t) {
|
|
1605
|
+
var r;
|
|
1606
|
+
let i = [];
|
|
1607
|
+
if (this.inner) {
|
|
1608
|
+
this.inner.cursor.moveTo(e, 1);
|
|
1609
|
+
for (let n = this.inner.cursor.node; n; n = n.parent) {
|
|
1610
|
+
let s = (r = n.tree) === null || r === void 0 ? void 0 : r.prop(A.mounted);
|
|
1611
|
+
if (s && s.parser == t)
|
|
1612
|
+
for (let o = this.fragI; o < this.fragments.length; o++) {
|
|
1613
|
+
let a = this.fragments[o];
|
|
1614
|
+
if (a.from >= n.to)
|
|
1615
|
+
break;
|
|
1616
|
+
a.tree == this.curFrag.tree && i.push({
|
|
1617
|
+
frag: a,
|
|
1618
|
+
pos: n.from - a.offset,
|
|
1619
|
+
mount: s
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
return i;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
function Ee(l, e) {
|
|
1628
|
+
let t = null, r = e;
|
|
1629
|
+
for (let i = 1, n = 0; i < l.length; i++) {
|
|
1630
|
+
let s = l[i - 1].to, o = l[i].from;
|
|
1631
|
+
for (; n < r.length; n++) {
|
|
1632
|
+
let a = r[n];
|
|
1633
|
+
if (a.from >= o)
|
|
1634
|
+
break;
|
|
1635
|
+
a.to <= s || (t || (r = t = e.slice()), a.from < s ? (t[n] = new H(a.from, s), a.to > o && t.splice(n + 1, 0, new H(o, a.to))) : a.to > o ? t[n--] = new H(o, a.to) : t.splice(n--, 1));
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
return r;
|
|
1639
|
+
}
|
|
1640
|
+
function it(l, e, t, r) {
|
|
1641
|
+
let i = 0, n = 0, s = !1, o = !1, a = -1e9, h = [];
|
|
1642
|
+
for (; ; ) {
|
|
1643
|
+
let u = i == l.length ? 1e9 : s ? l[i].to : l[i].from, p = n == e.length ? 1e9 : o ? e[n].to : e[n].from;
|
|
1644
|
+
if (s != o) {
|
|
1645
|
+
let c = Math.max(a, t), m = Math.min(u, p, r);
|
|
1646
|
+
c < m && h.push(new H(c, m));
|
|
1647
|
+
}
|
|
1648
|
+
if (a = Math.min(u, p), a == 1e9)
|
|
1649
|
+
break;
|
|
1650
|
+
u == a && (s ? (s = !1, i++) : s = !0), p == a && (o ? (o = !1, n++) : o = !0);
|
|
1651
|
+
}
|
|
1652
|
+
return h;
|
|
1653
|
+
}
|
|
1654
|
+
function Oe(l, e) {
|
|
1655
|
+
let t = [];
|
|
1656
|
+
for (let { pos: r, mount: i, frag: n } of l) {
|
|
1657
|
+
let s = r + (i.overlay ? i.overlay[0].from : 0), o = s + i.tree.length, a = Math.max(n.from, s), h = Math.min(n.to, o);
|
|
1658
|
+
if (i.overlay) {
|
|
1659
|
+
let u = i.overlay.map((c) => new H(c.from + r, c.to + r)), p = it(e, u, a, h);
|
|
1660
|
+
for (let c = 0, m = a; ; c++) {
|
|
1661
|
+
let k = c == p.length, P = k ? h : p[c].from;
|
|
1662
|
+
if (P > m && t.push(new le(m, P, i.tree, -s, n.from >= m || n.openStart, n.to <= P || n.openEnd)), k)
|
|
1663
|
+
break;
|
|
1664
|
+
m = p[c].to;
|
|
1665
|
+
}
|
|
1666
|
+
} else
|
|
1667
|
+
t.push(new le(a, h, i.tree, -s, n.from >= s || n.openStart, n.to <= o || n.openEnd));
|
|
1668
|
+
}
|
|
1669
|
+
return t;
|
|
1670
|
+
}
|
|
1671
|
+
let nt = 0;
|
|
1672
|
+
class j {
|
|
1673
|
+
/**
|
|
1674
|
+
@internal
|
|
1675
|
+
*/
|
|
1676
|
+
constructor(e, t, r, i) {
|
|
1677
|
+
this.name = e, this.set = t, this.base = r, this.modified = i, this.id = nt++;
|
|
1678
|
+
}
|
|
1679
|
+
toString() {
|
|
1680
|
+
let { name: e } = this;
|
|
1681
|
+
for (let t of this.modified)
|
|
1682
|
+
t.name && (e = `${t.name}(${e})`);
|
|
1683
|
+
return e;
|
|
1684
|
+
}
|
|
1685
|
+
static define(e, t) {
|
|
1686
|
+
let r = typeof e == "string" ? e : "?";
|
|
1687
|
+
if (e instanceof j && (t = e), t?.base)
|
|
1688
|
+
throw new Error("Can not derive from a modified tag");
|
|
1689
|
+
let i = new j(r, [], null, []);
|
|
1690
|
+
if (i.set.push(i), t)
|
|
1691
|
+
for (let n of t.set)
|
|
1692
|
+
i.set.push(n);
|
|
1693
|
+
return i;
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
Define a tag _modifier_, which is a function that, given a tag,
|
|
1697
|
+
will return a tag that is a subtag of the original. Applying the
|
|
1698
|
+
same modifier to a twice tag will return the same value (`m1(t1)
|
|
1699
|
+
== m1(t1)`) and applying multiple modifiers will, regardless or
|
|
1700
|
+
order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).
|
|
1701
|
+
|
|
1702
|
+
When multiple modifiers are applied to a given base tag, each
|
|
1703
|
+
smaller set of modifiers is registered as a parent, so that for
|
|
1704
|
+
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
|
|
1705
|
+
`m1(m3(t1)`, and so on.
|
|
1706
|
+
*/
|
|
1707
|
+
static defineModifier(e) {
|
|
1708
|
+
let t = new me(e);
|
|
1709
|
+
return (r) => r.modified.indexOf(t) > -1 ? r : me.get(r.base || r, r.modified.concat(t).sort((i, n) => i.id - n.id));
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
let st = 0;
|
|
1713
|
+
class me {
|
|
1714
|
+
constructor(e) {
|
|
1715
|
+
this.name = e, this.instances = [], this.id = st++;
|
|
1716
|
+
}
|
|
1717
|
+
static get(e, t) {
|
|
1718
|
+
if (!t.length)
|
|
1719
|
+
return e;
|
|
1720
|
+
let r = t[0].instances.find((o) => o.base == e && lt(t, o.modified));
|
|
1721
|
+
if (r)
|
|
1722
|
+
return r;
|
|
1723
|
+
let i = [], n = new j(e.name, i, e, t);
|
|
1724
|
+
for (let o of t)
|
|
1725
|
+
o.instances.push(n);
|
|
1726
|
+
let s = ot(t);
|
|
1727
|
+
for (let o of e.set)
|
|
1728
|
+
if (!o.modified.length)
|
|
1729
|
+
for (let a of s)
|
|
1730
|
+
i.push(me.get(o, a));
|
|
1731
|
+
return n;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
function lt(l, e) {
|
|
1735
|
+
return l.length == e.length && l.every((t, r) => t == e[r]);
|
|
1736
|
+
}
|
|
1737
|
+
function ot(l) {
|
|
1738
|
+
let e = [[]];
|
|
1739
|
+
for (let t = 0; t < l.length; t++)
|
|
1740
|
+
for (let r = 0, i = e.length; r < i; r++)
|
|
1741
|
+
e.push(e[r].concat(l[t]));
|
|
1742
|
+
return e.sort((t, r) => r.length - t.length);
|
|
1743
|
+
}
|
|
1744
|
+
function at(l) {
|
|
1745
|
+
let e = /* @__PURE__ */ Object.create(null);
|
|
1746
|
+
for (let t in l) {
|
|
1747
|
+
let r = l[t];
|
|
1748
|
+
Array.isArray(r) || (r = [r]);
|
|
1749
|
+
for (let i of t.split(" "))
|
|
1750
|
+
if (i) {
|
|
1751
|
+
let n = [], s = 2, o = i;
|
|
1752
|
+
for (let p = 0; ; ) {
|
|
1753
|
+
if (o == "..." && p > 0 && p + 3 == i.length) {
|
|
1754
|
+
s = 1;
|
|
1755
|
+
break;
|
|
1756
|
+
}
|
|
1757
|
+
let c = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);
|
|
1758
|
+
if (!c)
|
|
1759
|
+
throw new RangeError("Invalid path: " + i);
|
|
1760
|
+
if (n.push(c[0] == "*" ? "" : c[0][0] == '"' ? JSON.parse(c[0]) : c[0]), p += c[0].length, p == i.length)
|
|
1761
|
+
break;
|
|
1762
|
+
let m = i[p++];
|
|
1763
|
+
if (p == i.length && m == "!") {
|
|
1764
|
+
s = 0;
|
|
1765
|
+
break;
|
|
1766
|
+
}
|
|
1767
|
+
if (m != "/")
|
|
1768
|
+
throw new RangeError("Invalid path: " + i);
|
|
1769
|
+
o = i.slice(p);
|
|
1770
|
+
}
|
|
1771
|
+
let a = n.length - 1, h = n[a];
|
|
1772
|
+
if (!h)
|
|
1773
|
+
throw new RangeError("Invalid path: " + i);
|
|
1774
|
+
let u = new oe(r, s, a > 0 ? n.slice(0, a) : null);
|
|
1775
|
+
e[h] = u.sort(e[h]);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
return Le.add(e);
|
|
1779
|
+
}
|
|
1780
|
+
const Le = new A({
|
|
1781
|
+
combine(l, e) {
|
|
1782
|
+
let t, r, i;
|
|
1783
|
+
for (; l || e; ) {
|
|
1784
|
+
if (!l || e && l.depth >= e.depth ? (i = e, e = e.next) : (i = l, l = l.next), t && t.mode == i.mode && !i.context && !t.context)
|
|
1785
|
+
continue;
|
|
1786
|
+
let n = new oe(i.tags, i.mode, i.context);
|
|
1787
|
+
t ? t.next = n : r = n, t = n;
|
|
1788
|
+
}
|
|
1789
|
+
return r;
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1792
|
+
class oe {
|
|
1793
|
+
constructor(e, t, r, i) {
|
|
1794
|
+
this.tags = e, this.mode = t, this.context = r, this.next = i;
|
|
1795
|
+
}
|
|
1796
|
+
get opaque() {
|
|
1797
|
+
return this.mode == 0;
|
|
1798
|
+
}
|
|
1799
|
+
get inherit() {
|
|
1800
|
+
return this.mode == 1;
|
|
1801
|
+
}
|
|
1802
|
+
sort(e) {
|
|
1803
|
+
return !e || e.depth < this.depth ? (this.next = e, this) : (e.next = this.sort(e.next), e);
|
|
1804
|
+
}
|
|
1805
|
+
get depth() {
|
|
1806
|
+
return this.context ? this.context.length : 0;
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
oe.empty = new oe([], 2, null);
|
|
1810
|
+
function We(l, e) {
|
|
1811
|
+
let t = /* @__PURE__ */ Object.create(null);
|
|
1812
|
+
for (let n of l)
|
|
1813
|
+
if (!Array.isArray(n.tag))
|
|
1814
|
+
t[n.tag.id] = n.class;
|
|
1815
|
+
else
|
|
1816
|
+
for (let s of n.tag)
|
|
1817
|
+
t[s.id] = n.class;
|
|
1818
|
+
let { scope: r, all: i = null } = e || {};
|
|
1819
|
+
return {
|
|
1820
|
+
style: (n) => {
|
|
1821
|
+
let s = i;
|
|
1822
|
+
for (let o of n)
|
|
1823
|
+
for (let a of o.set) {
|
|
1824
|
+
let h = t[a.id];
|
|
1825
|
+
if (h) {
|
|
1826
|
+
s = s ? s + " " + h : h;
|
|
1827
|
+
break;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
return s;
|
|
1831
|
+
},
|
|
1832
|
+
scope: r
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
function ft(l, e) {
|
|
1836
|
+
let t = null;
|
|
1837
|
+
for (let r of l) {
|
|
1838
|
+
let i = r.style(e);
|
|
1839
|
+
i && (t = t ? t + " " + i : i);
|
|
1840
|
+
}
|
|
1841
|
+
return t;
|
|
1842
|
+
}
|
|
1843
|
+
function Ue(l, e, t, r = 0, i = l.length) {
|
|
1844
|
+
let n = new ut(r, Array.isArray(e) ? e : [e], t);
|
|
1845
|
+
n.highlightRange(l.cursor(), r, i, "", n.highlighters), n.flush(i);
|
|
1846
|
+
}
|
|
1847
|
+
function ht(l, e, t, r, i, n = 0, s = l.length) {
|
|
1848
|
+
let o = n;
|
|
1849
|
+
function a(h, u) {
|
|
1850
|
+
if (!(h <= o)) {
|
|
1851
|
+
for (let p = l.slice(o, h), c = 0; ; ) {
|
|
1852
|
+
let m = p.indexOf(`
|
|
1853
|
+
`, c), k = m < 0 ? p.length : m;
|
|
1854
|
+
if (k > c && r(p.slice(c, k), u), m < 0)
|
|
1855
|
+
break;
|
|
1856
|
+
i(), c = m + 1;
|
|
1857
|
+
}
|
|
1858
|
+
o = h;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
Ue(e, t, (h, u, p) => {
|
|
1862
|
+
a(h, ""), a(u, p);
|
|
1863
|
+
}, n, s), a(s, "");
|
|
1864
|
+
}
|
|
1865
|
+
class ut {
|
|
1866
|
+
constructor(e, t, r) {
|
|
1867
|
+
this.at = e, this.highlighters = t, this.span = r, this.class = "";
|
|
1868
|
+
}
|
|
1869
|
+
startSpan(e, t) {
|
|
1870
|
+
t != this.class && (this.flush(e), e > this.at && (this.at = e), this.class = t);
|
|
1871
|
+
}
|
|
1872
|
+
flush(e) {
|
|
1873
|
+
e > this.at && this.class && this.span(this.at, e, this.class);
|
|
1874
|
+
}
|
|
1875
|
+
highlightRange(e, t, r, i, n) {
|
|
1876
|
+
let { type: s, from: o, to: a } = e;
|
|
1877
|
+
if (o >= r || a <= t)
|
|
1878
|
+
return;
|
|
1879
|
+
s.isTop && (n = this.highlighters.filter((m) => !m.scope || m.scope(s)));
|
|
1880
|
+
let h = i, u = qe(e) || oe.empty, p = ft(n, u.tags);
|
|
1881
|
+
if (p && (h && (h += " "), h += p, u.mode == 1 && (i += (i ? " " : "") + p)), this.startSpan(Math.max(t, o), h), u.opaque)
|
|
1882
|
+
return;
|
|
1883
|
+
let c = e.tree && e.tree.prop(A.mounted);
|
|
1884
|
+
if (c && c.overlay) {
|
|
1885
|
+
let m = e.node.enter(c.overlay[0].from + o, 1), k = this.highlighters.filter((M) => !M.scope || M.scope(c.tree.type)), P = e.firstChild();
|
|
1886
|
+
for (let M = 0, E = o; ; M++) {
|
|
1887
|
+
let z = M < c.overlay.length ? c.overlay[M] : null, C = z ? z.from + o : a, F = Math.max(t, E), x = Math.min(r, C);
|
|
1888
|
+
if (F < x && P)
|
|
1889
|
+
for (; e.from < x && (this.highlightRange(e, F, x, i, n), this.startSpan(Math.min(x, e.to), h), !(e.to >= C || !e.nextSibling())); )
|
|
1890
|
+
;
|
|
1891
|
+
if (!z || C > r)
|
|
1892
|
+
break;
|
|
1893
|
+
E = z.to + o, E > t && (this.highlightRange(m.cursor(), Math.max(t, z.from + o), Math.min(r, E), "", k), this.startSpan(Math.min(r, E), h));
|
|
1894
|
+
}
|
|
1895
|
+
P && e.parent();
|
|
1896
|
+
} else if (e.firstChild()) {
|
|
1897
|
+
c && (i = "");
|
|
1898
|
+
do
|
|
1899
|
+
if (!(e.to <= t)) {
|
|
1900
|
+
if (e.from >= r)
|
|
1901
|
+
break;
|
|
1902
|
+
this.highlightRange(e, t, r, i, n), this.startSpan(Math.min(r, e.to), h);
|
|
1903
|
+
}
|
|
1904
|
+
while (e.nextSibling());
|
|
1905
|
+
e.parent();
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
function qe(l) {
|
|
1910
|
+
let e = l.type.prop(Le);
|
|
1911
|
+
for (; e && e.context && !l.matchContext(e.context); )
|
|
1912
|
+
e = e.next;
|
|
1913
|
+
return e || null;
|
|
1914
|
+
}
|
|
1915
|
+
const f = j.define, ue = f(), G = f(), Te = f(G), Re = f(G), Q = f(), pe = f(Q), ye = f(Q), J = f(), ee = f(J), U = f(), q = f(), ke = f(), ne = f(ke), ce = f(), y = {
|
|
1916
|
+
/**
|
|
1917
|
+
A comment.
|
|
1918
|
+
*/
|
|
1919
|
+
comment: ue,
|
|
1920
|
+
/**
|
|
1921
|
+
A line [comment](#highlight.tags.comment).
|
|
1922
|
+
*/
|
|
1923
|
+
lineComment: f(ue),
|
|
1924
|
+
/**
|
|
1925
|
+
A block [comment](#highlight.tags.comment).
|
|
1926
|
+
*/
|
|
1927
|
+
blockComment: f(ue),
|
|
1928
|
+
/**
|
|
1929
|
+
A documentation [comment](#highlight.tags.comment).
|
|
1930
|
+
*/
|
|
1931
|
+
docComment: f(ue),
|
|
1932
|
+
/**
|
|
1933
|
+
Any kind of identifier.
|
|
1934
|
+
*/
|
|
1935
|
+
name: G,
|
|
1936
|
+
/**
|
|
1937
|
+
The [name](#highlight.tags.name) of a variable.
|
|
1938
|
+
*/
|
|
1939
|
+
variableName: f(G),
|
|
1940
|
+
/**
|
|
1941
|
+
A type [name](#highlight.tags.name).
|
|
1942
|
+
*/
|
|
1943
|
+
typeName: Te,
|
|
1944
|
+
/**
|
|
1945
|
+
A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
|
|
1946
|
+
*/
|
|
1947
|
+
tagName: f(Te),
|
|
1948
|
+
/**
|
|
1949
|
+
A property or field [name](#highlight.tags.name).
|
|
1950
|
+
*/
|
|
1951
|
+
propertyName: Re,
|
|
1952
|
+
/**
|
|
1953
|
+
An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
|
|
1954
|
+
*/
|
|
1955
|
+
attributeName: f(Re),
|
|
1956
|
+
/**
|
|
1957
|
+
The [name](#highlight.tags.name) of a class.
|
|
1958
|
+
*/
|
|
1959
|
+
className: f(G),
|
|
1960
|
+
/**
|
|
1961
|
+
A label [name](#highlight.tags.name).
|
|
1962
|
+
*/
|
|
1963
|
+
labelName: f(G),
|
|
1964
|
+
/**
|
|
1965
|
+
A namespace [name](#highlight.tags.name).
|
|
1966
|
+
*/
|
|
1967
|
+
namespace: f(G),
|
|
1968
|
+
/**
|
|
1969
|
+
The [name](#highlight.tags.name) of a macro.
|
|
1970
|
+
*/
|
|
1971
|
+
macroName: f(G),
|
|
1972
|
+
/**
|
|
1973
|
+
A literal value.
|
|
1974
|
+
*/
|
|
1975
|
+
literal: Q,
|
|
1976
|
+
/**
|
|
1977
|
+
A string [literal](#highlight.tags.literal).
|
|
1978
|
+
*/
|
|
1979
|
+
string: pe,
|
|
1980
|
+
/**
|
|
1981
|
+
A documentation [string](#highlight.tags.string).
|
|
1982
|
+
*/
|
|
1983
|
+
docString: f(pe),
|
|
1984
|
+
/**
|
|
1985
|
+
A character literal (subtag of [string](#highlight.tags.string)).
|
|
1986
|
+
*/
|
|
1987
|
+
character: f(pe),
|
|
1988
|
+
/**
|
|
1989
|
+
An attribute value (subtag of [string](#highlight.tags.string)).
|
|
1990
|
+
*/
|
|
1991
|
+
attributeValue: f(pe),
|
|
1992
|
+
/**
|
|
1993
|
+
A number [literal](#highlight.tags.literal).
|
|
1994
|
+
*/
|
|
1995
|
+
number: ye,
|
|
1996
|
+
/**
|
|
1997
|
+
An integer [number](#highlight.tags.number) literal.
|
|
1998
|
+
*/
|
|
1999
|
+
integer: f(ye),
|
|
2000
|
+
/**
|
|
2001
|
+
A floating-point [number](#highlight.tags.number) literal.
|
|
2002
|
+
*/
|
|
2003
|
+
float: f(ye),
|
|
2004
|
+
/**
|
|
2005
|
+
A boolean [literal](#highlight.tags.literal).
|
|
2006
|
+
*/
|
|
2007
|
+
bool: f(Q),
|
|
2008
|
+
/**
|
|
2009
|
+
Regular expression [literal](#highlight.tags.literal).
|
|
2010
|
+
*/
|
|
2011
|
+
regexp: f(Q),
|
|
2012
|
+
/**
|
|
2013
|
+
An escape [literal](#highlight.tags.literal), for example a
|
|
2014
|
+
backslash escape in a string.
|
|
2015
|
+
*/
|
|
2016
|
+
escape: f(Q),
|
|
2017
|
+
/**
|
|
2018
|
+
A color [literal](#highlight.tags.literal).
|
|
2019
|
+
*/
|
|
2020
|
+
color: f(Q),
|
|
2021
|
+
/**
|
|
2022
|
+
A URL [literal](#highlight.tags.literal).
|
|
2023
|
+
*/
|
|
2024
|
+
url: f(Q),
|
|
2025
|
+
/**
|
|
2026
|
+
A language keyword.
|
|
2027
|
+
*/
|
|
2028
|
+
keyword: U,
|
|
2029
|
+
/**
|
|
2030
|
+
The [keyword](#highlight.tags.keyword) for the self or this
|
|
2031
|
+
object.
|
|
2032
|
+
*/
|
|
2033
|
+
self: f(U),
|
|
2034
|
+
/**
|
|
2035
|
+
The [keyword](#highlight.tags.keyword) for null.
|
|
2036
|
+
*/
|
|
2037
|
+
null: f(U),
|
|
2038
|
+
/**
|
|
2039
|
+
A [keyword](#highlight.tags.keyword) denoting some atomic value.
|
|
2040
|
+
*/
|
|
2041
|
+
atom: f(U),
|
|
2042
|
+
/**
|
|
2043
|
+
A [keyword](#highlight.tags.keyword) that represents a unit.
|
|
2044
|
+
*/
|
|
2045
|
+
unit: f(U),
|
|
2046
|
+
/**
|
|
2047
|
+
A modifier [keyword](#highlight.tags.keyword).
|
|
2048
|
+
*/
|
|
2049
|
+
modifier: f(U),
|
|
2050
|
+
/**
|
|
2051
|
+
A [keyword](#highlight.tags.keyword) that acts as an operator.
|
|
2052
|
+
*/
|
|
2053
|
+
operatorKeyword: f(U),
|
|
2054
|
+
/**
|
|
2055
|
+
A control-flow related [keyword](#highlight.tags.keyword).
|
|
2056
|
+
*/
|
|
2057
|
+
controlKeyword: f(U),
|
|
2058
|
+
/**
|
|
2059
|
+
A [keyword](#highlight.tags.keyword) that defines something.
|
|
2060
|
+
*/
|
|
2061
|
+
definitionKeyword: f(U),
|
|
2062
|
+
/**
|
|
2063
|
+
A [keyword](#highlight.tags.keyword) related to defining or
|
|
2064
|
+
interfacing with modules.
|
|
2065
|
+
*/
|
|
2066
|
+
moduleKeyword: f(U),
|
|
2067
|
+
/**
|
|
2068
|
+
An operator.
|
|
2069
|
+
*/
|
|
2070
|
+
operator: q,
|
|
2071
|
+
/**
|
|
2072
|
+
An [operator](#highlight.tags.operator) that dereferences something.
|
|
2073
|
+
*/
|
|
2074
|
+
derefOperator: f(q),
|
|
2075
|
+
/**
|
|
2076
|
+
Arithmetic-related [operator](#highlight.tags.operator).
|
|
2077
|
+
*/
|
|
2078
|
+
arithmeticOperator: f(q),
|
|
2079
|
+
/**
|
|
2080
|
+
Logical [operator](#highlight.tags.operator).
|
|
2081
|
+
*/
|
|
2082
|
+
logicOperator: f(q),
|
|
2083
|
+
/**
|
|
2084
|
+
Bit [operator](#highlight.tags.operator).
|
|
2085
|
+
*/
|
|
2086
|
+
bitwiseOperator: f(q),
|
|
2087
|
+
/**
|
|
2088
|
+
Comparison [operator](#highlight.tags.operator).
|
|
2089
|
+
*/
|
|
2090
|
+
compareOperator: f(q),
|
|
2091
|
+
/**
|
|
2092
|
+
[Operator](#highlight.tags.operator) that updates its operand.
|
|
2093
|
+
*/
|
|
2094
|
+
updateOperator: f(q),
|
|
2095
|
+
/**
|
|
2096
|
+
[Operator](#highlight.tags.operator) that defines something.
|
|
2097
|
+
*/
|
|
2098
|
+
definitionOperator: f(q),
|
|
2099
|
+
/**
|
|
2100
|
+
Type-related [operator](#highlight.tags.operator).
|
|
2101
|
+
*/
|
|
2102
|
+
typeOperator: f(q),
|
|
2103
|
+
/**
|
|
2104
|
+
Control-flow [operator](#highlight.tags.operator).
|
|
2105
|
+
*/
|
|
2106
|
+
controlOperator: f(q),
|
|
2107
|
+
/**
|
|
2108
|
+
Program or markup punctuation.
|
|
2109
|
+
*/
|
|
2110
|
+
punctuation: ke,
|
|
2111
|
+
/**
|
|
2112
|
+
[Punctuation](#highlight.tags.punctuation) that separates
|
|
2113
|
+
things.
|
|
2114
|
+
*/
|
|
2115
|
+
separator: f(ke),
|
|
2116
|
+
/**
|
|
2117
|
+
Bracket-style [punctuation](#highlight.tags.punctuation).
|
|
2118
|
+
*/
|
|
2119
|
+
bracket: ne,
|
|
2120
|
+
/**
|
|
2121
|
+
Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
|
|
2122
|
+
tokens).
|
|
2123
|
+
*/
|
|
2124
|
+
angleBracket: f(ne),
|
|
2125
|
+
/**
|
|
2126
|
+
Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
|
|
2127
|
+
tokens).
|
|
2128
|
+
*/
|
|
2129
|
+
squareBracket: f(ne),
|
|
2130
|
+
/**
|
|
2131
|
+
Parentheses (usually `(` and `)` tokens). Subtag of
|
|
2132
|
+
[bracket](#highlight.tags.bracket).
|
|
2133
|
+
*/
|
|
2134
|
+
paren: f(ne),
|
|
2135
|
+
/**
|
|
2136
|
+
Braces (usually `{` and `}` tokens). Subtag of
|
|
2137
|
+
[bracket](#highlight.tags.bracket).
|
|
2138
|
+
*/
|
|
2139
|
+
brace: f(ne),
|
|
2140
|
+
/**
|
|
2141
|
+
Content, for example plain text in XML or markup documents.
|
|
2142
|
+
*/
|
|
2143
|
+
content: J,
|
|
2144
|
+
/**
|
|
2145
|
+
[Content](#highlight.tags.content) that represents a heading.
|
|
2146
|
+
*/
|
|
2147
|
+
heading: ee,
|
|
2148
|
+
/**
|
|
2149
|
+
A level 1 [heading](#highlight.tags.heading).
|
|
2150
|
+
*/
|
|
2151
|
+
heading1: f(ee),
|
|
2152
|
+
/**
|
|
2153
|
+
A level 2 [heading](#highlight.tags.heading).
|
|
2154
|
+
*/
|
|
2155
|
+
heading2: f(ee),
|
|
2156
|
+
/**
|
|
2157
|
+
A level 3 [heading](#highlight.tags.heading).
|
|
2158
|
+
*/
|
|
2159
|
+
heading3: f(ee),
|
|
2160
|
+
/**
|
|
2161
|
+
A level 4 [heading](#highlight.tags.heading).
|
|
2162
|
+
*/
|
|
2163
|
+
heading4: f(ee),
|
|
2164
|
+
/**
|
|
2165
|
+
A level 5 [heading](#highlight.tags.heading).
|
|
2166
|
+
*/
|
|
2167
|
+
heading5: f(ee),
|
|
2168
|
+
/**
|
|
2169
|
+
A level 6 [heading](#highlight.tags.heading).
|
|
2170
|
+
*/
|
|
2171
|
+
heading6: f(ee),
|
|
2172
|
+
/**
|
|
2173
|
+
A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
|
|
2174
|
+
*/
|
|
2175
|
+
contentSeparator: f(J),
|
|
2176
|
+
/**
|
|
2177
|
+
[Content](#highlight.tags.content) that represents a list.
|
|
2178
|
+
*/
|
|
2179
|
+
list: f(J),
|
|
2180
|
+
/**
|
|
2181
|
+
[Content](#highlight.tags.content) that represents a quote.
|
|
2182
|
+
*/
|
|
2183
|
+
quote: f(J),
|
|
2184
|
+
/**
|
|
2185
|
+
[Content](#highlight.tags.content) that is emphasized.
|
|
2186
|
+
*/
|
|
2187
|
+
emphasis: f(J),
|
|
2188
|
+
/**
|
|
2189
|
+
[Content](#highlight.tags.content) that is styled strong.
|
|
2190
|
+
*/
|
|
2191
|
+
strong: f(J),
|
|
2192
|
+
/**
|
|
2193
|
+
[Content](#highlight.tags.content) that is part of a link.
|
|
2194
|
+
*/
|
|
2195
|
+
link: f(J),
|
|
2196
|
+
/**
|
|
2197
|
+
[Content](#highlight.tags.content) that is styled as code or
|
|
2198
|
+
monospace.
|
|
2199
|
+
*/
|
|
2200
|
+
monospace: f(J),
|
|
2201
|
+
/**
|
|
2202
|
+
[Content](#highlight.tags.content) that has a strike-through
|
|
2203
|
+
style.
|
|
2204
|
+
*/
|
|
2205
|
+
strikethrough: f(J),
|
|
2206
|
+
/**
|
|
2207
|
+
Inserted text in a change-tracking format.
|
|
2208
|
+
*/
|
|
2209
|
+
inserted: f(),
|
|
2210
|
+
/**
|
|
2211
|
+
Deleted text.
|
|
2212
|
+
*/
|
|
2213
|
+
deleted: f(),
|
|
2214
|
+
/**
|
|
2215
|
+
Changed text.
|
|
2216
|
+
*/
|
|
2217
|
+
changed: f(),
|
|
2218
|
+
/**
|
|
2219
|
+
An invalid or unsyntactic element.
|
|
2220
|
+
*/
|
|
2221
|
+
invalid: f(),
|
|
2222
|
+
/**
|
|
2223
|
+
Metadata or meta-instruction.
|
|
2224
|
+
*/
|
|
2225
|
+
meta: ce,
|
|
2226
|
+
/**
|
|
2227
|
+
[Metadata](#highlight.tags.meta) that applies to the entire
|
|
2228
|
+
document.
|
|
2229
|
+
*/
|
|
2230
|
+
documentMeta: f(ce),
|
|
2231
|
+
/**
|
|
2232
|
+
[Metadata](#highlight.tags.meta) that annotates or adds
|
|
2233
|
+
attributes to a given syntactic element.
|
|
2234
|
+
*/
|
|
2235
|
+
annotation: f(ce),
|
|
2236
|
+
/**
|
|
2237
|
+
Processing instruction or preprocessor directive. Subtag of
|
|
2238
|
+
[meta](#highlight.tags.meta).
|
|
2239
|
+
*/
|
|
2240
|
+
processingInstruction: f(ce),
|
|
2241
|
+
/**
|
|
2242
|
+
[Modifier](#highlight.Tag^defineModifier) that indicates that a
|
|
2243
|
+
given element is being defined. Expected to be used with the
|
|
2244
|
+
various [name](#highlight.tags.name) tags.
|
|
2245
|
+
*/
|
|
2246
|
+
definition: j.defineModifier("definition"),
|
|
2247
|
+
/**
|
|
2248
|
+
[Modifier](#highlight.Tag^defineModifier) that indicates that
|
|
2249
|
+
something is constant. Mostly expected to be used with
|
|
2250
|
+
[variable names](#highlight.tags.variableName).
|
|
2251
|
+
*/
|
|
2252
|
+
constant: j.defineModifier("constant"),
|
|
2253
|
+
/**
|
|
2254
|
+
[Modifier](#highlight.Tag^defineModifier) used to indicate that
|
|
2255
|
+
a [variable](#highlight.tags.variableName) or [property
|
|
2256
|
+
name](#highlight.tags.propertyName) is being called or defined
|
|
2257
|
+
as a function.
|
|
2258
|
+
*/
|
|
2259
|
+
function: j.defineModifier("function"),
|
|
2260
|
+
/**
|
|
2261
|
+
[Modifier](#highlight.Tag^defineModifier) that can be applied to
|
|
2262
|
+
[names](#highlight.tags.name) to indicate that they belong to
|
|
2263
|
+
the language's standard environment.
|
|
2264
|
+
*/
|
|
2265
|
+
standard: j.defineModifier("standard"),
|
|
2266
|
+
/**
|
|
2267
|
+
[Modifier](#highlight.Tag^defineModifier) that indicates a given
|
|
2268
|
+
[names](#highlight.tags.name) is local to some scope.
|
|
2269
|
+
*/
|
|
2270
|
+
local: j.defineModifier("local"),
|
|
2271
|
+
/**
|
|
2272
|
+
A generic variant [modifier](#highlight.Tag^defineModifier) that
|
|
2273
|
+
can be used to tag language-specific alternative variants of
|
|
2274
|
+
some common tag. It is recommended for themes to define special
|
|
2275
|
+
forms of at least the [string](#highlight.tags.string) and
|
|
2276
|
+
[variable name](#highlight.tags.variableName) tags, since those
|
|
2277
|
+
come up a lot.
|
|
2278
|
+
*/
|
|
2279
|
+
special: j.defineModifier("special")
|
|
2280
|
+
};
|
|
2281
|
+
for (let l in y) {
|
|
2282
|
+
let e = y[l];
|
|
2283
|
+
e instanceof j && (e.name = l);
|
|
2284
|
+
}
|
|
2285
|
+
const pt = We([
|
|
2286
|
+
{ tag: y.link, class: "tok-link" },
|
|
2287
|
+
{ tag: y.heading, class: "tok-heading" },
|
|
2288
|
+
{ tag: y.emphasis, class: "tok-emphasis" },
|
|
2289
|
+
{ tag: y.strong, class: "tok-strong" },
|
|
2290
|
+
{ tag: y.keyword, class: "tok-keyword" },
|
|
2291
|
+
{ tag: y.atom, class: "tok-atom" },
|
|
2292
|
+
{ tag: y.bool, class: "tok-bool" },
|
|
2293
|
+
{ tag: y.url, class: "tok-url" },
|
|
2294
|
+
{ tag: y.labelName, class: "tok-labelName" },
|
|
2295
|
+
{ tag: y.inserted, class: "tok-inserted" },
|
|
2296
|
+
{ tag: y.deleted, class: "tok-deleted" },
|
|
2297
|
+
{ tag: y.literal, class: "tok-literal" },
|
|
2298
|
+
{ tag: y.string, class: "tok-string" },
|
|
2299
|
+
{ tag: y.number, class: "tok-number" },
|
|
2300
|
+
{ tag: [y.regexp, y.escape, y.special(y.string)], class: "tok-string2" },
|
|
2301
|
+
{ tag: y.variableName, class: "tok-variableName" },
|
|
2302
|
+
{ tag: y.local(y.variableName), class: "tok-variableName tok-local" },
|
|
2303
|
+
{ tag: y.definition(y.variableName), class: "tok-variableName tok-definition" },
|
|
2304
|
+
{ tag: y.special(y.variableName), class: "tok-variableName2" },
|
|
2305
|
+
{ tag: y.definition(y.propertyName), class: "tok-propertyName tok-definition" },
|
|
2306
|
+
{ tag: y.typeName, class: "tok-typeName" },
|
|
2307
|
+
{ tag: y.namespace, class: "tok-namespace" },
|
|
2308
|
+
{ tag: y.className, class: "tok-className" },
|
|
2309
|
+
{ tag: y.macroName, class: "tok-macroName" },
|
|
2310
|
+
{ tag: y.propertyName, class: "tok-propertyName" },
|
|
2311
|
+
{ tag: y.operator, class: "tok-operator" },
|
|
2312
|
+
{ tag: y.comment, class: "tok-comment" },
|
|
2313
|
+
{ tag: y.meta, class: "tok-meta" },
|
|
2314
|
+
{ tag: y.invalid, class: "tok-invalid" },
|
|
2315
|
+
{ tag: y.punctuation, class: "tok-punctuation" }
|
|
2316
|
+
]), yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2317
|
+
__proto__: null,
|
|
2318
|
+
Tag: j,
|
|
2319
|
+
classHighlighter: pt,
|
|
2320
|
+
getStyleTags: qe,
|
|
2321
|
+
highlightCode: ht,
|
|
2322
|
+
highlightTree: Ue,
|
|
2323
|
+
styleTags: at,
|
|
2324
|
+
tagHighlighter: We,
|
|
2325
|
+
tags: y
|
|
2326
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2327
|
+
export {
|
|
2328
|
+
ct as D,
|
|
2329
|
+
v as I,
|
|
2330
|
+
A as N,
|
|
2331
|
+
gt as P,
|
|
2332
|
+
j as T,
|
|
2333
|
+
L as a,
|
|
2334
|
+
je as b,
|
|
2335
|
+
R as c,
|
|
2336
|
+
dt as d,
|
|
2337
|
+
We as e,
|
|
2338
|
+
le as f,
|
|
2339
|
+
Ue as h,
|
|
2340
|
+
yt as i,
|
|
2341
|
+
mt as p,
|
|
2342
|
+
at as s,
|
|
2343
|
+
y as t
|
|
2344
|
+
};
|