emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master f9694a7: Implement "final" before C++ class inherit


From: Alan Mackenzie
Subject: [Emacs-diffs] master f9694a7: Implement "final" before C++ class inheritance lists.
Date: Sat, 13 Apr 2019 09:32:19 -0400 (EDT)

branch: master
commit f9694a713824d402bcba01064ac2f95156bf4161
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Implement "final" before C++ class inheritance lists.
    
    * lisp/progmodes/cc-langs.el (c-class-id-suffix-ws-ids-kwds)
    (c-class-id-suffix-ws-ids-key): New lang const/var.
    
    * lisp/progmodes/cc-engine.el (c-guess-basic-syntax CASE 5D.4): Check for 
and
    skip over any matches for c-class-id-suffix-ws-ids-key (i.e. "final") before
    ":".
---
 lisp/progmodes/cc-engine.el |  7 +++++++
 lisp/progmodes/cc-langs.el  | 13 +++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index fc8c377..f0b44d2 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -12734,6 +12734,13 @@ comment at the start of cc-engine.el for more info."
                        (if (eq (char-after) ?<)
                            (zerop (c-forward-token-2 1 t indent-point))
                          t)
+                       (progn
+                         (while
+                             (and
+                              (< (point) indent-point)
+                              (looking-at c-class-id-suffix-ws-ids-key)
+                              (zerop (c-forward-token-2 1 nil indent-point))))
+                         t)
                        (eq (char-after) ?:))))
            (goto-char placeholder)
            (c-add-syntax 'inher-cont (c-point 'boi)))
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 2dff5cf..b5c3ff3 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -2049,6 +2049,19 @@ effect in the declaration, but are syntactically like 
whitespace."
 (c-lang-defvar c-type-decl-suffix-ws-ids-key
   (c-lang-const c-type-decl-suffix-ws-ids-key))
 
+(c-lang-defconst c-class-id-suffix-ws-ids-kwds
+  "\"Identifiers\" that when immediately following the identifier
+of a class declaration have semantic effect in the declaration,
+but are syntactially like whitespace."
+  t    nil
+  c++ '("final"))
+
+(c-lang-defconst c-class-id-suffix-ws-ids-key
+  ;; An adorned regexp matching `c-class-id-suffix-ws-ids-kwds'.
+  t (c-make-keywords-re t (c-lang-const c-class-id-suffix-ws-ids-kwds)))
+(c-lang-defvar c-class-id-suffix-ws-ids-key
+  (c-lang-const c-class-id-suffix-ws-ids-key))
+
 (c-lang-defconst c-class-decl-kwds
   "Keywords introducing declarations where the following block (if any)
 contains another declaration level that should be considered a class.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]