0
This repository has been archived on 2024-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
highlight_js-rails/vendor/assets/javascripts/highlight_js/languages/cpp.js
Rogaboru Kujimoshi a52831ccdb Update to 8.0
2014-06-08 21:04:39 +04:00

69 lines
2.8 KiB
JavaScript

/*
Language: C++
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
Contributors: Evgeny Stepanischev <imbolk@gmail.com>, Zaven Muradyan <megalivoithos@gmail.com>
*/
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 _Complex _Imaginary',
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 abort abs acos ' +
'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +
'fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +
'isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow ' +
'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' +
'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' +
'vfprintf vprintf vsprintf'
};
return {
aliases: ['c', 'h', 'c++', 'h++'],
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: '$',
keywords: 'if else elif endif define undef warning error line pragma',
contains: [
{
begin: 'include\\s*[<"]', end: '[>"]',
keywords: 'include',
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,
contains: ['self']
},
{
begin: hljs.IDENT_RE + '::'
}
]
};
}