-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrust.js
50 lines (50 loc) · 1.35 KB
/
rust.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
module.exports = function(hljs) {
var TITLE = {
className: 'title',
begin: hljs.UNDERSCORE_IDENT_RE
};
var NUMBER = {
className: 'number',
begin: '\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)',
relevance: 0
};
var KEYWORDS =
'assert bool break char check claim comm const cont copy dir do drop ' +
'else enum extern export f32 f64 fail false float fn for i16 i32 i64 i8 ' +
'if impl int let log loop match mod move mut priv pub pure ref return ' +
'self static str struct task true trait type u16 u32 u64 u8 uint unsafe ' +
'use vec while';
return {
keywords: KEYWORDS,
illegal: '</',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
hljs.APOS_STRING_MODE,
NUMBER,
{
className: 'function',
beginWithKeyword: true, end: '(\\(|<)',
keywords: 'fn',
contains: [TITLE]
},
{
className: 'preprocessor',
begin: '#\\[', end: '\\]'
},
{
beginWithKeyword: true, end: '(=|<)',
keywords: 'type',
contains: [TITLE],
illegal: '\\S'
},
{
beginWithKeyword: true, end: '({|<)',
keywords: 'trait enum',
contains: [TITLE],
illegal: '\\S'
}
]
};
};