diff options
author | Alan Mackenzie <acm@muc.de> | 2017-09-16 11:31:38 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2017-09-16 11:31:38 +0000 |
commit | 4ea37c2b8b0c5a68fde59770c3536195e0972217 (patch) | |
tree | 4d961e699f3379139974cef30e8b7d26e0e7b4a1 /lisp/progmodes/cc-langs.el | |
parent | 2d53f8783ff8e48d91809741adab6a2402587fad (diff) | |
download | emacs-4ea37c2b8b0c5a68fde59770c3536195e0972217.tar.gz |
Cope better with C++ and Objective-C protection keywords in class declarations
This fix fixes the fontification of a method inside a class at the time it is
typed, when there is a protection keyword clause preceding it.
* lisp/progmodes/cc-engine.el (c-forward-keyword-clause): Handle protection
keywords.
(c-looking-at-decl-block): Avoid scanning forward over protection keyword
clauses too eagerly.
* lisp/progmodes/cc-langs.el (c-protection-key c-post-protection-token): New
lang defconsts and defvars.
* lisp/progmodes/cc-mode.el (c-fl-decl-start): When we encounter a protection
keyword following a semicolon or brace, move forward over it before attempting
to parse a type.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r-- | lisp/progmodes/cc-langs.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index ef6b88c3727..7a285f93d34 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -2284,6 +2284,18 @@ one of `c-type-list-kwds', `c-ref-list-kwds', c++ '("private" "protected" "public") objc '("@private" "@protected" "@public")) +(c-lang-defconst c-protection-key + ;; A regexp match an element of `c-protection-kwds' cleanly. + t (c-make-keywords-re t (c-lang-const c-protection-kwds))) +(c-lang-defvar c-protection-key (c-lang-const c-protection-key)) + +(c-lang-defconst c-post-protection-token + "The token which (may) follow a protection keyword, +e.g. the \":\" in C++ Mode's \"public:\". nil if there is no such token." + t nil + c++ ":") +(c-lang-defvar c-post-protection-token (c-lang-const c-post-protection-token)) + (c-lang-defconst c-block-decls-with-vars "Keywords introducing declarations that can contain a block which might be followed by variable declarations, e.g. like \"foo\" in |