-
Notifications
You must be signed in to change notification settings - Fork 1
/
highlight-spicy.js
51 lines (48 loc) · 1.34 KB
/
highlight-spicy.js
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
// This is a grammar for highlight.js used by mdbook.
//
// - Guide on writing highlighters: https://highlightjs.readthedocs.io/en/latest/language-guide.html
// - possible values for `scope`/`className`: https://highlightjs.readthedocs.io/en/latest/css-classes-reference.html
hljs.registerLanguage('spicy', (hljs) => ({
name: 'Spicy',
keywords: {
keyword:
// TODO(bbannier): $$
'public self module import function '
+ 'global local const var return on break stop throw skip inout \\$\\$ '
+ 'while break continue '
+ 'for in '
+ 'if else '
+ 'switch case default '
+ 'type enum struct tuple unit ',
literal: 'True False Null',
built_in: 'uint8 uint16 uint32 uint64 '
+ 'int8 int16 int32 int64 '
+ 'bytes string '
+ 'optional '
+ 'vector set map '
+ 'bitfield void '
+ 'address network port time '
+ 'print assert '
+ 'begin end '
+ 'cast ',
},
contains: [
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
hljs.HASH_COMMENT_MODE,
hljs.REGEXP_MODE,
{
// Properties & hooks.
className: 'meta',
begin: /%\w+[-|\w]*/
}, {
// Attributes.
className: 'meta',
begin: /&\w+[-|\w]*/
}, {
className: 'operator',
begin: hljs.RE_STARTERS_RE,
},
]
}));
hljs.initHighlightingOnLoad()