emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 9e5452f: Don't confuse "::" with ":" when trying


From: Alan Mackenzie
Subject: [Emacs-diffs] emacs-25 9e5452f: Don't confuse "::" with ":" when trying to parse member initializers.
Date: Fri, 15 Jan 2016 21:15:13 +0000

branch: emacs-25
commit 9e5452f7166e3634f2d8e943815ed722e1672714
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Don't confuse "::" with ":" when trying to parse member initializers.
    
    * lisp/progmodes/cc-engine.el (c-back-over-member-initializers): Check
    more robustly for ":" token when searching backwards for it.
    
    * lisp/progmodes/cc-langs (c-:$-multichar-token-regexp): New language
    variable.
---
 lisp/progmodes/cc-engine.el |    6 ++++++
 lisp/progmodes/cc-langs.el  |    8 ++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index b08c555..63f0182 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6739,6 +6739,9 @@ comment at the start of cc-engine.el for more info."
                      (c-backward-syntactic-ws))
                    (c-back-over-list-of-member-inits)
                    (and (eq (char-before) ?:)
+                        (save-excursion
+                          (c-backward-token-2)
+                          (not (looking-at c-:$-multichar-token-regexp)))
                         (c-just-after-func-arglist-p))))
 
            (while (and (not (and level-plausible
@@ -6753,6 +6756,9 @@ comment at the start of cc-engine.el for more info."
                      (c-backward-syntactic-ws)
                      (c-back-over-list-of-member-inits)
                      (and (eq (char-before) ?:)
+                          (save-excursion
+                            (c-backward-token-2)
+                            (not (looking-at c-:$-multichar-token-regexp)))
                           (c-just-after-func-arglist-p)))))
 
            (and at-top-level level-plausible)))
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index b52da3f..48dd996 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1219,6 +1219,14 @@ operators."
 (c-lang-defvar c-assignment-op-regexp
   (c-lang-const c-assignment-op-regexp))
 
+(c-lang-defconst c-:$-multichar-token-regexp
+  ;; Regexp matching all tokens ending in ":" which are longer than one char.
+  ;; Currently (2016-01-07) only used in C++ Mode.
+  t (c-make-keywords-re nil
+      (c-filter-ops (c-lang-const c-operators) t ".+:$")))
+(c-lang-defvar c-:$-multichar-token-regexp
+  (c-lang-const c-:$-multichar-token-regexp))
+
 (c-lang-defconst c-<>-multichar-token-regexp
   ;; Regexp matching all tokens containing "<" or ">" which are longer
   ;; than one char.



reply via email to

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