nil
(and (looking-at c-keywords-regexp)
(c-forward-keyword-clause 1))))
- (when (memq res '(t known found prefix))
- ,(when (eq type 'ref)
- `(when c-record-type-identifiers
- (c-record-ref-id c-last-identifier-range)))
+ (when (memq res '(t known found prefix maybe))
+ (when c-record-type-identifiers
+ ,(if (eq type 'type)
+ `(c-record-type-id c-last-identifier-range)
+ `(c-record-ref-id c-last-identifier-range)))
t)))
(defmacro c-forward-id-comma-list (type update-safe-pos)
(eq (char-after) ?<))
;; Maybe an angle bracket arglist.
(when (let ((c-record-type-identifiers t)
- (c-record-found-types t))
+ (c-record-found-types t)
+ (c-last-identifier-range))
(c-forward-<>-arglist nil))
- (c-add-type start (1+ pos))
(c-forward-syntactic-ws)
- (setq pos (point)
- c-last-identifier-range nil)
+ (unless (eq (char-after) ?\()
+ (setq c-last-identifier-range nil)
+ (c-add-type start (1+ pos)))
+ (setq pos (point))
(if (and c-opt-identifier-concat-key
(looking-at c-opt-identifier-concat-key))
(c-forward-syntactic-ws)
t)
- (when (and c-record-type-identifiers id-start)
+ (when (and c-record-type-identifiers id-start
+ (not (eq (char-after) ?\()))
(c-record-type-id (cons id-start id-end)))
(setq res 'template)
nil)))
;; It's an identifier that might be a type.
'maybe))))
((eq name-res 'template)
- ;; A template is a type.
+ ;; A template is sometimes a type.
(goto-char id-end)
- (setq res t))
+ (c-forward-syntactic-ws)
+ (setq res
+ (if (eq (char-after) ?\()
+ (if (c-check-type id-start id-end)
+ ;; It's an identifier that has been used as
+ ;; a type somewhere else.
+ 'found
+ ;; It's an identifier that might be a type.
+ 'maybe)
+ t)))
(t
;; Otherwise it's an operator identifier, which is not a type.
(goto-char start)
;;
;; Fontify types and references in names containing angle bracket
;; arglists from the point to LIMIT. Note that
- ;; `c-font-lock-declarations' already has handled many of them.
+ ;; `c-font-lock-declarations' has already handled many of them.
;;
;; This function might do hidden buffer changes.
(when (and c-opt-identifier-concat-key
(not (get-text-property id-start 'face)))
(c-forward-syntactic-ws)
- (if (looking-at c-opt-identifier-concat-key)
- (c-put-font-lock-face id-start id-end
- c-reference-face-name)
- (c-put-font-lock-face id-start id-end
- 'font-lock-type-face)))))
+ (cond ((looking-at c-opt-identifier-concat-key)
+ (c-put-font-lock-face id-start id-end
+ c-reference-face-name))
+ ((eq (char-after) ?\())
+ (t (c-put-font-lock-face id-start id-end
+ 'font-lock-type-face))))))
(goto-char pos)))
(goto-char pos)))))