reactjs-tiptap-editor 0.2.29 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ActionMenuButton-Bycn676n.js +33 -0
- package/lib/ActionMenuButton-CpFNwSUZ.cjs +1 -0
- package/lib/Attachment.cjs +19 -0
- package/lib/Attachment.d.cts +344 -0
- package/lib/Attachment.d.ts +344 -0
- package/lib/Attachment.js +259 -0
- package/lib/Blockquote.cjs +1 -0
- package/lib/Blockquote.d.cts +343 -0
- package/lib/Blockquote.d.ts +343 -0
- package/lib/Blockquote.js +65 -0
- package/lib/Bold.cjs +1 -0
- package/lib/Bold.d.cts +343 -0
- package/lib/Bold.d.ts +343 -0
- package/lib/Bold.js +90 -0
- package/lib/BulletList.cjs +1 -0
- package/lib/BulletList.d.cts +343 -0
- package/lib/BulletList.d.ts +343 -0
- package/lib/BulletList.js +72 -0
- package/lib/Clear.cjs +1 -0
- package/lib/Clear.d.cts +342 -0
- package/lib/Clear.d.ts +342 -0
- package/lib/Clear.js +23 -0
- package/lib/Code.cjs +1 -0
- package/lib/Code.d.cts +343 -0
- package/lib/Code.d.ts +343 -0
- package/lib/Code.js +70 -0
- package/lib/CodeBlock.cjs +39 -0
- package/lib/CodeBlock.d.cts +352 -0
- package/lib/CodeBlock.d.ts +352 -0
- package/lib/CodeBlock.js +3639 -0
- package/lib/Color.cjs +1 -0
- package/lib/Color.d.cts +350 -0
- package/lib/Color.d.ts +350 -0
- package/lib/Color.js +141 -0
- package/lib/Document.cjs +1 -0
- package/lib/Document.d.cts +272 -0
- package/lib/Document.d.ts +272 -0
- package/lib/Document.js +13 -0
- package/lib/Drawer-BZadE1gM.js +1367 -0
- package/lib/Drawer-rwnFvgZR.cjs +1 -0
- package/lib/Drawer.cjs +1 -0
- package/lib/Drawer.d.cts +344 -0
- package/lib/Drawer.d.ts +344 -0
- package/lib/Drawer.js +7 -0
- package/lib/Emoji.cjs +1 -0
- package/lib/Emoji.d.cts +277 -0
- package/lib/Emoji.d.ts +277 -0
- package/lib/Emoji.js +2168 -0
- package/lib/Excalidraw-B2414Smc.js +651 -0
- package/lib/Excalidraw-D21vMFe0.cjs +1 -0
- package/lib/Excalidraw.cjs +1 -0
- package/lib/Excalidraw.d.cts +278 -0
- package/lib/Excalidraw.d.ts +278 -0
- package/lib/Excalidraw.js +6 -0
- package/lib/ExportPdf.cjs +15 -0
- package/lib/ExportPdf.d.cts +270 -0
- package/lib/ExportPdf.d.ts +270 -0
- package/lib/ExportPdf.js +67 -0
- package/lib/ExportWord.cjs +1 -0
- package/lib/ExportWord.d.cts +341 -0
- package/lib/ExportWord.d.ts +341 -0
- package/lib/ExportWord.js +72 -0
- package/lib/FontFamily.cjs +1 -0
- package/lib/FontFamily.d.cts +354 -0
- package/lib/FontFamily.d.ts +354 -0
- package/lib/FontFamily.js +136 -0
- package/lib/FontSize.cjs +1 -0
- package/lib/FontSize.d.cts +359 -0
- package/lib/FontSize.d.ts +359 -0
- package/lib/FontSize.js +110 -0
- package/lib/FormatPainter.cjs +1 -0
- package/lib/FormatPainter.d.cts +353 -0
- package/lib/FormatPainter.d.ts +353 -0
- package/lib/FormatPainter.js +74 -0
- package/lib/Heading.cjs +1 -0
- package/lib/Heading.d.cts +343 -0
- package/lib/Heading.d.ts +343 -0
- package/lib/Heading.js +147 -0
- package/lib/Highlight.cjs +1 -0
- package/lib/Highlight.d.cts +344 -0
- package/lib/Highlight.d.ts +344 -0
- package/lib/Highlight.js +85 -0
- package/lib/History.cjs +1 -0
- package/lib/History.d.cts +343 -0
- package/lib/History.d.ts +343 -0
- package/lib/History.js +431 -0
- package/lib/HorizontalRule.cjs +1 -0
- package/lib/HorizontalRule.d.cts +343 -0
- package/lib/HorizontalRule.d.ts +343 -0
- package/lib/HorizontalRule.js +87 -0
- package/lib/Iframe.cjs +1 -0
- package/lib/Iframe.d.cts +277 -0
- package/lib/Iframe.d.ts +277 -0
- package/lib/Iframe.js +6 -0
- package/lib/Image.cjs +1 -0
- package/lib/Image.d.cts +370 -0
- package/lib/Image.d.ts +370 -0
- package/lib/Image.js +7 -0
- package/lib/ImageGif.cjs +1 -0
- package/lib/ImageGif.d.cts +292 -0
- package/lib/ImageGif.d.ts +292 -0
- package/lib/ImageGif.js +7 -0
- package/lib/ImportWord.cjs +231 -0
- package/lib/ImportWord.d.cts +353 -0
- package/lib/ImportWord.d.ts +353 -0
- package/lib/ImportWord.js +16620 -0
- package/lib/Indent.cjs +1 -0
- package/lib/Indent.d.cts +344 -0
- package/lib/Indent.d.ts +344 -0
- package/lib/Indent.js +78 -0
- package/lib/Italic.cjs +1 -0
- package/lib/Italic.d.cts +343 -0
- package/lib/Italic.d.ts +343 -0
- package/lib/Italic.js +91 -0
- package/lib/Katex.cjs +1 -0
- package/lib/Katex.d.cts +279 -0
- package/lib/Katex.d.ts +279 -0
- package/lib/Katex.js +197 -0
- package/lib/LineHeight.cjs +1 -0
- package/lib/LineHeight.d.cts +347 -0
- package/lib/LineHeight.d.ts +347 -0
- package/lib/LineHeight.js +137 -0
- package/lib/Link.cjs +5 -0
- package/lib/Link.d.cts +343 -0
- package/lib/Link.d.ts +343 -0
- package/lib/Link.js +1048 -0
- package/lib/ListItem.cjs +1 -0
- package/lib/ListItem.d.cts +269 -0
- package/lib/ListItem.d.ts +269 -0
- package/lib/ListItem.js +33 -0
- package/lib/Mention.cjs +1 -0
- package/lib/Mention.d.cts +272 -0
- package/lib/Mention.d.ts +272 -0
- package/lib/Mention.js +233 -0
- package/lib/Mermaid.cjs +2 -0
- package/lib/Mermaid.d.cts +344 -0
- package/lib/Mermaid.d.ts +344 -0
- package/lib/Mermaid.js +390 -0
- package/lib/MoreMark.cjs +1 -0
- package/lib/MoreMark.d.cts +355 -0
- package/lib/MoreMark.d.ts +355 -0
- package/lib/MoreMark.js +95 -0
- package/lib/MultiColumn.cjs +1 -0
- package/lib/MultiColumn.d.cts +277 -0
- package/lib/MultiColumn.d.ts +277 -0
- package/lib/MultiColumn.js +8 -0
- package/lib/OrderedList.cjs +1 -0
- package/lib/OrderedList.d.cts +343 -0
- package/lib/OrderedList.d.ts +343 -0
- package/lib/OrderedList.js +90 -0
- package/lib/RichTextEditor-Cy9XKEI5.js +11178 -0
- package/lib/RichTextEditor-DkpDEr5U.cjs +137 -0
- package/lib/SearchAndReplace.cjs +1 -0
- package/lib/SearchAndReplace.d.cts +358 -0
- package/lib/SearchAndReplace.d.ts +358 -0
- package/lib/SearchAndReplace.js +339 -0
- package/lib/Selection.cjs +1 -0
- package/lib/Selection.d.cts +272 -0
- package/lib/Selection.d.ts +272 -0
- package/lib/Selection.js +25 -0
- package/lib/SlashCommand.cjs +1 -0
- package/lib/SlashCommand.d.cts +299 -0
- package/lib/SlashCommand.d.ts +299 -0
- package/lib/SlashCommand.js +369 -0
- package/lib/Strike.cjs +1 -0
- package/lib/Strike.d.cts +343 -0
- package/lib/Strike.d.ts +343 -0
- package/lib/Strike.js +80 -0
- package/lib/SubAndSuperScript.cjs +1 -0
- package/lib/SubAndSuperScript.d.cts +358 -0
- package/lib/SubAndSuperScript.d.ts +358 -0
- package/lib/SubAndSuperScript.js +41 -0
- package/lib/Table.cjs +1 -0
- package/lib/Table.d.cts +366 -0
- package/lib/Table.d.ts +366 -0
- package/lib/Table.js +2165 -0
- package/lib/TableOfContent.cjs +1 -0
- package/lib/TableOfContent.d.cts +274 -0
- package/lib/TableOfContent.d.ts +274 -0
- package/lib/TableOfContent.js +184 -0
- package/lib/TaskList.cjs +1 -0
- package/lib/TaskList.d.cts +349 -0
- package/lib/TaskList.d.ts +349 -0
- package/lib/TaskList.js +175 -0
- package/lib/TextAlign.cjs +1 -0
- package/lib/TextAlign.d.cts +353 -0
- package/lib/TextAlign.d.ts +353 -0
- package/lib/TextAlign.js +165 -0
- package/lib/TextBubble.cjs +1 -0
- package/lib/TextBubble.d.cts +343 -0
- package/lib/TextBubble.d.ts +343 -0
- package/lib/TextBubble.js +131 -0
- package/lib/TextDirection.cjs +1 -0
- package/lib/TextDirection.d.cts +270 -0
- package/lib/TextDirection.d.ts +270 -0
- package/lib/TextDirection.js +142 -0
- package/lib/TextUnderline.cjs +1 -0
- package/lib/TextUnderline.d.cts +343 -0
- package/lib/TextUnderline.d.ts +343 -0
- package/lib/TextUnderline.js +61 -0
- package/lib/TrailingNode.cjs +1 -0
- package/lib/TrailingNode.d.cts +280 -0
- package/lib/TrailingNode.d.ts +280 -0
- package/lib/TrailingNode.js +41 -0
- package/lib/Twitter-B_tSItrW.js +1743 -0
- package/lib/Twitter-CfDC4bFV.cjs +17 -0
- package/lib/Twitter.cjs +1 -0
- package/lib/Twitter.d.cts +295 -0
- package/lib/Twitter.d.ts +295 -0
- package/lib/Twitter.js +6 -0
- package/lib/Video.cjs +1 -0
- package/lib/Video.d.cts +371 -0
- package/lib/Video.d.ts +371 -0
- package/lib/Video.js +6 -0
- package/lib/bubble-extra.cjs +2 -0
- package/lib/bubble-extra.d.cts +294 -0
- package/lib/bubble-extra.d.ts +294 -0
- package/lib/bubble-extra.js +623 -0
- package/lib/dom-dataset-CAXnsjYE.cjs +33 -0
- package/lib/dom-dataset-CJ7GyQ2E.js +999 -0
- package/lib/index-COecBbaE.cjs +89 -0
- package/lib/index-ClFtfQ0J.cjs +1 -0
- package/lib/index-CvYIX2-x.js +129 -0
- package/lib/index-CySbCeQd.cjs +1 -0
- package/lib/{index-CO-iymkb.js → index-D9llIWB5.js} +442 -101
- package/lib/index-DXBa3JBo.js +46 -0
- package/lib/index-DjP7Onch.cjs +1 -0
- package/lib/index-Drmyqk9P.js +12322 -0
- package/lib/index-DuhDIOel.js +76 -0
- package/lib/index-LbrE7K9i.cjs +1 -0
- package/lib/index.cjs +2 -1
- package/lib/index.d.cts +290 -108
- package/lib/index.d.ts +290 -108
- package/lib/index.js +587 -13
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +108 -108
- package/lib/locale-bundle.d.ts +108 -108
- package/lib/locale-bundle.js +1 -1
- package/lib/shortId-Bfj8TyNr.cjs +2 -0
- package/lib/shortId-WJVkrvml.js +30 -0
- package/lib/style.css +1 -1
- package/lib/textarea-B45fP3gP.cjs +1 -0
- package/lib/textarea-DXTdXr2y.js +20 -0
- package/package.json +678 -15
- package/lib/RichTextEditor-Ce2IeNE6.js +0 -8265
- package/lib/RichTextEditor-hDDApaDD.cjs +0 -136
- package/lib/extension-bundle.cjs +0 -33
- package/lib/extension-bundle.d.cts +0 -951
- package/lib/extension-bundle.d.ts +0 -951
- package/lib/extension-bundle.js +0 -5982
- package/lib/index-CJ6Hb9MN.cjs +0 -1
- package/lib/tiptap-DOP8lVCQ.js +0 -5950
- package/lib/tiptap-Dq62HiQ9.cjs +0 -113
- package/lib/vendor-BbgkyoD-.js +0 -40297
- package/lib/vendor-DdwtMmSr.cjs +0 -302
package/lib/CodeBlock.js
ADDED
|
@@ -0,0 +1,3639 @@
|
|
|
1
|
+
import { N as Wn, t as Dt, m as qn } from "./index-Drmyqk9P.js";
|
|
2
|
+
import { N as jn, c as Ne, R as Yn } from "./dom-dataset-CJ7GyQ2E.js";
|
|
3
|
+
import { jsxs as me, jsx as T } from "react/jsx-runtime";
|
|
4
|
+
import { d as te, A as Xn, _ as Qn, a5 as Jn, k as we } from "./RichTextEditor-Cy9XKEI5.js";
|
|
5
|
+
import * as de from "react";
|
|
6
|
+
import { useRef as $t, useCallback as ea, useEffect as Ft } from "react";
|
|
7
|
+
import * as F from "@radix-ui/react-select";
|
|
8
|
+
import { ChevronDown as En, ChevronUp as ta, Check as na } from "lucide-react";
|
|
9
|
+
const Ut = F.Root, aa = F.Value, dt = de.forwardRef(({ className: e, children: t, ...n }, s) => /* @__PURE__ */ me(
|
|
10
|
+
F.Trigger,
|
|
11
|
+
{
|
|
12
|
+
ref: s,
|
|
13
|
+
className: te(
|
|
14
|
+
"richtext-flex richtext-h-10 richtext-w-full richtext-items-center richtext-justify-between richtext-rounded-md richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 [&>span]:richtext-line-clamp-1",
|
|
15
|
+
e
|
|
16
|
+
),
|
|
17
|
+
...n,
|
|
18
|
+
children: [
|
|
19
|
+
t,
|
|
20
|
+
/* @__PURE__ */ T(F.Icon, { asChild: !0, children: /* @__PURE__ */ T(En, { className: "richtext-h-4 richtext-w-4 richtext-opacity-50" }) })
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
));
|
|
24
|
+
dt.displayName = F.Trigger.displayName;
|
|
25
|
+
const _n = de.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ T(
|
|
26
|
+
F.ScrollUpButton,
|
|
27
|
+
{
|
|
28
|
+
ref: n,
|
|
29
|
+
className: te(
|
|
30
|
+
"richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",
|
|
31
|
+
e
|
|
32
|
+
),
|
|
33
|
+
...t,
|
|
34
|
+
children: /* @__PURE__ */ T(ta, { className: "richtext-h-4 richtext-w-4" })
|
|
35
|
+
}
|
|
36
|
+
));
|
|
37
|
+
_n.displayName = F.ScrollUpButton.displayName;
|
|
38
|
+
const yn = de.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ T(
|
|
39
|
+
F.ScrollDownButton,
|
|
40
|
+
{
|
|
41
|
+
ref: n,
|
|
42
|
+
className: te(
|
|
43
|
+
"richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",
|
|
44
|
+
e
|
|
45
|
+
),
|
|
46
|
+
...t,
|
|
47
|
+
children: /* @__PURE__ */ T(En, { className: "richtext-h-4 richtext-w-4" })
|
|
48
|
+
}
|
|
49
|
+
));
|
|
50
|
+
yn.displayName = F.ScrollDownButton.displayName;
|
|
51
|
+
const ut = de.forwardRef(({ className: e, children: t, position: n = "popper", ...s }, d) => /* @__PURE__ */ T(F.Portal, { children: /* @__PURE__ */ me(
|
|
52
|
+
F.Content,
|
|
53
|
+
{
|
|
54
|
+
ref: d,
|
|
55
|
+
className: te(
|
|
56
|
+
"richtext-relative richtext-z-50 richtext-max-h-60 richtext-overflow-y-auto richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md richtext-border richtext-bg-popover richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",
|
|
57
|
+
n === "popper" && "data-[side=bottom]:richtext-translate-y-1 data-[side=left]:richtext--translate-x-1 data-[side=right]:richtext-translate-x-1 data-[side=top]:richtext--translate-y-1",
|
|
58
|
+
e
|
|
59
|
+
),
|
|
60
|
+
position: n,
|
|
61
|
+
...s,
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ T(_n, {}),
|
|
64
|
+
/* @__PURE__ */ T(
|
|
65
|
+
F.Viewport,
|
|
66
|
+
{
|
|
67
|
+
className: te(
|
|
68
|
+
"richtext-p-1",
|
|
69
|
+
n === "popper" && "richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]"
|
|
70
|
+
),
|
|
71
|
+
children: t
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ T(yn, {})
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) }));
|
|
78
|
+
ut.displayName = F.Content.displayName;
|
|
79
|
+
const ra = de.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ T(
|
|
80
|
+
F.Label,
|
|
81
|
+
{
|
|
82
|
+
ref: n,
|
|
83
|
+
className: te("richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold", e),
|
|
84
|
+
...t
|
|
85
|
+
}
|
|
86
|
+
));
|
|
87
|
+
ra.displayName = F.Label.displayName;
|
|
88
|
+
const pt = de.forwardRef(({ className: e, children: t, ...n }, s) => /* @__PURE__ */ me(
|
|
89
|
+
F.Item,
|
|
90
|
+
{
|
|
91
|
+
ref: s,
|
|
92
|
+
className: te(
|
|
93
|
+
"richtext-relative richtext-flex richtext-w-full richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",
|
|
94
|
+
e
|
|
95
|
+
),
|
|
96
|
+
...n,
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ T("span", { className: "richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center", children: /* @__PURE__ */ T(F.ItemIndicator, { children: /* @__PURE__ */ T(na, { className: "richtext-h-4 richtext-w-4" }) }) }),
|
|
99
|
+
/* @__PURE__ */ T(F.ItemText, { children: t })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
));
|
|
103
|
+
pt.displayName = F.Item.displayName;
|
|
104
|
+
const ia = de.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ T(
|
|
105
|
+
F.Separator,
|
|
106
|
+
{
|
|
107
|
+
ref: n,
|
|
108
|
+
className: te("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted", e),
|
|
109
|
+
...t
|
|
110
|
+
}
|
|
111
|
+
));
|
|
112
|
+
ia.displayName = F.Separator.displayName;
|
|
113
|
+
function sa({ action: e, ...t }) {
|
|
114
|
+
return /* @__PURE__ */ T(
|
|
115
|
+
Xn,
|
|
116
|
+
{
|
|
117
|
+
action: e,
|
|
118
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
119
|
+
icon: t == null ? void 0 : t.icon,
|
|
120
|
+
tooltip: t == null ? void 0 : t.tooltip
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
var ke = {}, Y = Symbol(), le = Symbol(), Rt = (e) => typeof e == "string" ? E[e] : e, E = {
|
|
125
|
+
plain: ke,
|
|
126
|
+
plaintext: ke,
|
|
127
|
+
text: ke,
|
|
128
|
+
txt: ke
|
|
129
|
+
}, St = (e, t) => (t[le] || Ye)(e, t), Ye = (e, t) => {
|
|
130
|
+
for (var n = [e], s, d = [], p = 0; s = Rt(t[Y]); )
|
|
131
|
+
delete t[Y], Object.assign(t, s);
|
|
132
|
+
for (xn(e, t, n, 0); d[p++] = n[0], n = n[1]; ) ;
|
|
133
|
+
return d;
|
|
134
|
+
}, Bt = "</span>", Oe = "", xe = "", vn = (e) => {
|
|
135
|
+
for (var t = "", n = e.length, s = 0; s < n; ) t += wn(e[s++]);
|
|
136
|
+
return t;
|
|
137
|
+
}, wn = (e) => {
|
|
138
|
+
if (e instanceof fe) {
|
|
139
|
+
var { type: t, alias: n, content: s } = e, d = Oe, p = xe, b = `<span class="token ${t + (n ? " " + n : "") + (t == "keyword" && typeof s == "string" ? " keyword-" + s : "")}">`;
|
|
140
|
+
xe += Bt, Oe += b;
|
|
141
|
+
var m = wn(s);
|
|
142
|
+
return Oe = d, xe = p, b + m + Bt;
|
|
143
|
+
}
|
|
144
|
+
return typeof e != "string" ? vn(e) : (e = e.replace(/&/g, "&").replace(/</g, "<"), xe && e.includes(`
|
|
145
|
+
`) ? e.replace(/\n/g, xe + `
|
|
146
|
+
` + Oe) : e);
|
|
147
|
+
}, xn = (e, t, n, s, d) => {
|
|
148
|
+
for (var p in t)
|
|
149
|
+
if (t[p]) for (var b = 0, m = t[p], _ = Array.isArray(m) ? m : [m]; b < _.length; ++b) {
|
|
150
|
+
if (d && d[0] == p && d[1] == b)
|
|
151
|
+
return;
|
|
152
|
+
for (var y = _[b], l = y.pattern || y, c = Rt(y.inside), w = y.lookbehind, g = y.greedy && l.global, h = y.alias, a = n, r = s; a && (!d || r < d[2]); r += a[0].length, a = a[1]) {
|
|
153
|
+
var u = a[0], o = 0, i, f;
|
|
154
|
+
if (!(u instanceof fe)) {
|
|
155
|
+
if (l.lastIndex = g ? r : 0, i = l.exec(g ? e : u), i && w && i[1] && (f = i[1].length, i.index += f, i[0] = i[0].slice(f)), g) {
|
|
156
|
+
if (!i)
|
|
157
|
+
break;
|
|
158
|
+
if (i[0]) {
|
|
159
|
+
for (var S = i.index, R = S + i[0].length, A; S >= r + (A = a[0].length); a = a[1], r += A) ;
|
|
160
|
+
if (a[0] instanceof fe)
|
|
161
|
+
continue;
|
|
162
|
+
for (var v = a, m = r; (m += v[0].length) < R; v = v[1], o++) ;
|
|
163
|
+
u = e.slice(r, m), i.index -= r;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (i && i[0]) {
|
|
167
|
+
for (var S = i.index, k = i[0], N = u.slice(S + k.length), L = r + u.length, P = new fe(p, c ? St(k, c) : k, k, h), M = a, Z = 0, H; M = M[1], Z++ < o; ) ;
|
|
168
|
+
N && (!M || M[0] instanceof fe ? M = [N, M] : M[0] = N + M[0]), r += S, a[0] = S ? u.slice(0, S) : P, S ? a = a[1] = [P, M] : a[1] = M, o && (xn(e, t, a, r, H = [p, b, L]), L = H[2]), d && L > d[2] && (d[2] = L);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
function fe(e, t, n, s) {
|
|
175
|
+
this.type = e, this.content = t, this.alias = s, this.length = n.length;
|
|
176
|
+
}
|
|
177
|
+
var Ge = "\\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 = {
|
|
178
|
+
pattern: /(^(["']?)\w+\2)[ ]+\S.*/,
|
|
179
|
+
lookbehind: !0,
|
|
180
|
+
alias: "punctuation"
|
|
181
|
+
// this looks reasonably well in all themes
|
|
182
|
+
}, An = {
|
|
183
|
+
variable: /^\$\(|^`|\)$|`$/
|
|
184
|
+
}, Le = {
|
|
185
|
+
bash: ft,
|
|
186
|
+
environment: {
|
|
187
|
+
pattern: RegExp("\\$" + Ge),
|
|
188
|
+
alias: "constant"
|
|
189
|
+
},
|
|
190
|
+
variable: [
|
|
191
|
+
// [0]: Arithmetic Environment
|
|
192
|
+
{
|
|
193
|
+
pattern: /\$?\(\([^]*?\)\)/g,
|
|
194
|
+
greedy: !0,
|
|
195
|
+
inside: {
|
|
196
|
+
// If there is a $ sign at the beginning highlight $(( and )) as variable
|
|
197
|
+
variable: [
|
|
198
|
+
{
|
|
199
|
+
pattern: /(^\$[^]+)../,
|
|
200
|
+
lookbehind: !0
|
|
201
|
+
},
|
|
202
|
+
/^\$\(\(/
|
|
203
|
+
],
|
|
204
|
+
number: /\b0x[a-fA-F\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
205
|
+
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
|
|
206
|
+
operator: /--|\+\+|&&|\|\||(?:\*\*|<<|>>|[%&|^!=<>/*+-])=?|[?:~]/,
|
|
207
|
+
// If there is no $ sign at the beginning highlight (( and )) as punctuation
|
|
208
|
+
punctuation: /\(\(?|\)\)?|,|;/
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
// [1]: Command Substitution
|
|
212
|
+
{
|
|
213
|
+
pattern: /\$\((?:[^()]|\([^)]*\))*\)|`[^`]+`/g,
|
|
214
|
+
greedy: !0,
|
|
215
|
+
inside: An
|
|
216
|
+
},
|
|
217
|
+
// [2]: Brace expansion
|
|
218
|
+
{
|
|
219
|
+
pattern: /\$\{[^}]*\}/g,
|
|
220
|
+
greedy: !0,
|
|
221
|
+
inside: {
|
|
222
|
+
operator: /:[?=+-]?|[!/]|##?|%%?|\^\^?|,,?/,
|
|
223
|
+
punctuation: /[[\]]/,
|
|
224
|
+
environment: {
|
|
225
|
+
pattern: RegExp("(\\{)" + Ge),
|
|
226
|
+
lookbehind: !0,
|
|
227
|
+
alias: "constant"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
/\$(?:\w+|[#?*!@$])/
|
|
232
|
+
],
|
|
233
|
+
// Escape sequences from echo and printf's manuals, and escaped quotes.
|
|
234
|
+
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})/
|
|
235
|
+
}, oa = ft.inside = E.sh = E.shell = E.bash = {
|
|
236
|
+
shebang: {
|
|
237
|
+
pattern: /^#!\s*\/.*/,
|
|
238
|
+
alias: "important"
|
|
239
|
+
},
|
|
240
|
+
comment: {
|
|
241
|
+
pattern: /(^|[^"{\\$])#.*/,
|
|
242
|
+
lookbehind: !0
|
|
243
|
+
},
|
|
244
|
+
"function-name": [
|
|
245
|
+
// a) function foo {
|
|
246
|
+
// b) foo() {
|
|
247
|
+
// c) function foo() {
|
|
248
|
+
// but not “foo {”
|
|
249
|
+
{
|
|
250
|
+
// a) and c)
|
|
251
|
+
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
|
252
|
+
lookbehind: !0,
|
|
253
|
+
alias: "function"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
// b)
|
|
257
|
+
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
258
|
+
alias: "function"
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
// Highlight variable names as variables in for and select beginnings.
|
|
262
|
+
"for-or-select": {
|
|
263
|
+
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
264
|
+
lookbehind: !0,
|
|
265
|
+
alias: "variable"
|
|
266
|
+
},
|
|
267
|
+
// Highlight variable names as variables in the left-hand part
|
|
268
|
+
// of assignments (“=” and “+=”).
|
|
269
|
+
"assign-left": {
|
|
270
|
+
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
271
|
+
lookbehind: !0,
|
|
272
|
+
alias: "variable",
|
|
273
|
+
inside: {
|
|
274
|
+
environment: {
|
|
275
|
+
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + Ge),
|
|
276
|
+
lookbehind: !0,
|
|
277
|
+
alias: "constant"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
// Highlight parameter names as variables
|
|
282
|
+
parameter: {
|
|
283
|
+
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?![^\s=])/,
|
|
284
|
+
lookbehind: !0,
|
|
285
|
+
alias: "variable"
|
|
286
|
+
},
|
|
287
|
+
string: [
|
|
288
|
+
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
|
|
289
|
+
{
|
|
290
|
+
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[^]*?\n\2/g,
|
|
291
|
+
lookbehind: !0,
|
|
292
|
+
greedy: !0,
|
|
293
|
+
inside: Le
|
|
294
|
+
},
|
|
295
|
+
// Here-document with quotes around the tag
|
|
296
|
+
// → No expansion (so no “inside”).
|
|
297
|
+
{
|
|
298
|
+
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[^]*?\n\3/g,
|
|
299
|
+
lookbehind: !0,
|
|
300
|
+
greedy: !0,
|
|
301
|
+
inside: {
|
|
302
|
+
bash: ft
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
// “Normal” string
|
|
306
|
+
{
|
|
307
|
+
// https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
|
|
308
|
+
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[^]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^\\"`$])*"/g,
|
|
309
|
+
lookbehind: !0,
|
|
310
|
+
greedy: !0,
|
|
311
|
+
inside: Le
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
|
|
315
|
+
pattern: /(^|[^$\\])'[^']*'/g,
|
|
316
|
+
lookbehind: !0,
|
|
317
|
+
greedy: !0
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
// https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
|
|
321
|
+
pattern: /\$'(?:\\[^]|[^\\'])*'/g,
|
|
322
|
+
greedy: !0,
|
|
323
|
+
inside: {
|
|
324
|
+
entity: Le.entity
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
environment: {
|
|
329
|
+
pattern: RegExp("\\$?" + Ge),
|
|
330
|
+
alias: "constant"
|
|
331
|
+
},
|
|
332
|
+
variable: Le.variable,
|
|
333
|
+
function: {
|
|
334
|
+
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;|&])/,
|
|
335
|
+
lookbehind: !0
|
|
336
|
+
},
|
|
337
|
+
keyword: {
|
|
338
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
|
339
|
+
lookbehind: !0
|
|
340
|
+
},
|
|
341
|
+
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
|
342
|
+
builtin: {
|
|
343
|
+
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;|&])/,
|
|
344
|
+
lookbehind: !0,
|
|
345
|
+
// Alias added to make those easier to distinguish from strings.
|
|
346
|
+
alias: "class-name"
|
|
347
|
+
},
|
|
348
|
+
boolean: {
|
|
349
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
|
350
|
+
lookbehind: !0
|
|
351
|
+
},
|
|
352
|
+
"file-descriptor": {
|
|
353
|
+
pattern: /\B&\d\b/,
|
|
354
|
+
alias: "important"
|
|
355
|
+
},
|
|
356
|
+
operator: {
|
|
357
|
+
// Lots of redirections here, but not just that.
|
|
358
|
+
pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
|
359
|
+
inside: {
|
|
360
|
+
"file-descriptor": {
|
|
361
|
+
pattern: /^\d/,
|
|
362
|
+
alias: "important"
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
punctuation: /\$?\(\(?|\)\)?|\.\.|[[\]{};\\]/,
|
|
367
|
+
number: {
|
|
368
|
+
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
|
369
|
+
lookbehind: !0
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
[
|
|
373
|
+
"comment",
|
|
374
|
+
"function-name",
|
|
375
|
+
"for-or-select",
|
|
376
|
+
"assign-left",
|
|
377
|
+
"parameter",
|
|
378
|
+
"string",
|
|
379
|
+
"environment",
|
|
380
|
+
"function",
|
|
381
|
+
"keyword",
|
|
382
|
+
"builtin",
|
|
383
|
+
"boolean",
|
|
384
|
+
"file-descriptor",
|
|
385
|
+
"operator",
|
|
386
|
+
"punctuation",
|
|
387
|
+
"number"
|
|
388
|
+
].forEach((e) => An[e] = oa[e]);
|
|
389
|
+
var In = /(?:"(?:\\[^]|[^\\\n"])*"|'(?:\\[^]|[^\\\n'])*')/g, Ce = In.source, Gt = {
|
|
390
|
+
rule: /^@[\w-]+/,
|
|
391
|
+
"selector-function-argument": {
|
|
392
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^)]*\))*\))+(?=\s*\))/,
|
|
393
|
+
lookbehind: !0,
|
|
394
|
+
alias: "selector"
|
|
395
|
+
},
|
|
396
|
+
keyword: {
|
|
397
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
398
|
+
lookbehind: !0
|
|
399
|
+
}
|
|
400
|
+
// See rest below
|
|
401
|
+
};
|
|
402
|
+
Gt[Y] = E.css = {
|
|
403
|
+
comment: /\/\*[^]*?\*\//,
|
|
404
|
+
atrule: {
|
|
405
|
+
pattern: RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|${Ce})*?(?:;|(?=\\s*\\{))`),
|
|
406
|
+
inside: Gt
|
|
407
|
+
},
|
|
408
|
+
url: {
|
|
409
|
+
// https://drafts.csswg.org/css-values-3/#urls
|
|
410
|
+
pattern: RegExp(`\\burl\\((?:${Ce}|(?:[^\\\\
|
|
411
|
+
"')=]|\\\\[^])*)\\)`, "gi"),
|
|
412
|
+
greedy: !0,
|
|
413
|
+
inside: {
|
|
414
|
+
function: /^url/i,
|
|
415
|
+
punctuation: /^\(|\)$/,
|
|
416
|
+
string: {
|
|
417
|
+
pattern: RegExp("^" + Ce + "$"),
|
|
418
|
+
alias: "url"
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
selector: {
|
|
423
|
+
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|${Ce})*(?=\\s*\\{)`),
|
|
424
|
+
lookbehind: !0
|
|
425
|
+
},
|
|
426
|
+
string: {
|
|
427
|
+
pattern: In,
|
|
428
|
+
greedy: !0
|
|
429
|
+
},
|
|
430
|
+
property: {
|
|
431
|
+
pattern: /(^|[^-\w\xa0-\uffff])(?!\d)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*:)/i,
|
|
432
|
+
lookbehind: !0
|
|
433
|
+
},
|
|
434
|
+
important: /!important\b/i,
|
|
435
|
+
function: {
|
|
436
|
+
pattern: /(^|[^-a-z\d])[-a-z\d]+(?=\()/i,
|
|
437
|
+
lookbehind: !0
|
|
438
|
+
},
|
|
439
|
+
punctuation: /[(){},:;]/
|
|
440
|
+
};
|
|
441
|
+
var De = (e, t) => {
|
|
442
|
+
if (t.has(e)) return t.get(e);
|
|
443
|
+
var n = e, s = la.call(e).slice(8, -1);
|
|
444
|
+
if (s == "Object") {
|
|
445
|
+
t.set(e, n = {});
|
|
446
|
+
for (var d in e)
|
|
447
|
+
n[d] = De(e[d], t);
|
|
448
|
+
e[Y] && (n[Y] = De(e[Y], t)), e[le] && (n[le] = e[le]);
|
|
449
|
+
} else if (s == "Array") {
|
|
450
|
+
t.set(e, n = []);
|
|
451
|
+
for (var p = 0, b = e.length; p < b; p++)
|
|
452
|
+
n[p] = De(e[p], t);
|
|
453
|
+
}
|
|
454
|
+
return n;
|
|
455
|
+
}, Tt = (e) => De(e, /* @__PURE__ */ new Map()), ae = (e, t) => Object.assign(Tt(E[e]), t), D = (e, t, n) => {
|
|
456
|
+
var s = {};
|
|
457
|
+
for (var d in e)
|
|
458
|
+
s[d] = e[d], delete e[d];
|
|
459
|
+
for (var d in s)
|
|
460
|
+
d == t && Object.assign(e, n), n.hasOwnProperty(d) || (e[d] = s[d]);
|
|
461
|
+
}, la = {}.toString, ze = E.css, zt = {
|
|
462
|
+
pattern: /(\b\d+)(?:%|[a-z]+(?![\w-]))/,
|
|
463
|
+
lookbehind: !0
|
|
464
|
+
}, Ht = {
|
|
465
|
+
pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
|
|
466
|
+
lookbehind: !0
|
|
467
|
+
};
|
|
468
|
+
ze.selector.inside = ze.atrule.inside["selector-function-argument"].inside = {
|
|
469
|
+
"pseudo-element": /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
|
|
470
|
+
"pseudo-class": /:[-\w]+/,
|
|
471
|
+
class: /\.[-\w]+/,
|
|
472
|
+
id: /#[-\w]+/,
|
|
473
|
+
attribute: {
|
|
474
|
+
pattern: /\[(?:[^[\]"']|(["'])(?:\\[^]|(?!\1)[^\\\n])*\1)*\]/g,
|
|
475
|
+
greedy: !0,
|
|
476
|
+
inside: {
|
|
477
|
+
punctuation: /^\[|\]$/,
|
|
478
|
+
"case-sensitivity": {
|
|
479
|
+
pattern: /(\s)[si]$/i,
|
|
480
|
+
lookbehind: !0,
|
|
481
|
+
alias: "keyword"
|
|
482
|
+
},
|
|
483
|
+
namespace: {
|
|
484
|
+
pattern: /^(\s*)(?:(?!\s)[-*\w\xa0-\uffff])*\|(?!=)/,
|
|
485
|
+
lookbehind: !0,
|
|
486
|
+
inside: {
|
|
487
|
+
punctuation: /\|$/
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
"attr-name": {
|
|
491
|
+
pattern: /^(\s*)(?:(?!\s)[-\w\xa0-\uffff])+/,
|
|
492
|
+
lookbehind: !0
|
|
493
|
+
},
|
|
494
|
+
"attr-value": {
|
|
495
|
+
pattern: /(=\s*)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*$)|(["'])(?:\\[^]|(?!\2)[^\\\n])*\2/,
|
|
496
|
+
lookbehind: !0
|
|
497
|
+
},
|
|
498
|
+
operator: /[|~*^$]?=/
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
"n-th": [
|
|
502
|
+
{
|
|
503
|
+
pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,
|
|
504
|
+
lookbehind: !0,
|
|
505
|
+
inside: {
|
|
506
|
+
number: /[\dn]+/,
|
|
507
|
+
operator: /[+-]/
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i,
|
|
512
|
+
lookbehind: !0
|
|
513
|
+
}
|
|
514
|
+
],
|
|
515
|
+
combinator: />|\+|~|\|\|/,
|
|
516
|
+
// the `tag` token has been existed and removed.
|
|
517
|
+
// because we can't find a perfect tokenize to match it.
|
|
518
|
+
// if you want to add it, please read https://github.com/PrismJS/prism/pull/2373 first.
|
|
519
|
+
punctuation: /[(),]/
|
|
520
|
+
};
|
|
521
|
+
D(ze, "property", {
|
|
522
|
+
variable: {
|
|
523
|
+
pattern: /(^|[^-\w\xa0-\uffff])--(?!\d)(?:(?!\s)[-\w\xa0-\uffff])*/i,
|
|
524
|
+
lookbehind: !0
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
D(ze, "function", {
|
|
528
|
+
operator: {
|
|
529
|
+
pattern: /(\s)[/*+-](?!\S)/,
|
|
530
|
+
lookbehind: !0
|
|
531
|
+
},
|
|
532
|
+
// CAREFUL!
|
|
533
|
+
// Previewers and Inline color use hexcode and color.
|
|
534
|
+
hexcode: {
|
|
535
|
+
pattern: /\B#[a-f\d]{3,8}\b/i,
|
|
536
|
+
alias: "color"
|
|
537
|
+
},
|
|
538
|
+
color: [
|
|
539
|
+
{
|
|
540
|
+
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,
|
|
541
|
+
lookbehind: !0
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
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,
|
|
545
|
+
inside: {
|
|
546
|
+
function: /^[^(]+/,
|
|
547
|
+
unit: zt,
|
|
548
|
+
number: Ht,
|
|
549
|
+
punctuation: /[(),]/
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
// it's important that there is no boundary assertion after the hex digits
|
|
554
|
+
entity: /\\[a-f\d]{1,8}/i,
|
|
555
|
+
unit: zt,
|
|
556
|
+
number: Ht
|
|
557
|
+
});
|
|
558
|
+
E.ini = {
|
|
559
|
+
/**
|
|
560
|
+
* The component mimics the behavior of the Win32 API parser.
|
|
561
|
+
*
|
|
562
|
+
* @see {@link https://github.com/PrismJS/prism/issues/2775#issuecomment-787477723}
|
|
563
|
+
*/
|
|
564
|
+
comment: {
|
|
565
|
+
pattern: /(^[ \f \v]*)[#;].*/m,
|
|
566
|
+
lookbehind: !0
|
|
567
|
+
},
|
|
568
|
+
section: {
|
|
569
|
+
pattern: /(^[ \f \v]*)\[[^\n\]]*\]?/m,
|
|
570
|
+
lookbehind: !0,
|
|
571
|
+
inside: {
|
|
572
|
+
"section-name": {
|
|
573
|
+
pattern: /(^\[[ \f \v]*)[^ \f \v\]]+(?:[ \f \v]+[^ \f \v\]]+)*/,
|
|
574
|
+
lookbehind: !0,
|
|
575
|
+
alias: "selector"
|
|
576
|
+
},
|
|
577
|
+
punctuation: /[[\]]/
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
key: {
|
|
581
|
+
pattern: /(^[ \f \v]*)[^ \f\n \v=]+(?:[ \f \v]+[^ \f\n \v=]+)*(?=[ \f \v]*=)/m,
|
|
582
|
+
lookbehind: !0,
|
|
583
|
+
alias: "attr-name"
|
|
584
|
+
},
|
|
585
|
+
value: {
|
|
586
|
+
pattern: /(=[ \f \v]*)[^ \f\n \v]+(?:[ \f \v]+[^ \f\n \v]+)*/,
|
|
587
|
+
lookbehind: !0,
|
|
588
|
+
alias: "attr-value",
|
|
589
|
+
inside: {
|
|
590
|
+
"inner-value": {
|
|
591
|
+
pattern: /^(["']).+(?=\1$)/,
|
|
592
|
+
lookbehind: !0
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
punctuation: /=/
|
|
597
|
+
};
|
|
598
|
+
var re = () => ({
|
|
599
|
+
pattern: /\/\/.*|\/\*[^]*?(?:\*\/|$)/g,
|
|
600
|
+
greedy: !0
|
|
601
|
+
}), Nt = () => ({
|
|
602
|
+
pattern: /(["'])(?:\\[^]|(?!\1)[^\\\n])*\1/g,
|
|
603
|
+
greedy: !0
|
|
604
|
+
}), Rn = /\b0x[a-f\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i, Ee = /[()[\]{}.,:;]/, W = /\b(?:false|true)\b/, tt = {
|
|
605
|
+
"interpolation-punctuation": {
|
|
606
|
+
pattern: /^\$\{?|\}$/,
|
|
607
|
+
alias: "punctuation"
|
|
608
|
+
},
|
|
609
|
+
expression: {
|
|
610
|
+
pattern: /[^]+/
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
tt.expression.inside = E.kts = E.kt = E.kotlin = {
|
|
614
|
+
// https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions
|
|
615
|
+
"string-literal": [
|
|
616
|
+
{
|
|
617
|
+
pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
|
|
618
|
+
alias: "multiline",
|
|
619
|
+
inside: {
|
|
620
|
+
interpolation: {
|
|
621
|
+
pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
622
|
+
inside: tt
|
|
623
|
+
},
|
|
624
|
+
string: /[^]+/
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
pattern: /"(?:\\.|[^\\\n"$]|\$(?:(?!\{)|\{[^{}]*\}))*"/,
|
|
629
|
+
alias: "singleline",
|
|
630
|
+
inside: {
|
|
631
|
+
interpolation: {
|
|
632
|
+
pattern: /((?:^|[^\\])(?:\\\\)*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
633
|
+
lookbehind: !0,
|
|
634
|
+
inside: tt
|
|
635
|
+
},
|
|
636
|
+
string: /[^]+/
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
],
|
|
640
|
+
char: {
|
|
641
|
+
// https://kotlinlang.org/spec/expressions.html#character-literals
|
|
642
|
+
pattern: /'(?:[^\\\n']|\\(?:.|u[a-fA-F\d]{0,4}))'/g,
|
|
643
|
+
greedy: !0
|
|
644
|
+
},
|
|
645
|
+
comment: re(),
|
|
646
|
+
annotation: {
|
|
647
|
+
pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
|
|
648
|
+
alias: "builtin"
|
|
649
|
+
},
|
|
650
|
+
keyword: {
|
|
651
|
+
// The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
|
|
652
|
+
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/,
|
|
653
|
+
lookbehind: !0
|
|
654
|
+
},
|
|
655
|
+
boolean: W,
|
|
656
|
+
label: {
|
|
657
|
+
pattern: /\b\w+@|@\w+/,
|
|
658
|
+
alias: "symbol"
|
|
659
|
+
},
|
|
660
|
+
function: {
|
|
661
|
+
pattern: /(?:`[^\n`]+`|\b\w+)(?=\s*\()|(\.)(?:`[^\n`]+`|\w+)(?=\s*\{)/g,
|
|
662
|
+
lookbehind: !0,
|
|
663
|
+
greedy: !0
|
|
664
|
+
},
|
|
665
|
+
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/,
|
|
666
|
+
operator: /--|\+\+|&&|\|\||->|[!=]==|!!|[%!=<>/*+-]=?|[?:]:?|\.\.|\b(?:and|inv|shl|u?shr|x?or)\b/,
|
|
667
|
+
punctuation: Ee
|
|
668
|
+
};
|
|
669
|
+
var Sn = [
|
|
670
|
+
{
|
|
671
|
+
pattern: /&[a-z\d]{1,8};/i,
|
|
672
|
+
alias: "named-entity"
|
|
673
|
+
},
|
|
674
|
+
/&#x?[a-f\d]{1,8};/i
|
|
675
|
+
], ca = {
|
|
676
|
+
pattern: /<\/?(?!\d)[^\s/=>$<%]+(?:\s(?:\s*[^\s/=>]+(?:\s*=\s*(?!\s)(?:"[^"]*"|'[^']*'|[^\s"'=>]+(?=[\s>]))?|(?=[\s/>])))+)?\s*\/?>/g,
|
|
677
|
+
greedy: !0,
|
|
678
|
+
inside: {
|
|
679
|
+
punctuation: /^<\/?|\/?>$/,
|
|
680
|
+
tag: {
|
|
681
|
+
pattern: /^\S+/,
|
|
682
|
+
inside: {
|
|
683
|
+
namespace: /^[^:]+:/
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
"attr-value": [{
|
|
687
|
+
pattern: /(=\s*)(?:"[^"]*"|'[^']*'|[^\s"'=>]+)/g,
|
|
688
|
+
lookbehind: !0,
|
|
689
|
+
greedy: !0,
|
|
690
|
+
inside: {
|
|
691
|
+
punctuation: /^["']|["']$/,
|
|
692
|
+
entity: Sn
|
|
693
|
+
}
|
|
694
|
+
}],
|
|
695
|
+
"attr-equals": /=/,
|
|
696
|
+
"attr-name": {
|
|
697
|
+
pattern: /\S+/,
|
|
698
|
+
inside: {
|
|
699
|
+
namespace: /^[^:]+:/
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
E.rss = E.atom = E.ssml = E.xml = {
|
|
705
|
+
comment: {
|
|
706
|
+
pattern: /<!--(?:(?!<!--)[^])*?-->/g,
|
|
707
|
+
greedy: !0
|
|
708
|
+
},
|
|
709
|
+
prolog: {
|
|
710
|
+
pattern: /<\?[^]+?\?>/g,
|
|
711
|
+
greedy: !0
|
|
712
|
+
},
|
|
713
|
+
doctype: {
|
|
714
|
+
// https://www.w3.org/TR/xml/#NT-doctypedecl
|
|
715
|
+
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/gi,
|
|
716
|
+
greedy: !0,
|
|
717
|
+
inside: {
|
|
718
|
+
"internal-subset": {
|
|
719
|
+
pattern: /(\[)[^]+(?=\]\s*>$)/,
|
|
720
|
+
lookbehind: !0,
|
|
721
|
+
inside: "xml"
|
|
722
|
+
},
|
|
723
|
+
string: /"[^"]*"|'[^']*'/,
|
|
724
|
+
punctuation: /^<!|[>[\]]/,
|
|
725
|
+
"doctype-tag": /^DOCTYPE/i,
|
|
726
|
+
name: /\S+/
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
cdata: {
|
|
730
|
+
pattern: /<!\[CDATA\[[^]*?\]\]>/gi,
|
|
731
|
+
greedy: !0
|
|
732
|
+
},
|
|
733
|
+
tag: ca,
|
|
734
|
+
entity: Sn,
|
|
735
|
+
"markup-bracket": {
|
|
736
|
+
pattern: /[()[\]{}]/,
|
|
737
|
+
alias: "punctuation"
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
var bt = (e, t) => (e["language-" + t] = {
|
|
741
|
+
pattern: /[^]+/,
|
|
742
|
+
inside: t
|
|
743
|
+
}, e), Vt = (e, t) => ({
|
|
744
|
+
pattern: RegExp(`(<${e}[^>]*>)(?!</${e}>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])+?(?=</${e}>)`, "gi"),
|
|
745
|
+
lookbehind: !0,
|
|
746
|
+
greedy: !0,
|
|
747
|
+
inside: bt({
|
|
748
|
+
"included-cdata": {
|
|
749
|
+
pattern: /<!\[CDATA\[[^]*?\]\]>/i,
|
|
750
|
+
inside: bt({
|
|
751
|
+
cdata: /^<!\[CDATA\[|\]\]>$/i
|
|
752
|
+
}, t)
|
|
753
|
+
}
|
|
754
|
+
}, t)
|
|
755
|
+
}), Zt = (e, t) => ({
|
|
756
|
+
pattern: RegExp(`((?:^|["'\\s])(?:${e})\\s*=\\s*)(?:"[^"]*"|'[^']*'|[^\\s"'=>]+)`, "gi"),
|
|
757
|
+
lookbehind: !0,
|
|
758
|
+
greedy: !0,
|
|
759
|
+
inside: bt({
|
|
760
|
+
punctuation: /^["']|["']$/
|
|
761
|
+
}, t)
|
|
762
|
+
}), Tn = E.svg = E.mathml = E.html = E.markup = Tt(E.xml);
|
|
763
|
+
Tn.tag.inside["attr-value"].unshift(
|
|
764
|
+
Zt("style", "css"),
|
|
765
|
+
Zt("on[a-z]+", "javascript")
|
|
766
|
+
);
|
|
767
|
+
D(Tn, "cdata", {
|
|
768
|
+
style: Vt("style", "css"),
|
|
769
|
+
script: Vt("script", "javascript")
|
|
770
|
+
});
|
|
771
|
+
E.r = {
|
|
772
|
+
comment: /#.*/,
|
|
773
|
+
string: {
|
|
774
|
+
pattern: /(["'])(?:\\.|(?!\1)[^\\\n])*\1/g,
|
|
775
|
+
greedy: !0
|
|
776
|
+
},
|
|
777
|
+
"percent-operator": {
|
|
778
|
+
// Includes user-defined operators
|
|
779
|
+
// and %%, %*%, %/%, %in%, %o%, %x%
|
|
780
|
+
pattern: /%[^%\s]*%/,
|
|
781
|
+
alias: "operator"
|
|
782
|
+
},
|
|
783
|
+
boolean: /\b(?:FALSE|TRUE)\b/,
|
|
784
|
+
ellipsis: /\.\.(?:\.|\d+)/,
|
|
785
|
+
number: [
|
|
786
|
+
/\b(?:Inf|NaN)\b/,
|
|
787
|
+
/(?:\b0x[a-fA-F\d]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/
|
|
788
|
+
],
|
|
789
|
+
keyword: /\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,
|
|
790
|
+
operator: /->>?|<=|<<?-|[!=<>]=?|::?|&&?|\|\|?|[~^$@/*+-]/,
|
|
791
|
+
punctuation: /[()[\]{},;]/
|
|
792
|
+
};
|
|
793
|
+
E.basic = {
|
|
794
|
+
comment: {
|
|
795
|
+
pattern: /(?:!|rem\b).+/i,
|
|
796
|
+
inside: {
|
|
797
|
+
keyword: /^rem/i
|
|
798
|
+
}
|
|
799
|
+
},
|
|
800
|
+
string: {
|
|
801
|
+
pattern: /"(?:""|[#$%&'().,:;\w ?^!=<>/*+-])*"/g,
|
|
802
|
+
greedy: !0
|
|
803
|
+
},
|
|
804
|
+
number: /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
805
|
+
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,
|
|
806
|
+
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,
|
|
807
|
+
operator: /<=|<>|>=|[&^=<>/*+-]|\b(?:and|eqv|imp|not|x?or)\b/i,
|
|
808
|
+
punctuation: /[(),:;]/
|
|
809
|
+
};
|
|
810
|
+
E.vbnet = ae("basic", {
|
|
811
|
+
comment: {
|
|
812
|
+
pattern: /(?:!|'|rem\b).*/i,
|
|
813
|
+
inside: {
|
|
814
|
+
keyword: /^rem/i
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
string: {
|
|
818
|
+
pattern: /(^|[^"])"(?:""|[^"])*"(?!")/g,
|
|
819
|
+
lookbehind: !0,
|
|
820
|
+
greedy: !0
|
|
821
|
+
},
|
|
822
|
+
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,
|
|
823
|
+
punctuation: /[(){},:;]/
|
|
824
|
+
});
|
|
825
|
+
var Kt = {
|
|
826
|
+
// https://en.cppreference.com/w/c/language/character_constant
|
|
827
|
+
pattern: /'(?:\\[^]|[^\\\n']){0,32}'/g,
|
|
828
|
+
greedy: !0
|
|
829
|
+
}, Wt = {
|
|
830
|
+
pattern: /\/\/(?:[^\\\n]|\\\n?)*|\/\*[^]*?(?:\*\/|$)/g,
|
|
831
|
+
greedy: !0
|
|
832
|
+
}, qt = {
|
|
833
|
+
// https://en.cppreference.com/w/c/language/string_literal
|
|
834
|
+
pattern: /"(?:\\[^]|[^\\\n"])*"/g,
|
|
835
|
+
greedy: !0
|
|
836
|
+
}, jt = {
|
|
837
|
+
pattern: /\S[^]*/
|
|
838
|
+
};
|
|
839
|
+
jt.inside = E.c = {
|
|
840
|
+
comment: Wt,
|
|
841
|
+
char: Kt,
|
|
842
|
+
macro: {
|
|
843
|
+
// allow for multiline macro definitions
|
|
844
|
+
// spaces after the # character compile fine with gcc
|
|
845
|
+
pattern: /(^[ ]*)#\s*[a-z](?:[^\\\n/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\[^])*/img,
|
|
846
|
+
lookbehind: !0,
|
|
847
|
+
greedy: !0,
|
|
848
|
+
alias: "property",
|
|
849
|
+
inside: {
|
|
850
|
+
string: [
|
|
851
|
+
{
|
|
852
|
+
// highlight the path of the include statement as a string
|
|
853
|
+
pattern: /^(#\s*include\s*)<[^>]+>/,
|
|
854
|
+
lookbehind: !0
|
|
855
|
+
},
|
|
856
|
+
qt
|
|
857
|
+
],
|
|
858
|
+
char: Kt,
|
|
859
|
+
comment: Wt,
|
|
860
|
+
"macro-name": [
|
|
861
|
+
{
|
|
862
|
+
pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
|
|
863
|
+
lookbehind: !0
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
pattern: /(^#\s*define\s+)\w+/i,
|
|
867
|
+
lookbehind: !0,
|
|
868
|
+
alias: "function"
|
|
869
|
+
}
|
|
870
|
+
],
|
|
871
|
+
// highlight macro directives as keywords
|
|
872
|
+
directive: {
|
|
873
|
+
pattern: /^(#\s*)[a-z]+/,
|
|
874
|
+
lookbehind: !0,
|
|
875
|
+
alias: "keyword"
|
|
876
|
+
},
|
|
877
|
+
"directive-hash": /^#/,
|
|
878
|
+
punctuation: /##|\\(?=\n)/,
|
|
879
|
+
expression: jt
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
string: qt,
|
|
883
|
+
"class-name": {
|
|
884
|
+
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([^]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
|
|
885
|
+
lookbehind: !0
|
|
886
|
+
},
|
|
887
|
+
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/,
|
|
888
|
+
// highlight predefined macros as constants
|
|
889
|
+
constant: /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/,
|
|
890
|
+
function: /\b[a-z_]\w*(?=\s*\()/i,
|
|
891
|
+
number: /(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
|
|
892
|
+
operator: /->|([&|:+-])\1|[?:~]|>>=?|<<=?|[%&|^!=<>/*+-]=?/,
|
|
893
|
+
punctuation: Ee
|
|
894
|
+
};
|
|
895
|
+
D(
|
|
896
|
+
E.opencl = ae("c", {
|
|
897
|
+
// 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)
|
|
898
|
+
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/,
|
|
899
|
+
// Extracted from http://streamcomputing.eu/downloads/?opencl.lang (opencl-const)
|
|
900
|
+
// Math Constants: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/mathConstants.html
|
|
901
|
+
// Macros and Limits: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/macroLimits.html
|
|
902
|
+
number: /(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[fuhl]{0,4}/i,
|
|
903
|
+
boolean: W,
|
|
904
|
+
"constant-opencl-kernel": {
|
|
905
|
+
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/,
|
|
906
|
+
alias: "constant"
|
|
907
|
+
}
|
|
908
|
+
}),
|
|
909
|
+
"class-name",
|
|
910
|
+
{
|
|
911
|
+
// https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/scalarDataTypes.html
|
|
912
|
+
// https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/otherDataTypes.html
|
|
913
|
+
"builtin-type": {
|
|
914
|
+
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/,
|
|
915
|
+
alias: "keyword"
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
);
|
|
919
|
+
var gt = {
|
|
920
|
+
// Extracted from http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-types and opencl-host)
|
|
921
|
+
"type-opencl-host": {
|
|
922
|
+
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/,
|
|
923
|
+
alias: "keyword"
|
|
924
|
+
},
|
|
925
|
+
"boolean-opencl-host": {
|
|
926
|
+
pattern: /\bCL_(?:FALSE|TRUE)\b/,
|
|
927
|
+
alias: "boolean"
|
|
928
|
+
},
|
|
929
|
+
// Extracted from cl.h (2.0) and http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-const)
|
|
930
|
+
"constant-opencl-host": {
|
|
931
|
+
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/,
|
|
932
|
+
alias: "constant"
|
|
933
|
+
},
|
|
934
|
+
// Extracted from cl.h (2.0) and http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-host)
|
|
935
|
+
"function-opencl-host": {
|
|
936
|
+
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/,
|
|
937
|
+
alias: "function"
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
D(E.c, "keyword", gt);
|
|
941
|
+
E.cpp && (gt["type-opencl-host-cpp"] = {
|
|
942
|
+
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/,
|
|
943
|
+
alias: "keyword"
|
|
944
|
+
}, D(E.cpp, "keyword", gt));
|
|
945
|
+
var da = E.diff = {
|
|
946
|
+
// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
|
|
947
|
+
// Match "@@ ... @@" coord lines in unified diff.
|
|
948
|
+
// Match coord lines in normal diff (starts with a number).
|
|
949
|
+
coord: /^(?:\*{3}|-{3}|\+{3}|\d).*$|^@@.*@@$/m
|
|
950
|
+
// deleted, inserted, unchanged, diff
|
|
951
|
+
}, nt = {
|
|
952
|
+
"deleted-sign": "-",
|
|
953
|
+
"deleted-arrow": "<",
|
|
954
|
+
"inserted-sign": "+",
|
|
955
|
+
"inserted-arrow": ">",
|
|
956
|
+
unchanged: " ",
|
|
957
|
+
diff: "!"
|
|
958
|
+
};
|
|
959
|
+
for (var ue in nt) {
|
|
960
|
+
var at = ue.split("-")[0];
|
|
961
|
+
da[ue] = {
|
|
962
|
+
pattern: RegExp("^(?:[" + nt[ue] + `].*$
|
|
963
|
+
?)+`, "m"),
|
|
964
|
+
alias: at != ue ? at : ue == "diff" ? "bold" : void 0,
|
|
965
|
+
inside: {
|
|
966
|
+
prefix: {
|
|
967
|
+
pattern: RegExp("^[" + nt[ue] + "]", "mg"),
|
|
968
|
+
greedy: !0,
|
|
969
|
+
alias: at
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
var rt = /\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/, Re = "(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*", mt = {
|
|
975
|
+
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
|
976
|
+
inside: {
|
|
977
|
+
punctuation: /\./
|
|
978
|
+
}
|
|
979
|
+
}, ht = {
|
|
980
|
+
namespace: mt,
|
|
981
|
+
punctuation: /\./
|
|
982
|
+
}, Yt = {
|
|
983
|
+
pattern: RegExp(`(^|[^\\w.])${Re}[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b`),
|
|
984
|
+
lookbehind: !0,
|
|
985
|
+
inside: ht
|
|
986
|
+
};
|
|
987
|
+
E.java = {
|
|
988
|
+
"doc-comment": {
|
|
989
|
+
pattern: /\/\*\*(?!\/)[^]*?(?:\*\/|$)/g,
|
|
990
|
+
greedy: !0,
|
|
991
|
+
alias: "comment",
|
|
992
|
+
inside: "javadoc"
|
|
993
|
+
},
|
|
994
|
+
comment: re(),
|
|
995
|
+
"triple-quoted-string": {
|
|
996
|
+
// http://openjdk.java.net/jeps/355#Description
|
|
997
|
+
pattern: /"""[ ]*\n(?:\\.|[^\\])*?"""/g,
|
|
998
|
+
greedy: !0,
|
|
999
|
+
alias: "string"
|
|
1000
|
+
},
|
|
1001
|
+
char: {
|
|
1002
|
+
pattern: /'(?:\\.|[^\\\n']){1,6}'/g,
|
|
1003
|
+
greedy: !0
|
|
1004
|
+
},
|
|
1005
|
+
string: {
|
|
1006
|
+
pattern: /(^|[^\\])"(?:\\.|[^\\\n"])*"/g,
|
|
1007
|
+
lookbehind: !0,
|
|
1008
|
+
greedy: !0
|
|
1009
|
+
},
|
|
1010
|
+
annotation: {
|
|
1011
|
+
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
|
1012
|
+
lookbehind: !0,
|
|
1013
|
+
alias: "punctuation"
|
|
1014
|
+
},
|
|
1015
|
+
generics: {
|
|
1016
|
+
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
|
1017
|
+
inside: {
|
|
1018
|
+
"class-name": Yt,
|
|
1019
|
+
keyword: rt,
|
|
1020
|
+
punctuation: /[().,:<>]/,
|
|
1021
|
+
operator: /[?&|]/
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
import: [
|
|
1025
|
+
{
|
|
1026
|
+
pattern: RegExp(`(\\bimport\\s+)${Re}(?:[A-Z]\\w*|\\*)(?=\\s*;)`),
|
|
1027
|
+
lookbehind: !0,
|
|
1028
|
+
inside: {
|
|
1029
|
+
namespace: mt,
|
|
1030
|
+
punctuation: /\./,
|
|
1031
|
+
operator: /\*/,
|
|
1032
|
+
"class-name": /\w+/
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
pattern: RegExp(`(\\bimport\\s+static\\s+)${Re}(?:\\w+|\\*)(?=\\s*;)`),
|
|
1037
|
+
lookbehind: !0,
|
|
1038
|
+
alias: "static",
|
|
1039
|
+
inside: {
|
|
1040
|
+
namespace: mt,
|
|
1041
|
+
static: /\b\w+$/,
|
|
1042
|
+
punctuation: /\./,
|
|
1043
|
+
operator: /\*/,
|
|
1044
|
+
"class-name": /\w+/
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
],
|
|
1048
|
+
namespace: {
|
|
1049
|
+
pattern: RegExp(
|
|
1050
|
+
`(\\b(?:exports|import(?:\\s+static)?|module|opens?|package|provides|requires|to|transitive|uses|with)\\s+)(?!${rt.source})[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?`
|
|
1051
|
+
),
|
|
1052
|
+
lookbehind: !0,
|
|
1053
|
+
inside: {
|
|
1054
|
+
punctuation: /\./
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
"class-name": [
|
|
1058
|
+
Yt,
|
|
1059
|
+
{
|
|
1060
|
+
// variables, parameters, and constructor references
|
|
1061
|
+
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
1062
|
+
pattern: RegExp(`(^|[^\\w.])${Re}[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)`),
|
|
1063
|
+
lookbehind: !0,
|
|
1064
|
+
inside: ht
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
// class names based on keyword
|
|
1068
|
+
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
1069
|
+
pattern: RegExp(`(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)${Re}[A-Z]\\w*\\b`),
|
|
1070
|
+
lookbehind: !0,
|
|
1071
|
+
inside: ht
|
|
1072
|
+
}
|
|
1073
|
+
],
|
|
1074
|
+
keyword: rt,
|
|
1075
|
+
boolean: W,
|
|
1076
|
+
function: {
|
|
1077
|
+
pattern: /\b\w+(?=\()|(::\s*)[a-z_]\w*/,
|
|
1078
|
+
lookbehind: !0
|
|
1079
|
+
},
|
|
1080
|
+
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,
|
|
1081
|
+
constant: /\b[A-Z][A-Z_\d]+\b/,
|
|
1082
|
+
operator: {
|
|
1083
|
+
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[%&|^!=<>/*+-]=?)/m,
|
|
1084
|
+
lookbehind: !0
|
|
1085
|
+
},
|
|
1086
|
+
punctuation: Ee
|
|
1087
|
+
};
|
|
1088
|
+
D(
|
|
1089
|
+
E.less = ae("css", {
|
|
1090
|
+
comment: re(),
|
|
1091
|
+
atrule: {
|
|
1092
|
+
pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,
|
|
1093
|
+
inside: {
|
|
1094
|
+
punctuation: /[():]/
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
// selectors and mixins are considered the same
|
|
1098
|
+
selector: {
|
|
1099
|
+
pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,
|
|
1100
|
+
inside: {
|
|
1101
|
+
// mixin parameters
|
|
1102
|
+
variable: /@+[\w-]+/
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
property: /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,
|
|
1106
|
+
operator: /[/*+-]/
|
|
1107
|
+
}),
|
|
1108
|
+
"property",
|
|
1109
|
+
{
|
|
1110
|
+
variable: [
|
|
1111
|
+
// Variable declaration (the colon must be consumed!)
|
|
1112
|
+
{
|
|
1113
|
+
pattern: /@[\w-]+\s*:/,
|
|
1114
|
+
inside: {
|
|
1115
|
+
punctuation: /:/
|
|
1116
|
+
}
|
|
1117
|
+
},
|
|
1118
|
+
// Variable usage
|
|
1119
|
+
/@@?[\w-]+/
|
|
1120
|
+
],
|
|
1121
|
+
"mixin-usage": {
|
|
1122
|
+
pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
|
|
1123
|
+
lookbehind: !0,
|
|
1124
|
+
alias: "function"
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
);
|
|
1128
|
+
E.objc = E.objectivec = ae("c", {
|
|
1129
|
+
string: {
|
|
1130
|
+
pattern: /@?"(?:\\[^]|[^\\\n"])*"/g,
|
|
1131
|
+
greedy: !0
|
|
1132
|
+
},
|
|
1133
|
+
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/,
|
|
1134
|
+
operator: /-[->]?|\+\+?|!=?|==?|>>?=?|<<?=?|&&?|\|\|?|[~^@%?/*]/
|
|
1135
|
+
});
|
|
1136
|
+
delete E.objc["class-name"];
|
|
1137
|
+
var Nn = {
|
|
1138
|
+
pattern: /^(..)[^]+(?=.)/,
|
|
1139
|
+
lookbehind: !0
|
|
1140
|
+
}, it = "(?:([^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]|[^\\\\<>])*>)*>)", Xt = `(?:"(?:\\\\.|[^\\\\
|
|
1141
|
+
"])*"|(?:\\b(?!\\d)\\w+|[^\\s\0-\\x7f]+)[?!]?|\\$.)`, ie = {
|
|
1142
|
+
pattern: /((?:^|[^\\])(?:\\\\)*)#\{(?:[^{}]|\{[^}]*\})*\}/,
|
|
1143
|
+
lookbehind: !0,
|
|
1144
|
+
inside: {
|
|
1145
|
+
content: Nn,
|
|
1146
|
+
delimiter: {
|
|
1147
|
+
pattern: /.+/,
|
|
1148
|
+
alias: "punctuation"
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
Nn.inside = E.rb = E.ruby = {
|
|
1153
|
+
comment: {
|
|
1154
|
+
pattern: /#.*|^=begin\s[^]*?^=end/mg,
|
|
1155
|
+
greedy: !0
|
|
1156
|
+
},
|
|
1157
|
+
"string-literal": [
|
|
1158
|
+
{
|
|
1159
|
+
pattern: RegExp("%[qQiIwWs]?" + it, "g"),
|
|
1160
|
+
greedy: !0,
|
|
1161
|
+
inside: {
|
|
1162
|
+
interpolation: ie,
|
|
1163
|
+
string: /[^]+/
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
pattern: /(["'])(?:#\{[^}]+\}|#(?!\{)|\\[^]|(?!\1)[^\\#\n])*\1/g,
|
|
1168
|
+
greedy: !0,
|
|
1169
|
+
inside: {
|
|
1170
|
+
interpolation: ie,
|
|
1171
|
+
string: /[^]+/
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
pattern: /<<[-~]?([a-z_]\w*)\n(?:.*\n)*?[ ]*\1/gi,
|
|
1176
|
+
alias: "heredoc-string",
|
|
1177
|
+
greedy: !0,
|
|
1178
|
+
inside: {
|
|
1179
|
+
delimiter: {
|
|
1180
|
+
pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
|
|
1181
|
+
inside: {
|
|
1182
|
+
symbol: /\w+/,
|
|
1183
|
+
punctuation: /^<<[-~]?/
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
interpolation: ie,
|
|
1187
|
+
string: /[^]+/
|
|
1188
|
+
}
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
pattern: /<<[-~]?'([a-z_]\w*)'\n(?:.*\n)*?[ ]*\1/gi,
|
|
1192
|
+
alias: "heredoc-string",
|
|
1193
|
+
greedy: !0,
|
|
1194
|
+
inside: {
|
|
1195
|
+
delimiter: {
|
|
1196
|
+
pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
|
|
1197
|
+
inside: {
|
|
1198
|
+
symbol: /\w+/,
|
|
1199
|
+
punctuation: /^<<[-~]?'|'$/
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
string: /[^]+/
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
],
|
|
1206
|
+
"command-literal": [
|
|
1207
|
+
{
|
|
1208
|
+
pattern: RegExp("%x" + it, "g"),
|
|
1209
|
+
greedy: !0,
|
|
1210
|
+
inside: {
|
|
1211
|
+
interpolation: ie,
|
|
1212
|
+
command: {
|
|
1213
|
+
pattern: /[^]+/,
|
|
1214
|
+
alias: "string"
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\[^]|[^\\`#\n])*`/g,
|
|
1220
|
+
greedy: !0,
|
|
1221
|
+
inside: {
|
|
1222
|
+
interpolation: ie,
|
|
1223
|
+
command: {
|
|
1224
|
+
pattern: /[^]+/,
|
|
1225
|
+
alias: "string"
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
],
|
|
1230
|
+
"class-name": {
|
|
1231
|
+
pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
|
|
1232
|
+
lookbehind: !0,
|
|
1233
|
+
inside: {
|
|
1234
|
+
punctuation: /[.\\]/
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1237
|
+
"regex-literal": [
|
|
1238
|
+
{
|
|
1239
|
+
pattern: RegExp(`%r${it}[egimnosux]{0,6}`, "g"),
|
|
1240
|
+
greedy: !0,
|
|
1241
|
+
inside: {
|
|
1242
|
+
interpolation: ie,
|
|
1243
|
+
regex: /[^]+/
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
pattern: /(^|[^/])\/(?!\/)(?:\[[^\n\]]+\]|\\.|[^\\\n/[])+\/[egimnosux]{0,6}(?=\s*(?:$|[\n,.;})#]))/g,
|
|
1248
|
+
lookbehind: !0,
|
|
1249
|
+
greedy: !0,
|
|
1250
|
+
inside: {
|
|
1251
|
+
interpolation: ie,
|
|
1252
|
+
regex: /[^]+/
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
],
|
|
1256
|
+
variable: /[@$]+(?!\d)\w+(?:[?!]|\b)/,
|
|
1257
|
+
symbol: [
|
|
1258
|
+
{
|
|
1259
|
+
pattern: RegExp("(^|[^:]):" + Xt, "g"),
|
|
1260
|
+
lookbehind: !0,
|
|
1261
|
+
greedy: !0
|
|
1262
|
+
},
|
|
1263
|
+
{
|
|
1264
|
+
pattern: RegExp(`([
|
|
1265
|
+
{(,][ ]*)` + Xt + "(?=:(?!:))", "g"),
|
|
1266
|
+
lookbehind: !0,
|
|
1267
|
+
greedy: !0
|
|
1268
|
+
}
|
|
1269
|
+
],
|
|
1270
|
+
"method-definition": {
|
|
1271
|
+
pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
|
|
1272
|
+
lookbehind: !0,
|
|
1273
|
+
inside: {
|
|
1274
|
+
function: /\b\w+$/,
|
|
1275
|
+
keyword: /^self\b/,
|
|
1276
|
+
"class-name": /^\w+/,
|
|
1277
|
+
punctuation: /\./
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1280
|
+
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/,
|
|
1281
|
+
boolean: W,
|
|
1282
|
+
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/,
|
|
1283
|
+
constant: /\b[A-Z][A-Z\d_]*(?:[?!]|\b)/,
|
|
1284
|
+
number: Rn,
|
|
1285
|
+
"double-colon": {
|
|
1286
|
+
pattern: /::/,
|
|
1287
|
+
alias: "punctuation"
|
|
1288
|
+
},
|
|
1289
|
+
operator: /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[%&|^!=<>/*+-])=?|[?:]/,
|
|
1290
|
+
punctuation: /[()[\]{}.,;]/
|
|
1291
|
+
};
|
|
1292
|
+
E.sql = {
|
|
1293
|
+
comment: /\/\*[^]*?\*\/|(?:--|\/\/|#).*/,
|
|
1294
|
+
variable: [
|
|
1295
|
+
{
|
|
1296
|
+
pattern: /@(["'`])(?:\\[^]|(?!\1)[^\\])+\1/g,
|
|
1297
|
+
greedy: !0
|
|
1298
|
+
},
|
|
1299
|
+
/@[\w.$]+/
|
|
1300
|
+
],
|
|
1301
|
+
string: {
|
|
1302
|
+
pattern: /(^|[^@\\])(["'])(?:\\[^]|(?!\2)[^\\]|\2\2)*\2/g,
|
|
1303
|
+
lookbehind: !0,
|
|
1304
|
+
greedy: !0
|
|
1305
|
+
},
|
|
1306
|
+
identifier: {
|
|
1307
|
+
pattern: /(^|[^@\\])`(?:\\[^]|[^\\`]|``)*`/g,
|
|
1308
|
+
lookbehind: !0,
|
|
1309
|
+
greedy: !0,
|
|
1310
|
+
inside: {
|
|
1311
|
+
punctuation: /^`|`$/
|
|
1312
|
+
}
|
|
1313
|
+
},
|
|
1314
|
+
function: /\b(?:avg|count|first|format|last|[lu]case|len|max|mi[dn]|mod|now|round|sum)(?=\s*\()/i,
|
|
1315
|
+
// Should we highlight user defined functions too?
|
|
1316
|
+
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,
|
|
1317
|
+
boolean: /\b(?:false|true|null)\b/i,
|
|
1318
|
+
number: /\b0x[a-f\d]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
|
|
1319
|
+
operator: /[=%~^/*+-]|&&?|\|\|?|!=?|<<|<=?>?|>[>=]?|\b(?:and|between|div|[ir]?like|in|is|not|x?or|regexp|sounds like)\b/i,
|
|
1320
|
+
punctuation: /[()[\].,;`]/
|
|
1321
|
+
};
|
|
1322
|
+
E.wasm = {
|
|
1323
|
+
comment: /\(;[^]*?;\)|;;.*/,
|
|
1324
|
+
string: {
|
|
1325
|
+
pattern: /"(?:\\[^]|[^\\"])*"/g,
|
|
1326
|
+
greedy: !0
|
|
1327
|
+
},
|
|
1328
|
+
keyword: [
|
|
1329
|
+
{
|
|
1330
|
+
pattern: /\b(?:align|offset)=/,
|
|
1331
|
+
inside: {
|
|
1332
|
+
operator: /=/
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
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/,
|
|
1337
|
+
inside: {
|
|
1338
|
+
punctuation: /\./
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
/\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/
|
|
1342
|
+
],
|
|
1343
|
+
variable: /\$[\w!#$%&'*./:<=>?@\\^`|~+-]+/,
|
|
1344
|
+
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/,
|
|
1345
|
+
punctuation: /[()]/
|
|
1346
|
+
};
|
|
1347
|
+
var _e = (e, t) => {
|
|
1348
|
+
for (var n = 0; n < t; n++)
|
|
1349
|
+
e = e.replace(/<self>/g, `(?:${e})`);
|
|
1350
|
+
return e.replace(/<self>/g, "[]");
|
|
1351
|
+
}, B = (e, t) => e.replace(/<(\d+)>/g, (n, s) => `(?:${t[+s]})`), O = (e, t, n) => RegExp(B(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/, he = E.cpp = ae("c", {
|
|
1352
|
+
"class-name": [
|
|
1353
|
+
{
|
|
1354
|
+
pattern: RegExp(`(\\b(?:class|concept|enum|struct|typename)\\s+)(?!${Et.source})\\w+`),
|
|
1355
|
+
lookbehind: !0
|
|
1356
|
+
},
|
|
1357
|
+
// This is intended to capture the class name of method implementations like:
|
|
1358
|
+
// void foo::bar() const {}
|
|
1359
|
+
// However! The `foo` in the above example could also be a namespace, so we only capture the class name if
|
|
1360
|
+
// it starts with an uppercase letter. This approximation should give decent results.
|
|
1361
|
+
/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
|
|
1362
|
+
// This will capture the class name before destructors like:
|
|
1363
|
+
// Foo::~Foo() {}
|
|
1364
|
+
/\b[a-z_]\w*(?=\s*::\s*~\w+\s*\()/i,
|
|
1365
|
+
// This also intends to capture the class name of method implementations but here the class has template
|
|
1366
|
+
// parameters, so it can't be a namespace (until C++ adds generic namespaces).
|
|
1367
|
+
/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
|
|
1368
|
+
],
|
|
1369
|
+
keyword: Et,
|
|
1370
|
+
number: {
|
|
1371
|
+
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,
|
|
1372
|
+
greedy: !0
|
|
1373
|
+
},
|
|
1374
|
+
operator: /->|--|\+\+|&&|\|\||[?:~]|<=>|>>=?|<<=?|[%&|^!=<>/*+-]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|x?or|x?or_eq)\b/,
|
|
1375
|
+
boolean: W
|
|
1376
|
+
});
|
|
1377
|
+
D(he, "string", {
|
|
1378
|
+
module: {
|
|
1379
|
+
// https://en.cppreference.com/w/cpp/language/modules
|
|
1380
|
+
pattern: O(
|
|
1381
|
+
`(\\b(?:import|module)\\s+)(?:"(?:\\\\[\\s\\S]|[^\\\\
|
|
1382
|
+
"])*"|<[^<>
|
|
1383
|
+
]*>|<0>(?:\\s*:\\s*<0>)?|:\\s*<0>)`,
|
|
1384
|
+
[`\\b(?!${Et.source})\\w+(?:\\s*\\.\\s*\\w+)*\\b`],
|
|
1385
|
+
"g"
|
|
1386
|
+
),
|
|
1387
|
+
lookbehind: !0,
|
|
1388
|
+
greedy: !0,
|
|
1389
|
+
inside: {
|
|
1390
|
+
string: /^[<"][^]+/,
|
|
1391
|
+
operator: /:/,
|
|
1392
|
+
punctuation: /\./
|
|
1393
|
+
}
|
|
1394
|
+
},
|
|
1395
|
+
"raw-string": {
|
|
1396
|
+
pattern: /R"([^()\\ ]{0,16})\([^]*?\)\1"/g,
|
|
1397
|
+
greedy: !0,
|
|
1398
|
+
alias: "string"
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
D(he, "keyword", {
|
|
1402
|
+
"generic-function": {
|
|
1403
|
+
pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
|
|
1404
|
+
inside: {
|
|
1405
|
+
function: /^\w+/,
|
|
1406
|
+
generic: {
|
|
1407
|
+
pattern: /<[^]+/,
|
|
1408
|
+
alias: "class-name",
|
|
1409
|
+
inside: he
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
D(he, "operator", {
|
|
1415
|
+
"double-colon": {
|
|
1416
|
+
pattern: /::/,
|
|
1417
|
+
alias: "punctuation"
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1420
|
+
var kn = Object.assign({}, he);
|
|
1421
|
+
D(he, "class-name", {
|
|
1422
|
+
// the base clause is an optional list of parent classes
|
|
1423
|
+
// https://en.cppreference.com/w/cpp/language/class
|
|
1424
|
+
"base-clause": {
|
|
1425
|
+
pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/g,
|
|
1426
|
+
lookbehind: !0,
|
|
1427
|
+
greedy: !0,
|
|
1428
|
+
inside: kn
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
D(kn, "double-colon", {
|
|
1432
|
+
// All untokenized words that are not namespaces should be class names
|
|
1433
|
+
"class-name": /\b[a-z_]\w*\b(?!\s*::)/i
|
|
1434
|
+
});
|
|
1435
|
+
E.go = {
|
|
1436
|
+
comment: re(),
|
|
1437
|
+
char: {
|
|
1438
|
+
pattern: /'(?:\\.|[^\\\n']){0,10}'/g,
|
|
1439
|
+
greedy: !0
|
|
1440
|
+
},
|
|
1441
|
+
string: {
|
|
1442
|
+
pattern: /(^|[^\\])"(?:\\.|[^\\\n"])*"|`[^`]*`/g,
|
|
1443
|
+
lookbehind: !0,
|
|
1444
|
+
greedy: !0
|
|
1445
|
+
},
|
|
1446
|
+
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/,
|
|
1447
|
+
boolean: /\b(?:_|false|true|iota|nil)\b/,
|
|
1448
|
+
function: /\b\w+(?=\()/,
|
|
1449
|
+
number: [
|
|
1450
|
+
// binary and octal integers
|
|
1451
|
+
/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
|
|
1452
|
+
// hexadecimal integers and floats
|
|
1453
|
+
/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
|
|
1454
|
+
// decimal integers and floats
|
|
1455
|
+
/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
|
|
1456
|
+
],
|
|
1457
|
+
operator: /--|\+\+|&&|\|\||&\^=?|<-|<<=?|>>=?|[%&|^!=<>/*+-]=?|:=|\.{3}/,
|
|
1458
|
+
punctuation: Ee,
|
|
1459
|
+
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/
|
|
1460
|
+
};
|
|
1461
|
+
var st = {};
|
|
1462
|
+
E.js = E.javascript = Object.assign(st, {
|
|
1463
|
+
"doc-comment": {
|
|
1464
|
+
pattern: /\/\*\*(?!\/)[^]*?(?:\*\/|$)/g,
|
|
1465
|
+
greedy: !0,
|
|
1466
|
+
alias: "comment",
|
|
1467
|
+
inside: "jsdoc"
|
|
1468
|
+
},
|
|
1469
|
+
comment: re(),
|
|
1470
|
+
hashbang: {
|
|
1471
|
+
pattern: /^#!.*/g,
|
|
1472
|
+
greedy: !0,
|
|
1473
|
+
alias: "comment"
|
|
1474
|
+
},
|
|
1475
|
+
"template-string": {
|
|
1476
|
+
pattern: /`(?:\\[^]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\}|(?!\$\{)[^\\`])*`/g,
|
|
1477
|
+
greedy: !0,
|
|
1478
|
+
inside: {
|
|
1479
|
+
"template-punctuation": {
|
|
1480
|
+
pattern: /^`|`$/,
|
|
1481
|
+
alias: "string"
|
|
1482
|
+
},
|
|
1483
|
+
interpolation: {
|
|
1484
|
+
pattern: /((?:^|[^\\])(?:\\\\)*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\}/,
|
|
1485
|
+
lookbehind: !0,
|
|
1486
|
+
inside: {
|
|
1487
|
+
"interpolation-punctuation": {
|
|
1488
|
+
pattern: /^\$\{|\}$/,
|
|
1489
|
+
alias: "punctuation"
|
|
1490
|
+
},
|
|
1491
|
+
[Y]: st
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
string: /[^]+/
|
|
1495
|
+
}
|
|
1496
|
+
},
|
|
1497
|
+
"string-property": {
|
|
1498
|
+
pattern: /((?:^|[,{])[ ]*)(["'])(?:\\[^]|(?!\2)[^\\\n])*\2(?=\s*:)/mg,
|
|
1499
|
+
lookbehind: !0,
|
|
1500
|
+
greedy: !0,
|
|
1501
|
+
alias: "property"
|
|
1502
|
+
},
|
|
1503
|
+
string: Nt(),
|
|
1504
|
+
regex: {
|
|
1505
|
+
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,
|
|
1506
|
+
lookbehind: !0,
|
|
1507
|
+
greedy: !0,
|
|
1508
|
+
inside: {
|
|
1509
|
+
"regex-flags": /\w+$/,
|
|
1510
|
+
"regex-delimiter": /^\/|\/$/,
|
|
1511
|
+
"regex-source": {
|
|
1512
|
+
pattern: /.+/,
|
|
1513
|
+
alias: "language-regex",
|
|
1514
|
+
inside: "regex"
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
"class-name": [
|
|
1519
|
+
{
|
|
1520
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new)\s+)(?!\d)(?:(?!\s)[$\w.\xa0-\uffff])+/,
|
|
1521
|
+
lookbehind: !0,
|
|
1522
|
+
inside: {
|
|
1523
|
+
punctuation: /\./
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
pattern: /(^|[^$\w\xa0-\uffff]|\s)(?![a-z\d])(?:(?!\s)[$\w\xa0-\uffff])+(?=\.(?:constructor|prototype)\b)/,
|
|
1528
|
+
lookbehind: !0
|
|
1529
|
+
}
|
|
1530
|
+
],
|
|
1531
|
+
// This must be declared before keyword because we use "function" inside the look-forward
|
|
1532
|
+
"function-variable": {
|
|
1533
|
+
pattern: /#?(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^)]*\))*\)|(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+)\s*=>))/,
|
|
1534
|
+
alias: "function",
|
|
1535
|
+
inside: {
|
|
1536
|
+
"maybe-class-name": /^[A-Z].*/
|
|
1537
|
+
}
|
|
1538
|
+
},
|
|
1539
|
+
parameter: [
|
|
1540
|
+
/(function(?:\s+(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
1541
|
+
/(^|[^$\w\xa0-\uffff]|\s)(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?=\s*=>)/,
|
|
1542
|
+
/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
1543
|
+
/((?:\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*\{)/
|
|
1544
|
+
].map((e) => ({
|
|
1545
|
+
pattern: e,
|
|
1546
|
+
lookbehind: !0,
|
|
1547
|
+
inside: st
|
|
1548
|
+
})),
|
|
1549
|
+
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/,
|
|
1550
|
+
keyword: [
|
|
1551
|
+
{
|
|
1552
|
+
pattern: /(^|[^.]|\.{3}\s*)\b(?:as|assert(?=\s*\{)|export|from(?!\s*[^\s"'])|import)\b/,
|
|
1553
|
+
alias: "module",
|
|
1554
|
+
lookbehind: !0
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
pattern: /(^|[^.]|\.{3}\s*)\b(?:await|break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,
|
|
1558
|
+
alias: "control-flow",
|
|
1559
|
+
lookbehind: !0
|
|
1560
|
+
},
|
|
1561
|
+
{
|
|
1562
|
+
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/,
|
|
1563
|
+
lookbehind: !0
|
|
1564
|
+
}
|
|
1565
|
+
],
|
|
1566
|
+
boolean: W,
|
|
1567
|
+
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
1568
|
+
function: {
|
|
1569
|
+
pattern: /#?(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
1570
|
+
inside: {
|
|
1571
|
+
"maybe-class-name": /^[A-Z].*/
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1574
|
+
number: {
|
|
1575
|
+
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])/,
|
|
1576
|
+
lookbehind: !0
|
|
1577
|
+
},
|
|
1578
|
+
"literal-property": {
|
|
1579
|
+
pattern: /([\n,{][ ]*)(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?=\s*:)/,
|
|
1580
|
+
lookbehind: !0,
|
|
1581
|
+
alias: "property"
|
|
1582
|
+
},
|
|
1583
|
+
operator: [
|
|
1584
|
+
{
|
|
1585
|
+
pattern: /=>/,
|
|
1586
|
+
alias: "arrow"
|
|
1587
|
+
},
|
|
1588
|
+
/--|\+\+|(?:\*\*|&&|\|\||[!=]=|>>>?|<<|[%&|^!=<>/*+-]|\?\?)=?|\.{3}|\?(?!\.)|~|:/
|
|
1589
|
+
],
|
|
1590
|
+
"property-access": {
|
|
1591
|
+
pattern: /(\.\s*)#?(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+/,
|
|
1592
|
+
lookbehind: !0,
|
|
1593
|
+
inside: {
|
|
1594
|
+
"maybe-class-name": /^[A-Z].*/
|
|
1595
|
+
}
|
|
1596
|
+
},
|
|
1597
|
+
"maybe-class-name": {
|
|
1598
|
+
pattern: /(^|[^$\w\xa0-\uffff])[A-Z][$\w\xa0-\uffff]+/,
|
|
1599
|
+
lookbehind: !0
|
|
1600
|
+
},
|
|
1601
|
+
punctuation: /\?\.|[()[\]{}.,:;]/
|
|
1602
|
+
});
|
|
1603
|
+
var ua = (e) => (t, n) => {
|
|
1604
|
+
for (var s = Rt(e), d = "", p = [], b = 0, m = Ye(t, n), _ = 0, y = m.length, h = 0; _ < y; ) {
|
|
1605
|
+
var l = m[_++], c = l.length, w = l.type;
|
|
1606
|
+
w && w.slice(0, 6) != "ignore" ? (p[b++] = [h, l], d += " ".repeat(c)) : d += t.slice(h, h + c), h += c;
|
|
1607
|
+
}
|
|
1608
|
+
var g = 0, h = 0, a = (u) => {
|
|
1609
|
+
for (var o = 0; g < b && o < u.length; o++) {
|
|
1610
|
+
var i = u[o], f = i.content;
|
|
1611
|
+
if (Array.isArray(f))
|
|
1612
|
+
a(f);
|
|
1613
|
+
else {
|
|
1614
|
+
for (var R = i.length, A = [], v, S, k = 0, N = h; ([v, S] = p[g], v >= h && v < h + R) && (N < v && (A[k++] = d.slice(N, v)), N = v + S.length, A[k++] = S, ++g != b); )
|
|
1615
|
+
;
|
|
1616
|
+
h += R, k && (N < h && (A[k++] = d.slice(N, h)), f ? i.content = A : (u.splice(o, 1, ...A), o += k - 1));
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}, r = s ? St(d, s) : [d];
|
|
1620
|
+
return a(r), r;
|
|
1621
|
+
}, On = E.js, kt = On["template-string"], pa = kt.pattern.source, fa = kt.inside.interpolation.pattern, pe = (e, t) => ({
|
|
1622
|
+
pattern: RegExp("((?:" + t + ")\\s*)" + pa, "g"),
|
|
1623
|
+
lookbehind: !0,
|
|
1624
|
+
greedy: !0,
|
|
1625
|
+
inside: {
|
|
1626
|
+
"template-punctuation": {
|
|
1627
|
+
pattern: /^`|`$/,
|
|
1628
|
+
alias: "string"
|
|
1629
|
+
},
|
|
1630
|
+
["language-" + e]: {
|
|
1631
|
+
pattern: /[^]+/,
|
|
1632
|
+
inside: {
|
|
1633
|
+
interpolation: {
|
|
1634
|
+
pattern: fa,
|
|
1635
|
+
lookbehind: !0,
|
|
1636
|
+
alias: "language-javascript",
|
|
1637
|
+
inside: {
|
|
1638
|
+
"interpolation-punctuation": {
|
|
1639
|
+
pattern: /^\$\{|\}$/,
|
|
1640
|
+
alias: "punctuation"
|
|
1641
|
+
},
|
|
1642
|
+
[Y]: "js"
|
|
1643
|
+
}
|
|
1644
|
+
},
|
|
1645
|
+
[le]: ua(e)
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
});
|
|
1650
|
+
On["template-string"] = [
|
|
1651
|
+
// styled-jsx:
|
|
1652
|
+
// css`a { color: #25F; }`
|
|
1653
|
+
// styled-components:
|
|
1654
|
+
// styled.h1`color: red;`
|
|
1655
|
+
pe("css", "\\b(?:styled(?:\\([^)]*\\))?(?:\\s*\\.\\s*\\w+(?:\\([^)]*\\))*)*|css(?:\\s*\\.\\s*(?:global|resolve))?|createGlobalStyle|keyframes)"),
|
|
1656
|
+
// html`<p></p>`
|
|
1657
|
+
// div.innerHTML = `<p></p>`
|
|
1658
|
+
pe("html", "\\bhtml|\\.\\s*(?:inner|outer)HTML\\s*\\+?="),
|
|
1659
|
+
// svg`<path fill="#fff" d="M55.37 ..."/>`
|
|
1660
|
+
pe("svg", "\\bsvg"),
|
|
1661
|
+
// md`# h1`, markdown`## h2`
|
|
1662
|
+
pe("markdown", "\\b(?:markdown|md)"),
|
|
1663
|
+
// gql`...`, graphql`...`, graphql.experimental`...`
|
|
1664
|
+
pe("graphql", "\\b(?:gql|graphql(?:\\s*\\.\\s*experimental)?)"),
|
|
1665
|
+
// sql`...`
|
|
1666
|
+
pe("sql", "\\bsql"),
|
|
1667
|
+
// vanilla template string
|
|
1668
|
+
kt
|
|
1669
|
+
];
|
|
1670
|
+
var $e = "\\s|//.*(?!.)|/\\*(?:[^*]|\\*(?!/))*\\*/", _t = "\\{(?:[^{}]|\\{(?:[^{}]|\\{[^}]*\\})*\\})*\\}", Qt = B("\\{<0>*\\.{3}(?:[^{}]|<1>)*\\}", [$e, _t]), Jt = (e) => e && (!e.type || e.type == "plain-text"), ba = (e, t, n) => {
|
|
1671
|
+
for (var s = 0, d = [], p = 0; s < e.length; s++) {
|
|
1672
|
+
var b = e[s], m = b.length, _ = b.type, y = !_, l, c, w, g, h;
|
|
1673
|
+
_ && (h = b.content, _ == "tag" ? (w = h[0].length, c = h[2] ? t.substr(n + w, h[1].length) : "", w > 1 ? p && d[p - 1][0] == c && p-- : h[h.length - 1].length < 2 && (d[p++] = [c, 0])) : p && _ == "punctuation" ? (l = d[p - 1], h == "{" ? l[1]++ : l[1] && h == "}" ? l[1]-- : y = !"}()[]".includes(h)) : y = !0), y && p && !d[p - 1][1] && (w = n, Jt(e[s + 1]) && (m += e[s + 1].length, e.splice(s + 1, 1)), Jt(e[s - 1]) && (w -= e[--s].length, e.splice(s, 1)), g = t.slice(w, n + m), e[s] = new fe("plain-text", g, g)), n += m;
|
|
1674
|
+
}
|
|
1675
|
+
return e;
|
|
1676
|
+
}, Ln = (e, t) => {
|
|
1677
|
+
D(E[t] = e = Tt(e), "regex", {
|
|
1678
|
+
tag: {
|
|
1679
|
+
pattern: O(
|
|
1680
|
+
`</?(?:(?!\\d)[^\\s/=><%]+(?:<0>(?:<0>*(?:[^\\s<>/={*]+(?:<0>*=<0>*(?!\\s)(?:"[^"]*"|'[^']*'|<1>)?|(?=[\\s/>]))|<2>))+)?<0>*/?)?>`,
|
|
1681
|
+
[$e, _t, Qt],
|
|
1682
|
+
"g"
|
|
1683
|
+
),
|
|
1684
|
+
greedy: !0,
|
|
1685
|
+
inside: {
|
|
1686
|
+
punctuation: /^<\/?|\/?>$/,
|
|
1687
|
+
tag: {
|
|
1688
|
+
pattern: /^[^\s/]+/,
|
|
1689
|
+
inside: {
|
|
1690
|
+
namespace: /^[^:]+:/,
|
|
1691
|
+
"class-name": /^[A-Z]\w*(?:\.[A-Z]\w*)*$/
|
|
1692
|
+
}
|
|
1693
|
+
},
|
|
1694
|
+
script: {
|
|
1695
|
+
// Allow for two levels of nesting
|
|
1696
|
+
pattern: O("(=<0>*)<1>", [$e, _t]),
|
|
1697
|
+
lookbehind: !0,
|
|
1698
|
+
alias: t = "language-" + t,
|
|
1699
|
+
inside: e
|
|
1700
|
+
},
|
|
1701
|
+
spread: {
|
|
1702
|
+
pattern: RegExp(Qt),
|
|
1703
|
+
alias: t,
|
|
1704
|
+
inside: e
|
|
1705
|
+
},
|
|
1706
|
+
"attr-value": {
|
|
1707
|
+
pattern: O(`(=<0>*)(?:"[^"]*"|'[^']*')`, [$e]),
|
|
1708
|
+
lookbehind: !0,
|
|
1709
|
+
inside: {
|
|
1710
|
+
punctuation: /^["']|["']$/
|
|
1711
|
+
}
|
|
1712
|
+
},
|
|
1713
|
+
comment: e.comment,
|
|
1714
|
+
"attr-equals": /=/,
|
|
1715
|
+
"attr-name": {
|
|
1716
|
+
pattern: /\S+/,
|
|
1717
|
+
inside: {
|
|
1718
|
+
namespace: /^[^:]+:/
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}), e[le] = (n, s) => ba(Ye(n, s), n, 0);
|
|
1724
|
+
};
|
|
1725
|
+
Ln(E.js, "jsx");
|
|
1726
|
+
E.lua = {
|
|
1727
|
+
comment: /^#!.+|--(?:\[(=*)\[[^]*?\]\1\]|.*)/m,
|
|
1728
|
+
// \z may be used to skip the following space
|
|
1729
|
+
string: {
|
|
1730
|
+
pattern: /(["'])(?:(?!\1)[^\\\n]|\\z\s|\\[^z])*\1|\[(=*)\[[^]*?\]\2\]/g,
|
|
1731
|
+
greedy: !0
|
|
1732
|
+
},
|
|
1733
|
+
number: /\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
|
|
1734
|
+
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/,
|
|
1735
|
+
function: /(?!\d)\w+(?=\s*(?:[({]))/,
|
|
1736
|
+
// Match ".." but don't break "..."
|
|
1737
|
+
operator: {
|
|
1738
|
+
pattern: /[%&|^#*+-]|\/\/?|<[<=]?|>[>=]?|[=~]=?|(^|[^.])\.\.(?!\.)/,
|
|
1739
|
+
lookbehind: !0
|
|
1740
|
+
},
|
|
1741
|
+
punctuation: /[()[\]{},;]|\.+|:+/
|
|
1742
|
+
};
|
|
1743
|
+
var Me = "(?:\\((?:\\\\[\\s\\S]|[^\\\\()])*\\)|\\{(?:\\\\[\\s\\S]|[^\\\\{}])*\\}|\\[(?:\\\\[\\s\\S]|[^\\\\[\\]])*\\]|<(?:\\\\[\\s\\S]|[^\\\\<>])*>)", en = "(?![a-zA-Zd])\\s*(?:([^a-zA-Zd\\s{([<])(?:\\\\[^]|(?!\\1)[^\\\\])*\\1|([a-zA-Zd])(?:\\\\[^]|(?!\\2)[^\\\\])*\\2";
|
|
1744
|
+
E.perl = {
|
|
1745
|
+
comment: [
|
|
1746
|
+
{
|
|
1747
|
+
// POD
|
|
1748
|
+
pattern: /(^\s*)=\w[^]*?=cut.*/mg,
|
|
1749
|
+
lookbehind: !0,
|
|
1750
|
+
greedy: !0
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
pattern: /(^|[^\\$])#.*/g,
|
|
1754
|
+
lookbehind: !0,
|
|
1755
|
+
greedy: !0
|
|
1756
|
+
}
|
|
1757
|
+
],
|
|
1758
|
+
// TODO Could be nice to handle Heredoc too.
|
|
1759
|
+
string: {
|
|
1760
|
+
pattern: RegExp(
|
|
1761
|
+
`\\bq[qwx]?${en}|${Me})|("|\`)(?:\\\\[^]|(?!\\3)[^\\\\])*\\3|'(?:\\\\.|[^\\\\
|
|
1762
|
+
'])*'`,
|
|
1763
|
+
"g"
|
|
1764
|
+
),
|
|
1765
|
+
greedy: !0
|
|
1766
|
+
},
|
|
1767
|
+
regex: [
|
|
1768
|
+
{
|
|
1769
|
+
pattern: RegExp(
|
|
1770
|
+
`\\b(?:m|qr)${en}|${Me})[msixpodualngc]*`,
|
|
1771
|
+
"g"
|
|
1772
|
+
),
|
|
1773
|
+
greedy: !0
|
|
1774
|
+
},
|
|
1775
|
+
// The lookbehinds prevent -s from breaking
|
|
1776
|
+
{
|
|
1777
|
+
pattern: RegExp(
|
|
1778
|
+
`(^|[^-])\\b(?:s|tr|y)(?![a-zA-Zd])\\s*(?:([^a-zA-Zd\\s{([<])(?:\\\\[^]|(?!\\2)[^\\\\])*\\2(?:\\\\[^]|(?!\\2)[^\\\\])*\\2|([a-zA-Zd])(?:\\\\[^]|(?!\\3)[^\\\\])*\\3(?:\\\\[^]|(?!\\3)[^\\\\])*\\3|${Me}\\s*${Me})[msixpodualngcer]*`,
|
|
1779
|
+
"g"
|
|
1780
|
+
),
|
|
1781
|
+
lookbehind: !0,
|
|
1782
|
+
greedy: !0
|
|
1783
|
+
},
|
|
1784
|
+
// /.../
|
|
1785
|
+
// The look-ahead tries to prevent two divisions on
|
|
1786
|
+
// the same line from being highlighted as regex.
|
|
1787
|
+
// This does not support multi-line regex.
|
|
1788
|
+
{
|
|
1789
|
+
pattern: /\/(?:\\.|[^\\\n/])*\/[msixpodualngc]*(?=\s*(?:$|[\n,.;})&|*~<>!?^+-]|(?:and|cmp|eq|[gl][et]|ne|not|x|x?or)\b))/g,
|
|
1790
|
+
greedy: !0
|
|
1791
|
+
}
|
|
1792
|
+
],
|
|
1793
|
+
// FIXME Not sure about the handling of ::, ', and #
|
|
1794
|
+
variable: /[&*$@%](?:\{\^[A-Z]+\}|\^[A-Z_]|#?(?=\{)|#?(?:(?:::)*'?(?!\d)[$\w]+(?![$\w]))+(?:::)*|\d+)|(?!%=)[$@%][!"#$%&'*,./:;<=>?@()[\]{}||^_`|~+-]/,
|
|
1795
|
+
filehandle: {
|
|
1796
|
+
// <>, <FOO>, _
|
|
1797
|
+
pattern: /<(?![<=])\S*?>|\b_\b/,
|
|
1798
|
+
alias: "symbol"
|
|
1799
|
+
},
|
|
1800
|
+
"v-string": {
|
|
1801
|
+
// v1.2, 1.2.3
|
|
1802
|
+
pattern: /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,
|
|
1803
|
+
alias: "string"
|
|
1804
|
+
},
|
|
1805
|
+
function: {
|
|
1806
|
+
pattern: /(\bsub[ ]+)\w+/,
|
|
1807
|
+
lookbehind: !0
|
|
1808
|
+
},
|
|
1809
|
+
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/,
|
|
1810
|
+
number: /\b(?:0x[a-fA-F\d](?:_?[a-fA-F\d])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,
|
|
1811
|
+
operator: /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|->|=>|=~|~~|<=>?|!~|--|\+\+|(?:\*\*|\/\/|&&|\|\||<<|>>|[~%&|^!=<>/*+-])=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|[gl][et]|ne|not|x?or)\b/,
|
|
1812
|
+
punctuation: /[()[\]{},:;]/
|
|
1813
|
+
};
|
|
1814
|
+
var tn = {
|
|
1815
|
+
"format-spec": {
|
|
1816
|
+
pattern: /(:)[^(){}:]+(?=\}$)/,
|
|
1817
|
+
lookbehind: !0
|
|
1818
|
+
},
|
|
1819
|
+
"conversion-option": {
|
|
1820
|
+
pattern: //,
|
|
1821
|
+
alias: "punctuation"
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
tn[Y] = E.py = E.python = {
|
|
1825
|
+
comment: {
|
|
1826
|
+
pattern: /#.*/g,
|
|
1827
|
+
greedy: !0
|
|
1828
|
+
},
|
|
1829
|
+
"string-interpolation": {
|
|
1830
|
+
pattern: /(?:fr?|rf)(?:("""|''')[^]*?\1|(["'])(?:\\[^]|(?!\2)[^\\\n])*\2)/gi,
|
|
1831
|
+
greedy: !0,
|
|
1832
|
+
inside: {
|
|
1833
|
+
interpolation: {
|
|
1834
|
+
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
|
1835
|
+
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})*\}/,
|
|
1836
|
+
lookbehind: !0,
|
|
1837
|
+
inside: tn
|
|
1838
|
+
},
|
|
1839
|
+
string: /[^]+/
|
|
1840
|
+
}
|
|
1841
|
+
},
|
|
1842
|
+
"triple-quoted-string": {
|
|
1843
|
+
pattern: /(?:br?|rb?|u)?("""|''')[^]*?\1/gi,
|
|
1844
|
+
greedy: !0,
|
|
1845
|
+
alias: "string"
|
|
1846
|
+
},
|
|
1847
|
+
string: {
|
|
1848
|
+
pattern: /(?:br?|rb?|u)?(["'])(?:\\[^]|(?!\1)[^\\\n])*\1/gi,
|
|
1849
|
+
greedy: !0
|
|
1850
|
+
},
|
|
1851
|
+
function: {
|
|
1852
|
+
pattern: /((?:^|\s)def[ ]+)(?!\d)\w+(?=\s*\()/,
|
|
1853
|
+
lookbehind: !0
|
|
1854
|
+
},
|
|
1855
|
+
"class-name": {
|
|
1856
|
+
pattern: /(\bclass\s+)\w+/i,
|
|
1857
|
+
lookbehind: !0
|
|
1858
|
+
},
|
|
1859
|
+
decorator: {
|
|
1860
|
+
pattern: /(^[ ]*)@\w+(?:\.\w+)*/m,
|
|
1861
|
+
lookbehind: !0,
|
|
1862
|
+
alias: "annotation punctuation",
|
|
1863
|
+
inside: {
|
|
1864
|
+
punctuation: /\./
|
|
1865
|
+
}
|
|
1866
|
+
},
|
|
1867
|
+
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/,
|
|
1868
|
+
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/,
|
|
1869
|
+
boolean: /\b(?:False|True|None)\b/,
|
|
1870
|
+
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,
|
|
1871
|
+
operator: /!=|:=|\*\*=?|\/\/=?|<>|>>|<<|[%=<>/*+-]=?|[&|^~]/,
|
|
1872
|
+
punctuation: Ee
|
|
1873
|
+
};
|
|
1874
|
+
var ga = _e("/\\*(?:[^*/]|\\*(?!/)|/(?!\\*)|<self>)*\\*/", 2), nn = {
|
|
1875
|
+
pattern: /b?"(?:\\[^]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/g,
|
|
1876
|
+
greedy: !0
|
|
1877
|
+
}, an = {
|
|
1878
|
+
"closure-punctuation": {
|
|
1879
|
+
pattern: /^\||\|$/,
|
|
1880
|
+
alias: "punctuation"
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
an[Y] = E.rust = {
|
|
1884
|
+
comment: {
|
|
1885
|
+
pattern: RegExp("//.*|" + ga, "g"),
|
|
1886
|
+
greedy: !0
|
|
1887
|
+
},
|
|
1888
|
+
string: nn,
|
|
1889
|
+
char: {
|
|
1890
|
+
pattern: /b?'(?:\\(?:x[0-7][a-fA-F\d]|u\{(?:[a-fA-F\d]_*){1,6}\}|.)|[^\\\n '])'/g,
|
|
1891
|
+
greedy: !0
|
|
1892
|
+
},
|
|
1893
|
+
attribute: {
|
|
1894
|
+
pattern: /#!?\[(?:[^[\]"]|"(?:\\[^]|[^\\"])*")*\]/g,
|
|
1895
|
+
greedy: !0,
|
|
1896
|
+
alias: "attr-name",
|
|
1897
|
+
inside: {
|
|
1898
|
+
string: nn
|
|
1899
|
+
}
|
|
1900
|
+
},
|
|
1901
|
+
// Closure params should not be confused with bitwise OR |
|
|
1902
|
+
"closure-params": {
|
|
1903
|
+
pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/g,
|
|
1904
|
+
lookbehind: !0,
|
|
1905
|
+
greedy: !0,
|
|
1906
|
+
inside: an
|
|
1907
|
+
},
|
|
1908
|
+
"lifetime-annotation": {
|
|
1909
|
+
pattern: /'\w+/,
|
|
1910
|
+
alias: "symbol"
|
|
1911
|
+
},
|
|
1912
|
+
"fragment-specifier": {
|
|
1913
|
+
pattern: /(\$\w+:)[a-z]+/,
|
|
1914
|
+
lookbehind: !0,
|
|
1915
|
+
alias: "punctuation"
|
|
1916
|
+
},
|
|
1917
|
+
variable: /\$\w+/,
|
|
1918
|
+
"function-definition": {
|
|
1919
|
+
pattern: /(\bfn\s+)\w+/,
|
|
1920
|
+
lookbehind: !0,
|
|
1921
|
+
alias: "function"
|
|
1922
|
+
},
|
|
1923
|
+
"type-definition": {
|
|
1924
|
+
pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/,
|
|
1925
|
+
lookbehind: !0,
|
|
1926
|
+
alias: "class-name"
|
|
1927
|
+
},
|
|
1928
|
+
"module-declaration": [
|
|
1929
|
+
{
|
|
1930
|
+
pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,
|
|
1931
|
+
lookbehind: !0,
|
|
1932
|
+
alias: "namespace"
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
pattern: /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,
|
|
1936
|
+
lookbehind: !0,
|
|
1937
|
+
alias: "namespace",
|
|
1938
|
+
inside: {
|
|
1939
|
+
punctuation: /::/
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
],
|
|
1943
|
+
// https://github.com/rust-lang/reference/blob/master/src/keywords.md
|
|
1944
|
+
// primitives and str
|
|
1945
|
+
// https://doc.rust-lang.org/stable/rust-by-example/primitives.html
|
|
1946
|
+
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/,
|
|
1947
|
+
// functions can technically start with an upper-case letter, but this will introduce a lot of false positives
|
|
1948
|
+
// and Rust's naming conventions recommend snake_case anyway.
|
|
1949
|
+
// https://doc.rust-lang.org/1.0.0/style/style/naming/README.html
|
|
1950
|
+
function: /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
|
|
1951
|
+
macro: {
|
|
1952
|
+
pattern: /\b\w+!/,
|
|
1953
|
+
alias: "property"
|
|
1954
|
+
},
|
|
1955
|
+
constant: /\b[A-Z_][A-Z_\d]+\b/,
|
|
1956
|
+
"class-name": /\b[A-Z]\w*\b/,
|
|
1957
|
+
namespace: {
|
|
1958
|
+
pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,
|
|
1959
|
+
inside: {
|
|
1960
|
+
punctuation: /::/
|
|
1961
|
+
}
|
|
1962
|
+
},
|
|
1963
|
+
// Hex, oct, bin, dec numbers with visual separators and type suffix
|
|
1964
|
+
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/,
|
|
1965
|
+
boolean: W,
|
|
1966
|
+
punctuation: /->|\.\.=|\.{1,3}|::|[()[\]{},:;]/,
|
|
1967
|
+
operator: /&&|\|\||=>|>>=?|<<=?|[%&|^!=<>/*+-]=?|[@?]/
|
|
1968
|
+
};
|
|
1969
|
+
var rn = E.swift = {
|
|
1970
|
+
comment: {
|
|
1971
|
+
// Nested comments are supported up to 2 levels
|
|
1972
|
+
pattern: /\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\//g,
|
|
1973
|
+
greedy: !0
|
|
1974
|
+
},
|
|
1975
|
+
"string-literal": [
|
|
1976
|
+
// https://docs.swift.org/swift-book/LanguageGuide/StringsAndCharacters.html
|
|
1977
|
+
{
|
|
1978
|
+
pattern: /(^|[^"#])(?:"(?:\\(?:\((?:[^()]|\([^)]*\))*\)|[^(])|[^\\\n"])*"|"""(?:\\(?:\((?:[^()]|\([^)]*\))*\)|[^(])|[^\\"]|"(?!""))*""")(?!["#])/g,
|
|
1979
|
+
lookbehind: !0,
|
|
1980
|
+
greedy: !0,
|
|
1981
|
+
inside: {
|
|
1982
|
+
interpolation: {
|
|
1983
|
+
pattern: /(\\\()(?:[^()]|\([^()]*\))+(?=\))/,
|
|
1984
|
+
lookbehind: !0
|
|
1985
|
+
},
|
|
1986
|
+
"interpolation-punctuation": {
|
|
1987
|
+
pattern: /^\)|\\\($/,
|
|
1988
|
+
alias: "punctuation"
|
|
1989
|
+
},
|
|
1990
|
+
punctuation: /\\(?=\n)/,
|
|
1991
|
+
string: /[^]+/
|
|
1992
|
+
}
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
pattern: /(^|[^"#])(#+)(?:"(?:\\(?:#+\((?:[^()]|\([^)]*\))*\)|[^#])|[^\\\n])*?"|"""(?:\\(?:#+\((?:[^()]|\([^)]*\))*\)|[^#])|[^\\])*?""")\2/g,
|
|
1996
|
+
lookbehind: !0,
|
|
1997
|
+
greedy: !0,
|
|
1998
|
+
inside: {
|
|
1999
|
+
interpolation: {
|
|
2000
|
+
pattern: /(\\#+\()(?:[^()]|\([^()]*\))+(?=\))/,
|
|
2001
|
+
lookbehind: !0
|
|
2002
|
+
},
|
|
2003
|
+
"interpolation-punctuation": {
|
|
2004
|
+
pattern: /^\)|\\#+\($/,
|
|
2005
|
+
alias: "punctuation"
|
|
2006
|
+
},
|
|
2007
|
+
string: /[^]+/
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
],
|
|
2011
|
+
directive: {
|
|
2012
|
+
// directives with conditions
|
|
2013
|
+
pattern: /#(?:(?:elseif|if)\b(?:[ ]*(?:![ ]*)?(?:\b\w+\b(?:[ ]*\((?:[^()]|\([^)]*\))*\))?|\((?:[^()]|\([^)]*\))*\))(?:[ ]*(?:&&|\|\|))?)+|(?:else|endif)\b)/,
|
|
2014
|
+
alias: "property",
|
|
2015
|
+
inside: {
|
|
2016
|
+
"directive-name": /^#\w+/,
|
|
2017
|
+
boolean: W,
|
|
2018
|
+
number: /\b\d+(?:\.\d+)*\b/,
|
|
2019
|
+
operator: /!|&&|\|\||[<>]=?/,
|
|
2020
|
+
punctuation: /[(),]/
|
|
2021
|
+
}
|
|
2022
|
+
},
|
|
2023
|
+
literal: {
|
|
2024
|
+
pattern: /#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,
|
|
2025
|
+
alias: "constant"
|
|
2026
|
+
},
|
|
2027
|
+
"other-directive": {
|
|
2028
|
+
pattern: /#\w+/,
|
|
2029
|
+
alias: "property"
|
|
2030
|
+
},
|
|
2031
|
+
attribute: {
|
|
2032
|
+
pattern: /@\w+/,
|
|
2033
|
+
alias: "atrule"
|
|
2034
|
+
},
|
|
2035
|
+
"function-definition": {
|
|
2036
|
+
pattern: /(\bfunc\s+)\w+/,
|
|
2037
|
+
lookbehind: !0,
|
|
2038
|
+
alias: "function"
|
|
2039
|
+
},
|
|
2040
|
+
label: {
|
|
2041
|
+
// https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html#ID141
|
|
2042
|
+
pattern: /\b(break|continue)\s+\w+|\b(?!\d)\w+(?=\s*:\s*(?:for|repeat|while)\b)/,
|
|
2043
|
+
lookbehind: !0,
|
|
2044
|
+
alias: "important"
|
|
2045
|
+
},
|
|
2046
|
+
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/,
|
|
2047
|
+
boolean: W,
|
|
2048
|
+
nil: {
|
|
2049
|
+
pattern: /\bnil\b/,
|
|
2050
|
+
alias: "constant"
|
|
2051
|
+
},
|
|
2052
|
+
"short-argument": /\$\d+\b/,
|
|
2053
|
+
omit: {
|
|
2054
|
+
pattern: /\b_\b/,
|
|
2055
|
+
alias: "keyword"
|
|
2056
|
+
},
|
|
2057
|
+
number: /\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f\d_]+(?:\.[a-f\dp_]+)?|0b[01_]+|0o[0-7_]+)\b/i,
|
|
2058
|
+
// A class name must start with an upper-case letter and be either 1 letter long or contain a lower-case letter.
|
|
2059
|
+
"class-name": /\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,
|
|
2060
|
+
function: /\b[a-z_]\w*(?=\s*\()/i,
|
|
2061
|
+
constant: /\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,
|
|
2062
|
+
// Operators are generic in Swift. Developers can even create new operators (e.g. +++).
|
|
2063
|
+
// https://docs.swift.org/swift-book/ReferenceManual/zzSummaryOfTheGrammar.html#ID481
|
|
2064
|
+
// This regex only supports ASCII operators.
|
|
2065
|
+
operator: /[~?%&|^!=<>/*+-]+|\.[.~?%&|^!=<>/*+-]+/,
|
|
2066
|
+
punctuation: /[()[\]{}.,:;\\]/
|
|
2067
|
+
};
|
|
2068
|
+
rn["string-literal"].forEach((e) => {
|
|
2069
|
+
e.inside.interpolation.inside = rn;
|
|
2070
|
+
});
|
|
2071
|
+
E.clike = {
|
|
2072
|
+
comment: re(),
|
|
2073
|
+
string: Nt(),
|
|
2074
|
+
"class-name": {
|
|
2075
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
2076
|
+
lookbehind: !0,
|
|
2077
|
+
inside: {
|
|
2078
|
+
punctuation: /[.\\]/
|
|
2079
|
+
}
|
|
2080
|
+
},
|
|
2081
|
+
keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
2082
|
+
boolean: W,
|
|
2083
|
+
function: /\b\w+(?=\()/,
|
|
2084
|
+
number: Rn,
|
|
2085
|
+
operator: /[!=]==|[!=<>]=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
2086
|
+
punctuation: Ee
|
|
2087
|
+
};
|
|
2088
|
+
var Xe = (e) => `\\b(?:${e})\\b`, Cn = "bool|char|decimal|double|dynamic|float|object|s?byte|string|u?int|u?long|u?short|var|void", Qe = "class|enum|interface|record|struct", Mn = "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", Pn = Xe(Qe), He = RegExp(Xe(Cn + "|" + Qe + "|" + Mn + "|" + Ot)), ma = Xe(Qe + "|" + Mn + "|" + Ot), ha = Xe(Cn + "|" + Qe + "|" + Ot), Ve = _e("<(?:[^<>;=*/%&|^+-]|<self>)*>", 2), Fe = _e("\\((?:[^()]|<self>)*\\)", 2), J = "@?\\b(?!\\d)\\w+\\b", Ze = B("<0>(?:\\s*<1>)?", [J, Ve]), ce = B("(?!<0>)<1>(?:\\s*\\.\\s*<1>)*", [ma, Ze]), Lt = "\\[\\s*(?:,\\s*)*\\]", Ea = B("<0>(?:\\s*(?:\\?\\s*)?<1>)*(?:\\s*\\?)?", [ce, Lt]), _a = B("[^()[\\],;%&|^=<>/*+-]|<0>|<1>|<2>", [Ve, Fe, Lt]), ya = B("\\(<0>+(?:,<0>+)+\\)", [_a]), be = B("(?:<0>|<1>)(?:\\s*(?:\\?\\s*)?<2>)*(?:\\s*\\?)?", [ya, ce, Lt]), j = {
|
|
2089
|
+
keyword: He,
|
|
2090
|
+
punctuation: /[()[\].,:<>?]/
|
|
2091
|
+
}, Dn = `'(?:\\\\.|[^
|
|
2092
|
+
'\\\\]|\\\\[Uux][a-fA-F\\d]{1,8})'`, $n = `"(?:\\\\.|[^\\\\
|
|
2093
|
+
"])*"`, va = '@"(?:""|\\\\[\\s\\S]|[^\\\\"])*"(?!")', ne = E.dotnet = E.cs = E.csharp = ae("clike", {
|
|
2094
|
+
string: [
|
|
2095
|
+
{
|
|
2096
|
+
pattern: O("(^|[^$\\\\])<0>", [va], "g"),
|
|
2097
|
+
lookbehind: !0,
|
|
2098
|
+
greedy: !0
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
pattern: O("(^|[^@$\\\\])<0>", [$n], "g"),
|
|
2102
|
+
lookbehind: !0,
|
|
2103
|
+
greedy: !0
|
|
2104
|
+
}
|
|
2105
|
+
],
|
|
2106
|
+
"class-name": [
|
|
2107
|
+
{
|
|
2108
|
+
// Using static
|
|
2109
|
+
// using static System.Math;
|
|
2110
|
+
pattern: O("(\\busing\\s+static\\s+)<0>(?=\\s*;)", [ce]),
|
|
2111
|
+
lookbehind: !0,
|
|
2112
|
+
inside: j
|
|
2113
|
+
},
|
|
2114
|
+
{
|
|
2115
|
+
// Using alias (type)
|
|
2116
|
+
// using Project = PC.MyCompany.Project;
|
|
2117
|
+
pattern: O("(\\busing\\s+<0>\\s*=\\s*)<1>(?=\\s*;)", [J, be]),
|
|
2118
|
+
lookbehind: !0,
|
|
2119
|
+
inside: j
|
|
2120
|
+
},
|
|
2121
|
+
{
|
|
2122
|
+
// Using alias (alias)
|
|
2123
|
+
// using Project = PC.MyCompany.Project;
|
|
2124
|
+
pattern: O("(\\busing\\s+)<0>(?=\\s*=)", [J]),
|
|
2125
|
+
lookbehind: !0
|
|
2126
|
+
},
|
|
2127
|
+
{
|
|
2128
|
+
// Type declarations
|
|
2129
|
+
// class Foo<A, B>
|
|
2130
|
+
// interface Foo<out A, B>
|
|
2131
|
+
pattern: O("(\\b<0>\\s+)<1>", [Pn, Ze]),
|
|
2132
|
+
lookbehind: !0,
|
|
2133
|
+
inside: j
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
// Single catch exception declaration
|
|
2137
|
+
// catch(Foo)
|
|
2138
|
+
// (things like catch(Foo e) is covered by variable declaration)
|
|
2139
|
+
pattern: O("(\\bcatch\\s*\\(\\s*)<0>", [ce]),
|
|
2140
|
+
lookbehind: !0,
|
|
2141
|
+
inside: j
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
// Name of the type parameter of generic constraints
|
|
2145
|
+
// where Foo : class
|
|
2146
|
+
pattern: O("(\\bwhere\\s+)<0>", [J]),
|
|
2147
|
+
lookbehind: !0
|
|
2148
|
+
},
|
|
2149
|
+
{
|
|
2150
|
+
// Casts and checks via as and is.
|
|
2151
|
+
// as Foo<A>, is Bar<B>
|
|
2152
|
+
// (things like if(a is Foo b) is covered by variable declaration)
|
|
2153
|
+
pattern: O("(\\b(?:is(?:\\s+not)?|as)\\s+)<0>", [Ea]),
|
|
2154
|
+
lookbehind: !0,
|
|
2155
|
+
inside: j
|
|
2156
|
+
},
|
|
2157
|
+
{
|
|
2158
|
+
// Variable, field and parameter declaration
|
|
2159
|
+
// (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
|
|
2160
|
+
pattern: O("\\b<0>(?=\\s+(?!<1>|with\\s*\\{)<2>(?:\\s*[=,:;{)\\]]|\\s+(?:in|when)\\b))", [be, ha, J]),
|
|
2161
|
+
inside: j
|
|
2162
|
+
}
|
|
2163
|
+
],
|
|
2164
|
+
keyword: He,
|
|
2165
|
+
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals
|
|
2166
|
+
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,
|
|
2167
|
+
operator: /[=-]>|([&|+-])\1|~|\?\?=?|>>=?|<<=?|[%&|^!=<>/*+-]=?/,
|
|
2168
|
+
punctuation: /\?\.?|::|[()[\]{}.,:;]/
|
|
2169
|
+
});
|
|
2170
|
+
D(ne, "number", {
|
|
2171
|
+
range: {
|
|
2172
|
+
pattern: /\.\./,
|
|
2173
|
+
alias: "operator"
|
|
2174
|
+
}
|
|
2175
|
+
});
|
|
2176
|
+
D(ne, "punctuation", {
|
|
2177
|
+
"named-parameter": {
|
|
2178
|
+
pattern: O("([(,]\\s*)<0>(?=\\s*:)", [J]),
|
|
2179
|
+
lookbehind: !0,
|
|
2180
|
+
alias: "punctuation"
|
|
2181
|
+
}
|
|
2182
|
+
});
|
|
2183
|
+
D(ne, "class-name", {
|
|
2184
|
+
namespace: {
|
|
2185
|
+
// namespace Foo.Bar {}
|
|
2186
|
+
// using Foo.Bar;
|
|
2187
|
+
pattern: O("(\\b(?:namespace|using)\\s+)<0>(?:\\s*\\.\\s*<0>)*(?=\\s*[;{])", [J]),
|
|
2188
|
+
lookbehind: !0,
|
|
2189
|
+
inside: {
|
|
2190
|
+
punctuation: /\./
|
|
2191
|
+
}
|
|
2192
|
+
},
|
|
2193
|
+
"type-expression": {
|
|
2194
|
+
// default(Foo), typeof(Foo<Bar>), sizeof(int)
|
|
2195
|
+
pattern: O("(\\b(?:default|sizeof|typeof)\\s*\\(\\s*(?!\\s))(?:[^()\\s]|\\s(?!\\s)|<0>)+(?=\\s*\\))", [Fe]),
|
|
2196
|
+
lookbehind: !0,
|
|
2197
|
+
alias: "class-name",
|
|
2198
|
+
inside: j
|
|
2199
|
+
},
|
|
2200
|
+
"return-type": {
|
|
2201
|
+
// Foo<Bar> ForBar(); Foo IFoo.Bar() => 0
|
|
2202
|
+
// int this[int index] => 0; T IReadOnlyList<T>.this[int index] => this[index];
|
|
2203
|
+
// int Foo => 0; int Foo { get; set } = 0;
|
|
2204
|
+
pattern: O("<0>(?=\\s+(?:<1>\\s*(?:=>|[({]|\\.\\s*this\\s*\\[)|this\\s*\\[))", [be, ce]),
|
|
2205
|
+
alias: "class-name",
|
|
2206
|
+
inside: j
|
|
2207
|
+
},
|
|
2208
|
+
"constructor-invocation": {
|
|
2209
|
+
// new List<Foo<Bar[]>> { }
|
|
2210
|
+
pattern: O("(\\bnew\\s+)<0>(?=\\s*[[({])", [be]),
|
|
2211
|
+
lookbehind: !0,
|
|
2212
|
+
alias: "class-name",
|
|
2213
|
+
inside: j
|
|
2214
|
+
},
|
|
2215
|
+
/*'explicit-implementation': {
|
|
2216
|
+
// int IFoo<Foo>.Bar => 0; void IFoo<Foo<Foo>>.Foo<T>();
|
|
2217
|
+
pattern: replace(/\b<0>(?=\.<1>)/, className, methodOrPropertyDeclaration),
|
|
2218
|
+
inside: classNameInside,
|
|
2219
|
+
alias: 'class-name'
|
|
2220
|
+
},*/
|
|
2221
|
+
"generic-method": {
|
|
2222
|
+
// foo<Bar>()
|
|
2223
|
+
pattern: O("<0>\\s*<1>(?=\\s*\\()", [J, Ve]),
|
|
2224
|
+
inside: {
|
|
2225
|
+
function: O("^<0>", [J]),
|
|
2226
|
+
generic: {
|
|
2227
|
+
pattern: RegExp(Ve),
|
|
2228
|
+
alias: "class-name",
|
|
2229
|
+
inside: j
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
},
|
|
2233
|
+
"type-list": {
|
|
2234
|
+
// The list of types inherited or of generic constraints
|
|
2235
|
+
// class Foo<F> : Bar, IList<FooBar>
|
|
2236
|
+
// where F : Bar, IList<int>
|
|
2237
|
+
pattern: O(
|
|
2238
|
+
"\\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|[{;]|=>|$))",
|
|
2239
|
+
[Pn, Ze, J, be, He.source, Fe, "\\bnew\\s*\\(\\s*\\)"]
|
|
2240
|
+
),
|
|
2241
|
+
lookbehind: !0,
|
|
2242
|
+
inside: {
|
|
2243
|
+
"record-arguments": {
|
|
2244
|
+
pattern: O("(^(?!new\\s*\\()<0>\\s*)<1>", [Ze, Fe], "g"),
|
|
2245
|
+
lookbehind: !0,
|
|
2246
|
+
greedy: !0,
|
|
2247
|
+
inside: ne
|
|
2248
|
+
},
|
|
2249
|
+
keyword: He,
|
|
2250
|
+
"class-name": {
|
|
2251
|
+
pattern: RegExp(be, "g"),
|
|
2252
|
+
greedy: !0,
|
|
2253
|
+
inside: j
|
|
2254
|
+
},
|
|
2255
|
+
punctuation: /[(),]/
|
|
2256
|
+
}
|
|
2257
|
+
},
|
|
2258
|
+
preprocessor: {
|
|
2259
|
+
pattern: /(^[ ]*)#.*/m,
|
|
2260
|
+
lookbehind: !0,
|
|
2261
|
+
alias: "property",
|
|
2262
|
+
inside: {
|
|
2263
|
+
// highlight preprocessor directives as keywords
|
|
2264
|
+
directive: {
|
|
2265
|
+
pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
|
|
2266
|
+
lookbehind: !0,
|
|
2267
|
+
alias: "keyword"
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
});
|
|
2272
|
+
var Fn = $n + "|" + Dn, Un = B(`/(?![*/])|//[^
|
|
2273
|
+
]*
|
|
2274
|
+
|/\\*(?:[^*]|\\*(?!/))*\\*/|<0>`, [Fn]), Bn = _e(B(`[^()"'/]|<0>|\\(<self>*\\)`, [Un]), 2), sn = "\\b(?:assembly|event|field|method|module|param|property|return|type)\\b", wa = B("<0>(?:\\s*\\(<1>*\\))?", [ce, Bn]), Ct = `:[^
|
|
2275
|
+
}]+`, Gn = _e(B(`[^()"'/]|<0>|\\(<self>*\\)`, [Un]), 2), on = B("\\{(?!\\{)(?:(?![}:])<0>)*<1>?\\}", [Gn, Ct]), zn = _e(B(`[^()"'/]|/(?!\\*)|/\\*(?:[^*]|\\*(?!/))*\\*/|<0>|\\(<self>*\\)`, [Fn]), 2), ln = B("\\{(?!\\{)(?:(?![}:])<0>)*<1>?\\}", [zn, Ct]), cn = (e, t) => ({
|
|
2276
|
+
interpolation: {
|
|
2277
|
+
pattern: O("((?:^|[^{])(?:\\{\\{)*)<0>", [e]),
|
|
2278
|
+
lookbehind: !0,
|
|
2279
|
+
inside: {
|
|
2280
|
+
"format-string": {
|
|
2281
|
+
pattern: O("(^\\{(?:(?![}:])<0>)*)<1>(?=\\}$)", [t, Ct]),
|
|
2282
|
+
lookbehind: !0,
|
|
2283
|
+
inside: {
|
|
2284
|
+
punctuation: /^:/
|
|
2285
|
+
}
|
|
2286
|
+
},
|
|
2287
|
+
punctuation: /^\{|\}$/,
|
|
2288
|
+
expression: {
|
|
2289
|
+
pattern: /[^]+/,
|
|
2290
|
+
alias: "language-csharp",
|
|
2291
|
+
inside: ne
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
},
|
|
2295
|
+
string: /[^]+/
|
|
2296
|
+
});
|
|
2297
|
+
D(ne, "class-name", {
|
|
2298
|
+
attribute: {
|
|
2299
|
+
// Attributes
|
|
2300
|
+
// [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
|
|
2301
|
+
pattern: O("((?:^|[^\\s\\w>)?])\\s*\\[\\s*)(?:<0>\\s*:\\s*)?<1>(?:\\s*,\\s*<1>)*(?=\\s*\\])", [sn, wa], "g"),
|
|
2302
|
+
lookbehind: !0,
|
|
2303
|
+
greedy: !0,
|
|
2304
|
+
inside: {
|
|
2305
|
+
target: {
|
|
2306
|
+
pattern: O("^<0>(?=\\s*:)", [sn]),
|
|
2307
|
+
alias: "keyword"
|
|
2308
|
+
},
|
|
2309
|
+
"attribute-arguments": {
|
|
2310
|
+
pattern: O("\\(<0>*\\)", [Bn]),
|
|
2311
|
+
inside: ne
|
|
2312
|
+
},
|
|
2313
|
+
"class-name": {
|
|
2314
|
+
pattern: RegExp(ce),
|
|
2315
|
+
inside: {
|
|
2316
|
+
punctuation: /\./
|
|
2317
|
+
}
|
|
2318
|
+
},
|
|
2319
|
+
punctuation: /[,:]/
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
});
|
|
2323
|
+
D(ne, "string", {
|
|
2324
|
+
"interpolation-string": [
|
|
2325
|
+
{
|
|
2326
|
+
pattern: O('(^|[^\\\\])(?:\\$@|@\\$)"(?:""|\\\\[\\s\\S]|\\{\\{|<0>|[^\\\\{"])*"', [on], "g"),
|
|
2327
|
+
lookbehind: !0,
|
|
2328
|
+
greedy: !0,
|
|
2329
|
+
inside: cn(on, Gn)
|
|
2330
|
+
},
|
|
2331
|
+
{
|
|
2332
|
+
pattern: O('(^|[^@\\\\])\\$"(?:\\\\.|\\{\\{|<0>|[^\\\\"{])*"', [ln], "g"),
|
|
2333
|
+
lookbehind: !0,
|
|
2334
|
+
greedy: !0,
|
|
2335
|
+
inside: cn(ln, zn)
|
|
2336
|
+
}
|
|
2337
|
+
],
|
|
2338
|
+
char: {
|
|
2339
|
+
pattern: RegExp(Dn, "g"),
|
|
2340
|
+
greedy: !0
|
|
2341
|
+
}
|
|
2342
|
+
});
|
|
2343
|
+
E.graphql = {
|
|
2344
|
+
comment: /#.*/,
|
|
2345
|
+
description: {
|
|
2346
|
+
pattern: /(?:"""(?:[^"]|"(?!""))*"""|"(?:\\.|[^\\\n"])*")(?=\s*[a-z_])/gi,
|
|
2347
|
+
greedy: !0,
|
|
2348
|
+
alias: "string",
|
|
2349
|
+
inside: {
|
|
2350
|
+
"language-markdown": {
|
|
2351
|
+
pattern: /("(?!")|""")[^]+(?=\1)/,
|
|
2352
|
+
lookbehind: !0,
|
|
2353
|
+
inside: "md"
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
},
|
|
2357
|
+
string: {
|
|
2358
|
+
pattern: /"""[^]*?"""|"(?:\\.|[^\\\n"])*"/g,
|
|
2359
|
+
greedy: !0
|
|
2360
|
+
},
|
|
2361
|
+
number: /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
2362
|
+
boolean: W,
|
|
2363
|
+
variable: /\$[a-z_]\w*/i,
|
|
2364
|
+
directive: {
|
|
2365
|
+
pattern: /@[a-z_]\w*/i,
|
|
2366
|
+
alias: "function"
|
|
2367
|
+
},
|
|
2368
|
+
"attr-name": {
|
|
2369
|
+
pattern: /\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\\n"])*")*\))?:)/gi,
|
|
2370
|
+
greedy: !0
|
|
2371
|
+
},
|
|
2372
|
+
"atom-input": {
|
|
2373
|
+
pattern: /\b[A-Z]\w*Input\b/,
|
|
2374
|
+
alias: "class-name"
|
|
2375
|
+
},
|
|
2376
|
+
scalar: /\b(?:Boolean|Float|ID|Int|String)\b/,
|
|
2377
|
+
constant: /\b[A-Z][A-Z_\d]*\b/,
|
|
2378
|
+
"class-name": {
|
|
2379
|
+
pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,
|
|
2380
|
+
lookbehind: !0
|
|
2381
|
+
},
|
|
2382
|
+
fragment: {
|
|
2383
|
+
pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))(?!\d)\w+/,
|
|
2384
|
+
lookbehind: !0,
|
|
2385
|
+
alias: "function"
|
|
2386
|
+
},
|
|
2387
|
+
"definition-mutation": {
|
|
2388
|
+
pattern: /(\bmutation\s+)(?!\d)\w+/,
|
|
2389
|
+
lookbehind: !0,
|
|
2390
|
+
alias: "function"
|
|
2391
|
+
},
|
|
2392
|
+
"definition-query": {
|
|
2393
|
+
pattern: /(\bquery\s+)(?!\d)\w+/,
|
|
2394
|
+
lookbehind: !0,
|
|
2395
|
+
alias: "function"
|
|
2396
|
+
},
|
|
2397
|
+
keyword: /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
|
|
2398
|
+
operator: /[&|!=]|\.{3}/,
|
|
2399
|
+
"property-query": /\w+(?=\s*\()/,
|
|
2400
|
+
object: /\w+(?=\s*\{)/,
|
|
2401
|
+
punctuation: /[()[\]{},:!=]/,
|
|
2402
|
+
property: /\w+/,
|
|
2403
|
+
[le](e, t) {
|
|
2404
|
+
for (var n = Ye(e, t), s = n.filter(({ type: a }) => a && a != "comment" && a != "scalar"), d = s.length, p = 0, b = (a) => {
|
|
2405
|
+
for (var r = 0; r < a.length; r++)
|
|
2406
|
+
if (p + r == d || s[p + r].type != a[r])
|
|
2407
|
+
return !0;
|
|
2408
|
+
}, m = (a, r) => {
|
|
2409
|
+
for (var u = 1, o = p; o < d; o++) {
|
|
2410
|
+
var i = s[o], f = i.content;
|
|
2411
|
+
if (i.type == "punctuation") {
|
|
2412
|
+
if (a == f)
|
|
2413
|
+
u++;
|
|
2414
|
+
else if (r == f && !--u)
|
|
2415
|
+
return o;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
}; p < d; ) {
|
|
2419
|
+
var _ = s[p++];
|
|
2420
|
+
if (_.type == "keyword" && _.content == "mutation") {
|
|
2421
|
+
var y = [];
|
|
2422
|
+
if (!b(["definition-mutation", "punctuation"]) && s[p + 1].content == "(") {
|
|
2423
|
+
p += 2;
|
|
2424
|
+
var l = m("(", ")");
|
|
2425
|
+
if (!l) continue;
|
|
2426
|
+
for (; p < l; p++) {
|
|
2427
|
+
var c = s[p];
|
|
2428
|
+
c.type == "variable" && (c.alias = "variable-input", y.push(c.content));
|
|
2429
|
+
}
|
|
2430
|
+
p = l + 1;
|
|
2431
|
+
}
|
|
2432
|
+
if (!b(["punctuation", "property-query"]) && s[p].content == "{" && (s[++p].alias = "property-mutation", y[0])) {
|
|
2433
|
+
var w = m("{", "}");
|
|
2434
|
+
if (w) for (var g = p; g < w; g++) {
|
|
2435
|
+
var h = s[g];
|
|
2436
|
+
h.type == "variable" && y.indexOf(h.content) >= 0 && (h.alias = "variable-input");
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
return n;
|
|
2442
|
+
}
|
|
2443
|
+
};
|
|
2444
|
+
E.webmanifest = E.json = {
|
|
2445
|
+
property: {
|
|
2446
|
+
pattern: /"(?:\\.|[^\\\n"])*"(?=\s*:)/g,
|
|
2447
|
+
greedy: !0
|
|
2448
|
+
},
|
|
2449
|
+
string: {
|
|
2450
|
+
pattern: /"(?:\\.|[^\\\n"])*"/g,
|
|
2451
|
+
greedy: !0
|
|
2452
|
+
},
|
|
2453
|
+
comment: re(),
|
|
2454
|
+
number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
2455
|
+
operator: /:/,
|
|
2456
|
+
punctuation: /[[\]{},]/,
|
|
2457
|
+
boolean: W,
|
|
2458
|
+
null: {
|
|
2459
|
+
pattern: /\bnull\b/,
|
|
2460
|
+
alias: "keyword"
|
|
2461
|
+
}
|
|
2462
|
+
};
|
|
2463
|
+
E.makefile = {
|
|
2464
|
+
comment: /#(?:\\[^]|[^\\\n])*/,
|
|
2465
|
+
string: Nt(),
|
|
2466
|
+
"builtin-target": {
|
|
2467
|
+
pattern: /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
|
|
2468
|
+
alias: "builtin"
|
|
2469
|
+
},
|
|
2470
|
+
target: {
|
|
2471
|
+
pattern: /^(?:[^:=\s]|[ ]+(?![\s:]))+(?=\s*:(?!=))/m,
|
|
2472
|
+
alias: "symbol",
|
|
2473
|
+
inside: {
|
|
2474
|
+
variable: /\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/
|
|
2475
|
+
}
|
|
2476
|
+
},
|
|
2477
|
+
variable: /\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
|
|
2478
|
+
// Directives
|
|
2479
|
+
keyword: /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|override|private|s?include|undefine|unexport|vpath)\b/,
|
|
2480
|
+
function: {
|
|
2481
|
+
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)?)(?=[ ])/,
|
|
2482
|
+
lookbehind: !0
|
|
2483
|
+
},
|
|
2484
|
+
operator: /(?:::|[?:+!])?=|[|@]/,
|
|
2485
|
+
punctuation: /[:;(){}]/
|
|
2486
|
+
};
|
|
2487
|
+
var Mt = E.scss = ae("css", {
|
|
2488
|
+
comment: re(),
|
|
2489
|
+
atrule: {
|
|
2490
|
+
pattern: /@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,
|
|
2491
|
+
inside: {
|
|
2492
|
+
rule: /@[\w-]+/,
|
|
2493
|
+
[Y]: "scss"
|
|
2494
|
+
}
|
|
2495
|
+
},
|
|
2496
|
+
// url, compassified
|
|
2497
|
+
url: /(?:[-a-z]+-)?url(?=\()/i,
|
|
2498
|
+
// CSS selector regex is not appropriate for Sass
|
|
2499
|
+
// since there can be lot more things (var, @ directive, nesting..)
|
|
2500
|
+
// a selector must start at the end of a property or after a brace (end of other rules or nesting)
|
|
2501
|
+
// it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
|
|
2502
|
+
// 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
|
|
2503
|
+
// can "pass" as a selector- e.g: proper#{$erty})
|
|
2504
|
+
// this one was hard to do, so please be careful if you edit this one :)
|
|
2505
|
+
selector: {
|
|
2506
|
+
// Initial look-ahead is used to prevent matching of blank selectors
|
|
2507
|
+
pattern: /(?!\s)[^@;(){}]?(?:[^@;(){}\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,
|
|
2508
|
+
inside: {
|
|
2509
|
+
parent: {
|
|
2510
|
+
pattern: /&/,
|
|
2511
|
+
alias: "important"
|
|
2512
|
+
},
|
|
2513
|
+
placeholder: /%[-\w]+/,
|
|
2514
|
+
variable: /\$[-\w]+|#\{\$[-\w]+\}/
|
|
2515
|
+
}
|
|
2516
|
+
},
|
|
2517
|
+
property: {
|
|
2518
|
+
pattern: /(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,
|
|
2519
|
+
inside: {
|
|
2520
|
+
variable: /\$[-\w]+|#\{\$[-\w]+\}/
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
});
|
|
2524
|
+
D(Mt, "atrule", {
|
|
2525
|
+
keyword: [
|
|
2526
|
+
/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,
|
|
2527
|
+
{
|
|
2528
|
+
pattern: /( )(?:from|through)(?= )/,
|
|
2529
|
+
lookbehind: !0
|
|
2530
|
+
}
|
|
2531
|
+
]
|
|
2532
|
+
});
|
|
2533
|
+
D(Mt, "important", {
|
|
2534
|
+
// var and interpolated vars
|
|
2535
|
+
variable: /\$[-\w]+|#\{\$[-\w]+\}/
|
|
2536
|
+
});
|
|
2537
|
+
D(Mt, "function", {
|
|
2538
|
+
"module-modifier": {
|
|
2539
|
+
pattern: /\b(?:as|hide|show|with)\b/i,
|
|
2540
|
+
alias: "keyword"
|
|
2541
|
+
},
|
|
2542
|
+
placeholder: {
|
|
2543
|
+
pattern: /%[-\w]+/,
|
|
2544
|
+
alias: "selector"
|
|
2545
|
+
},
|
|
2546
|
+
statement: {
|
|
2547
|
+
pattern: /\B!(?:default|optional)\b/i,
|
|
2548
|
+
alias: "keyword"
|
|
2549
|
+
},
|
|
2550
|
+
boolean: W,
|
|
2551
|
+
null: {
|
|
2552
|
+
pattern: /\bnull\b/,
|
|
2553
|
+
alias: "keyword"
|
|
2554
|
+
},
|
|
2555
|
+
operator: {
|
|
2556
|
+
pattern: /(\s)(?:[%/*+-]|[!=]=|[<>]=?|and|not|or)(?!\S)/,
|
|
2557
|
+
lookbehind: !0
|
|
2558
|
+
}
|
|
2559
|
+
});
|
|
2560
|
+
var Hn = {
|
|
2561
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/g,
|
|
2562
|
+
lookbehind: !0,
|
|
2563
|
+
greedy: !0
|
|
2564
|
+
}, ye = E.ts = E.typescript = ae("js", {
|
|
2565
|
+
"class-name": Hn
|
|
2566
|
+
});
|
|
2567
|
+
D(ye, "operator", {
|
|
2568
|
+
builtin: /\b(?:Array|Function|Promise|any|boolean|never|number|string|symbol|unknown)\b/
|
|
2569
|
+
});
|
|
2570
|
+
ye.keyword.push(
|
|
2571
|
+
/\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*\*)/
|
|
2572
|
+
);
|
|
2573
|
+
delete ye.parameter;
|
|
2574
|
+
delete ye["literal-property"];
|
|
2575
|
+
var Pt = Hn.inside = Object.assign({}, ye);
|
|
2576
|
+
delete Pt["class-name"];
|
|
2577
|
+
delete Pt["maybe-class-name"];
|
|
2578
|
+
D(ye, "function", {
|
|
2579
|
+
decorator: {
|
|
2580
|
+
pattern: /@[$\w\xa0-\uffff]+/,
|
|
2581
|
+
inside: {
|
|
2582
|
+
at: {
|
|
2583
|
+
pattern: /^@/,
|
|
2584
|
+
alias: "operator"
|
|
2585
|
+
},
|
|
2586
|
+
function: /.+/
|
|
2587
|
+
}
|
|
2588
|
+
},
|
|
2589
|
+
"generic-function": {
|
|
2590
|
+
// e.g. foo<T extends "bar" | "baz">( ...
|
|
2591
|
+
pattern: /#?(?!\d)(?:(?!\s)[$\w\xa0-\uffff])+\s*<(?:[^<>=]|=[^<]|=?<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/g,
|
|
2592
|
+
greedy: !0,
|
|
2593
|
+
inside: {
|
|
2594
|
+
generic: {
|
|
2595
|
+
pattern: /<[^]+/,
|
|
2596
|
+
// everything after the first <
|
|
2597
|
+
alias: "class-name",
|
|
2598
|
+
inside: Pt
|
|
2599
|
+
},
|
|
2600
|
+
function: /\S+/
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
});
|
|
2604
|
+
Ln(E.ts, "tsx");
|
|
2605
|
+
var yt = E.tsx.tag, Vn = "(?:^|(";
|
|
2606
|
+
try {
|
|
2607
|
+
RegExp("(?<=)"), Vn += "?<=";
|
|
2608
|
+
} catch {
|
|
2609
|
+
yt.lookbehind = !0;
|
|
2610
|
+
}
|
|
2611
|
+
yt.pattern = RegExp(Vn + `[^\\w$])|(?=</))${yt.pattern.source}`, "g");
|
|
2612
|
+
var vt = /[*&][^\s[\]{},]+/, wt = /!(?:<[\w%#;/?:@&=$,.!~*'()[\]+-]+>|(?:[a-zA-Z\d-]*!)?[\w%#;/?:@&=$.~*'()+-]+)?/, xt = `(?:${wt.source}(?:[ ]+${vt.source})?|${vt.source}(?:[ ]+${wt.source})?)`, xa = B(
|
|
2613
|
+
"(?:[^\\s\0-\\x08\\x0e-\\x1f!\"#%&'*,:>?@[\\]{}`|\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff-]|[?:-]<0>)(?:[ ]*(?:(?![#:])<0>|:<0>))*",
|
|
2614
|
+
["[^\\s\0-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]"]
|
|
2615
|
+
), dn = `"(?:\\\\.|[^\\\\
|
|
2616
|
+
"])*"|'(?:\\\\.|[^\\\\
|
|
2617
|
+
'])*'`, Ae = (e, t) => O(
|
|
2618
|
+
`([:,[{-]\\s*(?:\\s<0>[ ]+)?)<1>(?=[ ]*(?:$|,|\\]|\\}|(?:
|
|
2619
|
+
\\s*)?#))`,
|
|
2620
|
+
[xt, e],
|
|
2621
|
+
t
|
|
2622
|
+
);
|
|
2623
|
+
E.yml = E.yaml = {
|
|
2624
|
+
scalar: {
|
|
2625
|
+
pattern: O(`([:-]\\s*(?:\\s<0>[ ]+)?[|>])[ ]*(?:(
|
|
2626
|
+
[ ]+)\\S.*(?:\\2.+)*)`, [xt]),
|
|
2627
|
+
lookbehind: !0,
|
|
2628
|
+
alias: "string"
|
|
2629
|
+
},
|
|
2630
|
+
comment: /#.*/,
|
|
2631
|
+
key: {
|
|
2632
|
+
pattern: O(
|
|
2633
|
+
`((?:^|[:,[{
|
|
2634
|
+
?-])[ ]*(?:<0>[ ]+)?)<1>(?=\\s*:\\s)`,
|
|
2635
|
+
[xt, "(?:" + xa + "|" + dn + ")"],
|
|
2636
|
+
"g"
|
|
2637
|
+
),
|
|
2638
|
+
lookbehind: !0,
|
|
2639
|
+
greedy: !0,
|
|
2640
|
+
alias: "atrule"
|
|
2641
|
+
},
|
|
2642
|
+
directive: {
|
|
2643
|
+
pattern: /(^[ ]*)%.+/m,
|
|
2644
|
+
lookbehind: !0,
|
|
2645
|
+
alias: "important"
|
|
2646
|
+
},
|
|
2647
|
+
datetime: {
|
|
2648
|
+
pattern: Ae("\\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"),
|
|
2649
|
+
lookbehind: !0,
|
|
2650
|
+
alias: "number"
|
|
2651
|
+
},
|
|
2652
|
+
boolean: {
|
|
2653
|
+
pattern: Ae("false|true", "im"),
|
|
2654
|
+
lookbehind: !0,
|
|
2655
|
+
alias: "important"
|
|
2656
|
+
},
|
|
2657
|
+
null: {
|
|
2658
|
+
pattern: Ae("null|~", "im"),
|
|
2659
|
+
lookbehind: !0,
|
|
2660
|
+
alias: "important"
|
|
2661
|
+
},
|
|
2662
|
+
string: {
|
|
2663
|
+
pattern: Ae(dn, "mg"),
|
|
2664
|
+
lookbehind: !0,
|
|
2665
|
+
greedy: !0
|
|
2666
|
+
},
|
|
2667
|
+
number: {
|
|
2668
|
+
pattern: Ae("[+-]?(?:0x[a-f\\d]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)", "im"),
|
|
2669
|
+
lookbehind: !0
|
|
2670
|
+
},
|
|
2671
|
+
tag: wt,
|
|
2672
|
+
important: vt,
|
|
2673
|
+
punctuation: /---|[:[\]{},|>?-]|\.{3}/
|
|
2674
|
+
};
|
|
2675
|
+
var un = {
|
|
2676
|
+
pattern: /\\[\\()[\]{}^$+*?|.]/,
|
|
2677
|
+
alias: "escape"
|
|
2678
|
+
}, Ue = /\\(?: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]|.)/, Aa = {
|
|
2679
|
+
pattern: /\.|\\[wsd]|\\p\{[^{}]+\}/i,
|
|
2680
|
+
alias: "class-name"
|
|
2681
|
+
}, Ia = {
|
|
2682
|
+
pattern: /\\[wsd]|\\p\{[^{}]+\}/i,
|
|
2683
|
+
alias: "class-name"
|
|
2684
|
+
}, pn = "(?:[^\\\\-]|" + Ue.source + ")", Ra = RegExp(pn + "-" + pn), fn = {
|
|
2685
|
+
pattern: /(<|')[^<>']+(?=[>']$)/,
|
|
2686
|
+
lookbehind: !0,
|
|
2687
|
+
alias: "variable"
|
|
2688
|
+
};
|
|
2689
|
+
E.regex = {
|
|
2690
|
+
"char-class": {
|
|
2691
|
+
pattern: /((?:^|[^\\])(?:\\\\)*)\[(?:\\[^]|[^\\\]])*\]/,
|
|
2692
|
+
lookbehind: !0,
|
|
2693
|
+
inside: {
|
|
2694
|
+
"char-class-punctuation": {
|
|
2695
|
+
pattern: /^.|.$/g,
|
|
2696
|
+
greedy: !0,
|
|
2697
|
+
alias: "punctuation"
|
|
2698
|
+
},
|
|
2699
|
+
"char-class-negation": {
|
|
2700
|
+
pattern: /^\^/,
|
|
2701
|
+
alias: "operator"
|
|
2702
|
+
},
|
|
2703
|
+
range: {
|
|
2704
|
+
pattern: Ra,
|
|
2705
|
+
inside: {
|
|
2706
|
+
escape: Ue,
|
|
2707
|
+
"range-punctuation": {
|
|
2708
|
+
pattern: /-/,
|
|
2709
|
+
alias: "operator"
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
},
|
|
2713
|
+
"special-escape": un,
|
|
2714
|
+
"char-set": Ia,
|
|
2715
|
+
escape: Ue
|
|
2716
|
+
}
|
|
2717
|
+
},
|
|
2718
|
+
"special-escape": un,
|
|
2719
|
+
"char-set": Aa,
|
|
2720
|
+
backreference: [
|
|
2721
|
+
{
|
|
2722
|
+
// a backreference which is not an octal escape
|
|
2723
|
+
pattern: /\\(?![123][0-7]{2})[1-9]/,
|
|
2724
|
+
alias: "keyword"
|
|
2725
|
+
},
|
|
2726
|
+
{
|
|
2727
|
+
pattern: /\\k<[^<>']+>/,
|
|
2728
|
+
alias: "keyword",
|
|
2729
|
+
inside: {
|
|
2730
|
+
"group-name": fn
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
],
|
|
2734
|
+
anchor: {
|
|
2735
|
+
pattern: /[$^]|\\[ABbGZz]/,
|
|
2736
|
+
alias: "function"
|
|
2737
|
+
},
|
|
2738
|
+
escape: Ue,
|
|
2739
|
+
group: [
|
|
2740
|
+
{
|
|
2741
|
+
// https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html
|
|
2742
|
+
// https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference?view=netframework-4.7.2#grouping-constructs
|
|
2743
|
+
// (), (?<name>), (?'name'), (?>), (?:), (?=), (?!), (?<=), (?<!), (?is-m), (?i-m:)
|
|
2744
|
+
pattern: /(\()\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[!=]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?)/,
|
|
2745
|
+
lookbehind: !0,
|
|
2746
|
+
inside: {
|
|
2747
|
+
"group-name": fn
|
|
2748
|
+
}
|
|
2749
|
+
},
|
|
2750
|
+
{
|
|
2751
|
+
pattern: /[()]/,
|
|
2752
|
+
alias: "punctuation"
|
|
2753
|
+
}
|
|
2754
|
+
],
|
|
2755
|
+
quantifier: {
|
|
2756
|
+
pattern: /(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,
|
|
2757
|
+
alias: "number"
|
|
2758
|
+
},
|
|
2759
|
+
alternation: {
|
|
2760
|
+
pattern: /\|/,
|
|
2761
|
+
alias: "keyword"
|
|
2762
|
+
}
|
|
2763
|
+
};
|
|
2764
|
+
const Sa = (e, t, ...n) => {
|
|
2765
|
+
var X;
|
|
2766
|
+
let s, d, p = [], b, m = "", _, y = !1, l = !1, c = !0, w = [], g, h = 0;
|
|
2767
|
+
const a = Na(), r = a.firstChild, u = r.children, o = u[0], i = o.firstChild, f = { language: "text", value: m }, R = new Set(n), A = {}, v = (x) => {
|
|
2768
|
+
if (Object.assign(f, x), m = x.value ?? m, s = f.language, !E[s]) throw Error(`Language '${s}' has no grammar.`);
|
|
2769
|
+
g = !!f.readOnly, a.style.tabSize = f.tabSize || 2, i.inputMode = g ? "none" : "", i.setAttribute("aria-readonly", g), N(), k(), (d != (d = E[s]) || m != i.value) && (Z(), i.value = m, i.selectionEnd = 0, S());
|
|
2770
|
+
}, S = () => {
|
|
2771
|
+
w = St(m = i.value, d), H("tokenize", w, s, m);
|
|
2772
|
+
let x = vn(w).split(`
|
|
2773
|
+
`), I = 0, C = h, K = h = x.length;
|
|
2774
|
+
for (; x[I] == p[I] && I < K; ) ++I;
|
|
2775
|
+
for (; K && x[--K] == p[--C]; ) ;
|
|
2776
|
+
if (I == K && I == C) u[I + 1].innerHTML = x[I] + `
|
|
2777
|
+
`;
|
|
2778
|
+
else {
|
|
2779
|
+
let Q = C < I ? C : I - 1, q = Q, ve = "";
|
|
2780
|
+
for (; q < K; ) ve += `<div class=pce-line aria-hidden=true>${x[++q]}
|
|
2781
|
+
</div>`;
|
|
2782
|
+
for (q = K < I ? K : I - 1; q < C; q++) u[I + 1].remove();
|
|
2783
|
+
for (ve && u[Q + 1].insertAdjacentHTML("afterend", ve), q = Q + 1; q < h; ) u[++q].setAttribute("data-line", q);
|
|
2784
|
+
a.style.setProperty(
|
|
2785
|
+
"--number-width",
|
|
2786
|
+
Math.ceil(Math.log10(h + 1)) + ".001ch"
|
|
2787
|
+
);
|
|
2788
|
+
}
|
|
2789
|
+
H("update", m), U(!0), c && setTimeout(setTimeout, 0, () => c = !0), p = x, c = !1;
|
|
2790
|
+
}, k = (x) => {
|
|
2791
|
+
(x || R).forEach((I) => {
|
|
2792
|
+
typeof I == "object" ? (I.update($, f), x && R.add(I)) : (I($, f), x || R.delete(I));
|
|
2793
|
+
});
|
|
2794
|
+
}, N = ([x, I] = L()) => {
|
|
2795
|
+
a.className = `prism-code-editor language-${s}${f.lineNumbers == !1 ? "" : " show-line-numbers"} pce-${f.wordWrap ? "" : "no"}wrap${f.rtl ? " pce-rtl" : ""} pce-${x < I ? "has" : "no"}-selection${l ? " pce-focus" : ""}${g ? " pce-readonly" : ""}`;
|
|
2796
|
+
}, L = () => [
|
|
2797
|
+
i.selectionStart,
|
|
2798
|
+
i.selectionEnd,
|
|
2799
|
+
i.selectionDirection
|
|
2800
|
+
], P = {
|
|
2801
|
+
Escape() {
|
|
2802
|
+
i.blur();
|
|
2803
|
+
}
|
|
2804
|
+
}, M = {}, Z = () => Be && !l && z(
|
|
2805
|
+
$,
|
|
2806
|
+
"focus",
|
|
2807
|
+
(x) => {
|
|
2808
|
+
let I = x.relatedTarget;
|
|
2809
|
+
I ? I.focus() : i.blur();
|
|
2810
|
+
},
|
|
2811
|
+
{ once: !0 }
|
|
2812
|
+
), H = (x, ...I) => {
|
|
2813
|
+
var C, K;
|
|
2814
|
+
(C = A[x]) == null || C.forEach((Q) => Q.apply($, I)), (K = f["on" + x[0].toUpperCase() + x.slice(1)]) == null || K.apply($, I);
|
|
2815
|
+
}, U = (x) => {
|
|
2816
|
+
if (x || c) {
|
|
2817
|
+
const I = L(), C = u[_ = Kn(m, 0, I[I[2] < "f" ? 0 : 1])];
|
|
2818
|
+
C != b && (b == null || b.classList.remove("active-line"), C.classList.add("active-line"), b = C), N(I), H("selectionChange", I, m);
|
|
2819
|
+
}
|
|
2820
|
+
}, $ = {
|
|
2821
|
+
scrollContainer: a,
|
|
2822
|
+
wrapper: r,
|
|
2823
|
+
overlays: o,
|
|
2824
|
+
textarea: i,
|
|
2825
|
+
get activeLine() {
|
|
2826
|
+
return b;
|
|
2827
|
+
},
|
|
2828
|
+
get activeLineNumber() {
|
|
2829
|
+
return _;
|
|
2830
|
+
},
|
|
2831
|
+
get value() {
|
|
2832
|
+
return m;
|
|
2833
|
+
},
|
|
2834
|
+
options: f,
|
|
2835
|
+
get focused() {
|
|
2836
|
+
return l;
|
|
2837
|
+
},
|
|
2838
|
+
get removed() {
|
|
2839
|
+
return y;
|
|
2840
|
+
},
|
|
2841
|
+
get tokens() {
|
|
2842
|
+
return w;
|
|
2843
|
+
},
|
|
2844
|
+
inputCommandMap: M,
|
|
2845
|
+
keyCommandMap: P,
|
|
2846
|
+
extensions: {},
|
|
2847
|
+
setOptions: v,
|
|
2848
|
+
update: S,
|
|
2849
|
+
getSelection: L,
|
|
2850
|
+
setSelection(x, I = x, C) {
|
|
2851
|
+
Z(), i.setSelectionRange(x, I, C), U(!0);
|
|
2852
|
+
},
|
|
2853
|
+
addExtensions(...x) {
|
|
2854
|
+
k(x);
|
|
2855
|
+
},
|
|
2856
|
+
addListener(x, I) {
|
|
2857
|
+
(A[x] || (A[x] = /* @__PURE__ */ new Set())).add(I);
|
|
2858
|
+
},
|
|
2859
|
+
removeListener(x, I) {
|
|
2860
|
+
var C;
|
|
2861
|
+
(C = A[x]) == null || C.delete(I);
|
|
2862
|
+
},
|
|
2863
|
+
remove() {
|
|
2864
|
+
a.remove(), y = !0;
|
|
2865
|
+
}
|
|
2866
|
+
};
|
|
2867
|
+
return z($, "keydown", (x) => {
|
|
2868
|
+
var I;
|
|
2869
|
+
(I = P[x.key]) != null && I.call(P, x, L(), m) && G(x);
|
|
2870
|
+
}), z($, "beforeinput", (x) => {
|
|
2871
|
+
var I;
|
|
2872
|
+
(g || x.inputType == "insertText" && ((I = M[x.data]) != null && I.call(M, x, L(), m))) && G(x);
|
|
2873
|
+
}), z($, "input", S), z($, "blur", () => {
|
|
2874
|
+
Te = null, l = !1, N();
|
|
2875
|
+
}), z($, "focus", () => {
|
|
2876
|
+
Te = U, l = !0, N();
|
|
2877
|
+
}), z($, "selectionchange", (x) => {
|
|
2878
|
+
U(), G(x);
|
|
2879
|
+
}), (X = Ta(e)) == null || X.append(a), t && v(t), $;
|
|
2880
|
+
}, bn = /* @__PURE__ */ document.createElement("div"), Je = (e) => {
|
|
2881
|
+
bn.innerHTML = e;
|
|
2882
|
+
const t = bn.firstChild;
|
|
2883
|
+
return () => t.cloneNode(!0);
|
|
2884
|
+
}, z = (e, t, n, s) => e.textarea.addEventListener(t, n, s), Ta = (e) => typeof e == "string" ? document.querySelector(e) : e, Zn = navigator.userAgent, Ke = /Mac|iPhone|iPod|iPad/i.test(navigator.platform), We = /Chrome\//.test(Zn), Be = !We && /AppleWebKit\//.test(Zn), Kn = (e, t = 0, n = 1 / 0) => {
|
|
2885
|
+
let s = 1;
|
|
2886
|
+
for (; (t = e.indexOf(`
|
|
2887
|
+
`, t) + 1) && t <= n; s++) ;
|
|
2888
|
+
return s;
|
|
2889
|
+
}, ot = {}, Na = /* @__PURE__ */ Je(
|
|
2890
|
+
"<div><div class=pce-wrapper><div class=pce-overlays><textarea spellcheck=false autocapitalize=off autocomplete=off>"
|
|
2891
|
+
), G = (e) => {
|
|
2892
|
+
e.preventDefault(), e.stopImmediatePropagation();
|
|
2893
|
+
};
|
|
2894
|
+
let Te;
|
|
2895
|
+
document.addEventListener("selectionchange", () => Te == null ? void 0 : Te());
|
|
2896
|
+
const ka = (e, t, n = 0) => {
|
|
2897
|
+
const s = e.scrollContainer.style, d = document.documentElement.style;
|
|
2898
|
+
s.scrollPaddingBlock = d.scrollPaddingBlock = `${n}px ${We && !t.textContent ? t.offsetHeight : 0}px`, t.scrollIntoView({ block: "nearest" }), s.scrollPaddingBlock = d.scrollPaddingBlock = "";
|
|
2899
|
+
}, qe = (e, t) => t ? e.lastIndexOf(`
|
|
2900
|
+
`, t - 1) + 1 : 0, et = (e, t) => (t = e.indexOf(`
|
|
2901
|
+
`, t)) + 1 ? t : e.length, Oa = (e, t, n) => (e.addListener(t, n), () => e.removeListener(t, n)), La = (e, t) => parseFloat(getComputedStyle(e)[t]);
|
|
2902
|
+
let ge;
|
|
2903
|
+
const Ie = (e) => e.replace(/[$+?|.^*()[\]{}\\]/g, "\\$&"), At = (e, t) => e.slice(qe(e, t), t), ee = (e, t, n = t) => [
|
|
2904
|
+
e.slice(t = qe(e, t), n = et(e, n)).split(`
|
|
2905
|
+
`),
|
|
2906
|
+
t,
|
|
2907
|
+
n
|
|
2908
|
+
], je = (e, t, n = 0, s = n, d = e.getSelection()[0]) => {
|
|
2909
|
+
var l;
|
|
2910
|
+
const p = e.value, b = e.wrapper.children[Kn(p, 0, d)], m = document.createTreeWalker(b, 5);
|
|
2911
|
+
let _ = m.lastChild(), y = et(p, d) + 1 - d - _.length;
|
|
2912
|
+
for (; -y <= s && (_ = m.previousNode()); )
|
|
2913
|
+
if (!_.lastChild && (y -= _.length || 0, y <= n)) {
|
|
2914
|
+
for (; _ != b; _ = _.parentNode)
|
|
2915
|
+
if ((l = _.matches) != null && l.call(_, t)) return _;
|
|
2916
|
+
}
|
|
2917
|
+
}, lt = (e, t) => {
|
|
2918
|
+
var n;
|
|
2919
|
+
return ((n = je(e, '[class*="language-"]', 0, 0, t)) == null ? void 0 : n.className.match(
|
|
2920
|
+
/language-(\S*)/
|
|
2921
|
+
)[1]) || e.options.language;
|
|
2922
|
+
}, V = (e, t, n, s, d, p) => {
|
|
2923
|
+
if (e.options.readOnly) return;
|
|
2924
|
+
ge = e.getSelection(), s ?? (s = n);
|
|
2925
|
+
let b = e.textarea, m = e.value, _ = We && !m[s ?? ge[1]] && /\n$/.test(t) && /^$|\n$/.test(m), y;
|
|
2926
|
+
e.focused || b.focus(), n != null && b.setSelectionRange(n, s), d != null && (y = Oa(e, "update", () => {
|
|
2927
|
+
b.setSelectionRange(
|
|
2928
|
+
d,
|
|
2929
|
+
p ?? d,
|
|
2930
|
+
ge[2]
|
|
2931
|
+
), y();
|
|
2932
|
+
})), Be || b.dispatchEvent(new InputEvent("beforeinput", { data: t })), We || Be ? (_ && (b.selectionEnd--, t = t.slice(0, -1)), Be && (t += `
|
|
2933
|
+
`), document.execCommand(
|
|
2934
|
+
t ? "insertHTML" : "delete",
|
|
2935
|
+
!1,
|
|
2936
|
+
t.replace(/&/g, "&").replace(/</g, "<")
|
|
2937
|
+
), _ && b.selectionStart++) : document.execCommand(t ? "insertText" : "delete", !1, t), ge = 0;
|
|
2938
|
+
}, Se = (e) => e.altKey + e.ctrlKey * 2 + e.metaKey * 4 + e.shiftKey * 8;
|
|
2939
|
+
let It = !1;
|
|
2940
|
+
const gn = navigator.clipboard, oe = Ke ? 4 : 2, Ca = (e) => It = e, se = (e) => e.search(/\S|$/), Ma = (e = ['""', "''", "``", "()", "[]", "{}"], t = /([^$\w'"`]["'`]|.[[({])[.,:;\])}>\s]|.[[({]`/s) => (n, s) => {
|
|
2941
|
+
let d;
|
|
2942
|
+
const { keyCommandMap: p, inputCommandMap: b, getSelection: m, scrollContainer: _ } = n, y = ({ insertSpaces: a = !0, tabSize: r } = s) => [a ? " " : " ", a ? r || 2 : 1], l = () => {
|
|
2943
|
+
var a;
|
|
2944
|
+
return !s.readOnly && !((a = n.extensions.cursor) != null && a.scrollIntoView());
|
|
2945
|
+
}, c = ([a, r], [u, o], i, f) => (a < r || !f && t.test((i[r - 1] || " ") + u + (i[r] || " "))) && !V(n, u + i.slice(a, r) + o, null, null, a + 1, r + 1), w = ([a, r], u, o) => a == r && o[r] == u && !n.setSelection(a + 1), g = (a, r, u, o, i, f) => {
|
|
2946
|
+
let R = r.join(`
|
|
2947
|
+
`);
|
|
2948
|
+
if (R != a.join(`
|
|
2949
|
+
`)) {
|
|
2950
|
+
const A = a.length - 1, v = r[A], S = a[A], k = S.length - v.length, N = r[0].length - a[0].length, L = u + se((N < 0 ? r : a)[0]), P = o - S.length + se(k > 0 ? v : S), M = u - o + R.length + k, Z = L > i ? i : Math.max(L, i + N), H = f + u - o + R.length;
|
|
2951
|
+
V(
|
|
2952
|
+
n,
|
|
2953
|
+
R,
|
|
2954
|
+
u,
|
|
2955
|
+
o,
|
|
2956
|
+
Z,
|
|
2957
|
+
f < P ? H + k : Math.max(P + M, H)
|
|
2958
|
+
);
|
|
2959
|
+
}
|
|
2960
|
+
}, h = (a, r, u, o, i, f, R, A) => {
|
|
2961
|
+
g(
|
|
2962
|
+
r,
|
|
2963
|
+
r.map(
|
|
2964
|
+
a ? (v) => v.slice(se(v) ? A - se(v) % A : 0) : (v) => v && R.repeat(A - se(v) % A) + v
|
|
2965
|
+
),
|
|
2966
|
+
u,
|
|
2967
|
+
o,
|
|
2968
|
+
i,
|
|
2969
|
+
f
|
|
2970
|
+
);
|
|
2971
|
+
};
|
|
2972
|
+
b["<"] = (a, r, u) => c(r, "<>", u, !0), e.forEach(([a, r]) => {
|
|
2973
|
+
const u = a == r;
|
|
2974
|
+
b[a] = (o, i, f) => (u && w(i, r, f) || c(i, a + r, f)) && l(), u || (b[r] = (o, i, f) => w(i, r, f) && l());
|
|
2975
|
+
}), b[">"] = (a, r, u) => {
|
|
2976
|
+
var i, f;
|
|
2977
|
+
const o = (f = (i = ot[lt(n)]) == null ? void 0 : i.autoCloseTags) == null ? void 0 : f.call(i, r, u, n);
|
|
2978
|
+
o && (V(n, ">" + o, null, null, r[0] + 1), G(a));
|
|
2979
|
+
}, p.Tab = (a, [r, u], o) => {
|
|
2980
|
+
if (It || s.readOnly || Se(a) & 6) return;
|
|
2981
|
+
const [i, f] = y(s), R = a.shiftKey, [A, v, S] = ee(o, r, u);
|
|
2982
|
+
return r < u || R ? h(R, A, v, S, r, u, i, f) : V(n, i.repeat(f - (r - v) % f)), l();
|
|
2983
|
+
}, p.Enter = (a, r, u) => {
|
|
2984
|
+
var i, f, R;
|
|
2985
|
+
const o = Se(a) & 7;
|
|
2986
|
+
if (!o || o == oe) {
|
|
2987
|
+
o && (r[0] = r[1] = ee(u, r[1])[2]);
|
|
2988
|
+
const [A, v] = y(), [S, k] = r, N = (i = ot[lt(n)]) == null ? void 0 : i.autoIndent, L = Math.floor(se(At(u, S)) / v) * v, P = (f = N == null ? void 0 : N[0]) != null && f.call(N, r, u, n) ? v : 0, M = (R = N == null ? void 0 : N[1]) == null ? void 0 : R.call(N, r, u, n), Z = `
|
|
2989
|
+
` + A.repeat(L + P) + (M ? `
|
|
2990
|
+
` + A.repeat(L) : "");
|
|
2991
|
+
if (Z[1] || u[k])
|
|
2992
|
+
return V(n, Z, S, k, S + L + P + 1), l();
|
|
2993
|
+
}
|
|
2994
|
+
}, p.Backspace = (a, [r, u], o) => {
|
|
2995
|
+
if (r == u) {
|
|
2996
|
+
const i = At(o, r), f = s.tabSize || 2, R = e.includes(o.slice(r - 1, r + 1)), A = /[^ ]/.test(i) ? 0 : (i.length - 1) % f + 1;
|
|
2997
|
+
if (R || A > 1)
|
|
2998
|
+
return V(n, "", r - (R ? 1 : A), r + R), l();
|
|
2999
|
+
}
|
|
3000
|
+
};
|
|
3001
|
+
for (let a = 0; a < 2; a++)
|
|
3002
|
+
p[a ? "ArrowDown" : "ArrowUp"] = (r, [u, o], i) => {
|
|
3003
|
+
const f = Se(r);
|
|
3004
|
+
if (f == 1) {
|
|
3005
|
+
const R = a ? u : qe(i, u) - 1, A = a ? i.indexOf(`
|
|
3006
|
+
`, o) + 1 : o;
|
|
3007
|
+
if (R > -1 && A > 0) {
|
|
3008
|
+
const [v, S, k] = ee(i, R, A), N = v[a ? "pop" : "shift"](), L = (N.length + 1) * (a ? 1 : -1);
|
|
3009
|
+
v[a ? "unshift" : "push"](N), V(n, v.join(`
|
|
3010
|
+
`), S, k, u + L, o + L);
|
|
3011
|
+
}
|
|
3012
|
+
return l();
|
|
3013
|
+
} else if (f == 9) {
|
|
3014
|
+
const [R, A, v] = ee(i, u, o), S = R.join(`
|
|
3015
|
+
`), k = a ? S.length + 1 : 0;
|
|
3016
|
+
return V(n, S + `
|
|
3017
|
+
` + S, A, v, u + k, o + k), l();
|
|
3018
|
+
} else if (f == 2 && !Ke)
|
|
3019
|
+
return _.scrollBy(0, La(_, "lineHeight") * (a ? 1 : -1)), !0;
|
|
3020
|
+
};
|
|
3021
|
+
z(n, "keydown", (a) => {
|
|
3022
|
+
var R;
|
|
3023
|
+
const r = Se(a), u = a.keyCode, [o, i, f] = m();
|
|
3024
|
+
if (r == oe && (u == 221 || u == 219))
|
|
3025
|
+
h(u == 219, ...ee(n.value, o, i), o, i, ...y()), l(), G(a);
|
|
3026
|
+
else if (r == (Ke ? 10 : 2) && u == 77)
|
|
3027
|
+
Ca(!It), G(a);
|
|
3028
|
+
else if (u == 191 && r == oe || u == 65 && r == 9) {
|
|
3029
|
+
const A = n.value, v = r == 9, S = v ? o : qe(A, o), k = ot[lt(n, S)] || {}, { line: N, block: L } = ((R = k.getComments) == null ? void 0 : R.call(k, n, S, A)) || k.comments || {}, [P, M, Z] = ee(A, o, i), H = P.length - 1;
|
|
3030
|
+
if (v) {
|
|
3031
|
+
if (L) {
|
|
3032
|
+
const [U, $] = L, X = A.slice(o, i), x = A.slice(0, o).search(Ie(U) + " ?$"), I = RegExp("^ ?" + Ie($)).test(A.slice(i));
|
|
3033
|
+
x + 1 && I ? V(
|
|
3034
|
+
n,
|
|
3035
|
+
X,
|
|
3036
|
+
x,
|
|
3037
|
+
i + +(A[i] == " ") + $.length,
|
|
3038
|
+
x,
|
|
3039
|
+
x + i - o
|
|
3040
|
+
) : V(
|
|
3041
|
+
n,
|
|
3042
|
+
`${U} ${X} ${$}`,
|
|
3043
|
+
o,
|
|
3044
|
+
i,
|
|
3045
|
+
o + U.length + 1,
|
|
3046
|
+
i + U.length + 1
|
|
3047
|
+
), l(), G(a);
|
|
3048
|
+
}
|
|
3049
|
+
} else if (N) {
|
|
3050
|
+
const U = Ie(N), $ = RegExp(`^\\s*(${U} ?|$)`), X = RegExp(U + " ?"), x = !/\S/.test(A.slice(M, Z)), I = P.map(
|
|
3051
|
+
P.every((C) => $.test(C)) && !x ? (C) => C.replace(X, "") : (C) => x || /\S/.test(C) ? C.replace(/^\s*/, `$&${N} `) : C
|
|
3052
|
+
);
|
|
3053
|
+
g(P, I, M, Z, o, i), l(), G(a);
|
|
3054
|
+
} else if (L) {
|
|
3055
|
+
const [U, $] = L, X = se(P[0]), x = P[0].startsWith(U, X) && P[H].endsWith($), I = P.slice();
|
|
3056
|
+
I[0] = P[0].replace(
|
|
3057
|
+
x ? RegExp(Ie(U) + " ?") : /(?=\S)|$/,
|
|
3058
|
+
x ? "" : U + " "
|
|
3059
|
+
);
|
|
3060
|
+
let C = I[0].length - P[0].length;
|
|
3061
|
+
I[H] = x ? I[H].replace(RegExp(`( ?${Ie($)})?$`), "") : I[H] + " " + $;
|
|
3062
|
+
let K = I.join(`
|
|
3063
|
+
`), Q = X + M, q = Q > o ? o : Math.max(o + C, Q), ve = Q > i - (o != i) ? i : Math.min(Math.max(Q, i + C), M + K.length);
|
|
3064
|
+
V(n, K, M, Z, q, Math.max(q, ve)), l(), G(a);
|
|
3065
|
+
}
|
|
3066
|
+
} else if (r == 8 + oe && u == 75) {
|
|
3067
|
+
const A = n.value, [v, S, k] = ee(A, o, i), N = f > "f" ? i - k + v.pop().length : o - S, L = et(A, k + 1) - k - 1;
|
|
3068
|
+
V(
|
|
3069
|
+
n,
|
|
3070
|
+
"",
|
|
3071
|
+
S - !!S,
|
|
3072
|
+
k + !S,
|
|
3073
|
+
S + Math.min(N, L)
|
|
3074
|
+
), l(), G(a);
|
|
3075
|
+
}
|
|
3076
|
+
}), ["copy", "cut", "paste"].forEach(
|
|
3077
|
+
(a) => z(n, a, (r) => {
|
|
3078
|
+
const [u, o] = m();
|
|
3079
|
+
if (u == o && gn) {
|
|
3080
|
+
const [[i], f, R] = ee(n.value, u, o);
|
|
3081
|
+
a == "paste" ? r.clipboardData.getData("text/plain") == d && (V(n, d + `
|
|
3082
|
+
`, f, f, u + d.length + 1), l(), G(r)) : (gn.writeText(d = i), a == "cut" && (V(n, "", f, R + 1), l()), G(r));
|
|
3083
|
+
}
|
|
3084
|
+
})
|
|
3085
|
+
);
|
|
3086
|
+
}, Pa = (e = 999) => {
|
|
3087
|
+
let t = 0, n, s, d = !1, p, b, m, _, y, l;
|
|
3088
|
+
const c = [], w = (a) => {
|
|
3089
|
+
a >= e && (a--, c.shift()), c.splice(t = a, e, [n.value, l(), l()]);
|
|
3090
|
+
}, g = (a) => {
|
|
3091
|
+
var r;
|
|
3092
|
+
c[a] && (y.value = c[a][0], y.setSelectionRange(...c[a][a < t ? 2 : 1]), n.update(), (r = n.extensions.cursor) == null || r.scrollIntoView(), t = a, s = !1);
|
|
3093
|
+
}, h = (a, r) => {
|
|
3094
|
+
a.extensions.history = h, n = a, l = a.getSelection, y || w(0), y = a.textarea, a.addListener("selectionChange", () => {
|
|
3095
|
+
s = d, d = !1;
|
|
3096
|
+
}), z(a, "beforeinput", (u) => {
|
|
3097
|
+
let o = u.data, i = u.inputType, f = u.timeStamp;
|
|
3098
|
+
/history/.test(i) ? (g(t + (i[7] == "U" ? -1 : 1)), G(u)) : (_ = s && (p == i || f - m < 99 && i.slice(-4) == "Drop") && !ge && (o != " " || b == o)) || (c[t][2] = ge || l()), d = !0, b = o, m = f, p = i;
|
|
3099
|
+
}), z(a, "input", () => w(t + !_)), z(a, "keydown", (u) => {
|
|
3100
|
+
if (!r.readOnly) {
|
|
3101
|
+
const o = Se(u), i = u.keyCode, f = o == oe && i == 90, R = o == oe + 8 && i == 90 || !Ke && o == oe && i == 89;
|
|
3102
|
+
f ? (g(t - 1), G(u)) : R && (g(t + 1), G(u));
|
|
3103
|
+
}
|
|
3104
|
+
});
|
|
3105
|
+
};
|
|
3106
|
+
return h.clear = () => {
|
|
3107
|
+
w(0), s = !1;
|
|
3108
|
+
}, h.has = (a) => t + a in c, h.go = (a) => g(t + a), h;
|
|
3109
|
+
}, Da = Je(
|
|
3110
|
+
"<div style=position:absolute;top:0;opacity:0;padding:inherit> <span><span></span> "
|
|
3111
|
+
), $a = () => {
|
|
3112
|
+
let e, t = " ", n = " ";
|
|
3113
|
+
const s = Da(), [d, p] = s.childNodes, [b, m] = p.childNodes, _ = (c) => {
|
|
3114
|
+
let { value: w, activeLine: g } = e, h = c[c[2] < "f" ? 0 : 1], a = At(w, h), r = w.slice(h, et(w, h));
|
|
3115
|
+
!a && !r && (r = " "), t != a && (d.data = t = a), n != r && (m.data = n = r), s.parentNode != g && g.prepend(s);
|
|
3116
|
+
}, y = () => ka(e, b), l = (c) => {
|
|
3117
|
+
c.addListener("selectionChange", _), e = c, c.extensions.cursor = l, z(c, "input", (w) => {
|
|
3118
|
+
/history/.test(w.inputType) && y();
|
|
3119
|
+
}), c.activeLine && _(c.getSelection());
|
|
3120
|
+
};
|
|
3121
|
+
return l.getPosition = () => {
|
|
3122
|
+
const c = b.getBoundingClientRect(), w = e.overlays.getBoundingClientRect();
|
|
3123
|
+
return {
|
|
3124
|
+
top: c.y - w.y,
|
|
3125
|
+
bottom: w.bottom - c.bottom,
|
|
3126
|
+
left: c.x - w.x,
|
|
3127
|
+
right: w.right - c.x,
|
|
3128
|
+
height: c.height
|
|
3129
|
+
};
|
|
3130
|
+
}, l.scrollIntoView = y, l.element = b, l;
|
|
3131
|
+
}, Fa = Je(
|
|
3132
|
+
"<div class=guide-indents style=left:var(--padding-left);bottom:auto;right:auto> "
|
|
3133
|
+
), Ua = Je(
|
|
3134
|
+
"<div style=width:1px;position:absolute;background:var(--bg-guide-indent)>"
|
|
3135
|
+
), Ba = () => {
|
|
3136
|
+
let e, t = 0, n, s = -1, d;
|
|
3137
|
+
const p = [], b = [], m = Fa(), _ = [], y = (g) => {
|
|
3138
|
+
n = [];
|
|
3139
|
+
const h = c(g.split(`
|
|
3140
|
+
`)), a = h.length;
|
|
3141
|
+
for (let r = 0, u = [], o = h[0]; o; r++) {
|
|
3142
|
+
const i = (p[r] || (p[r] = Ua())).style, [f, R, A] = o, v = b[r];
|
|
3143
|
+
o = h[r + 1], f != (v == null ? void 0 : v[0]) && (i.top = f + "00%"), R != (v == null ? void 0 : v[1]) && (i.height = R + "00%"), A != (v == null ? void 0 : v[2]) && (i.left = A * 100 + "%");
|
|
3144
|
+
const S = u[0] != f && (o == null ? void 0 : o[0]) != f, k = u[0] + u[1] != f + R && (o == null ? void 0 : o[0]) + (o == null ? void 0 : o[1]) != f + R;
|
|
3145
|
+
for (let N = -S, L = R + k; N < L; N++)
|
|
3146
|
+
n[N + f] = r;
|
|
3147
|
+
u = b[r] = h[r];
|
|
3148
|
+
}
|
|
3149
|
+
for (let r = t; r > a; ) p[--r].remove();
|
|
3150
|
+
m.append(...p.slice(t, t = a));
|
|
3151
|
+
}, l = () => {
|
|
3152
|
+
const g = n[d.activeLineNumber - 1] ?? -1;
|
|
3153
|
+
g != s && (s > -1 && (p[s].className = ""), g > -1 && (p[g].className = "active")), s = g;
|
|
3154
|
+
}, c = (g) => {
|
|
3155
|
+
const h = g.length, a = [], r = [];
|
|
3156
|
+
for (let u = 0, o = -1, i = 0, f = 0; ; i++) {
|
|
3157
|
+
const R = i == h, A = R ? 0 : _[i] = w(g[i]);
|
|
3158
|
+
if (A < 0)
|
|
3159
|
+
o < 0 && (o = i);
|
|
3160
|
+
else {
|
|
3161
|
+
for (let v = A; v < u; v++)
|
|
3162
|
+
a[v][1] = (o < 0 || v == A && !R ? i : o) - a[v][0];
|
|
3163
|
+
for (let v = u; v < A; )
|
|
3164
|
+
r[f++] = a[v] = [
|
|
3165
|
+
o < 0 || v > u ? i : o,
|
|
3166
|
+
0,
|
|
3167
|
+
v++ * e
|
|
3168
|
+
];
|
|
3169
|
+
o = -1, u = A;
|
|
3170
|
+
}
|
|
3171
|
+
if (R) break;
|
|
3172
|
+
}
|
|
3173
|
+
return _.length = h, r;
|
|
3174
|
+
}, w = (g) => {
|
|
3175
|
+
let h = g.search(/\S/), a = 0;
|
|
3176
|
+
if (h < 0) return h;
|
|
3177
|
+
for (let r = 0; r < h; )
|
|
3178
|
+
a += g[r++] == " " ? e - a % e : 1;
|
|
3179
|
+
return Math.ceil(a / e);
|
|
3180
|
+
};
|
|
3181
|
+
return {
|
|
3182
|
+
lines: m.children,
|
|
3183
|
+
indentLevels: _,
|
|
3184
|
+
update(g, h) {
|
|
3185
|
+
d || (d = g, g.extensions.indentGuides = this, g.overlays.append(m), g.addListener("update", y), g.addListener("selectionChange", l)), m.style.display = h.wordWrap ? "none" : "", e != (e = h.tabSize || 2) && (y(g.value), l());
|
|
3186
|
+
}
|
|
3187
|
+
};
|
|
3188
|
+
}, Ga = () => (e) => {
|
|
3189
|
+
let t, n, s, d = -1, p = [], b = () => {
|
|
3190
|
+
n || (n = e.extensions.matchBrackets);
|
|
3191
|
+
let [y, l] = e.getSelection(), c = y == l && e.focused && n && m(l) || -1;
|
|
3192
|
+
if (c != d) {
|
|
3193
|
+
if (_(), c + 1) {
|
|
3194
|
+
let w = t[s[c]], g = t[c];
|
|
3195
|
+
p = [w, g].map(
|
|
3196
|
+
(h) => je(e, ".punctuation", 0, -1, h[1])
|
|
3197
|
+
), p[0] != p[1] && w[1] + w[3].length == g[1] && (p[0].textContent += p[1].textContent, p[1].textContent = "", p[1] = p[0]), _(!0);
|
|
3198
|
+
} else p = [];
|
|
3199
|
+
d = c;
|
|
3200
|
+
}
|
|
3201
|
+
}, m = (y) => {
|
|
3202
|
+
var l;
|
|
3203
|
+
({ brackets: t, pairs: s } = n);
|
|
3204
|
+
for (let c = 0, w; w = t[++c]; )
|
|
3205
|
+
if (!w[4] && w[5] >= y && ((l = t[s[c]]) == null ? void 0 : l[1]) <= y)
|
|
3206
|
+
return c;
|
|
3207
|
+
}, _ = (y) => p.forEach((l) => l.classList.toggle("active-bracket", !!y));
|
|
3208
|
+
z(e, "focus", b), z(e, "blur", b), e.addListener("selectionChange", b), e.addListener("update", () => {
|
|
3209
|
+
_(), d = -1;
|
|
3210
|
+
});
|
|
3211
|
+
}, za = (e = !0, t = "([{", n = ")]}") => {
|
|
3212
|
+
let s, d;
|
|
3213
|
+
const p = [], b = (c) => {
|
|
3214
|
+
c.extensions.matchBrackets = b, c.addListener("tokenize", y), e && c.tokens[0] ? c.update() : y(c.tokens);
|
|
3215
|
+
}, m = b.brackets = [], _ = b.pairs = [], y = (c) => {
|
|
3216
|
+
if (_.length = m.length = d = s = 0, l(c, 0), e)
|
|
3217
|
+
for (let w = 0, g; g = m[w]; ) {
|
|
3218
|
+
let h = g[0].alias;
|
|
3219
|
+
g[0].alias = (h ? h + " " : "") + `bracket-${w++ in _ ? "level-" + g[2] % 12 : "error"}`;
|
|
3220
|
+
}
|
|
3221
|
+
}, l = (c, w) => {
|
|
3222
|
+
let g, h = 0;
|
|
3223
|
+
for (; g = c[h++]; ) {
|
|
3224
|
+
let a = g.length;
|
|
3225
|
+
if (typeof g != "string") {
|
|
3226
|
+
let r = g.content;
|
|
3227
|
+
if (Array.isArray(r))
|
|
3228
|
+
l(r, w);
|
|
3229
|
+
else if ((g.alias || g.type) == "punctuation") {
|
|
3230
|
+
let u = mn(r, t, a - 1), o = u || mn(r, n, a - 1);
|
|
3231
|
+
if (o) {
|
|
3232
|
+
if (m[s] = [g, w, 0, r, !!u, w + a], u) p[d++] = [s, u];
|
|
3233
|
+
else
|
|
3234
|
+
for (let i = d; i; ) {
|
|
3235
|
+
let [f, R] = p[--i];
|
|
3236
|
+
o == R && (_[_[s] = f] = s, m[s][2] = m[f][2] = d = i, i = 0);
|
|
3237
|
+
}
|
|
3238
|
+
s++;
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
w += a;
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
return b;
|
|
3246
|
+
}, mn = (e, t, n) => t.indexOf(e[0]) + 1 || n && t.indexOf(e[n]) + 1, Ha = "xml,rss,atom,jsx,tsx,xquery,actionscript".split(","), Va = /^(?:area|base|w?br|col|embed|hr|img|input|link|meta|source|track)$/i, Za = (e) => {
|
|
3247
|
+
let t = [], n, s = [], d, p, b = [], m = (y, l, c) => {
|
|
3248
|
+
n = c, s.length = t.length = d = p = 0, _(y, l, 0);
|
|
3249
|
+
}, _ = (y, l, c) => {
|
|
3250
|
+
let w = Ha.includes(l), g = 0, h = y.length;
|
|
3251
|
+
for (; g < h; ) {
|
|
3252
|
+
const a = y[g++], r = a.content, u = a.length;
|
|
3253
|
+
if (Array.isArray(r))
|
|
3254
|
+
if (a.type == "tag" && n[c] == "<") {
|
|
3255
|
+
const o = r[0].length, i = r[2] ? n.substr(c + o, r[1].length) : "", f = r[r.length - 1].length < 2 && (w || !Va.test(i));
|
|
3256
|
+
if (r[2] && w && _(r, l, c), f)
|
|
3257
|
+
if (o > 1)
|
|
3258
|
+
for (let R = p; R; )
|
|
3259
|
+
i == b[--R][1] && (t[t[d] = b[p = R][0]] = d, R = 0);
|
|
3260
|
+
else
|
|
3261
|
+
b[p++] = [d, i];
|
|
3262
|
+
s[d++] = [
|
|
3263
|
+
a,
|
|
3264
|
+
c,
|
|
3265
|
+
c + u,
|
|
3266
|
+
i,
|
|
3267
|
+
o > 1,
|
|
3268
|
+
f
|
|
3269
|
+
];
|
|
3270
|
+
} else {
|
|
3271
|
+
let o = a.alias || a.type;
|
|
3272
|
+
_(
|
|
3273
|
+
r,
|
|
3274
|
+
o.slice(0, 9) == "language-" ? o.slice(9) : l,
|
|
3275
|
+
c
|
|
3276
|
+
);
|
|
3277
|
+
}
|
|
3278
|
+
c += u;
|
|
3279
|
+
}
|
|
3280
|
+
};
|
|
3281
|
+
return e.addListener("tokenize", m), m(e.tokens, e.options.language, e.value), {
|
|
3282
|
+
tags: s,
|
|
3283
|
+
pairs: t
|
|
3284
|
+
};
|
|
3285
|
+
}, Ka = (e, t) => {
|
|
3286
|
+
for (let n = 0, s = t.length; n < s; n++) if (t[n][1] <= e && t[n][2] >= e) return n;
|
|
3287
|
+
}, Wa = () => (e) => {
|
|
3288
|
+
var t;
|
|
3289
|
+
let n, s;
|
|
3290
|
+
const { tags: d, pairs: p } = (t = e.extensions).matchTags || (t.matchTags = Za(e)), b = (m) => [n, s].forEach((_) => {
|
|
3291
|
+
_ && _.classList.toggle("active-tagname", !m);
|
|
3292
|
+
});
|
|
3293
|
+
e.addListener("selectionChange", ([m, _]) => {
|
|
3294
|
+
let y, l, c;
|
|
3295
|
+
m == _ && e.focused && (c = Ka(m, d), c + 1 && (c = p[c], c + 1 && (y = je(e, ".tag>.tag")) && (l = je(e, ".tag>.tag", 2, 0, d[c][1])))), n != y && (b(!0), n = y, s = l, b());
|
|
3296
|
+
});
|
|
3297
|
+
}, qa = "_wrap_1x3wi_1", ja = "_blockInfoEditable_1x3wi_30", hn = {
|
|
3298
|
+
wrap: qa,
|
|
3299
|
+
blockInfoEditable: ja
|
|
3300
|
+
}, Pe = [
|
|
3301
|
+
{ value: "plaintext", label: "plaintext" },
|
|
3302
|
+
{ value: "javascript", label: "JavaScript" },
|
|
3303
|
+
{ value: "typescript", label: "TypeScript" },
|
|
3304
|
+
{ value: "html", label: "HTML" },
|
|
3305
|
+
{ value: "css", label: "CSS" },
|
|
3306
|
+
{ value: "python", label: "Python" },
|
|
3307
|
+
{ value: "java", label: "Java" },
|
|
3308
|
+
{ value: "cpp", label: "C++" },
|
|
3309
|
+
{ value: "go", label: "Go" },
|
|
3310
|
+
{ value: "rust", label: "Rust" },
|
|
3311
|
+
{ value: "sql", label: "SQL" },
|
|
3312
|
+
{ value: "json", label: "JSON" },
|
|
3313
|
+
{ value: "yaml", label: "YAML" },
|
|
3314
|
+
{ value: "markdown", label: "Markdown" },
|
|
3315
|
+
{ value: "bash", label: "Bash" },
|
|
3316
|
+
{ value: "php", label: "PHP" }
|
|
3317
|
+
], ct = [2, 4, 8];
|
|
3318
|
+
function Ya(e) {
|
|
3319
|
+
const t = Qn(), n = $t(null), s = ea(() => Jn(Ja.name, e == null ? void 0 : e.editor), [e == null ? void 0 : e.editor]), d = $t(null), p = e.node.attrs.code || e.node.textContent || "", b = () => {
|
|
3320
|
+
p && navigator.clipboard.writeText(p).then(() => {
|
|
3321
|
+
console.log("Copy Success");
|
|
3322
|
+
}).catch((l) => {
|
|
3323
|
+
console.error("Error:", l);
|
|
3324
|
+
});
|
|
3325
|
+
}, m = () => {
|
|
3326
|
+
e.updateAttributes({
|
|
3327
|
+
lineNumbers: !e.node.attrs.lineNumbers
|
|
3328
|
+
});
|
|
3329
|
+
}, _ = () => {
|
|
3330
|
+
e.updateAttributes({
|
|
3331
|
+
wordWrap: !e.node.attrs.wordWrap
|
|
3332
|
+
});
|
|
3333
|
+
}, y = (l) => {
|
|
3334
|
+
const c = { ...l };
|
|
3335
|
+
return c.language && !Pe.some((w) => w.value === c.language) && (c.language = "plaintext", e.updateAttributes({
|
|
3336
|
+
language: "plaintext"
|
|
3337
|
+
})), c;
|
|
3338
|
+
};
|
|
3339
|
+
return Ft(() => {
|
|
3340
|
+
if (n.current) {
|
|
3341
|
+
const l = y(e.node.attrs);
|
|
3342
|
+
d.current = Sa(n.current, {
|
|
3343
|
+
readOnly: !e.editor.isEditable,
|
|
3344
|
+
language: l.language || "plaintext",
|
|
3345
|
+
tabSize: l.tabSize ?? 2,
|
|
3346
|
+
lineNumbers: l.lineNumbers ?? !0,
|
|
3347
|
+
wordWrap: l.wordWrap ?? !1,
|
|
3348
|
+
value: p,
|
|
3349
|
+
rtl: !1,
|
|
3350
|
+
onUpdate(c) {
|
|
3351
|
+
e.updateAttributes({ code: c });
|
|
3352
|
+
}
|
|
3353
|
+
}), d.current.addExtensions(
|
|
3354
|
+
za(),
|
|
3355
|
+
Wa(),
|
|
3356
|
+
Ba(),
|
|
3357
|
+
Ga(),
|
|
3358
|
+
$a(),
|
|
3359
|
+
Ma(),
|
|
3360
|
+
Pa()
|
|
3361
|
+
), e.node.attrs.shouldFocus && setTimeout(() => {
|
|
3362
|
+
var c;
|
|
3363
|
+
(c = d.current) == null || c.textarea.focus(), e.updateAttributes({
|
|
3364
|
+
shouldFocus: !1
|
|
3365
|
+
});
|
|
3366
|
+
}, 0);
|
|
3367
|
+
}
|
|
3368
|
+
return () => {
|
|
3369
|
+
var l, c;
|
|
3370
|
+
(l = d.current) != null && l.remove && ((c = d.current) == null || c.remove());
|
|
3371
|
+
};
|
|
3372
|
+
}, [n]), Ft(() => {
|
|
3373
|
+
var l, c;
|
|
3374
|
+
if ((l = d.current) != null && l.setOptions) {
|
|
3375
|
+
const w = y(e.node.attrs);
|
|
3376
|
+
(c = d.current) == null || c.setOptions(w);
|
|
3377
|
+
}
|
|
3378
|
+
}, [d, e.node.attrs]), /* @__PURE__ */ T(jn, { className: Ne(hn.wrap, "render-wrapper"), children: /* @__PURE__ */ T(
|
|
3379
|
+
"div",
|
|
3380
|
+
{
|
|
3381
|
+
ref: n,
|
|
3382
|
+
className: Ne("richtext-node-container richtext-hover-shadow richtext-select-outline richtext-node-code-block !richtext-my-[10px]", {
|
|
3383
|
+
[hn.blockInfoEditable]: !t
|
|
3384
|
+
}),
|
|
3385
|
+
children: /* @__PURE__ */ me("div", { className: "richtext-code-block-toolbar", children: [
|
|
3386
|
+
/* @__PURE__ */ T("div", { children: /* @__PURE__ */ me(
|
|
3387
|
+
Ut,
|
|
3388
|
+
{
|
|
3389
|
+
defaultValue: e.node.attrs.language,
|
|
3390
|
+
disabled: !t,
|
|
3391
|
+
onValueChange: (l) => {
|
|
3392
|
+
e.updateAttributes({
|
|
3393
|
+
language: l
|
|
3394
|
+
});
|
|
3395
|
+
},
|
|
3396
|
+
children: [
|
|
3397
|
+
/* @__PURE__ */ T(dt, { className: "richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ T(aa, { placeholder: "Select language" }) }),
|
|
3398
|
+
/* @__PURE__ */ T(
|
|
3399
|
+
ut,
|
|
3400
|
+
{
|
|
3401
|
+
className: "richtext-border-[#3a3f4b] richtext-bg-[#21252b] richtext-text-[#ccc]",
|
|
3402
|
+
onCloseAutoFocus: (l) => l.preventDefault(),
|
|
3403
|
+
children: Pe == null ? void 0 : Pe.map(
|
|
3404
|
+
(l) => /* @__PURE__ */ T(
|
|
3405
|
+
pt,
|
|
3406
|
+
{
|
|
3407
|
+
value: l.value,
|
|
3408
|
+
children: l.label
|
|
3409
|
+
},
|
|
3410
|
+
l.value
|
|
3411
|
+
)
|
|
3412
|
+
)
|
|
3413
|
+
}
|
|
3414
|
+
)
|
|
3415
|
+
]
|
|
3416
|
+
}
|
|
3417
|
+
) }),
|
|
3418
|
+
/* @__PURE__ */ T("div", { className: "toolbar-divider" }),
|
|
3419
|
+
/* @__PURE__ */ T(
|
|
3420
|
+
"div",
|
|
3421
|
+
{
|
|
3422
|
+
className: "richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
3423
|
+
onClick: b,
|
|
3424
|
+
children: /* @__PURE__ */ T(
|
|
3425
|
+
we,
|
|
3426
|
+
{
|
|
3427
|
+
className: "richtext-size-4",
|
|
3428
|
+
name: "Copy"
|
|
3429
|
+
}
|
|
3430
|
+
)
|
|
3431
|
+
}
|
|
3432
|
+
),
|
|
3433
|
+
/* @__PURE__ */ T("div", { className: "toolbar-divider" }),
|
|
3434
|
+
/* @__PURE__ */ T(
|
|
3435
|
+
"div",
|
|
3436
|
+
{
|
|
3437
|
+
onClick: m,
|
|
3438
|
+
className: Ne("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]", {
|
|
3439
|
+
"richtext-bg-[#5a5d5e4f]": e == null ? void 0 : e.node.attrs.lineNumbers
|
|
3440
|
+
}),
|
|
3441
|
+
children: /* @__PURE__ */ T(
|
|
3442
|
+
we,
|
|
3443
|
+
{
|
|
3444
|
+
className: "richtext-size-4",
|
|
3445
|
+
name: "List"
|
|
3446
|
+
}
|
|
3447
|
+
)
|
|
3448
|
+
}
|
|
3449
|
+
),
|
|
3450
|
+
/* @__PURE__ */ T("div", { className: "toolbar-divider" }),
|
|
3451
|
+
/* @__PURE__ */ T(
|
|
3452
|
+
"div",
|
|
3453
|
+
{
|
|
3454
|
+
onClick: _,
|
|
3455
|
+
className: Ne("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]", {
|
|
3456
|
+
"richtext-bg-[#5a5d5e4f]": e == null ? void 0 : e.node.attrs.wordWrap
|
|
3457
|
+
}),
|
|
3458
|
+
children: /* @__PURE__ */ T(
|
|
3459
|
+
we,
|
|
3460
|
+
{
|
|
3461
|
+
className: "richtext-size-4",
|
|
3462
|
+
name: "WrapText"
|
|
3463
|
+
}
|
|
3464
|
+
)
|
|
3465
|
+
}
|
|
3466
|
+
),
|
|
3467
|
+
/* @__PURE__ */ T("div", { className: "toolbar-divider" }),
|
|
3468
|
+
/* @__PURE__ */ T("div", { children: /* @__PURE__ */ me(
|
|
3469
|
+
Ut,
|
|
3470
|
+
{
|
|
3471
|
+
defaultValue: e.node.attrs.tabSize,
|
|
3472
|
+
disabled: !t,
|
|
3473
|
+
onValueChange: (l) => {
|
|
3474
|
+
e.updateAttributes({
|
|
3475
|
+
tabSize: l
|
|
3476
|
+
});
|
|
3477
|
+
},
|
|
3478
|
+
children: [
|
|
3479
|
+
/* @__PURE__ */ T(dt, { className: "richtext-h-7 richtext-w-[60px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ T(
|
|
3480
|
+
we,
|
|
3481
|
+
{
|
|
3482
|
+
className: "richtext-size-4",
|
|
3483
|
+
name: "IndentIncrease"
|
|
3484
|
+
}
|
|
3485
|
+
) }),
|
|
3486
|
+
/* @__PURE__ */ T(
|
|
3487
|
+
ut,
|
|
3488
|
+
{
|
|
3489
|
+
className: "richtext-border-[#3a3f4b] richtext-bg-[#21252b] richtext-text-[#ccc]",
|
|
3490
|
+
onCloseAutoFocus: (l) => l.preventDefault(),
|
|
3491
|
+
children: ct == null ? void 0 : ct.map((l) => /* @__PURE__ */ T(
|
|
3492
|
+
pt,
|
|
3493
|
+
{
|
|
3494
|
+
value: l,
|
|
3495
|
+
children: l
|
|
3496
|
+
},
|
|
3497
|
+
l
|
|
3498
|
+
))
|
|
3499
|
+
}
|
|
3500
|
+
)
|
|
3501
|
+
]
|
|
3502
|
+
}
|
|
3503
|
+
) }),
|
|
3504
|
+
/* @__PURE__ */ T("div", { className: "toolbar-divider" }),
|
|
3505
|
+
/* @__PURE__ */ T(
|
|
3506
|
+
"div",
|
|
3507
|
+
{
|
|
3508
|
+
className: "richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
3509
|
+
onClick: s,
|
|
3510
|
+
children: /* @__PURE__ */ T(
|
|
3511
|
+
we,
|
|
3512
|
+
{
|
|
3513
|
+
className: "richtext-size-4",
|
|
3514
|
+
name: "Trash2"
|
|
3515
|
+
}
|
|
3516
|
+
)
|
|
3517
|
+
}
|
|
3518
|
+
)
|
|
3519
|
+
] })
|
|
3520
|
+
}
|
|
3521
|
+
) });
|
|
3522
|
+
}
|
|
3523
|
+
const Xa = /^`{3}([a-z]+)?\s$/, Qa = /^~{3}([a-z]+)?\s$/, Ja = /* @__PURE__ */ Wn.create({
|
|
3524
|
+
name: "codeBlock",
|
|
3525
|
+
group: "block",
|
|
3526
|
+
atom: !0,
|
|
3527
|
+
content: "text*",
|
|
3528
|
+
addOptions() {
|
|
3529
|
+
var e;
|
|
3530
|
+
return {
|
|
3531
|
+
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
3532
|
+
languages: [],
|
|
3533
|
+
button: ({ editor: t, t: n }) => ({
|
|
3534
|
+
component: sa,
|
|
3535
|
+
componentProps: {
|
|
3536
|
+
action: () => t.commands.setCodeBlock({}),
|
|
3537
|
+
isActive: () => t.isActive("codeBlock") || !1,
|
|
3538
|
+
disabled: !1,
|
|
3539
|
+
icon: "Code2",
|
|
3540
|
+
tooltip: n("editor.codeblock.tooltip")
|
|
3541
|
+
}
|
|
3542
|
+
})
|
|
3543
|
+
};
|
|
3544
|
+
},
|
|
3545
|
+
addAttributes() {
|
|
3546
|
+
return {
|
|
3547
|
+
code: {
|
|
3548
|
+
default: "",
|
|
3549
|
+
parseHTML: (e) => e.textContent || ""
|
|
3550
|
+
},
|
|
3551
|
+
language: {
|
|
3552
|
+
default: "plaintext"
|
|
3553
|
+
},
|
|
3554
|
+
lineNumbers: {
|
|
3555
|
+
default: !0
|
|
3556
|
+
},
|
|
3557
|
+
wordWrap: {
|
|
3558
|
+
default: !1
|
|
3559
|
+
},
|
|
3560
|
+
tabSize: {
|
|
3561
|
+
default: 2
|
|
3562
|
+
},
|
|
3563
|
+
shouldFocus: {
|
|
3564
|
+
default: !0,
|
|
3565
|
+
parseHTML: () => !1,
|
|
3566
|
+
renderHTML: !1
|
|
3567
|
+
}
|
|
3568
|
+
};
|
|
3569
|
+
},
|
|
3570
|
+
parseHTML() {
|
|
3571
|
+
return [
|
|
3572
|
+
{
|
|
3573
|
+
tag: "pre",
|
|
3574
|
+
preserveWhitespace: "full",
|
|
3575
|
+
getAttrs: (e) => ({
|
|
3576
|
+
code: e.textContent || ""
|
|
3577
|
+
})
|
|
3578
|
+
},
|
|
3579
|
+
{
|
|
3580
|
+
tag: "pre code",
|
|
3581
|
+
preserveWhitespace: "full",
|
|
3582
|
+
getAttrs: (e) => ({
|
|
3583
|
+
code: e.textContent || ""
|
|
3584
|
+
})
|
|
3585
|
+
}
|
|
3586
|
+
];
|
|
3587
|
+
},
|
|
3588
|
+
renderHTML({ HTMLAttributes: e, node: t }) {
|
|
3589
|
+
var s;
|
|
3590
|
+
const n = t.attrs.code || ((s = t.content.firstChild) == null ? void 0 : s.text) || "";
|
|
3591
|
+
return [
|
|
3592
|
+
"pre",
|
|
3593
|
+
qn(this.options.HTMLAttributes, e),
|
|
3594
|
+
["code", {}, n]
|
|
3595
|
+
];
|
|
3596
|
+
},
|
|
3597
|
+
addNodeView() {
|
|
3598
|
+
return Yn(Ya);
|
|
3599
|
+
},
|
|
3600
|
+
addCommands() {
|
|
3601
|
+
return {
|
|
3602
|
+
setCodeBlock: (e) => ({ commands: t }) => t.insertContent({
|
|
3603
|
+
type: this.name,
|
|
3604
|
+
attrs: {
|
|
3605
|
+
...e,
|
|
3606
|
+
shouldFocus: !0
|
|
3607
|
+
}
|
|
3608
|
+
})
|
|
3609
|
+
};
|
|
3610
|
+
},
|
|
3611
|
+
addKeyboardShortcuts() {
|
|
3612
|
+
return {
|
|
3613
|
+
"Mod-Alt-c": () => this.editor.commands.setCodeBlock({})
|
|
3614
|
+
};
|
|
3615
|
+
},
|
|
3616
|
+
addInputRules() {
|
|
3617
|
+
return [
|
|
3618
|
+
Dt({
|
|
3619
|
+
find: Xa,
|
|
3620
|
+
type: this.type,
|
|
3621
|
+
getAttributes: (e) => ({
|
|
3622
|
+
language: e[1]
|
|
3623
|
+
})
|
|
3624
|
+
}),
|
|
3625
|
+
Dt({
|
|
3626
|
+
find: Qa,
|
|
3627
|
+
type: this.type,
|
|
3628
|
+
getAttributes: (e) => ({
|
|
3629
|
+
language: e[1]
|
|
3630
|
+
})
|
|
3631
|
+
})
|
|
3632
|
+
];
|
|
3633
|
+
}
|
|
3634
|
+
});
|
|
3635
|
+
export {
|
|
3636
|
+
Ja as CodeBlock,
|
|
3637
|
+
Xa as backtickInputRegex,
|
|
3638
|
+
Qa as tildeInputRegex
|
|
3639
|
+
};
|