]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't confuse "::" with ":" when trying to parse member initializers.
authorAlan Mackenzie <acm@muc.de>
Fri, 15 Jan 2016 21:15:20 +0000 (21:15 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 22 Mar 2016 00:05:55 +0000 (17:05 -0700)
* 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.

[This reapplies commit 9e5452f7166e3634f2d8e943815ed722e1672714,
which was inadvertently lost by merge commit
7823745acbe9b87eea2db4ef434e379fc903ec35.]

lisp/progmodes/cc-engine.el
lisp/progmodes/cc-langs.el

index 66b5369bbba8cea755c53a0445744291f9ff4c2f..06e11b25d209ecfd68418aa9c33d8cef267dc750 100644 (file)
@@ -6798,6 +6798,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
@@ -6812,6 +6815,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)))
index d212482790d00eabf74e0ac8d2b036d42057802e..7a8213bf6cacce598e4f56d8c7b77e3d1e89e93b 100644 (file)
@@ -1230,6 +1230,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.