]> git.eshelyaron.com Git - emacs.git/commitdiff
C++ Mode: recognize brace blocks without the hitherto required = sign
authorAlan Mackenzie <acm@muc.de>
Fri, 3 Apr 2020 20:37:31 +0000 (20:37 +0000)
committerAlan Mackenzie <acm@muc.de>
Fri, 3 Apr 2020 20:37:31 +0000 (20:37 +0000)
* lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): Add code
to recognize a literal brace expression following an array declaration for
C++.
(c-looking-at-inexpr-block): Replace c-symbol-chars with c-symbol-char-key,
fixing a coding error.

lisp/progmodes/cc-engine.el

index bccef6890f87984cdaf482b7bb58dfdd6a06ab0d..aa3f7d399e9abb5cc097f0db219d6bcacee21af9 100644 (file)
@@ -11685,7 +11685,16 @@ comment at the start of cc-engine.el for more info."
                                     (not (c-in-literal))
                                     ))))
                           nil)
-                         (t t))))))
+                         (t t)))))
+               ((and
+                 (c-major-mode-is 'c++-mode)
+                 (eq (char-after) ?\[)
+                ;; Be careful of "operator []"
+                 (not (save-excursion
+                        (c-backward-token-2 1 nil lim)
+                        (looking-at c-opt-op-identifier-prefix))))
+                (setq braceassignp t)
+                nil))
          (when (eq braceassignp 'dontknow)
            (cond ((and
                    (not (eq (char-after) ?,))
@@ -12057,7 +12066,7 @@ comment at the start of cc-engine.el for more info."
                         (c-backward-token-2 1 nil lim)
                         (and
                          (not (and (c-on-identifier)
-                                   (looking-at c-symbol-chars)))
+                                   (looking-at c-symbol-char-key)))
                          (not (looking-at c-opt-op-identifier-prefix)))))))
            (cons 'inlambda bracket-pos))
           ((and c-recognize-paren-inexpr-blocks