summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.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-langs.el
parent68575ab00b802b29b0bc74ebb3780a81a7550698 (diff)
downloademacs-b248a85d103b7f34b9747e8d6884179bf3d4decb.tar.gz
emacs-b248a85d103b7f34b9747e8d6884179bf3d4decb.tar.bz2
emacs-b248a85d103b7f34b9747e8d6884179bf3d4decb.zip
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-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index d7ef278174a..35097242cb7 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -511,6 +511,12 @@ parameters \(point-min), \(point-max) and <buffer size>."
;;; Lexer-level syntax (identifiers, tokens etc).
+(c-lang-defconst c-has-bitfields
+ "Whether the language has bitfield declarations."
+ t nil
+ (c c++ objc) t)
+(c-lang-defvar c-has-bitfields (c-lang-const c-has-bitfields))
+
(c-lang-defconst c-symbol-start
"Regexp that matches the start of a symbol, i.e. any identifier or
keyword. It's unspecified how far it matches. Does not contain a \\|
@@ -528,6 +534,7 @@ This is of the form that fits inside [ ] in a regexp."
;; operator chars too, but they are handled with other means instead.
t (concat c-alnum "_$")
objc (concat c-alnum "_$@"))
+(c-lang-defvar c-symbol-chars (c-lang-const c-symbol-chars))
(c-lang-defconst c-symbol-key
"Regexp matching identifiers and keywords (with submatch 0). Assumed
@@ -1927,6 +1934,21 @@ one of `c-type-list-kwds', `c-ref-list-kwds',
(c-lang-defvar c-not-decl-init-keywords
(c-lang-const c-not-decl-init-keywords))
+(c-lang-defconst c-not-primitive-type-keywords
+ "List of all keywords apart from primitive types (like \"int\")."
+ t (set-difference (c-lang-const c-keywords)
+ (c-lang-const c-primitive-type-kwds)
+ :test 'string-equal)
+ ;; The "more" for C++ is the QT keyword (as in "more slots:").
+ ;; This variable is intended for use in c-beginning-of-statement-1.
+ c++ (append (c-lang-const c-not-primitive-type-keywords) '("more")))
+
+(c-lang-defconst c-not-primitive-type-keywords-regexp
+ t (c-make-keywords-re t
+ (c-lang-const c-not-primitive-type-keywords)))
+(c-lang-defvar c-not-primitive-type-keywords-regexp
+ (c-lang-const c-not-primitive-type-keywords-regexp))
+
(c-lang-defconst c-protection-kwds
"Access protection label keywords in classes."
t nil