3 * Description: C++ programming language.
4 * Author: Markku Rossi <mtr@iki.fi>
9 (build-re '(alignas alignof and and_eq asm auto bitand bitor bool
10 break case catch char char16_t char32_t class compl const constexpr
11 const_cast continue decltype default delete do double dynamic_cast
12 else enum explicit export extern false float for friend goto if
13 inline int long mutable namespace new noexcept not not_eq nullptr
14 operator or or_eq private protected public register
15 reinterpret_cast return short signed sizeof static static_assert
16 static_cast struct switch template this thread_local throw true try
17 typedef typeid typename union unsigned using virtual void volatile
18 wchar_t while xor xor_eq))
20 /\\b(a(lign(as|of)|nd(|_eq)|sm|uto)|b(it(and|or)|ool|reak)\\
21 |c(a(se|tch)|har(|16_t|32_t)|lass|o(mpl|n(st(|_cast|expr)|tinue)))\\
22 |d(e(cltype|fault|lete)|o(|uble)|ynamic_cast)\\
23 |e(lse|num|x(p(licit|ort)|tern))|f(alse|loat|or|riend)|goto\\
24 |i(f|n(line|t))|long|mutable|n(amespace|ew|o(except|t(|_eq))|ullptr)\\
25 |o(perator|r(|_eq))|p(r(ivate|otected)|ublic)\\
26 |re(gister|interpret_cast|turn)\\
27 |s(hort|i(gned|zeof)|t(atic(|_(assert|cast))|ruct)|witch)\\
28 |t(emplate|h(is|r(ead_local|ow))|r(ue|y)|ype(def|id|name))\\
29 |u(n(ion|signed)|sing)|v(irtual|o(id|latile))|w(char_t|hile)|xor(|_eq))\b/;
32 * We inherit the C++ state from the C state. This gives us all the
33 * defaults, etc. All we have to do here is to overwrite things that
34 * are not implemented, or are broken.
39 /* See `c.st' for the comments on this one. */
40 type_re = cpp_type_re;
43 /* One line comments. */
51 /* Keywords; those missing from C, but not types, goto, or case
52 (build-re '(asm catch delete new operator overload this throw try))
54 /\b(asm|catch|delete|new|o(perator|verload)|t(h(is|row)|ry))\b/ {
67 /* Remove false labels. */
72 /* Labels. Emacs accepts also bare numbers. */
73 /^([ \t]*)([a-zA-Z0-9_]+)(:)/ {
76 if (strcmp ($2, "public") == 0
77 || strcmp ($2, "private") == 0
78 || strcmp ($2, "protected") == 0)
80 /* These use the `type' face. */
87 reference_face (true);
89 reference_face (false);
96 * Function definitions, but only if you code with the one and only
97 * usable indentation style (GNU).
99 /^([a-zA-Z_][a-zA-Z_0-9:~]*)([ \t]*\()/ {
100 function_name_face (true);
102 function_name_face (false);
107 /* Function definitions and prototypes for other (loser) coding styles. */
108 /^([A-Za-z][a-zA-Z0-9_\&\* ]+)([ \*])([a-zA-Z_][a-zA-Z_0-9:~]*)([ \t]*\()/ {
114 highlight_types (garbage, cpp_type_re);
116 language_print (middle_garbage);
118 function_name_face (true);
119 language_print (function_name);
120 function_name_face (false);
122 language_print (tail_garbage);