Commit 38de11bd authored by Alan Mackenzie's avatar Alan Mackenzie
Browse files

Fix indentation/fontification of Java enum with "implements".

* progmodes/cc-langs.el (c-postfix-decl-spec-key): New variable, a
regexp which matches "implements", etc., in Java.
* progmodes/cc-engine.el (c-inside-bracelist-p): Check for extra
specifier clauses coming after "enum".
* progmodes/cc-fonts.el (c-font-lock-declarations)
(c-font-lock-enum-tail): Check for extra specifier clauses coming
after "enum".
parent 1610938f
2013-09-28 Alan Mackenzie <acm@muc.de>
Fix indentation/fontification of Java enum with "implements".
* progmodes/cc-langs.el (c-postfix-decl-spec-key): New variable, a
regexp which matches "implements", etc., in Java.
* progmodes/cc-engine.el (c-inside-bracelist-p): Check for extra
specifier clauses coming after "enum".
* progmodes/cc-fonts.el (c-font-lock-declarations)
(c-font-lock-enum-tail): Check for extra specifier clauses coming
after "enum".
2013-09-28 Jan Djärv <jan.h.d@swipnet.se>
* faces.el (region): Change ns_selection_color to
......
......@@ -8486,17 +8486,21 @@ comment at the start of cc-engine.el for more info."
(or
;; This will pick up brace list declarations.
(c-safe
(save-excursion
(goto-char containing-sexp)
(c-forward-sexp -1)
(let (bracepos)
(if (and (or (looking-at c-brace-list-key)
(progn (c-forward-sexp -1)
(looking-at c-brace-list-key)))
(setq bracepos (c-down-list-forward (point)))
(not (c-crosses-statement-barrier-p (point)
(- bracepos 2))))
(point)))))
(save-excursion
(goto-char containing-sexp)
(let (before-identifier)
(while
(progn
(c-forward-sexp -1)
(cond
((c-on-identifier) (setq before-identifier t))
((and before-identifier
(looking-at c-postfix-decl-spec-key))
(setq before-identifier nil)
t)
((looking-at c-brace-list-key) nil)
(t nil))))
(looking-at c-brace-list-key))))
;; this will pick up array/aggregate init lists, even if they are nested.
(save-excursion
(let ((class-key
......
......@@ -1471,13 +1471,22 @@ casts and declarations are fontified. Used on level 2 and higher."
(let ((paren-state (c-parse-state)))
(and
(numberp (car paren-state))
(save-excursion
(goto-char (car paren-state))
(c-backward-token-2)
(or (looking-at c-brace-list-key)
(progn
(c-backward-token-2)
(looking-at c-brace-list-key)))))))
(c-safe
(save-excursion
(goto-char (car paren-state))
(let (before-identifier)
(while
(progn
(c-forward-sexp -1)
(cond
((c-on-identifier) (setq before-identifier t))
((and before-identifier
(looking-at c-postfix-decl-spec-key))
(setq before-identifier nil)
t)
((looking-at c-brace-list-key) nil) ; "enum"
(t nil))))
(looking-at c-brace-list-key)))))))
(c-forward-token-2)
nil)
......@@ -1565,14 +1574,22 @@ casts and declarations are fontified. Used on level 2 and higher."
(when (and
encl-pos
(eq (char-after encl-pos) ?\{)
(save-excursion
(goto-char encl-pos)
(c-backward-syntactic-ws)
(c-simple-skip-symbol-backward)
(or (looking-at c-brace-list-key) ; "enum"
(progn (c-backward-syntactic-ws)
(c-simple-skip-symbol-backward)
(looking-at c-brace-list-key)))))
(c-safe
(save-excursion
(goto-char encl-pos)
(let (before-identifier)
(while
(progn
(c-forward-sexp -1)
(cond
((c-on-identifier) (setq before-identifier t))
((and before-identifier
(looking-at c-postfix-decl-spec-key))
(setq before-identifier nil)
t)
((looking-at c-brace-list-key) nil) ; "enum"
(t nil))))
(looking-at c-brace-list-key)))))
(c-syntactic-skip-backward "^{," nil t)
(c-put-char-property (1- (point)) 'c-type 'c-decl-id-start)
......
......@@ -2040,6 +2040,12 @@ declarations."
;; In CORBA PSDL:
"as" "const" "implements" "of" "ref"))
(c-lang-defconst c-postfix-decl-spec-key
;; Regexp matching the keywords in `c-postfix-decl-spec-kwds'.
t (c-make-keywords-re t (c-lang-const c-postfix-decl-spec-kwds)))
(c-lang-defvar c-postfix-decl-spec-key
(c-lang-const c-postfix-decl-spec-key))
(c-lang-defconst c-nonsymbol-sexp-kwds
"Keywords that may be followed by a nonsymbol sexp before whatever
construct it's part of continues."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment