summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-fonts.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2011-07-26 19:18:40 +0000
committerAlan Mackenzie <acm@muc.de>2011-07-26 19:18:40 +0000
commitb248a85d103b7f34b9747e8d6884179bf3d4decb (patch)
tree333bf00f158a25e470684db5ef2dcfaa2e96663e /lisp/progmodes/cc-fonts.el
parent68575ab00b802b29b0bc74ebb3780a81a7550698 (diff)
downloademacs-b248a85d103b7f34b9747e8d6884179bf3d4decb.tar.gz
Fontify bitfield declarations properly.
cc-langs.el (c-has-bitfields): New lang variable. (c-symbol-chars): Now exported as a lang variable. (c-not-primitive-type-keywords): New lang variable. cc-fonts.el (c-font-lock-declarations): Jump over the QT keyword "more" to prevent "more slots: ...." being spuriously parsed as a bitfield declaraion. cc-engine.el (c-beginning-of-statement-1): Refactor and enhance to handle bitfield declarations. (c-punctuation-in): New function. (c-forward-decl-or-cast-1): Enhance CASE 3 to handle bitfield declarations properly.
Diffstat (limited to 'lisp/progmodes/cc-fonts.el')
-rw-r--r--lisp/progmodes/cc-fonts.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 0500d48ddbc..2277ba760ab 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1179,6 +1179,14 @@ casts and declarations are fontified. Used on level 2 and higher."
(goto-char start-pos)))
;; Now analyze the construct.
+ ;; In QT, "more" is an irritating keyword that expands to nothing.
+ ;; We skip over it to prevent recognition of "more slots: <symbol>"
+ ;; as a bitfield declaration.
+ (when (and (c-major-mode-is 'c++-mode)
+ (looking-at
+ (concat "\\(more\\)\\([^" c-symbol-chars "]\\|$\\)")))
+ (goto-char (match-end 1))
+ (c-forward-syntactic-ws))
(setq decl-or-cast (c-forward-decl-or-cast-1
match-pos context last-cast-end))