forked from argotorg/fe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom-highlight.js
More file actions
87 lines (84 loc) · 1.21 KB
/
custom-highlight.js
File metadata and controls
87 lines (84 loc) · 1.21 KB
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
86
87
function highlight_fe(hljs) {
const KEYWORDS = [
"and",
"break",
"const",
"continue",
"contract",
"ingot",
"else",
"emit",
"enum",
"event",
"false",
"fn",
"for",
"idx",
"if",
"impl",
"in",
"let",
"loop",
"match",
"mut",
"or",
"not",
"pragma",
"pub",
"return",
"revert",
"self",
"Self",
"struct",
"trait",
"true",
"type",
"unsafe",
"use",
"where",
"while"
];
const TYPES = [
"address",
"i8",
"i16",
"i32",
"i64",
"i128",
"i256",
"u8",
"u16",
"u32",
"u64",
"u128",
"u256",
"bool",
"Context",
"Option",
"Result",
"String",
"Array",
"Map"
];
return {
name: "Fe",
keywords: {
keyword: KEYWORDS.join(' '),
built_in: TYPES.join(' '),
literal: "false true",
},
contains: [
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
{
scope: "string",
begin: '"',
end: '"',
contains: [{ begin: "\\\\." }],
},
hljs.COMMENT("//", "\n"),
],
}
}
hljs.registerLanguage("fe", highlight_fe);
hljs.initHighlightingOnLoad();