Commit 8e292700 authored by Alan Mackenzie's avatar Alan Mackenzie
Browse files

Distinguish the two meanings of Java's keyword "default". Fixes bug #22358.

* 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.

* cc-langs.el (c-modifier-kwds): Add "default" to Java's value.
parent 6ba14afdd5d2
......@@ -9955,7 +9955,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)
......@@ -9971,6 +9983,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
......
......@@ -1891,8 +1891,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"))
......
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