comparison lisp/progmodes/cc-fonts.el @ 73903:f0343b6fc846

(c-font-lock-declarations): Don't overwrite fontification for "case" and "default" keywords.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 10 Nov 2006 16:58:27 +0000
parents 60304f6ae360
children 0588a1acad14
comparison
equal deleted inserted replaced
73902:8c826e10b91b 73903:f0343b6fc846
1168 ;; A cast or declaration has been successfully identified, so do 1168 ;; A cast or declaration has been successfully identified, so do
1169 ;; all the fontification of types and refs that's been recorded. 1169 ;; all the fontification of types and refs that's been recorded.
1170 (c-fontify-recorded-types-and-refs) 1170 (c-fontify-recorded-types-and-refs)
1171 nil)) 1171 nil))
1172 1172
1173 ;; It was a false alarm. Check if we're in a label instead. 1173 ;; It was a false alarm.
1174 (goto-char start-pos) 1174 (goto-char start-pos)
1175 (when (c-forward-label t match-pos nil) 1175 ;; The below code attempts to fontify the case constants in
1176 ;; Can't use `c-fontify-types-and-refs' here since we 1176 ;; c-label-face-name, but it cannot catch every case [sic].
1177 ;; should use the label face. 1177 ;; And do we want to fontify case constants anyway?
1178 (let (elem) 1178 nil
1179 (while c-record-ref-identifiers 1179 ;;; (when (c-forward-label t match-pos nil)
1180 (setq elem (car c-record-ref-identifiers) 1180 ;;; ;; Can't use `c-fontify-types-and-refs' here since we
1181 c-record-ref-identifiers (cdr c-record-ref-identifiers)) 1181 ;;; ;; should use the label face.
1182 (c-put-font-lock-face (car elem) (cdr elem) 1182 ;;; (save-excursion
1183 c-label-face-name))) 1183 ;;; (while c-record-ref-identifiers
1184 ;; `c-forward-label' probably has added a `c-decl-end' 1184 ;;; (let ((elem (car c-record-ref-identifiers))
1185 ;; marker, so return t to `c-find-decl-spots' to signal 1185 ;;; c-record-type-identifiers)
1186 ;; that. 1186 ;;; (goto-char (cdr elem))
1187 t)))) 1187 ;;; ;; Find the end of any label.
1188 ;;; (while (and (re-search-forward "\\sw\\|:" nil t)
1189 ;;; (progn (backward-char 1) t)
1190 ;;; (or (re-search-forward
1191 ;;; "\\=0[Xx][0-9A-Fa-f]+\\|\\([0-9]+\\)" nil t)
1192 ;;; (c-forward-name)))
1193 ;;; (c-backward-syntactic-ws)
1194 ;;; (let ((end (point)))
1195 ;;; ;; Now find the start of the bit we regard as the label.
1196 ;;; (when (and (c-simple-skip-symbol-backward)
1197 ;;; (not (c-get-char-property (point) 'face)))
1198 ;;; (c-put-font-lock-face (point) end c-label-face-name))
1199 ;;; (goto-char end))))
1200 ;;; (setq c-record-ref-identifiers (cdr c-record-ref-identifiers))))
1201 ;;; ;; `c-forward-label' probably has added a `c-decl-end'
1202 ;;; ;; marker, so return t to `c-find-decl-spots' to signal
1203 ;;; ;; that.
1204 ;;; t)
1205 )))
1188 1206
1189 nil))) 1207 nil)))
1190 1208
1191 (c-lang-defconst c-simple-decl-matchers 1209 (c-lang-defconst c-simple-decl-matchers
1192 "Simple font lock matchers for types and declarations. These are used 1210 "Simple font lock matchers for types and declarations. These are used