aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Marshall1996-11-16 13:27:49 +0000
committerSimon Marshall1996-11-16 13:27:49 +0000
commitc1f2ffc8f907a22e7534fb59fd969ed58163badf (patch)
treeee87b16cf3ec707de1f629a6ab5b8002ffdb2bb6
parent06fb1cf202b2c42b58be2596c348e8d41df0f1b7 (diff)
downloademacs-c1f2ffc8f907a22e7534fb59fd969ed58163badf.tar.gz
emacs-c1f2ffc8f907a22e7534fb59fd969ed58163badf.zip
(a) add font-lock-keywords-alist, (b) fix compilation of quoted conses in keyword form, (c) make simple font-lock-match-c-style-declaration-item-and-skip-to-next and more complex font-lock-match-c++-style-declaration-item-and-skip-to-next.
-rw-r--r--lisp/font-lock.el815
1 files changed, 494 insertions, 321 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 91bad065390..0117d5f5c94 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -50,62 +50,84 @@
50;; also the variable `font-lock-maximum-size'. Support modes for Font Lock 50;; also the variable `font-lock-maximum-size'. Support modes for Font Lock
51;; mode can be used to speed up Font Lock mode. See `font-lock-support-mode'. 51;; mode can be used to speed up Font Lock mode. See `font-lock-support-mode'.
52 52
53;; Constructing patterns: 53;;; How Font Lock mode supports modes or is supported by modes:
54;; 54
55;; Modes that support Font Lock mode do so by defining one or more variables
56;; whose values specify the fontification. Font Lock mode knows of these
57;; variable names from (a) the buffer local variable `font-lock-defaults', if
58;; non-nil, or (b) the global variable `font-lock-defaults-alist', if the major
59;; mode has an entry. (Font Lock mode is set up via (a) where a mode's
60;; patterns are distributed with the mode's package library, and (b) where a
61;; mode's patterns are distributed with font-lock.el itself. An example of (a)
62;; is Pascal mode, an example of (b) is Lisp mode. Normally, the mechanism is
63;; (a); (b) is used where it is not clear which package library should contain
64;; the pattern definitions.) Font Lock mode chooses which variable to use for
65;; fontification based on `font-lock-maximum-decoration'.
66
67;;; Constructing patterns:
68
55;; See the documentation for the variable `font-lock-keywords'. 69;; See the documentation for the variable `font-lock-keywords'.
56;; 70;;
57;; Nasty regexps of the form "bar\\(\\|lo\\)\\|f\\(oo\\|u\\(\\|bar\\)\\)\\|lo" 71;; Nasty regexps of the form "bar\\(\\|lo\\)\\|f\\(oo\\|u\\(\\|bar\\)\\)\\|lo"
58;; are made thusly: (make-regexp '("foo" "fu" "fubar" "bar" "barlo" "lo")) for 72;; are made thusly: (make-regexp '("foo" "fu" "fubar" "bar" "barlo" "lo")) for
59;; efficiency. See /pub/gnu/emacs/elisp-archive/functions/make-regexp.el.Z on 73;; efficiency. See /pub/gnu/emacs/elisp-archive/functions/make-regexp.el.Z on
60;; archive.cis.ohio-state.edu for this and other functions. 74;; archive.cis.ohio-state.edu for this and other functions not just by simon.
61 75
62;; Adding patterns for modes that already support Font Lock: 76;;; Adding patterns for modes that already support Font Lock:
63;; 77
64;; Font Lock mode uses the buffer local variable `font-lock-keywords' for the 78;; Though Font Lock highlighting patterns already exist for many modes, it's
65;; highlighting patterns. This variable is set by Font Lock mode from (a) the 79;; likely there's something that you want fontified that currently isn't, even
66;; buffer local variable `font-lock-defaults', if non-nil, or (b) the global 80;; at the maximum fontification level. You can add highlighting patterns via
67;; variable `font-lock-defaults-alist', if the major mode has an entry. 81;; `font-lock-add-keywords'. For example, say in some C
68;; Font Lock mode is set up via (a) where a mode's patterns are distributed 82;; header file you #define the token `and' to expand to `&&', etc., to make
69;; with the mode's package library, (b) where a mode's patterns are distributed 83;; your C code almost readable. In your ~/.emacs there could be:
70;; with font-lock.el itself. An example of (a) is Pascal mode, an example of
71;; (b) is C/C++ modes. (Normally, the mechanism is (a); (b) is used where it
72;; is not clear which package library should contain the pattern definitions.)
73;;
74;; If, for a particular mode, mechanism (a) is used, you need to add your
75;; patterns after that package library has loaded, e.g.:
76;; 84;;
77;; (eval-after-load "pascal" '(add-to-list 'pascal-font-lock-keywords ...)) 85;; (font-lock-add-keywords 'c-mode '("\\<\\(and\\|or\\|not\\)\\>"))
78;; 86;;
79;; (Note that only one pattern can be added with `add-to-list'. For multiple 87;; Some modes provide specific ways to modify patterns based on the values of
80;; patterns, use one `eval-after-load' form with one `setq' and `append' form, 88;; other variables. For example, additional C types can be specified via the
81;; or multiple `eval-after-load' forms each with one `add-to-list' form.) 89;; variable `c-font-lock-extra-types'.
82;; If mechanism (b) is used, you need to add your patterns after font-lock.el 90
83;; itself has loaded, e.g.: 91;;; Adding patterns for modes that do not support Font Lock:
92
93;; Not all modes support Font Lock mode. If you (as a user of the mode) add
94;; patterns for a new mode, you must define in your ~/.emacs a variable or
95;; variables that specify regexp fontification. Then, you should indicate to
96;; Font Lock mode, via the mode hook setting `font-lock-defaults', exactly what
97;; support is required. For example, say Foo mode should have the following
98;; regexps fontified case-sensitively, and comments and strings should not be
99;; fontified automagically. In your ~/.emacs there could be:
84;; 100;;
85;; (eval-after-load "font-lock" '(add-to-list 'c-font-lock-keywords ...)) 101;; (defvar foo-font-lock-keywords
102;; '(("\\<\\(one\\|two\\|three\\)\\>" . font-lock-keyword-face)
103;; ("\\<\\(four\\|five\\|six\\)\\>" . font-lock-type-face))
104;; "Default expressions to highlight in Foo mode.")
86;; 105;;
87;; Which variable you should add to depends on what level of fontification you 106;; (add-hook 'foo-mode-hook
88;; choose and what level is supported. If you choose the maximum level, by 107;; (function (lambda ()
89;; setting the variable `font-lock-maximum-decoration', you change a different 108;; (make-local-variable 'font-lock-defaults)
90;; variable. Maximum level patterns for C are `c-font-lock-keywords-3', so: 109;; (setq font-lock-defaults '(foo-font-lock-keywords t)))))
110
111;;; Adding Font Lock support for modes:
112
113;; Of course, it would be better that the mode already supports Font Lock mode.
114;; The package author would do something similar to above. The mode must
115;; define at the top-level a variable or variables that specify regexp
116;; fontification. Then, the mode command should indicate to Font Lock mode,
117;; via `font-lock-defaults', exactly what support is required. For example,
118;; say Bar mode should have the following regexps fontified case-insensitively,
119;; and comments and strings should be fontified automagically. In bar.el there
120;; could be:
91;; 121;;
92;; (setq font-lock-maximum-decoration t) 122;; (defvar bar-font-lock-keywords
93;; (eval-after-load "font-lock" 123;; '(("\\<\\(uno\\|due\\|tre\\)\\>" . font-lock-keyword-face)
94;; '(add-to-list 'c-font-lock-keywords-3 124;; ("\\<\\(quattro\\|cinque\\|sei\\)\\>" . font-lock-type-face))
95;; '("\\<FILE\\>" . font-lock-type-face))) 125;; "Default expressions to highlight in Bar mode.")
96;; 126;;
97;; To see which variable to set, see the buffer's value of `font-lock-defaults' 127;; and within `bar-mode' there could be:
98;; or the mode's entry in the global value of `font-lock-defaults-alist'.
99
100;; Adding patterns for modes that do not support Font Lock:
101;; 128;;
102;; If you add patterns for a new mode, say foo.el's `foo-mode', say in which 129;; (make-local-variable 'font-lock-defaults)
103;; you don't want syntactic fontification to occur, you can make Font Lock mode 130;; (setq font-lock-defaults '(bar-font-lock-keywords nil t))
104;; use your regexps when turning on Font Lock by adding to `foo-mode-hook':
105;;
106;; (add-hook 'foo-mode-hook
107;; '(lambda () (make-local-variable 'font-lock-defaults)
108;; (setq font-lock-defaults '(foo-font-lock-keywords t))))
109 131
110;; What is fontification for? You might say, "It's to make my code look nice." 132;; What is fontification for? You might say, "It's to make my code look nice."
111;; I think it should be for adding information in the form of cues. These cues 133;; I think it should be for adding information in the form of cues. These cues
@@ -168,7 +190,7 @@ for buffers in Rmail mode, and size is irrelevant otherwise.")
168 190
169;; Fontification variables: 191;; Fontification variables:
170 192
171;; Originally these variables defaulted to face names such as `bold' etc. 193;; Originally these variable values were face names such as `bold' etc.
172;; Now we create our own faces, but we keep these variables for compatibility 194;; Now we create our own faces, but we keep these variables for compatibility
173;; and they give users another mechanism for changing face appearance. 195;; and they give users another mechanism for changing face appearance.
174;; We now allow a FACENAME in `font-lock-keywords' to be any expression that 196;; We now allow a FACENAME in `font-lock-keywords' to be any expression that
@@ -399,6 +421,10 @@ Other variables include those for buffer-specialised fontification functions,
399`font-lock-comment-start-regexp', `font-lock-inhibit-thing-lock' and 421`font-lock-comment-start-regexp', `font-lock-inhibit-thing-lock' and
400`font-lock-maximum-size'.") 422`font-lock-maximum-size'.")
401 423
424(defvar font-lock-keywords-alist nil
425 "*Alist of `font-lock-keywords' local to a `major-mode'.
426This is normally set via `font-lock-add-keywords'.")
427
402(defvar font-lock-keywords-only nil 428(defvar font-lock-keywords-only nil
403 "*Non-nil means Font Lock should not fontify comments or strings. 429 "*Non-nil means Font Lock should not fontify comments or strings.
404This is normally set via `font-lock-defaults'.") 430This is normally set via `font-lock-defaults'.")
@@ -530,6 +556,10 @@ To fontify a block (the function or paragraph containing point, or a number of
530lines around point), perhaps because modification on the current line caused 556lines around point), perhaps because modification on the current line caused
531syntactic change on other lines, you can use \\[font-lock-fontify-block]. 557syntactic change on other lines, you can use \\[font-lock-fontify-block].
532 558
559The default Font Lock mode highlighting are normally selected via the variable
560`font-lock-maximum-decoration'. You can add your own highlighting for some
561mode, by calling `font-lock-add-keywords'.
562
533The default Font Lock mode faces and their attributes are defined in the 563The default Font Lock mode faces and their attributes are defined in the
534variable `font-lock-face-attributes', and Font Lock mode default settings in 564variable `font-lock-face-attributes', and Font Lock mode default settings in
535the variable `font-lock-defaults-alist'. You can set your own default settings 565the variable `font-lock-defaults-alist'. You can set your own default settings
@@ -573,6 +603,43 @@ its mode hook."
573Turn on only if the terminal can display it." 603Turn on only if the terminal can display it."
574 (when window-system 604 (when window-system
575 (font-lock-mode t))) 605 (font-lock-mode t)))
606
607;;;###autoload
608(defun font-lock-add-keywords (major-mode keywords &optional append)
609 "Add highlighting KEYWORDS for MAJOR-MODE.
610MODE should be a symbol, the major mode command name, such as `c-mode' or nil.
611If nil, highlighting keywords are added for the current buffer.
612KEYWORDS should be a list; see the variable `font-lock-keywords'.
613By default they are added at the beginning of the current highlighting list.
614If optional argument APPEND is `set', they are used to replace the current
615highlighting list. If APPEND has any other value, e.g., t, they are added at
616the end of the current highlighting list.
617
618For example:
619
620 (font-lock-add-keywords 'c-mode
621 '((\"\\\\\\=<\\\\(FIXME\\\\):\" 1 font-lock-warning-face prepend)
622 (\"\\\\\\=<\\\\(and\\\\|or\\\\|not\\\\)\\\\\\=>\" . font-lock-keyword-face)))
623
624adds two fontification patterns for C mode, to fontify `FIXME:' words, even in
625comments, and to fontify `and', `or' and `not' words as keywords."
626 (cond (major-mode
627 ;; If MAJOR-MODE is non-nil, add the KEYWORDS and APPEND spec to
628 ;; `font-lock-keywords-alist' so `font-lock-set-defaults' uses them.
629 (let ((spec (cons keywords append)) cell)
630 (if (setq cell (assq major-mode font-lock-keywords-alist))
631 (setcdr cell (append (cdr cell) (list spec)))
632 (push (list major-mode spec) font-lock-keywords-alist))))
633 (font-lock-mode
634 ;; Otherwise if Font Lock mode is on, set or add the keywords now.
635 (if (eq append 'set)
636 (setq font-lock-keywords keywords)
637 (let ((old (if (eq (car-safe font-lock-keywords) t)
638 (cdr font-lock-keywords)
639 font-lock-keywords)))
640 (setq font-lock-keywords (if append
641 (append old keywords)
642 (append keywords old))))))))
576 643
577;; Global Font Lock mode. 644;; Global Font Lock mode.
578;; 645;;
@@ -1068,10 +1135,6 @@ HIGHLIGHT should be of the form MATCH-HIGHLIGHT, see `font-lock-keywords'."
1068 ((eq override t) 1135 ((eq override t)
1069 ;; Override existing fontification. 1136 ;; Override existing fontification.
1070 (put-text-property start end 'face (eval (nth 1 highlight)))) 1137 (put-text-property start end 'face (eval (nth 1 highlight))))
1071 ((eq override 'keep)
1072 ;; Keep existing fontification.
1073 (font-lock-fillin-text-property start end 'face
1074 (eval (nth 1 highlight))))
1075 ((eq override 'prepend) 1138 ((eq override 'prepend)
1076 ;; Prepend to existing fontification. 1139 ;; Prepend to existing fontification.
1077 (font-lock-prepend-text-property start end 'face 1140 (font-lock-prepend-text-property start end 'face
@@ -1079,6 +1142,10 @@ HIGHLIGHT should be of the form MATCH-HIGHLIGHT, see `font-lock-keywords'."
1079 ((eq override 'append) 1142 ((eq override 'append)
1080 ;; Append to existing fontification. 1143 ;; Append to existing fontification.
1081 (font-lock-append-text-property start end 'face 1144 (font-lock-append-text-property start end 'face
1145 (eval (nth 1 highlight))))
1146 ((eq override 'keep)
1147 ;; Keep existing fontification.
1148 (font-lock-fillin-text-property start end 'face
1082 (eval (nth 1 highlight))))))) 1149 (eval (nth 1 highlight)))))))
1083 1150
1084(defsubst font-lock-fontify-anchored-keywords (keywords limit) 1151(defsubst font-lock-fontify-anchored-keywords (keywords limit)
@@ -1145,17 +1212,22 @@ START should be at the beginning of a line."
1145 (cons t (mapcar 'font-lock-compile-keyword keywords)))))) 1212 (cons t (mapcar 'font-lock-compile-keyword keywords))))))
1146 1213
1147(defun font-lock-compile-keyword (keyword) 1214(defun font-lock-compile-keyword (keyword)
1148 (cond ((nlistp keyword) ; Just MATCHER 1215 (cond ((nlistp keyword) ; MATCHER
1149 (list keyword '(0 font-lock-keyword-face))) 1216 (list keyword '(0 font-lock-keyword-face)))
1150 ((eq (car keyword) 'eval) ; Specified (eval . FORM) 1217 ((eq (car keyword) 'eval) ; (eval . FORM)
1151 (font-lock-compile-keyword (eval (cdr keyword)))) 1218 (font-lock-compile-keyword (eval (cdr keyword))))
1152 ((numberp (cdr keyword)) ; Specified (MATCHER . MATCH) 1219 ((eq (car-safe (cdr keyword)) 'quote) ; (MATCHER . 'FORM)
1220 ;; If FORM is a FACENAME then quote it. Otherwise ignore the quote.
1221 (if (symbolp (nth 2 keyword))
1222 (list (car keyword) (list 0 (cdr keyword)))
1223 (font-lock-compile-keyword (cons (car keyword) (nth 2 keyword)))))
1224 ((numberp (cdr keyword)) ; (MATCHER . MATCH)
1153 (list (car keyword) (list (cdr keyword) 'font-lock-keyword-face))) 1225 (list (car keyword) (list (cdr keyword) 'font-lock-keyword-face)))
1154 ((symbolp (cdr keyword)) ; Specified (MATCHER . FACENAME) 1226 ((symbolp (cdr keyword)) ; (MATCHER . FACENAME)
1155 (list (car keyword) (list 0 (cdr keyword)))) 1227 (list (car keyword) (list 0 (cdr keyword))))
1156 ((nlistp (nth 1 keyword)) ; Specified (MATCHER . HIGHLIGHT) 1228 ((nlistp (nth 1 keyword)) ; (MATCHER . HIGHLIGHT)
1157 (list (car keyword) (cdr keyword))) 1229 (list (car keyword) (cdr keyword)))
1158 (t ; Hopefully (MATCHER HIGHLIGHT ...) 1230 (t ; (MATCHER HIGHLIGHT ...)
1159 keyword))) 1231 keyword)))
1160 1232
1161(defun font-lock-value-in-major-mode (alist) 1233(defun font-lock-value-in-major-mode (alist)
@@ -1196,11 +1268,16 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
1196 (cdr (assq major-mode font-lock-defaults-alist)))) 1268 (cdr (assq major-mode font-lock-defaults-alist))))
1197 (keywords 1269 (keywords
1198 (font-lock-choose-keywords (nth 0 defaults) 1270 (font-lock-choose-keywords (nth 0 defaults)
1199 (font-lock-value-in-major-mode font-lock-maximum-decoration)))) 1271 (font-lock-value-in-major-mode font-lock-maximum-decoration)))
1272 (local (cdr (assq major-mode font-lock-keywords-alist))))
1200 ;; Regexp fontification? 1273 ;; Regexp fontification?
1201 (setq font-lock-keywords (if (fboundp keywords) 1274 (setq font-lock-keywords (if (fboundp keywords)
1202 (funcall keywords) 1275 (funcall keywords)
1203 (eval keywords))) 1276 (eval keywords)))
1277 ;; Local fontification?
1278 (while local
1279 (font-lock-add-keywords nil (car (car local)) (cdr (car local)))
1280 (setq local (cdr local)))
1204 ;; Syntactic fontification? 1281 ;; Syntactic fontification?
1205 (when (nth 1 defaults) 1282 (when (nth 1 defaults)
1206 (set (make-local-variable 'font-lock-keywords-only) t)) 1283 (set (make-local-variable 'font-lock-keywords-only) t))
@@ -1279,12 +1356,12 @@ Each element of the list should be of the form
1279 1356
1280 (FACE FOREGROUND BACKGROUND BOLD-P ITALIC-P UNDERLINE-P) 1357 (FACE FOREGROUND BACKGROUND BOLD-P ITALIC-P UNDERLINE-P)
1281 1358
1282where FACE should be one of the face symbols `font-lock-comment-face', 1359where FACE could be one of the face symbols `font-lock-comment-face',
1283`font-lock-string-face', `font-lock-keyword-face', `font-lock-type-face', 1360`font-lock-string-face', `font-lock-keyword-face', `font-lock-builtin-face',
1284`font-lock-function-name-face', `font-lock-variable-name-face', and 1361`font-lock-type-face', `font-lock-function-name-face',
1285`font-lock-reference-face'. A form for each of these face symbols should be 1362`font-lock-variable-name-face', `font-lock-reference-face' and
1286provided in the list, but other face symbols and attributes may be given and 1363`font-lock-warning-face', or any other face symbols and attributes may be
1287used in highlighting. See `font-lock-keywords'. 1364specified here and used in `font-lock-keywords'.
1288 1365
1289Subsequent element items should be the attributes for the corresponding 1366Subsequent element items should be the attributes for the corresponding
1290Font Lock mode faces. Attributes FOREGROUND and BACKGROUND should be strings 1367Font Lock mode faces. Attributes FOREGROUND and BACKGROUND should be strings
@@ -1305,102 +1382,102 @@ If optional OVERRIDE is non-nil, faces that already exist are reset.
1305See `font-lock-make-face' and `list-faces-display'." 1382See `font-lock-make-face' and `list-faces-display'."
1306 ;; We don't need to `setq' any of these variables, but the user can see what 1383 ;; We don't need to `setq' any of these variables, but the user can see what
1307 ;; is being used if we do. 1384 ;; is being used if we do.
1308 (if (null font-lock-display-type) 1385 (unless font-lock-display-type
1309 (setq font-lock-display-type 1386 (setq font-lock-display-type
1310 (let ((display-resource (x-get-resource ".displayType" 1387 (let ((display-resource (x-get-resource ".displayType" "DisplayType")))
1311 "DisplayType"))) 1388 (cond (display-resource (intern (downcase display-resource)))
1312 (cond (display-resource (intern (downcase display-resource))) 1389 ((x-display-color-p) 'color)
1313 ((x-display-color-p) 'color) 1390 ((x-display-grayscale-p) 'grayscale)
1314 ((x-display-grayscale-p) 'grayscale) 1391 (t 'mono)))))
1315 (t 'mono))))) 1392 (unless font-lock-background-mode
1316 (if (null font-lock-background-mode) 1393 (setq font-lock-background-mode
1317 (setq font-lock-background-mode 1394 (let ((bg-resource (x-get-resource ".backgroundMode" "BackgroundMode"))
1318 (let ((bg-resource (x-get-resource ".backgroundMode" 1395 (params (frame-parameters)))
1319 "BackgroundMode")) 1396 (cond (bg-resource (intern (downcase bg-resource)))
1320 (params (frame-parameters))) 1397 ((eq system-type 'ms-dos)
1321 (cond (bg-resource (intern (downcase bg-resource))) 1398 (if (string-match "light" (cdr (assq 'background-color params)))
1322 ((eq system-type 'ms-dos) 1399 'light
1323 (if (string-match "light" 1400 'dark))
1324 (cdr (assq 'background-color params))) 1401 ((< (apply '+ (x-color-values
1325 'light 1402 (cdr (assq 'background-color params))))
1326 'dark)) 1403 (* (apply '+ (x-color-values "white")) .6))
1327 ((< (apply '+ (x-color-values 1404 'dark)
1328 (cdr (assq 'background-color params)))) 1405 (t 'light)))))
1329 (* (apply '+ (x-color-values "white")) .6)) 1406 (let ((face-attributes
1330 'dark) 1407 (let ((light-bg (eq font-lock-background-mode 'light)))
1331 (t 'light))))) 1408 (cond ((memq font-lock-display-type '(mono monochrome))
1332 (if (null font-lock-face-attributes) 1409 ;; Emacs 19.25's font-lock defaults:
1333 (setq font-lock-face-attributes 1410 ;;'((font-lock-comment-face nil nil nil t nil)
1334 (let ((light-bg (eq font-lock-background-mode 'light))) 1411 ;; (font-lock-string-face nil nil nil nil t)
1335 (cond ((memq font-lock-display-type '(mono monochrome)) 1412 ;; (font-lock-keyword-face nil nil t nil nil)
1336 ;; Emacs 19.25's font-lock defaults: 1413 ;; (font-lock-function-name-face nil nil t t nil)
1337 ;;'((font-lock-comment-face nil nil nil t nil) 1414 ;; (font-lock-type-face nil nil nil t nil))
1338 ;; (font-lock-string-face nil nil nil nil t) 1415 (list '(font-lock-comment-face nil nil t t nil)
1339 ;; (font-lock-keyword-face nil nil t nil nil) 1416 '(font-lock-string-face nil nil nil t nil)
1340 ;; (font-lock-function-name-face nil nil t t nil) 1417 '(font-lock-keyword-face nil nil t nil nil)
1341 ;; (font-lock-type-face nil nil nil t nil)) 1418 '(font-lock-builtin-face nil nil t nil nil)
1342 (list '(font-lock-comment-face nil nil t t nil) 1419 (list
1343 '(font-lock-string-face nil nil nil t nil) 1420 'font-lock-function-name-face
1344 '(font-lock-keyword-face nil nil t nil nil) 1421 (cdr (assq 'background-color (frame-parameters)))
1345 '(font-lock-builtin-face nil nil t nil nil) 1422 (cdr (assq 'foreground-color (frame-parameters)))
1346 (list 1423 t nil nil)
1347 'font-lock-function-name-face 1424 '(font-lock-variable-name-face nil nil t t nil)
1348 (cdr (assq 'background-color (frame-parameters))) 1425 '(font-lock-type-face nil nil t nil t)
1349 (cdr (assq 'foreground-color (frame-parameters))) 1426 '(font-lock-reference-face nil nil t nil t)
1350 t nil nil) 1427 (list
1351 '(font-lock-variable-name-face nil nil t t nil) 1428 'font-lock-warning-face
1352 '(font-lock-type-face nil nil t nil t) 1429 (cdr (assq 'background-color (frame-parameters)))
1353 '(font-lock-reference-face nil nil t nil t) 1430 (cdr (assq 'foreground-color (frame-parameters)))
1354 (list 1431 t nil nil)))
1355 'font-lock-warning-face 1432 ((memq font-lock-display-type '(grayscale greyscale
1356 (cdr (assq 'background-color (frame-parameters))) 1433 grayshade greyshade))
1357 (cdr (assq 'foreground-color (frame-parameters))) 1434 (list
1358 t nil nil))) 1435 (list 'font-lock-comment-face
1359 ((memq font-lock-display-type '(grayscale greyscale 1436 (if light-bg "DimGray" "LightGray") nil t t nil)
1360 grayshade greyshade)) 1437 (list 'font-lock-string-face
1361 (list 1438 (if light-bg "DimGray" "LightGray") nil nil t nil)
1362 (list 'font-lock-comment-face 1439 (list 'font-lock-keyword-face
1363 (if light-bg "DimGray" "LightGray") nil t t nil) 1440 nil (if light-bg "LightGray" "DimGray") t nil nil)
1364 (list 'font-lock-string-face 1441 (list 'font-lock-builtin-face
1365 (if light-bg "DimGray" "LightGray") nil nil t nil) 1442 nil (if light-bg "LightGray" "DimGray") t nil nil)
1366 (list 'font-lock-keyword-face 1443 (list 'font-lock-function-name-face
1367 nil (if light-bg "LightGray" "DimGray") t nil nil) 1444 (cdr (assq 'background-color (frame-parameters)))
1368 (list 'font-lock-builtin-face 1445 (cdr (assq 'foreground-color (frame-parameters)))
1369 nil (if light-bg "LightGray" "DimGray") t nil nil) 1446 t nil nil)
1370 (list 'font-lock-function-name-face 1447 (list 'font-lock-variable-name-face
1371 (cdr (assq 'background-color (frame-parameters))) 1448 nil (if light-bg "Gray90" "DimGray") t t nil)
1372 (cdr (assq 'foreground-color (frame-parameters))) 1449 (list 'font-lock-type-face
1373 t nil nil) 1450 nil (if light-bg "Gray80" "DimGray") t nil nil)
1374 (list 'font-lock-variable-name-face 1451 (list 'font-lock-reference-face
1375 nil (if light-bg "Gray90" "DimGray") t t nil) 1452 nil (if light-bg "LightGray" "Gray50") t nil t)
1376 (list 'font-lock-type-face 1453 (list 'font-lock-warning-face
1377 nil (if light-bg "Gray80" "DimGray") t nil nil) 1454 (cdr (assq 'background-color (frame-parameters)))
1378 (list 'font-lock-reference-face 1455 (cdr (assq 'foreground-color (frame-parameters)))
1379 nil (if light-bg "LightGray" "Gray50") t nil t) 1456 t nil nil)))
1380 (list 'font-lock-warning-face 1457 (light-bg ; light colour background
1381 (cdr (assq 'background-color (frame-parameters))) 1458 '((font-lock-comment-face "Firebrick")
1382 (cdr (assq 'foreground-color (frame-parameters))) 1459 (font-lock-string-face "RosyBrown")
1383 t nil nil))) 1460 (font-lock-keyword-face "Purple")
1384 (light-bg ; light colour background 1461 (font-lock-builtin-face "Orchid")
1385 '((font-lock-comment-face "Firebrick") 1462 (font-lock-function-name-face "Blue")
1386 (font-lock-string-face "RosyBrown") 1463 (font-lock-variable-name-face "DarkGoldenrod")
1387 (font-lock-keyword-face "Purple") 1464 (font-lock-type-face "DarkOliveGreen")
1388 (font-lock-builtin-face "Orchid") 1465 (font-lock-reference-face "CadetBlue")
1389 (font-lock-function-name-face "Blue") 1466 (font-lock-warning-face "Red" nil t nil nil)))
1390 (font-lock-variable-name-face "DarkGoldenrod") 1467 (t ; dark colour background
1391 (font-lock-type-face "DarkOliveGreen") 1468 '((font-lock-comment-face "OrangeRed")
1392 (font-lock-reference-face "CadetBlue") 1469 (font-lock-string-face "LightSalmon")
1393 (font-lock-warning-face "Red" nil t nil nil))) 1470 (font-lock-keyword-face "Cyan")
1394 (t ; dark colour background 1471 (font-lock-builtin-face "LightSteelBlue")
1395 '((font-lock-comment-face "OrangeRed") 1472 (font-lock-function-name-face "LightSkyBlue")
1396 (font-lock-string-face "LightSalmon") 1473 (font-lock-variable-name-face "LightGoldenrod")
1397 (font-lock-keyword-face "Cyan") 1474 (font-lock-type-face "PaleGreen")
1398 (font-lock-builtin-face "LightSteelBlue") 1475 (font-lock-reference-face "Aquamarine")
1399 (font-lock-function-name-face "LightSkyBlue") 1476 (font-lock-warning-face "Pink" nil t nil nil)))))))
1400 (font-lock-variable-name-face "LightGoldenrod") 1477 (while face-attributes
1401 (font-lock-type-face "PaleGreen") 1478 (unless (assq (car (car face-attributes)) font-lock-face-attributes)
1402 (font-lock-reference-face "Aquamarine") 1479 (push (car face-attributes) font-lock-face-attributes))
1403 (font-lock-warning-face "Pink" nil t nil nil))))))) 1480 (setq face-attributes (cdr face-attributes))))
1404 ;; Now make the faces if we have to. 1481 ;; Now make the faces if we have to.
1405 (mapcar (function 1482 (mapcar (function
1406 (lambda (face-attributes) 1483 (lambda (face-attributes)
@@ -1460,25 +1537,25 @@ the face is also set; its value is the face name."
1460;; The below function should stay in font-lock.el, since it is used by many 1537;; The below function should stay in font-lock.el, since it is used by many
1461;; other libraries. 1538;; other libraries.
1462 1539
1463(defun font-lock-match-c++-style-declaration-item-and-skip-to-next (limit) 1540(defun font-lock-match-c-style-declaration-item-and-skip-to-next (limit)
1464 "Match, and move over, any declaration/definition item after point. 1541 "Match, and move over, any declaration/definition item after point.
1465Matches after point, but ignores leading whitespace, `*' and `&' characters. 1542Matches after point, but ignores leading whitespace and `*' characters.
1466Does not move further than LIMIT. This generic function is intended to be used 1543Does not move further than LIMIT.
1467as a MATCHER in a MATCH-ANCHORED `font-lock-keywords' item. 1544
1468 1545The expected syntax of a declaration/definition item is `word', possibly ending
1469The expected syntax of a declaration/definition item is `word' or `word::word', 1546with optional whitespace and a `('. Everything following the item (but
1470possibly ending with optional whitespace and a `('. Everything following the 1547belonging to it) is expected to by skip-able by `scan-sexps', and items are
1471item (but belonging to it) is expected to by skip-able by `scan-sexps', and 1548expected to be separated with a `,' and to be terminated with a `;'.
1472items are expected to be separated with a `,' and to be terminated with a `;'. 1549
1473 1550Thus the regexp matches after point: word (
1474Thus the regexp matches after point: word::word ( 1551 ^^^^ ^
1475 ^^^^ ^^^^ ^ 1552Where the match subexpressions are: 1 2
1476Where the match subexpressions are: 1 3 4 1553
1477 1554The item is delimited by (match-beginning 1) and (match-end 1).
1478So, the item is delimited by (match-beginning 1) and (match-end 1). 1555If (match-beginning 2) is non-nil, the item is followed by a `('.
1479If (match-beginning 3) is non-nil, that part of the item follows a `::'. 1556
1480If (match-beginning 4) is non-nil, the item is followed by a `('." 1557This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1481 (when (looking-at "[ \t*&]*\\(\\sw+\\)\\(::\\(\\sw+\\)\\)?[ \t]*\\((\\)?") 1558 (when (looking-at "[ \t*]*\\(\\sw+\\)[ \t]*\\((\\)?")
1482 (save-match-data 1559 (save-match-data
1483 (condition-case nil 1560 (condition-case nil
1484 (save-restriction 1561 (save-restriction
@@ -1527,13 +1604,14 @@ If (match-beginning 4) is non-nil, the item is followed by a `('."
1527; '("cond" "if" "while" "let\\*?" "prog[nv12*]?" "inline" "catch" "throw" 1604; '("cond" "if" "while" "let\\*?" "prog[nv12*]?" "inline" "catch" "throw"
1528; "save-restriction" "save-excursion" "save-window-excursion" 1605; "save-restriction" "save-excursion" "save-window-excursion"
1529; "save-selected-window" "save-match-data" "save-current-buffer" 1606; "save-selected-window" "save-match-data" "save-current-buffer"
1530; "unwind-protect" "condition-case" "track-mouse" 1607; "unwind-protect" "condition-case" "track-mouse" "dont-compile"
1531; "eval-after-load" "eval-and-compile" "eval-when-compile" 1608; "eval-after-load" "eval-and-compile" "eval-when-compile"
1532; "when" "unless" "do" "flet" "labels" "return" "return-from" 1609; "when" "unless" "do" "flet" "labels" "return" "return-from"
1533; "with-output-to-temp-buffer" "with-timeout" "with-current-buffer" 1610; "with-output-to-temp-buffer" "with-timeout" "with-current-buffer"
1534; "with-temp-buffer" "with-temp-file")) 1611; "with-temp-buffer" "with-temp-file"))
1535 (cons (concat "(\\(" 1612 (cons (concat "(\\("
1536 "c\\(atch\\|ond\\(\\|ition-case\\)\\)\\|do\\|" 1613 "c\\(atch\\|ond\\(\\|ition-case\\)\\)\\|"
1614 "do\\(\\|nt-compile\\)\\|"
1537 "eval-\\(a\\(fter-load\\|nd-compile\\)\\|" 1615 "eval-\\(a\\(fter-load\\|nd-compile\\)\\|"
1538 "when-compile\\)\\|flet\\|i\\(f\\|nline\\)\\|" 1616 "when-compile\\)\\|flet\\|i\\(f\\|nline\\)\\|"
1539 "l\\(abels\\|et\\*?\\)\\|prog[nv12*]?\\|" 1617 "l\\(abels\\|et\\*?\\)\\|prog[nv12*]?\\|"
@@ -1557,8 +1635,8 @@ If (match-beginning 4) is non-nil, the item is followed by a `('."
1557 ;; Words inside `' tend to be symbol names. 1635 ;; Words inside `' tend to be symbol names.
1558 '("`\\(\\sw\\sw+\\)'" 1 font-lock-reference-face prepend) 1636 '("`\\(\\sw\\sw+\\)'" 1 font-lock-reference-face prepend)
1559 ;; 1637 ;;
1560 ;; CLisp `:' keywords as references. 1638 ;; CLisp `:' keywords as builtins.
1561 '("\\<:\\sw\\sw+\\>" 0 font-lock-reference-face prepend) 1639 '("\\<:\\sw\\sw+\\>" 0 font-lock-builtin-face)
1562 ;; 1640 ;;
1563 ;; ELisp and CLisp `&' keywords as types. 1641 ;; ELisp and CLisp `&' keywords as types.
1564 '("\\<\\&\\sw+\\>" . font-lock-type-face) 1642 '("\\<\\&\\sw+\\>" . font-lock-type-face)
@@ -1654,23 +1732,50 @@ If (match-beginning 4) is non-nil, the item is followed by a `('."
1654 1732
1655;;; User choices. 1733;;; User choices.
1656 1734
1735;; These provide a means to fontify types not defined by the language. Those
1736;; types might be the user's own or they might be generally accepted and used.
1737;; Generally excepted types are used to provide default variable values.
1738
1657(defvar c-font-lock-extra-types '("FILE" "\\sw+_t") 1739(defvar c-font-lock-extra-types '("FILE" "\\sw+_t")
1658 "*List of extra types to fontify in C mode. 1740 "*List of extra types to fontify in C mode.
1659Each list item should be a regexp without word-delimiters or parentheses.") 1741Each list item should be a regexp without word-delimiters or parentheses.
1742For example, a value of (\"FILE\" \"\\\\sw+_t\") means the word FILE and words
1743ending in _t are treated as type names.")
1660 1744
1661(defvar c++-font-lock-extra-types nil 1745(defvar c++-font-lock-extra-types nil
1662 "*List of extra types to fontify in C++ mode. 1746 "*List of extra types to fontify in C++ mode.
1663Each list item should be a regexp without word-delimiters or parentheses.") 1747Each list item should be a regexp without word-delimiters or parentheses.
1748For example, a value of (\"String\") means the word String is treated as a type
1749name.")
1664 1750
1665(defvar objc-font-lock-extra-types '("Class" "BOOL" "IMP" "SEL") 1751(defvar objc-font-lock-extra-types '("Class" "BOOL" "IMP" "SEL")
1666 "*List of extra types to fontify in Objective-C mode. 1752 "*List of extra types to fontify in Objective-C mode.
1667Each list item should be a regexp without word-delimiters or parentheses.") 1753Each list item should be a regexp without word-delimiters or parentheses.
1754For example, a value of (\"Class\" \"BOOL\" \"IMP\" \"SEL\") means the words
1755Class, BOOL, IMP and SEL are treated as type names.")
1668 1756
1669(defvar java-font-lock-extra-types '("[A-Z\300-\326\330-\337]\\sw+") 1757(defvar java-font-lock-extra-types '("[A-Z\300-\326\330-\337]\\sw+")
1670 "*List of extra types to fontify in Java mode. 1758 "*List of extra types to fontify in Java mode.
1671Each list item should be a regexp without word-delimiters or parentheses.") 1759Each list item should be a regexp without word-delimiters or parentheses.
1760For example, a value of (\"[A-Z\300-\326\330-\337]\\\\sw+\") means capitalised
1761words (and words conforming to the Java id spec) are treated as type names.")
1672 1762
1673;;; C. 1763;;; C.
1764
1765;; [Murmur murmur murmur] Maestro, drum-roll please... [Murmur murmur murmur.]
1766;; Ahem. [Murmur murmur murmur] Lay-dees an Gennel-men. [Murmur murmur shhh!]
1767;; I am most proud and humbly honoured today [murmur murmur cough] to present
1768;; to you good people, the winner of the Second Millennium Award for The Most
1769;; Hairy Language Syntax. [Ahhh!] All rise please. [Shuffle shuffle
1770;; shuffle.] And a round of applause please. For... The C Language! [Roar.]
1771;;
1772;; Thank you... You are too kind... It is with a feeling of great privilege
1773;; and indeed emotion [sob] that I accept this award. It has been a long hard
1774;; road. But we know our destiny. And our future. For we must not rest.
1775;; There are more tokens to overload, more shoehorn, more methodologies. But
1776;; more is a plus! [Ha ha ha.] And more means plus! [Ho ho ho.] The future
1777;; is C++! [Ohhh!] The Third Millennium Award will be ours! [Roar.]
1778
1674(defconst c-font-lock-keywords-1 nil 1779(defconst c-font-lock-keywords-1 nil
1675 "Subdued level highlighting for C mode.") 1780 "Subdued level highlighting for C mode.")
1676 1781
@@ -1689,14 +1794,14 @@ See also `c-font-lock-extra-types'.")
1689; ("auto" "extern" "register" "static" "typedef" "struct" "union" "enum" 1794; ("auto" "extern" "register" "static" "typedef" "struct" "union" "enum"
1690; "signed" "unsigned" "short" "long" "int" "char" "float" "double" 1795; "signed" "unsigned" "short" "long" "int" "char" "float" "double"
1691; "void" "volatile" "const") 1796; "void" "volatile" "const")
1692 (mapconcat 'identity 1797 `(mapconcat 'identity
1693 (cons 1798 (cons
1694 (concat "auto\\|c\\(har\\|onst\\)\\|double\\|e\\(num\\|xtern\\)\\|" 1799 (,@ (concat "auto\\|c\\(har\\|onst\\)\\|double\\|" ; 6 ()s deep.
1695 "float\\|int\\|long\\|register\\|" 1800 "e\\(num\\|xtern\\)\\|float\\|int\\|long\\|register\\|"
1696 "s\\(hort\\|igned\\|t\\(atic\\|ruct\\)\\)\\|typedef\\|" 1801 "s\\(hort\\|igned\\|t\\(atic\\|ruct\\)\\)\\|typedef\\|"
1697 "un\\(ion\\|signed\\)\\|vo\\(id\\|latile\\)") ; 6 ()s deep. 1802 "un\\(ion\\|signed\\)\\|vo\\(id\\|latile\\)"))
1698 c-font-lock-extra-types) 1803 c-font-lock-extra-types)
1699 "\\|")) 1804 "\\|"))
1700 ) 1805 )
1701 (setq c-font-lock-keywords-1 1806 (setq c-font-lock-keywords-1
1702 (list 1807 (list
@@ -1705,10 +1810,13 @@ See also `c-font-lock-extra-types'.")
1705 ;; Note that `c++-font-lock-keywords-1' depends on `c-font-lock-keywords-1'. 1810 ;; Note that `c++-font-lock-keywords-1' depends on `c-font-lock-keywords-1'.
1706 ;; 1811 ;;
1707 ;; Fontify function name definitions (GNU style; without type on line). 1812 ;; Fontify function name definitions (GNU style; without type on line).
1708 (list (concat "^\\(\\sw+\\)[ \t]*(") 1 'font-lock-function-name-face) 1813 '("^\\(\\sw+\\)[ \t]*(" 1 font-lock-function-name-face)
1814 ;;
1815 ;; Fontify error directives.
1816 '("^#[ \t]*error[ \t]+\\(.+\\)" 1 font-lock-warning-face prepend)
1709 ;; 1817 ;;
1710 ;; Fontify filenames in #include <...> preprocessor directives as strings. 1818 ;; Fontify filenames in #include <...> preprocessor directives as strings.
1711 '("^#[ \t]*\\(import\\|include\\)[ \t]+\\(<[^>\"\n]+>?\\)" 1819 '("^#[ \t]*\\(import\\|include\\)[ \t]+\\(<[^>\"\n]*>?\\)"
1712 2 font-lock-string-face) 1820 2 font-lock-string-face)
1713 ;; 1821 ;;
1714 ;; Fontify function macro names. 1822 ;; Fontify function macro names.
@@ -1731,7 +1839,8 @@ See also `c-font-lock-extra-types'.")
1731 ;; Simple regexps for speed. 1839 ;; Simple regexps for speed.
1732 ;; 1840 ;;
1733 ;; Fontify all type specifiers. 1841 ;; Fontify all type specifiers.
1734 (cons (concat "\\<\\(" c-type-types "\\)\\>") 'font-lock-type-face) 1842 `(eval .
1843 (cons (concat "\\<\\(" (,@ c-type-types) "\\)\\>") 'font-lock-type-face))
1735 ;; 1844 ;;
1736 ;; Fontify all builtin keywords (except case, default and goto; see below). 1845 ;; Fontify all builtin keywords (except case, default and goto; see below).
1737 (concat "\\<\\(" c-keywords "\\)\\>") 1846 (concat "\\<\\(" c-keywords "\\)\\>")
@@ -1754,33 +1863,34 @@ See also `c-font-lock-extra-types'.")
1754 (list 1863 (list
1755 ;; 1864 ;;
1756 ;; Fontify all storage classes and type specifiers, plus their items. 1865 ;; Fontify all storage classes and type specifiers, plus their items.
1757 (list (concat "\\<\\(" c-type-types "\\)\\>" 1866 `(eval .
1758 "\\([ \t*&]+\\sw+\\>\\)*") 1867 (list (concat "\\<\\(" (,@ c-type-types) "\\)\\>"
1759 ;; Fontify each declaration item. 1868 "\\([ \t*&]+\\sw+\\>\\)*")
1760 '(font-lock-match-c++-style-declaration-item-and-skip-to-next 1869 ;; Fontify each declaration item.
1761 ;; Start with point after all type specifiers. 1870 '(font-lock-match-c-style-declaration-item-and-skip-to-next
1762 (goto-char (or (match-beginning 8) (match-end 1))) 1871 ;; Start with point after all type specifiers.
1763 ;; Finish with point after first type specifier. 1872 (goto-char (or (match-beginning 8) (match-end 1)))
1764 (goto-char (match-end 1)) 1873 ;; Finish with point after first type specifier.
1765 ;; Fontify as a variable or function name. 1874 (goto-char (match-end 1))
1766 (1 (if (match-beginning 4) 1875 ;; Fontify as a variable or function name.
1767 font-lock-function-name-face 1876 (1 (if (match-beginning 2)
1768 font-lock-variable-name-face)))) 1877 font-lock-function-name-face
1878 font-lock-variable-name-face)))))
1769 ;; 1879 ;;
1770 ;; Fontify structures, or typedef names, plus their items. 1880 ;; Fontify structures, or typedef names, plus their items.
1771 '("\\(}\\)[ \t*]*\\sw" 1881 '("\\(}\\)[ \t*]*\\sw"
1772 (font-lock-match-c++-style-declaration-item-and-skip-to-next 1882 (font-lock-match-c-style-declaration-item-and-skip-to-next
1773 (goto-char (match-end 1)) nil 1883 (goto-char (match-end 1)) nil
1774 (1 (if (match-beginning 4) 1884 (1 (if (match-beginning 2)
1775 font-lock-function-name-face 1885 font-lock-function-name-face
1776 font-lock-variable-name-face)))) 1886 font-lock-variable-name-face))))
1777 ;; 1887 ;;
1778 ;; Fontify anything at beginning of line as a declaration or definition. 1888 ;; Fontify anything at beginning of line as a declaration or definition.
1779 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*" 1889 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*"
1780 (1 font-lock-type-face) 1890 (1 font-lock-type-face)
1781 (font-lock-match-c++-style-declaration-item-and-skip-to-next 1891 (font-lock-match-c-style-declaration-item-and-skip-to-next
1782 (goto-char (or (match-beginning 2) (match-end 1))) nil 1892 (goto-char (or (match-beginning 2) (match-end 1))) nil
1783 (1 (if (match-beginning 4) 1893 (1 (if (match-beginning 2)
1784 font-lock-function-name-face 1894 font-lock-function-name-face
1785 font-lock-variable-name-face)))) 1895 font-lock-variable-name-face))))
1786 ))) 1896 )))
@@ -1803,35 +1913,72 @@ See also `c++-font-lock-extra-types'.")
1803 "Gaudy level highlighting for C++ mode. 1913 "Gaudy level highlighting for C++ mode.
1804See also `c++-font-lock-extra-types'.") 1914See also `c++-font-lock-extra-types'.")
1805 1915
1806(let ((c++-keywords 1916(defun font-lock-match-c++-style-declaration-item-and-skip-to-next (limit)
1917 ;; Regexp matches after point: word<word>::word (
1918 ;; ^^^^ ^^^^ ^^^^ ^
1919 ;; Where the match subexpressions are: 1 3 5 6
1920 ;;
1921 ;; Item is delimited by (match-beginning 1) and (match-end 1).
1922 ;; If (match-beginning 3) is non-nil, that part of the item incloses a `<>'.
1923 ;; If (match-beginning 5) is non-nil, that part of the item follows a `::'.
1924 ;; If (match-beginning 6) is non-nil, the item is followed by a `('.
1925 (when (looking-at (eval-when-compile
1926 (concat "[ \t*&]*\\(\\sw+\\)"
1927 "\\(<\\(\\sw+\\)[ \t*&]*>\\)?"
1928 "\\(::\\**\\(\\sw+\\)\\)?"
1929 "[ \t]*\\((\\)?")))
1930 (save-match-data
1931 (condition-case nil
1932 (save-restriction
1933 ;; Restrict to the end of line, currently guaranteed to be LIMIT.
1934 (narrow-to-region (point-min) limit)
1935 (goto-char (match-end 1))
1936 ;; Move over any item value, etc., to the next item.
1937 (while (not (looking-at "[ \t]*\\(\\(,\\)\\|;\\|$\\)"))
1938 (goto-char (or (scan-sexps (point) 1) (point-max))))
1939 (goto-char (match-end 2)))
1940 (error t)))))
1941
1942(let* ((c++-keywords
1807; ("break" "continue" "do" "else" "for" "if" "return" "switch" "while" 1943; ("break" "continue" "do" "else" "for" "if" "return" "switch" "while"
1808; "asm" "catch" "delete" "new" "operator" "sizeof" "this" "throw" "try" 1944; "asm" "catch" "delete" "new" "operator" "sizeof" "this" "throw" "try"
1809; "protected" "private" "public"
1810; ;; Eric Hopper <hopper@omnifarious.mn.org> says these are new. 1945; ;; Eric Hopper <hopper@omnifarious.mn.org> says these are new.
1811; "static_cast" "dynamic_cast" "const_cast" "reinterpret_cast") 1946; "static_cast" "dynamic_cast" "const_cast" "reinterpret_cast")
1812 (concat "asm\\|break\\|c\\(atch\\|on\\(st_cast\\|tinue\\)\\)\\|" 1947 (concat "asm\\|break\\|c\\(atch\\|on\\(st_cast\\|tinue\\)\\)\\|"
1813 "d\\(elete\\|o\\|ynamic_cast\\)\\|else\\|for\\|if\\|new\\|" 1948 "d\\(elete\\|o\\|ynamic_cast\\)\\|else\\|for\\|if\\|new\\|"
1814 "operator\\|p\\(r\\(ivate\\|otected\\)\\|ublic\\)\\|" 1949 "operator\\|re\\(interpret_cast\\|turn\\)\\|"
1815 "re\\(interpret_cast\\|turn\\)\\|s\\(izeof\\|tatic_cast\\|" 1950 "s\\(izeof\\|tatic_cast\\|"
1816 "witch\\)\\|t\\(h\\(is\\|row\\)\\|ry\\)\\|while")) 1951 "witch\\)\\|t\\(h\\(is\\|row\\)\\|ry\\)\\|while"))
1817 (c++-type-types 1952 (c++-operators
1953 (mapconcat 'identity
1954 (mapcar 'regexp-quote
1955 ;; Taken from Stroustrup, minus keywords otherwise fontified.
1956 (sort '("+" "-" "*" "/" "%" "^" "&" "|" "~" "!" "=" "<" ">"
1957 "+=" "-=" "*=" "/=" "%=" "^=" "&=" "|=" "<<" ">>"
1958 ">>=" "<<=" "==" "!=" "<=" ">=" "&&" "||" "++" "--"
1959 "->*" "," "->" "[]" "()")
1960 (function (lambda (a b) (> (length a) (length b))))))
1961 "\\|"))
1962 (c++-type-types
1818; ("auto" "extern" "register" "static" "typedef" "struct" "union" "enum" 1963; ("auto" "extern" "register" "static" "typedef" "struct" "union" "enum"
1819; "signed" "unsigned" "short" "long" "int" "char" "float" "double" 1964; "signed" "unsigned" "short" "long" "int" "char" "float" "double"
1820; "void" "volatile" "const" "class" "inline" "friend" "bool" 1965; "void" "volatile" "const" "inline" "friend" "bool"
1821; "virtual" "complex" "template" 1966; "virtual" "complex" "template"
1822; ;; Eric Hopper <hopper@omnifarious.mn.org> says these are new. 1967; ;; Eric Hopper <hopper@omnifarious.mn.org> says these are new.
1823; "namespace" "using") 1968; "namespace" "using")
1824 (mapconcat 'identity 1969 `(mapconcat 'identity
1825 (cons 1970 (cons
1826 (concat "auto\\|bool\\|c\\(har\\|lass\\|o\\(mplex\\|nst\\)\\)\\|" 1971 (,@ (concat "auto\\|bool\\|c\\(har\\|o\\(mplex\\|nst\\)\\)\\|"
1827 "double\\|e\\(num\\|xtern\\)\\|f\\(loat\\|riend\\)\\|" 1972 "double\\|e\\(num\\|xtern\\)\\|f\\(loat\\|riend\\)\\|"
1828 "in\\(line\\|t\\)\\|long\\|namespace\\|register\\|" 1973 "in\\(line\\|t\\)\\|long\\|namespace\\|register\\|"
1829 "s\\(hort\\|igned\\|t\\(atic\\|ruct\\)\\)\\|" 1974 "s\\(hort\\|igned\\|t\\(atic\\|ruct\\)\\)\\|"
1830 "t\\(emplate\\|ypedef\\)\\|" 1975 "t\\(emplate\\|ypedef\\)\\|"
1831 "u\\(n\\(ion\\|signed\\)\\|sing\\)\\|" 1976 "u\\(n\\(ion\\|signed\\)\\|sing\\)\\|"
1832 "v\\(irtual\\|o\\(id\\|latile\\)\\)") ; 12 ()s deep. 1977 "v\\(irtual\\|o\\(id\\|latile\\)\\)")) ; 12 ()s deep.
1833 c++-font-lock-extra-types) 1978 c++-font-lock-extra-types)
1834 "\\|")) 1979 "\\|"))
1980 (c++-type-suffix "\\(<\\(\\sw+\\)[ \t*&]*>\\)?\\(::\\**\\(\\sw+\\)\\)?")
1981 (c++-type-spec (concat "\\(\\sw+\\)\\>" c++-type-suffix))
1835 ) 1982 )
1836 (setq c++-font-lock-keywords-1 1983 (setq c++-font-lock-keywords-1
1837 (append 1984 (append
@@ -1840,12 +1987,23 @@ See also `c++-font-lock-extra-types'.")
1840 (cdr c-font-lock-keywords-1) 1987 (cdr c-font-lock-keywords-1)
1841 (list 1988 (list
1842 ;; 1989 ;;
1843 ;; Fontify function name definitions, possibly incorporating class name. 1990 ;; Class names etc.
1844 '("^\\(\\sw+\\)\\(::\\(\\sw+\\)\\)?[ \t]*(" 1991 (list (concat "\\<\\(class\\|public\\|private\\|protected\\)\\>[ \t]*"
1845 (1 (if (match-beginning 2) 1992 "\\(" c++-type-spec "\\)?")
1846 font-lock-type-face 1993 '(1 font-lock-type-face)
1847 font-lock-function-name-face)) 1994 '(3 (if (match-beginning 6)
1848 (3 font-lock-function-name-face nil t)) 1995 font-lock-type-face
1996 font-lock-function-name-face) nil t)
1997 '(5 font-lock-function-name-face nil t)
1998 '(7 font-lock-function-name-face nil t))
1999 ;;
2000 ;; Fontify function name definitions, possibly incorporating class names.
2001 (list (concat "^" c++-type-spec "[ \t]*(")
2002 '(1 (if (or (match-beginning 2) (match-beginning 4))
2003 font-lock-type-face
2004 font-lock-function-name-face))
2005 '(3 font-lock-function-name-face nil t)
2006 '(5 font-lock-function-name-face nil t))
1849 ))) 2007 )))
1850 2008
1851 (setq c++-font-lock-keywords-2 2009 (setq c++-font-lock-keywords-2
@@ -1853,11 +2011,14 @@ See also `c++-font-lock-extra-types'.")
1853 (list 2011 (list
1854 ;; 2012 ;;
1855 ;; The list `c-font-lock-keywords-2' for C++ plus operator overloading. 2013 ;; The list `c-font-lock-keywords-2' for C++ plus operator overloading.
1856 (cons (concat "\\<\\(" c++-type-types "\\)\\>") 'font-lock-type-face) 2014 `(eval .
2015 (cons (concat "\\<\\(" (,@ c++-type-types) "\\)\\>")
2016 'font-lock-type-face))
1857 ;; 2017 ;;
1858 ;; Fontify operator function name overloading. 2018 ;; Fontify operator overloading.
1859 '("\\<\\(operator\\)\\>[ \t]*\\([[(><!=+-][])><=+-]?\\)?" 2019 (list (concat "\\<\\(operator\\)\\>[ \t]*\\(" c++-operators "\\)?")
1860 (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)) 2020 '(1 font-lock-keyword-face)
2021 '(2 font-lock-builtin-face nil t))
1861 ;; 2022 ;;
1862 ;; Fontify case/goto keywords and targets, and case default/goto tags. 2023 ;; Fontify case/goto keywords and targets, and case default/goto tags.
1863 '("\\<\\(case\\|goto\\)\\>[ \t]*\\(\\sw+\\)?" 2024 '("\\<\\(case\\|goto\\)\\>[ \t]*\\(\\sw+\\)?"
@@ -1880,41 +2041,46 @@ See also `c++-font-lock-extra-types'.")
1880 (list 2041 (list
1881 ;; 2042 ;;
1882 ;; Fontify all storage classes and type specifiers, plus their items. 2043 ;; Fontify all storage classes and type specifiers, plus their items.
1883 (list (concat "\\<\\(" c++-type-types "\\)\\>" 2044 `(eval .
1884 "\\([ \t*&]+\\sw+\\>\\)*") 2045 (list (concat "\\<\\(" (,@ c++-type-types) "\\)\\>" (,@ c++-type-suffix)
1885 ;; Fontify each declaration item. 2046 "\\([ \t*&]+" (,@ c++-type-spec) "\\)*")
1886 '(font-lock-match-c++-style-declaration-item-and-skip-to-next 2047 ;; Fontify each declaration item.
1887 ;; Start with point after all type specifiers. 2048 '(font-lock-match-c++-style-declaration-item-and-skip-to-next
1888 (goto-char (or (match-beginning 14) (match-end 1))) 2049 ;; Start with point after all type specifiers.
1889 ;; Finish with point after first type specifier. 2050 (goto-char (or (match-beginning 18) (match-end 1)))
1890 (goto-char (match-end 1)) 2051 ;; Finish with point after first type specifier.
1891 ;; Fontify as a variable or function name. 2052 (goto-char (match-end 1))
1892 (1 (cond ((match-beginning 2) font-lock-type-face) 2053 ;; Fontify as a variable or function name.
1893 ((match-beginning 4) font-lock-function-name-face) 2054 (1 (cond ((or (match-beginning 2) (match-beginning 4))
1894 (t font-lock-variable-name-face))) 2055 font-lock-type-face)
1895 (3 (if (match-beginning 4) 2056 ((match-beginning 6) font-lock-function-name-face)
1896 font-lock-function-name-face 2057 (t font-lock-variable-name-face)))
1897 font-lock-variable-name-face) nil t))) 2058 (3 font-lock-function-name-face nil t)
2059 (5 (if (match-beginning 6)
2060 font-lock-function-name-face
2061 font-lock-variable-name-face) nil t))))
1898 ;; 2062 ;;
1899 ;; Fontify structures, or typedef names, plus their items. 2063 ;; Fontify structures, or typedef names, plus their items.
1900 '("\\(}\\)[ \t*]*\\sw" 2064 '("\\(}\\)[ \t*]*\\sw"
1901 (font-lock-match-c++-style-declaration-item-and-skip-to-next 2065 (font-lock-match-c++-style-declaration-item-and-skip-to-next
1902 (goto-char (match-end 1)) nil 2066 (goto-char (match-end 1)) nil
1903 (1 (if (match-beginning 4) 2067 (1 (if (match-beginning 6)
1904 font-lock-function-name-face 2068 font-lock-function-name-face
1905 font-lock-variable-name-face)))) 2069 font-lock-variable-name-face))))
1906 ;; 2070 ;;
1907 ;; Fontify anything at beginning of line as a declaration or definition. 2071 ;; Fontify anything at beginning of line as a declaration or definition.
1908 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*" 2072 (list (concat "^\\(" c++-type-spec "[ \t*&]*\\)+")
1909 (1 font-lock-type-face) 2073 '(font-lock-match-c++-style-declaration-item-and-skip-to-next
1910 (font-lock-match-c++-style-declaration-item-and-skip-to-next 2074 (goto-char (match-beginning 1))
1911 (goto-char (or (match-beginning 2) (match-end 1))) nil 2075 (goto-char (match-end 1))
1912 (1 (cond ((match-beginning 2) font-lock-type-face) 2076 (1 (cond ((or (match-beginning 2) (match-beginning 4))
1913 ((match-beginning 4) font-lock-function-name-face) 2077 font-lock-type-face)
1914 (t font-lock-variable-name-face))) 2078 ((match-beginning 6) font-lock-function-name-face)
1915 (3 (if (match-beginning 4) 2079 (t font-lock-variable-name-face)))
1916 font-lock-function-name-face 2080 (3 font-lock-function-name-face nil t)
1917 font-lock-variable-name-face) nil t))) 2081 (5 (if (match-beginning 6)
2082 font-lock-function-name-face
2083 font-lock-variable-name-face) nil t)))
1918 ))) 2084 )))
1919 ) 2085 )
1920 2086
@@ -1944,19 +2110,20 @@ See also `objc-font-lock-extra-types'.")
1944 (concat "break\\|continue\\|do\\|else\\|for\\|if\\|return\\|" 2110 (concat "break\\|continue\\|do\\|else\\|for\\|if\\|return\\|"
1945 "s\\(elf\\|izeof\\|uper\\|witch\\)\\|while")) 2111 "s\\(elf\\|izeof\\|uper\\|witch\\)\\|while"))
1946 (objc-type-types 2112 (objc-type-types
1947 (mapconcat 'identity 2113 `(mapconcat 'identity
1948 (cons 2114 (cons
1949; '("auto" "extern" "register" "static" "typedef" "struct" "union" 2115; '("auto" "extern" "register" "static" "typedef" "struct" "union"
1950; "enum" "signed" "unsigned" "short" "long" "int" "char" 2116; "enum" "signed" "unsigned" "short" "long" "int" "char"
1951; "float" "double" "void" "volatile" "const" 2117; "float" "double" "void" "volatile" "const"
1952; "id" "oneway" "in" "out" "inout" "bycopy" "byref") 2118; "id" "oneway" "in" "out" "inout" "bycopy" "byref")
1953 (concat "auto\\|by\\(copy\\|ref\\)\\|c\\(har\\|onst\\)\\|double\\|" 2119 (,@ (concat "auto\\|by\\(copy\\|ref\\)\\|c\\(har\\|onst\\)\\|"
1954 "e\\(num\\|xtern\\)\\|float\\|i\\([dn]\\|n\\(out\\|t\\)\\)\\|" 2120 "double\\|e\\(num\\|xtern\\)\\|float\\|"
1955 "long\\|o\\(neway\\|ut\\)\\|register\\|s\\(hort\\|igned\\|" 2121 "i\\([dn]\\|n\\(out\\|t\\)\\)\\|long\\|"
1956 "t\\(atic\\|ruct\\)\\)\\|typedef\\|un\\(ion\\|signed\\)\\|" 2122 "o\\(neway\\|ut\\)\\|register\\|s\\(hort\\|igned\\|"
1957 "vo\\(id\\|latile\\)") 2123 "t\\(atic\\|ruct\\)\\)\\|typedef\\|"
1958 objc-font-lock-extra-types) 2124 "un\\(ion\\|signed\\)\\|vo\\(id\\|latile\\)"))
1959 "\\|")) 2125 objc-font-lock-extra-types)
2126 "\\|"))
1960 ) 2127 )
1961 (setq objc-font-lock-keywords-1 2128 (setq objc-font-lock-keywords-1
1962 (append 2129 (append
@@ -1966,9 +2133,9 @@ See also `objc-font-lock-extra-types'.")
1966 (list 2133 (list
1967 ;; 2134 ;;
1968 ;; Fontify compiler directives. 2135 ;; Fontify compiler directives.
1969 '("@\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?[ \t:<(]*" 2136 '("@\\(\\sw+\\)\\>"
1970 (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t) 2137 (1 font-lock-keyword-face)
1971 (font-lock-match-c++-style-declaration-item-and-skip-to-next nil nil 2138 ("\\=[ \t:<(,]*\\(\\sw+\\)" nil nil
1972 (1 font-lock-function-name-face))) 2139 (1 font-lock-function-name-face)))
1973 ;; 2140 ;;
1974 ;; Fontify method names and arguments. Oh Lordy! 2141 ;; Fontify method names and arguments. Oh Lordy!
@@ -1997,7 +2164,9 @@ See also `objc-font-lock-extra-types'.")
1997 ;; Simple regexps for speed. 2164 ;; Simple regexps for speed.
1998 ;; 2165 ;;
1999 ;; Fontify all type specifiers. 2166 ;; Fontify all type specifiers.
2000 (cons (concat "\\<\\(" objc-type-types "\\)\\>") 'font-lock-type-face) 2167 `(eval .
2168 (cons (concat "\\<\\(" (,@ objc-type-types) "\\)\\>")
2169 'font-lock-type-face))
2001 ;; 2170 ;;
2002 ;; Fontify all builtin keywords (except case, default and goto; see below). 2171 ;; Fontify all builtin keywords (except case, default and goto; see below).
2003 (concat "\\<\\(" objc-keywords "\\)\\>") 2172 (concat "\\<\\(" objc-keywords "\\)\\>")
@@ -2022,33 +2191,34 @@ See also `objc-font-lock-extra-types'.")
2022 (list 2191 (list
2023 ;; 2192 ;;
2024 ;; Fontify all storage classes and type specifiers, plus their items. 2193 ;; Fontify all storage classes and type specifiers, plus their items.
2025 (list (concat "\\<\\(" objc-type-types "\\)\\>" 2194 `(eval .
2026 "\\([ \t*&]+\\sw+\\>\\)*") 2195 (list (concat "\\<\\(" (,@ objc-type-types) "\\)\\>"
2027 ;; Fontify each declaration item. 2196 "\\([ \t*&]+\\sw+\\>\\)*")
2028 '(font-lock-match-c++-style-declaration-item-and-skip-to-next 2197 ;; Fontify each declaration item.
2029 ;; Start with point after all type specifiers. 2198 '(font-lock-match-c-style-declaration-item-and-skip-to-next
2030 (goto-char (or (match-beginning 2) (match-end 1))) 2199 ;; Start with point after all type specifiers.
2031 ;; Finish with point after first type specifier. 2200 (goto-char (or (match-beginning 2) (match-end 1)))
2032 (goto-char (match-end 1)) 2201 ;; Finish with point after first type specifier.
2033 ;; Fontify as a variable or function name. 2202 (goto-char (match-end 1))
2034 (1 (if (match-beginning 4) 2203 ;; Fontify as a variable or function name.
2035 font-lock-function-name-face 2204 (1 (if (match-beginning 2)
2036 font-lock-variable-name-face)))) 2205 font-lock-function-name-face
2206 font-lock-variable-name-face)))))
2037 ;; 2207 ;;
2038 ;; Fontify structures, or typedef names, plus their items. 2208 ;; Fontify structures, or typedef names, plus their items.
2039 '("\\(}\\)[ \t*]*\\sw" 2209 '("\\(}\\)[ \t*]*\\sw"
2040 (font-lock-match-c++-style-declaration-item-and-skip-to-next 2210 (font-lock-match-c-style-declaration-item-and-skip-to-next
2041 (goto-char (match-end 1)) nil 2211 (goto-char (match-end 1)) nil
2042 (1 (if (match-beginning 4) 2212 (1 (if (match-beginning 2)
2043 font-lock-function-name-face 2213 font-lock-function-name-face
2044 font-lock-variable-name-face)))) 2214 font-lock-variable-name-face))))
2045 ;; 2215 ;;
2046 ;; Fontify anything at beginning of line as a declaration or definition. 2216 ;; Fontify anything at beginning of line as a declaration or definition.
2047 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*" 2217 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*"
2048 (1 font-lock-type-face) 2218 (1 font-lock-type-face)
2049 (font-lock-match-c++-style-declaration-item-and-skip-to-next 2219 (font-lock-match-c-style-declaration-item-and-skip-to-next
2050 (goto-char (or (match-beginning 2) (match-end 1))) nil 2220 (goto-char (or (match-beginning 2) (match-end 1))) nil
2051 (1 (if (match-beginning 4) 2221 (1 (if (match-beginning 2)
2052 font-lock-function-name-face 2222 font-lock-function-name-face
2053 font-lock-variable-name-face)))) 2223 font-lock-variable-name-face))))
2054 ))) 2224 )))
@@ -2105,8 +2275,8 @@ See also `java-font-lock-extra-types'.")
2105 ;; 2275 ;;
2106 ;; Random types immediately followed by an object name. 2276 ;; Random types immediately followed by an object name.
2107 (java-other-types 2277 (java-other-types
2108 (mapconcat 'identity (cons "\\sw+\\.\\sw+" java-font-lock-extra-types) 2278 '(mapconcat 'identity (cons "\\sw+\\.\\sw+" java-font-lock-extra-types)
2109 "\\|")) 2279 "\\|"))
2110 ) 2280 )
2111 (setq java-font-lock-keywords-1 2281 (setq java-font-lock-keywords-1
2112 (list 2282 (list
@@ -2167,38 +2337,41 @@ See also `java-font-lock-extra-types'.")
2167 (list 2337 (list
2168 ;; 2338 ;;
2169 ;; Fontify random types in casts. 2339 ;; Fontify random types in casts.
2170 (list (concat "(\\(" java-other-types "\\))" 2340 `(eval .
2171 "[ \t]*\\(\\sw\\|[\"\(]\\)") 2341 (list (concat "(\\(" (,@ java-other-types) "\\))"
2172 ;; Fontify the type name. 2342 "[ \t]*\\(\\sw\\|[\"\(]\\)")
2173 '(1 font-lock-type-face)) 2343 ;; Fontify the type name.
2344 '(1 font-lock-type-face)))
2174 ;; 2345 ;;
2175 ;; Fontify random types immediately followed by an item or items. 2346 ;; Fontify random types immediately followed by an item or items.
2176 (list (concat "\\<\\(" java-other-types "\\)\\>" 2347 `(eval .
2177 "\\([ \t]*\\[[ \t]*\\]\\)*" 2348 (list (concat "\\<\\(" (,@ java-other-types) "\\)\\>"
2178 "[ \t]*\\sw") 2349 "\\([ \t]*\\[[ \t]*\\]\\)*"
2179 ;; Fontify the type name. 2350 "[ \t]*\\sw")
2180 '(1 font-lock-type-face)) 2351 ;; Fontify the type name.
2181 (list (concat "\\<\\(" java-other-types "\\)\\>" 2352 '(1 font-lock-type-face)))
2182 "\\([ \t]*\\[[ \t]*\\]\\)*" 2353 `(eval .
2183 "\\([ \t]*\\sw\\)") 2354 (list (concat "\\<\\(" (,@ java-other-types) "\\)\\>"
2184 ;; Fontify each declaration item. 2355 "\\([ \t]*\\[[ \t]*\\]\\)*"
2185 '(font-lock-match-c++-style-declaration-item-and-skip-to-next 2356 "\\([ \t]*\\sw\\)")
2186 ;; Start and finish with point after the type specifier. 2357 ;; Fontify each declaration item.
2187 (goto-char (match-beginning 3)) (goto-char (match-beginning 3)) 2358 '(font-lock-match-c-style-declaration-item-and-skip-to-next
2188 ;; Fontify as a variable or function name. 2359 ;; Start and finish with point after the type specifier.
2189 (1 (if (match-beginning 4) 2360 (goto-char (match-beginning 3)) (goto-char (match-beginning 3))
2190 font-lock-function-name-face 2361 ;; Fontify as a variable or function name.
2191 font-lock-variable-name-face)))) 2362 (1 (if (match-beginning 2)
2363 font-lock-function-name-face
2364 font-lock-variable-name-face)))))
2192 ;; 2365 ;;
2193 ;; Fontify those that are immediately followed by an item or items. 2366 ;; Fontify those that are immediately followed by an item or items.
2194 (list (concat "\\<\\(" java-minor-types "\\)\\>" 2367 (list (concat "\\<\\(" java-minor-types "\\)\\>"
2195 "\\([ \t]*\\[[ \t]*\\]\\)*") 2368 "\\([ \t]*\\[[ \t]*\\]\\)*")
2196 ;; Fontify each declaration item. 2369 ;; Fontify each declaration item.
2197 '(font-lock-match-c++-style-declaration-item-and-skip-to-next 2370 '(font-lock-match-c-style-declaration-item-and-skip-to-next
2198 ;; Start and finish with point after the type specifier. 2371 ;; Start and finish with point after the type specifier.
2199 nil (goto-char (match-end 0)) 2372 nil (goto-char (match-end 0))
2200 ;; Fontify as a variable or function name. 2373 ;; Fontify as a variable or function name.
2201 (1 (if (match-beginning 4) 2374 (1 (if (match-beginning 2)
2202 font-lock-function-name-face 2375 font-lock-function-name-face
2203 font-lock-variable-name-face)))) 2376 font-lock-variable-name-face))))
2204 ;; 2377 ;;
@@ -2208,13 +2381,13 @@ See also `java-font-lock-extra-types'.")
2208 "\\([ \t]*\\[[ \t]*\\]\\)*" 2381 "\\([ \t]*\\[[ \t]*\\]\\)*"
2209 "\\)*") 2382 "\\)*")
2210 ;; Fontify each declaration item. 2383 ;; Fontify each declaration item.
2211 '(font-lock-match-c++-style-declaration-item-and-skip-to-next 2384 '(font-lock-match-c-style-declaration-item-and-skip-to-next
2212 ;; Start with point after all type specifiers. 2385 ;; Start with point after all type specifiers.
2213 (goto-char (or (match-beginning 2) (match-end 1))) 2386 (goto-char (or (match-beginning 2) (match-end 1)))
2214 ;; Finish with point after first type specifier. 2387 ;; Finish with point after first type specifier.
2215 (goto-char (match-end 1)) 2388 (goto-char (match-end 1))
2216 ;; Fontify as a variable or function name. 2389 ;; Fontify as a variable or function name.
2217 (1 (if (match-beginning 4) 2390 (1 (if (match-beginning 2)
2218 font-lock-function-name-face 2391 font-lock-function-name-face
2219 font-lock-variable-name-face)))) 2392 font-lock-variable-name-face))))
2220 ))) 2393 )))