Mercurial
annotate third_party/highlight/es/languages/cpp.min.js @ 188:32ce881452fa hg-web
Fixing few stuff.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 23 Jan 2026 22:50:28 -0800 |
| parents | 2db6253f355d |
| children |
| rev | line source |
|---|---|
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 /*! `cpp` grammar compiled for Highlight.js 11.11.1 */ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 var hljsGrammar=(()=>{"use strict";return e=>{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 const t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}] |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4 }),n="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",i="(?!struct)("+n+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5 className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6 begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
9 begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 className:"number",variants:[{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)" |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
12 },{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
13 begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)" |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
14 }],relevance:0},l={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
15 keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
16 },contains:[{begin:/\\\n/,relevance:0},e.inherit(c,{className:"string"}),{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
17 className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},u={ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
18 className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 },d=t.optional(r)+e.IDENT_RE+"\\s*\\(",_={ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"], |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
21 keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"], |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"], |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 _type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"] |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
24 },p={className:"function.dispatch",relevance:0,keywords:{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
25 _hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"] |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
26 }, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
27 begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/)) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
28 },m=[p,l,s,a,e.C_BLOCK_COMMENT_MODE,o,c],f={variants:[{begin:/=/,end:/;/},{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
29 begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
30 keywords:_,contains:m.concat([{begin:/\(/,end:/\)/,keywords:_, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
31 contains:m.concat(["self"]),relevance:0}]),relevance:0},g={className:"function", |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
32 begin:"("+i+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
33 keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:_,relevance:0},{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
34 begin:d,returnBegin:!0,contains:[u],relevance:0},{begin:/::/,relevance:0},{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
35 begin:/:/,endsWithParent:!0,contains:[c,o]},{relevance:0,match:/,/},{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
36 className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
37 contains:[a,e.C_BLOCK_COMMENT_MODE,c,o,s,{begin:/\(/,end:/\)/,keywords:_, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
38 relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,c,o,s]}] |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
39 },s,a,e.C_BLOCK_COMMENT_MODE,l]};return{name:"C++", |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
40 aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"</", |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
41 classNameAliases:{"function.dispatch":"built_in"}, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
42 contains:[].concat(f,g,p,m,[l,{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
43 begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)", |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
44 end:">",keywords:_,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:_},{ |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
45 match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/], |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
46 className:{1:"keyword",3:"title.class"}}])}}})();export default hljsGrammar; |