[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2fca889cfb4: CC Mode: Fontify int unsigned Foo;
From: |
Alan Mackenzie |
Subject: |
master 2fca889cfb4: CC Mode: Fontify int unsigned Foo; |
Date: |
Fri, 24 Nov 2023 07:24:34 -0500 (EST) |
branch: master
commit 2fca889cfb4fa495a6ffa0c7fe368551ee9a32bc
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>
CC Mode: Fontify int unsigned Foo;
This fixes bug#59953. Foo now gets fontified when unsigned
comes after int.
* lisp/progmodes/cc-engine.el (c-forward-type): Refactor nested
`if' forms into a cond form. Loop around matches for
c-opt-type-component-key, advancing over them.
---
lisp/progmodes/cc-engine.el | 66 ++++++++++++++++++++++++++-------------------
1 file changed, 38 insertions(+), 28 deletions(-)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index d903dd0694e..018a194ac14 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -9440,37 +9440,47 @@ multi-line strings (but not C++, for example)."
(or c-promote-possible-types (eq res t)))
(c-record-type-id (cons (match-beginning 1) (match-end 1))))
- (if (and c-opt-type-component-key
+ (cond
+ ((and c-opt-type-component-key
(save-match-data
(looking-at c-opt-type-component-key)))
;; There might be more keywords for the type.
- (let (safe-pos)
- (c-forward-keyword-clause 1 t)
- (while (progn
- (setq safe-pos (point))
- (c-forward-syntactic-ws)
- (looking-at c-opt-type-component-key))
- (when (and c-record-type-identifiers
- (looking-at c-primitive-type-key))
- (c-record-type-id (cons (match-beginning 1)
- (match-end 1))))
- (c-forward-keyword-clause 1 t))
- (if (looking-at c-primitive-type-key)
- (progn
- (when c-record-type-identifiers
- (c-record-type-id (cons (match-beginning 1)
- (match-end 1))))
- (c-forward-keyword-clause 1 t)
- (setq res t))
- (goto-char safe-pos)
- (setq res 'prefix))
- (setq pos (point)))
- (if (save-match-data (c-forward-keyword-clause 1 t))
- (setq pos (point))
- (if pos
- (goto-char pos)
- (goto-char (match-end 1))
- (setq pos (point)))))
+ (let (safe-pos)
+ (c-forward-keyword-clause 1 t)
+ (while (progn
+ (setq safe-pos (point))
+ (c-forward-syntactic-ws)
+ (looking-at c-opt-type-component-key))
+ (when (and c-record-type-identifiers
+ (looking-at c-primitive-type-key))
+ (c-record-type-id (cons (match-beginning 1)
+ (match-end 1))))
+ (c-forward-keyword-clause 1 t))
+ (if (looking-at c-primitive-type-key)
+ (progn
+ (when c-record-type-identifiers
+ (c-record-type-id (cons (match-beginning 1)
+ (match-end 1))))
+ (c-forward-keyword-clause 1 t)
+ (setq res t)
+ (while (progn
+ (setq safe-pos (point))
+ (c-forward-syntactic-ws)
+ (looking-at c-opt-type-component-key))
+ (c-forward-keyword-clause 1 t)))
+ (goto-char safe-pos)
+ (setq res 'prefix))
+ (setq pos (point))))
+ ((save-match-data (c-forward-keyword-clause 1 t))
+ (while (progn
+ (setq pos (point))
+ (c-forward-syntactic-ws)
+ (and c-opt-type-component-key
+ (looking-at c-opt-type-component-key)))
+ (c-forward-keyword-clause 1 t)))
+ (pos (goto-char pos))
+ (t (goto-char (match-end 1))
+ (setq pos (point))))
(c-forward-syntactic-ws))
((and (eq name-res t)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 2fca889cfb4: CC Mode: Fontify int unsigned Foo;,
Alan Mackenzie <=