This repository was archived by the owner on Dec 3, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshBrushRust.js
More file actions
63 lines (55 loc) · 2.7 KB
/
shBrushRust.js
File metadata and controls
63 lines (55 loc) · 2.7 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
;(function() {
// CommonJS
SyntaxHighlighter = SyntaxHighlighter || (
typeof require !== 'undefined' ? require('shCore').SyntaxHighlighter
: null
);
function Brush() {
var datatypes = 'u8 i8 u16 i16 u32 i32 u64 i64 f32 f64 ' +
'isize usize bool char str Box ' +
'Option Result String Vec Some None Ok Err';
var keywords = 'abstract alignof as become box ' +
'break const continue crate do ' +
'else enum extern false final ' +
'fn for if impl in ' +
'let loop macro match mod ' +
'move mut offsetof override priv ' +
'proc pub pure ref return ' +
'Self self sizeof static struct ' +
'super trait true type typeof ' +
'unsafe unsized use virtual where ' +
'while yield';
var functions = 'drop default from';
var macros = 'assert assert_eq cfg column concat concat_idents ' +
'debug_assert debug_assert_eq env file format ' +
'format_args include include_bytes include_str ' +
'line module_path option_env panic print println ' +
'scoped_thread_local select stringify thread_local ' +
'try unimplemented unreachable vec write writeln';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLineCComments,
css: 'comments' },
{ regex: SyntaxHighlighter.regexLib.multiLineCComments,
css: 'comments' },
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString,
css: 'string' },
{ regex: SyntaxHighlighter.regexLib.singleQuotedString,
css: 'string' },
{ regex: /^ *#\!\[[^\]]+\]/gm,
css: 'preprocessor' },
{ regex: new RegExp(this.getKeywords(datatypes), 'gm'),
css: 'color1 bold' },
{ regex: new RegExp('(' + this.getKeywords(macros) + ')\!', 'gm'),
css: 'color2 bold' },
{ regex: new RegExp(this.getKeywords(functions), 'gm'),
css: 'functions bold' },
{ regex: new RegExp(this.getKeywords(keywords), 'gm'),
css: 'keyword bold' }
];
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['rust', 'rs'];
SyntaxHighlighter.brushes.Rust = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();