summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2017-09-18 08:52:24 +0000
committerAlan Mackenzie <acm@muc.de>2017-10-05 17:16:10 +0000
commit57ab49f7da6e7c978932b565ed63d66c07ce8c30 (patch)
tree1966788204278a39a1e15f386bd4986fcdb29039 /lisp/progmodes/cc-langs.el
parentbd5326f879c089745c33871efc8682da5c206f80 (diff)
downloademacs-57ab49f7da6e7c978932b565ed63d66c07ce8c30.tar.gz
Fix irregularities with CC Mode fontification, particularly with "known types"
* lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Introduce a new optional parameter, template-class. In "class <X = Y>", fontify "Y" as a type. (c-font-lock-single-decl): New variable template-class, set to non-nil when we have a construct like the above. Pass this as argument to c-font-lock-declarators. (c-font-lock-cut-off-declarators): Check more rigorously that a declaration being processed starts before the function's starting position. (c-complex-decl-matchers): Remove the redundant clause which fontified "types preceded by, e.g., "struct"". * lisp/progmodes/cc-langs.el (c-template-typename-kwds) (c-template-typename-key): New lang defconsts and defvar.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index bcda093678a..227b3e16485 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1896,6 +1896,17 @@ the type of that expression."
t (c-make-keywords-re t (c-lang-const c-typeof-kwds)))
(c-lang-defvar c-typeof-key (c-lang-const c-typeof-key))
+(c-lang-defconst c-template-typename-kwds
+ "Keywords which, within a template declaration, can introduce a
+declaration with a type as a default value. This is used only in
+C++ Mode, e.g. \"<typename X = Y>\"."
+ t nil
+ c++ '("class" "typename"))
+
+(c-lang-defconst c-template-typename-key
+ t (c-make-keywords-re t (c-lang-const c-template-typename-kwds)))
+(c-lang-defvar c-template-typename-key (c-lang-const c-template-typename-key))
+
(c-lang-defconst c-type-prefix-kwds
"Keywords where the following name - if any - is a type name, and
where the keyword together with the symbol works as a type in