-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpp.js
48 lines (48 loc) · 1.85 KB
/
cpp.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
module.exports = function(hljs) {
var CPP_KEYWORDS = {
keyword: 'false int float while private char catch export virtual operator sizeof ' +
'dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace ' +
'unsigned long throw volatile static protected bool template mutable if public friend ' +
'do return goto auto void enum else break new extern using true class asm case typeid ' +
'short reinterpret_cast|10 default double register explicit signed typename try this ' +
'switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype ' +
'noexcept nullptr static_assert thread_local restrict _Bool complex',
built_in: 'std string cin cout cerr clog stringstream istringstream ostringstream ' +
'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' +
'unordered_map unordered_multiset unordered_multimap array shared_ptr'
};
return {
keywords: CPP_KEYWORDS,
illegal: '</',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
{
className: 'string',
begin: '\'\\\\?.', end: '\'',
illegal: '.'
},
{
className: 'number',
begin: '\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)'
},
hljs.C_NUMBER_MODE,
{
className: 'preprocessor',
begin: '#', end: '$',
contains: [
{begin: '<', end: '>', illegal: '\\n'},
hljs.C_LINE_COMMENT_MODE
]
},
{
className: 'stl_container',
begin: '\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>',
keywords: CPP_KEYWORDS,
relevance: 10,
contains: ['self']
}
]
};
};