[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 3be326e: Parse compound identifiers in C++ member i
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master 3be326e: Parse compound identifiers in C++ member initialization lists. |
Date: |
Wed, 15 Jun 2016 16:00:18 +0000 (UTC) |
branch: master
commit 3be326e8e50e296ebd6ed116b5e5b7b54267b087
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
Parse compound identifiers in C++ member initialization lists.
* lisp/progmodes/cc-engine.el (c-back-over-compound-identifier): New
function.
(c-back-over-member-initializer-braces, c-back-over-list-of-member-inits)
(c-back-over-member-initializers): Call c-back-over-compound-identifier
rather
than c-simple-skip-symbol-backward.
---
lisp/progmodes/cc-engine.el | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 7c77b70..32eca3e 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -7128,6 +7128,31 @@ comment at the start of cc-engine.el for more info."
(prog1 (car ,ps)
(setq ,ps (cdr ,ps)))))
+(defun c-back-over-compound-identifier ()
+ ;; Point is putatively just after a "compound identifier", i.e. something
+ ;; looking (in C++) like this "FQN::of::base::Class". Move to the start of
+ ;; this construct and return t. If the parsing fails, return nil, leaving
+ ;; point unchanged.
+ (let ((here (point))
+ end
+ )
+ (if (not (c-simple-skip-symbol-backward))
+ nil
+ (while
+ (progn
+ (setq end (point))
+ (c-backward-syntactic-ws)
+ (c-backward-token-2)
+ (and
+ c-opt-identifier-concat-key
+ (looking-at c-opt-identifier-concat-key)
+ (progn
+ (c-backward-syntactic-ws)
+ (c-simple-skip-symbol-backward))))
+ (setq end (point)))
+ (goto-char end)
+ t)))
+
(defun c-back-over-member-initializer-braces ()
;; Point is just after a closing brace/parenthesis. Try to parse this as a
;; C++ member initializer list, going back to just after the introducing ":"
@@ -7138,7 +7163,7 @@ comment at the start of cc-engine.el for more info."
(when (not (c-go-list-backward))
(throw 'done nil))
(c-backward-syntactic-ws)
- (when (not (c-simple-skip-symbol-backward))
+ (when (not (c-back-over-compound-identifier))
(throw 'done nil))
(c-backward-syntactic-ws)
@@ -7150,7 +7175,7 @@ comment at the start of cc-engine.el for more info."
(when (not (c-go-list-backward))
(throw 'done nil))
(c-backward-syntactic-ws)
- (when (not (c-simple-skip-symbol-backward))
+ (when (not (c-back-over-compound-identifier))
(throw 'done nil))
(c-backward-syntactic-ws))
@@ -7174,7 +7199,7 @@ comment at the start of cc-engine.el for more info."
(when (not (c-go-list-backward))
(throw 'done nil))
(c-backward-syntactic-ws)
- (when (not (c-simple-skip-symbol-backward))
+ (when (not (c-back-over-compound-identifier))
(throw 'level nil))
(c-backward-syntactic-ws)))
@@ -7196,7 +7221,7 @@ comment at the start of cc-engine.el for more info."
(when (not (c-go-list-backward))
(throw 'done nil))
(c-backward-syntactic-ws))
- (when (c-simple-skip-symbol-backward)
+ (when (c-back-over-compound-identifier)
(c-backward-syntactic-ws))
(c-back-over-list-of-member-inits)
(and (eq (char-before) ?:)
@@ -7212,7 +7237,7 @@ comment at the start of cc-engine.el for more info."
(catch 'level
(goto-char pos)
(c-backward-syntactic-ws)
- (when (not (c-simple-skip-symbol-backward))
+ (when (not (c-back-over-compound-identifier))
(throw 'level nil))
(c-backward-syntactic-ws)
(c-back-over-list-of-member-inits)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 3be326e: Parse compound identifiers in C++ member initialization lists.,
Alan Mackenzie <=