]> git.eshelyaron.com Git - emacs.git/commitdiff
Correctly fontify Java class constructors.
authorAlan Mackenzie <acm@muc.de>
Sat, 7 Sep 2013 14:33:50 +0000 (14:33 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 7 Sep 2013 14:33:50 +0000 (14:33 +0000)
* progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")"
in Java Mode.
(c-recognize-typeless-decls): Set the Java value to t.
* progmodes/cc-engine.el (c-forward-decl-or-cast-1): While
handling a "(", add a check for, effectively, Java, and handle a
"typeless" declaration there.

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

index 5e4c11d5cfb50d80dff4ec8b9384d0a8ce5a0dda..7803db1d1ee0466e8ec4fbe95787ce50633bae81 100644 (file)
@@ -1,3 +1,13 @@
+2013-09-07  Alan Mackenzie  <acm@muc.de>
+
+       Correctly fontify Java class constructors.
+       * progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")"
+       in Java Mode.
+       (c-recognize-typeless-decls): Set the Java value to t.
+       * progmodes/cc-engine.el (c-forward-decl-or-cast-1): While
+       handling a "(", add a check for, effectively, Java, and handle a
+       "typeless" declaration there.
+
 2013-09-07  Roland Winkler  <winkler@gnu.org>
 
        * textmodes/bibtex.el (bibtex-biblatex-entry-alist): Add optional
index db2a6c68539667195cdef179f9de72b0651ba6d2..c8a9c461a9db81a1ce853cff4aac67ed41f042a9 100644 (file)
@@ -6905,32 +6905,38 @@ comment at the start of cc-engine.el for more info."
 
       ;; Skip over type decl prefix operators.  (Note similar code in
       ;; `c-font-lock-declarators'.)
-      (while (and (looking-at c-type-decl-prefix-key)
-                 (if (and (c-major-mode-is 'c++-mode)
-                          (match-beginning 3))
-                     ;; If the third submatch matches in C++ then
-                     ;; we're looking at an identifier that's a
-                     ;; prefix only if it specifies a member pointer.
-                     (when (setq got-identifier (c-forward-name))
-                       (if (looking-at "\\(::\\)")
-                           ;; We only check for a trailing "::" and
-                           ;; let the "*" that should follow be
-                           ;; matched in the next round.
-                           (progn (setq got-identifier nil) t)
-                         ;; It turned out to be the real identifier,
-                         ;; so stop.
-                         nil))
-                   t))
-
-       (if (eq (char-after) ?\()
+      (if (and c-recognize-typeless-decls
+              (equal c-type-decl-prefix-key "\\<\\>"))
+         (when (eq (char-after) ?\()
            (progn
              (setq paren-depth (1+ paren-depth))
-             (forward-char))
-         (unless got-prefix-before-parens
-           (setq got-prefix-before-parens (= paren-depth 0)))
-         (setq got-prefix t)
-         (goto-char (match-end 1)))
-       (c-forward-syntactic-ws))
+             (forward-char)))
+       (while (and (looking-at c-type-decl-prefix-key)
+                   (if (and (c-major-mode-is 'c++-mode)
+                            (match-beginning 3))
+                       ;; If the third submatch matches in C++ then
+                       ;; we're looking at an identifier that's a
+                       ;; prefix only if it specifies a member pointer.
+                       (when (setq got-identifier (c-forward-name))
+                         (if (looking-at "\\(::\\)")
+                             ;; We only check for a trailing "::" and
+                             ;; let the "*" that should follow be
+                             ;; matched in the next round.
+                             (progn (setq got-identifier nil) t)
+                           ;; It turned out to be the real identifier,
+                           ;; so stop.
+                           nil))
+                     t))
+
+         (if (eq (char-after) ?\()
+             (progn
+               (setq paren-depth (1+ paren-depth))
+               (forward-char))
+           (unless got-prefix-before-parens
+             (setq got-prefix-before-parens (= paren-depth 0)))
+           (setq got-prefix t)
+           (goto-char (match-end 1)))
+         (c-forward-syntactic-ws)))
 
       (setq got-parens (> paren-depth 0))
 
index 0116e9ec3ddcd224a51d171a1e798853cf3cf3df..80e6189822b135a35b8dbd87609a5dab046ca54b 100644 (file)
@@ -2816,7 +2816,8 @@ is in effect when this is matched (see `c-identifier-syntax-table')."
                     "\\>")
                  "")
                "\\)")
-  (java idl) "\\([\[\(]\\)")
+  java "\\([\[\(\)]\\)"
+  idl "\\([\[\(]\\)")
 (c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key)
   'dont-doc)
 
@@ -2937,7 +2938,7 @@ calls before a brace block.  This setting does not affect declarations
 that are preceded by a declaration starting keyword, so
 e.g. `c-typeless-decl-kwds' may still be used when it's set to nil."
   t nil
-  (c c++ objc) t)
+  (c c++ objc java) t)
 (c-lang-defvar c-recognize-typeless-decls
   (c-lang-const c-recognize-typeless-decls))