3 * Description: C++ programming language.
4 * Author: Markku Rossi <mtr@iki.fi>
9 (build-re '(auto bool char class complex const double enum extern
10 float friend inline int long private protected public register
11 short signed static struct template typedef union unsigned virtual
14 /\b(auto|bool|c(har|lass|o(mplex|nst))|double|e(num|xtern)|f(loat|riend)\
15 |in(line|t)|long|p(r(ivate|otected)|ublic)|register\
16 |s(hort|igned|t(atic|ruct))|t(emplate|ypedef)|un(ion|signed)\
17 |v(irtual|o(id|latile)))\b/;
20 * We inherit the C++ state from the C state. This gives us all the
21 * defaults, etc. All we have to do here is to overwrite things that
22 * are not implemented, or are broken.
27 /* See `c.st' for the comments on this one. */
28 type_re = cpp_type_re;
31 /* One line comments. */
39 /* Keywords; those missing from C, but not types, goto, or case
40 (build-re '(asm catch delete new operator overload this throw try))
42 /\b(asm|catch|delete|new|o(perator|verload)|t(h(is|row)|ry))\b/ {
55 /* Remove false labels. */
60 /* Labels. Emacs accepts also bare numbers. */
61 /^([ \t]*)([a-zA-Z0-9_]+)(:)/ {
64 if (strcmp ($2, "public") == 0
65 || strcmp ($2, "private") == 0
66 || strcmp ($2, "protected") == 0)
68 /* These use the `type' face. */
75 reference_face (true);
77 reference_face (false);
84 * Function definitions, but only if you code with the one and only
85 * usable indentation style (GNU).
87 /^([a-zA-Z_][a-zA-Z_0-9:~]*)([ \t]*\()/ {
88 function_name_face (true);
90 function_name_face (false);
95 /* Function definitions and prototypes for other (loser) coding styles. */
96 /^([A-Za-z][a-zA-Z0-9_\&\* ]+)([ \*])([a-zA-Z_][a-zA-Z_0-9:~]*)([ \t]*\()/ {
102 highlight_types (garbage, cpp_type_re);
104 language_print (middle_garbage);
106 function_name_face (true);
107 language_print (function_name);
108 function_name_face (false);
110 language_print (tail_garbage);