]> code.delx.au - gnu-emacs/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)
committerAlan Mackenzie <acm@muc.de>
Fri, 15 Jan 2016 21:15:20 +0000 (21:15 +0000)
* 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
lisp/progmodes/cc-langs.el

index b08c555e34f3f907db127c50053e4385d8b04f2f..63f018298453d75ac6584a57be24d07a5a8dd698 100644 (file)
@@ -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)))
index b52da3f662d1e5474095254904e3a0099cfb2951..48dd99608867bbc8fe24ec3a3517bde3a74f485b 100644 (file)
@@ -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.