diff options
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 35 | ||||
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 13 |
2 files changed, 31 insertions, 17 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index aac7e631087..62bc236706d 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -5812,10 +5812,11 @@ comment at the start of cc-engine.el for more info." | |||
| 5812 | nil | 5812 | nil |
| 5813 | (and (looking-at c-keywords-regexp) | 5813 | (and (looking-at c-keywords-regexp) |
| 5814 | (c-forward-keyword-clause 1)))) | 5814 | (c-forward-keyword-clause 1)))) |
| 5815 | (when (memq res '(t known found prefix)) | 5815 | (when (memq res '(t known found prefix maybe)) |
| 5816 | ,(when (eq type 'ref) | 5816 | (when c-record-type-identifiers |
| 5817 | `(when c-record-type-identifiers | 5817 | ,(if (eq type 'type) |
| 5818 | (c-record-ref-id c-last-identifier-range))) | 5818 | `(c-record-type-id c-last-identifier-range) |
| 5819 | `(c-record-ref-id c-last-identifier-range))) | ||
| 5819 | t))) | 5820 | t))) |
| 5820 | 5821 | ||
| 5821 | (defmacro c-forward-id-comma-list (type update-safe-pos) | 5822 | (defmacro c-forward-id-comma-list (type update-safe-pos) |
| @@ -6371,13 +6372,15 @@ comment at the start of cc-engine.el for more info." | |||
| 6371 | (eq (char-after) ?<)) | 6372 | (eq (char-after) ?<)) |
| 6372 | ;; Maybe an angle bracket arglist. | 6373 | ;; Maybe an angle bracket arglist. |
| 6373 | (when (let ((c-record-type-identifiers t) | 6374 | (when (let ((c-record-type-identifiers t) |
| 6374 | (c-record-found-types t)) | 6375 | (c-record-found-types t) |
| 6376 | (c-last-identifier-range)) | ||
| 6375 | (c-forward-<>-arglist nil)) | 6377 | (c-forward-<>-arglist nil)) |
| 6376 | 6378 | ||
| 6377 | (c-add-type start (1+ pos)) | ||
| 6378 | (c-forward-syntactic-ws) | 6379 | (c-forward-syntactic-ws) |
| 6379 | (setq pos (point) | 6380 | (unless (eq (char-after) ?\() |
| 6380 | c-last-identifier-range nil) | 6381 | (setq c-last-identifier-range nil) |
| 6382 | (c-add-type start (1+ pos))) | ||
| 6383 | (setq pos (point)) | ||
| 6381 | 6384 | ||
| 6382 | (if (and c-opt-identifier-concat-key | 6385 | (if (and c-opt-identifier-concat-key |
| 6383 | (looking-at c-opt-identifier-concat-key)) | 6386 | (looking-at c-opt-identifier-concat-key)) |
| @@ -6391,7 +6394,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6391 | (c-forward-syntactic-ws) | 6394 | (c-forward-syntactic-ws) |
| 6392 | t) | 6395 | t) |
| 6393 | 6396 | ||
| 6394 | (when (and c-record-type-identifiers id-start) | 6397 | (when (and c-record-type-identifiers id-start |
| 6398 | (not (eq (char-after) ?\())) | ||
| 6395 | (c-record-type-id (cons id-start id-end))) | 6399 | (c-record-type-id (cons id-start id-end))) |
| 6396 | (setq res 'template) | 6400 | (setq res 'template) |
| 6397 | nil))) | 6401 | nil))) |
| @@ -6565,9 +6569,18 @@ comment at the start of cc-engine.el for more info." | |||
| 6565 | ;; It's an identifier that might be a type. | 6569 | ;; It's an identifier that might be a type. |
| 6566 | 'maybe)))) | 6570 | 'maybe)))) |
| 6567 | ((eq name-res 'template) | 6571 | ((eq name-res 'template) |
| 6568 | ;; A template is a type. | 6572 | ;; A template is sometimes a type. |
| 6569 | (goto-char id-end) | 6573 | (goto-char id-end) |
| 6570 | (setq res t)) | 6574 | (c-forward-syntactic-ws) |
| 6575 | (setq res | ||
| 6576 | (if (eq (char-after) ?\() | ||
| 6577 | (if (c-check-type id-start id-end) | ||
| 6578 | ;; It's an identifier that has been used as | ||
| 6579 | ;; a type somewhere else. | ||
| 6580 | 'found | ||
| 6581 | ;; It's an identifier that might be a type. | ||
| 6582 | 'maybe) | ||
| 6583 | t))) | ||
| 6571 | (t | 6584 | (t |
| 6572 | ;; Otherwise it's an operator identifier, which is not a type. | 6585 | ;; Otherwise it's an operator identifier, which is not a type. |
| 6573 | (goto-char start) | 6586 | (goto-char start) |
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 3cc537bba3d..d8643677192 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -914,7 +914,7 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 914 | ;; | 914 | ;; |
| 915 | ;; Fontify types and references in names containing angle bracket | 915 | ;; Fontify types and references in names containing angle bracket |
| 916 | ;; arglists from the point to LIMIT. Note that | 916 | ;; arglists from the point to LIMIT. Note that |
| 917 | ;; `c-font-lock-declarations' already has handled many of them. | 917 | ;; `c-font-lock-declarations' has already handled many of them. |
| 918 | ;; | 918 | ;; |
| 919 | ;; This function might do hidden buffer changes. | 919 | ;; This function might do hidden buffer changes. |
| 920 | 920 | ||
| @@ -976,11 +976,12 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 976 | (when (and c-opt-identifier-concat-key | 976 | (when (and c-opt-identifier-concat-key |
| 977 | (not (get-text-property id-start 'face))) | 977 | (not (get-text-property id-start 'face))) |
| 978 | (c-forward-syntactic-ws) | 978 | (c-forward-syntactic-ws) |
| 979 | (if (looking-at c-opt-identifier-concat-key) | 979 | (cond ((looking-at c-opt-identifier-concat-key) |
| 980 | (c-put-font-lock-face id-start id-end | 980 | (c-put-font-lock-face id-start id-end |
| 981 | c-reference-face-name) | 981 | c-reference-face-name)) |
| 982 | (c-put-font-lock-face id-start id-end | 982 | ((eq (char-after) ?\()) |
| 983 | 'font-lock-type-face))))) | 983 | (t (c-put-font-lock-face id-start id-end |
| 984 | 'font-lock-type-face)))))) | ||
| 984 | 985 | ||
| 985 | (goto-char pos))) | 986 | (goto-char pos))) |
| 986 | (goto-char pos))))) | 987 | (goto-char pos))))) |