@remarkablejames/editor 0.0.1 → 0.0.3
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/lib/{ActionMenuButton-B0EHT9CC.js → ActionMenuButton-D5HLfRzv.js} +1 -1
- package/lib/{ActionMenuButton-J1el_e6Z.cjs → ActionMenuButton-DN6VHLkp.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +5 -5
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +1 -1
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +1 -1
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +1 -1
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +2 -2
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +1 -1
- package/lib/CodeBlock.cjs +1 -44
- package/lib/CodeBlock.js +181 -3857
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +2 -2
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +1 -1
- package/lib/{Drawer-BCWVN-4l.js → Drawer-B9l1SoRJ.js} +21 -21
- package/lib/{Drawer-BTouEroZ.cjs → Drawer-BN0lYcnJ.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +2 -2
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +12 -12
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +3 -3
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +3 -3
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +3 -3
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +2 -2
- package/lib/History.cjs +1 -1
- package/lib/History.js +1 -1
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +1 -1
- package/lib/{Iframe-BfBLILDA.cjs → Iframe-CXFk3GEq.cjs} +1 -1
- package/lib/{Iframe-BdgiWGml.js → Iframe-MjeJ2OOI.js} +9 -9
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +1 -1
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +22 -22
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +1 -1
- package/lib/{Indent-Dvqz_WEn.cjs → Indent-BPX9XRos.cjs} +1 -1
- package/lib/{Indent-BpMcZKok.js → Indent-CgwDItIf.js} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +1 -1
- package/lib/{Katex-B8_uprkO.js → Katex-CZ4g3vA9.js} +2 -2
- package/lib/{Katex-BQyeCeQ0.cjs → Katex-DIgsR_dS.cjs} +1 -1
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +1 -1
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +2 -2
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-CIshn_8F.cjs → LinkEditBlock-B2bU0Mcr.cjs} +1 -1
- package/lib/{LinkEditBlock-BX0fXXpF.js → LinkEditBlock-CaDV3Vq5.js} +2 -2
- package/lib/{Mermaid-0GiGVxn0.cjs → Mermaid-B9h7XKFo.cjs} +1 -1
- package/lib/{Mermaid-D8bbIgAl.js → Mermaid-EhYj_ICn.js} +2 -2
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +1 -1
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +1 -1
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +2 -2
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +2 -2
- package/lib/{SlashCommandNodeView-rDJ7OjRd.cjs → SlashCommandNodeView-COlWSlnE.cjs} +1 -1
- package/lib/{SlashCommandNodeView-BcmtKbEE.js → SlashCommandNodeView-CY3peX5x.js} +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-DbxuP5xh.js → Table-Bw7rLue7.js} +2 -2
- package/lib/{Table-BEhNBeuA.cjs → Table-DLrtX6T7.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +1 -1
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +2 -2
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +1 -1
- package/lib/{Twitter-BuEBgpi9.cjs → Twitter-Ck6vGefg.cjs} +1 -1
- package/lib/{Twitter-9I6BLNmg.js → Twitter-pM0y5Z-L.js} +2 -2
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +1 -1
- package/lib/bubble.cjs +1 -1
- package/lib/bubble.js +103 -103
- package/lib/{dropdown-menu-DjWlG2-J.cjs → dropdown-menu-DwR8tTs9.cjs} +1 -1
- package/lib/{dropdown-menu-Bs69ZBbO.js → dropdown-menu-nX-u8e2w.js} +1 -1
- package/lib/extensions/CodeBlock/CodeBlock.d.ts +1 -1
- package/lib/extensions/Image/Image.d.ts +11 -0
- package/lib/extensions/Image/components/ImageCropper.d.ts +1 -1
- package/lib/index-Dib4cXXf.cjs +10 -0
- package/lib/{index-lj3VWExo.js → index-_WrFM-Fk.js} +1289 -1118
- package/lib/index.cjs +1 -1
- package/lib/index.js +1 -1
- package/lib/{popover-D-hUKDYu.cjs → popover-BY7j9SiD.cjs} +1 -1
- package/lib/{popover-CPr9bHYn.js → popover-CSvY4C-l.js} +1 -1
- package/lib/{select-CuE_HaQJ.js → select-BelNLNvT.js} +1 -1
- package/lib/{select-C2KF4RNg.cjs → select-Bu-5iIA9.cjs} +1 -1
- package/lib/{separator-CHzYNMVt.js → separator-Br5kcIJa.js} +2 -2
- package/lib/{separator-_gvUNba_.cjs → separator-Cp9Lg3HU.cjs} +1 -1
- package/lib/style.css +1 -1
- package/lib/{textarea-gEoNp9CA.js → textarea-Ceev4t42.js} +1 -1
- package/lib/{textarea-DZj6EY-N.cjs → textarea-DfqvYaA6.cjs} +1 -1
- package/lib/theme/theme.d.ts +1 -1
- package/package.json +1 -1
- package/lib/index-D9oM__YW.cjs +0 -1
package/lib/CodeBlock.js
CHANGED
|
@@ -1,3760 +1,84 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { u as
|
|
4
|
-
import { useRef as
|
|
1
|
+
import { h as L, j as h, N as M, t as k, k as W, m as j } from "./clsx-CDyrfCnw.js";
|
|
2
|
+
import { jsx as r, Fragment as R, jsxs as f } from "react/jsx-runtime";
|
|
3
|
+
import { u as H, d as V, A as P, w as F, I as u } from "./index-_WrFM-Fk.js";
|
|
4
|
+
import { useRef as y, useCallback as v, useEffect as A } from "react";
|
|
5
5
|
import "./theme.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import { createEditor as O } from "prism-code-editor-lightweight";
|
|
7
|
+
import { defaultCommands as _, editHistory as J } from "prism-code-editor-lightweight/commands";
|
|
8
|
+
import { cursorPosition as q } from "prism-code-editor-lightweight/cursor";
|
|
9
|
+
import { indentGuides as D } from "prism-code-editor-lightweight/guides";
|
|
10
|
+
import { highlightBracketPairs as G } from "prism-code-editor-lightweight/highlight-brackets";
|
|
11
|
+
import { matchBrackets as U } from "prism-code-editor-lightweight/match-brackets";
|
|
12
|
+
import { matchTags as $ } from "prism-code-editor-lightweight/match-tags";
|
|
13
|
+
import { S as w, a as S, b as K, c as T, d as E } from "./select-BelNLNvT.js";
|
|
14
|
+
import { d as Q } from "./delete-node-eQHsyyhR.js";
|
|
15
|
+
import "prism-code-editor-lightweight/prism/languages/bash";
|
|
16
|
+
import "prism-code-editor-lightweight/prism/languages/css";
|
|
17
|
+
import "prism-code-editor-lightweight/prism/languages/css-extras";
|
|
18
|
+
import "prism-code-editor-lightweight/prism/languages/ini";
|
|
19
|
+
import "prism-code-editor-lightweight/prism/languages/kotlin";
|
|
20
|
+
import "prism-code-editor-lightweight/prism/languages/xml";
|
|
21
|
+
import "prism-code-editor-lightweight/prism/languages/markup";
|
|
22
|
+
import "prism-code-editor-lightweight/prism/languages/r";
|
|
23
|
+
import "prism-code-editor-lightweight/prism/languages/basic";
|
|
24
|
+
import "prism-code-editor-lightweight/prism/languages/vbnet";
|
|
25
|
+
import "prism-code-editor-lightweight/prism/languages/c";
|
|
26
|
+
import "prism-code-editor-lightweight/prism/languages/opencl";
|
|
27
|
+
import "prism-code-editor-lightweight/prism/languages/diff";
|
|
28
|
+
import "prism-code-editor-lightweight/prism/languages/java";
|
|
29
|
+
import "prism-code-editor-lightweight/prism/languages/less";
|
|
30
|
+
import "prism-code-editor-lightweight/prism/languages/objectivec";
|
|
31
|
+
import "prism-code-editor-lightweight/prism/languages/ruby";
|
|
32
|
+
import "prism-code-editor-lightweight/prism/languages/sql";
|
|
33
|
+
import "prism-code-editor-lightweight/prism/languages/wasm";
|
|
34
|
+
import "prism-code-editor-lightweight/prism/languages/cpp";
|
|
35
|
+
import "prism-code-editor-lightweight/prism/languages/go";
|
|
36
|
+
import "prism-code-editor-lightweight/prism/languages/javascript";
|
|
37
|
+
import "prism-code-editor-lightweight/prism/languages/js-templates";
|
|
38
|
+
import "prism-code-editor-lightweight/prism/languages/jsx";
|
|
39
|
+
import "prism-code-editor-lightweight/prism/languages/lua";
|
|
40
|
+
import "prism-code-editor-lightweight/prism/languages/perl";
|
|
41
|
+
import "prism-code-editor-lightweight/prism/languages/python";
|
|
42
|
+
import "prism-code-editor-lightweight/prism/languages/rust";
|
|
43
|
+
import "prism-code-editor-lightweight/prism/languages/swift";
|
|
44
|
+
import "prism-code-editor-lightweight/prism/languages/clike";
|
|
45
|
+
import "prism-code-editor-lightweight/prism/languages/csharp";
|
|
46
|
+
import "prism-code-editor-lightweight/prism/languages/graphql";
|
|
47
|
+
import "prism-code-editor-lightweight/prism/languages/json";
|
|
48
|
+
import "prism-code-editor-lightweight/prism/languages/makefile";
|
|
49
|
+
import "prism-code-editor-lightweight/prism/languages/scss";
|
|
50
|
+
import "prism-code-editor-lightweight/prism/languages/typescript";
|
|
51
|
+
import "prism-code-editor-lightweight/prism/languages/tsx";
|
|
52
|
+
import "prism-code-editor-lightweight/prism/languages/yaml";
|
|
53
|
+
import "prism-code-editor-lightweight/prism/languages/regex";
|
|
54
|
+
import "prism-code-editor-lightweight/prism/languages/php";
|
|
55
|
+
import "prism-code-editor-lightweight/prism/languages/markdown";
|
|
56
|
+
function at() {
|
|
57
|
+
const e = H(B.name), {
|
|
58
|
+
icon: i = void 0,
|
|
11
59
|
tooltip: n = void 0,
|
|
12
60
|
tooltipOptions: s = {},
|
|
13
|
-
action:
|
|
14
|
-
isActive:
|
|
15
|
-
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState:
|
|
16
|
-
|
|
61
|
+
action: o = void 0,
|
|
62
|
+
isActive: d = void 0
|
|
63
|
+
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update: b } = V(d), p = () => {
|
|
64
|
+
m || o && (o(), b());
|
|
17
65
|
};
|
|
18
|
-
return e ? /* @__PURE__ */
|
|
19
|
-
|
|
66
|
+
return e ? /* @__PURE__ */ r(
|
|
67
|
+
P,
|
|
20
68
|
{
|
|
21
|
-
action:
|
|
22
|
-
dataState:
|
|
23
|
-
disabled:
|
|
24
|
-
icon:
|
|
69
|
+
action: p,
|
|
70
|
+
dataState: c,
|
|
71
|
+
disabled: m,
|
|
72
|
+
icon: i,
|
|
25
73
|
tooltip: n,
|
|
26
74
|
tooltipOptions: s
|
|
27
75
|
}
|
|
28
|
-
) : /* @__PURE__ */
|
|
76
|
+
) : /* @__PURE__ */ r(R, {});
|
|
29
77
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
txt: xe
|
|
35
|
-
}, ke = (e, t) => (t[J] || Se)(e, t), Se = (e, t) => {
|
|
36
|
-
for (var n = [e], s, l = [], u = 0; s = St(t[j]); )
|
|
37
|
-
delete t[j], Object.assign(t, s);
|
|
38
|
-
for (xn(e, t, n, 0); l[u++] = n[0], n = n[1]; ) ;
|
|
39
|
-
return l;
|
|
40
|
-
}, zt = "</span>", Oe = "", ye = "", Sn = (e) => {
|
|
41
|
-
for (var t = "", n = e.length, s = 0; s < n; ) t += Tn(e[s++]);
|
|
42
|
-
return t;
|
|
43
|
-
}, Tn = (e) => {
|
|
44
|
-
if (e instanceof ue) {
|
|
45
|
-
var { type: t, alias: n, content: s } = e, l = Oe, u = ye, f = `<span class="token ${t + (n ? " " + n : "") + (t == "keyword" && typeof s == "string" ? " keyword-" + s : "")}">`;
|
|
46
|
-
ye += zt, Oe += f;
|
|
47
|
-
var E = Tn(s);
|
|
48
|
-
return Oe = l, ye = u, f + E + zt;
|
|
49
|
-
}
|
|
50
|
-
return typeof e != "string" ? Sn(e) : (e = e.replace(/&/g, "&").replace(/</g, "<"), ye && e.includes(`
|
|
51
|
-
`) ? e.replace(/\n/g, ye + `
|
|
52
|
-
` + Oe) : e);
|
|
53
|
-
}, xn = (e, t, n, s, l) => {
|
|
54
|
-
for (var u in t)
|
|
55
|
-
if (t[u]) for (var f = 0, E = t[u], y = Array.isArray(E) ? E : [E]; f < y.length; ++f) {
|
|
56
|
-
if (l && l[0] == u && l[1] == f)
|
|
57
|
-
return;
|
|
58
|
-
for (var v = y[f], m = v.pattern || v, p = St(v.inside), c = v.lookbehind, b = v.greedy && m.global, g = v.alias, a = n, r = s; a && (!l || r < l[2]); r += a[0].length, a = a[1]) {
|
|
59
|
-
var d = a[0], o = 0, i, h;
|
|
60
|
-
if (!(d instanceof ue)) {
|
|
61
|
-
if (m.lastIndex = b ? r : 0, i = m.exec(b ? e : d), i && c && i[1] && (h = i[1].length, i.index += h, i[0] = i[0].slice(h)), b) {
|
|
62
|
-
if (!i)
|
|
63
|
-
break;
|
|
64
|
-
if (i[0]) {
|
|
65
|
-
for (var S = i.index, k = S + i[0].length, I; S >= r + (I = a[0].length); a = a[1], r += I) ;
|
|
66
|
-
if (a[0] instanceof ue)
|
|
67
|
-
continue;
|
|
68
|
-
for (var w = a, E = r; (E += w[0].length) < k; w = w[1], o++) ;
|
|
69
|
-
d = e.slice(r, E), i.index -= r;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (i && i[0]) {
|
|
73
|
-
for (var S = i.index, x = i[0], T = d.slice(S + x.length), N = r + d.length, P = new ue(u, p ? ke(x, p) : x, x, g), M = a, V = 0, z; M = M[1], V++ < o; ) ;
|
|
74
|
-
T && (!M || M[0] instanceof ue ? M = [T, M] : M[0] = T + M[0]), r += S, a[0] = S ? d.slice(0, S) : P, S ? a = a[1] = [P, M] : a[1] = M, o && (xn(e, t, a, r, z = [u, f, N]), N = z[2]), l && N > l[2] && (l[2] = N);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
function ue(e, t, n, s) {
|
|
81
|
-
this.type = e, this.content = t, this.alias = s, this.length = n.length;
|
|
82
|
-
}
|
|
83
|
-
const pa = (e, t, ...n) => {
|
|
84
|
-
var Y;
|
|
85
|
-
let s, l, u = [], f, E = "", y, v = !1, m = !1, p = !0, c = [], b, g = 0;
|
|
86
|
-
const a = fa(), r = a.firstChild, d = r.children, o = d[0], i = o.firstChild, h = { language: "text", value: E }, k = new Set(n), I = {}, w = (A) => {
|
|
87
|
-
if (Object.assign(h, A), E = A.value ?? E, s = h.language, !_[s]) throw Error(`Language '${s}' has no grammar.`);
|
|
88
|
-
b = !!h.readOnly, a.style.tabSize = h.tabSize || 2, i.inputMode = b ? "none" : "", i.setAttribute("aria-readonly", b), T(), x(), (l != (l = _[s]) || E != i.value) && (V(), i.value = E, i.selectionEnd = 0, S());
|
|
89
|
-
}, S = () => {
|
|
90
|
-
c = ke(E = i.value, l), z("tokenize", c, s, E);
|
|
91
|
-
let A = Sn(c).split(`
|
|
92
|
-
`), R = 0, L = g, Z = g = A.length;
|
|
93
|
-
for (; A[R] == u[R] && R < Z; ) ++R;
|
|
94
|
-
for (; Z && A[--Z] == u[--L]; ) ;
|
|
95
|
-
if (R == Z && R == L) d[R + 1].innerHTML = A[R] + `
|
|
96
|
-
`;
|
|
97
|
-
else {
|
|
98
|
-
let X = L < R ? L : R - 1, K = X, _e = "";
|
|
99
|
-
for (; K < Z; ) _e += `<div class=pce-line aria-hidden=true>${A[++K]}
|
|
100
|
-
</div>`;
|
|
101
|
-
for (K = Z < R ? Z : R - 1; K < L; K++) d[R + 1].remove();
|
|
102
|
-
for (_e && d[X + 1].insertAdjacentHTML("afterend", _e), K = X + 1; K < g; ) d[++K].setAttribute("data-line", K);
|
|
103
|
-
a.style.setProperty(
|
|
104
|
-
"--number-width",
|
|
105
|
-
Math.ceil(Math.log10(g + 1)) + ".001ch"
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
z("update", E), U(!0), p && setTimeout(setTimeout, 0, () => p = !0), u = A, p = !1;
|
|
109
|
-
}, x = (A) => {
|
|
110
|
-
(A || k).forEach((R) => {
|
|
111
|
-
typeof R == "object" ? (R.update(D, h), A && k.add(R)) : (R(D, h), A || k.delete(R));
|
|
112
|
-
});
|
|
113
|
-
}, T = ([A, R] = N()) => {
|
|
114
|
-
a.className = `prism-code-editor language-${s}${h.lineNumbers == !1 ? "" : " show-line-numbers"} pce-${h.wordWrap ? "" : "no"}wrap${h.rtl ? " pce-rtl" : ""} pce-${A < R ? "has" : "no"}-selection${m ? " pce-focus" : ""}${b ? " pce-readonly" : ""}`;
|
|
115
|
-
}, N = () => [
|
|
116
|
-
i.selectionStart,
|
|
117
|
-
i.selectionEnd,
|
|
118
|
-
i.selectionDirection
|
|
119
|
-
], P = {
|
|
120
|
-
Escape() {
|
|
121
|
-
i.blur();
|
|
122
|
-
}
|
|
123
|
-
}, M = {}, V = () => $e && !m && G(
|
|
124
|
-
D,
|
|
125
|
-
"focus",
|
|
126
|
-
(A) => {
|
|
127
|
-
let R = A.relatedTarget;
|
|
128
|
-
R ? R.focus() : i.blur();
|
|
129
|
-
},
|
|
130
|
-
{ once: !0 }
|
|
131
|
-
), z = (A, ...R) => {
|
|
132
|
-
var L, Z;
|
|
133
|
-
(L = I[A]) == null || L.forEach((X) => X.apply(D, R)), (Z = h["on" + A[0].toUpperCase() + A.slice(1)]) == null || Z.apply(D, R);
|
|
134
|
-
}, U = (A) => {
|
|
135
|
-
if (A || p) {
|
|
136
|
-
const R = N(), L = d[y = Nn(E, 0, R[R[2] < "f" ? 0 : 1])];
|
|
137
|
-
L != f && (f == null || f.classList.remove("active-line"), L.classList.add("active-line"), f = L), T(R), z("selectionChange", R, E);
|
|
138
|
-
}
|
|
139
|
-
}, D = {
|
|
140
|
-
scrollContainer: a,
|
|
141
|
-
wrapper: r,
|
|
142
|
-
overlays: o,
|
|
143
|
-
textarea: i,
|
|
144
|
-
get activeLine() {
|
|
145
|
-
return f;
|
|
146
|
-
},
|
|
147
|
-
get activeLineNumber() {
|
|
148
|
-
return y;
|
|
149
|
-
},
|
|
150
|
-
get value() {
|
|
151
|
-
return E;
|
|
152
|
-
},
|
|
153
|
-
options: h,
|
|
154
|
-
get focused() {
|
|
155
|
-
return m;
|
|
156
|
-
},
|
|
157
|
-
get removed() {
|
|
158
|
-
return v;
|
|
159
|
-
},
|
|
160
|
-
get tokens() {
|
|
161
|
-
return c;
|
|
162
|
-
},
|
|
163
|
-
inputCommandMap: M,
|
|
164
|
-
keyCommandMap: P,
|
|
165
|
-
extensions: {},
|
|
166
|
-
setOptions: w,
|
|
167
|
-
update: S,
|
|
168
|
-
getSelection: N,
|
|
169
|
-
setSelection(A, R = A, L) {
|
|
170
|
-
V(), i.setSelectionRange(A, R, L), U(!0);
|
|
171
|
-
},
|
|
172
|
-
addExtensions(...A) {
|
|
173
|
-
x(A);
|
|
174
|
-
},
|
|
175
|
-
addListener(A, R) {
|
|
176
|
-
(I[A] || (I[A] = /* @__PURE__ */ new Set())).add(R);
|
|
177
|
-
},
|
|
178
|
-
removeListener(A, R) {
|
|
179
|
-
var L;
|
|
180
|
-
(L = I[A]) == null || L.delete(R);
|
|
181
|
-
},
|
|
182
|
-
remove() {
|
|
183
|
-
a.remove(), v = !0;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
return G(D, "keydown", (A) => {
|
|
187
|
-
var R;
|
|
188
|
-
(R = P[A.key]) != null && R.call(P, A, N(), E) && B(A);
|
|
189
|
-
}), G(D, "beforeinput", (A) => {
|
|
190
|
-
var R;
|
|
191
|
-
(b || A.inputType == "insertText" && ((R = M[A.data]) != null && R.call(M, A, N(), E))) && B(A);
|
|
192
|
-
}), G(D, "input", S), G(D, "blur", () => {
|
|
193
|
-
Re = null, m = !1, T();
|
|
194
|
-
}), G(D, "focus", () => {
|
|
195
|
-
Re = U, m = !0, T();
|
|
196
|
-
}), G(D, "selectionchange", (A) => {
|
|
197
|
-
U(), B(A);
|
|
198
|
-
}), (Y = ba(e)) == null || Y.append(a), t && w(t), D;
|
|
199
|
-
}, Ht = /* @__PURE__ */ document.createElement("div"), Ye = (e) => {
|
|
200
|
-
Ht.innerHTML = e;
|
|
201
|
-
const t = Ht.firstChild;
|
|
202
|
-
return () => t.cloneNode(!0);
|
|
203
|
-
}, G = (e, t, n, s) => e.textarea.addEventListener(t, n, s), ba = (e) => typeof e == "string" ? document.querySelector(e) : e, On = navigator.userAgent, Ge = /Mac|iPhone|iPod|iPad/i.test(navigator.platform), ze = /Chrome\//.test(On), $e = !ze && /AppleWebKit\//.test(On), Nn = (e, t = 0, n = 1 / 0) => {
|
|
204
|
-
let s = 1;
|
|
205
|
-
for (; (t = e.indexOf(`
|
|
206
|
-
`, t) + 1) && t <= n; s++) ;
|
|
207
|
-
return s;
|
|
208
|
-
}, at = {}, fa = /* @__PURE__ */ Ye(
|
|
209
|
-
"<div><div class=pce-wrapper><div class=pce-overlays><textarea spellcheck=false autocapitalize=off autocomplete=off>"
|
|
210
|
-
), B = (e) => {
|
|
211
|
-
e.preventDefault(), e.stopImmediatePropagation();
|
|
212
|
-
};
|
|
213
|
-
let Re;
|
|
214
|
-
document.addEventListener("selectionchange", () => Re == null ? void 0 : Re());
|
|
215
|
-
const ga = (e, t, n = 0) => {
|
|
216
|
-
const s = e.scrollContainer.style, l = document.documentElement.style;
|
|
217
|
-
s.scrollPaddingBlock = l.scrollPaddingBlock = `${n}px ${ze && !t.textContent ? t.offsetHeight : 0}px`, t.scrollIntoView({ block: "nearest" }), s.scrollPaddingBlock = l.scrollPaddingBlock = "";
|
|
218
|
-
}, He = (e, t) => t ? e.lastIndexOf(`
|
|
219
|
-
`, t - 1) + 1 : 0, Xe = (e, t) => (t = e.indexOf(`
|
|
220
|
-
`, t)) + 1 ? t : e.length, ma = (e, t, n) => (e.addListener(t, n), () => e.removeListener(t, n)), ha = (e, t) => parseFloat(getComputedStyle(e)[t]);
|
|
221
|
-
let pe;
|
|
222
|
-
const ve = (e) => e.replace(/[$+?|.^*()[\]{}\\]/g, "\\$&"), pt = (e, t) => e.slice(He(e, t), t), ee = (e, t, n = t) => [
|
|
223
|
-
e.slice(t = He(e, t), n = Xe(e, n)).split(`
|
|
224
|
-
`),
|
|
225
|
-
t,
|
|
226
|
-
n
|
|
227
|
-
], Ve = (e, t, n = 0, s = n, l = e.getSelection()[0]) => {
|
|
228
|
-
var m;
|
|
229
|
-
const u = e.value, f = e.wrapper.children[Nn(u, 0, l)], E = document.createTreeWalker(f, 5);
|
|
230
|
-
let y = E.lastChild(), v = Xe(u, l) + 1 - l - y.length;
|
|
231
|
-
for (; -v <= s && (y = E.previousNode()); )
|
|
232
|
-
if (!y.lastChild && (v -= y.length || 0, v <= n)) {
|
|
233
|
-
for (; y != f; y = y.parentNode)
|
|
234
|
-
if ((m = y.matches) != null && m.call(y, t)) return y;
|
|
235
|
-
}
|
|
236
|
-
}, rt = (e, t) => {
|
|
237
|
-
var n;
|
|
238
|
-
return ((n = Ve(e, '[class*="language-"]', 0, 0, t)) == null ? void 0 : n.className.match(
|
|
239
|
-
/language-(\S*)/
|
|
240
|
-
)[1]) || e.options.language;
|
|
241
|
-
}, H = (e, t, n, s, l, u) => {
|
|
242
|
-
if (e.options.readOnly) return;
|
|
243
|
-
pe = e.getSelection(), s ?? (s = n);
|
|
244
|
-
let f = e.textarea, E = e.value, y = ze && !E[s ?? pe[1]] && /\n$/.test(t) && /^$|\n$/.test(E), v;
|
|
245
|
-
e.focused || f.focus(), n != null && f.setSelectionRange(n, s), l != null && (v = ma(e, "update", () => {
|
|
246
|
-
f.setSelectionRange(
|
|
247
|
-
l,
|
|
248
|
-
u ?? l,
|
|
249
|
-
pe[2]
|
|
250
|
-
), v();
|
|
251
|
-
})), $e || f.dispatchEvent(new InputEvent("beforeinput", { data: t })), ze || $e ? (y && (f.selectionEnd--, t = t.slice(0, -1)), $e && (t += `
|
|
252
|
-
`), document.execCommand(
|
|
253
|
-
t ? "insertHTML" : "delete",
|
|
254
|
-
!1,
|
|
255
|
-
t.replace(/&/g, "&").replace(/</g, "<")
|
|
256
|
-
), y && f.selectionStart++) : document.execCommand(t ? "insertText" : "delete", !1, t), pe = 0;
|
|
257
|
-
}, Ae = (e) => e.altKey + e.ctrlKey * 2 + e.metaKey * 4 + e.shiftKey * 8;
|
|
258
|
-
let bt = !1;
|
|
259
|
-
const Vt = navigator.clipboard, oe = Ge ? 4 : 2, _a = (e) => bt = e, ie = (e) => e.search(/\S|$/), Ea = (e = ['""', "''", "``", "()", "[]", "{}"], t = /([^$\w'"`]["'`]|.[[({])[.,:;\])}>\s]|.[[({]`/s) => (n, s) => {
|
|
260
|
-
let l;
|
|
261
|
-
const { keyCommandMap: u, inputCommandMap: f, getSelection: E, scrollContainer: y } = n, v = ({ insertSpaces: a = !0, tabSize: r } = s) => [a ? " " : " ", a ? r || 2 : 1], m = () => {
|
|
262
|
-
var a;
|
|
263
|
-
return !s.readOnly && !((a = n.extensions.cursor) != null && a.scrollIntoView());
|
|
264
|
-
}, p = ([a, r], [d, o], i, h) => (a < r || !h && t.test((i[r - 1] || " ") + d + (i[r] || " "))) && !H(n, d + i.slice(a, r) + o, null, null, a + 1, r + 1), c = ([a, r], d, o) => a == r && o[r] == d && !n.setSelection(a + 1), b = (a, r, d, o, i, h) => {
|
|
265
|
-
let k = r.join(`
|
|
266
|
-
`);
|
|
267
|
-
if (k != a.join(`
|
|
268
|
-
`)) {
|
|
269
|
-
const I = a.length - 1, w = r[I], S = a[I], x = S.length - w.length, T = r[0].length - a[0].length, N = d + ie((T < 0 ? r : a)[0]), P = o - S.length + ie(x > 0 ? w : S), M = d - o + k.length + x, V = N > i ? i : Math.max(N, i + T), z = h + d - o + k.length;
|
|
270
|
-
H(
|
|
271
|
-
n,
|
|
272
|
-
k,
|
|
273
|
-
d,
|
|
274
|
-
o,
|
|
275
|
-
V,
|
|
276
|
-
h < P ? z + x : Math.max(P + M, z)
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
}, g = (a, r, d, o, i, h, k, I) => {
|
|
280
|
-
b(
|
|
281
|
-
r,
|
|
282
|
-
r.map(
|
|
283
|
-
a ? (w) => w.slice(ie(w) ? I - ie(w) % I : 0) : (w) => w && k.repeat(I - ie(w) % I) + w
|
|
284
|
-
),
|
|
285
|
-
d,
|
|
286
|
-
o,
|
|
287
|
-
i,
|
|
288
|
-
h
|
|
289
|
-
);
|
|
290
|
-
};
|
|
291
|
-
f["<"] = (a, r, d) => p(r, "<>", d, !0), e.forEach(([a, r]) => {
|
|
292
|
-
const d = a == r;
|
|
293
|
-
f[a] = (o, i, h) => (d && c(i, r, h) || p(i, a + r, h)) && m(), d || (f[r] = (o, i, h) => c(i, r, h) && m());
|
|
294
|
-
}), f[">"] = (a, r, d) => {
|
|
295
|
-
var i, h;
|
|
296
|
-
const o = (h = (i = at[rt(n)]) == null ? void 0 : i.autoCloseTags) == null ? void 0 : h.call(i, r, d, n);
|
|
297
|
-
o && (H(n, ">" + o, null, null, r[0] + 1), B(a));
|
|
298
|
-
}, u.Tab = (a, [r, d], o) => {
|
|
299
|
-
if (bt || s.readOnly || Ae(a) & 6) return;
|
|
300
|
-
const [i, h] = v(s), k = a.shiftKey, [I, w, S] = ee(o, r, d);
|
|
301
|
-
return r < d || k ? g(k, I, w, S, r, d, i, h) : H(n, i.repeat(h - (r - w) % h)), m();
|
|
302
|
-
}, u.Enter = (a, r, d) => {
|
|
303
|
-
var i, h, k;
|
|
304
|
-
const o = Ae(a) & 7;
|
|
305
|
-
if (!o || o == oe) {
|
|
306
|
-
o && (r[0] = r[1] = ee(d, r[1])[2]);
|
|
307
|
-
const [I, w] = v(), [S, x] = r, T = (i = at[rt(n)]) == null ? void 0 : i.autoIndent, N = Math.floor(ie(pt(d, S)) / w) * w, P = (h = T == null ? void 0 : T[0]) != null && h.call(T, r, d, n) ? w : 0, M = (k = T == null ? void 0 : T[1]) == null ? void 0 : k.call(T, r, d, n), V = `
|
|
308
|
-
` + I.repeat(N + P) + (M ? `
|
|
309
|
-
` + I.repeat(N) : "");
|
|
310
|
-
if (V[1] || d[x])
|
|
311
|
-
return H(n, V, S, x, S + N + P + 1), m();
|
|
312
|
-
}
|
|
313
|
-
}, u.Backspace = (a, [r, d], o) => {
|
|
314
|
-
if (r == d) {
|
|
315
|
-
const i = pt(o, r), h = s.tabSize || 2, k = e.includes(o.slice(r - 1, r + 1)), I = /[^ ]/.test(i) ? 0 : (i.length - 1) % h + 1;
|
|
316
|
-
if (k || I > 1)
|
|
317
|
-
return H(n, "", r - (k ? 1 : I), r + k), m();
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
for (let a = 0; a < 2; a++)
|
|
321
|
-
u[a ? "ArrowDown" : "ArrowUp"] = (r, [d, o], i) => {
|
|
322
|
-
const h = Ae(r);
|
|
323
|
-
if (h == 1) {
|
|
324
|
-
const k = a ? d : He(i, d) - 1, I = a ? i.indexOf(`
|
|
325
|
-
`, o) + 1 : o;
|
|
326
|
-
if (k > -1 && I > 0) {
|
|
327
|
-
const [w, S, x] = ee(i, k, I), T = w[a ? "pop" : "shift"](), N = (T.length + 1) * (a ? 1 : -1);
|
|
328
|
-
w[a ? "unshift" : "push"](T), H(n, w.join(`
|
|
329
|
-
`), S, x, d + N, o + N);
|
|
330
|
-
}
|
|
331
|
-
return m();
|
|
332
|
-
} else if (h == 9) {
|
|
333
|
-
const [k, I, w] = ee(i, d, o), S = k.join(`
|
|
334
|
-
`), x = a ? S.length + 1 : 0;
|
|
335
|
-
return H(n, S + `
|
|
336
|
-
` + S, I, w, d + x, o + x), m();
|
|
337
|
-
} else if (h == 2 && !Ge)
|
|
338
|
-
return y.scrollBy(0, ha(y, "lineHeight") * (a ? 1 : -1)), !0;
|
|
339
|
-
};
|
|
340
|
-
G(n, "keydown", (a) => {
|
|
341
|
-
var k;
|
|
342
|
-
const r = Ae(a), d = a.keyCode, [o, i, h] = E();
|
|
343
|
-
if (r == oe && (d == 221 || d == 219))
|
|
344
|
-
g(d == 219, ...ee(n.value, o, i), o, i, ...v()), m(), B(a);
|
|
345
|
-
else if (r == (Ge ? 10 : 2) && d == 77)
|
|
346
|
-
_a(!bt), B(a);
|
|
347
|
-
else if (d == 191 && r == oe || d == 65 && r == 9) {
|
|
348
|
-
const I = n.value, w = r == 9, S = w ? o : He(I, o), x = at[rt(n, S)] || {}, { line: T, block: N } = ((k = x.getComments) == null ? void 0 : k.call(x, n, S, I)) || x.comments || {}, [P, M, V] = ee(I, o, i), z = P.length - 1;
|
|
349
|
-
if (w) {
|
|
350
|
-
if (N) {
|
|
351
|
-
const [U, D] = N, Y = I.slice(o, i), A = I.slice(0, o).search(ve(U) + " ?$"), R = RegExp("^ ?" + ve(D)).test(I.slice(i));
|
|
352
|
-
A + 1 && R ? H(
|
|
353
|
-
n,
|
|
354
|
-
Y,
|
|
355
|
-
A,
|
|
356
|
-
i + +(I[i] == " ") + D.length,
|
|
357
|
-
A,
|
|
358
|
-
A + i - o
|
|
359
|
-
) : H(
|
|
360
|
-
n,
|
|
361
|
-
`${U} ${Y} ${D}`,
|
|
362
|
-
o,
|
|
363
|
-
i,
|
|
364
|
-
o + U.length + 1,
|
|
365
|
-
i + U.length + 1
|
|
366
|
-
), m(), B(a);
|
|
367
|
-
}
|
|
368
|
-
} else if (T) {
|
|
369
|
-
const U = ve(T), D = RegExp(`^\\s*(${U} ?|$)`), Y = RegExp(U + " ?"), A = !/\S/.test(I.slice(M, V)), R = P.map(
|
|
370
|
-
P.every((L) => D.test(L)) && !A ? (L) => L.replace(Y, "") : (L) => A || /\S/.test(L) ? L.replace(/^\s*/, `$&${T} `) : L
|
|
371
|
-
);
|
|
372
|
-
b(P, R, M, V, o, i), m(), B(a);
|
|
373
|
-
} else if (N) {
|
|
374
|
-
const [U, D] = N, Y = ie(P[0]), A = P[0].startsWith(U, Y) && P[z].endsWith(D), R = P.slice();
|
|
375
|
-
R[0] = P[0].replace(
|
|
376
|
-
A ? RegExp(ve(U) + " ?") : /(?=\S)|$/,
|
|
377
|
-
A ? "" : U + " "
|
|
378
|
-
);
|
|
379
|
-
let L = R[0].length - P[0].length;
|
|
380
|
-
R[z] = A ? R[z].replace(RegExp(`( ?${ve(D)})?$`), "") : R[z] + " " + D;
|
|
381
|
-
let Z = R.join(`
|
|
382
|
-
`), X = Y + M, K = X > o ? o : Math.max(o + L, X), _e = X > i - (o != i) ? i : Math.min(Math.max(X, i + L), M + Z.length);
|
|
383
|
-
H(n, Z, M, V, K, Math.max(K, _e)), m(), B(a);
|
|
384
|
-
}
|
|
385
|
-
} else if (r == 8 + oe && d == 75) {
|
|
386
|
-
const I = n.value, [w, S, x] = ee(I, o, i), T = h > "f" ? i - x + w.pop().length : o - S, N = Xe(I, x + 1) - x - 1;
|
|
387
|
-
H(
|
|
388
|
-
n,
|
|
389
|
-
"",
|
|
390
|
-
S - !!S,
|
|
391
|
-
x + !S,
|
|
392
|
-
S + Math.min(T, N)
|
|
393
|
-
), m(), B(a);
|
|
394
|
-
}
|
|
395
|
-
}), ["copy", "cut", "paste"].forEach(
|
|
396
|
-
(a) => G(n, a, (r) => {
|
|
397
|
-
const [d, o] = E();
|
|
398
|
-
if (d == o && Vt) {
|
|
399
|
-
const [[i], h, k] = ee(n.value, d, o);
|
|
400
|
-
a == "paste" ? r.clipboardData.getData("text/plain") == l && (H(n, l + `
|
|
401
|
-
`, h, h, d + l.length + 1), m(), B(r)) : (Vt.writeText(l = i), a == "cut" && (H(n, "", h, k + 1), m()), B(r));
|
|
402
|
-
}
|
|
403
|
-
})
|
|
404
|
-
);
|
|
405
|
-
}, ya = (e = 999) => {
|
|
406
|
-
let t = 0, n, s, l = !1, u, f, E, y, v, m;
|
|
407
|
-
const p = [], c = (a) => {
|
|
408
|
-
a >= e && (a--, p.shift()), p.splice(t = a, e, [n.value, m(), m()]);
|
|
409
|
-
}, b = (a) => {
|
|
410
|
-
var r;
|
|
411
|
-
p[a] && (v.value = p[a][0], v.setSelectionRange(...p[a][a < t ? 2 : 1]), n.update(), (r = n.extensions.cursor) == null || r.scrollIntoView(), t = a, s = !1);
|
|
412
|
-
}, g = (a, r) => {
|
|
413
|
-
a.extensions.history = g, n = a, m = a.getSelection, v || c(0), v = a.textarea, a.addListener("selectionChange", () => {
|
|
414
|
-
s = l, l = !1;
|
|
415
|
-
}), G(a, "beforeinput", (d) => {
|
|
416
|
-
let o = d.data, i = d.inputType, h = d.timeStamp;
|
|
417
|
-
/history/.test(i) ? (b(t + (i[7] == "U" ? -1 : 1)), B(d)) : (y = s && (u == i || h - E < 99 && i.slice(-4) == "Drop") && !pe && (o != " " || f == o)) || (p[t][2] = pe || m()), l = !0, f = o, E = h, u = i;
|
|
418
|
-
}), G(a, "input", () => c(t + !y)), G(a, "keydown", (d) => {
|
|
419
|
-
if (!r.readOnly) {
|
|
420
|
-
const o = Ae(d), i = d.keyCode, h = o == oe && i == 90, k = o == oe + 8 && i == 90 || !Ge && o == oe && i == 89;
|
|
421
|
-
h ? (b(t - 1), B(d)) : k && (b(t + 1), B(d));
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
};
|
|
425
|
-
return g.clear = () => {
|
|
426
|
-
c(0), s = !1;
|
|
427
|
-
}, g.has = (a) => t + a in p, g.go = (a) => b(t + a), g;
|
|
428
|
-
}, va = Ye(
|
|
429
|
-
"<div style=position:absolute;top:0;opacity:0;padding:inherit> <span><span></span> "
|
|
430
|
-
), wa = () => {
|
|
431
|
-
let e, t = " ", n = " ";
|
|
432
|
-
const s = va(), [l, u] = s.childNodes, [f, E] = u.childNodes, y = (p) => {
|
|
433
|
-
let { value: c, activeLine: b } = e, g = p[p[2] < "f" ? 0 : 1], a = pt(c, g), r = c.slice(g, Xe(c, g));
|
|
434
|
-
!a && !r && (r = " "), t != a && (l.data = t = a), n != r && (E.data = n = r), s.parentNode != b && b.prepend(s);
|
|
435
|
-
}, v = () => ga(e, f), m = (p) => {
|
|
436
|
-
p.addListener("selectionChange", y), e = p, p.extensions.cursor = m, G(p, "input", (c) => {
|
|
437
|
-
/history/.test(c.inputType) && v();
|
|
438
|
-
}), p.activeLine && y(p.getSelection());
|
|
439
|
-
};
|
|
440
|
-
return m.getPosition = () => {
|
|
441
|
-
const p = f.getBoundingClientRect(), c = e.overlays.getBoundingClientRect();
|
|
442
|
-
return {
|
|
443
|
-
top: p.y - c.y,
|
|
444
|
-
bottom: c.bottom - p.bottom,
|
|
445
|
-
left: p.x - c.x,
|
|
446
|
-
right: c.right - p.x,
|
|
447
|
-
height: p.height
|
|
448
|
-
};
|
|
449
|
-
}, m.scrollIntoView = v, m.element = f, m;
|
|
450
|
-
}, Aa = Ye(
|
|
451
|
-
"<div class=guide-indents style=left:var(--padding-left);bottom:auto;right:auto> "
|
|
452
|
-
), Ia = Ye(
|
|
453
|
-
"<div style=width:1px;position:absolute;background:var(--bg-guide-indent)>"
|
|
454
|
-
), Ra = () => {
|
|
455
|
-
let e, t = 0, n, s = -1, l;
|
|
456
|
-
const u = [], f = [], E = Aa(), y = [], v = (b) => {
|
|
457
|
-
n = [];
|
|
458
|
-
const g = p(b.split(`
|
|
459
|
-
`)), a = g.length;
|
|
460
|
-
for (let r = 0, d = [], o = g[0]; o; r++) {
|
|
461
|
-
const i = (u[r] || (u[r] = Ia())).style, [h, k, I] = o, w = f[r];
|
|
462
|
-
o = g[r + 1], h != (w == null ? void 0 : w[0]) && (i.top = h + "00%"), k != (w == null ? void 0 : w[1]) && (i.height = k + "00%"), I != (w == null ? void 0 : w[2]) && (i.left = I * 100 + "%");
|
|
463
|
-
const S = d[0] != h && (o == null ? void 0 : o[0]) != h, x = d[0] + d[1] != h + k && (o == null ? void 0 : o[0]) + (o == null ? void 0 : o[1]) != h + k;
|
|
464
|
-
for (let T = -S, N = k + x; T < N; T++)
|
|
465
|
-
n[T + h] = r;
|
|
466
|
-
d = f[r] = g[r];
|
|
467
|
-
}
|
|
468
|
-
for (let r = t; r > a; ) u[--r].remove();
|
|
469
|
-
E.append(...u.slice(t, t = a));
|
|
470
|
-
}, m = () => {
|
|
471
|
-
const b = n[l.activeLineNumber - 1] ?? -1;
|
|
472
|
-
b != s && (s > -1 && (u[s].className = ""), b > -1 && (u[b].className = "active")), s = b;
|
|
473
|
-
}, p = (b) => {
|
|
474
|
-
const g = b.length, a = [], r = [];
|
|
475
|
-
for (let d = 0, o = -1, i = 0, h = 0; ; i++) {
|
|
476
|
-
const k = i == g, I = k ? 0 : y[i] = c(b[i]);
|
|
477
|
-
if (I < 0)
|
|
478
|
-
o < 0 && (o = i);
|
|
479
|
-
else {
|
|
480
|
-
for (let w = I; w < d; w++)
|
|
481
|
-
a[w][1] = (o < 0 || w == I && !k ? i : o) - a[w][0];
|
|
482
|
-
for (let w = d; w < I; )
|
|
483
|
-
r[h++] = a[w] = [
|
|
484
|
-
o < 0 || w > d ? i : o,
|
|
485
|
-
0,
|
|
486
|
-
w++ * e
|
|
487
|
-
];
|
|
488
|
-
o = -1, d = I;
|
|
489
|
-
}
|
|
490
|
-
if (k) break;
|
|
491
|
-
}
|
|
492
|
-
return y.length = g, r;
|
|
493
|
-
}, c = (b) => {
|
|
494
|
-
let g = b.search(/\S/), a = 0;
|
|
495
|
-
if (g < 0) return g;
|
|
496
|
-
for (let r = 0; r < g; )
|
|
497
|
-
a += b[r++] == " " ? e - a % e : 1;
|
|
498
|
-
return Math.ceil(a / e);
|
|
499
|
-
};
|
|
500
|
-
return {
|
|
501
|
-
lines: E.children,
|
|
502
|
-
indentLevels: y,
|
|
503
|
-
update(b, g) {
|
|
504
|
-
l || (l = b, b.extensions.indentGuides = this, b.overlays.append(E), b.addListener("update", v), b.addListener("selectionChange", m)), E.style.display = g.wordWrap ? "none" : "", e != (e = g.tabSize || 2) && (v(b.value), m());
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
}, ka = () => (e) => {
|
|
508
|
-
let t, n, s, l = -1, u = [], f = () => {
|
|
509
|
-
n || (n = e.extensions.matchBrackets);
|
|
510
|
-
let [v, m] = e.getSelection(), p = v == m && e.focused && n && E(m) || -1;
|
|
511
|
-
if (p != l) {
|
|
512
|
-
if (y(), p + 1) {
|
|
513
|
-
let c = t[s[p]], b = t[p];
|
|
514
|
-
u = [c, b].map(
|
|
515
|
-
(g) => Ve(e, ".punctuation", 0, -1, g[1])
|
|
516
|
-
), u[0] != u[1] && c[1] + c[3].length == b[1] && (u[0].textContent += u[1].textContent, u[1].textContent = "", u[1] = u[0]), y(!0);
|
|
517
|
-
} else u = [];
|
|
518
|
-
l = p;
|
|
519
|
-
}
|
|
520
|
-
}, E = (v) => {
|
|
521
|
-
var m;
|
|
522
|
-
({ brackets: t, pairs: s } = n);
|
|
523
|
-
for (let p = 0, c; c = t[++p]; )
|
|
524
|
-
if (!c[4] && c[5] >= v && ((m = t[s[p]]) == null ? void 0 : m[1]) <= v)
|
|
525
|
-
return p;
|
|
526
|
-
}, y = (v) => u.forEach((m) => m.classList.toggle("active-bracket", !!v));
|
|
527
|
-
G(e, "focus", f), G(e, "blur", f), e.addListener("selectionChange", f), e.addListener("update", () => {
|
|
528
|
-
y(), l = -1;
|
|
529
|
-
});
|
|
530
|
-
}, Sa = (e = !0, t = "([{", n = ")]}") => {
|
|
531
|
-
let s, l;
|
|
532
|
-
const u = [], f = (p) => {
|
|
533
|
-
p.extensions.matchBrackets = f, p.addListener("tokenize", v), e && p.tokens[0] ? p.update() : v(p.tokens);
|
|
534
|
-
}, E = f.brackets = [], y = f.pairs = [], v = (p) => {
|
|
535
|
-
if (y.length = E.length = l = s = 0, m(p, 0), e)
|
|
536
|
-
for (let c = 0, b; b = E[c]; ) {
|
|
537
|
-
let g = b[0].alias;
|
|
538
|
-
b[0].alias = (g ? g + " " : "") + `bracket-${c++ in y ? "level-" + b[2] % 12 : "error"}`;
|
|
539
|
-
}
|
|
540
|
-
}, m = (p, c) => {
|
|
541
|
-
let b, g = 0;
|
|
542
|
-
for (; b = p[g++]; ) {
|
|
543
|
-
let a = b.length;
|
|
544
|
-
if (typeof b != "string") {
|
|
545
|
-
let r = b.content;
|
|
546
|
-
if (Array.isArray(r))
|
|
547
|
-
m(r, c);
|
|
548
|
-
else if ((b.alias || b.type) == "punctuation") {
|
|
549
|
-
let d = Zt(r, t, a - 1), o = d || Zt(r, n, a - 1);
|
|
550
|
-
if (o) {
|
|
551
|
-
if (E[s] = [b, c, 0, r, !!d, c + a], d) u[l++] = [s, d];
|
|
552
|
-
else
|
|
553
|
-
for (let i = l; i; ) {
|
|
554
|
-
let [h, k] = u[--i];
|
|
555
|
-
o == k && (y[y[s] = h] = s, E[s][2] = E[h][2] = l = i, i = 0);
|
|
556
|
-
}
|
|
557
|
-
s++;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
c += a;
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
return f;
|
|
565
|
-
}, Zt = (e, t, n) => t.indexOf(e[0]) + 1 || n && t.indexOf(e[n]) + 1, Ta = "xml,rss,atom,jsx,tsx,xquery,actionscript".split(","), xa = /^(?:area|base|w?br|col|embed|hr|img|input|link|meta|source|track)$/i, Oa = (e) => {
|
|
566
|
-
let t = [], n, s = [], l, u, f = [], E = (v, m, p) => {
|
|
567
|
-
n = p, s.length = t.length = l = u = 0, y(v, m, 0);
|
|
568
|
-
}, y = (v, m, p) => {
|
|
569
|
-
let c = Ta.includes(m), b = 0, g = v.length;
|
|
570
|
-
for (; b < g; ) {
|
|
571
|
-
const a = v[b++], r = a.content, d = a.length;
|
|
572
|
-
if (Array.isArray(r))
|
|
573
|
-
if (a.type == "tag" && n[p] == "<") {
|
|
574
|
-
const o = r[0].length, i = r[2] ? n.substr(p + o, r[1].length) : "", h = r[r.length - 1].length < 2 && (c || !xa.test(i));
|
|
575
|
-
if (r[2] && c && y(r, m, p), h)
|
|
576
|
-
if (o > 1)
|
|
577
|
-
for (let k = u; k; )
|
|
578
|
-
i == f[--k][1] && (t[t[l] = f[u = k][0]] = l, k = 0);
|
|
579
|
-
else
|
|
580
|
-
f[u++] = [l, i];
|
|
581
|
-
s[l++] = [
|
|
582
|
-
a,
|
|
583
|
-
p,
|
|
584
|
-
p + d,
|
|
585
|
-
i,
|
|
586
|
-
o > 1,
|
|
587
|
-
h
|
|
588
|
-
];
|
|
589
|
-
} else {
|
|
590
|
-
let o = a.alias || a.type;
|
|
591
|
-
y(
|
|
592
|
-
r,
|
|
593
|
-
o.slice(0, 9) == "language-" ? o.slice(9) : m,
|
|
594
|
-
p
|
|
595
|
-
);
|
|
596
|
-
}
|
|
597
|
-
p += d;
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
return e.addListener("tokenize", E), E(e.tokens, e.options.language, e.value), {
|
|
601
|
-
tags: s,
|
|
602
|
-
pairs: t
|
|
603
|
-
};
|
|
604
|
-
}, Na = (e, t) => {
|
|
605
|
-
for (let n = 0, s = t.length; n < s; n++) if (t[n][1] <= e && t[n][2] >= e) return n;
|
|
606
|
-
}, La = () => (e) => {
|
|
607
|
-
var t;
|
|
608
|
-
let n, s;
|
|
609
|
-
const { tags: l, pairs: u } = (t = e.extensions).matchTags || (t.matchTags = Oa(e)), f = (E) => [n, s].forEach((y) => {
|
|
610
|
-
y && y.classList.toggle("active-tagname", !E);
|
|
611
|
-
});
|
|
612
|
-
e.addListener("selectionChange", ([E, y]) => {
|
|
613
|
-
let v, m, p;
|
|
614
|
-
E == y && e.focused && (p = Na(E, l), p + 1 && (p = u[p], p + 1 && (v = Ve(e, ".tag>.tag")) && (m = Ve(e, ".tag>.tag", 2, 0, l[p][1])))), n != v && (f(!0), n = v, s = m, f());
|
|
615
|
-
});
|
|
616
|
-
};
|
|
617
|
-
var Ze = "\\b(?:BASH(?:OPTS|_ALIASES|_ARG[CV]|_CMDS|_COMPLETION_COMPAT_DIR|_LINENO|_REMATCH|_SOURCE|_VERSINFO|_VERSION)?|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|E?UID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_(?:ADDRESS|ALL|IDENTIFICATION|MEASUREMENT|MONETARY|NAME|NUMERIC|PAPER|TELEPHONE|TIME)|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS[1-4]|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_(?:CONFIG_DIRS|CURRENT_DESKTOP|DATA_DIRS|GREETER_DATA_DIR|MENU_PREFIX|RUNTIME_DIR|SEAT|SEAT_PATH|SESSION_DESKTOP|SESSION_ID|SESSION_PATH|SESSION_TYPE|VTNR)|XMODIFIERS)\\b", ft = {
|
|
618
|
-
pattern: /(^(["']?)\w+\2)[ ]+\S.*/,
|
|
619
|
-
lookbehind: !0,
|
|
620
|
-
alias: "punctuation"
|
|
621
|
-
// this looks reasonably well in all themes
|
|
622
|
-
}, Ln = {
|
|
623
|
-
variable: /^\$\(|^`|\)$|`$/
|
|
624
|
-
}, Ne = {
|
|
625
|
-
bash: ft,
|
|
626
|
-
environment: {
|
|
627
|
-
pattern: RegExp("\\$" + Ze),
|
|
628
|
-
alias: "constant"
|
|
629
|
-
},
|
|
630
|
-
variable: [
|
|
631
|
-
// [0]: Arithmetic Environment
|
|
632
|
-
{
|
|
633
|
-
pattern: /\$?\(\([^]*?\)\)/g,
|
|
634
|
-
greedy: !0,
|
|
635
|
-
inside: {
|
|
636
|
-
// If there is a $ sign at the beginning highlight $(( and )) as variable
|
|
637
|
-
variable: [
|
|
638
|
-
{
|
|
639
|
-
pattern: /(^\$[^]+)../,
|
|
640
|
-
lookbehind: !0
|
|
641
|
-
},
|
|
642
|
-
/^\$\(\(/
|
|
643
|
-
],
|
|
644
|
-
number: /\b0x[a-fA-F\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
645
|
-
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
|
|
646
|
-
operator: /--|\+\+|&&|\|\||(?:\*\*|<<|>>|[%&|^!=<>/*+-])=?|[?:~]/,
|
|
647
|
-
// If there is no $ sign at the beginning highlight (( and )) as punctuation
|
|
648
|
-
punctuation: /\(\(?|\)\)?|,|;/
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
// [1]: Command Substitution
|
|
652
|
-
{
|
|
653
|
-
pattern: /\$\((?:[^()]|\([^)]*\))*\)|`[^`]+`/g,
|
|
654
|
-
greedy: !0,
|
|
655
|
-
inside: Ln
|
|
656
|
-
},
|
|
657
|
-
// [2]: Brace expansion
|
|
658
|
-
{
|
|
659
|
-
pattern: /\$\{[^}]*\}/g,
|
|
660
|
-
greedy: !0,
|
|
661
|
-
inside: {
|
|
662
|
-
operator: /:[?=+-]?|[!/]|##?|%%?|\^\^?|,,?/,
|
|
663
|
-
punctuation: /[[\]]/,
|
|
664
|
-
environment: {
|
|
665
|
-
pattern: RegExp("(\\{)" + Ze),
|
|
666
|
-
lookbehind: !0,
|
|
667
|
-
alias: "constant"
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
},
|
|
671
|
-
/\$(?:\w+|[#?*!@$])/
|
|
672
|
-
],
|
|
673
|
-
// Escape sequences from echo and printf's manuals, and escaped quotes.
|
|
674
|
-
entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[a-fA-F\d]{8}|u[a-fA-F\d]{4}|x[a-fA-F\d]{1,2})/
|
|
675
|
-
}, Ca = ft.inside = _.sh = _.shell = _.bash = {
|
|
676
|
-
shebang: {
|
|
677
|
-
pattern: /^#!\s*\/.*/,
|
|
678
|
-
alias: "important"
|
|
679
|
-
},
|
|
680
|
-
comment: {
|
|
681
|
-
pattern: /(^|[^"{\\$])#.*/,
|
|
682
|
-
lookbehind: !0
|
|
683
|
-
},
|
|
684
|
-
"function-name": [
|
|
685
|
-
// a) function foo {
|
|
686
|
-
// b) foo() {
|
|
687
|
-
// c) function foo() {
|
|
688
|
-
// but not “foo {”
|
|
689
|
-
{
|
|
690
|
-
// a) and c)
|
|
691
|
-
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
|
692
|
-
lookbehind: !0,
|
|
693
|
-
alias: "function"
|
|
694
|
-
},
|
|
695
|
-
{
|
|
696
|
-
// b)
|
|
697
|
-
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
698
|
-
alias: "function"
|
|
699
|
-
}
|
|
700
|
-
],
|
|
701
|
-
// Highlight variable names as variables in for and select beginnings.
|
|
702
|
-
"for-or-select": {
|
|
703
|
-
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
704
|
-
lookbehind: !0,
|
|
705
|
-
alias: "variable"
|
|
706
|
-
},
|
|
707
|
-
// Highlight variable names as variables in the left-hand part
|
|
708
|
-
// of assignments (“=” and “+=”).
|
|
709
|
-
"assign-left": {
|
|
710
|
-
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
711
|
-
lookbehind: !0,
|
|
712
|
-
alias: "variable",
|
|
713
|
-
inside: {
|
|
714
|
-
environment: {
|
|
715
|
-
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + Ze),
|
|
716
|
-
lookbehind: !0,
|
|
717
|
-
alias: "constant"
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
},
|
|
721
|
-
// Highlight parameter names as variables
|
|
722
|
-
parameter: {
|
|
723
|
-
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?![^\s=])/,
|
|
724
|
-
lookbehind: !0,
|
|
725
|
-
alias: "variable"
|
|
726
|
-
},
|
|
727
|
-
string: [
|
|
728
|
-
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
|
|
729
|
-
{
|
|
730
|
-
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[^]*?\n\2/g,
|
|
731
|
-
lookbehind: !0,
|
|
732
|
-
greedy: !0,
|
|
733
|
-
inside: Ne
|
|
734
|
-
},
|
|
735
|
-
// Here-document with quotes around the tag
|
|
736
|
-
// → No expansion (so no “inside”).
|
|
737
|
-
{
|
|
738
|
-
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[^]*?\n\3/g,
|
|
739
|
-
lookbehind: !0,
|
|
740
|
-
greedy: !0,
|
|
741
|
-
inside: {
|
|
742
|
-
bash: ft
|
|
743
|
-
}
|
|
744
|
-
},
|
|
745
|
-
// “Normal” string
|
|
746
|
-
{
|
|
747
|
-
// https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
|
|
748
|
-
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[^]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^\\"`$])*"/g,
|
|
749
|
-
lookbehind: !0,
|
|
750
|
-
greedy: !0,
|
|
751
|
-
inside: Ne
|
|
752
|
-
},
|
|
753
|
-
{
|
|
754
|
-
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
|
|
755
|
-
pattern: /(^|[^$\\])'[^']*'/g,
|
|
756
|
-
lookbehind: !0,
|
|
757
|
-
greedy: !0
|
|
758
|
-
},
|
|
759
|
-
{
|
|
760
|
-
// https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
|
|
761
|
-
pattern: /\$'(?:\\[^]|[^\\'])*'/g,
|
|
762
|
-
greedy: !0,
|
|
763
|
-
inside: {
|
|
764
|
-
entity: Ne.entity
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
],
|
|
768
|
-
environment: {
|
|
769
|
-
pattern: RegExp("\\$?" + Ze),
|
|
770
|
-
alias: "constant"
|
|
771
|
-
},
|
|
772
|
-
variable: Ne.variable,
|
|
773
|
-
function: {
|
|
774
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|c?fdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cron|crontab|c?split|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff3?|dig|dircolors|dirname|dirs?|dmesg|docker|docker-compose|du|[ef]?grep|eject|env|ethtool|expand|expect|expr|fdformat|fg|file|find|fmt|fold|format|free|fsck|fuser|g?awk|git|g?parted|groupadd|groupdel|groupmod|groups|grub-mkconfig|halt|head|hg|history|host|hostname|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|killall|less|link|ln|logname|logrotate|look|lpc|lprint[dq]?|lprm?|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mm?v|more|most|mtools|m?tr|mutt|nano|nc|netstat|nice|nl|node|nohup|notify-send|nslookup|op|open|passwd|paste|pathchk|ping|p?kill|p?npm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ra[mr]|reboot|remsync|rename|renice|rev|rmdir|rp?m|r?sync|[sr]?cp|screen|sdiff|se[dq]|sendmail|service|s?ftp|shellcheck|shuf|shutdown|sleep|s?locate|[sz]?sh|stat|strace|sudo|sum?|suspend|swapon|sysctl|tac|tail|tar|tee|time|timeout|h?top|touch|traceroute|t?sort|tty|u?mount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vim?|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|g?zip|zsh|zypper)(?=$|[)\s;|&])/,
|
|
775
|
-
lookbehind: !0
|
|
776
|
-
},
|
|
777
|
-
keyword: {
|
|
778
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
|
779
|
-
lookbehind: !0
|
|
780
|
-
},
|
|
781
|
-
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
|
782
|
-
builtin: {
|
|
783
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|[ls]et|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
|
|
784
|
-
lookbehind: !0,
|
|
785
|
-
// Alias added to make those easier to distinguish from strings.
|
|
786
|
-
alias: "class-name"
|
|
787
|
-
},
|
|
788
|
-
boolean: {
|
|
789
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
|
790
|
-
lookbehind: !0
|
|
791
|
-
},
|
|
792
|
-
"file-descriptor": {
|
|
793
|
-
pattern: /\B&\d\b/,
|
|
794
|
-
alias: "important"
|
|
795
|
-
},
|
|
796
|
-
operator: {
|
|
797
|
-
// Lots of redirections here, but not just that.
|
|
798
|
-
pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
|
799
|
-
inside: {
|
|
800
|
-
"file-descriptor": {
|
|
801
|
-
pattern: /^\d/,
|
|
802
|
-
alias: "important"
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
},
|
|
806
|
-
punctuation: /\$?\(\(?|\)\)?|\.\.|[[\]{};\\]/,
|
|
807
|
-
number: {
|
|
808
|
-
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
|
809
|
-
lookbehind: !0
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
[
|
|
813
|
-
"comment",
|
|
814
|
-
"function-name",
|
|
815
|
-
"for-or-select",
|
|
816
|
-
"assign-left",
|
|
817
|
-
"parameter",
|
|
818
|
-
"string",
|
|
819
|
-
"environment",
|
|
820
|
-
"function",
|
|
821
|
-
"keyword",
|
|
822
|
-
"builtin",
|
|
823
|
-
"boolean",
|
|
824
|
-
"file-descriptor",
|
|
825
|
-
"operator",
|
|
826
|
-
"punctuation",
|
|
827
|
-
"number"
|
|
828
|
-
].forEach((e) => Ln[e] = Ca[e]);
|
|
829
|
-
var Cn = /(?:"(?:\\[^]|[^\\\n"])*"|'(?:\\[^]|[^\\\n'])*')/g, Le = Cn.source, qt = {
|
|
830
|
-
rule: /^@[\w-]+/,
|
|
831
|
-
"selector-function-argument": {
|
|
832
|
-
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^)]*\))*\))+(?=\s*\))/,
|
|
833
|
-
lookbehind: !0,
|
|
834
|
-
alias: "selector"
|
|
835
|
-
},
|
|
836
|
-
keyword: {
|
|
837
|
-
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
838
|
-
lookbehind: !0
|
|
839
|
-
}
|
|
840
|
-
// See rest below
|
|
841
|
-
};
|
|
842
|
-
qt[j] = _.css = {
|
|
843
|
-
comment: /\/\*[^]*?\*\//,
|
|
844
|
-
atrule: {
|
|
845
|
-
pattern: RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|${Le})*?(?:;|(?=\\s*\\{))`),
|
|
846
|
-
inside: qt
|
|
847
|
-
},
|
|
848
|
-
url: {
|
|
849
|
-
// https://drafts.csswg.org/css-values-3/#urls
|
|
850
|
-
pattern: RegExp(`\\burl\\((?:${Le}|(?:[^\\\\
|
|
851
|
-
"')=]|\\\\[^])*)\\)`, "gi"),
|
|
852
|
-
greedy: !0,
|
|
853
|
-
inside: {
|
|
854
|
-
function: /^url/i,
|
|
855
|
-
punctuation: /^\(|\)$/,
|
|
856
|
-
string: {
|
|
857
|
-
pattern: RegExp("^" + Le + "$"),
|
|
858
|
-
alias: "url"
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
},
|
|
862
|
-
selector: {
|
|
863
|
-
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|${Le})*(?=\\s*\\{)`),
|
|
864
|
-
lookbehind: !0
|
|
865
|
-
},
|
|
866
|
-
string: {
|
|
867
|
-
pattern: Cn,
|
|
868
|
-
greedy: !0
|
|
869
|
-
},
|
|
870
|
-
property: {
|
|
871
|
-
pattern: /(^|[^-\w\xa0-\uffff])(?!\d)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*:)/i,
|
|
872
|
-
lookbehind: !0
|
|
873
|
-
},
|
|
874
|
-
important: /!important\b/i,
|
|
875
|
-
function: {
|
|
876
|
-
pattern: /(^|[^-a-z\d])[-a-z\d]+(?=\()/i,
|
|
877
|
-
lookbehind: !0
|
|
878
|
-
},
|
|
879
|
-
punctuation: /[(){},:;]/
|
|
880
|
-
};
|
|
881
|
-
var De = (e, t) => {
|
|
882
|
-
if (t.has(e)) return t.get(e);
|
|
883
|
-
var n = e, s = Ma.call(e).slice(8, -1);
|
|
884
|
-
if (s == "Object") {
|
|
885
|
-
t.set(e, n = {});
|
|
886
|
-
for (var l in e)
|
|
887
|
-
n[l] = De(e[l], t);
|
|
888
|
-
e[j] && (n[j] = De(e[j], t)), e[J] && (n[J] = e[J]);
|
|
889
|
-
} else if (s == "Array") {
|
|
890
|
-
t.set(e, n = []);
|
|
891
|
-
for (var u = 0, f = e.length; u < f; u++)
|
|
892
|
-
n[u] = De(e[u], t);
|
|
893
|
-
}
|
|
894
|
-
return n;
|
|
895
|
-
}, Qe = (e) => De(e, /* @__PURE__ */ new Map()), ae = (e, t) => Object.assign(Qe(_[e]), t), $ = (e, t, n) => {
|
|
896
|
-
var s = {};
|
|
897
|
-
for (var l in e)
|
|
898
|
-
s[l] = e[l], delete e[l];
|
|
899
|
-
for (var l in s)
|
|
900
|
-
l == t && Object.assign(e, n), n.hasOwnProperty(l) || (e[l] = s[l]);
|
|
901
|
-
}, Ma = {}.toString, qe = _.css, Kt = {
|
|
902
|
-
pattern: /(\b\d+)(?:%|[a-z]+(?![\w-]))/,
|
|
903
|
-
lookbehind: !0
|
|
904
|
-
}, Wt = {
|
|
905
|
-
pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
|
|
906
|
-
lookbehind: !0
|
|
907
|
-
};
|
|
908
|
-
qe.selector.inside = qe.atrule.inside["selector-function-argument"].inside = {
|
|
909
|
-
"pseudo-element": /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
|
|
910
|
-
"pseudo-class": /:[-\w]+/,
|
|
911
|
-
class: /\.[-\w]+/,
|
|
912
|
-
id: /#[-\w]+/,
|
|
913
|
-
attribute: {
|
|
914
|
-
pattern: /\[(?:[^[\]"']|(["'])(?:\\[^]|(?!\1)[^\\\n])*\1)*\]/g,
|
|
915
|
-
greedy: !0,
|
|
916
|
-
inside: {
|
|
917
|
-
punctuation: /^\[|\]$/,
|
|
918
|
-
"case-sensitivity": {
|
|
919
|
-
pattern: /(\s)[si]$/i,
|
|
920
|
-
lookbehind: !0,
|
|
921
|
-
alias: "keyword"
|
|
922
|
-
},
|
|
923
|
-
namespace: {
|
|
924
|
-
pattern: /^(\s*)(?:(?!\s)[-*\w\xa0-\uffff])*\|(?!=)/,
|
|
925
|
-
lookbehind: !0,
|
|
926
|
-
inside: {
|
|
927
|
-
punctuation: /\|$/
|
|
928
|
-
}
|
|
929
|
-
},
|
|
930
|
-
"attr-name": {
|
|
931
|
-
pattern: /^(\s*)(?:(?!\s)[-\w\xa0-\uffff])+/,
|
|
932
|
-
lookbehind: !0
|
|
933
|
-
},
|
|
934
|
-
"attr-value": {
|
|
935
|
-
pattern: /(=\s*)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*$)|(["'])(?:\\[^]|(?!\2)[^\\\n])*\2/,
|
|
936
|
-
lookbehind: !0
|
|
937
|
-
},
|
|
938
|
-
operator: /[|~*^$]?=/
|
|
939
|
-
}
|
|
940
|
-
},
|
|
941
|
-
"n-th": [
|
|
942
|
-
{
|
|
943
|
-
pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,
|
|
944
|
-
lookbehind: !0,
|
|
945
|
-
inside: {
|
|
946
|
-
number: /[\dn]+/,
|
|
947
|
-
operator: /[+-]/
|
|
948
|
-
}
|
|
949
|
-
},
|
|
950
|
-
{
|
|
951
|
-
pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i,
|
|
952
|
-
lookbehind: !0
|
|
953
|
-
}
|
|
954
|
-
],
|
|
955
|
-
combinator: />|\+|~|\|\|/,
|
|
956
|
-
// the `tag` token has been existed and removed.
|
|
957
|
-
// because we can't find a perfect tokenize to match it.
|
|
958
|
-
// if you want to add it, please read https://github.com/PrismJS/prism/pull/2373 first.
|
|
959
|
-
punctuation: /[(),]/
|
|
960
|
-
};
|
|
961
|
-
$(qe, "property", {
|
|
962
|
-
variable: {
|
|
963
|
-
pattern: /(^|[^-\w\xa0-\uffff])--(?!\d)(?:(?!\s)[-\w\xa0-\uffff])*/i,
|
|
964
|
-
lookbehind: !0
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
$(qe, "function", {
|
|
968
|
-
operator: {
|
|
969
|
-
pattern: /(\s)[/*+-](?!\S)/,
|
|
970
|
-
lookbehind: !0
|
|
971
|
-
},
|
|
972
|
-
// CAREFUL!
|
|
973
|
-
// Previewers and Inline color use hexcode and color.
|
|
974
|
-
hexcode: {
|
|
975
|
-
pattern: /\B#[a-f\d]{3,8}\b/i,
|
|
976
|
-
alias: "color"
|
|
977
|
-
},
|
|
978
|
-
color: [
|
|
979
|
-
{
|
|
980
|
-
pattern: /(^|[^\w-])(?:(?:alice|cadet|cornflower|deepsky|dodger|midnight|powder|royal|sky|steel)blue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blueviolet|brown|burlywood|chartreuse|chocolate|coral|cornsilk|crimson|(?:dark)?(?:blue|cyan|goldenrod|gr[ae]y|green|khaki|magenta|olivegreen|orange|orchid|red|salmon|seagreen|slateblue|slategr[ae]y|turquoise|violet)|deeppink|dimgr[ae]y|firebrick|floralwhite|(?:forest|lawn|lime|pale|spring)green|fuchsia|gainsboro|ghostwhite|gold|greenyellow|honeydew|hotpink|indianred|indigo|ivory|lavender|lavenderblush|lemonchiffon|light(?:blue|coral|cyan|goldenrodyellow|gr[ae]y|green|pink|salmon|seagreen|skyblue|slategr[ae]y|steelblue|yellow)|lime|linen|maroon|medium(?:aquamarine|blue|orchid|purple|seagreen|slateblue|springgreen|turquoise|violetred)|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orangered|palegoldenrod|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|purple|rebeccapurple|rosybrown|saddlebrown|sandybrown|seashell|sienna|silver|snow|tan|teal|thistle|tomato|transparent|wheat|white|whitesmoke|yellow|yellowgreen)(?![\w-])/i,
|
|
981
|
-
lookbehind: !0
|
|
982
|
-
},
|
|
983
|
-
{
|
|
984
|
-
pattern: /\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,
|
|
985
|
-
inside: {
|
|
986
|
-
function: /^[^(]+/,
|
|
987
|
-
unit: Kt,
|
|
988
|
-
number: Wt,
|
|
989
|
-
punctuation: /[(),]/
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
],
|
|
993
|
-
// it's important that there is no boundary assertion after the hex digits
|
|
994
|
-
entity: /\\[a-f\d]{1,8}/i,
|
|
995
|
-
unit: Kt,
|
|
996
|
-
number: Wt
|
|
997
|
-
});
|
|
998
|
-
_.ini = {
|
|
999
|
-
/**
|
|
1000
|
-
* The component mimics the behavior of the Win32 API parser.
|
|
1001
|
-
*
|
|
1002
|
-
* @see {@link https://github.com/PrismJS/prism/issues/2775#issuecomment-787477723}
|
|
1003
|
-
*/
|
|
1004
|
-
comment: {
|
|
1005
|
-
pattern: /(^[ \f \v]*)[#;].*/m,
|
|
1006
|
-
lookbehind: !0
|
|
1007
|
-
},
|
|
1008
|
-
section: {
|
|
1009
|
-
pattern: /(^[ \f \v]*)\[[^\n\]]*\]?/m,
|
|
1010
|
-
lookbehind: !0,
|
|
1011
|
-
inside: {
|
|
1012
|
-
"section-name": {
|
|
1013
|
-
pattern: /(^\[[ \f \v]*)[^ \f \v\]]+(?:[ \f \v]+[^ \f \v\]]+)*/,
|
|
1014
|
-
lookbehind: !0,
|
|
1015
|
-
alias: "selector"
|
|
1016
|
-
},
|
|
1017
|
-
punctuation: /[[\]]/
|
|
1018
|
-
}
|
|
1019
|
-
},
|
|
1020
|
-
key: {
|
|
1021
|
-
pattern: /(^[ \f \v]*)[^ \f\n \v=]+(?:[ \f \v]+[^ \f\n \v=]+)*(?=[ \f \v]*=)/m,
|
|
1022
|
-
lookbehind: !0,
|
|
1023
|
-
alias: "attr-name"
|
|
1024
|
-
},
|
|
1025
|
-
value: {
|
|
1026
|
-
pattern: /(=[ \f \v]*)[^ \f\n \v]+(?:[ \f \v]+[^ \f\n \v]+)*/,
|
|
1027
|
-
lookbehind: !0,
|
|
1028
|
-
alias: "attr-value",
|
|
1029
|
-
inside: {
|
|
1030
|
-
"inner-value": {
|
|
1031
|
-
pattern: /^(["']).+(?=\1$)/,
|
|
1032
|
-
lookbehind: !0
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
},
|
|
1036
|
-
punctuation: /=/
|
|
1037
|
-
};
|
|
1038
|
-
var re = () => ({
|
|
1039
|
-
pattern: /\/\/.*|\/\*[^]*?(?:\*\/|$)/g,
|
|
1040
|
-
greedy: !0
|
|
1041
|
-
}), Tt = () => ({
|
|
1042
|
-
pattern: /(["'])(?:\\[^]|(?!\1)[^\\\n])*\1/g,
|
|
1043
|
-
greedy: !0
|
|
1044
|
-
}), Mn = /\b0x[a-f\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i, te = /[()[\]{}.,:;]/, q = /\b(?:false|true)\b/, it = {
|
|
1045
|
-
"interpolation-punctuation": {
|
|
1046
|
-
pattern: /^\$\{?|\}$/,
|
|
1047
|
-
alias: "punctuation"
|
|
1048
|
-
},
|
|
1049
|
-
expression: {
|
|
1050
|
-
pattern: /[^]+/
|
|
1051
|
-
}
|
|
1052
|
-
};
|
|
1053
|
-
it.expression.inside = _.kts = _.kt = _.kotlin = {
|
|
1054
|
-
// https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions
|
|
1055
|
-
"string-literal": [
|
|
1056
|
-
{
|
|
1057
|
-
pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
|
|
1058
|
-
alias: "multiline",
|
|
1059
|
-
inside: {
|
|
1060
|
-
interpolation: {
|
|
1061
|
-
pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
1062
|
-
inside: it
|
|
1063
|
-
},
|
|
1064
|
-
string: /[^]+/
|
|
1065
|
-
}
|
|
1066
|
-
},
|
|
1067
|
-
{
|
|
1068
|
-
pattern: /"(?:\\.|[^\\\n"$]|\$(?:(?!\{)|\{[^{}]*\}))*"/,
|
|
1069
|
-
alias: "singleline",
|
|
1070
|
-
inside: {
|
|
1071
|
-
interpolation: {
|
|
1072
|
-
pattern: /((?:^|[^\\])(?:\\\\)*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
1073
|
-
lookbehind: !0,
|
|
1074
|
-
inside: it
|
|
1075
|
-
},
|
|
1076
|
-
string: /[^]+/
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
],
|
|
1080
|
-
char: {
|
|
1081
|
-
// https://kotlinlang.org/spec/expressions.html#character-literals
|
|
1082
|
-
pattern: /'(?:[^\\\n']|\\(?:.|u[a-fA-F\d]{0,4}))'/g,
|
|
1083
|
-
greedy: !0
|
|
1084
|
-
},
|
|
1085
|
-
comment: re(),
|
|
1086
|
-
annotation: {
|
|
1087
|
-
pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
|
|
1088
|
-
alias: "builtin"
|
|
1089
|
-
},
|
|
1090
|
-
keyword: {
|
|
1091
|
-
// The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
|
|
1092
|
-
pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,
|
|
1093
|
-
lookbehind: !0
|
|
1094
|
-
},
|
|
1095
|
-
boolean: q,
|
|
1096
|
-
label: {
|
|
1097
|
-
pattern: /\b\w+@|@\w+/,
|
|
1098
|
-
alias: "symbol"
|
|
1099
|
-
},
|
|
1100
|
-
function: {
|
|
1101
|
-
pattern: /(?:`[^\n`]+`|\b\w+)(?=\s*\()|(\.)(?:`[^\n`]+`|\w+)(?=\s*\{)/g,
|
|
1102
|
-
lookbehind: !0,
|
|
1103
|
-
greedy: !0
|
|
1104
|
-
},
|
|
1105
|
-
number: /\b(?:0[xX][a-fA-F\d]+(?:_[a-fA-F\d]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
|
|
1106
|
-
operator: /--|\+\+|&&|\|\||->|[!=]==|!!|[%!=<>/*+-]=?|[?:]:?|\.\.|\b(?:and|inv|shl|u?shr|x?or)\b/,
|
|
1107
|
-
punctuation: te
|
|
1108
|
-
};
|
|
1109
|
-
var Pn = [
|
|
1110
|
-
{
|
|
1111
|
-
pattern: /&[a-z\d]{1,8};/i,
|
|
1112
|
-
alias: "named-entity"
|
|
1113
|
-
},
|
|
1114
|
-
/&#x?[a-f\d]{1,8};/i
|
|
1115
|
-
], Pa = {
|
|
1116
|
-
pattern: /<\/?(?!\d)[^\s/=>$<%]+(?:\s(?:\s*[^\s/=>]+(?:\s*=\s*(?!\s)(?:"[^"]*"|'[^']*'|[^\s"'=>]+(?=[\s>]))?|(?=[\s/>])))+)?\s*\/?>/g,
|
|
1117
|
-
greedy: !0,
|
|
1118
|
-
inside: {
|
|
1119
|
-
punctuation: /^<\/?|\/?>$/,
|
|
1120
|
-
tag: {
|
|
1121
|
-
pattern: /^\S+/,
|
|
1122
|
-
inside: {
|
|
1123
|
-
namespace: /^[^:]+:/
|
|
1124
|
-
}
|
|
1125
|
-
},
|
|
1126
|
-
"attr-value": [{
|
|
1127
|
-
pattern: /(=\s*)(?:"[^"]*"|'[^']*'|[^\s"'=>]+)/g,
|
|
1128
|
-
lookbehind: !0,
|
|
1129
|
-
greedy: !0,
|
|
1130
|
-
inside: {
|
|
1131
|
-
punctuation: /^["']|["']$/,
|
|
1132
|
-
entity: Pn
|
|
1133
|
-
}
|
|
1134
|
-
}],
|
|
1135
|
-
"attr-equals": /=/,
|
|
1136
|
-
"attr-name": {
|
|
1137
|
-
pattern: /\S+/,
|
|
1138
|
-
inside: {
|
|
1139
|
-
namespace: /^[^:]+:/
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
};
|
|
1144
|
-
_.rss = _.atom = _.ssml = _.xml = {
|
|
1145
|
-
comment: {
|
|
1146
|
-
pattern: /<!--(?:(?!<!--)[^])*?-->/g,
|
|
1147
|
-
greedy: !0
|
|
1148
|
-
},
|
|
1149
|
-
prolog: {
|
|
1150
|
-
pattern: /<\?[^]+?\?>/g,
|
|
1151
|
-
greedy: !0
|
|
1152
|
-
},
|
|
1153
|
-
doctype: {
|
|
1154
|
-
// https://www.w3.org/TR/xml/#NT-doctypedecl
|
|
1155
|
-
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/gi,
|
|
1156
|
-
greedy: !0,
|
|
1157
|
-
inside: {
|
|
1158
|
-
"internal-subset": {
|
|
1159
|
-
pattern: /(\[)[^]+(?=\]\s*>$)/,
|
|
1160
|
-
lookbehind: !0,
|
|
1161
|
-
inside: "xml"
|
|
1162
|
-
},
|
|
1163
|
-
string: /"[^"]*"|'[^']*'/,
|
|
1164
|
-
punctuation: /^<!|[>[\]]/,
|
|
1165
|
-
"doctype-tag": /^DOCTYPE/i,
|
|
1166
|
-
name: /\S+/
|
|
1167
|
-
}
|
|
1168
|
-
},
|
|
1169
|
-
cdata: {
|
|
1170
|
-
pattern: /<!\[CDATA\[[^]*?\]\]>/gi,
|
|
1171
|
-
greedy: !0
|
|
1172
|
-
},
|
|
1173
|
-
tag: Pa,
|
|
1174
|
-
entity: Pn,
|
|
1175
|
-
"markup-bracket": {
|
|
1176
|
-
pattern: /[()[\]{}]/,
|
|
1177
|
-
alias: "punctuation"
|
|
1178
|
-
}
|
|
1179
|
-
};
|
|
1180
|
-
var gt = (e, t) => (e["language-" + t] = {
|
|
1181
|
-
pattern: /[^]+/,
|
|
1182
|
-
inside: t
|
|
1183
|
-
}, e), jt = (e, t) => ({
|
|
1184
|
-
pattern: RegExp(`(<${e}[^>]*>)(?!</${e}>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])+?(?=</${e}>)`, "gi"),
|
|
1185
|
-
lookbehind: !0,
|
|
1186
|
-
greedy: !0,
|
|
1187
|
-
inside: gt({
|
|
1188
|
-
"included-cdata": {
|
|
1189
|
-
pattern: /<!\[CDATA\[[^]*?\]\]>/i,
|
|
1190
|
-
inside: gt({
|
|
1191
|
-
cdata: /^<!\[CDATA\[|\]\]>$/i
|
|
1192
|
-
}, t)
|
|
1193
|
-
}
|
|
1194
|
-
}, t)
|
|
1195
|
-
}), Yt = (e, t) => ({
|
|
1196
|
-
pattern: RegExp(`((?:^|["'\\s])(?:${e})\\s*=\\s*)(?:"[^"]*"|'[^']*'|[^\\s"'=>]+)`, "gi"),
|
|
1197
|
-
lookbehind: !0,
|
|
1198
|
-
greedy: !0,
|
|
1199
|
-
inside: gt({
|
|
1200
|
-
punctuation: /^["']|["']$/
|
|
1201
|
-
}, t)
|
|
1202
|
-
}), $n = _.svg = _.mathml = _.html = _.markup = Qe(_.xml);
|
|
1203
|
-
$n.tag.inside["attr-value"].unshift(
|
|
1204
|
-
Yt("style", "css"),
|
|
1205
|
-
Yt("on[a-z]+", "javascript")
|
|
1206
|
-
);
|
|
1207
|
-
$($n, "cdata", {
|
|
1208
|
-
style: jt("style", "css"),
|
|
1209
|
-
script: jt("script", "javascript")
|
|
1210
|
-
});
|
|
1211
|
-
_.r = {
|
|
1212
|
-
comment: /#.*/,
|
|
1213
|
-
string: {
|
|
1214
|
-
pattern: /(["'])(?:\\.|(?!\1)[^\\\n])*\1/g,
|
|
1215
|
-
greedy: !0
|
|
1216
|
-
},
|
|
1217
|
-
"percent-operator": {
|
|
1218
|
-
// Includes user-defined operators
|
|
1219
|
-
// and %%, %*%, %/%, %in%, %o%, %x%
|
|
1220
|
-
pattern: /%[^%\s]*%/,
|
|
1221
|
-
alias: "operator"
|
|
1222
|
-
},
|
|
1223
|
-
boolean: /\b(?:FALSE|TRUE)\b/,
|
|
1224
|
-
ellipsis: /\.\.(?:\.|\d+)/,
|
|
1225
|
-
number: [
|
|
1226
|
-
/\b(?:Inf|NaN)\b/,
|
|
1227
|
-
/(?:\b0x[a-fA-F\d]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/
|
|
1228
|
-
],
|
|
1229
|
-
keyword: /\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,
|
|
1230
|
-
operator: /->>?|<=|<<?-|[!=<>]=?|::?|&&?|\|\|?|[~^$@/*+-]/,
|
|
1231
|
-
punctuation: /[()[\]{},;]/
|
|
1232
|
-
};
|
|
1233
|
-
_.basic = {
|
|
1234
|
-
comment: {
|
|
1235
|
-
pattern: /(?:!|rem\b).+/i,
|
|
1236
|
-
inside: {
|
|
1237
|
-
keyword: /^rem/i
|
|
1238
|
-
}
|
|
1239
|
-
},
|
|
1240
|
-
string: {
|
|
1241
|
-
pattern: /"(?:""|[#$%&'().,:;\w ?^!=<>/*+-])*"/g,
|
|
1242
|
-
greedy: !0
|
|
1243
|
-
},
|
|
1244
|
-
number: /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
1245
|
-
keyword: /\b(?:as|beep|bload|bsave|call absolute|call|case|chain|chdir|clear|close|cls|com|common|const|data|declare|def(?: fn| seg|dbl|int|[ls]ng|str)|dim|do|double|else|elseif|environ|erase|error|exit|field|files|for|function|get|gosub|goto|if|input|integer|ioctl|key|kill|line input|locate|lock|long|loop|[lr]set|mkdir|name|next|off|on(?: com| error| key| timer)?|open|option base|[op]ut|poke|read|redim|rem|restore|resume|return|rmdir|run|select case|shared|shell|single|sleep|static|step|stop|string|sub|swap|system|then|timer|to|troff|tron|type|unlock|until|using|view print|wait|w?end|while|write)(?:\$|\b)/i,
|
|
1246
|
-
function: /\b(?:abs|access|a?cos|angle|area|arithmetic|array|a?sin|ask|atn?|base|begin|break|cause|ceil|chr|clip|collate|color|co[nst]|cosh|csc|date|datum|debug|decimal|de[fgt]|degrees|delete|device|display|dot|elapsed|eps|erasable|exline|exp|external|extype|filetype|fixed|fp|go|graph|handler|idn|image|int?|internal|ip|is|keyed|[lu]bound|[lu]case|left|le[nt]|length|lines?|log2?|log10|[lr]trim|margin|ma[tx]|maxnum|mi[dn]|missing|mod|native|nul|numeric|of|option|ord|organization|outin|output|pi|pointer|points?|pos|print|program|prompt|rad|radians|randomize|record|recsize|rectype|relative|remainder|repeat|rest|retry|rewrite|right|rnd|round|same|se[ct]|select|sequential|setter|sgn|sinh|size|skip|s[qt]r|standard|status|stream|style|tab|tanh?|template|text|there|time|timeout|trace|transform|truncate|use|val|variable|viewport|when|window|with|zer|zonewidth)(?:\$|\b)/i,
|
|
1247
|
-
operator: /<=|<>|>=|[&^=<>/*+-]|\b(?:and|eqv|imp|not|x?or)\b/i,
|
|
1248
|
-
punctuation: /[(),:;]/
|
|
1249
|
-
};
|
|
1250
|
-
_.vbnet = ae("basic", {
|
|
1251
|
-
comment: {
|
|
1252
|
-
pattern: /(?:!|'|rem\b).*/i,
|
|
1253
|
-
inside: {
|
|
1254
|
-
keyword: /^rem/i
|
|
1255
|
-
}
|
|
1256
|
-
},
|
|
1257
|
-
string: {
|
|
1258
|
-
pattern: /(^|[^"])"(?:""|[^"])*"(?!")/g,
|
|
1259
|
-
lookbehind: !0,
|
|
1260
|
-
greedy: !0
|
|
1261
|
-
},
|
|
1262
|
-
keyword: /(?:\b(?:addhandler|addressof|alias|and|andalso|as|beep|bload|boolean|bsave|byref|byval|call absolute|call|case|catch|cbool|c?byte|cc?har|c?date|cdbl|cdec|chain|chdir|cu?int|class|clear|close|cls|cobj|com|common|const|continue|c?sbyte|c?u?short|c?sng|cstr|c?type|cu?lng|data|decimal|declare|def(?: fn| seg|dbl|int|lng|sng|str)|default|delegate|dim|directcast|do|double|else|elseif|enum|environ|erase|error|event|exit|false|true|field|files|finally|for each|for|friend|function|[gls]et|gettype|getxmlnamespace|global|gosub|goto|handles|i[fns]|implements|imports|inherits|input|interface|ioctl|isnot|key|kill|lib|like|line input|locate|lock|loop|[lr]set|me|mkdir|mod|module|mustinherit|mustoverride|mybase|myclass|name|namespace|narrowing|new|next|not|nothing|notinheritable|notoverridable|object|off?|on (?:com|error|key|timer)|on|open|operator|option base|option|optional|orelse|out|overloads|overridable|overrides|paramarray|partial|poke|private|property|protected|public|put|raiseevent|read|readonly|redim|removehandler|restore|resume|return|rmdir|run|select case|select|shadows|shared|shell|single|sleep|static|step|stop|string|structure|sub|swap|synclock|system|[tw]hen|throw|timer|to|troff|tron|try|trycast|typeof|u?integer|u?long|unlock|until|using|view print|wait|w?end|while|widening|with|withevents|write|writeonly|x?or)|\B#(?:const|else|elseif|end|if))(?:\$|\b)/i,
|
|
1263
|
-
punctuation: /[(){},:;]/
|
|
1264
|
-
});
|
|
1265
|
-
var Xt = {
|
|
1266
|
-
// https://en.cppreference.com/w/c/language/character_constant
|
|
1267
|
-
pattern: /'(?:\\[^]|[^\\\n']){0,32}'/g,
|
|
1268
|
-
greedy: !0
|
|
1269
|
-
}, Qt = {
|
|
1270
|
-
pattern: /\/\/(?:[^\\\n]|\\\n?)*|\/\*[^]*?(?:\*\/|$)/g,
|
|
1271
|
-
greedy: !0
|
|
1272
|
-
}, Jt = {
|
|
1273
|
-
// https://en.cppreference.com/w/c/language/string_literal
|
|
1274
|
-
pattern: /"(?:\\[^]|[^\\\n"])*"/g,
|
|
1275
|
-
greedy: !0
|
|
1276
|
-
}, en = {
|
|
1277
|
-
pattern: /\S[^]*/
|
|
1278
|
-
};
|
|
1279
|
-
en.inside = _.c = {
|
|
1280
|
-
comment: Qt,
|
|
1281
|
-
char: Xt,
|
|
1282
|
-
macro: {
|
|
1283
|
-
// allow for multiline macro definitions
|
|
1284
|
-
// spaces after the # character compile fine with gcc
|
|
1285
|
-
pattern: /(^[ ]*)#\s*[a-z](?:[^\\\n/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\[^])*/img,
|
|
1286
|
-
lookbehind: !0,
|
|
1287
|
-
greedy: !0,
|
|
1288
|
-
alias: "property",
|
|
1289
|
-
inside: {
|
|
1290
|
-
string: [
|
|
1291
|
-
{
|
|
1292
|
-
// highlight the path of the include statement as a string
|
|
1293
|
-
pattern: /^(#\s*include\s*)<[^>]+>/,
|
|
1294
|
-
lookbehind: !0
|
|
1295
|
-
},
|
|
1296
|
-
Jt
|
|
1297
|
-
],
|
|
1298
|
-
char: Xt,
|
|
1299
|
-
comment: Qt,
|
|
1300
|
-
"macro-name": [
|
|
1301
|
-
{
|
|
1302
|
-
pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
|
|
1303
|
-
lookbehind: !0
|
|
1304
|
-
},
|
|
1305
|
-
{
|
|
1306
|
-
pattern: /(^#\s*define\s+)\w+/i,
|
|
1307
|
-
lookbehind: !0,
|
|
1308
|
-
alias: "function"
|
|
1309
|
-
}
|
|
1310
|
-
],
|
|
1311
|
-
// highlight macro directives as keywords
|
|
1312
|
-
directive: {
|
|
1313
|
-
pattern: /^(#\s*)[a-z]+/,
|
|
1314
|
-
lookbehind: !0,
|
|
1315
|
-
alias: "keyword"
|
|
1316
|
-
},
|
|
1317
|
-
"directive-hash": /^#/,
|
|
1318
|
-
punctuation: /##|\\(?=\n)/,
|
|
1319
|
-
expression: en
|
|
1320
|
-
}
|
|
1321
|
-
},
|
|
1322
|
-
string: Jt,
|
|
1323
|
-
"class-name": {
|
|
1324
|
-
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([^]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
|
|
1325
|
-
lookbehind: !0
|
|
1326
|
-
},
|
|
1327
|
-
keyword: /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
|
|
1328
|
-
// highlight predefined macros as constants
|
|
1329
|
-
constant: /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/,
|
|
1330
|
-
function: /\b[a-z_]\w*(?=\s*\()/i,
|
|
1331
|
-
number: /(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
|
|
1332
|
-
operator: /->|([&|:+-])\1|[?:~]|>>=?|<<=?|[%&|^!=<>/*+-]=?/,
|
|
1333
|
-
punctuation: te
|
|
1334
|
-
};
|
|
1335
|
-
$(
|
|
1336
|
-
_.opencl = ae("c", {
|
|
1337
|
-
// Extracted from the official specs (2.0) and http://streamcomputing.eu/downloads/?opencl.lang (opencl-keywords, opencl-types) and http://sourceforge.net/tracker/?func=detail&aid=2957794&group_id=95717&atid=612384 (Words2, partly Words3)
|
|
1338
|
-
keyword: /\b(?:(?:__)?(?:constant|global|kernel|local|private|read_only|read_write|write_only)|__attribute__|auto|(?:bool|u?(?:char|int|long|short)|half|quad)(?:2|3|4|8|16)?|break|case|complex|const|continue|(?:double|float)(?:16(?:x(?:1|2|4|8|16))?|1x(?:1|2|4|8|16)|2(?:x(?:1|2|4|8|16))?|3|4(?:x(?:1|2|4|8|16))?|8(?:x(?:1|2|4|8|16))?)?|default|do|else|enum|extern|for|goto|if|imaginary|inline|packed|pipe|register|restrict|return|signed|sizeof|static|struct|switch|typedef|uniform|union|unsigned|void|volatile|while)\b/,
|
|
1339
|
-
// Extracted from http://streamcomputing.eu/downloads/?opencl.lang (opencl-const)
|
|
1340
|
-
// Math Constants: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/mathConstants.html
|
|
1341
|
-
// Macros and Limits: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/macroLimits.html
|
|
1342
|
-
number: /(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[fuhl]{0,4}/i,
|
|
1343
|
-
boolean: q,
|
|
1344
|
-
"constant-opencl-kernel": {
|
|
1345
|
-
pattern: /\b(?:CHAR_(?:BIT|MAX|MIN)|CLK_(?:ADDRESS_(?:CLAMP(?:_TO_EDGE)?|NONE|REPEAT)|FILTER_(?:LINEAR|NEAREST)|(?:GLOBAL|LOCAL)_MEM_FENCE|NORMALIZED_COORDS_(?:FALSE|TRUE))|CL_(?:BGRA|(?:HALF_)?FLOAT|INTENSITY|LUMINANCE|A?R?G?B?[Ax]?|(?:(?:UN)?SIGNED|[US]NORM)_(?:INT(?:8|16|32))|UNORM_(?:INT_101010|SHORT_(?:555|565)))|(?:DBL|FLT|HALF)_(?:DIG|EPSILON|(?:MAX|MIN)(?:(?:_10)?_EXP)?|MANT_DIG)|FLT_RADIX|HUGE_VALF?|(?:INT|LONG|SCHAR|SHRT)_(?:MAX|MIN)|INFINITY|MAXFLOAT|M_(?:[12]_PI|2_SQRTPI|E|LN2|LN10|LOG2E?|LOG10E?|PI(?:_[24])?|SQRT(?:1_2|2))(?:_F|_H)?|NAN|(?:UCHAR|UINT|ULONG|USHRT)_MAX)\b/,
|
|
1346
|
-
alias: "constant"
|
|
1347
|
-
}
|
|
1348
|
-
}),
|
|
1349
|
-
"class-name",
|
|
1350
|
-
{
|
|
1351
|
-
// https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/scalarDataTypes.html
|
|
1352
|
-
// https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/otherDataTypes.html
|
|
1353
|
-
"builtin-type": {
|
|
1354
|
-
pattern: /\b(?:_cl_(?:command_queue|context|device_id|event|kernel|mem|platform_id|program|sampler)|cl_(?:image_format|mem_fence_flags)|clk_event_t|event_t|image(?:1d_(?:array_|buffer_)?t|2d_(?:array_(?:depth_|msaa_depth_|msaa_)?|depth_|msaa_depth_|msaa_)?t|3d_t)|ndrange_t|ptrdiff_t|queue_t|reserve_id_t|sampler_t|size_t|u?intptr_t)\b/,
|
|
1355
|
-
alias: "keyword"
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
);
|
|
1359
|
-
var mt = {
|
|
1360
|
-
// Extracted from http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-types and opencl-host)
|
|
1361
|
-
"type-opencl-host": {
|
|
1362
|
-
pattern: /\b(?:cl_(?:GLenum|GLint|GLuin|addressing_mode|bitfield|bool|buffer_create_type|build_status|channel_(?:order|type)|(?:u?(?:char|int|long|short)|double|float)(?:[2348]|16)?|command_(?:queue(?:_info|_properties)?|type)|context(?:_info|_properties)?|device_(?:exec_capabilities|fp_config|id|info|local_mem_type|mem_cache_type|type)|(?:event|sampler)(?:_info)?|filter_mode|half|image_info|kernel(?:_info|_work_group_info)?|map_flags|mem(?:_flags|_info|_object_type)?|platform_(?:id|info)|profiling_info|program(?:_build_info|_info)?))\b/,
|
|
1363
|
-
alias: "keyword"
|
|
1364
|
-
},
|
|
1365
|
-
"boolean-opencl-host": {
|
|
1366
|
-
pattern: /\bCL_(?:FALSE|TRUE)\b/,
|
|
1367
|
-
alias: "boolean"
|
|
1368
|
-
},
|
|
1369
|
-
// Extracted from cl.h (2.0) and http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-const)
|
|
1370
|
-
"constant-opencl-host": {
|
|
1371
|
-
pattern: /\bCL_(?:A|ABGR|ADDRESS_(?:CLAMP(?:_TO_EDGE)?|MIRRORED_REPEAT|NONE|REPEAT)|ARGB|BLOCKING|BUFFER_CREATE_TYPE_REGION|BUILD_(?:ERROR|IN_PROGRESS|NONE|PROGRAM_FAILURE|SUCCESS)|COMMAND_(?:ACQUIRE_GL_OBJECTS|BARRIER|COPY_(?:BUFFER(?:_RECT|_TO_IMAGE)?|IMAGE(?:_TO_BUFFER)?)|FILL_(?:BUFFER|IMAGE)|MAP(?:_BUFFER|_IMAGE)|MARKER|MIGRATE(?:_SVM)?_MEM_OBJECTS|NATIVE_KERNEL|NDRANGE_KERNEL|READ_(?:BUFFER(?:_RECT)?|IMAGE)|RELEASE_GL_OBJECTS|SVM_(?:FREE|MAP|MEMCPY|MEMFILL|UNMAP)|TASK|UNMAP_MEM_OBJECT|USER|WRITE_(?:BUFFER(?:_RECT)?|IMAGE))|COMPILER_NOT_AVAILABLE|COMPILE_PROGRAM_FAILURE|COMPLETE|CONTEXT_(?:DEVICES|INTEROP_USER_SYNC|NUM_DEVICES|PLATFORM|PROPERTIES|REFERENCE_COUNT)|DEPTH(?:_STENCIL)?|DEVICE_(?:ADDRESS_BITS|AFFINITY_DOMAIN_(?:L[1-4]_CACHE|NEXT_PARTITIONABLE|NUMA)|AVAILABLE|BUILT_IN_KERNELS|COMPILER_AVAILABLE|DOUBLE_FP_CONFIG|ENDIAN_LITTLE|ERROR_CORRECTION_SUPPORT|EXECUTION_CAPABILITIES|EXTENSIONS|GLOBAL_(?:MEM_(?:CACHELINE_SIZE|CACHE_SIZE|CACHE_TYPE|SIZE)|VARIABLE_PREFERRED_TOTAL_SIZE)|HOST_UNIFIED_MEMORY|IL_VERSION|IMAGE(?:2D_MAX_(?:HEIGHT|WIDTH)|3D_MAX_(?:DEPTH|HEIGHT|WIDTH)|_BASE_ADDRESS_ALIGNMENT|_MAX_ARRAY_SIZE|_MAX_BUFFER_SIZE|_PITCH_ALIGNMENT|_SUPPORT)|LINKER_AVAILABLE|LOCAL_MEM_SIZE|LOCAL_MEM_TYPE|MAX_(?:CLOCK_FREQUENCY|COMPUTE_UNITS|CONSTANT_ARGS|CONSTANT_BUFFER_SIZE|GLOBAL_VARIABLE_SIZE|MEM_ALLOC_SIZE|NUM_SUB_GROUPS|ON_DEVICE_(?:EVENTS|QUEUES)|PARAMETER_SIZE|PIPE_ARGS|READ_IMAGE_ARGS|READ_WRITE_IMAGE_ARGS|SAMPLERS|WORK_GROUP_SIZE|WORK_ITEM_DIMENSIONS|WORK_ITEM_SIZES|WRITE_IMAGE_ARGS)|MEM_BASE_ADDR_ALIGN|MIN_DATA_TYPE_ALIGN_SIZE|NAME|NATIVE_VECTOR_WIDTH_(?:CHAR|DOUBLE|FLOAT|HALF|INT|LONG|SHORT)|NOT_(?:AVAILABLE|FOUND)|OPENCL_C_VERSION|PARENT_DEVICE|PARTITION_(?:AFFINITY_DOMAIN|BY_AFFINITY_DOMAIN|BY_COUNTS|BY_COUNTS_LIST_END|EQUALLY|FAILED|MAX_SUB_DEVICES|PROPERTIES|TYPE)|PIPE_MAX_(?:ACTIVE_RESERVATIONS|PACKET_SIZE)|PLATFORM|PREFERRED_(?:GLOBAL_ATOMIC_ALIGNMENT|INTEROP_USER_SYNC|LOCAL_ATOMIC_ALIGNMENT|PLATFORM_ATOMIC_ALIGNMENT|VECTOR_WIDTH_(?:CHAR|DOUBLE|FLOAT|HALF|INT|LONG|SHORT))|PRINTF_BUFFER_SIZE|PROFILE|PROFILING_TIMER_RESOLUTION|QUEUE_(?:ON_(?:DEVICE_(?:MAX_SIZE|PREFERRED_SIZE|PROPERTIES)|HOST_PROPERTIES)|PROPERTIES)|REFERENCE_COUNT|SINGLE_FP_CONFIG|SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS|SVM_(?:ATOMICS|CAPABILITIES|COARSE_GRAIN_BUFFER|FINE_GRAIN_BUFFER|FINE_GRAIN_SYSTEM)|TYPE(?:_ACCELERATOR|_ALL|_CPU|_CUSTOM|_DEFAULT|_GPU)?|VENDOR(?:_ID)?|VERSION)|DRIVER_VERSION|EVENT_(?:COMMAND_(?:EXECUTION_STATUS|QUEUE|TYPE)|CONTEXT|REFERENCE_COUNT)|EXEC_(?:KERNEL|NATIVE_KERNEL|STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST)|FILTER_(?:LINEAR|NEAREST)|FLOAT|FP_(?:CORRECTLY_ROUNDED_DIVIDE_SQRT|DENORM|FMA|INF_NAN|ROUND_TO_INF|ROUND_TO_NEAREST|ROUND_TO_ZERO|SOFT_FLOAT)|GLOBAL|HALF_FLOAT|IMAGE_(?:ARRAY_SIZE|BUFFER|DEPTH|ELEMENT_SIZE|FORMAT|FORMAT_MISMATCH|FORMAT_NOT_SUPPORTED|HEIGHT|NUM_MIP_LEVELS|NUM_SAMPLES|ROW_PITCH|SLICE_PITCH|WIDTH)|INTENSITY|INVALID_(?:ARG_INDEX|ARG_SIZE|ARG_VALUE|BINARY|BUFFER_SIZE|BUILD_OPTIONS|COMMAND_QUEUE|COMPILER_OPTIONS|CONTEXT|DEVICE|DEVICE_PARTITION_COUNT|DEVICE_QUEUE|DEVICE_TYPE|EVENT|EVENT_WAIT_LIST|GLOBAL_OFFSET|GLOBAL_WORK_SIZE|GL_OBJECT|HOST_PTR|IMAGE_DESCRIPTOR|IMAGE_FORMAT_DESCRIPTOR|IMAGE_SIZE|KERNEL|KERNEL_ARGS|KERNEL_DEFINITION|KERNEL_NAME|LINKER_OPTIONS|MEM_OBJECT|MIP_LEVEL|OPERATION|PIPE_SIZE|PLATFORM|PROGRAM|PROGRAM_EXECUTABLE|PROPERTY|QUEUE_PROPERTIES|SAMPLER|VALUE|WORK_DIMENSION|WORK_GROUP_SIZE|WORK_ITEM_SIZE)|KERNEL_(?:ARG_(?:ACCESS_(?:NONE|QUALIFIER|READ_ONLY|READ_WRITE|WRITE_ONLY)|ADDRESS_(?:CONSTANT|GLOBAL|LOCAL|PRIVATE|QUALIFIER)|INFO_NOT_AVAILABLE|NAME|TYPE_(?:CONST|NAME|NONE|PIPE|QUALIFIER|RESTRICT|VOLATILE))|ATTRIBUTES|COMPILE_NUM_SUB_GROUPS|COMPILE_WORK_GROUP_SIZE|CONTEXT|EXEC_INFO_SVM_FINE_GRAIN_SYSTEM|EXEC_INFO_SVM_PTRS|FUNCTION_NAME|GLOBAL_WORK_SIZE|LOCAL_MEM_SIZE|LOCAL_SIZE_FOR_SUB_GROUP_COUNT|MAX_NUM_SUB_GROUPS|MAX_SUB_GROUP_SIZE_FOR_NDRANGE|NUM_ARGS|PREFERRED_WORK_GROUP_SIZE_MULTIPLE|PRIVATE_MEM_SIZE|PROGRAM|REFERENCE_COUNT|SUB_GROUP_COUNT_FOR_NDRANGE|WORK_GROUP_SIZE)|LINKER_NOT_AVAILABLE|LINK_PROGRAM_FAILURE|LOCAL|LUMINANCE|MAP_(?:FAILURE|READ|WRITE|WRITE_INVALIDATE_REGION)|MEM_(?:ALLOC_HOST_PTR|ASSOCIATED_MEMOBJECT|CONTEXT|COPY_HOST_PTR|COPY_OVERLAP|FLAGS|HOST_NO_ACCESS|HOST_PTR|HOST_READ_ONLY|HOST_WRITE_ONLY|KERNEL_READ_AND_WRITE|MAP_COUNT|OBJECT_(?:ALLOCATION_FAILURE|BUFFER|IMAGE1D|IMAGE1D_ARRAY|IMAGE1D_BUFFER|IMAGE2D|IMAGE2D_ARRAY|IMAGE3D|PIPE)|OFFSET|READ_ONLY|READ_WRITE|REFERENCE_COUNT|SIZE|SVM_ATOMICS|SVM_FINE_GRAIN_BUFFER|TYPE|USES_SVM_POINTER|USE_HOST_PTR|WRITE_ONLY)|MIGRATE_MEM_OBJECT_(?:CONTENT_UNDEFINED|HOST)|MISALIGNED_SUB_BUFFER_OFFSET|NONE|NON_BLOCKING|OUT_OF_(?:HOST_MEMORY|RESOURCES)|PIPE_(?:MAX_PACKETS|PACKET_SIZE)|PLATFORM_(?:EXTENSIONS|HOST_TIMER_RESOLUTION|NAME|PROFILE|VENDOR|VERSION)|PROFILING_(?:COMMAND_(?:COMPLETE|END|QUEUED|START|SUBMIT)|INFO_NOT_AVAILABLE)|PROGRAM_(?:BINARIES|BINARY_SIZES|BINARY_TYPE(?:_COMPILED_OBJECT|_EXECUTABLE|_LIBRARY|_NONE)?|BUILD_(?:GLOBAL_VARIABLE_TOTAL_SIZE|LOG|OPTIONS|STATUS)|CONTEXT|DEVICES|IL|KERNEL_NAMES|NUM_DEVICES|NUM_KERNELS|REFERENCE_COUNT|SOURCE)|QUEUED|QUEUE_(?:CONTEXT|DEVICE|DEVICE_DEFAULT|ON_DEVICE|ON_DEVICE_DEFAULT|OUT_OF_ORDER_EXEC_MODE_ENABLE|PROFILING_ENABLE|PROPERTIES|REFERENCE_COUNT|SIZE)|RA?|READ_(?:ONLY|WRITE)_CACHE|RG|RGB[Ax]?|RG?x|RUNNING|SAMPLER_(?:ADDRESSING_MODE|CONTEXT|FILTER_MODE|LOD_MAX|LOD_MIN|MIP_FILTER_MODE|NORMALIZED_COORDS|REFERENCE_COUNT)|(?:UN)?SIGNED_INT(?:8|16|32)|SNORM_INT(?:8|16)|SUBMITTED|SUCCESS|UNORM_INT(?:8|16|24|_101010|_101010_2)|UNORM_SHORT_5[56]5|VERSION_(?:1_[012]|2_[01])|s?BGRA|sRGB[Ax]?)\b/,
|
|
1372
|
-
alias: "constant"
|
|
1373
|
-
},
|
|
1374
|
-
// Extracted from cl.h (2.0) and http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-host)
|
|
1375
|
-
"function-opencl-host": {
|
|
1376
|
-
pattern: /\bcl(?:BuildProgram|CloneKernel|CompileProgram|Create(?:Buffer|CommandQueue(?:WithProperties)?|Context|ContextFromType|Image|Image[23]D|Kernel|KernelsInProgram|Pipe|ProgramWith(?:Binary|BuiltInKernels|IL|Source)|Sampler|SamplerWithProperties|SubBuffer|SubDevices|UserEvent)|Enqueue(?:(?:Barrier|Marker)(?:WithWaitList)?|Copy(?:Buffer(?:Rect|ToImage)?|Image(?:ToBuffer)?)|(?:Fill|Map)(?:Buffer|Image)|MigrateMemObjects|NDRangeKernel|NativeKernel|(?:Read|Write)(?:Buffer(?:Rect)?|Image)|SVM(?:Free|Map|MemFill|Memcpy|MigrateMem|Unmap)|Task|UnmapMemObject|WaitForEvents)|Finish|Flush|Get(?:CommandQueueInfo|ContextInfo|Device(?:AndHostTimer|IDs|Info)|Event(?:Profiling)?Info|ExtensionFunctionAddress(?:ForPlatform)?|HostTimer|ImageInfo|Kernel(?:ArgInfo|Info|SubGroupInfo|WorkGroupInfo)|MemObjectInfo|PipeInfo|Platform(?:IDs|Info)|Program(?:Build)?Info|SamplerInfo|SupportedImageFormats)|LinkProgram|(?:Release|Retain)(?:CommandQueue|Context|Device|Event|Kernel|MemObject|Program|Sampler)|SVM(?:Alloc|Free)|Set(?:CommandQueueProperty|DefaultDeviceCommandQueue|EventCallback|Kernel|Kernel(?:Arg(?:SVMPointer)?|ExecInfo)|MemObjectDestructorCallback|UserEventStatus)|Unload(?:Platform)?Compiler|WaitForEvents)\b/,
|
|
1377
|
-
alias: "function"
|
|
1378
|
-
}
|
|
1379
|
-
};
|
|
1380
|
-
$(_.c, "keyword", mt);
|
|
1381
|
-
_.cpp && (mt["type-opencl-host-cpp"] = {
|
|
1382
|
-
pattern: /\b(?:Buffer|BufferGL|BufferRenderGL|CommandQueue|Context|Device|DeviceCommandQueue|EnqueueArgs|Event|Image(?:[123]D|[12]DArray|1DBuffer|[23]DGL|Format|GL)?|Kernel|KernelFunctor|LocalSpaceArg|Memory|NDRange|Pipe|Platform|Program|SVMAllocator|SVMTrait(?:Atomic|Coarse|Fine|ReadOnly|ReadWrite|WriteOnly)|Sampler|UserEvent)\b/,
|
|
1383
|
-
alias: "keyword"
|
|
1384
|
-
}, $(_.cpp, "keyword", mt));
|
|
1385
|
-
var $a = _.diff = {
|
|
1386
|
-
// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
|
|
1387
|
-
// Match "@@ ... @@" coord lines in unified diff.
|
|
1388
|
-
// Match coord lines in normal diff (starts with a number).
|
|
1389
|
-
coord: /^(?:\*{3}|-{3}|\+{3}|\d).*$|^@@.*@@$/m
|
|
1390
|
-
// deleted, inserted, unchanged, diff
|
|
1391
|
-
}, st = {
|
|
1392
|
-
"deleted-sign": "-",
|
|
1393
|
-
"deleted-arrow": "<",
|
|
1394
|
-
"inserted-sign": "+",
|
|
1395
|
-
"inserted-arrow": ">",
|
|
1396
|
-
unchanged: " ",
|
|
1397
|
-
diff: "!"
|
|
1398
|
-
};
|
|
1399
|
-
for (var ce in st) {
|
|
1400
|
-
var ot = ce.split("-")[0];
|
|
1401
|
-
$a[ce] = {
|
|
1402
|
-
pattern: RegExp("^(?:[" + st[ce] + `].*$
|
|
1403
|
-
?)+`, "m"),
|
|
1404
|
-
alias: ot != ce ? ot : ce == "diff" ? "bold" : void 0,
|
|
1405
|
-
inside: {
|
|
1406
|
-
prefix: {
|
|
1407
|
-
pattern: RegExp("^[" + st[ce] + "]", "mg"),
|
|
1408
|
-
greedy: !0,
|
|
1409
|
-
alias: ot
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
};
|
|
1413
|
-
}
|
|
1414
|
-
var lt = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|opens?|package|permits|private|protected|provides|public|record(?!\s*[()[\]{}%~.,:;?%&|^=<>/*+-])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throws?|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/, Ie = "(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*", ht = {
|
|
1415
|
-
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
|
1416
|
-
inside: {
|
|
1417
|
-
punctuation: /\./
|
|
1418
|
-
}
|
|
1419
|
-
}, _t = {
|
|
1420
|
-
namespace: ht,
|
|
1421
|
-
punctuation: /\./
|
|
1422
|
-
}, tn = {
|
|
1423
|
-
pattern: RegExp(`(^|[^\\w.])${Ie}[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b`),
|
|
1424
|
-
lookbehind: !0,
|
|
1425
|
-
inside: _t
|
|
1426
|
-
};
|
|
1427
|
-
_.java = {
|
|
1428
|
-
"doc-comment": {
|
|
1429
|
-
pattern: /\/\*\*(?!\/)[^]*?(?:\*\/|$)/g,
|
|
1430
|
-
greedy: !0,
|
|
1431
|
-
alias: "comment",
|
|
1432
|
-
inside: "javadoc"
|
|
1433
|
-
},
|
|
1434
|
-
comment: re(),
|
|
1435
|
-
"triple-quoted-string": {
|
|
1436
|
-
// http://openjdk.java.net/jeps/355#Description
|
|
1437
|
-
pattern: /"""[ ]*\n(?:\\.|[^\\])*?"""/g,
|
|
1438
|
-
greedy: !0,
|
|
1439
|
-
alias: "string"
|
|
1440
|
-
},
|
|
1441
|
-
char: {
|
|
1442
|
-
pattern: /'(?:\\.|[^\\\n']){1,6}'/g,
|
|
1443
|
-
greedy: !0
|
|
1444
|
-
},
|
|
1445
|
-
string: {
|
|
1446
|
-
pattern: /(^|[^\\])"(?:\\.|[^\\\n"])*"/g,
|
|
1447
|
-
lookbehind: !0,
|
|
1448
|
-
greedy: !0
|
|
1449
|
-
},
|
|
1450
|
-
annotation: {
|
|
1451
|
-
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
|
1452
|
-
lookbehind: !0,
|
|
1453
|
-
alias: "punctuation"
|
|
1454
|
-
},
|
|
1455
|
-
generics: {
|
|
1456
|
-
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
|
1457
|
-
inside: {
|
|
1458
|
-
"class-name": tn,
|
|
1459
|
-
keyword: lt,
|
|
1460
|
-
punctuation: /[().,:<>]/,
|
|
1461
|
-
operator: /[?&|]/
|
|
1462
|
-
}
|
|
1463
|
-
},
|
|
1464
|
-
import: [
|
|
1465
|
-
{
|
|
1466
|
-
pattern: RegExp(`(\\bimport\\s+)${Ie}(?:[A-Z]\\w*|\\*)(?=\\s*;)`),
|
|
1467
|
-
lookbehind: !0,
|
|
1468
|
-
inside: {
|
|
1469
|
-
namespace: ht,
|
|
1470
|
-
punctuation: /\./,
|
|
1471
|
-
operator: /\*/,
|
|
1472
|
-
"class-name": /\w+/
|
|
1473
|
-
}
|
|
1474
|
-
},
|
|
1475
|
-
{
|
|
1476
|
-
pattern: RegExp(`(\\bimport\\s+static\\s+)${Ie}(?:\\w+|\\*)(?=\\s*;)`),
|
|
1477
|
-
lookbehind: !0,
|
|
1478
|
-
alias: "static",
|
|
1479
|
-
inside: {
|
|
1480
|
-
namespace: ht,
|
|
1481
|
-
static: /\b\w+$/,
|
|
1482
|
-
punctuation: /\./,
|
|
1483
|
-
operator: /\*/,
|
|
1484
|
-
"class-name": /\w+/
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
],
|
|
1488
|
-
namespace: {
|
|
1489
|
-
pattern: RegExp(
|
|
1490
|
-
`(\\b(?:exports|import(?:\\s+static)?|module|opens?|package|provides|requires|to|transitive|uses|with)\\s+)(?!${lt.source})[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?`
|
|
1491
|
-
),
|
|
1492
|
-
lookbehind: !0,
|
|
1493
|
-
inside: {
|
|
1494
|
-
punctuation: /\./
|
|
1495
|
-
}
|
|
1496
|
-
},
|
|
1497
|
-
"class-name": [
|
|
1498
|
-
tn,
|
|
1499
|
-
{
|
|
1500
|
-
// variables, parameters, and constructor references
|
|
1501
|
-
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
1502
|
-
pattern: RegExp(`(^|[^\\w.])${Ie}[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)`),
|
|
1503
|
-
lookbehind: !0,
|
|
1504
|
-
inside: _t
|
|
1505
|
-
},
|
|
1506
|
-
{
|
|
1507
|
-
// class names based on keyword
|
|
1508
|
-
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
1509
|
-
pattern: RegExp(`(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)${Ie}[A-Z]\\w*\\b`),
|
|
1510
|
-
lookbehind: !0,
|
|
1511
|
-
inside: _t
|
|
1512
|
-
}
|
|
1513
|
-
],
|
|
1514
|
-
keyword: lt,
|
|
1515
|
-
boolean: q,
|
|
1516
|
-
function: {
|
|
1517
|
-
pattern: /\b\w+(?=\()|(::\s*)[a-z_]\w*/,
|
|
1518
|
-
lookbehind: !0
|
|
1519
|
-
},
|
|
1520
|
-
number: /\b0b[01][01_]*l?\b|\b0x(?:\.[a-f\d_p+-]+|[a-f\d_]+(?:\.[a-f\d_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
|
|
1521
|
-
constant: /\b[A-Z][A-Z_\d]+\b/,
|
|
1522
|
-
operator: {
|
|
1523
|
-
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[%&|^!=<>/*+-]=?)/m,
|
|
1524
|
-
lookbehind: !0
|
|
1525
|
-
},
|
|
1526
|
-
punctuation: te
|
|
1527
|
-
};
|
|
1528
|
-
$(
|
|
1529
|
-
_.less = ae("css", {
|
|
1530
|
-
comment: re(),
|
|
1531
|
-
atrule: {
|
|
1532
|
-
pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,
|
|
1533
|
-
inside: {
|
|
1534
|
-
punctuation: /[():]/
|
|
1535
|
-
}
|
|
1536
|
-
},
|
|
1537
|
-
// selectors and mixins are considered the same
|
|
1538
|
-
selector: {
|
|
1539
|
-
pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,
|
|
1540
|
-
inside: {
|
|
1541
|
-
// mixin parameters
|
|
1542
|
-
variable: /@+[\w-]+/
|
|
1543
|
-
}
|
|
1544
|
-
},
|
|
1545
|
-
property: /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,
|
|
1546
|
-
operator: /[/*+-]/
|
|
1547
|
-
}),
|
|
1548
|
-
"property",
|
|
1549
|
-
{
|
|
1550
|
-
variable: [
|
|
1551
|
-
// Variable declaration (the colon must be consumed!)
|
|
1552
|
-
{
|
|
1553
|
-
pattern: /@[\w-]+\s*:/,
|
|
1554
|
-
inside: {
|
|
1555
|
-
punctuation: /:/
|
|
1556
|
-
}
|
|
1557
|
-
},
|
|
1558
|
-
// Variable usage
|
|
1559
|
-
/@@?[\w-]+/
|
|
1560
|
-
],
|
|
1561
|
-
"mixin-usage": {
|
|
1562
|
-
pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
|
|
1563
|
-
lookbehind: !0,
|
|
1564
|
-
alias: "function"
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
);
|
|
1568
|
-
_.objc = _.objectivec = ae("c", {
|
|
1569
|
-
string: {
|
|
1570
|
-
pattern: /@?"(?:\\[^]|[^\\\n"])*"/g,
|
|
1571
|
-
greedy: !0
|
|
1572
|
-
},
|
|
1573
|
-
keyword: /\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int?|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,
|
|
1574
|
-
operator: /-[->]?|\+\+?|!=?|==?|>>?=?|<<?=?|&&?|\|\|?|[~^@%?/*]/
|
|
1575
|
-
});
|
|
1576
|
-
delete _.objc["class-name"];
|
|
1577
|
-
var Dn = {
|
|
1578
|
-
pattern: /^(..)[^]+(?=.)/,
|
|
1579
|
-
lookbehind: !0
|
|
1580
|
-
}, ct = "(?:([^a-zA-Z\\d\\s{(\\[<=])(?:\\\\[\\s\\S]|(?!\\1)[^\\\\])*\\1|\\((?:\\\\[\\s\\S]|[^\\\\()]|\\((?:\\\\[\\s\\S]|[^\\\\()])*\\))*\\)|\\{(?:\\\\[\\s\\S]|[^\\\\{}]|\\{(?:\\\\[\\s\\S]|[^\\\\{}])*\\})*\\}|\\[(?:\\\\[\\s\\S]|[^\\\\[\\]]|\\[(?:\\\\[\\s\\S]|[^\\\\[\\]])*\\])*\\]|<(?:\\\\[\\s\\S]|[^\\\\<>]|<(?:\\\\[\\s\\S]|[^\\\\<>])*>)*>)", nn = `(?:"(?:\\\\.|[^\\\\
|
|
1581
|
-
"])*"|(?:\\b(?!\\d)\\w+|[^\\s\0-\\x7f]+)[?!]?|\\$.)`, se = {
|
|
1582
|
-
pattern: /((?:^|[^\\])(?:\\\\)*)#\{(?:[^{}]|\{[^}]*\})*\}/,
|
|
1583
|
-
lookbehind: !0,
|
|
1584
|
-
inside: {
|
|
1585
|
-
content: Dn,
|
|
1586
|
-
delimiter: {
|
|
1587
|
-
pattern: /.+/,
|
|
1588
|
-
alias: "punctuation"
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
};
|
|
1592
|
-
Dn.inside = _.rb = _.ruby = {
|
|
1593
|
-
comment: {
|
|
1594
|
-
pattern: /#.*|^=begin\s[^]*?^=end/mg,
|
|
1595
|
-
greedy: !0
|
|
1596
|
-
},
|
|
1597
|
-
"string-literal": [
|
|
1598
|
-
{
|
|
1599
|
-
pattern: RegExp("%[qQiIwWs]?" + ct, "g"),
|
|
1600
|
-
greedy: !0,
|
|
1601
|
-
inside: {
|
|
1602
|
-
interpolation: se,
|
|
1603
|
-
string: /[^]+/
|
|
1604
|
-
}
|
|
1605
|
-
},
|
|
1606
|
-
{
|
|
1607
|
-
pattern: /(["'])(?:#\{[^}]+\}|#(?!\{)|\\[^]|(?!\1)[^\\#\n])*\1/g,
|
|
1608
|
-
greedy: !0,
|
|
1609
|
-
inside: {
|
|
1610
|
-
interpolation: se,
|
|
1611
|
-
string: /[^]+/
|
|
1612
|
-
}
|
|
1613
|
-
},
|
|
1614
|
-
{
|
|
1615
|
-
pattern: /<<[-~]?([a-z_]\w*)\n(?:.*\n)*?[ ]*\1/gi,
|
|
1616
|
-
alias: "heredoc-string",
|
|
1617
|
-
greedy: !0,
|
|
1618
|
-
inside: {
|
|
1619
|
-
delimiter: {
|
|
1620
|
-
pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
|
|
1621
|
-
inside: {
|
|
1622
|
-
symbol: /\w+/,
|
|
1623
|
-
punctuation: /^<<[-~]?/
|
|
1624
|
-
}
|
|
1625
|
-
},
|
|
1626
|
-
interpolation: se,
|
|
1627
|
-
string: /[^]+/
|
|
1628
|
-
}
|
|
1629
|
-
},
|
|
1630
|
-
{
|
|
1631
|
-
pattern: /<<[-~]?'([a-z_]\w*)'\n(?:.*\n)*?[ ]*\1/gi,
|
|
1632
|
-
alias: "heredoc-string",
|
|
1633
|
-
greedy: !0,
|
|
1634
|
-
inside: {
|
|
1635
|
-
delimiter: {
|
|
1636
|
-
pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
|
|
1637
|
-
inside: {
|
|
1638
|
-
symbol: /\w+/,
|
|
1639
|
-
punctuation: /^<<[-~]?'|'$/
|
|
1640
|
-
}
|
|
1641
|
-
},
|
|
1642
|
-
string: /[^]+/
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
],
|
|
1646
|
-
"command-literal": [
|
|
1647
|
-
{
|
|
1648
|
-
pattern: RegExp("%x" + ct, "g"),
|
|
1649
|
-
greedy: !0,
|
|
1650
|
-
inside: {
|
|
1651
|
-
interpolation: se,
|
|
1652
|
-
command: {
|
|
1653
|
-
pattern: /[^]+/,
|
|
1654
|
-
alias: "string"
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
},
|
|
1658
|
-
{
|
|
1659
|
-
pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\[^]|[^\\`#\n])*`/g,
|
|
1660
|
-
greedy: !0,
|
|
1661
|
-
inside: {
|
|
1662
|
-
interpolation: se,
|
|
1663
|
-
command: {
|
|
1664
|
-
pattern: /[^]+/,
|
|
1665
|
-
alias: "string"
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
],
|
|
1670
|
-
"class-name": {
|
|
1671
|
-
pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
|
|
1672
|
-
lookbehind: !0,
|
|
1673
|
-
inside: {
|
|
1674
|
-
punctuation: /[.\\]/
|
|
1675
|
-
}
|
|
1676
|
-
},
|
|
1677
|
-
"regex-literal": [
|
|
1678
|
-
{
|
|
1679
|
-
pattern: RegExp(`%r${ct}[egimnosux]{0,6}`, "g"),
|
|
1680
|
-
greedy: !0,
|
|
1681
|
-
inside: {
|
|
1682
|
-
interpolation: se,
|
|
1683
|
-
regex: /[^]+/
|
|
1684
|
-
}
|
|
1685
|
-
},
|
|
1686
|
-
{
|
|
1687
|
-
pattern: /(^|[^/])\/(?!\/)(?:\[[^\n\]]+\]|\\.|[^\\\n/[])+\/[egimnosux]{0,6}(?=\s*(?:$|[\n,.;})#]))/g,
|
|
1688
|
-
lookbehind: !0,
|
|
1689
|
-
greedy: !0,
|
|
1690
|
-
inside: {
|
|
1691
|
-
interpolation: se,
|
|
1692
|
-
regex: /[^]+/
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
],
|
|
1696
|
-
variable: /[@$]+(?!\d)\w+(?:[?!]|\b)/,
|
|
1697
|
-
symbol: [
|
|
1698
|
-
{
|
|
1699
|
-
pattern: RegExp("(^|[^:]):" + nn, "g"),
|
|
1700
|
-
lookbehind: !0,
|
|
1701
|
-
greedy: !0
|
|
1702
|
-
},
|
|
1703
|
-
{
|
|
1704
|
-
pattern: RegExp(`([
|
|
1705
|
-
{(,][ ]*)` + nn + "(?=:(?!:))", "g"),
|
|
1706
|
-
lookbehind: !0,
|
|
1707
|
-
greedy: !0
|
|
1708
|
-
}
|
|
1709
|
-
],
|
|
1710
|
-
"method-definition": {
|
|
1711
|
-
pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
|
|
1712
|
-
lookbehind: !0,
|
|
1713
|
-
inside: {
|
|
1714
|
-
function: /\b\w+$/,
|
|
1715
|
-
keyword: /^self\b/,
|
|
1716
|
-
"class-name": /^\w+/,
|
|
1717
|
-
punctuation: /\./
|
|
1718
|
-
}
|
|
1719
|
-
},
|
|
1720
|
-
keyword: /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|f?or|if|in|include|module|new|next|nil|not|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|[tw]hen|throw|undef|unless|until|while|yield)\b/,
|
|
1721
|
-
boolean: q,
|
|
1722
|
-
builtin: /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,
|
|
1723
|
-
constant: /\b[A-Z][A-Z\d_]*(?:[?!]|\b)/,
|
|
1724
|
-
number: Mn,
|
|
1725
|
-
"double-colon": {
|
|
1726
|
-
pattern: /::/,
|
|
1727
|
-
alias: "punctuation"
|
|
1728
|
-
},
|
|
1729
|
-
operator: /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[%&|^!=<>/*+-])=?|[?:]/,
|
|
1730
|
-
punctuation: /[()[\]{}.,;]/
|
|
1731
|
-
};
|
|
1732
|
-
_.sql = {
|
|
1733
|
-
comment: /\/\*[^]*?\*\/|(?:--|\/\/|#).*/,
|
|
1734
|
-
variable: [
|
|
1735
|
-
{
|
|
1736
|
-
pattern: /@(["'`])(?:\\[^]|(?!\1)[^\\])+\1/g,
|
|
1737
|
-
greedy: !0
|
|
1738
|
-
},
|
|
1739
|
-
/@[\w.$]+/
|
|
1740
|
-
],
|
|
1741
|
-
string: {
|
|
1742
|
-
pattern: /(^|[^@\\])(["'])(?:\\[^]|(?!\2)[^\\]|\2\2)*\2/g,
|
|
1743
|
-
lookbehind: !0,
|
|
1744
|
-
greedy: !0
|
|
1745
|
-
},
|
|
1746
|
-
identifier: {
|
|
1747
|
-
pattern: /(^|[^@\\])`(?:\\[^]|[^\\`]|``)*`/g,
|
|
1748
|
-
lookbehind: !0,
|
|
1749
|
-
greedy: !0,
|
|
1750
|
-
inside: {
|
|
1751
|
-
punctuation: /^`|`$/
|
|
1752
|
-
}
|
|
1753
|
-
},
|
|
1754
|
-
function: /\b(?:avg|count|first|format|last|[lu]case|len|max|mi[dn]|mod|now|round|sum)(?=\s*\()/i,
|
|
1755
|
-
// Should we highlight user defined functions too?
|
|
1756
|
-
keyword: /\b(?:action|add|after|algorithm|alter|analyze|any|apply|asc?|authorization|auto_increment|backup|bdb|begin|berkeleydb|bigint|binary|bit|blob|bool|boolean|break|browse|[br]tree|bulk|by|c?all|cascaded?|case|chain|character|charset|check(?:point)?|close|clustered|coalesce|collate|columns?|comment|commit(?:ted)?|compute|connect|consistent|constraint|contains(?:table)?|continue|convert|create|cross|current(?:_date|_time|_timestamp|_user)?|cursor|cycle|data(?:bases?)?|date(?:time)?|day|dbcc|deallocate|dec|decimal|declare|default|definer|delayed|delete|delimiters?|deny|desc|describe|deterministic|disable|discard|disk|distinct|distinctrow|distributed|do|double|drop|dummy|dump(?:file)?|duplicate|else(?:if)?|enable|enclosed|end|engine|enum|errlvl|errors|escaped?|except|exec(?:ute)?|exists|exit|explain|extended|fetch|fields|file|fillfactor|first|fixed|float|following|for each row|for|force|foreign|freetexttable|freetext|from|full|function|geometry(?:collection)?|global|goto|grant|group|handler|hash|having|holdlock|hour|identity(?:col|_insert)?|if|ignore|import|index|infile|inner|innodb|inout|insert|integer|intersect|interval|into?|invoker|isolation|iterate|join|keys?|kill|language|last|leave|left|level|limit|lineno|lines|linestring|load|local|lock|long(?:blob|text)|loop|matched|match|(?:medium|tiny)(?:blob|int|text)|merge|middleint|minute|mode|modifies|modify|month|multi(?:linestring|point|polygon)|national|natural|n?char|next|no|nonclustered|nullif|numeric|off?|offsets?|on|open(?:datasource|query|rowset)?|optimize|option(?:ally)?|order|out(?:er|file)?|over|partial|partition|percent|pivot|plan|point|polygon|preceding|precision|prepare|prev|primary|print|privileges|proc(?:edure)?|public|purge|quick|raiserror|reads?|real|reconfigure|references|release|rename|repeat(?:able)?|replace|replication|require|resignal|restore|restrict|returning|returns?|revoke|right|rollback|routine|row(?:count|guidcol|s)?|rule|savepoint|save|schema|second|select|serializable|serial|session_user|session|setuser|set|share|show|shutdown|simple|smallint|snapshot|some|soname|sql|start(?:ing)?|statistics|status|striped|system_user|tables?|tablespace|temp(?:orary|table)?|terminated|textsize|text|[tw]hen|timestamp|time|top?|transactions?|tran|trigger|truncate|tsequal|types?|unbounded|uncommitted|undefined|union|unique|unlock|unpivot|unsigned|updatetext|update|usage|user?|using|values?|var(?:binary|char|character|ying)|view|waitfor|warnings|where|while|with(?: rollup|in)?|work|writetext|write|year)\b/i,
|
|
1757
|
-
boolean: /\b(?:false|true|null)\b/i,
|
|
1758
|
-
number: /\b0x[a-f\d]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
|
|
1759
|
-
operator: /[=%~^/*+-]|&&?|\|\|?|!=?|<<|<=?>?|>[>=]?|\b(?:and|between|div|[ir]?like|in|is|not|x?or|regexp|sounds like)\b/i,
|
|
1760
|
-
punctuation: /[()[\].,;`]/
|
|
1761
|
-
};
|
|
1762
|
-
_.wasm = {
|
|
1763
|
-
comment: /\(;[^]*?;\)|;;.*/,
|
|
1764
|
-
string: {
|
|
1765
|
-
pattern: /"(?:\\[^]|[^\\"])*"/g,
|
|
1766
|
-
greedy: !0
|
|
1767
|
-
},
|
|
1768
|
-
keyword: [
|
|
1769
|
-
{
|
|
1770
|
-
pattern: /\b(?:align|offset)=/,
|
|
1771
|
-
inside: {
|
|
1772
|
-
operator: /=/
|
|
1773
|
-
}
|
|
1774
|
-
},
|
|
1775
|
-
{
|
|
1776
|
-
pattern: /\b(?:(?:[fi]32|[fi]64)(?:\.(?:abs|a[dn]d|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|x?or))?|memory\.(?:grow|size))\b/,
|
|
1777
|
-
inside: {
|
|
1778
|
-
punctuation: /\./
|
|
1779
|
-
}
|
|
1780
|
-
},
|
|
1781
|
-
/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/
|
|
1782
|
-
],
|
|
1783
|
-
variable: /\$[\w!#$%&'*./:<=>?@\\^`|~+-]+/,
|
|
1784
|
-
number: /[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[a-fA-F\d](?:_?[a-fA-F\d])*(?:\.[a-fA-F\d](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[a-fA-F\d](?:_?[\da-fA-D])*)?\b/,
|
|
1785
|
-
punctuation: /[()]/
|
|
1786
|
-
};
|
|
1787
|
-
var me = (e, t) => {
|
|
1788
|
-
for (var n = 0; n < t; n++)
|
|
1789
|
-
e = e.replace(/<self>/g, `(?:${e})`);
|
|
1790
|
-
return e.replace(/<self>/g, "[]");
|
|
1791
|
-
}, F = (e, t) => e.replace(/<(\d+)>/g, (n, s) => `(?:${t[+s]})`), O = (e, t, n) => RegExp(F(e, t), n), Et = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/, ge = _.cpp = ae("c", {
|
|
1792
|
-
"class-name": [
|
|
1793
|
-
{
|
|
1794
|
-
pattern: RegExp(`(\\b(?:class|concept|enum|struct|typename)\\s+)(?!${Et.source})\\w+`),
|
|
1795
|
-
lookbehind: !0
|
|
1796
|
-
},
|
|
1797
|
-
// This is intended to capture the class name of method implementations like:
|
|
1798
|
-
// void foo::bar() const {}
|
|
1799
|
-
// However! The `foo` in the above example could also be a namespace, so we only capture the class name if
|
|
1800
|
-
// it starts with an uppercase letter. This approximation should give decent results.
|
|
1801
|
-
/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
|
|
1802
|
-
// This will capture the class name before destructors like:
|
|
1803
|
-
// Foo::~Foo() {}
|
|
1804
|
-
/\b[a-z_]\w*(?=\s*::\s*~\w+\s*\()/i,
|
|
1805
|
-
// This also intends to capture the class name of method implementations but here the class has template
|
|
1806
|
-
// parameters, so it can't be a namespace (until C++ adds generic namespaces).
|
|
1807
|
-
/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
|
|
1808
|
-
],
|
|
1809
|
-
keyword: Et,
|
|
1810
|
-
number: {
|
|
1811
|
-
pattern: /(?:\b0b[01']+|\b0x(?:[a-f\d']+(?:\.[a-f\d']*)?|\.[a-f\d']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/gi,
|
|
1812
|
-
greedy: !0
|
|
1813
|
-
},
|
|
1814
|
-
operator: /->|--|\+\+|&&|\|\||[?:~]|<=>|>>=?|<<=?|[%&|^!=<>/*+-]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|x?or|x?or_eq)\b/,
|
|
1815
|
-
boolean: q
|
|
1816
|
-
});
|
|
1817
|
-
$(ge, "string", {
|
|
1818
|
-
module: {
|
|
1819
|
-
// https://en.cppreference.com/w/cpp/language/modules
|
|
1820
|
-
pattern: O(
|
|
1821
|
-
`(\\b(?:import|module)\\s+)(?:"(?:\\\\[\\s\\S]|[^\\\\
|
|
1822
|
-
"])*"|<[^<>
|
|
1823
|
-
]*>|<0>(?:\\s*:\\s*<0>)?|:\\s*<0>)`,
|
|
1824
|
-
[`\\b(?!${Et.source})\\w+(?:\\s*\\.\\s*\\w+)*\\b`],
|
|
1825
|
-
"g"
|
|
1826
|
-
),
|
|
1827
|
-
lookbehind: !0,
|
|
1828
|
-
greedy: !0,
|
|
1829
|
-
inside: {
|
|
1830
|
-
string: /^[<"][^]+/,
|
|
1831
|
-
operator: /:/,
|
|
1832
|
-
punctuation: /\./
|
|
1833
|
-
}
|
|
1834
|
-
},
|
|
1835
|
-
"raw-string": {
|
|
1836
|
-
pattern: /R"([^()\\ ]{0,16})\([^]*?\)\1"/g,
|
|
1837
|
-
greedy: !0,
|
|
1838
|
-
alias: "string"
|
|
1839
|
-
}
|
|
1840
|
-
});
|
|
1841
|
-
$(ge, "keyword", {
|
|
1842
|
-
"generic-function": {
|
|
1843
|
-
pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
|
|
1844
|
-
inside: {
|
|
1845
|
-
function: /^\w+/,
|
|
1846
|
-
generic: {
|
|
1847
|
-
pattern: /<[^]+/,
|
|
1848
|
-
alias: "class-name",
|
|
1849
|
-
inside: ge
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
});
|
|
1854
|
-
$(ge, "operator", {
|
|
1855
|
-
"double-colon": {
|
|
1856
|
-
pattern: /::/,
|
|
1857
|
-
alias: "punctuation"
|
|
1858
|
-
}
|
|
1859
|
-
});
|
|
1860
|
-
var Fn = Object.assign({}, ge);
|
|
1861
|
-
$(ge, "class-name", {
|
|
1862
|
-
// the base clause is an optional list of parent classes
|
|
1863
|
-
// https://en.cppreference.com/w/cpp/language/class
|
|
1864
|
-
"base-clause": {
|
|
1865
|
-
pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/g,
|
|
1866
|
-
lookbehind: !0,
|
|
1867
|
-
greedy: !0,
|
|
1868
|
-
inside: Fn
|
|
1869
|
-
}
|
|
1870
|
-
});
|
|
1871
|
-
$(Fn, "double-colon", {
|
|
1872
|
-
// All untokenized words that are not namespaces should be class names
|
|
1873
|
-
"class-name": /\b[a-z_]\w*\b(?!\s*::)/i
|
|
1874
|
-
});
|
|
1875
|
-
_.go = {
|
|
1876
|
-
comment: re(),
|
|
1877
|
-
char: {
|
|
1878
|
-
pattern: /'(?:\\.|[^\\\n']){0,10}'/g,
|
|
1879
|
-
greedy: !0
|
|
1880
|
-
},
|
|
1881
|
-
string: {
|
|
1882
|
-
pattern: /(^|[^\\])"(?:\\.|[^\\\n"])*"|`[^`]*`/g,
|
|
1883
|
-
lookbehind: !0,
|
|
1884
|
-
greedy: !0
|
|
1885
|
-
},
|
|
1886
|
-
keyword: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
|
|
1887
|
-
boolean: /\b(?:_|false|true|iota|nil)\b/,
|
|
1888
|
-
function: /\b\w+(?=\()/,
|
|
1889
|
-
number: [
|
|
1890
|
-
// binary and octal integers
|
|
1891
|
-
/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
|
|
1892
|
-
// hexadecimal integers and floats
|
|
1893
|
-
/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
|
|
1894
|
-
// decimal integers and floats
|
|
1895
|
-
/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
|
|
1896
|
-
],
|
|
1897
|
-
operator: /--|\+\+|&&|\|\||&\^=?|<-|<<=?|>>=?|[%&|^!=<>/*+-]=?|:=|\.{3}/,
|
|
1898
|
-
punctuation: te,
|
|
1899
|
-
builtin: /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
|
|
1900
|
-
};
|
|
1901
|
-
var dt = {};
|
|
1902
|
-
_.js = _.javascript = Object.assign(dt, {
|
|
1903
|
-
"doc-comment": {
|
|
1904
|
-
pattern: /\/\*\*(?!\/)[^]*?(?:\*\/|$)/g,
|
|
1905
|
-
greedy: !0,
|
|
1906
|
-
alias: "comment",
|
|
1907
|
-
inside: "jsdoc"
|
|
1908
|
-
},
|
|
1909
|
-
comment: re(),
|
|
1910
|
-
hashbang: {
|
|
1911
|
-
pattern: /^#!.*/g,
|
|
1912
|
-
greedy: !0,
|
|
1913
|
-
alias: "comment"
|
|
1914
|
-
},
|
|
1915
|
-
"template-string": {
|
|
1916
|
-
pattern: /`(?:\\[^]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\}|(?!\$\{)[^\\`])*`/g,
|
|
1917
|
-
greedy: !0,
|
|
1918
|
-
inside: {
|
|
1919
|
-
"template-punctuation": {
|
|
1920
|
-
pattern: /^`|`$/,
|
|
1921
|
-
alias: "string"
|
|
1922
|
-
},
|
|
1923
|
-
interpolation: {
|
|
1924
|
-
pattern: /((?:^|[^\\])(?:\\\\)*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\}/,
|
|
1925
|
-
lookbehind: !0,
|
|
1926
|
-
inside: {
|
|
1927
|
-
"interpolation-punctuation": {
|
|
1928
|
-
pattern: /^\$\{|\}$/,
|
|
1929
|
-
alias: "punctuation"
|
|
1930
|
-
},
|
|
1931
|
-
[j]: dt
|
|
1932
|
-
}
|
|
1933
|
-
},
|
|
1934
|
-
string: /[^]+/
|
|
1935
|
-
}
|
|
1936
|
-
},
|
|
1937
|
-
"string-property": {
|
|
1938
|
-
pattern: /((?:^|[,{])[ ]*)(["'])(?:\\[^]|(?!\2)[^\\\n])*\2(?=\s*:)/mg,
|
|
1939
|
-
lookbehind: !0,
|
|
1940
|
-
greedy: !0,
|
|
1941
|
-
alias: "property"
|
|
1942
|
-
},
|
|
1943
|
-
string: Tt(),
|
|
1944
|
-
regex: {
|
|
1945
|
-
pattern: /((?:^|[^$\w\xa0-\uffff"'`.)\]\s]|\b(?:return|yield))\s*)\/(?:(?:\[(?:\\.|[^\\\n\]])*\]|\\.|[^\\\n/[])+\/[dgimyus]{0,7}|(?:\[(?:\\.|[^\\\n[\]]|\[(?:\\.|[^\\\n[\]]|\[(?:\\.|[^\\\n[\]])*\])*\])*\]|\\.|[^\\\n/[])+\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?!\/\*|[^()[\]{}.,:;?`\n%&|^!=<>/*+-]))/g,
|
|
1946
|
-
lookbehind: !0,
|
|
1947
|
-
greedy: !0,
|
|
1948
|
-
inside: {
|
|
1949
|
-
"regex-flags": /\w+$/,
|
|
1950
|
-
"regex-delimiter": /^\/|\/$/,
|
|
1951
|
-
"regex-source": {
|
|
1952
|
-
pattern: /.+/,
|
|
1953
|
-
alias: "language-regex",
|
|
1954
|
-
inside: "regex"
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
},
|
|
1958
|
-
"class-name": [
|
|
1959
|
-
{
|
|
1960
|
-
pattern: /(\b(?:class|extends|implements|instanceof|interface|new)\s+)(?!\d)(?:(?!\s)[$\w.\xa0-\uffff])+/,
|
|
1961
|
-
lookbehind: !0,
|
|
1962
|
-
inside: {
|
|
1963
|
-
punctuation: /\./
|
|
1964
|
-
}
|
|
1965
|
-
},
|
|
1966
|
-
{
|
|
1967
|
-
pattern: /(^|[^$\w\xa0-\uffff]|\s)(?![a-z\d])(?:(?!\s)[$\w\xa0-\uffff])+(?=\.(?:constructor|prototype)\b)/,
|
|
1968
|
-
lookbehind: !0
|
|
1969
|
-
}
|
|
1970
|
-
],
|
|
1971
|
-
// This must be declared before keyword because we use "function" inside the look-forward
|
|
1972
|
-
"function-variable": {
|
|
1973
|
-
pattern: /#?(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^)]*\))*\)|(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+)\s*=>))/,
|
|
1974
|
-
alias: "function",
|
|
1975
|
-
inside: {
|
|
1976
|
-
"maybe-class-name": /^[A-Z].*/
|
|
1977
|
-
}
|
|
1978
|
-
},
|
|
1979
|
-
parameter: [
|
|
1980
|
-
/(function(?:\s+(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
1981
|
-
/(^|[^$\w\xa0-\uffff]|\s)(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?=\s*=>)/,
|
|
1982
|
-
/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
1983
|
-
/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while|yield|class|const|debugger|delete|enum|extends|function|[gs]et|export|from|import|implements|in|instanceof|interface|let|new|null|of|package|private|protected|public|static|super|this|typeof|undefined|var|void|with)(?![$\w\xa0-\uffff]))(?:(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/
|
|
1984
|
-
].map((e) => ({
|
|
1985
|
-
pattern: e,
|
|
1986
|
-
lookbehind: !0,
|
|
1987
|
-
inside: dt
|
|
1988
|
-
})),
|
|
1989
|
-
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/,
|
|
1990
|
-
keyword: [
|
|
1991
|
-
{
|
|
1992
|
-
pattern: /(^|[^.]|\.{3}\s*)\b(?:as|assert(?=\s*\{)|export|from(?!\s*[^\s"'])|import)\b/,
|
|
1993
|
-
alias: "module",
|
|
1994
|
-
lookbehind: !0
|
|
1995
|
-
},
|
|
1996
|
-
{
|
|
1997
|
-
pattern: /(^|[^.]|\.{3}\s*)\b(?:await|break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,
|
|
1998
|
-
alias: "control-flow",
|
|
1999
|
-
lookbehind: !0
|
|
2000
|
-
},
|
|
2001
|
-
{
|
|
2002
|
-
pattern: /(^|[^.]|\.{3}\s*)\b(?:async(?!\s*[^\s($\w\xa0-\uffff])|class|const|debugger|delete|enum|extends|function|[gs]et(?!\s*[^\s#[$\w\xa0-\uffff])|implements|in|instanceof|interface|let|new|null|of|package|private|protected|public|static|super|this|typeof|undefined|var|void|with)\b/,
|
|
2003
|
-
lookbehind: !0
|
|
2004
|
-
}
|
|
2005
|
-
],
|
|
2006
|
-
boolean: q,
|
|
2007
|
-
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
2008
|
-
function: {
|
|
2009
|
-
pattern: /#?(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
2010
|
-
inside: {
|
|
2011
|
-
"maybe-class-name": /^[A-Z].*/
|
|
2012
|
-
}
|
|
2013
|
-
},
|
|
2014
|
-
number: {
|
|
2015
|
-
pattern: /(^|[^$\w])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][a-fA-F\d]+(?:_[a-fA-F\d]+)*n?|\d+(?:_\d+)*n|(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?)(?![$\w])/,
|
|
2016
|
-
lookbehind: !0
|
|
2017
|
-
},
|
|
2018
|
-
"literal-property": {
|
|
2019
|
-
pattern: /([\n,{][ ]*)(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?=\s*:)/,
|
|
2020
|
-
lookbehind: !0,
|
|
2021
|
-
alias: "property"
|
|
2022
|
-
},
|
|
2023
|
-
operator: [
|
|
2024
|
-
{
|
|
2025
|
-
pattern: /=>/,
|
|
2026
|
-
alias: "arrow"
|
|
2027
|
-
},
|
|
2028
|
-
/--|\+\+|(?:\*\*|&&|\|\||[!=]=|>>>?|<<|[%&|^!=<>/*+-]|\?\?)=?|\.{3}|\?(?!\.)|~|:/
|
|
2029
|
-
],
|
|
2030
|
-
"property-access": {
|
|
2031
|
-
pattern: /(\.\s*)#?(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+/,
|
|
2032
|
-
lookbehind: !0,
|
|
2033
|
-
inside: {
|
|
2034
|
-
"maybe-class-name": /^[A-Z].*/
|
|
2035
|
-
}
|
|
2036
|
-
},
|
|
2037
|
-
"maybe-class-name": {
|
|
2038
|
-
pattern: /(^|[^$\w\xa0-\uffff])[A-Z][$\w\xa0-\uffff]+/,
|
|
2039
|
-
lookbehind: !0
|
|
2040
|
-
},
|
|
2041
|
-
punctuation: /\?\.|[()[\]{}.,:;]/
|
|
2042
|
-
});
|
|
2043
|
-
var Un = (e) => (t, n) => {
|
|
2044
|
-
for (var s = St(e), l = "", u = [], f = 0, E = Se(t, n), y = 0, v = E.length, g = 0; y < v; ) {
|
|
2045
|
-
var m = E[y++], p = m.length, c = m.type;
|
|
2046
|
-
c && c.slice(0, 6) != "ignore" ? (u[f++] = [g, m], l += " ".repeat(p)) : l += t.slice(g, g + p), g += p;
|
|
2047
|
-
}
|
|
2048
|
-
var b = 0, g = 0, a = (d) => {
|
|
2049
|
-
for (var o = 0; b < f && o < d.length; o++) {
|
|
2050
|
-
var i = d[o], h = i.content;
|
|
2051
|
-
if (Array.isArray(h))
|
|
2052
|
-
a(h);
|
|
2053
|
-
else {
|
|
2054
|
-
for (var k = i.length, I = [], w, S, x = 0, T = g; ([w, S] = u[b], w >= g && w < g + k) && (T < w && (I[x++] = l.slice(T, w)), T = w + S.length, I[x++] = S, ++b != f); )
|
|
2055
|
-
;
|
|
2056
|
-
g += k, x && (T < g && (I[x++] = l.slice(T, g)), h ? i.content = I : (d.splice(o, 1, ...I), o += x - 1));
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
}, r = s ? ke(l, s) : [l];
|
|
2060
|
-
return a(r), r;
|
|
2061
|
-
}, Bn = _.js, xt = Bn["template-string"], Da = xt.pattern.source, Fa = xt.inside.interpolation.pattern, de = (e, t) => ({
|
|
2062
|
-
pattern: RegExp("((?:" + t + ")\\s*)" + Da, "g"),
|
|
2063
|
-
lookbehind: !0,
|
|
2064
|
-
greedy: !0,
|
|
2065
|
-
inside: {
|
|
2066
|
-
"template-punctuation": {
|
|
2067
|
-
pattern: /^`|`$/,
|
|
2068
|
-
alias: "string"
|
|
2069
|
-
},
|
|
2070
|
-
["language-" + e]: {
|
|
2071
|
-
pattern: /[^]+/,
|
|
2072
|
-
inside: {
|
|
2073
|
-
interpolation: {
|
|
2074
|
-
pattern: Fa,
|
|
2075
|
-
lookbehind: !0,
|
|
2076
|
-
alias: "language-javascript",
|
|
2077
|
-
inside: {
|
|
2078
|
-
"interpolation-punctuation": {
|
|
2079
|
-
pattern: /^\$\{|\}$/,
|
|
2080
|
-
alias: "punctuation"
|
|
2081
|
-
},
|
|
2082
|
-
[j]: "js"
|
|
2083
|
-
}
|
|
2084
|
-
},
|
|
2085
|
-
[J]: Un(e)
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
});
|
|
2090
|
-
Bn["template-string"] = [
|
|
2091
|
-
// styled-jsx:
|
|
2092
|
-
// css`a { color: #25F; }`
|
|
2093
|
-
// styled-components:
|
|
2094
|
-
// styled.h1`color: red;`
|
|
2095
|
-
de("css", "\\b(?:styled(?:\\([^)]*\\))?(?:\\s*\\.\\s*\\w+(?:\\([^)]*\\))*)*|css(?:\\s*\\.\\s*(?:global|resolve))?|createGlobalStyle|keyframes)"),
|
|
2096
|
-
// html`<p></p>`
|
|
2097
|
-
// div.innerHTML = `<p></p>`
|
|
2098
|
-
de("html", "\\bhtml|\\.\\s*(?:inner|outer)HTML\\s*\\+?="),
|
|
2099
|
-
// svg`<path fill="#fff" d="M55.37 ..."/>`
|
|
2100
|
-
de("svg", "\\bsvg"),
|
|
2101
|
-
// md`# h1`, markdown`## h2`
|
|
2102
|
-
de("markdown", "\\b(?:markdown|md)"),
|
|
2103
|
-
// gql`...`, graphql`...`, graphql.experimental`...`
|
|
2104
|
-
de("graphql", "\\b(?:gql|graphql(?:\\s*\\.\\s*experimental)?)"),
|
|
2105
|
-
// sql`...`
|
|
2106
|
-
de("sql", "\\bsql"),
|
|
2107
|
-
// vanilla template string
|
|
2108
|
-
xt
|
|
2109
|
-
];
|
|
2110
|
-
var Fe = "\\s|//.*(?!.)|/\\*(?:[^*]|\\*(?!/))*\\*/", yt = "\\{(?:[^{}]|\\{(?:[^{}]|\\{[^}]*\\})*\\})*\\}", an = F("\\{<0>*\\.{3}(?:[^{}]|<1>)*\\}", [Fe, yt]), rn = (e) => e && (!e.type || e.type == "plain-text"), Ua = (e, t, n) => {
|
|
2111
|
-
for (var s = 0, l = [], u = 0; s < e.length; s++) {
|
|
2112
|
-
var f = e[s], E = f.length, y = f.type, v = !y, m, p, c, b, g;
|
|
2113
|
-
y && (g = f.content, y == "tag" ? (c = g[0].length, p = g[2] ? t.substr(n + c, g[1].length) : "", c > 1 ? u && l[u - 1][0] == p && u-- : g[g.length - 1].length < 2 && (l[u++] = [p, 0])) : u && y == "punctuation" ? (m = l[u - 1], g == "{" ? m[1]++ : m[1] && g == "}" ? m[1]-- : v = !"}()[]".includes(g)) : v = !0), v && u && !l[u - 1][1] && (c = n, rn(e[s + 1]) && (E += e[s + 1].length, e.splice(s + 1, 1)), rn(e[s - 1]) && (c -= e[--s].length, e.splice(s, 1)), b = t.slice(c, n + E), e[s] = new ue("plain-text", b, b)), n += E;
|
|
2114
|
-
}
|
|
2115
|
-
return e;
|
|
2116
|
-
}, Gn = (e, t) => {
|
|
2117
|
-
$(_[t] = e = Qe(e), "regex", {
|
|
2118
|
-
tag: {
|
|
2119
|
-
pattern: O(
|
|
2120
|
-
`</?(?:(?!\\d)[^\\s/=><%]+(?:<0>(?:<0>*(?:[^\\s<>/={*]+(?:<0>*=<0>*(?!\\s)(?:"[^"]*"|'[^']*'|<1>)?|(?=[\\s/>]))|<2>))+)?<0>*/?)?>`,
|
|
2121
|
-
[Fe, yt, an],
|
|
2122
|
-
"g"
|
|
2123
|
-
),
|
|
2124
|
-
greedy: !0,
|
|
2125
|
-
inside: {
|
|
2126
|
-
punctuation: /^<\/?|\/?>$/,
|
|
2127
|
-
tag: {
|
|
2128
|
-
pattern: /^[^\s/]+/,
|
|
2129
|
-
inside: {
|
|
2130
|
-
namespace: /^[^:]+:/,
|
|
2131
|
-
"class-name": /^[A-Z]\w*(?:\.[A-Z]\w*)*$/
|
|
2132
|
-
}
|
|
2133
|
-
},
|
|
2134
|
-
script: {
|
|
2135
|
-
// Allow for two levels of nesting
|
|
2136
|
-
pattern: O("(=<0>*)<1>", [Fe, yt]),
|
|
2137
|
-
lookbehind: !0,
|
|
2138
|
-
alias: t = "language-" + t,
|
|
2139
|
-
inside: e
|
|
2140
|
-
},
|
|
2141
|
-
spread: {
|
|
2142
|
-
pattern: RegExp(an),
|
|
2143
|
-
alias: t,
|
|
2144
|
-
inside: e
|
|
2145
|
-
},
|
|
2146
|
-
"attr-value": {
|
|
2147
|
-
pattern: O(`(=<0>*)(?:"[^"]*"|'[^']*')`, [Fe]),
|
|
2148
|
-
lookbehind: !0,
|
|
2149
|
-
inside: {
|
|
2150
|
-
punctuation: /^["']|["']$/
|
|
2151
|
-
}
|
|
2152
|
-
},
|
|
2153
|
-
comment: e.comment,
|
|
2154
|
-
"attr-equals": /=/,
|
|
2155
|
-
"attr-name": {
|
|
2156
|
-
pattern: /\S+/,
|
|
2157
|
-
inside: {
|
|
2158
|
-
namespace: /^[^:]+:/
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
}), e[J] = (n, s) => Ua(Se(n, s), n, 0);
|
|
2164
|
-
};
|
|
2165
|
-
Gn(_.js, "jsx");
|
|
2166
|
-
_.lua = {
|
|
2167
|
-
comment: /^#!.+|--(?:\[(=*)\[[^]*?\]\1\]|.*)/m,
|
|
2168
|
-
// \z may be used to skip the following space
|
|
2169
|
-
string: {
|
|
2170
|
-
pattern: /(["'])(?:(?!\1)[^\\\n]|\\z\s|\\[^z])*\1|\[(=*)\[[^]*?\]\2\]/g,
|
|
2171
|
-
greedy: !0
|
|
2172
|
-
},
|
|
2173
|
-
number: /\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
|
|
2174
|
-
keyword: /\b(?:and|break|do|else|elseif|end|false|true|f?or|function|goto|if|in|local|nil|not|repeat|return|then|until|while)\b/,
|
|
2175
|
-
function: /(?!\d)\w+(?=\s*(?:[({]))/,
|
|
2176
|
-
// Match ".." but don't break "..."
|
|
2177
|
-
operator: {
|
|
2178
|
-
pattern: /[%&|^#*+-]|\/\/?|<[<=]?|>[>=]?|[=~]=?|(^|[^.])\.\.(?!\.)/,
|
|
2179
|
-
lookbehind: !0
|
|
2180
|
-
},
|
|
2181
|
-
punctuation: /[()[\]{},;]|\.+|:+/
|
|
2182
|
-
};
|
|
2183
|
-
var Ce = "(?:\\((?:\\\\[\\s\\S]|[^\\\\()])*\\)|\\{(?:\\\\[\\s\\S]|[^\\\\{}])*\\}|\\[(?:\\\\[\\s\\S]|[^\\\\[\\]])*\\]|<(?:\\\\[\\s\\S]|[^\\\\<>])*>)", sn = "(?![a-zA-Zd])\\s*(?:([^a-zA-Zd\\s{([<])(?:\\\\[^]|(?!\\1)[^\\\\])*\\1|([a-zA-Zd])(?:\\\\[^]|(?!\\2)[^\\\\])*\\2";
|
|
2184
|
-
_.perl = {
|
|
2185
|
-
comment: [
|
|
2186
|
-
{
|
|
2187
|
-
// POD
|
|
2188
|
-
pattern: /(^\s*)=\w[^]*?=cut.*/mg,
|
|
2189
|
-
lookbehind: !0,
|
|
2190
|
-
greedy: !0
|
|
2191
|
-
},
|
|
2192
|
-
{
|
|
2193
|
-
pattern: /(^|[^\\$])#.*/g,
|
|
2194
|
-
lookbehind: !0,
|
|
2195
|
-
greedy: !0
|
|
2196
|
-
}
|
|
2197
|
-
],
|
|
2198
|
-
// TODO Could be nice to handle Heredoc too.
|
|
2199
|
-
string: {
|
|
2200
|
-
pattern: RegExp(
|
|
2201
|
-
`\\bq[qwx]?${sn}|${Ce})|("|\`)(?:\\\\[^]|(?!\\3)[^\\\\])*\\3|'(?:\\\\.|[^\\\\
|
|
2202
|
-
'])*'`,
|
|
2203
|
-
"g"
|
|
2204
|
-
),
|
|
2205
|
-
greedy: !0
|
|
2206
|
-
},
|
|
2207
|
-
regex: [
|
|
2208
|
-
{
|
|
2209
|
-
pattern: RegExp(
|
|
2210
|
-
`\\b(?:m|qr)${sn}|${Ce})[msixpodualngc]*`,
|
|
2211
|
-
"g"
|
|
2212
|
-
),
|
|
2213
|
-
greedy: !0
|
|
2214
|
-
},
|
|
2215
|
-
// The lookbehinds prevent -s from breaking
|
|
2216
|
-
{
|
|
2217
|
-
pattern: RegExp(
|
|
2218
|
-
`(^|[^-])\\b(?:s|tr|y)(?![a-zA-Zd])\\s*(?:([^a-zA-Zd\\s{([<])(?:\\\\[^]|(?!\\2)[^\\\\])*\\2(?:\\\\[^]|(?!\\2)[^\\\\])*\\2|([a-zA-Zd])(?:\\\\[^]|(?!\\3)[^\\\\])*\\3(?:\\\\[^]|(?!\\3)[^\\\\])*\\3|${Ce}\\s*${Ce})[msixpodualngcer]*`,
|
|
2219
|
-
"g"
|
|
2220
|
-
),
|
|
2221
|
-
lookbehind: !0,
|
|
2222
|
-
greedy: !0
|
|
2223
|
-
},
|
|
2224
|
-
// /.../
|
|
2225
|
-
// The look-ahead tries to prevent two divisions on
|
|
2226
|
-
// the same line from being highlighted as regex.
|
|
2227
|
-
// This does not support multi-line regex.
|
|
2228
|
-
{
|
|
2229
|
-
pattern: /\/(?:\\.|[^\\\n/])*\/[msixpodualngc]*(?=\s*(?:$|[\n,.;})&|*~<>!?^+-]|(?:and|cmp|eq|[gl][et]|ne|not|x|x?or)\b))/g,
|
|
2230
|
-
greedy: !0
|
|
2231
|
-
}
|
|
2232
|
-
],
|
|
2233
|
-
// FIXME Not sure about the handling of ::, ', and #
|
|
2234
|
-
variable: /[&*$@%](?:\{\^[A-Z]+\}|\^[A-Z_]|#?(?=\{)|#?(?:(?:::)*'?(?!\d)[$\w]+(?![$\w]))+(?:::)*|\d+)|(?!%=)[$@%][!"#$%&'*,./:;<=>?@()[\]{}||^_`|~+-]/,
|
|
2235
|
-
filehandle: {
|
|
2236
|
-
// <>, <FOO>, _
|
|
2237
|
-
pattern: /<(?![<=])\S*?>|\b_\b/,
|
|
2238
|
-
alias: "symbol"
|
|
2239
|
-
},
|
|
2240
|
-
"v-string": {
|
|
2241
|
-
// v1.2, 1.2.3
|
|
2242
|
-
pattern: /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,
|
|
2243
|
-
alias: "string"
|
|
2244
|
-
},
|
|
2245
|
-
function: {
|
|
2246
|
-
pattern: /(\bsub[ ]+)\w+/,
|
|
2247
|
-
lookbehind: !0
|
|
2248
|
-
},
|
|
2249
|
-
keyword: /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
|
|
2250
|
-
number: /\b(?:0x[a-fA-F\d](?:_?[a-fA-F\d])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,
|
|
2251
|
-
operator: /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|->|=>|=~|~~|<=>?|!~|--|\+\+|(?:\*\*|\/\/|&&|\|\||<<|>>|[~%&|^!=<>/*+-])=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|[gl][et]|ne|not|x?or)\b/,
|
|
2252
|
-
punctuation: /[()[\]{},:;]/
|
|
2253
|
-
};
|
|
2254
|
-
var on = {
|
|
2255
|
-
"format-spec": {
|
|
2256
|
-
pattern: /(:)[^(){}:]+(?=\}$)/,
|
|
2257
|
-
lookbehind: !0
|
|
2258
|
-
},
|
|
2259
|
-
"conversion-option": {
|
|
2260
|
-
pattern: //,
|
|
2261
|
-
alias: "punctuation"
|
|
2262
|
-
}
|
|
2263
|
-
};
|
|
2264
|
-
on[j] = _.py = _.python = {
|
|
2265
|
-
comment: {
|
|
2266
|
-
pattern: /#.*/g,
|
|
2267
|
-
greedy: !0
|
|
2268
|
-
},
|
|
2269
|
-
"string-interpolation": {
|
|
2270
|
-
pattern: /(?:fr?|rf)(?:("""|''')[^]*?\1|(["'])(?:\\[^]|(?!\2)[^\\\n])*\2)/gi,
|
|
2271
|
-
greedy: !0,
|
|
2272
|
-
inside: {
|
|
2273
|
-
interpolation: {
|
|
2274
|
-
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
|
2275
|
-
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\}/,
|
|
2276
|
-
lookbehind: !0,
|
|
2277
|
-
inside: on
|
|
2278
|
-
},
|
|
2279
|
-
string: /[^]+/
|
|
2280
|
-
}
|
|
2281
|
-
},
|
|
2282
|
-
"triple-quoted-string": {
|
|
2283
|
-
pattern: /(?:br?|rb?|u)?("""|''')[^]*?\1/gi,
|
|
2284
|
-
greedy: !0,
|
|
2285
|
-
alias: "string"
|
|
2286
|
-
},
|
|
2287
|
-
string: {
|
|
2288
|
-
pattern: /(?:br?|rb?|u)?(["'])(?:\\[^]|(?!\1)[^\\\n])*\1/gi,
|
|
2289
|
-
greedy: !0
|
|
2290
|
-
},
|
|
2291
|
-
function: {
|
|
2292
|
-
pattern: /((?:^|\s)def[ ]+)(?!\d)\w+(?=\s*\()/,
|
|
2293
|
-
lookbehind: !0
|
|
2294
|
-
},
|
|
2295
|
-
"class-name": {
|
|
2296
|
-
pattern: /(\bclass\s+)\w+/i,
|
|
2297
|
-
lookbehind: !0
|
|
2298
|
-
},
|
|
2299
|
-
decorator: {
|
|
2300
|
-
pattern: /(^[ ]*)@\w+(?:\.\w+)*/m,
|
|
2301
|
-
lookbehind: !0,
|
|
2302
|
-
alias: "annotation punctuation",
|
|
2303
|
-
inside: {
|
|
2304
|
-
punctuation: /\./
|
|
2305
|
-
}
|
|
2306
|
-
},
|
|
2307
|
-
keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|de[fl]|elif|else|except|exec|finally|f?or|from|global|i[fns]|import|lambda|match|nonlocal|not|pass|print|raise|return|try|while|with|yield)\b/,
|
|
2308
|
-
builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|ma[px]|memoryview|min|next|object|oct|open|ord|pow|property|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|x?range|zip)\b/,
|
|
2309
|
-
boolean: /\b(?:False|True|None)\b/,
|
|
2310
|
-
number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f\d])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
2311
|
-
operator: /!=|:=|\*\*=?|\/\/=?|<>|>>|<<|[%=<>/*+-]=?|[&|^~]/,
|
|
2312
|
-
punctuation: te
|
|
2313
|
-
};
|
|
2314
|
-
var Ba = me("/\\*(?:[^*/]|\\*(?!/)|/(?!\\*)|<self>)*\\*/", 2), ln = {
|
|
2315
|
-
pattern: /b?"(?:\\[^]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/g,
|
|
2316
|
-
greedy: !0
|
|
2317
|
-
}, cn = {
|
|
2318
|
-
"closure-punctuation": {
|
|
2319
|
-
pattern: /^\||\|$/,
|
|
2320
|
-
alias: "punctuation"
|
|
2321
|
-
}
|
|
2322
|
-
};
|
|
2323
|
-
cn[j] = _.rust = {
|
|
2324
|
-
comment: {
|
|
2325
|
-
pattern: RegExp("//.*|" + Ba, "g"),
|
|
2326
|
-
greedy: !0
|
|
2327
|
-
},
|
|
2328
|
-
string: ln,
|
|
2329
|
-
char: {
|
|
2330
|
-
pattern: /b?'(?:\\(?:x[0-7][a-fA-F\d]|u\{(?:[a-fA-F\d]_*){1,6}\}|.)|[^\\\n '])'/g,
|
|
2331
|
-
greedy: !0
|
|
2332
|
-
},
|
|
2333
|
-
attribute: {
|
|
2334
|
-
pattern: /#!?\[(?:[^[\]"]|"(?:\\[^]|[^\\"])*")*\]/g,
|
|
2335
|
-
greedy: !0,
|
|
2336
|
-
alias: "attr-name",
|
|
2337
|
-
inside: {
|
|
2338
|
-
string: ln
|
|
2339
|
-
}
|
|
2340
|
-
},
|
|
2341
|
-
// Closure params should not be confused with bitwise OR |
|
|
2342
|
-
"closure-params": {
|
|
2343
|
-
pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/g,
|
|
2344
|
-
lookbehind: !0,
|
|
2345
|
-
greedy: !0,
|
|
2346
|
-
inside: cn
|
|
2347
|
-
},
|
|
2348
|
-
"lifetime-annotation": {
|
|
2349
|
-
pattern: /'\w+/,
|
|
2350
|
-
alias: "symbol"
|
|
2351
|
-
},
|
|
2352
|
-
"fragment-specifier": {
|
|
2353
|
-
pattern: /(\$\w+:)[a-z]+/,
|
|
2354
|
-
lookbehind: !0,
|
|
2355
|
-
alias: "punctuation"
|
|
2356
|
-
},
|
|
2357
|
-
variable: /\$\w+/,
|
|
2358
|
-
"function-definition": {
|
|
2359
|
-
pattern: /(\bfn\s+)\w+/,
|
|
2360
|
-
lookbehind: !0,
|
|
2361
|
-
alias: "function"
|
|
2362
|
-
},
|
|
2363
|
-
"type-definition": {
|
|
2364
|
-
pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/,
|
|
2365
|
-
lookbehind: !0,
|
|
2366
|
-
alias: "class-name"
|
|
2367
|
-
},
|
|
2368
|
-
"module-declaration": [
|
|
2369
|
-
{
|
|
2370
|
-
pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,
|
|
2371
|
-
lookbehind: !0,
|
|
2372
|
-
alias: "namespace"
|
|
2373
|
-
},
|
|
2374
|
-
{
|
|
2375
|
-
pattern: /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,
|
|
2376
|
-
lookbehind: !0,
|
|
2377
|
-
alias: "namespace",
|
|
2378
|
-
inside: {
|
|
2379
|
-
punctuation: /::/
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
],
|
|
2383
|
-
// https://github.com/rust-lang/reference/blob/master/src/keywords.md
|
|
2384
|
-
// primitives and str
|
|
2385
|
-
// https://doc.rust-lang.org/stable/rust-by-example/primitives.html
|
|
2386
|
-
keyword: /\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield|bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/,
|
|
2387
|
-
// functions can technically start with an upper-case letter, but this will introduce a lot of false positives
|
|
2388
|
-
// and Rust's naming conventions recommend snake_case anyway.
|
|
2389
|
-
// https://doc.rust-lang.org/1.0.0/style/style/naming/README.html
|
|
2390
|
-
function: /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
|
|
2391
|
-
macro: {
|
|
2392
|
-
pattern: /\b\w+!/,
|
|
2393
|
-
alias: "property"
|
|
2394
|
-
},
|
|
2395
|
-
constant: /\b[A-Z_][A-Z_\d]+\b/,
|
|
2396
|
-
"class-name": /\b[A-Z]\w*\b/,
|
|
2397
|
-
namespace: {
|
|
2398
|
-
pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,
|
|
2399
|
-
inside: {
|
|
2400
|
-
punctuation: /::/
|
|
2401
|
-
}
|
|
2402
|
-
},
|
|
2403
|
-
// Hex, oct, bin, dec numbers with visual separators and type suffix
|
|
2404
|
-
number: /\b(?:0x[a-fA-F\d](?:_?[a-fA-F\d])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,
|
|
2405
|
-
boolean: q,
|
|
2406
|
-
punctuation: /->|\.\.=|\.{1,3}|::|[()[\]{},:;]/,
|
|
2407
|
-
operator: /&&|\|\||=>|>>=?|<<=?|[%&|^!=<>/*+-]=?|[@?]/
|
|
2408
|
-
};
|
|
2409
|
-
var dn = _.swift = {
|
|
2410
|
-
comment: {
|
|
2411
|
-
// Nested comments are supported up to 2 levels
|
|
2412
|
-
pattern: /\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\//g,
|
|
2413
|
-
greedy: !0
|
|
2414
|
-
},
|
|
2415
|
-
"string-literal": [
|
|
2416
|
-
// https://docs.swift.org/swift-book/LanguageGuide/StringsAndCharacters.html
|
|
2417
|
-
{
|
|
2418
|
-
pattern: /(^|[^"#])(?:"(?:\\(?:\((?:[^()]|\([^)]*\))*\)|[^(])|[^\\\n"])*"|"""(?:\\(?:\((?:[^()]|\([^)]*\))*\)|[^(])|[^\\"]|"(?!""))*""")(?!["#])/g,
|
|
2419
|
-
lookbehind: !0,
|
|
2420
|
-
greedy: !0,
|
|
2421
|
-
inside: {
|
|
2422
|
-
interpolation: {
|
|
2423
|
-
pattern: /(\\\()(?:[^()]|\([^()]*\))+(?=\))/,
|
|
2424
|
-
lookbehind: !0
|
|
2425
|
-
},
|
|
2426
|
-
"interpolation-punctuation": {
|
|
2427
|
-
pattern: /^\)|\\\($/,
|
|
2428
|
-
alias: "punctuation"
|
|
2429
|
-
},
|
|
2430
|
-
punctuation: /\\(?=\n)/,
|
|
2431
|
-
string: /[^]+/
|
|
2432
|
-
}
|
|
2433
|
-
},
|
|
2434
|
-
{
|
|
2435
|
-
pattern: /(^|[^"#])(#+)(?:"(?:\\(?:#+\((?:[^()]|\([^)]*\))*\)|[^#])|[^\\\n])*?"|"""(?:\\(?:#+\((?:[^()]|\([^)]*\))*\)|[^#])|[^\\])*?""")\2/g,
|
|
2436
|
-
lookbehind: !0,
|
|
2437
|
-
greedy: !0,
|
|
2438
|
-
inside: {
|
|
2439
|
-
interpolation: {
|
|
2440
|
-
pattern: /(\\#+\()(?:[^()]|\([^()]*\))+(?=\))/,
|
|
2441
|
-
lookbehind: !0
|
|
2442
|
-
},
|
|
2443
|
-
"interpolation-punctuation": {
|
|
2444
|
-
pattern: /^\)|\\#+\($/,
|
|
2445
|
-
alias: "punctuation"
|
|
2446
|
-
},
|
|
2447
|
-
string: /[^]+/
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
],
|
|
2451
|
-
directive: {
|
|
2452
|
-
// directives with conditions
|
|
2453
|
-
pattern: /#(?:(?:elseif|if)\b(?:[ ]*(?:![ ]*)?(?:\b\w+\b(?:[ ]*\((?:[^()]|\([^)]*\))*\))?|\((?:[^()]|\([^)]*\))*\))(?:[ ]*(?:&&|\|\|))?)+|(?:else|endif)\b)/,
|
|
2454
|
-
alias: "property",
|
|
2455
|
-
inside: {
|
|
2456
|
-
"directive-name": /^#\w+/,
|
|
2457
|
-
boolean: q,
|
|
2458
|
-
number: /\b\d+(?:\.\d+)*\b/,
|
|
2459
|
-
operator: /!|&&|\|\||[<>]=?/,
|
|
2460
|
-
punctuation: /[(),]/
|
|
2461
|
-
}
|
|
2462
|
-
},
|
|
2463
|
-
literal: {
|
|
2464
|
-
pattern: /#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,
|
|
2465
|
-
alias: "constant"
|
|
2466
|
-
},
|
|
2467
|
-
"other-directive": {
|
|
2468
|
-
pattern: /#\w+/,
|
|
2469
|
-
alias: "property"
|
|
2470
|
-
},
|
|
2471
|
-
attribute: {
|
|
2472
|
-
pattern: /@\w+/,
|
|
2473
|
-
alias: "atrule"
|
|
2474
|
-
},
|
|
2475
|
-
"function-definition": {
|
|
2476
|
-
pattern: /(\bfunc\s+)\w+/,
|
|
2477
|
-
lookbehind: !0,
|
|
2478
|
-
alias: "function"
|
|
2479
|
-
},
|
|
2480
|
-
label: {
|
|
2481
|
-
// https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html#ID141
|
|
2482
|
-
pattern: /\b(break|continue)\s+\w+|\b(?!\d)\w+(?=\s*:\s*(?:for|repeat|while)\b)/,
|
|
2483
|
-
lookbehind: !0,
|
|
2484
|
-
alias: "important"
|
|
2485
|
-
},
|
|
2486
|
-
keyword: /\b(?:Any|[Pp]rotocol|[Ss]elf|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|[gs]et|guard|higherThan|i[fns]|import|indirect|infix|init|inout|internal|isolated|lazy|lef?t|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|public|repeat|required|rethrows|return|right|safe|some|static|struct|subscript|super|switch|throws?|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,
|
|
2487
|
-
boolean: q,
|
|
2488
|
-
nil: {
|
|
2489
|
-
pattern: /\bnil\b/,
|
|
2490
|
-
alias: "constant"
|
|
2491
|
-
},
|
|
2492
|
-
"short-argument": /\$\d+\b/,
|
|
2493
|
-
omit: {
|
|
2494
|
-
pattern: /\b_\b/,
|
|
2495
|
-
alias: "keyword"
|
|
2496
|
-
},
|
|
2497
|
-
number: /\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f\d_]+(?:\.[a-f\dp_]+)?|0b[01_]+|0o[0-7_]+)\b/i,
|
|
2498
|
-
// A class name must start with an upper-case letter and be either 1 letter long or contain a lower-case letter.
|
|
2499
|
-
"class-name": /\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,
|
|
2500
|
-
function: /\b[a-z_]\w*(?=\s*\()/i,
|
|
2501
|
-
constant: /\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,
|
|
2502
|
-
// Operators are generic in Swift. Developers can even create new operators (e.g. +++).
|
|
2503
|
-
// https://docs.swift.org/swift-book/ReferenceManual/zzSummaryOfTheGrammar.html#ID481
|
|
2504
|
-
// This regex only supports ASCII operators.
|
|
2505
|
-
operator: /[~?%&|^!=<>/*+-]+|\.[.~?%&|^!=<>/*+-]+/,
|
|
2506
|
-
punctuation: /[()[\]{}.,:;\\]/
|
|
2507
|
-
};
|
|
2508
|
-
dn["string-literal"].forEach((e) => {
|
|
2509
|
-
e.inside.interpolation.inside = dn;
|
|
2510
|
-
});
|
|
2511
|
-
_.clike = {
|
|
2512
|
-
comment: re(),
|
|
2513
|
-
string: Tt(),
|
|
2514
|
-
"class-name": {
|
|
2515
|
-
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
2516
|
-
lookbehind: !0,
|
|
2517
|
-
inside: {
|
|
2518
|
-
punctuation: /[.\\]/
|
|
2519
|
-
}
|
|
2520
|
-
},
|
|
2521
|
-
keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
2522
|
-
boolean: q,
|
|
2523
|
-
function: /\b\w+(?=\()/,
|
|
2524
|
-
number: Mn,
|
|
2525
|
-
operator: /[!=]==|[!=<>]=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
2526
|
-
punctuation: te
|
|
2527
|
-
};
|
|
2528
|
-
var Je = (e) => `\\b(?:${e})\\b`, zn = "bool|char|decimal|double|dynamic|float|object|s?byte|string|u?int|u?long|u?short|var|void", et = "class|enum|interface|record|struct", Hn = "add|alias|and|ascending|async|await|by|descending|from(?!\\s*[^\\s\\w])|[gls]et|global|group|into|init(?=\\s*;)|join|nameof|not|notnull|on|or|orderby|partial|remove|select|unmanaged|value|when|where|with(?=\\s*{)", Ot = "abstract|as|[bc]ase|break|catch|checked|const|continue|default|delegate|do|else|event|explicit|extern|finally|fixed|for|foreach|goto|i[fns]|implicit|internal|lock|namespace|new|null|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|switch|this|throw|try|typeof|unchecked|unsafe|using|virtual|volatile|while|yield", Vn = Je(et), Ke = RegExp(Je(zn + "|" + et + "|" + Hn + "|" + Ot)), Ga = Je(et + "|" + Hn + "|" + Ot), za = Je(zn + "|" + et + "|" + Ot), We = me("<(?:[^<>;=*/%&|^+-]|<self>)*>", 2), Ue = me("\\((?:[^()]|<self>)*\\)", 2), Q = "@?\\b(?!\\d)\\w+\\b", je = F("<0>(?:\\s*<1>)?", [Q, We]), le = F("(?!<0>)<1>(?:\\s*\\.\\s*<1>)*", [Ga, je]), Nt = "\\[\\s*(?:,\\s*)*\\]", Ha = F("<0>(?:\\s*(?:\\?\\s*)?<1>)*(?:\\s*\\?)?", [le, Nt]), Va = F("[^()[\\],;%&|^=<>/*+-]|<0>|<1>|<2>", [We, Ue, Nt]), Za = F("\\(<0>+(?:,<0>+)+\\)", [Va]), be = F("(?:<0>|<1>)(?:\\s*(?:\\?\\s*)?<2>)*(?:\\s*\\?)?", [Za, le, Nt]), W = {
|
|
2529
|
-
keyword: Ke,
|
|
2530
|
-
punctuation: /[()[\].,:<>?]/
|
|
2531
|
-
}, Zn = `'(?:\\\\.|[^
|
|
2532
|
-
'\\\\]|\\\\[Uux][a-fA-F\\d]{1,8})'`, qn = `"(?:\\\\.|[^\\\\
|
|
2533
|
-
"])*"`, qa = '@"(?:""|\\\\[\\s\\S]|[^\\\\"])*"(?!")', ne = _.dotnet = _.cs = _.csharp = ae("clike", {
|
|
2534
|
-
string: [
|
|
2535
|
-
{
|
|
2536
|
-
pattern: O("(^|[^$\\\\])<0>", [qa], "g"),
|
|
2537
|
-
lookbehind: !0,
|
|
2538
|
-
greedy: !0
|
|
2539
|
-
},
|
|
2540
|
-
{
|
|
2541
|
-
pattern: O("(^|[^@$\\\\])<0>", [qn], "g"),
|
|
2542
|
-
lookbehind: !0,
|
|
2543
|
-
greedy: !0
|
|
2544
|
-
}
|
|
2545
|
-
],
|
|
2546
|
-
"class-name": [
|
|
2547
|
-
{
|
|
2548
|
-
// Using static
|
|
2549
|
-
// using static System.Math;
|
|
2550
|
-
pattern: O("(\\busing\\s+static\\s+)<0>(?=\\s*;)", [le]),
|
|
2551
|
-
lookbehind: !0,
|
|
2552
|
-
inside: W
|
|
2553
|
-
},
|
|
2554
|
-
{
|
|
2555
|
-
// Using alias (type)
|
|
2556
|
-
// using Project = PC.MyCompany.Project;
|
|
2557
|
-
pattern: O("(\\busing\\s+<0>\\s*=\\s*)<1>(?=\\s*;)", [Q, be]),
|
|
2558
|
-
lookbehind: !0,
|
|
2559
|
-
inside: W
|
|
2560
|
-
},
|
|
2561
|
-
{
|
|
2562
|
-
// Using alias (alias)
|
|
2563
|
-
// using Project = PC.MyCompany.Project;
|
|
2564
|
-
pattern: O("(\\busing\\s+)<0>(?=\\s*=)", [Q]),
|
|
2565
|
-
lookbehind: !0
|
|
2566
|
-
},
|
|
2567
|
-
{
|
|
2568
|
-
// Type declarations
|
|
2569
|
-
// class Foo<A, B>
|
|
2570
|
-
// interface Foo<out A, B>
|
|
2571
|
-
pattern: O("(\\b<0>\\s+)<1>", [Vn, je]),
|
|
2572
|
-
lookbehind: !0,
|
|
2573
|
-
inside: W
|
|
2574
|
-
},
|
|
2575
|
-
{
|
|
2576
|
-
// Single catch exception declaration
|
|
2577
|
-
// catch(Foo)
|
|
2578
|
-
// (things like catch(Foo e) is covered by variable declaration)
|
|
2579
|
-
pattern: O("(\\bcatch\\s*\\(\\s*)<0>", [le]),
|
|
2580
|
-
lookbehind: !0,
|
|
2581
|
-
inside: W
|
|
2582
|
-
},
|
|
2583
|
-
{
|
|
2584
|
-
// Name of the type parameter of generic constraints
|
|
2585
|
-
// where Foo : class
|
|
2586
|
-
pattern: O("(\\bwhere\\s+)<0>", [Q]),
|
|
2587
|
-
lookbehind: !0
|
|
2588
|
-
},
|
|
2589
|
-
{
|
|
2590
|
-
// Casts and checks via as and is.
|
|
2591
|
-
// as Foo<A>, is Bar<B>
|
|
2592
|
-
// (things like if(a is Foo b) is covered by variable declaration)
|
|
2593
|
-
pattern: O("(\\b(?:is(?:\\s+not)?|as)\\s+)<0>", [Ha]),
|
|
2594
|
-
lookbehind: !0,
|
|
2595
|
-
inside: W
|
|
2596
|
-
},
|
|
2597
|
-
{
|
|
2598
|
-
// Variable, field and parameter declaration
|
|
2599
|
-
// (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
|
|
2600
|
-
pattern: O("\\b<0>(?=\\s+(?!<1>|with\\s*\\{)<2>(?:\\s*[=,:;{)\\]]|\\s+(?:in|when)\\b))", [be, za, Q]),
|
|
2601
|
-
inside: W
|
|
2602
|
-
}
|
|
2603
|
-
],
|
|
2604
|
-
keyword: Ke,
|
|
2605
|
-
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals
|
|
2606
|
-
number: /(?:\b0(?:x[a-f\d_]*[a-f\d]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[+-]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
|
|
2607
|
-
operator: /[=-]>|([&|+-])\1|~|\?\?=?|>>=?|<<=?|[%&|^!=<>/*+-]=?/,
|
|
2608
|
-
punctuation: /\?\.?|::|[()[\]{}.,:;]/
|
|
2609
|
-
});
|
|
2610
|
-
$(ne, "number", {
|
|
2611
|
-
range: {
|
|
2612
|
-
pattern: /\.\./,
|
|
2613
|
-
alias: "operator"
|
|
2614
|
-
}
|
|
2615
|
-
});
|
|
2616
|
-
$(ne, "punctuation", {
|
|
2617
|
-
"named-parameter": {
|
|
2618
|
-
pattern: O("([(,]\\s*)<0>(?=\\s*:)", [Q]),
|
|
2619
|
-
lookbehind: !0,
|
|
2620
|
-
alias: "punctuation"
|
|
2621
|
-
}
|
|
2622
|
-
});
|
|
2623
|
-
$(ne, "class-name", {
|
|
2624
|
-
namespace: {
|
|
2625
|
-
// namespace Foo.Bar {}
|
|
2626
|
-
// using Foo.Bar;
|
|
2627
|
-
pattern: O("(\\b(?:namespace|using)\\s+)<0>(?:\\s*\\.\\s*<0>)*(?=\\s*[;{])", [Q]),
|
|
2628
|
-
lookbehind: !0,
|
|
2629
|
-
inside: {
|
|
2630
|
-
punctuation: /\./
|
|
2631
|
-
}
|
|
2632
|
-
},
|
|
2633
|
-
"type-expression": {
|
|
2634
|
-
// default(Foo), typeof(Foo<Bar>), sizeof(int)
|
|
2635
|
-
pattern: O("(\\b(?:default|sizeof|typeof)\\s*\\(\\s*(?!\\s))(?:[^()\\s]|\\s(?!\\s)|<0>)+(?=\\s*\\))", [Ue]),
|
|
2636
|
-
lookbehind: !0,
|
|
2637
|
-
alias: "class-name",
|
|
2638
|
-
inside: W
|
|
2639
|
-
},
|
|
2640
|
-
"return-type": {
|
|
2641
|
-
// Foo<Bar> ForBar(); Foo IFoo.Bar() => 0
|
|
2642
|
-
// int this[int index] => 0; T IReadOnlyList<T>.this[int index] => this[index];
|
|
2643
|
-
// int Foo => 0; int Foo { get; set } = 0;
|
|
2644
|
-
pattern: O("<0>(?=\\s+(?:<1>\\s*(?:=>|[({]|\\.\\s*this\\s*\\[)|this\\s*\\[))", [be, le]),
|
|
2645
|
-
alias: "class-name",
|
|
2646
|
-
inside: W
|
|
2647
|
-
},
|
|
2648
|
-
"constructor-invocation": {
|
|
2649
|
-
// new List<Foo<Bar[]>> { }
|
|
2650
|
-
pattern: O("(\\bnew\\s+)<0>(?=\\s*[[({])", [be]),
|
|
2651
|
-
lookbehind: !0,
|
|
2652
|
-
alias: "class-name",
|
|
2653
|
-
inside: W
|
|
2654
|
-
},
|
|
2655
|
-
/*'explicit-implementation': {
|
|
2656
|
-
// int IFoo<Foo>.Bar => 0; void IFoo<Foo<Foo>>.Foo<T>();
|
|
2657
|
-
pattern: replace(/\b<0>(?=\.<1>)/, className, methodOrPropertyDeclaration),
|
|
2658
|
-
inside: classNameInside,
|
|
2659
|
-
alias: 'class-name'
|
|
2660
|
-
},*/
|
|
2661
|
-
"generic-method": {
|
|
2662
|
-
// foo<Bar>()
|
|
2663
|
-
pattern: O("<0>\\s*<1>(?=\\s*\\()", [Q, We]),
|
|
2664
|
-
inside: {
|
|
2665
|
-
function: O("^<0>", [Q]),
|
|
2666
|
-
generic: {
|
|
2667
|
-
pattern: RegExp(We),
|
|
2668
|
-
alias: "class-name",
|
|
2669
|
-
inside: W
|
|
2670
|
-
}
|
|
2671
|
-
}
|
|
2672
|
-
},
|
|
2673
|
-
"type-list": {
|
|
2674
|
-
// The list of types inherited or of generic constraints
|
|
2675
|
-
// class Foo<F> : Bar, IList<FooBar>
|
|
2676
|
-
// where F : Bar, IList<int>
|
|
2677
|
-
pattern: O(
|
|
2678
|
-
"\\b((?:<0>\\s+<1>|record\\s+<1>\\s*<5>|where\\s+<2>)\\s*:\\s*)(?:<3>|<4>|<1>\\s*<5>|<6>)(?:\\s*,\\s*(?:<3>|<4>|<6>))*(?=\\s*(?:where|[{;]|=>|$))",
|
|
2679
|
-
[Vn, je, Q, be, Ke.source, Ue, "\\bnew\\s*\\(\\s*\\)"]
|
|
2680
|
-
),
|
|
2681
|
-
lookbehind: !0,
|
|
2682
|
-
inside: {
|
|
2683
|
-
"record-arguments": {
|
|
2684
|
-
pattern: O("(^(?!new\\s*\\()<0>\\s*)<1>", [je, Ue], "g"),
|
|
2685
|
-
lookbehind: !0,
|
|
2686
|
-
greedy: !0,
|
|
2687
|
-
inside: ne
|
|
2688
|
-
},
|
|
2689
|
-
keyword: Ke,
|
|
2690
|
-
"class-name": {
|
|
2691
|
-
pattern: RegExp(be, "g"),
|
|
2692
|
-
greedy: !0,
|
|
2693
|
-
inside: W
|
|
2694
|
-
},
|
|
2695
|
-
punctuation: /[(),]/
|
|
2696
|
-
}
|
|
2697
|
-
},
|
|
2698
|
-
preprocessor: {
|
|
2699
|
-
pattern: /(^[ ]*)#.*/m,
|
|
2700
|
-
lookbehind: !0,
|
|
2701
|
-
alias: "property",
|
|
2702
|
-
inside: {
|
|
2703
|
-
// highlight preprocessor directives as keywords
|
|
2704
|
-
directive: {
|
|
2705
|
-
pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
|
|
2706
|
-
lookbehind: !0,
|
|
2707
|
-
alias: "keyword"
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
2711
|
-
});
|
|
2712
|
-
var Kn = qn + "|" + Zn, Wn = F(`/(?![*/])|//[^
|
|
2713
|
-
]*
|
|
2714
|
-
|/\\*(?:[^*]|\\*(?!/))*\\*/|<0>`, [Kn]), jn = me(F(`[^()"'/]|<0>|\\(<self>*\\)`, [Wn]), 2), un = "\\b(?:assembly|event|field|method|module|param|property|return|type)\\b", Ka = F("<0>(?:\\s*\\(<1>*\\))?", [le, jn]), Lt = `:[^
|
|
2715
|
-
}]+`, Yn = me(F(`[^()"'/]|<0>|\\(<self>*\\)`, [Wn]), 2), pn = F("\\{(?!\\{)(?:(?![}:])<0>)*<1>?\\}", [Yn, Lt]), Xn = me(F(`[^()"'/]|/(?!\\*)|/\\*(?:[^*]|\\*(?!/))*\\*/|<0>|\\(<self>*\\)`, [Kn]), 2), bn = F("\\{(?!\\{)(?:(?![}:])<0>)*<1>?\\}", [Xn, Lt]), fn = (e, t) => ({
|
|
2716
|
-
interpolation: {
|
|
2717
|
-
pattern: O("((?:^|[^{])(?:\\{\\{)*)<0>", [e]),
|
|
2718
|
-
lookbehind: !0,
|
|
2719
|
-
inside: {
|
|
2720
|
-
"format-string": {
|
|
2721
|
-
pattern: O("(^\\{(?:(?![}:])<0>)*)<1>(?=\\}$)", [t, Lt]),
|
|
2722
|
-
lookbehind: !0,
|
|
2723
|
-
inside: {
|
|
2724
|
-
punctuation: /^:/
|
|
2725
|
-
}
|
|
2726
|
-
},
|
|
2727
|
-
punctuation: /^\{|\}$/,
|
|
2728
|
-
expression: {
|
|
2729
|
-
pattern: /[^]+/,
|
|
2730
|
-
alias: "language-csharp",
|
|
2731
|
-
inside: ne
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
},
|
|
2735
|
-
string: /[^]+/
|
|
2736
|
-
});
|
|
2737
|
-
$(ne, "class-name", {
|
|
2738
|
-
attribute: {
|
|
2739
|
-
// Attributes
|
|
2740
|
-
// [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
|
|
2741
|
-
pattern: O("((?:^|[^\\s\\w>)?])\\s*\\[\\s*)(?:<0>\\s*:\\s*)?<1>(?:\\s*,\\s*<1>)*(?=\\s*\\])", [un, Ka], "g"),
|
|
2742
|
-
lookbehind: !0,
|
|
2743
|
-
greedy: !0,
|
|
2744
|
-
inside: {
|
|
2745
|
-
target: {
|
|
2746
|
-
pattern: O("^<0>(?=\\s*:)", [un]),
|
|
2747
|
-
alias: "keyword"
|
|
2748
|
-
},
|
|
2749
|
-
"attribute-arguments": {
|
|
2750
|
-
pattern: O("\\(<0>*\\)", [jn]),
|
|
2751
|
-
inside: ne
|
|
2752
|
-
},
|
|
2753
|
-
"class-name": {
|
|
2754
|
-
pattern: RegExp(le),
|
|
2755
|
-
inside: {
|
|
2756
|
-
punctuation: /\./
|
|
2757
|
-
}
|
|
2758
|
-
},
|
|
2759
|
-
punctuation: /[,:]/
|
|
2760
|
-
}
|
|
2761
|
-
}
|
|
2762
|
-
});
|
|
2763
|
-
$(ne, "string", {
|
|
2764
|
-
"interpolation-string": [
|
|
2765
|
-
{
|
|
2766
|
-
pattern: O('(^|[^\\\\])(?:\\$@|@\\$)"(?:""|\\\\[\\s\\S]|\\{\\{|<0>|[^\\\\{"])*"', [pn], "g"),
|
|
2767
|
-
lookbehind: !0,
|
|
2768
|
-
greedy: !0,
|
|
2769
|
-
inside: fn(pn, Yn)
|
|
2770
|
-
},
|
|
2771
|
-
{
|
|
2772
|
-
pattern: O('(^|[^@\\\\])\\$"(?:\\\\.|\\{\\{|<0>|[^\\\\"{])*"', [bn], "g"),
|
|
2773
|
-
lookbehind: !0,
|
|
2774
|
-
greedy: !0,
|
|
2775
|
-
inside: fn(bn, Xn)
|
|
2776
|
-
}
|
|
2777
|
-
],
|
|
2778
|
-
char: {
|
|
2779
|
-
pattern: RegExp(Zn, "g"),
|
|
2780
|
-
greedy: !0
|
|
2781
|
-
}
|
|
2782
|
-
});
|
|
2783
|
-
_.graphql = {
|
|
2784
|
-
comment: /#.*/,
|
|
2785
|
-
description: {
|
|
2786
|
-
pattern: /(?:"""(?:[^"]|"(?!""))*"""|"(?:\\.|[^\\\n"])*")(?=\s*[a-z_])/gi,
|
|
2787
|
-
greedy: !0,
|
|
2788
|
-
alias: "string",
|
|
2789
|
-
inside: {
|
|
2790
|
-
"language-markdown": {
|
|
2791
|
-
pattern: /("(?!")|""")[^]+(?=\1)/,
|
|
2792
|
-
lookbehind: !0,
|
|
2793
|
-
inside: "md"
|
|
2794
|
-
}
|
|
2795
|
-
}
|
|
2796
|
-
},
|
|
2797
|
-
string: {
|
|
2798
|
-
pattern: /"""[^]*?"""|"(?:\\.|[^\\\n"])*"/g,
|
|
2799
|
-
greedy: !0
|
|
2800
|
-
},
|
|
2801
|
-
number: /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
2802
|
-
boolean: q,
|
|
2803
|
-
variable: /\$[a-z_]\w*/i,
|
|
2804
|
-
directive: {
|
|
2805
|
-
pattern: /@[a-z_]\w*/i,
|
|
2806
|
-
alias: "function"
|
|
2807
|
-
},
|
|
2808
|
-
"attr-name": {
|
|
2809
|
-
pattern: /\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\\n"])*")*\))?:)/gi,
|
|
2810
|
-
greedy: !0
|
|
2811
|
-
},
|
|
2812
|
-
"atom-input": {
|
|
2813
|
-
pattern: /\b[A-Z]\w*Input\b/,
|
|
2814
|
-
alias: "class-name"
|
|
2815
|
-
},
|
|
2816
|
-
scalar: /\b(?:Boolean|Float|ID|Int|String)\b/,
|
|
2817
|
-
constant: /\b[A-Z][A-Z_\d]*\b/,
|
|
2818
|
-
"class-name": {
|
|
2819
|
-
pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,
|
|
2820
|
-
lookbehind: !0
|
|
2821
|
-
},
|
|
2822
|
-
fragment: {
|
|
2823
|
-
pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))(?!\d)\w+/,
|
|
2824
|
-
lookbehind: !0,
|
|
2825
|
-
alias: "function"
|
|
2826
|
-
},
|
|
2827
|
-
"definition-mutation": {
|
|
2828
|
-
pattern: /(\bmutation\s+)(?!\d)\w+/,
|
|
2829
|
-
lookbehind: !0,
|
|
2830
|
-
alias: "function"
|
|
2831
|
-
},
|
|
2832
|
-
"definition-query": {
|
|
2833
|
-
pattern: /(\bquery\s+)(?!\d)\w+/,
|
|
2834
|
-
lookbehind: !0,
|
|
2835
|
-
alias: "function"
|
|
2836
|
-
},
|
|
2837
|
-
keyword: /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
|
|
2838
|
-
operator: /[&|!=]|\.{3}/,
|
|
2839
|
-
"property-query": /\w+(?=\s*\()/,
|
|
2840
|
-
object: /\w+(?=\s*\{)/,
|
|
2841
|
-
punctuation: /[()[\]{},:!=]/,
|
|
2842
|
-
property: /\w+/,
|
|
2843
|
-
[J](e, t) {
|
|
2844
|
-
for (var n = Se(e, t), s = n.filter(({ type: a }) => a && a != "comment" && a != "scalar"), l = s.length, u = 0, f = (a) => {
|
|
2845
|
-
for (var r = 0; r < a.length; r++)
|
|
2846
|
-
if (u + r == l || s[u + r].type != a[r])
|
|
2847
|
-
return !0;
|
|
2848
|
-
}, E = (a, r) => {
|
|
2849
|
-
for (var d = 1, o = u; o < l; o++) {
|
|
2850
|
-
var i = s[o], h = i.content;
|
|
2851
|
-
if (i.type == "punctuation") {
|
|
2852
|
-
if (a == h)
|
|
2853
|
-
d++;
|
|
2854
|
-
else if (r == h && !--d)
|
|
2855
|
-
return o;
|
|
2856
|
-
}
|
|
2857
|
-
}
|
|
2858
|
-
}; u < l; ) {
|
|
2859
|
-
var y = s[u++];
|
|
2860
|
-
if (y.type == "keyword" && y.content == "mutation") {
|
|
2861
|
-
var v = [];
|
|
2862
|
-
if (!f(["definition-mutation", "punctuation"]) && s[u + 1].content == "(") {
|
|
2863
|
-
u += 2;
|
|
2864
|
-
var m = E("(", ")");
|
|
2865
|
-
if (!m) continue;
|
|
2866
|
-
for (; u < m; u++) {
|
|
2867
|
-
var p = s[u];
|
|
2868
|
-
p.type == "variable" && (p.alias = "variable-input", v.push(p.content));
|
|
2869
|
-
}
|
|
2870
|
-
u = m + 1;
|
|
2871
|
-
}
|
|
2872
|
-
if (!f(["punctuation", "property-query"]) && s[u].content == "{" && (s[++u].alias = "property-mutation", v[0])) {
|
|
2873
|
-
var c = E("{", "}");
|
|
2874
|
-
if (c) for (var b = u; b < c; b++) {
|
|
2875
|
-
var g = s[b];
|
|
2876
|
-
g.type == "variable" && v.indexOf(g.content) >= 0 && (g.alias = "variable-input");
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
return n;
|
|
2882
|
-
}
|
|
2883
|
-
};
|
|
2884
|
-
_.webmanifest = _.json = {
|
|
2885
|
-
property: {
|
|
2886
|
-
pattern: /"(?:\\.|[^\\\n"])*"(?=\s*:)/g,
|
|
2887
|
-
greedy: !0
|
|
2888
|
-
},
|
|
2889
|
-
string: {
|
|
2890
|
-
pattern: /"(?:\\.|[^\\\n"])*"/g,
|
|
2891
|
-
greedy: !0
|
|
2892
|
-
},
|
|
2893
|
-
comment: re(),
|
|
2894
|
-
number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
2895
|
-
operator: /:/,
|
|
2896
|
-
punctuation: /[[\]{},]/,
|
|
2897
|
-
boolean: q,
|
|
2898
|
-
null: {
|
|
2899
|
-
pattern: /\bnull\b/,
|
|
2900
|
-
alias: "keyword"
|
|
2901
|
-
}
|
|
2902
|
-
};
|
|
2903
|
-
_.makefile = {
|
|
2904
|
-
comment: /#(?:\\[^]|[^\\\n])*/,
|
|
2905
|
-
string: Tt(),
|
|
2906
|
-
"builtin-target": {
|
|
2907
|
-
pattern: /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
|
|
2908
|
-
alias: "builtin"
|
|
2909
|
-
},
|
|
2910
|
-
target: {
|
|
2911
|
-
pattern: /^(?:[^:=\s]|[ ]+(?![\s:]))+(?=\s*:(?!=))/m,
|
|
2912
|
-
alias: "symbol",
|
|
2913
|
-
inside: {
|
|
2914
|
-
variable: /\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/
|
|
2915
|
-
}
|
|
2916
|
-
},
|
|
2917
|
-
variable: /\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
|
|
2918
|
-
// Directives
|
|
2919
|
-
keyword: /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|override|private|s?include|undefine|unexport|vpath)\b/,
|
|
2920
|
-
function: {
|
|
2921
|
-
pattern: /(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ ])/,
|
|
2922
|
-
lookbehind: !0
|
|
2923
|
-
},
|
|
2924
|
-
operator: /(?:::|[?:+!])?=|[|@]/,
|
|
2925
|
-
punctuation: /[:;(){}]/
|
|
2926
|
-
};
|
|
2927
|
-
var Ct = _.scss = ae("css", {
|
|
2928
|
-
comment: re(),
|
|
2929
|
-
atrule: {
|
|
2930
|
-
pattern: /@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,
|
|
2931
|
-
inside: {
|
|
2932
|
-
rule: /@[\w-]+/,
|
|
2933
|
-
[j]: "scss"
|
|
2934
|
-
}
|
|
2935
|
-
},
|
|
2936
|
-
// url, compassified
|
|
2937
|
-
url: /(?:[-a-z]+-)?url(?=\()/i,
|
|
2938
|
-
// CSS selector regex is not appropriate for Sass
|
|
2939
|
-
// since there can be lot more things (var, @ directive, nesting..)
|
|
2940
|
-
// a selector must start at the end of a property or after a brace (end of other rules or nesting)
|
|
2941
|
-
// it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
|
|
2942
|
-
// the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
|
|
2943
|
-
// can "pass" as a selector- e.g: proper#{$erty})
|
|
2944
|
-
// this one was hard to do, so please be careful if you edit this one :)
|
|
2945
|
-
selector: {
|
|
2946
|
-
// Initial look-ahead is used to prevent matching of blank selectors
|
|
2947
|
-
pattern: /(?!\s)[^@;(){}]?(?:[^@;(){}\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,
|
|
2948
|
-
inside: {
|
|
2949
|
-
parent: {
|
|
2950
|
-
pattern: /&/,
|
|
2951
|
-
alias: "important"
|
|
2952
|
-
},
|
|
2953
|
-
placeholder: /%[-\w]+/,
|
|
2954
|
-
variable: /\$[-\w]+|#\{\$[-\w]+\}/
|
|
2955
|
-
}
|
|
2956
|
-
},
|
|
2957
|
-
property: {
|
|
2958
|
-
pattern: /(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,
|
|
2959
|
-
inside: {
|
|
2960
|
-
variable: /\$[-\w]+|#\{\$[-\w]+\}/
|
|
2961
|
-
}
|
|
2962
|
-
}
|
|
2963
|
-
});
|
|
2964
|
-
$(Ct, "atrule", {
|
|
2965
|
-
keyword: [
|
|
2966
|
-
/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,
|
|
2967
|
-
{
|
|
2968
|
-
pattern: /( )(?:from|through)(?= )/,
|
|
2969
|
-
lookbehind: !0
|
|
2970
|
-
}
|
|
2971
|
-
]
|
|
2972
|
-
});
|
|
2973
|
-
$(Ct, "important", {
|
|
2974
|
-
// var and interpolated vars
|
|
2975
|
-
variable: /\$[-\w]+|#\{\$[-\w]+\}/
|
|
2976
|
-
});
|
|
2977
|
-
$(Ct, "function", {
|
|
2978
|
-
"module-modifier": {
|
|
2979
|
-
pattern: /\b(?:as|hide|show|with)\b/i,
|
|
2980
|
-
alias: "keyword"
|
|
2981
|
-
},
|
|
2982
|
-
placeholder: {
|
|
2983
|
-
pattern: /%[-\w]+/,
|
|
2984
|
-
alias: "selector"
|
|
2985
|
-
},
|
|
2986
|
-
statement: {
|
|
2987
|
-
pattern: /\B!(?:default|optional)\b/i,
|
|
2988
|
-
alias: "keyword"
|
|
2989
|
-
},
|
|
2990
|
-
boolean: q,
|
|
2991
|
-
null: {
|
|
2992
|
-
pattern: /\bnull\b/,
|
|
2993
|
-
alias: "keyword"
|
|
2994
|
-
},
|
|
2995
|
-
operator: {
|
|
2996
|
-
pattern: /(\s)(?:[%/*+-]|[!=]=|[<>]=?|and|not|or)(?!\S)/,
|
|
2997
|
-
lookbehind: !0
|
|
2998
|
-
}
|
|
2999
|
-
});
|
|
3000
|
-
var Qn = {
|
|
3001
|
-
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/g,
|
|
3002
|
-
lookbehind: !0,
|
|
3003
|
-
greedy: !0
|
|
3004
|
-
}, he = _.ts = _.typescript = ae("js", {
|
|
3005
|
-
"class-name": Qn
|
|
3006
|
-
});
|
|
3007
|
-
$(he, "operator", {
|
|
3008
|
-
builtin: /\b(?:Array|Function|Promise|any|boolean|never|number|string|symbol|unknown)\b/
|
|
3009
|
-
});
|
|
3010
|
-
he.keyword.push(
|
|
3011
|
-
/\b(?:abstract|declare|is|keyof|readonly|require)\b|\b(?:asserts|infer|interface|module|namespace|type)\b(?!\s*[^\s{_$a-zA-Z\xa0-\uffff])|\btype(?=\s*\*)/
|
|
3012
|
-
);
|
|
3013
|
-
delete he.parameter;
|
|
3014
|
-
delete he["literal-property"];
|
|
3015
|
-
var Mt = Qn.inside = Object.assign({}, he);
|
|
3016
|
-
delete Mt["class-name"];
|
|
3017
|
-
delete Mt["maybe-class-name"];
|
|
3018
|
-
$(he, "function", {
|
|
3019
|
-
decorator: {
|
|
3020
|
-
pattern: /@[$\w\xa0-\uffff]+/,
|
|
3021
|
-
inside: {
|
|
3022
|
-
at: {
|
|
3023
|
-
pattern: /^@/,
|
|
3024
|
-
alias: "operator"
|
|
3025
|
-
},
|
|
3026
|
-
function: /.+/
|
|
3027
|
-
}
|
|
3028
|
-
},
|
|
3029
|
-
"generic-function": {
|
|
3030
|
-
// e.g. foo<T extends "bar" | "baz">( ...
|
|
3031
|
-
pattern: /#?(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+\s*<(?:[^<>=]|=[^<]|=?<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/g,
|
|
3032
|
-
greedy: !0,
|
|
3033
|
-
inside: {
|
|
3034
|
-
generic: {
|
|
3035
|
-
pattern: /<[^]+/,
|
|
3036
|
-
// everything after the first <
|
|
3037
|
-
alias: "class-name",
|
|
3038
|
-
inside: Mt
|
|
3039
|
-
},
|
|
3040
|
-
function: /\S+/
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
});
|
|
3044
|
-
Gn(_.ts, "tsx");
|
|
3045
|
-
var vt = _.tsx.tag, Jn = "(?:^|(";
|
|
3046
|
-
try {
|
|
3047
|
-
RegExp("(?<=)"), Jn += "?<=";
|
|
3048
|
-
} catch {
|
|
3049
|
-
vt.lookbehind = !0;
|
|
3050
|
-
}
|
|
3051
|
-
vt.pattern = RegExp(Jn + `[^\\w$])|(?=</))${vt.pattern.source}`, "g");
|
|
3052
|
-
var wt = /[*&][^\s[\]{},]+/, At = /!(?:<[\w%#;/?:@&=$,.!~*'()[\]+-]+>|(?:[a-zA-Z\d-]*!)?[\w%#;/?:@&=$.~*'()+-]+)?/, It = `(?:${At.source}(?:[ ]+${wt.source})?|${wt.source}(?:[ ]+${At.source})?)`, Wa = F(
|
|
3053
|
-
"(?:[^\\s\0-\\x08\\x0e-\\x1f!\"#%&'*,:>?@[\\]{}`|\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff-]|[?:-]<0>)(?:[ ]*(?:(?![#:])<0>|:<0>))*",
|
|
3054
|
-
["[^\\s\0-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]"]
|
|
3055
|
-
), gn = `"(?:\\\\.|[^\\\\
|
|
3056
|
-
"])*"|'(?:\\\\.|[^\\\\
|
|
3057
|
-
'])*'`, we = (e, t) => O(
|
|
3058
|
-
`([:,[{-]\\s*(?:\\s<0>[ ]+)?)<1>(?=[ ]*(?:$|,|\\]|\\}|(?:
|
|
3059
|
-
\\s*)?#))`,
|
|
3060
|
-
[It, e],
|
|
3061
|
-
t
|
|
3062
|
-
);
|
|
3063
|
-
_.yml = _.yaml = {
|
|
3064
|
-
scalar: {
|
|
3065
|
-
pattern: O(`([:-]\\s*(?:\\s<0>[ ]+)?[|>])[ ]*(?:(
|
|
3066
|
-
[ ]+)\\S.*(?:\\2.+)*)`, [It]),
|
|
3067
|
-
lookbehind: !0,
|
|
3068
|
-
alias: "string"
|
|
3069
|
-
},
|
|
3070
|
-
comment: /#.*/,
|
|
3071
|
-
key: {
|
|
3072
|
-
pattern: O(
|
|
3073
|
-
`((?:^|[:,[{
|
|
3074
|
-
?-])[ ]*(?:<0>[ ]+)?)<1>(?=\\s*:\\s)`,
|
|
3075
|
-
[It, "(?:" + Wa + "|" + gn + ")"],
|
|
3076
|
-
"g"
|
|
3077
|
-
),
|
|
3078
|
-
lookbehind: !0,
|
|
3079
|
-
greedy: !0,
|
|
3080
|
-
alias: "atrule"
|
|
3081
|
-
},
|
|
3082
|
-
directive: {
|
|
3083
|
-
pattern: /(^[ ]*)%.+/m,
|
|
3084
|
-
lookbehind: !0,
|
|
3085
|
-
alias: "important"
|
|
3086
|
-
},
|
|
3087
|
-
datetime: {
|
|
3088
|
-
pattern: we("\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ ]+)\\d\\d?:\\d\\d:\\d\\d(?:\\.\\d*)?(?:[ ]*(?:Z|[+-]\\d\\d?(?::\\d\\d)?))?|\\d{4}-\\d\\d-\\d\\d|\\d\\d?:\\d\\d(?::\\d\\d(?:\\.\\d*)?)?", "m"),
|
|
3089
|
-
lookbehind: !0,
|
|
3090
|
-
alias: "number"
|
|
3091
|
-
},
|
|
3092
|
-
boolean: {
|
|
3093
|
-
pattern: we("false|true", "im"),
|
|
3094
|
-
lookbehind: !0,
|
|
3095
|
-
alias: "important"
|
|
3096
|
-
},
|
|
3097
|
-
null: {
|
|
3098
|
-
pattern: we("null|~", "im"),
|
|
3099
|
-
lookbehind: !0,
|
|
3100
|
-
alias: "important"
|
|
3101
|
-
},
|
|
3102
|
-
string: {
|
|
3103
|
-
pattern: we(gn, "mg"),
|
|
3104
|
-
lookbehind: !0,
|
|
3105
|
-
greedy: !0
|
|
3106
|
-
},
|
|
3107
|
-
number: {
|
|
3108
|
-
pattern: we("[+-]?(?:0x[a-f\\d]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)", "im"),
|
|
3109
|
-
lookbehind: !0
|
|
3110
|
-
},
|
|
3111
|
-
tag: At,
|
|
3112
|
-
important: wt,
|
|
3113
|
-
punctuation: /---|[:[\]{},|>?-]|\.{3}/
|
|
3114
|
-
};
|
|
3115
|
-
var mn = {
|
|
3116
|
-
pattern: /\\[\\()[\]{}^$+*?|.]/,
|
|
3117
|
-
alias: "escape"
|
|
3118
|
-
}, Be = /\\(?:x[a-fA-F\d]{2}|u[a-fA-F\d]{4}|u\{[a-fA-F\d]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/, ja = {
|
|
3119
|
-
pattern: /\.|\\[wsd]|\\p\{[^{}]+\}/i,
|
|
3120
|
-
alias: "class-name"
|
|
3121
|
-
}, Ya = {
|
|
3122
|
-
pattern: /\\[wsd]|\\p\{[^{}]+\}/i,
|
|
3123
|
-
alias: "class-name"
|
|
3124
|
-
}, hn = "(?:[^\\\\-]|" + Be.source + ")", Xa = RegExp(hn + "-" + hn), _n = {
|
|
3125
|
-
pattern: /(<|')[^<>']+(?=[>']$)/,
|
|
3126
|
-
lookbehind: !0,
|
|
3127
|
-
alias: "variable"
|
|
3128
|
-
};
|
|
3129
|
-
_.regex = {
|
|
3130
|
-
"char-class": {
|
|
3131
|
-
pattern: /((?:^|[^\\])(?:\\\\)*)\[(?:\\[^]|[^\\\]])*\]/,
|
|
3132
|
-
lookbehind: !0,
|
|
3133
|
-
inside: {
|
|
3134
|
-
"char-class-punctuation": {
|
|
3135
|
-
pattern: /^.|.$/g,
|
|
3136
|
-
greedy: !0,
|
|
3137
|
-
alias: "punctuation"
|
|
3138
|
-
},
|
|
3139
|
-
"char-class-negation": {
|
|
3140
|
-
pattern: /^\^/,
|
|
3141
|
-
alias: "operator"
|
|
3142
|
-
},
|
|
3143
|
-
range: {
|
|
3144
|
-
pattern: Xa,
|
|
3145
|
-
inside: {
|
|
3146
|
-
escape: Be,
|
|
3147
|
-
"range-punctuation": {
|
|
3148
|
-
pattern: /-/,
|
|
3149
|
-
alias: "operator"
|
|
3150
|
-
}
|
|
3151
|
-
}
|
|
3152
|
-
},
|
|
3153
|
-
"special-escape": mn,
|
|
3154
|
-
"char-set": Ya,
|
|
3155
|
-
escape: Be
|
|
3156
|
-
}
|
|
3157
|
-
},
|
|
3158
|
-
"special-escape": mn,
|
|
3159
|
-
"char-set": ja,
|
|
3160
|
-
backreference: [
|
|
3161
|
-
{
|
|
3162
|
-
// a backreference which is not an octal escape
|
|
3163
|
-
pattern: /\\(?![123][0-7]{2})[1-9]/,
|
|
3164
|
-
alias: "keyword"
|
|
3165
|
-
},
|
|
3166
|
-
{
|
|
3167
|
-
pattern: /\\k<[^<>']+>/,
|
|
3168
|
-
alias: "keyword",
|
|
3169
|
-
inside: {
|
|
3170
|
-
"group-name": _n
|
|
3171
|
-
}
|
|
3172
|
-
}
|
|
3173
|
-
],
|
|
3174
|
-
anchor: {
|
|
3175
|
-
pattern: /[$^]|\\[ABbGZz]/,
|
|
3176
|
-
alias: "function"
|
|
3177
|
-
},
|
|
3178
|
-
escape: Be,
|
|
3179
|
-
group: [
|
|
3180
|
-
{
|
|
3181
|
-
// https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html
|
|
3182
|
-
// https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference?view=netframework-4.7.2#grouping-constructs
|
|
3183
|
-
// (), (?<name>), (?'name'), (?>), (?:), (?=), (?!), (?<=), (?<!), (?is-m), (?i-m:)
|
|
3184
|
-
pattern: /(\()\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[!=]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?)/,
|
|
3185
|
-
lookbehind: !0,
|
|
3186
|
-
inside: {
|
|
3187
|
-
"group-name": _n
|
|
3188
|
-
}
|
|
3189
|
-
},
|
|
3190
|
-
{
|
|
3191
|
-
pattern: /[()]/,
|
|
3192
|
-
alias: "punctuation"
|
|
3193
|
-
}
|
|
3194
|
-
],
|
|
3195
|
-
quantifier: {
|
|
3196
|
-
pattern: /(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,
|
|
3197
|
-
alias: "number"
|
|
3198
|
-
},
|
|
3199
|
-
alternation: {
|
|
3200
|
-
pattern: /\|/,
|
|
3201
|
-
alias: "keyword"
|
|
3202
|
-
}
|
|
3203
|
-
};
|
|
3204
|
-
var En = /\/\*[^]*?\*\/|\/\/.*|#(?!\[).*/, yn = [
|
|
3205
|
-
{
|
|
3206
|
-
pattern: /\b(?:false|true)\b/i,
|
|
3207
|
-
alias: "boolean"
|
|
3208
|
-
},
|
|
3209
|
-
{
|
|
3210
|
-
pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/gi,
|
|
3211
|
-
lookbehind: !0,
|
|
3212
|
-
greedy: !0
|
|
3213
|
-
},
|
|
3214
|
-
{
|
|
3215
|
-
pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/gi,
|
|
3216
|
-
lookbehind: !0,
|
|
3217
|
-
greedy: !0
|
|
3218
|
-
},
|
|
3219
|
-
/\b(?:null)\b/i,
|
|
3220
|
-
/\b[A-Z_][A-Z\d_]*\b(?!\s*\()/
|
|
3221
|
-
], vn = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[a-f\d]+(?:_[a-f\d]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i, wn = /<?=>|\?\?=?|\.{3}|\??->|[!=]==|::|--|\+\+|&&|\*\*=?|\|\||>>|<<|[?~]|[.%&|^!=<>/*+-]=?/, Rt = {
|
|
3222
|
-
pattern: /\{\$(?:[^{}]|\{(?:[^{}]|\{[^}]+\})*\})*\}|(^|[^\\{])\$+(?:\w+(?:\[[^\n[\]]*\]|->\w+)?)/,
|
|
3223
|
-
lookbehind: !0
|
|
3224
|
-
}, An = [
|
|
3225
|
-
{
|
|
3226
|
-
pattern: /<<<'([^']+)'\n(?:.*\n)*?\1;/g,
|
|
3227
|
-
alias: "nowdoc-string",
|
|
3228
|
-
greedy: !0,
|
|
3229
|
-
inside: {
|
|
3230
|
-
delimiter: {
|
|
3231
|
-
pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
|
|
3232
|
-
alias: "symbol",
|
|
3233
|
-
inside: {
|
|
3234
|
-
punctuation: /^<<<'?|[';]$/
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
|
-
}
|
|
3238
|
-
},
|
|
3239
|
-
{
|
|
3240
|
-
pattern: /<<<(?:"([^"]+)"\n(?:.*\n)*?\1;|([a-z_]\w*)\n(?:.*\n)*?\2;)/gi,
|
|
3241
|
-
greedy: !0,
|
|
3242
|
-
alias: "heredoc-string",
|
|
3243
|
-
inside: {
|
|
3244
|
-
delimiter: {
|
|
3245
|
-
pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
|
|
3246
|
-
alias: "symbol",
|
|
3247
|
-
inside: {
|
|
3248
|
-
punctuation: /^<<<"?|[";]$/
|
|
3249
|
-
}
|
|
3250
|
-
},
|
|
3251
|
-
interpolation: Rt
|
|
3252
|
-
}
|
|
3253
|
-
},
|
|
3254
|
-
{
|
|
3255
|
-
pattern: /`(?:\\[^]|[^\\`])*`/g,
|
|
3256
|
-
alias: "backtick-quoted-string",
|
|
3257
|
-
greedy: !0
|
|
3258
|
-
},
|
|
3259
|
-
{
|
|
3260
|
-
pattern: /'(?:\\[^]|[^\\'])*'/g,
|
|
3261
|
-
greedy: !0,
|
|
3262
|
-
alias: "single-quoted-string"
|
|
3263
|
-
},
|
|
3264
|
-
{
|
|
3265
|
-
pattern: /"(?:\\[^]|[^\\"])*"/g,
|
|
3266
|
-
greedy: !0,
|
|
3267
|
-
alias: "double-quoted-string",
|
|
3268
|
-
inside: {
|
|
3269
|
-
interpolation: Rt
|
|
3270
|
-
}
|
|
3271
|
-
}
|
|
3272
|
-
], In = Rt.inside = {
|
|
3273
|
-
delimiter: {
|
|
3274
|
-
pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
|
|
3275
|
-
alias: "important"
|
|
3276
|
-
},
|
|
3277
|
-
"doc-comment": {
|
|
3278
|
-
pattern: /\/\*\*(?!\/)[^]*?\*\//g,
|
|
3279
|
-
greedy: !0,
|
|
3280
|
-
alias: "comment",
|
|
3281
|
-
inside: "phpdoc"
|
|
3282
|
-
},
|
|
3283
|
-
comment: En,
|
|
3284
|
-
string: An,
|
|
3285
|
-
attribute: {
|
|
3286
|
-
pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[^]|[^\\"])*"|'(?:\\[^]|[^\\'])*')+\](?=\s*[a-z$#])/img,
|
|
3287
|
-
greedy: !0,
|
|
3288
|
-
inside: {
|
|
3289
|
-
"attribute-content": {
|
|
3290
|
-
pattern: /^(..)[^]+(?=.)/,
|
|
3291
|
-
lookbehind: !0,
|
|
3292
|
-
// inside can appear subset of php
|
|
3293
|
-
inside: {
|
|
3294
|
-
comment: En,
|
|
3295
|
-
string: An,
|
|
3296
|
-
"attribute-class-name": [
|
|
3297
|
-
{
|
|
3298
|
-
pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/gi,
|
|
3299
|
-
lookbehind: !0,
|
|
3300
|
-
greedy: !0,
|
|
3301
|
-
alias: "class-name"
|
|
3302
|
-
},
|
|
3303
|
-
{
|
|
3304
|
-
pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/gi,
|
|
3305
|
-
lookbehind: !0,
|
|
3306
|
-
greedy: !0,
|
|
3307
|
-
alias: "class-name class-name-fully-qualified",
|
|
3308
|
-
inside: {
|
|
3309
|
-
punctuation: /\\/
|
|
3310
|
-
}
|
|
3311
|
-
}
|
|
3312
|
-
],
|
|
3313
|
-
constant: yn,
|
|
3314
|
-
number: vn,
|
|
3315
|
-
operator: wn,
|
|
3316
|
-
punctuation: te
|
|
3317
|
-
}
|
|
3318
|
-
},
|
|
3319
|
-
delimiter: {
|
|
3320
|
-
pattern: /.+/,
|
|
3321
|
-
alias: "punctuation"
|
|
3322
|
-
}
|
|
3323
|
-
}
|
|
3324
|
-
},
|
|
3325
|
-
variable: /\$+(?:\w+|(?=\{))/,
|
|
3326
|
-
package: {
|
|
3327
|
-
pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
|
|
3328
|
-
lookbehind: !0,
|
|
3329
|
-
inside: {
|
|
3330
|
-
punctuation: /\\/
|
|
3331
|
-
}
|
|
3332
|
-
},
|
|
3333
|
-
"class-name-definition": {
|
|
3334
|
-
pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
|
|
3335
|
-
lookbehind: !0,
|
|
3336
|
-
alias: "class-name"
|
|
3337
|
-
},
|
|
3338
|
-
"function-definition": {
|
|
3339
|
-
pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
|
|
3340
|
-
lookbehind: !0,
|
|
3341
|
-
alias: "function"
|
|
3342
|
-
},
|
|
3343
|
-
keyword: [
|
|
3344
|
-
{
|
|
3345
|
-
pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/gi,
|
|
3346
|
-
lookbehind: !0,
|
|
3347
|
-
greedy: !0,
|
|
3348
|
-
alias: "type-casting"
|
|
3349
|
-
},
|
|
3350
|
-
{
|
|
3351
|
-
pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/gi,
|
|
3352
|
-
lookbehind: !0,
|
|
3353
|
-
greedy: !0,
|
|
3354
|
-
alias: "type-hint"
|
|
3355
|
-
},
|
|
3356
|
-
{
|
|
3357
|
-
pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/gi,
|
|
3358
|
-
lookbehind: !0,
|
|
3359
|
-
greedy: !0,
|
|
3360
|
-
alias: "return-type"
|
|
3361
|
-
},
|
|
3362
|
-
{
|
|
3363
|
-
pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/gi,
|
|
3364
|
-
alias: "type-declaration",
|
|
3365
|
-
greedy: !0
|
|
3366
|
-
},
|
|
3367
|
-
{
|
|
3368
|
-
pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/gi,
|
|
3369
|
-
lookbehind: !0,
|
|
3370
|
-
greedy: !0,
|
|
3371
|
-
alias: "type-declaration"
|
|
3372
|
-
},
|
|
3373
|
-
{
|
|
3374
|
-
pattern: /\b(?:parent|self|static)(?=\s*::)/gi,
|
|
3375
|
-
greedy: !0,
|
|
3376
|
-
alias: "static-context"
|
|
3377
|
-
},
|
|
3378
|
-
{
|
|
3379
|
-
// yield from
|
|
3380
|
-
pattern: /(\byield\s+)from\b/gi,
|
|
3381
|
-
lookbehind: !0
|
|
3382
|
-
},
|
|
3383
|
-
// `class` is always a keyword unlike other keywords
|
|
3384
|
-
/\bclass\b/i,
|
|
3385
|
-
{
|
|
3386
|
-
// https://www.php.net/manual/en/reserved.keywords.php
|
|
3387
|
-
//
|
|
3388
|
-
// keywords cannot be preceded by "->"
|
|
3389
|
-
// the complex lookbehind means `(?<!(?:->|::)\s*)`
|
|
3390
|
-
pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|[fx]?or|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|yield|__halt_compiler)\b/i,
|
|
3391
|
-
lookbehind: !0
|
|
3392
|
-
}
|
|
3393
|
-
],
|
|
3394
|
-
"argument-name": {
|
|
3395
|
-
pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,
|
|
3396
|
-
lookbehind: !0
|
|
3397
|
-
},
|
|
3398
|
-
"class-name": [
|
|
3399
|
-
{
|
|
3400
|
-
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/gi,
|
|
3401
|
-
lookbehind: !0,
|
|
3402
|
-
greedy: !0
|
|
3403
|
-
},
|
|
3404
|
-
{
|
|
3405
|
-
pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/gi,
|
|
3406
|
-
lookbehind: !0,
|
|
3407
|
-
greedy: !0
|
|
3408
|
-
},
|
|
3409
|
-
{
|
|
3410
|
-
pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/gi,
|
|
3411
|
-
greedy: !0
|
|
3412
|
-
},
|
|
3413
|
-
{
|
|
3414
|
-
pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/gi,
|
|
3415
|
-
lookbehind: !0,
|
|
3416
|
-
greedy: !0,
|
|
3417
|
-
alias: "class-name-fully-qualified",
|
|
3418
|
-
inside: {
|
|
3419
|
-
punctuation: /\\/
|
|
3420
|
-
}
|
|
3421
|
-
},
|
|
3422
|
-
{
|
|
3423
|
-
pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/gi,
|
|
3424
|
-
greedy: !0,
|
|
3425
|
-
alias: "class-name-fully-qualified",
|
|
3426
|
-
inside: {
|
|
3427
|
-
punctuation: /\\/
|
|
3428
|
-
}
|
|
3429
|
-
},
|
|
3430
|
-
{
|
|
3431
|
-
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/gi,
|
|
3432
|
-
lookbehind: !0,
|
|
3433
|
-
greedy: !0,
|
|
3434
|
-
alias: "class-name-fully-qualified",
|
|
3435
|
-
inside: {
|
|
3436
|
-
punctuation: /\\/
|
|
3437
|
-
}
|
|
3438
|
-
},
|
|
3439
|
-
{
|
|
3440
|
-
pattern: /\b[a-z_]\w*(?=\s*\$)/gi,
|
|
3441
|
-
greedy: !0,
|
|
3442
|
-
alias: "type-declaration"
|
|
3443
|
-
},
|
|
3444
|
-
{
|
|
3445
|
-
pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/gi,
|
|
3446
|
-
greedy: !0,
|
|
3447
|
-
alias: "class-name-fully-qualified type-declaration",
|
|
3448
|
-
inside: {
|
|
3449
|
-
punctuation: /\\/
|
|
3450
|
-
}
|
|
3451
|
-
},
|
|
3452
|
-
{
|
|
3453
|
-
pattern: /\b[a-z_]\w*(?=\s*::)/gi,
|
|
3454
|
-
greedy: !0,
|
|
3455
|
-
alias: "static-context"
|
|
3456
|
-
},
|
|
3457
|
-
{
|
|
3458
|
-
pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/gi,
|
|
3459
|
-
greedy: !0,
|
|
3460
|
-
alias: "class-name-fully-qualified static-context",
|
|
3461
|
-
inside: {
|
|
3462
|
-
punctuation: /\\/
|
|
3463
|
-
}
|
|
3464
|
-
},
|
|
3465
|
-
{
|
|
3466
|
-
pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/gi,
|
|
3467
|
-
lookbehind: !0,
|
|
3468
|
-
greedy: !0,
|
|
3469
|
-
alias: "type-hint"
|
|
3470
|
-
},
|
|
3471
|
-
{
|
|
3472
|
-
pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/gi,
|
|
3473
|
-
lookbehind: !0,
|
|
3474
|
-
greedy: !0,
|
|
3475
|
-
alias: "class-name-fully-qualified type-hint",
|
|
3476
|
-
inside: {
|
|
3477
|
-
punctuation: /\\/
|
|
3478
|
-
}
|
|
3479
|
-
},
|
|
3480
|
-
{
|
|
3481
|
-
pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/gi,
|
|
3482
|
-
alias: "return-type",
|
|
3483
|
-
lookbehind: !0,
|
|
3484
|
-
greedy: !0
|
|
3485
|
-
},
|
|
3486
|
-
{
|
|
3487
|
-
pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/gi,
|
|
3488
|
-
lookbehind: !0,
|
|
3489
|
-
greedy: !0,
|
|
3490
|
-
alias: "class-name-fully-qualified return-type",
|
|
3491
|
-
inside: {
|
|
3492
|
-
punctuation: /\\/
|
|
3493
|
-
}
|
|
3494
|
-
}
|
|
3495
|
-
],
|
|
3496
|
-
constant: yn,
|
|
3497
|
-
function: {
|
|
3498
|
-
pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
|
|
3499
|
-
lookbehind: !0,
|
|
3500
|
-
inside: {
|
|
3501
|
-
punctuation: /\\/
|
|
3502
|
-
}
|
|
3503
|
-
},
|
|
3504
|
-
property: {
|
|
3505
|
-
pattern: /(->\s*)\w+/,
|
|
3506
|
-
lookbehind: !0
|
|
3507
|
-
},
|
|
3508
|
-
number: vn,
|
|
3509
|
-
operator: wn,
|
|
3510
|
-
punctuation: te
|
|
3511
|
-
}, Qa = Un("html");
|
|
3512
|
-
_.php = {
|
|
3513
|
-
php: {
|
|
3514
|
-
pattern: /<\?(?:[^"'/#]|\/(?![*/])|(["'])(?:\\[^]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^\n?]|\?(?!>))*(?=$|\?>|\n)|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/,
|
|
3515
|
-
alias: "language-php",
|
|
3516
|
-
inside: In
|
|
3517
|
-
},
|
|
3518
|
-
[J]: (e, t) => e.includes("<?") ? Qa(e, t) : ke(e, In)
|
|
3519
|
-
};
|
|
3520
|
-
var Ja = [`(?:\\\\.|[^\\\\
|
|
3521
|
-
]|
|
|
3522
|
-
(?!
|
|
3523
|
-
))`], Me = (e) => O(`((?:^|[^\\\\])(?:\\\\\\\\)*)(?:${e})`, Ja, "g"), kt = /(?:\\.|``(?:[^\n`]|`(?!`))+``|`[^\n`]+`|[^\\\n|`])+/, Rn = F(`\\|?<0>(?:\\|<0>)+\\|?(?:
|
|
3524
|
-
|(?![\\s\\S]))`, [kt.source]), er = `\\|?[ ]*:?-{3,}:?[ ]*(?:\\|[ ]*:?-{3,}:?[ ]*)+\\|?
|
|
3525
|
-
`, fe = _.md = _.markdown = Qe(_.html);
|
|
3526
|
-
$(fe, "prolog", {
|
|
3527
|
-
"front-matter-block": {
|
|
3528
|
-
pattern: /(^(?:\s*\n)?)---(?!.)[^]*?\n---(?!.)/g,
|
|
3529
|
-
lookbehind: !0,
|
|
3530
|
-
greedy: !0,
|
|
3531
|
-
inside: {
|
|
3532
|
-
punctuation: /^---|---$/,
|
|
3533
|
-
"front-matter": {
|
|
3534
|
-
pattern: /\S(?:[^]*\S)?/,
|
|
3535
|
-
alias: "language-yaml",
|
|
3536
|
-
inside: "yaml"
|
|
3537
|
-
}
|
|
3538
|
-
}
|
|
3539
|
-
},
|
|
3540
|
-
blockquote: {
|
|
3541
|
-
// > ...
|
|
3542
|
-
pattern: /^>(?:[ ]*>)*/m,
|
|
3543
|
-
alias: "punctuation"
|
|
3544
|
-
},
|
|
3545
|
-
table: {
|
|
3546
|
-
pattern: RegExp("^" + Rn + er + "(?:" + Rn + ")*", "m"),
|
|
3547
|
-
inside: {
|
|
3548
|
-
"table-header-row": {
|
|
3549
|
-
pattern: /^.+/,
|
|
3550
|
-
inside: {
|
|
3551
|
-
"table-header": {
|
|
3552
|
-
pattern: kt,
|
|
3553
|
-
alias: "important",
|
|
3554
|
-
inside: fe
|
|
3555
|
-
},
|
|
3556
|
-
punctuation: /\|/
|
|
3557
|
-
}
|
|
3558
|
-
},
|
|
3559
|
-
"table-data-rows": {
|
|
3560
|
-
pattern: /(.+\n)[^]+/,
|
|
3561
|
-
lookbehind: !0,
|
|
3562
|
-
inside: {
|
|
3563
|
-
"table-data": {
|
|
3564
|
-
pattern: kt,
|
|
3565
|
-
inside: fe
|
|
3566
|
-
},
|
|
3567
|
-
punctuation: /\|/
|
|
3568
|
-
}
|
|
3569
|
-
},
|
|
3570
|
-
"table-line": {
|
|
3571
|
-
pattern: /.+/,
|
|
3572
|
-
inside: {
|
|
3573
|
-
punctuation: /\S+/
|
|
3574
|
-
}
|
|
3575
|
-
}
|
|
3576
|
-
}
|
|
3577
|
-
},
|
|
3578
|
-
code: [
|
|
3579
|
-
{
|
|
3580
|
-
// Prefixed by 4 spaces or 1 tab and preceded by an empty line
|
|
3581
|
-
pattern: /(^[ ]*\n)(?: | ).+(?:\n(?: | ).+)*/m,
|
|
3582
|
-
lookbehind: !0,
|
|
3583
|
-
alias: "keyword"
|
|
3584
|
-
},
|
|
3585
|
-
{
|
|
3586
|
-
// ```optional language
|
|
3587
|
-
// code block
|
|
3588
|
-
// ```
|
|
3589
|
-
pattern: /^(```+)[^`][^]*?^\1`*$/mg,
|
|
3590
|
-
greedy: !0,
|
|
3591
|
-
inside: {
|
|
3592
|
-
punctuation: /^`+|`+$/,
|
|
3593
|
-
"code-language": /^.+/,
|
|
3594
|
-
"code-block": /(?!^)[^]+(?=\n)/,
|
|
3595
|
-
[J](e, t) {
|
|
3596
|
-
var n = Se(e, t), s;
|
|
3597
|
-
return n[5] && (s = (/[a-z][\w-]*/i.exec(
|
|
3598
|
-
n[1].content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp")
|
|
3599
|
-
) || [""])[0].toLowerCase(), n[3].alias = "language-" + s, (t = _[s]) && (n[3].content = ke(n[3].content, t))), n;
|
|
3600
|
-
}
|
|
3601
|
-
}
|
|
3602
|
-
}
|
|
3603
|
-
],
|
|
3604
|
-
title: [
|
|
3605
|
-
{
|
|
3606
|
-
// title 1
|
|
3607
|
-
// =======
|
|
3608
|
-
// title 2
|
|
3609
|
-
// -------
|
|
3610
|
-
pattern: /\S.*\n(?:==+|--+)(?=[ ]*$)/m,
|
|
3611
|
-
alias: "important",
|
|
3612
|
-
inside: {
|
|
3613
|
-
punctuation: /=+$|-+$/
|
|
3614
|
-
}
|
|
3615
|
-
},
|
|
3616
|
-
{
|
|
3617
|
-
// # title 1
|
|
3618
|
-
// ###### title 6
|
|
3619
|
-
pattern: /(^\s*)#.+/m,
|
|
3620
|
-
lookbehind: !0,
|
|
3621
|
-
alias: "important",
|
|
3622
|
-
inside: {
|
|
3623
|
-
punctuation: /^#+|#+$/
|
|
3624
|
-
}
|
|
3625
|
-
}
|
|
3626
|
-
],
|
|
3627
|
-
hr: {
|
|
3628
|
-
// ***
|
|
3629
|
-
// ---
|
|
3630
|
-
// * * *
|
|
3631
|
-
// -----------
|
|
3632
|
-
pattern: /(^\s*)([*-])(?:[ ]*\2){2,}(?=\s*$)/m,
|
|
3633
|
-
lookbehind: !0,
|
|
3634
|
-
alias: "punctuation"
|
|
3635
|
-
},
|
|
3636
|
-
list: {
|
|
3637
|
-
// * item
|
|
3638
|
-
// + item
|
|
3639
|
-
// - item
|
|
3640
|
-
// 1. item
|
|
3641
|
-
pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[ ].)/m,
|
|
3642
|
-
lookbehind: !0,
|
|
3643
|
-
alias: "punctuation"
|
|
3644
|
-
},
|
|
3645
|
-
"url-reference": {
|
|
3646
|
-
// [id]: http://example.com "Optional title"
|
|
3647
|
-
// [id]: http://example.com 'Optional title'
|
|
3648
|
-
// [id]: http://example.com (Optional title)
|
|
3649
|
-
// [id]: <http://example.com> "Optional title"
|
|
3650
|
-
pattern: /!?\[[^\]]+\]:[ ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[ ]+(?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*'|\((?:\\.|[^)\\])*\)))?/,
|
|
3651
|
-
inside: {
|
|
3652
|
-
variable: {
|
|
3653
|
-
pattern: /^(!?\[)[^\]]+/,
|
|
3654
|
-
lookbehind: !0
|
|
3655
|
-
},
|
|
3656
|
-
string: /(?:"(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*'|\((?:\\.|[^)\\])*\))$/,
|
|
3657
|
-
punctuation: /^[[\]!:]|<|>/
|
|
3658
|
-
},
|
|
3659
|
-
alias: "url"
|
|
3660
|
-
},
|
|
3661
|
-
bold: {
|
|
3662
|
-
// **strong**
|
|
3663
|
-
// __strong__
|
|
3664
|
-
// allow one nested instance of italic text using the same delimiter
|
|
3665
|
-
pattern: Me("\\b__(?:(?!_)<0>|_(?:(?!_)<0>)+_)+__\\b|\\*\\*(?:(?!\\*)<0>|\\*(?:(?!\\*)<0>)+\\*)+\\*\\*"),
|
|
3666
|
-
lookbehind: !0,
|
|
3667
|
-
greedy: !0,
|
|
3668
|
-
inside: {
|
|
3669
|
-
content: {
|
|
3670
|
-
pattern: /(^..)[^]+(?=..)/,
|
|
3671
|
-
lookbehind: !0,
|
|
3672
|
-
inside: {}
|
|
3673
|
-
// see below
|
|
3674
|
-
},
|
|
3675
|
-
punctuation: /../
|
|
3676
|
-
}
|
|
3677
|
-
},
|
|
3678
|
-
italic: {
|
|
3679
|
-
// *em*
|
|
3680
|
-
// _em_
|
|
3681
|
-
// allow one nested instance of bold text using the same delimiter
|
|
3682
|
-
pattern: Me("\\b_(?:(?!_)<0>|__(?:(?!_)<0>)+__)+_\\b|\\*(?:(?!\\*)<0>|\\*\\*(?:(?!\\*)<0>)+\\*\\*)+\\*"),
|
|
3683
|
-
lookbehind: !0,
|
|
3684
|
-
greedy: !0,
|
|
3685
|
-
inside: {
|
|
3686
|
-
content: {
|
|
3687
|
-
pattern: /(?!^)[^]+(?=.)/,
|
|
3688
|
-
inside: {}
|
|
3689
|
-
// see below
|
|
3690
|
-
},
|
|
3691
|
-
punctuation: /./
|
|
3692
|
-
}
|
|
3693
|
-
},
|
|
3694
|
-
strike: {
|
|
3695
|
-
// ~~strike through~~
|
|
3696
|
-
// ~strike~
|
|
3697
|
-
// eslint-disable-next-line regexp/strict
|
|
3698
|
-
pattern: Me("(~~?)(?:(?!~)<0>)+\\2"),
|
|
3699
|
-
lookbehind: !0,
|
|
3700
|
-
greedy: !0,
|
|
3701
|
-
inside: {
|
|
3702
|
-
punctuation: /^~~?|~~?$/,
|
|
3703
|
-
content: {
|
|
3704
|
-
pattern: /[^]+/,
|
|
3705
|
-
inside: {}
|
|
3706
|
-
// see below
|
|
3707
|
-
}
|
|
3708
|
-
}
|
|
3709
|
-
},
|
|
3710
|
-
"code-snippet": {
|
|
3711
|
-
// `code`
|
|
3712
|
-
// ``code``
|
|
3713
|
-
pattern: /(^|[^\\`])(?:``[^\n`]+(?:`[^\n`]+)*``(?!`)|`[^\n`]+`(?!`))/g,
|
|
3714
|
-
lookbehind: !0,
|
|
3715
|
-
greedy: !0,
|
|
3716
|
-
alias: "code keyword"
|
|
3717
|
-
},
|
|
3718
|
-
url: {
|
|
3719
|
-
// [example](http://example.com "Optional title")
|
|
3720
|
-
// [example][id]
|
|
3721
|
-
// [example] [id]
|
|
3722
|
-
pattern: Me('!?\\[(?:(?!\\])<0>)+\\](?:\\([^\\s)]+(?:[ ]+"(?:\\\\.|[^\\\\"])*")?\\)|[ ]?\\[(?:(?!\\])<0>)+\\])'),
|
|
3723
|
-
lookbehind: !0,
|
|
3724
|
-
greedy: !0,
|
|
3725
|
-
inside: {
|
|
3726
|
-
operator: /^!/,
|
|
3727
|
-
content: {
|
|
3728
|
-
pattern: /(^\[)[^\]]+(?=\])/,
|
|
3729
|
-
lookbehind: !0,
|
|
3730
|
-
inside: {}
|
|
3731
|
-
// see below
|
|
3732
|
-
},
|
|
3733
|
-
variable: {
|
|
3734
|
-
pattern: /(^\][ ]?\[)[^\]]+(?=\]$)/,
|
|
3735
|
-
lookbehind: !0
|
|
3736
|
-
},
|
|
3737
|
-
url: {
|
|
3738
|
-
pattern: /(^\]\()[^\s)]+/,
|
|
3739
|
-
lookbehind: !0
|
|
3740
|
-
},
|
|
3741
|
-
string: {
|
|
3742
|
-
pattern: /(^[ ]+)"(?:\\.|[^\\"])*"(?=\)$)/,
|
|
3743
|
-
lookbehind: !0
|
|
3744
|
-
},
|
|
3745
|
-
"markup-bracket": fe["markup-bracket"]
|
|
3746
|
-
}
|
|
3747
|
-
}
|
|
3748
|
-
});
|
|
3749
|
-
["url", "bold", "italic", "strike"].forEach((e) => {
|
|
3750
|
-
["url", "bold", "italic", "strike", "code-snippet", "markup-bracket"].forEach((t) => {
|
|
3751
|
-
e != t && (fe[e].inside.content.inside[t] = fe[t]);
|
|
3752
|
-
});
|
|
3753
|
-
});
|
|
3754
|
-
const tr = "_wrap_1x3wi_1", nr = "_blockInfoEditable_1x3wi_30", kn = {
|
|
3755
|
-
wrap: tr,
|
|
3756
|
-
blockInfoEditable: nr
|
|
3757
|
-
}, Pe = [
|
|
78
|
+
const Y = "_wrap_1x3wi_1", X = "_blockInfoEditable_1x3wi_30", z = {
|
|
79
|
+
wrap: Y,
|
|
80
|
+
blockInfoEditable: X
|
|
81
|
+
}, x = [
|
|
3758
82
|
{ value: "plaintext", label: "plaintext" },
|
|
3759
83
|
{ value: "javascript", label: "JavaScript" },
|
|
3760
84
|
{ value: "typescript", label: "TypeScript" },
|
|
@@ -3771,182 +95,182 @@ const tr = "_wrap_1x3wi_1", nr = "_blockInfoEditable_1x3wi_30", kn = {
|
|
|
3771
95
|
{ value: "markdown", label: "Markdown" },
|
|
3772
96
|
{ value: "bash", label: "Bash" },
|
|
3773
97
|
{ value: "php", label: "PHP" }
|
|
3774
|
-
],
|
|
3775
|
-
function
|
|
3776
|
-
const
|
|
3777
|
-
|
|
3778
|
-
var
|
|
3779
|
-
(
|
|
98
|
+
], g = [2, 4, 8];
|
|
99
|
+
function Z(e) {
|
|
100
|
+
const i = F(), n = y(null), s = v(() => Q(B.name, e == null ? void 0 : e.editor), [e == null ? void 0 : e.editor]), o = y(null), d = e.node.attrs.code || e.node.textContent || "", c = v((t) => {
|
|
101
|
+
t == null || t.stopPropagation(), setTimeout(() => {
|
|
102
|
+
var a, l, N;
|
|
103
|
+
(N = (l = (a = o.current) == null ? void 0 : a.textarea) == null ? void 0 : l.focus) == null || N.call(l);
|
|
3780
104
|
}, 0);
|
|
3781
|
-
}, []),
|
|
3782
|
-
if (
|
|
105
|
+
}, []), m = async () => {
|
|
106
|
+
if (d)
|
|
3783
107
|
try {
|
|
3784
108
|
if (navigator.clipboard)
|
|
3785
|
-
await navigator.clipboard.writeText(
|
|
109
|
+
await navigator.clipboard.writeText(d);
|
|
3786
110
|
else {
|
|
3787
|
-
const
|
|
3788
|
-
|
|
111
|
+
const t = document.createElement("textarea");
|
|
112
|
+
t.value = d, document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t);
|
|
3789
113
|
}
|
|
3790
|
-
} catch (
|
|
3791
|
-
console.error("Error:",
|
|
114
|
+
} catch (t) {
|
|
115
|
+
console.error("Error:", t);
|
|
3792
116
|
} finally {
|
|
3793
|
-
|
|
117
|
+
c();
|
|
3794
118
|
}
|
|
3795
|
-
},
|
|
119
|
+
}, b = () => {
|
|
3796
120
|
e.updateAttributes({
|
|
3797
121
|
lineNumbers: !e.node.attrs.lineNumbers
|
|
3798
|
-
}),
|
|
3799
|
-
},
|
|
122
|
+
}), c();
|
|
123
|
+
}, p = () => {
|
|
3800
124
|
e.updateAttributes({
|
|
3801
125
|
wordWrap: !e.node.attrs.wordWrap
|
|
3802
|
-
}),
|
|
3803
|
-
},
|
|
3804
|
-
const
|
|
3805
|
-
return
|
|
126
|
+
}), c();
|
|
127
|
+
}, C = (t) => {
|
|
128
|
+
const a = { ...t };
|
|
129
|
+
return a.language && !x.some((l) => l.value === a.language) && (a.language = "plaintext", e.updateAttributes({
|
|
3806
130
|
language: "plaintext"
|
|
3807
|
-
})),
|
|
3808
|
-
},
|
|
3809
|
-
(
|
|
3810
|
-
|
|
131
|
+
})), a;
|
|
132
|
+
}, I = v(
|
|
133
|
+
(t) => {
|
|
134
|
+
c(t);
|
|
3811
135
|
},
|
|
3812
|
-
[
|
|
136
|
+
[c]
|
|
3813
137
|
);
|
|
3814
|
-
return
|
|
138
|
+
return A(() => {
|
|
3815
139
|
if (n.current) {
|
|
3816
|
-
const
|
|
3817
|
-
|
|
3818
|
-
readOnly: !
|
|
3819
|
-
language:
|
|
3820
|
-
tabSize:
|
|
3821
|
-
lineNumbers:
|
|
3822
|
-
wordWrap:
|
|
3823
|
-
value:
|
|
140
|
+
const t = C(e.node.attrs);
|
|
141
|
+
o.current = O(n.current, {
|
|
142
|
+
readOnly: !i,
|
|
143
|
+
language: t.language || "plaintext",
|
|
144
|
+
tabSize: t.tabSize ?? 2,
|
|
145
|
+
lineNumbers: t.lineNumbers ?? !0,
|
|
146
|
+
wordWrap: t.wordWrap ?? !1,
|
|
147
|
+
value: d,
|
|
3824
148
|
rtl: !1,
|
|
3825
|
-
onUpdate(
|
|
149
|
+
onUpdate(a) {
|
|
3826
150
|
queueMicrotask(() => {
|
|
3827
|
-
e.updateAttributes({ code:
|
|
151
|
+
e.updateAttributes({ code: a });
|
|
3828
152
|
});
|
|
3829
153
|
}
|
|
3830
|
-
}),
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
154
|
+
}), o.current.addExtensions(
|
|
155
|
+
U(),
|
|
156
|
+
$(),
|
|
157
|
+
D(),
|
|
158
|
+
G(),
|
|
159
|
+
q(),
|
|
160
|
+
_(),
|
|
161
|
+
J()
|
|
3838
162
|
), e.node.attrs.shouldFocus && setTimeout(() => {
|
|
3839
|
-
|
|
163
|
+
c(), e.updateAttributes({
|
|
3840
164
|
shouldFocus: !1
|
|
3841
165
|
});
|
|
3842
166
|
}, 0);
|
|
3843
167
|
}
|
|
3844
168
|
return () => {
|
|
3845
|
-
var
|
|
3846
|
-
(
|
|
169
|
+
var t, a;
|
|
170
|
+
(t = o.current) != null && t.remove && ((a = o.current) == null || a.remove());
|
|
3847
171
|
};
|
|
3848
|
-
}, [n]),
|
|
3849
|
-
var
|
|
3850
|
-
if ((
|
|
3851
|
-
const
|
|
3852
|
-
(
|
|
172
|
+
}, [n]), A(() => {
|
|
173
|
+
var t, a;
|
|
174
|
+
if ((t = o.current) != null && t.setOptions) {
|
|
175
|
+
const l = C(e.node.attrs);
|
|
176
|
+
(a = o.current) == null || a.setOptions(l);
|
|
3853
177
|
}
|
|
3854
|
-
}, [
|
|
178
|
+
}, [o, e.node.attrs]), /* @__PURE__ */ r(L, { className: h(z.wrap, "render-wrapper"), children: /* @__PURE__ */ r(
|
|
3855
179
|
"div",
|
|
3856
180
|
{
|
|
3857
|
-
onClick:
|
|
181
|
+
onClick: I,
|
|
3858
182
|
ref: n,
|
|
3859
|
-
className:
|
|
183
|
+
className: h(
|
|
3860
184
|
"richtext-node-container richtext-hover-shadow richtext-select-outline richtext-node-code-block !richtext-my-[10px]",
|
|
3861
185
|
{
|
|
3862
|
-
[
|
|
186
|
+
[z.blockInfoEditable]: !i
|
|
3863
187
|
}
|
|
3864
188
|
),
|
|
3865
|
-
children: /* @__PURE__ */
|
|
3866
|
-
/* @__PURE__ */
|
|
3867
|
-
|
|
189
|
+
children: /* @__PURE__ */ f("div", { className: "richtext-code-block-toolbar", children: [
|
|
190
|
+
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ f(
|
|
191
|
+
w,
|
|
3868
192
|
{
|
|
3869
193
|
defaultValue: e.node.attrs.language,
|
|
3870
|
-
disabled: !
|
|
3871
|
-
onValueChange: (
|
|
194
|
+
disabled: !i,
|
|
195
|
+
onValueChange: (t) => {
|
|
3872
196
|
e.updateAttributes({
|
|
3873
|
-
language:
|
|
3874
|
-
}),
|
|
197
|
+
language: t
|
|
198
|
+
}), c();
|
|
3875
199
|
},
|
|
3876
200
|
children: [
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ r(S, { className: "richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ r(K, { placeholder: "Select language" }) }),
|
|
202
|
+
/* @__PURE__ */ r(T, { onCloseAutoFocus: (t) => t.preventDefault(), children: x == null ? void 0 : x.map((t) => /* @__PURE__ */ r(E, { value: t.value, children: t.label }, t.value)) })
|
|
3879
203
|
]
|
|
3880
204
|
}
|
|
3881
205
|
) }),
|
|
3882
|
-
/* @__PURE__ */
|
|
3883
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ r("div", { className: "toolbar-divider" }),
|
|
207
|
+
/* @__PURE__ */ r(
|
|
3884
208
|
"div",
|
|
3885
209
|
{
|
|
3886
210
|
className: "richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
3887
|
-
onClick:
|
|
3888
|
-
children: /* @__PURE__ */
|
|
211
|
+
onClick: m,
|
|
212
|
+
children: /* @__PURE__ */ r(u, { className: "richtext-size-4", name: "Copy" })
|
|
3889
213
|
}
|
|
3890
214
|
),
|
|
3891
|
-
/* @__PURE__ */
|
|
3892
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ r("div", { className: "toolbar-divider" }),
|
|
216
|
+
/* @__PURE__ */ r(
|
|
3893
217
|
"div",
|
|
3894
218
|
{
|
|
3895
|
-
onClick:
|
|
3896
|
-
className:
|
|
219
|
+
onClick: b,
|
|
220
|
+
className: h(
|
|
3897
221
|
"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
3898
222
|
{
|
|
3899
223
|
"richtext-bg-[#5a5d5e4f]": e == null ? void 0 : e.node.attrs.lineNumbers
|
|
3900
224
|
}
|
|
3901
225
|
),
|
|
3902
|
-
children: /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ r(u, { className: "richtext-size-4", name: "List" })
|
|
3903
227
|
}
|
|
3904
228
|
),
|
|
3905
|
-
/* @__PURE__ */
|
|
3906
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ r("div", { className: "toolbar-divider" }),
|
|
230
|
+
/* @__PURE__ */ r(
|
|
3907
231
|
"div",
|
|
3908
232
|
{
|
|
3909
|
-
onClick:
|
|
3910
|
-
className:
|
|
233
|
+
onClick: p,
|
|
234
|
+
className: h(
|
|
3911
235
|
"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
3912
236
|
{
|
|
3913
237
|
"richtext-bg-[#5a5d5e4f]": e == null ? void 0 : e.node.attrs.wordWrap
|
|
3914
238
|
}
|
|
3915
239
|
),
|
|
3916
|
-
children: /* @__PURE__ */
|
|
240
|
+
children: /* @__PURE__ */ r(u, { className: "richtext-size-4", name: "WrapText" })
|
|
3917
241
|
}
|
|
3918
242
|
),
|
|
3919
|
-
/* @__PURE__ */
|
|
3920
|
-
/* @__PURE__ */
|
|
3921
|
-
|
|
243
|
+
/* @__PURE__ */ r("div", { className: "toolbar-divider" }),
|
|
244
|
+
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ f(
|
|
245
|
+
w,
|
|
3922
246
|
{
|
|
3923
247
|
defaultValue: e.node.attrs.tabSize,
|
|
3924
|
-
disabled: !
|
|
3925
|
-
onValueChange: (
|
|
248
|
+
disabled: !i,
|
|
249
|
+
onValueChange: (t) => {
|
|
3926
250
|
e.updateAttributes({
|
|
3927
|
-
tabSize:
|
|
3928
|
-
}),
|
|
251
|
+
tabSize: t
|
|
252
|
+
}), c();
|
|
3929
253
|
},
|
|
3930
254
|
children: [
|
|
3931
|
-
/* @__PURE__ */
|
|
3932
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ r(S, { className: "richtext-h-7 richtext-w-[60px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ r(u, { className: "richtext-size-4", name: "IndentIncrease" }) }),
|
|
256
|
+
/* @__PURE__ */ r(T, { onCloseAutoFocus: (t) => t.preventDefault(), children: g == null ? void 0 : g.map((t) => /* @__PURE__ */ r(E, { value: t, children: t }, t)) })
|
|
3933
257
|
]
|
|
3934
258
|
}
|
|
3935
259
|
) }),
|
|
3936
|
-
/* @__PURE__ */
|
|
3937
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ r("div", { className: "toolbar-divider" }),
|
|
261
|
+
/* @__PURE__ */ r(
|
|
3938
262
|
"div",
|
|
3939
263
|
{
|
|
3940
264
|
className: "richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
3941
265
|
onClick: s,
|
|
3942
|
-
children: /* @__PURE__ */
|
|
266
|
+
children: /* @__PURE__ */ r(u, { className: "richtext-size-4", name: "Trash2" })
|
|
3943
267
|
}
|
|
3944
268
|
)
|
|
3945
269
|
] })
|
|
3946
270
|
}
|
|
3947
271
|
) });
|
|
3948
272
|
}
|
|
3949
|
-
const
|
|
273
|
+
const ee = /^`{3}([a-z]+)?\s$/, te = /^~{3}([a-z]+)?\s$/, B = /* @__PURE__ */ M.create({
|
|
3950
274
|
name: "codeBlock",
|
|
3951
275
|
group: "block",
|
|
3952
276
|
atom: !0,
|
|
@@ -3956,10 +280,10 @@ const rr = /^`{3}([a-z]+)?\s$/, ir = /^~{3}([a-z]+)?\s$/, ea = /* @__PURE__ */ n
|
|
|
3956
280
|
return {
|
|
3957
281
|
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
3958
282
|
languages: [],
|
|
3959
|
-
button: ({ editor:
|
|
283
|
+
button: ({ editor: i, t: n }) => ({
|
|
3960
284
|
componentProps: {
|
|
3961
|
-
action: () =>
|
|
3962
|
-
isActive: () =>
|
|
285
|
+
action: () => i.commands.setCodeBlock({}),
|
|
286
|
+
isActive: () => i.isActive("codeBlock"),
|
|
3963
287
|
disabled: !1,
|
|
3964
288
|
icon: "Code2",
|
|
3965
289
|
tooltip: n("editor.codeblock.tooltip")
|
|
@@ -4010,21 +334,21 @@ const rr = /^`{3}([a-z]+)?\s$/, ir = /^~{3}([a-z]+)?\s$/, ea = /* @__PURE__ */ n
|
|
|
4010
334
|
}
|
|
4011
335
|
];
|
|
4012
336
|
},
|
|
4013
|
-
renderHTML({ HTMLAttributes: e, node:
|
|
337
|
+
renderHTML({ HTMLAttributes: e, node: i }) {
|
|
4014
338
|
var s;
|
|
4015
|
-
const n =
|
|
339
|
+
const n = i.attrs.code || ((s = i.content.firstChild) == null ? void 0 : s.text) || "";
|
|
4016
340
|
return [
|
|
4017
341
|
"pre",
|
|
4018
|
-
|
|
342
|
+
j(this.options.HTMLAttributes, e),
|
|
4019
343
|
["code", {}, n]
|
|
4020
344
|
];
|
|
4021
345
|
},
|
|
4022
346
|
addNodeView() {
|
|
4023
|
-
return
|
|
347
|
+
return W(Z);
|
|
4024
348
|
},
|
|
4025
349
|
addCommands() {
|
|
4026
350
|
return {
|
|
4027
|
-
setCodeBlock: (e) => ({ commands:
|
|
351
|
+
setCodeBlock: (e) => ({ commands: i }) => i.insertContent({
|
|
4028
352
|
type: this.name,
|
|
4029
353
|
attrs: {
|
|
4030
354
|
...e,
|
|
@@ -4040,15 +364,15 @@ const rr = /^`{3}([a-z]+)?\s$/, ir = /^~{3}([a-z]+)?\s$/, ea = /* @__PURE__ */ n
|
|
|
4040
364
|
},
|
|
4041
365
|
addInputRules() {
|
|
4042
366
|
return [
|
|
4043
|
-
|
|
4044
|
-
find:
|
|
367
|
+
k({
|
|
368
|
+
find: ee,
|
|
4045
369
|
type: this.type,
|
|
4046
370
|
getAttributes: (e) => ({
|
|
4047
371
|
language: e[1]
|
|
4048
372
|
})
|
|
4049
373
|
}),
|
|
4050
|
-
|
|
4051
|
-
find:
|
|
374
|
+
k({
|
|
375
|
+
find: te,
|
|
4052
376
|
type: this.type,
|
|
4053
377
|
getAttributes: (e) => ({
|
|
4054
378
|
language: e[1]
|
|
@@ -4058,8 +382,8 @@ const rr = /^`{3}([a-z]+)?\s$/, ir = /^~{3}([a-z]+)?\s$/, ea = /* @__PURE__ */ n
|
|
|
4058
382
|
}
|
|
4059
383
|
});
|
|
4060
384
|
export {
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
385
|
+
B as CodeBlock,
|
|
386
|
+
at as RichTextCodeBlock,
|
|
387
|
+
ee as backtickInputRegex,
|
|
388
|
+
te as tildeInputRegex
|
|
4065
389
|
};
|