diff options
author | Alan Mackenzie <acm@muc.de> | 2016-01-23 19:38:49 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2016-01-23 19:38:49 +0000 |
commit | a1865bcf966eafdce28f50fb8a19c1bfd831079a (patch) | |
tree | dcb1e7f0a1d41a1328e0e3d2a1649f31dfd9488f | |
parent | 76045f7d6f654ea20e09412e5054f9159d1bb142 (diff) | |
download | emacs-a1865bcf966eafdce28f50fb8a19c1bfd831079a.tar.gz |
Distinguish the two meanings of Java's keyword "default". Fixes bug #22358.
* lisp/progmodes/cc-engine.el (c-guess-basic-syntax CASE 14): Check the
context of case labels (including "default") more rigorously.
(c-guess-basic-syntax CASE 15): Consequential amendment.
* lisp/progmodes/cc-langs.el (c-modifier-kwds): Add "default" to Java's value.
-rw-r--r-- | lisp/progmodes/cc-engine.el | 15 | ||||
-rw-r--r-- | lisp/progmodes/cc-langs.el | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 8113446e4d3..815bd7216f2 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10072,7 +10072,19 @@ comment at the start of cc-engine.el for more info." paren-state))) ;; CASE 14: A case or default label - ((looking-at c-label-kwds-regexp) + ((save-excursion + (and (looking-at c-label-kwds-regexp) + (or (c-major-mode-is 'idl-mode) + (and + containing-sexp + (goto-char containing-sexp) + (eq (char-after) ?{) + (progn (c-backward-syntactic-ws) t) + (eq (char-before) ?\)) + (c-go-list-backward) + (progn (c-backward-syntactic-ws) t) + (c-simple-skip-symbol-backward) + (looking-at c-block-stmt-2-key))))) (if containing-sexp (progn (goto-char containing-sexp) @@ -10088,6 +10100,7 @@ comment at the start of cc-engine.el for more info." ((save-excursion (back-to-indentation) (and (not (looking-at c-syntactic-ws-start)) + (not (looking-at c-label-kwds-regexp)) (c-forward-label))) (cond (containing-decl-open (setq placeholder (c-add-class-syntax 'inclass diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 48dd9960886..8a1d43c627c 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1980,8 +1980,8 @@ will be handled." ;; In CORBA CIDL: "bindsTo" "delegatesTo" "implements" "proxy" "storedOn") ;; Note: "const" is not used in Java, but it's still a reserved keyword. - java '("abstract" "const" "final" "native" "private" "protected" "public" - "static" "strictfp" "synchronized" "transient" "volatile") + java '("abstract" "const" "default" "final" "native" "private" "protected" + "public" "static" "strictfp" "synchronized" "transient" "volatile") pike '("final" "inline" "local" "nomask" "optional" "private" "protected" "public" "static" "variant")) |