comparison lisp/progmodes/cc-fonts.el @ 90667:dbe3f29e61d6

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 505-522) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: etc/TUTORIAL.cn: Updated. - Merge from erc--emacs--22 * gnus--rel--5.10 (patch 164-167) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-137
author Miles Bader <miles@gnu.org>
date Tue, 21 Nov 2006 08:56:38 +0000
parents 8a8e69664178 0588a1acad14
children 6588c6259dfb
comparison
equal deleted inserted replaced
90666:00d54c8fa693 90667:dbe3f29e61d6
895 ;; square brackets, and we treat them as initializers too. 895 ;; square brackets, and we treat them as initializers too.
896 (c-syntactic-re-search-forward 896 (c-syntactic-re-search-forward
897 "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t)) 897 "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t))
898 898
899 (setq next-pos (match-beginning 0) 899 (setq next-pos (match-beginning 0)
900 id-face (if (eq (char-after next-pos) ?\() 900 id-face (if (and (eq (char-after next-pos) ?\()
901 (let (c-last-identifier-range)
902 (save-excursion
903 (goto-char next-pos)
904 (c-at-toplevel-p))))
901 'font-lock-function-name-face 905 'font-lock-function-name-face
902 'font-lock-variable-name-face) 906 'font-lock-variable-name-face)
903 got-init (and (match-beginning 1) 907 got-init (and (match-beginning 1)
904 (char-after (match-beginning 1)))) 908 (char-after (match-beginning 1))))
905 909
1168 ;; A cast or declaration has been successfully identified, so do 1172 ;; A cast or declaration has been successfully identified, so do
1169 ;; all the fontification of types and refs that's been recorded. 1173 ;; all the fontification of types and refs that's been recorded.
1170 (c-fontify-recorded-types-and-refs) 1174 (c-fontify-recorded-types-and-refs)
1171 nil)) 1175 nil))
1172 1176
1173 ;; It was a false alarm. Check if we're in a label instead. 1177 ;; It was a false alarm.
1174 (goto-char start-pos) 1178 (goto-char start-pos)
1175 (when (c-forward-label t match-pos nil) 1179 ;; The below code attempts to fontify the case constants in
1176 ;; Can't use `c-fontify-types-and-refs' here since we 1180 ;; c-label-face-name, but it cannot catch every case [sic].
1177 ;; should use the label face. 1181 ;; And do we want to fontify case constants anyway?
1178 (let (elem) 1182 nil
1179 (while c-record-ref-identifiers 1183 ;;; (when (c-forward-label t match-pos nil)
1180 (setq elem (car c-record-ref-identifiers) 1184 ;;; ;; Can't use `c-fontify-types-and-refs' here since we
1181 c-record-ref-identifiers (cdr c-record-ref-identifiers)) 1185 ;;; ;; should use the label face.
1182 (c-put-font-lock-face (car elem) (cdr elem) 1186 ;;; (save-excursion
1183 c-label-face-name))) 1187 ;;; (while c-record-ref-identifiers
1184 ;; `c-forward-label' probably has added a `c-decl-end' 1188 ;;; (let ((elem (car c-record-ref-identifiers))
1185 ;; marker, so return t to `c-find-decl-spots' to signal 1189 ;;; c-record-type-identifiers)
1186 ;; that. 1190 ;;; (goto-char (cdr elem))
1187 t)))) 1191 ;;; ;; Find the end of any label.
1192 ;;; (while (and (re-search-forward "\\sw\\|:" nil t)
1193 ;;; (progn (backward-char 1) t)
1194 ;;; (or (re-search-forward
1195 ;;; "\\=0[Xx][0-9A-Fa-f]+\\|\\([0-9]+\\)" nil t)
1196 ;;; (c-forward-name)))
1197 ;;; (c-backward-syntactic-ws)
1198 ;;; (let ((end (point)))
1199 ;;; ;; Now find the start of the bit we regard as the label.
1200 ;;; (when (and (c-simple-skip-symbol-backward)
1201 ;;; (not (c-get-char-property (point) 'face)))
1202 ;;; (c-put-font-lock-face (point) end c-label-face-name))
1203 ;;; (goto-char end))))
1204 ;;; (setq c-record-ref-identifiers (cdr c-record-ref-identifiers))))
1205 ;;; ;; `c-forward-label' probably has added a `c-decl-end'
1206 ;;; ;; marker, so return t to `c-find-decl-spots' to signal
1207 ;;; ;; that.
1208 ;;; t)
1209 )))
1188 1210
1189 nil))) 1211 nil)))
1190 1212
1191 (c-lang-defconst c-simple-decl-matchers 1213 (c-lang-defconst c-simple-decl-matchers
1192 "Simple font lock matchers for types and declarations. These are used 1214 "Simple font lock matchers for types and declarations. These are used