aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2013-09-07 14:33:50 +0000
committerAlan Mackenzie2013-09-07 14:33:50 +0000
commite8dd0787d9c19e81344552d185e9008031f58723 (patch)
tree5362b43c9e443f32fbeb9659dd4a353c656d78f9
parent1db9ceee691bdc46b2103ae8bbd265b720babdc4 (diff)
downloademacs-e8dd0787d9c19e81344552d185e9008031f58723.tar.gz
emacs-e8dd0787d9c19e81344552d185e9008031f58723.zip
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.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/progmodes/cc-engine.el54
-rw-r--r--lisp/progmodes/cc-langs.el5
3 files changed, 43 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5e4c11d5cfb..7803db1d1ee 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12013-09-07 Alan Mackenzie <acm@muc.de>
2
3 Correctly fontify Java class constructors.
4 * progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")"
5 in Java Mode.
6 (c-recognize-typeless-decls): Set the Java value to t.
7 * progmodes/cc-engine.el (c-forward-decl-or-cast-1): While
8 handling a "(", add a check for, effectively, Java, and handle a
9 "typeless" declaration there.
10
12013-09-07 Roland Winkler <winkler@gnu.org> 112013-09-07 Roland Winkler <winkler@gnu.org>
2 12
3 * textmodes/bibtex.el (bibtex-biblatex-entry-alist): Add optional 13 * textmodes/bibtex.el (bibtex-biblatex-entry-alist): Add optional
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index db2a6c68539..c8a9c461a9d 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6905,32 +6905,38 @@ comment at the start of cc-engine.el for more info."
6905 6905
6906 ;; Skip over type decl prefix operators. (Note similar code in 6906 ;; Skip over type decl prefix operators. (Note similar code in
6907 ;; `c-font-lock-declarators'.) 6907 ;; `c-font-lock-declarators'.)
6908 (while (and (looking-at c-type-decl-prefix-key) 6908 (if (and c-recognize-typeless-decls
6909 (if (and (c-major-mode-is 'c++-mode) 6909 (equal c-type-decl-prefix-key "\\<\\>"))
6910 (match-beginning 3)) 6910 (when (eq (char-after) ?\()
6911 ;; If the third submatch matches in C++ then
6912 ;; we're looking at an identifier that's a
6913 ;; prefix only if it specifies a member pointer.
6914 (when (setq got-identifier (c-forward-name))
6915 (if (looking-at "\\(::\\)")
6916 ;; We only check for a trailing "::" and
6917 ;; let the "*" that should follow be
6918 ;; matched in the next round.
6919 (progn (setq got-identifier nil) t)
6920 ;; It turned out to be the real identifier,
6921 ;; so stop.
6922 nil))
6923 t))
6924
6925 (if (eq (char-after) ?\()
6926 (progn 6911 (progn
6927 (setq paren-depth (1+ paren-depth)) 6912 (setq paren-depth (1+ paren-depth))
6928 (forward-char)) 6913 (forward-char)))
6929 (unless got-prefix-before-parens 6914 (while (and (looking-at c-type-decl-prefix-key)
6930 (setq got-prefix-before-parens (= paren-depth 0))) 6915 (if (and (c-major-mode-is 'c++-mode)
6931 (setq got-prefix t) 6916 (match-beginning 3))
6932 (goto-char (match-end 1))) 6917 ;; If the third submatch matches in C++ then
6933 (c-forward-syntactic-ws)) 6918 ;; we're looking at an identifier that's a
6919 ;; prefix only if it specifies a member pointer.
6920 (when (setq got-identifier (c-forward-name))
6921 (if (looking-at "\\(::\\)")
6922 ;; We only check for a trailing "::" and
6923 ;; let the "*" that should follow be
6924 ;; matched in the next round.
6925 (progn (setq got-identifier nil) t)
6926 ;; It turned out to be the real identifier,
6927 ;; so stop.
6928 nil))
6929 t))
6930
6931 (if (eq (char-after) ?\()
6932 (progn
6933 (setq paren-depth (1+ paren-depth))
6934 (forward-char))
6935 (unless got-prefix-before-parens
6936 (setq got-prefix-before-parens (= paren-depth 0)))
6937 (setq got-prefix t)
6938 (goto-char (match-end 1)))
6939 (c-forward-syntactic-ws)))
6934 6940
6935 (setq got-parens (> paren-depth 0)) 6941 (setq got-parens (> paren-depth 0))
6936 6942
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 0116e9ec3dd..80e6189822b 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -2816,7 +2816,8 @@ is in effect when this is matched (see `c-identifier-syntax-table')."
2816 "\\>") 2816 "\\>")
2817 "") 2817 "")
2818 "\\)") 2818 "\\)")
2819 (java idl) "\\([\[\(]\\)") 2819 java "\\([\[\(\)]\\)"
2820 idl "\\([\[\(]\\)")
2820(c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key) 2821(c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key)
2821 'dont-doc) 2822 'dont-doc)
2822 2823
@@ -2937,7 +2938,7 @@ calls before a brace block. This setting does not affect declarations
2937that are preceded by a declaration starting keyword, so 2938that are preceded by a declaration starting keyword, so
2938e.g. `c-typeless-decl-kwds' may still be used when it's set to nil." 2939e.g. `c-typeless-decl-kwds' may still be used when it's set to nil."
2939 t nil 2940 t nil
2940 (c c++ objc) t) 2941 (c c++ objc java) t)
2941(c-lang-defvar c-recognize-typeless-decls 2942(c-lang-defvar c-recognize-typeless-decls
2942 (c-lang-const c-recognize-typeless-decls)) 2943 (c-lang-const c-recognize-typeless-decls))
2943 2944