aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/cc-engine.el
diff options
context:
space:
mode:
authorAlan Mackenzie2013-09-07 14:33:50 +0000
committerAlan Mackenzie2013-09-07 14:33:50 +0000
commite8dd0787d9c19e81344552d185e9008031f58723 (patch)
tree5362b43c9e443f32fbeb9659dd4a353c656d78f9 /lisp/progmodes/cc-engine.el
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.
Diffstat (limited to 'lisp/progmodes/cc-engine.el')
-rw-r--r--lisp/progmodes/cc-engine.el54
1 files changed, 30 insertions, 24 deletions
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