c-forward-<>-arglist no longer directly applies face properties in Java Mode.
This allows the calling of c-restore-<>-properties from c-common-init without the test suite giving spurious errors. * lisp/progmodes/cc-engine.el (c-forward-<>-arglist): Remove the form that sets face properties. (c-forward-<>-arglist-recur): Reformulate the bit that handles types inside template brackets using c-inside-<>-type-key. Don't bind c-record-type-identifiers or c-record-found-types around the recursive call, allowing positions of found types to flow back to the caller. * lisp/progmodes/cc-langs.el (c-inside-<>-type-kwds, c-inside-<>-type-key): new lang consts/var. * lisp/progmodes/cc-mode.el (c-common-init): Don't remove c-restore-<>-properties from the list of functions called at mode initialization.
This commit is contained in:
parent
ff9de7b38a
commit
db2ee1cd63
3 changed files with 33 additions and 25 deletions
|
@ -6026,7 +6026,6 @@ comment at the start of cc-engine.el for more info."
|
|||
;; `nconc' doesn't mind that the tail of
|
||||
;; `c-record-found-types' is t.
|
||||
(nconc c-record-found-types c-record-type-identifiers)))
|
||||
(if (c-major-mode-is 'java-mode) (c-fontify-recorded-types-and-refs))
|
||||
t)
|
||||
|
||||
(goto-char start)
|
||||
|
@ -6072,28 +6071,31 @@ comment at the start of cc-engine.el for more info."
|
|||
(progn
|
||||
(c-forward-syntactic-ws)
|
||||
(when (or (and c-record-type-identifiers all-types)
|
||||
(c-major-mode-is 'java-mode))
|
||||
;; All encountered identifiers are types, so set the
|
||||
;; promote flag and parse the type.
|
||||
(progn
|
||||
(c-forward-syntactic-ws)
|
||||
(if (looking-at "\\?")
|
||||
(forward-char)
|
||||
(when (looking-at c-identifier-start)
|
||||
(not (equal c-inside-<>-type-key "\\(\\<\\>\\)")))
|
||||
(c-forward-syntactic-ws)
|
||||
(cond
|
||||
((eq (char-after) ??)
|
||||
(forward-char))
|
||||
((and (looking-at c-identifier-start)
|
||||
(not (looking-at c-keywords-regexp)))
|
||||
(if (or (and all-types c-record-type-identifiers)
|
||||
(c-major-mode-is 'java-mode))
|
||||
;; All encountered identifiers are types, so set the
|
||||
;; promote flag and parse the type.
|
||||
(let ((c-promote-possible-types t)
|
||||
(c-record-found-types t))
|
||||
(c-forward-type))))
|
||||
(c-forward-type))
|
||||
(c-forward-token-2))))
|
||||
|
||||
(c-forward-syntactic-ws)
|
||||
|
||||
(when (looking-at c-inside-<>-type-key)
|
||||
(goto-char (match-end 1))
|
||||
(c-forward-syntactic-ws)
|
||||
|
||||
(when (or (looking-at "extends")
|
||||
(looking-at "super"))
|
||||
(forward-word-strictly)
|
||||
(c-forward-syntactic-ws)
|
||||
(let ((c-promote-possible-types t)
|
||||
(c-record-found-types t))
|
||||
(c-forward-type)
|
||||
(c-forward-syntactic-ws)))))
|
||||
(let ((c-promote-possible-types t)
|
||||
(c-record-found-types t))
|
||||
(c-forward-type))
|
||||
(c-forward-syntactic-ws)))
|
||||
|
||||
(setq pos (point)) ; e.g. first token inside the '<'
|
||||
|
||||
|
@ -6414,9 +6416,7 @@ comment at the start of cc-engine.el for more info."
|
|||
((and c-recognize-<>-arglists
|
||||
(eq (char-after) ?<))
|
||||
;; Maybe an angle bracket arglist.
|
||||
(when (let ((c-record-type-identifiers t)
|
||||
(c-record-found-types t)
|
||||
(c-last-identifier-range))
|
||||
(when (let (c-last-identifier-range)
|
||||
(c-forward-<>-arglist nil))
|
||||
|
||||
(c-forward-syntactic-ws)
|
||||
|
|
|
@ -2310,6 +2310,15 @@ assumed to be set if this isn't nil."
|
|||
t (c-make-keywords-re t (c-lang-const c-<>-sexp-kwds)))
|
||||
(c-lang-defvar c-opt-<>-sexp-key (c-lang-const c-opt-<>-sexp-key))
|
||||
|
||||
(c-lang-defconst c-inside-<>-type-kwds
|
||||
"Keywords which, used inside a C++ style template arglist, introduce a type."
|
||||
t nil
|
||||
java '("extends" "super"))
|
||||
|
||||
(c-lang-defconst c-inside-<>-type-key
|
||||
t (c-make-keywords-re t (c-lang-const c-inside-<>-type-kwds)))
|
||||
(c-lang-defvar c-inside-<>-type-key (c-lang-const c-inside-<>-type-key))
|
||||
|
||||
(c-lang-defconst c-brace-id-list-kwds
|
||||
"Keywords that may be followed by a brace block containing a comma
|
||||
separated list of identifier definitions, i.e. like the list of
|
||||
|
|
|
@ -686,9 +686,8 @@ compatible with old code; callers should always specify it."
|
|||
(funcall fn (point-min) (point-max)))
|
||||
c-get-state-before-change-functions)
|
||||
(mapc (lambda (fn)
|
||||
(if (not (eq fn 'c-restore-<>-properties))
|
||||
(funcall fn (point-min) (point-max)
|
||||
(- (point-max) (point-min)))))
|
||||
(funcall fn (point-min) (point-max)
|
||||
(- (point-max) (point-min))))
|
||||
c-before-font-lock-functions))))
|
||||
|
||||
(set (make-local-variable 'outline-regexp) "[^#\n\^M]")
|
||||
|
|
Loading…
Add table
Reference in a new issue