-
Notifications
You must be signed in to change notification settings - Fork 3
/
JavaScript.mtsx
85 lines (85 loc) · 3.21 KB
/
JavaScript.mtsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// 此文件为内置语法,仅对配色进行调整
// 当语法更新时,我会同步跟进
// 有bug请找bin修,我只负责调整和优化
{
name: ["JavaScript EX", ".js", ".es", ".mjs"]
comment: {startsWith: "//"}
comment: {startsWith: "/*", endsWith: "*/"}
defines: [
"single-quoted-string": {
style: "string"
start: {match: /'/}
end: {match: /(?m)'|$/}
contains: [
{match: /\\\n/, 0: "strEscape"}
{builtin: #JAVA_ESCAPED_CHAR#}
]
}
"double-quoted-string": {
style: "string"
start: {match: /"/}
end: {match: /(?m)"|$/}
contains: [
{match: /\\\n/, 0: "strEscape"}
{builtin: #JAVA_ESCAPED_CHAR#}
]
}
"backtick-string": {
style: "string"
start: {match: /`/}
end: {match: /`/}
contains: [
{match: /\\`/, 0: "strEscape"}
{builtin: #JAVA_ESCAPED_CHAR#}
{include: "dollarExp"}
]
}
"regex": {
start: {match: /(?<=(?:[=,(&|!:;]|^|\breturn)\s{0,20})/ + "/"}
end: {match: "/" + /([img]*)/, 1: "operator"}
style: "meta"
contains: [
{match: /\\./, 0: "strEscape"}
{
start: {match: /\[/}
end: {match: /\]/}
contains: [
{match: /\\./, 0: "strEscape"}
]
}
]
}
"dollarExp": {
start: {match: /\$\{/}
end: {match: /\}/}
style: "strEscape"
contains: [
{include: "single-quoted-string"}
{include: "double-quoted-string"}
{include: "regex"}
{include: "backtick-string"}
{include: "dollarExp"}
]
}
]
contains: [
{include: "single-quoted-string"}
{include: "double-quoted-string"}
{include: "regex"}
{include: "backtick-string"}
{builtin: #JAVA_NUMBER#}
{match: /\basync(?=\s+function\b)/, 0: "keyword"}
{match: keywordsToRegex(
"break case catch class const continue debugger default delete do else enum export async await"
"extends false finally for function if implements import instanceof interface let debugger"
"new null package private protected public return static super switch this with"
"throw true try typeof var void while yield function of import in from as"
), 0: "keyword"
}
{match: keywordsToRegex("JSON Date Function Symbol RegExp Array String Number Boolean Math BigInt Map Set Object WeakMap WeakSet console globalThis"),0:"namespace"}
{match: keywordsToRegex("prototype Infinity NaN undefined"),0:"operator"}
{match: keywordsToRegex("=> === !== ..."),0:"label"}
{match: keywordsToRegex("Error AggregateError EvalError RangeError ReferenceError SyntaxError TypeError URIError InternalError"),0:"error"}
]
codeFormatter: #BUILT_IN_JS_FORMATTER#
}