Mercurial > emacs
annotate lisp/progmodes/cc-fonts.el @ 90332:3f1e5b454299
(ccl-embed-string): Check string length.
Set special flag for multibyte character sequence.
(ccl-compile-write-string): Don't make str unibyte.
(ccl-compile-write-repeat): Likewise.
(ccl-compile-write): If the character code doesn't fit in 22-bit
(ccl-dump-write-const-string): Check special flag for multibyte
character sequence.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 02 Mar 2006 01:47:27 +0000 |
parents | 4b3d39451150 |
children | 8a8e69664178 |
rev | line source |
---|---|
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1 ;;; cc-fonts.el --- font lock support for CC Mode |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2 |
68773
dc49655f57ae
Update copyright for 2006.
Nick Roberts <nickrob@snap.net.nz>
parents:
67252
diff
changeset
|
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
4 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
5 ;; Authors: 2003- Alan Mackenzie |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
6 ;; 2002- Martin Stjernholm |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
7 ;; Maintainer: bug-cc-mode@gnu.org |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
8 ;; Created: 07-Jan-2002 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
9 ;; Version: See cc-mode.el |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
10 ;; Keywords: c languages oop |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
11 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
12 ;; This file is part of GNU Emacs. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
13 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
15 ;; it under the terms of the GNU General Public License as published by |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
16 ;; the Free Software Foundation; either version 2, or (at your option) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
17 ;; any later version. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
18 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
19 ;; GNU Emacs is distributed in the hope that it will be useful, |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
22 ;; GNU General Public License for more details. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
23 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
24 ;; You should have received a copy of the GNU General Public License |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
25 ;; along with this program; see the file COPYING. If not, write to |
64085 | 26 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
28 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
29 ;;; Commentary: |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
30 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
31 ;; Some comments on the use of faces: |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
32 ;; |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
33 ;; o `c-label-face-name' is either `font-lock-constant-face' (in |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
34 ;; Emacs), or `font-lock-reference-face'. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
35 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
36 ;; o `c-constant-face-name', `c-reference-face-name' and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
37 ;; `c-doc-markup-face-name' are essentially set up like |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
38 ;; `c-label-face-name'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
39 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
40 ;; o `c-preprocessor-face-name' is `font-lock-preprocessor-face' in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
41 ;; XEmacs and - in lack of a closer equivalent - |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
42 ;; `font-lock-builtin-face' or `font-lock-reference-face' in Emacs. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
43 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
44 ;; o `c-doc-face-name' is `font-lock-doc-string-face' in XEmacs, |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
45 ;; `font-lock-doc-face' in Emacs 21 and later, or |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
46 ;; `font-lock-comment-face' in older Emacs (that since source |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
47 ;; documentation are actually comments in these languages, as opposed |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
48 ;; to elisp). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
49 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
50 ;; TBD: We should probably provide real faces for the above uses and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
51 ;; instead initialize them from the standard faces. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
52 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
53 ;;; Code: |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
54 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
55 ;; The faces that already have been put onto the text is tested in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
56 ;; various places to direct further fontifications. For this to work, |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
57 ;; the following assumptions regarding the faces must hold (apart from |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
58 ;; the dependencies on the font locking order): |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
59 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
60 ;; o `font-lock-comment-face' and the face in `c-doc-face-name' is |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
61 ;; not used in anything but comments. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
62 ;; o If any face (e.g. `c-doc-markup-face-name') but those above is |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
63 ;; used in comments, it doesn't replace them. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
64 ;; o `font-lock-string-face' is not used in anything but string |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
65 ;; literals (single or double quoted). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
66 ;; o `font-lock-keyword-face' and the face in `c-label-face-name' are |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
67 ;; never overlaid with other faces. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
68 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
69 (eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
70 (let ((load-path |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
71 (if (and (boundp 'byte-compile-dest-file) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
72 (stringp byte-compile-dest-file)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
73 (cons (file-name-directory byte-compile-dest-file) load-path) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
74 load-path))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
75 (load "cc-bytecomp" nil t))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
76 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
77 (cc-require 'cc-defs) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
78 (cc-require-when-compile 'cc-langs) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
79 (cc-require 'cc-vars) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
80 (cc-require 'cc-engine) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
81 (cc-require-when-compile 'cc-awk) ; Change from cc-require, 2003/6/18 to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
82 ;; prevent cc-awk being loaded when it's not needed. There is now a (require |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
83 ;; 'cc-awk) in (defun awk-mode ..). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
84 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
85 ;; Avoid repeated loading through the eval-after-load directive in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
86 ;; cc-mode.el. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
87 (provide 'cc-fonts) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
88 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
89 (cc-external-require 'font-lock) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
90 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
91 (cc-bytecomp-defvar parse-sexp-lookup-properties) ; Emacs only. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
92 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
93 ;; Need to declare these local symbols during compilation since |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
94 ;; they're referenced from lambdas in `byte-compile' calls that are |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
95 ;; executed at compile time. They don't need to have the proper |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
96 ;; definitions, though, since the generated functions aren't called |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
97 ;; during compilation. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
98 (cc-bytecomp-defvar c-preprocessor-face-name) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
99 (cc-bytecomp-defvar c-reference-face-name) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
100 (cc-bytecomp-defun c-fontify-recorded-types-and-refs) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
101 (cc-bytecomp-defun c-font-lock-declarators) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
102 (cc-bytecomp-defun c-font-lock-objc-method) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
103 (cc-bytecomp-defun c-font-lock-invalid-string) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
104 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
105 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
106 ;; Note that font-lock in XEmacs doesn't expand face names as |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
107 ;; variables, so we have to use the (eval . FORM) in the font lock |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
108 ;; matchers wherever we use these alias variables. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
109 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
110 (defconst c-preprocessor-face-name |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
111 (cond ((c-face-name-p 'font-lock-preprocessor-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
112 ;; XEmacs has a font-lock-preprocessor-face. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
113 'font-lock-preprocessor-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
114 ((c-face-name-p 'font-lock-builtin-face) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
115 ;; In Emacs font-lock-builtin-face has traditionally been |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
116 ;; used for preprocessor directives. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
117 'font-lock-builtin-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
118 (t |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
119 'font-lock-reference-face))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
120 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
121 (cc-bytecomp-defvar font-lock-constant-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
122 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
123 (defconst c-label-face-name |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
124 (cond ((c-face-name-p 'font-lock-label-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
125 ;; If it happens to occur in the future. (Well, the more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
126 ;; pragmatic reason is to get unique faces for the test |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
127 ;; suite.) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
128 'font-lock-label-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
129 ((and (c-face-name-p 'font-lock-constant-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
130 (eq font-lock-constant-face 'font-lock-constant-face)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
131 ;; Test both if font-lock-constant-face exists and that it's |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
132 ;; not an alias for something else. This is important since |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
133 ;; we compare already set faces in various places. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
134 'font-lock-constant-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
135 (t |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
136 'font-lock-reference-face))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
137 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
138 (defconst c-constant-face-name |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
139 (if (and (c-face-name-p 'font-lock-constant-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
140 (eq font-lock-constant-face 'font-lock-constant-face)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
141 ;; This doesn't exist in some earlier versions of XEmacs 21. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
142 'font-lock-constant-face |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
143 c-label-face-name)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
144 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
145 (defconst c-reference-face-name |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
146 (with-no-warnings |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
147 (if (and (c-face-name-p 'font-lock-reference-face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
148 (eq font-lock-reference-face 'font-lock-reference-face)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
149 ;; This is considered obsolete in Emacs, but it still maps well |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
150 ;; to this use. (Another reason to do this is to get unique |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
151 ;; faces for the test suite.) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
152 'font-lock-reference-face |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
153 c-label-face-name))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
154 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
155 ;; This should not mapped to a face that also is used to fontify things |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
156 ;; that aren't comments or string literals. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
157 (defconst c-doc-face-name |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
158 (cond ((c-face-name-p 'font-lock-doc-string-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
159 ;; XEmacs. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
160 'font-lock-doc-string-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
161 ((c-face-name-p 'font-lock-doc-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
162 ;; Emacs 21 and later. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
163 'font-lock-doc-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
164 (t |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
165 'font-lock-comment-face))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
166 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
167 (defconst c-doc-markup-face-name |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
168 (if (c-face-name-p 'font-lock-doc-markup-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
169 ;; If it happens to occur in the future. (Well, the more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
170 ;; pragmatic reason is to get unique faces for the test |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
171 ;; suite.) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
172 'font-lock-doc-markup-face |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
173 c-label-face-name)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
174 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
175 (defconst c-negation-char-face-name |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
176 (if (c-face-name-p 'font-lock-negation-char-face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
177 ;; Emacs 22 has a special face for negation chars. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
178 'font-lock-negation-char-face)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
179 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
180 (cc-bytecomp-defun face-inverse-video-p) ; Only in Emacs. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
181 (cc-bytecomp-defun face-property-instance) ; Only in XEmacs. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
182 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
183 (defun c-make-inverse-face (oldface newface) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
184 ;; Emacs and XEmacs have completely different face manipulation |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
185 ;; routines. :P |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
186 (copy-face oldface newface) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
187 (cond ((fboundp 'face-inverse-video-p) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
188 ;; Emacs. This only looks at the inverse flag in the current |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
189 ;; frame. Other display configurations might be different, |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
190 ;; but it can only show if the same Emacs has frames on |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
191 ;; e.g. a color and a monochrome display simultaneously. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
192 (unless (face-inverse-video-p oldface) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
193 (invert-face newface))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
194 ((fboundp 'face-property-instance) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
195 ;; XEmacs. Same pitfall here. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
196 (unless (face-property-instance oldface 'reverse) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
197 (invert-face newface))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
198 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
199 (eval-and-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
200 ;; We need the following functions during compilation since they're |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
201 ;; called when the `c-lang-defconst' initializers are evaluated. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
202 ;; Define them at runtime too for the sake of derived modes. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
203 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
204 (defmacro c-put-font-lock-face (from to face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
205 ;; Put a face on a region (overriding any existing face) in the way |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
206 ;; font-lock would do it. In XEmacs that means putting an |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
207 ;; additional font-lock property, or else the font-lock package |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
208 ;; won't recognize it as fontified and might override it |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
209 ;; incorrectly. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
210 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
211 ;; This function does a hidden buffer change. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
212 (if (fboundp 'font-lock-set-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
213 ;; Note: This function has no docstring in XEmacs so it might be |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
214 ;; considered internal. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
215 `(font-lock-set-face ,from ,to ,face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
216 `(put-text-property ,from ,to 'face ,face))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
217 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
218 (defmacro c-remove-font-lock-face (from to) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
219 ;; This is the inverse of `c-put-font-lock-face'. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
220 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
221 ;; This function does a hidden buffer change. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
222 (if (fboundp 'font-lock-remove-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
223 `(font-lock-remove-face ,from ,to) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
224 `(remove-text-properties ,from ,to '(face nil)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
225 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
226 (defmacro c-put-font-lock-string-face (from to) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
227 ;; Put `font-lock-string-face' on a string. The surrounding |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
228 ;; quotes are included in Emacs but not in XEmacs. The passed |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
229 ;; region should include them. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
230 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
231 ;; This function does a hidden buffer change. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
232 (if (featurep 'xemacs) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
233 `(c-put-font-lock-face (1+ ,from) (1- ,to) 'font-lock-string-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
234 `(c-put-font-lock-face ,from ,to 'font-lock-string-face))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
235 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
236 (defmacro c-fontify-types-and-refs (varlist &rest body) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
237 ;; Like `let', but additionally activates `c-record-type-identifiers' |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
238 ;; and `c-record-ref-identifiers', and fontifies the recorded ranges |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
239 ;; accordingly on exit. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
240 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
241 ;; This function does hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
242 `(let ((c-record-type-identifiers t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
243 c-record-ref-identifiers |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
244 ,@varlist) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
245 (prog1 (progn ,@body) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
246 (c-fontify-recorded-types-and-refs)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
247 (put 'c-fontify-types-and-refs 'lisp-indent-function 1) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
248 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
249 (defun c-skip-comments-and-strings (limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
250 ;; If the point is within a region fontified as a comment or |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
251 ;; string literal skip to the end of it or to LIMIT, whichever |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
252 ;; comes first, and return t. Otherwise return nil. The match |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
253 ;; data is not clobbered. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
254 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
255 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
256 (when (c-got-face-at (point) c-literal-faces) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
257 (while (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
258 (goto-char (next-single-property-change |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
259 (point) 'face nil limit)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
260 (and (< (point) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
261 (c-got-face-at (point) c-literal-faces)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
262 t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
263 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
264 (defun c-make-syntactic-matcher (regexp) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
265 ;; Returns a byte compiled function suitable for use in place of a |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
266 ;; regexp string in a `font-lock-keywords' matcher, except that |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
267 ;; only matches outside comments and string literals count. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
268 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
269 ;; This function does not do any hidden buffer changes, but the |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
270 ;; generated functions will. (They are however used in places |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
271 ;; covered by the font-lock context.) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
272 (byte-compile |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
273 `(lambda (limit) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
274 (let (res) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
275 (while (and (setq res (re-search-forward ,regexp limit t)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
276 (progn |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
277 (goto-char (match-beginning 0)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
278 (or (c-skip-comments-and-strings limit) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
279 (progn |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
280 (goto-char (match-end 0)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
281 nil))))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
282 res)))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
283 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
284 (defun c-make-font-lock-search-function (regexp &rest highlights) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
285 ;; This function makes a byte compiled function that works much like |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
286 ;; a matcher element in `font-lock-keywords'. It cuts out a little |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
287 ;; bit of the overhead compared to a real matcher. The main reason |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
288 ;; is however to pass the real search limit to the anchored |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
289 ;; matcher(s), since most (if not all) font-lock implementations |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
290 ;; arbitrarily limits anchored matchers to the same line, and also |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
291 ;; to insulate against various other irritating differences between |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
292 ;; the different (X)Emacs font-lock packages. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
293 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
294 ;; REGEXP is the matcher, which must be a regexp. Only matches |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
295 ;; where the beginning is outside any comment or string literal are |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
296 ;; significant. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
297 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
298 ;; HIGHLIGHTS is a list of highlight specs, just like in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
299 ;; `font-lock-keywords', with these limitations: The face is always |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
300 ;; overridden (no big disadvantage, since hits in comments etc are |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
301 ;; filtered anyway), there is no "laxmatch", and an anchored matcher |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
302 ;; is always a form which must do all the fontification directly. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
303 ;; `limit' is a variable bound to the real limit in the context of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
304 ;; the anchored matcher forms. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
305 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
306 ;; This function does not do any hidden buffer changes, but the |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
307 ;; generated functions will. (They are however used in places |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
308 ;; covered by the font-lock context.) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
309 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
310 ;; Note: Replace `byte-compile' with `eval' to debug the generated |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
311 ;; lambda easier. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
312 (byte-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
313 `(lambda (limit) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
314 (let (;; The font-lock package in Emacs is known to clobber |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
315 ;; `parse-sexp-lookup-properties' (when it exists). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
316 (parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
317 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
318 (boundp 'parse-sexp-lookup-properties)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
319 (while (re-search-forward ,regexp limit t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
320 (unless (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
321 (goto-char (match-beginning 0)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
322 (c-skip-comments-and-strings limit)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
323 (goto-char (match-end 0)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
324 ,@(mapcar |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
325 (lambda (highlight) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
326 (if (integerp (car highlight)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
327 (progn |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
328 (unless (eq (nth 2 highlight) t) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
329 (error |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
330 "The override flag must currently be t in %s" |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
331 highlight)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
332 (when (nth 3 highlight) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
333 (error |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
334 "The laxmatch flag may currently not be set in %s" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
335 highlight)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
336 `(save-match-data |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
337 (c-put-font-lock-face |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
338 (match-beginning ,(car highlight)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
339 (match-end ,(car highlight)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
340 ,(elt highlight 1)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
341 (when (nth 3 highlight) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
342 (error "Match highlights currently not supported in %s" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
343 highlight)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
344 `(progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
345 ,(nth 1 highlight) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
346 (save-match-data ,(car highlight)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
347 ,(nth 2 highlight)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
348 highlights)))) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
349 nil))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
350 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
351 (eval-after-load "edebug" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
352 '(progn |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
353 (def-edebug-spec c-fontify-types-and-refs let*) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
354 (def-edebug-spec c-make-syntactic-matcher t) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
355 ;; If there are literal quoted or backquoted highlight specs in |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
356 ;; the call to `c-make-font-lock-search-function' then let's |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
357 ;; instrument the forms in them. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
358 (def-edebug-spec c-make-font-lock-search-function |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
359 (form &rest &or ("quote" (&rest form)) ("`" (&rest form)) form))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
360 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
361 (defun c-fontify-recorded-types-and-refs () |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
362 ;; Convert the ranges recorded on `c-record-type-identifiers' and |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
363 ;; `c-record-ref-identifiers' to fontification. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
364 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
365 ;; This function does hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
366 (let (elem) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
367 (while (consp c-record-type-identifiers) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
368 (setq elem (car c-record-type-identifiers) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
369 c-record-type-identifiers (cdr c-record-type-identifiers)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
370 (c-put-font-lock-face (car elem) (cdr elem) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
371 'font-lock-type-face)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
372 (while c-record-ref-identifiers |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
373 (setq elem (car c-record-ref-identifiers) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
374 c-record-ref-identifiers (cdr c-record-ref-identifiers)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
375 ;; Note that the reference face is a variable that is |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
376 ;; dereferenced, since it's an alias in Emacs. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
377 (c-put-font-lock-face (car elem) (cdr elem) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
378 c-reference-face-name)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
379 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
380 (c-lang-defconst c-cpp-matchers |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
381 "Font lock matchers for preprocessor directives and purely lexical |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
382 stuff. Used on level 1 and higher." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
383 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
384 ;; Note: `c-font-lock-declarations' assumes that no matcher here |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
385 ;; sets `font-lock-type-face' in languages where |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
386 ;; `c-recognize-<>-arglists' is set. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
387 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
388 t `(,@(when (c-lang-const c-opt-cpp-prefix) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
389 (let* ((noncontinued-line-end "\\(\\=\\|\\(\\=\\|[^\\]\\)[\n\r]\\)") |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
390 (ncle-depth (regexp-opt-depth noncontinued-line-end)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
391 (sws-depth (c-lang-const c-syntactic-ws-depth)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
392 (nsws-depth (c-lang-const c-nonempty-syntactic-ws-depth))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
393 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
394 `(;; The stuff after #error and #warning is a message, so |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
395 ;; fontify it as a string. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
396 ,@(when (c-lang-const c-cpp-message-directives) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
397 (let* ((re (c-make-keywords-re nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
398 (c-lang-const c-cpp-message-directives))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
399 (re-depth (regexp-opt-depth re))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
400 `((,(concat noncontinued-line-end |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
401 (c-lang-const c-opt-cpp-prefix) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
402 re |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
403 "\\s +\\(.*\\)$") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
404 ,(+ ncle-depth re-depth 1) font-lock-string-face)))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
405 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
406 ;; Fontify filenames in #include <...> as strings. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
407 ,@(when (c-lang-const c-cpp-include-directives) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
408 (let* ((re (c-make-keywords-re nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
409 (c-lang-const c-cpp-include-directives))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
410 (re-depth (regexp-opt-depth re))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
411 `((,(concat noncontinued-line-end |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
412 (c-lang-const c-opt-cpp-prefix) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
413 re |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
414 (c-lang-const c-syntactic-ws) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
415 "\\(<[^>\n\r]*>?\\)") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
416 (,(+ ncle-depth re-depth sws-depth 1) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
417 font-lock-string-face) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
418 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
419 ;; Use an anchored matcher to put paren syntax |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
420 ;; on the brackets. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
421 (,(byte-compile |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
422 `(lambda (limit) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
423 (let ((beg (match-beginning |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
424 ,(+ ncle-depth re-depth sws-depth 1))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
425 (end (1- (match-end ,(+ ncle-depth re-depth |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
426 sws-depth 1))))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
427 (if (eq (char-after end) ?>) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
428 (progn |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
429 (c-mark-<-as-paren beg) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
430 (c-mark->-as-paren end)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
431 (c-clear-char-property beg 'syntax-table))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
432 nil))))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
433 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
434 ;; #define. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
435 ,@(when (c-lang-const c-opt-cpp-macro-define) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
436 `((,(c-make-font-lock-search-function |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
437 (concat |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
438 noncontinued-line-end |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
439 (c-lang-const c-opt-cpp-prefix) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
440 (c-lang-const c-opt-cpp-macro-define) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
441 (c-lang-const c-nonempty-syntactic-ws) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
442 "\\(" (c-lang-const ; 1 + ncle + nsws |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
443 c-symbol-key) "\\)" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
444 (concat "\\(" ; 2 + ncle + nsws + c-sym-key |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
445 ;; Macro with arguments - a "function". |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
446 "\\(\(\\)" ; 3 + ncle + nsws + c-sym-key |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
447 "\\|" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
448 ;; Macro without arguments - a "variable". |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
449 "\\([^\(]\\|$\\)" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
450 "\\)")) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
451 `((if (match-beginning |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
452 ,(+ 3 ncle-depth nsws-depth |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
453 (c-lang-const c-symbol-key-depth))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
454 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
455 ;; "Function". Fontify the name and the arguments. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
456 (save-restriction |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
457 (c-put-font-lock-face |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
458 (match-beginning ,(+ 1 ncle-depth nsws-depth)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
459 (match-end ,(+ 1 ncle-depth nsws-depth)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
460 'font-lock-function-name-face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
461 (goto-char |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
462 (match-end |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
463 ,(+ 3 ncle-depth nsws-depth |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
464 (c-lang-const c-symbol-key-depth)))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
465 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
466 (narrow-to-region (point-min) limit) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
467 (while (and |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
468 (progn |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
469 (c-forward-syntactic-ws) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
470 (looking-at c-symbol-key)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
471 (progn |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
472 (c-put-font-lock-face |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
473 (match-beginning 0) (match-end 0) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
474 'font-lock-variable-name-face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
475 (goto-char (match-end 0)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
476 (c-forward-syntactic-ws) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
477 (eq (char-after) ?,))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
478 (forward-char))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
479 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
480 ;; "Variable". |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
481 (c-put-font-lock-face |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
482 (match-beginning ,(+ 1 ncle-depth nsws-depth)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
483 (match-end ,(+ 1 ncle-depth nsws-depth)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
484 'font-lock-variable-name-face))))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
485 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
486 ;; Fontify cpp function names in preprocessor |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
487 ;; expressions in #if and #elif. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
488 ,@(when (and (c-lang-const c-cpp-expr-directives) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
489 (c-lang-const c-cpp-expr-functions)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
490 (let ((ced-re (c-make-keywords-re t |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
491 (c-lang-const c-cpp-expr-directives))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
492 (cef-re (c-make-keywords-re t |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
493 (c-lang-const c-cpp-expr-functions)))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
494 `((,(c-make-font-lock-search-function |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
495 (concat noncontinued-line-end |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
496 (c-lang-const c-opt-cpp-prefix) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
497 ced-re ; 1 + ncle-depth |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
498 ;; Match the whole logical line to look |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
499 ;; for the functions in. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
500 "\\(\\\\\\(.\\|[\n\r]\\)\\|[^\n\r]\\)*") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
501 `((let ((limit (match-end 0))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
502 (while (re-search-forward ,cef-re limit 'move) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
503 (c-put-font-lock-face (match-beginning 1) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
504 (match-end 1) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
505 c-preprocessor-face-name))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
506 (goto-char (match-end ,(1+ ncle-depth))))))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
507 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
508 ;; Fontify the directive names. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
509 (,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
510 (concat noncontinued-line-end |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
511 "\\(" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
512 (c-lang-const c-opt-cpp-prefix) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
513 "[" (c-lang-const c-symbol-chars) "]+" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
514 "\\)") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
515 `(,(1+ ncle-depth) c-preprocessor-face-name t))) |
62079
bd033c2d7fd4
(c-cpp-matchers): Use font-lock-negation-char-face.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
61394
diff
changeset
|
516 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
517 (eval . (list ,(c-make-syntactic-matcher |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
518 (concat noncontinued-line-end |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
519 (c-lang-const c-opt-cpp-prefix) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
520 "if\\(n\\)def\\>")) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
521 ,(+ ncle-depth 1) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
522 c-negation-char-face-name |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
523 'append)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
524 ))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
525 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
526 ,@(when (c-major-mode-is 'pike-mode) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
527 ;; Recognize hashbangs in Pike. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
528 `((eval . (list "\\`#![^\n\r]*" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
529 0 c-preprocessor-face-name)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
530 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
531 ;; Make hard spaces visible through an inverted `font-lock-warning-face'. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
532 (eval . (list |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
533 "\240" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
534 0 (progn |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
535 (unless (c-face-name-p 'c-nonbreakable-space-face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
536 (c-make-inverse-face 'font-lock-warning-face |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
537 'c-nonbreakable-space-face)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
538 ''c-nonbreakable-space-face))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
539 )) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
540 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
541 (defun c-font-lock-invalid-string () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
542 ;; Assuming the point is after the opening character of a string, |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
543 ;; fontify that char with `font-lock-warning-face' if the string |
52606
e1373b8163ac
(c-font-lock-declarations): Fixed recognition of constructors and
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
544 ;; decidedly isn't terminated properly. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
545 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
546 ;; This function does hidden buffer changes. |
52606
e1373b8163ac
(c-font-lock-declarations): Fixed recognition of constructors and
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
547 (let ((start (1- (point)))) |
e1373b8163ac
(c-font-lock-declarations): Fixed recognition of constructors and
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
548 (save-excursion |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
549 (and (eq (elt (parse-partial-sexp start (c-point 'eol)) 8) start) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
550 (if (integerp c-multiline-string-start-char) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
551 ;; There's no multiline string start char before the |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
552 ;; string, so newlines aren't allowed. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
553 (not (eq (char-before start) c-multiline-string-start-char)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
554 ;; Multiline strings are allowed anywhere if |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
555 ;; c-multiline-string-start-char is t. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
556 (not c-multiline-string-start-char)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
557 (if c-string-escaped-newlines |
52606
e1373b8163ac
(c-font-lock-declarations): Fixed recognition of constructors and
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
558 ;; There's no \ before the newline. |
e1373b8163ac
(c-font-lock-declarations): Fixed recognition of constructors and
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
559 (not (eq (char-before (point)) ?\\)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
560 ;; Escaped newlines aren't supported. |
52606
e1373b8163ac
(c-font-lock-declarations): Fixed recognition of constructors and
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
561 t) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
562 (c-put-font-lock-face start (1+ start) 'font-lock-warning-face))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
563 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
564 (c-lang-defconst c-basic-matchers-before |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
565 "Font lock matchers for basic keywords, labels, references and various |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
566 other easily recognizable things that should be fontified before generic |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
567 casts and declarations are fontified. Used on level 2 and higher." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
568 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
569 ;; Note: `c-font-lock-declarations' assumes that no matcher here |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
570 ;; sets `font-lock-type-face' in languages where |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
571 ;; `c-recognize-<>-arglists' is set. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
572 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
573 t `(;; Put a warning face on the opener of unclosed strings that |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
574 ;; can't span lines. Later font |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
575 ;; lock packages have a `font-lock-syntactic-face-function' for |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
576 ;; this, but it doesn't give the control we want since any |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
577 ;; fontification done inside the function will be |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
578 ;; unconditionally overridden. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
579 ,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
580 ;; Match a char before the string starter to make |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
581 ;; `c-skip-comments-and-strings' work correctly. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
582 (concat ".\\(" c-string-limit-regexp "\\)") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
583 '((c-font-lock-invalid-string))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
584 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
585 ;; Fontify keyword constants. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
586 ,@(when (c-lang-const c-constant-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
587 (let ((re (c-make-keywords-re nil (c-lang-const c-constant-kwds)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
588 (if (c-major-mode-is 'pike-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
589 ;; No symbol is a keyword after "->" in Pike. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
590 `((eval . (list ,(concat "\\(\\=.?\\|[^>]\\|[^-]>\\)" |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
591 "\\<\\(" re "\\)\\>") |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
592 2 c-constant-face-name))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
593 `((eval . (list ,(concat "\\<\\(" re "\\)\\>") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
594 1 c-constant-face-name)))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
595 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
596 ;; Fontify all keywords except the primitive types. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
597 ,(if (c-major-mode-is 'pike-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
598 ;; No symbol is a keyword after "->" in Pike. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
599 `(,(concat "\\(\\=.?\\|[^>]\\|[^-]>\\)" |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
600 "\\<" (c-lang-const c-regular-keywords-regexp)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
601 2 font-lock-keyword-face) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
602 `(,(concat "\\<" (c-lang-const c-regular-keywords-regexp)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
603 1 font-lock-keyword-face)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
604 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
605 ;; Fontify leading identifiers in fully qualified names like |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
606 ;; "foo::bar" in languages that supports such things. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
607 ,@(when (c-lang-const c-opt-identifier-concat-key) |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
608 (if (c-major-mode-is 'java-mode) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
609 ;; Java needs special treatment since "." is used both to |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
610 ;; qualify names and in normal indexing. Here we look for |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
611 ;; capital characters at the beginning of an identifier to |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
612 ;; recognize the class. "*" is also recognized to cover |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
613 ;; wildcard import declarations. All preceding dot separated |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
614 ;; identifiers are taken as package names and therefore |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
615 ;; fontified as references. |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
616 `(,(c-make-font-lock-search-function |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
617 ;; Search for class identifiers preceded by ".". The |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
618 ;; anchored matcher takes it from there. |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
619 (concat (c-lang-const c-opt-identifier-concat-key) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
620 (c-lang-const c-simple-ws) "*" |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
621 (concat "\\(" |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
622 "[" c-upper "]" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
623 "[" (c-lang-const c-symbol-chars) "]*" |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
624 "\\|" |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
625 "\\*" |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
626 "\\)")) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
627 `((let (id-end) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
628 (goto-char (1+ (match-beginning 0))) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
629 (while (and (eq (char-before) ?.) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
630 (progn |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
631 (backward-char) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
632 (c-backward-syntactic-ws) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
633 (setq id-end (point)) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
634 (< (skip-chars-backward |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
635 ,(c-lang-const c-symbol-chars)) 0)) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
636 (not (get-text-property (point) 'face))) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
637 (c-put-font-lock-face (point) id-end |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
638 c-reference-face-name) |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
639 (c-backward-syntactic-ws))) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
640 nil |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
641 (goto-char (match-end 0))))) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
642 |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
643 `((,(byte-compile |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
644 ;; Must use a function here since we match longer than |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
645 ;; we want to move before doing a new search. This is |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
646 ;; not necessary for XEmacs since it restarts the |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
647 ;; search from the end of the first highlighted |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
648 ;; submatch (something that causes problems in other |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
649 ;; places). |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
650 `(lambda (limit) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
651 (while (re-search-forward |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
652 ,(concat "\\(\\<" ; 1 |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
653 "\\(" (c-lang-const c-symbol-key) "\\)" ; 2 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
654 (c-lang-const c-simple-ws) "*" |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
655 (c-lang-const c-opt-identifier-concat-key) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
656 (c-lang-const c-simple-ws) "*" |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
657 "\\)" |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
658 "\\(" |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
659 (c-lang-const c-opt-after-id-concat-key) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
660 "\\)") |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
661 limit t) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
662 (unless (progn |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
663 (goto-char (match-beginning 0)) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
664 (c-skip-comments-and-strings limit)) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
665 (or (get-text-property (match-beginning 2) 'face) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
666 (c-put-font-lock-face (match-beginning 2) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
667 (match-end 2) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
668 c-reference-face-name)) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
669 (goto-char (match-end 1)))))))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
670 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
671 ;; Fontify the special declarations in Objective-C. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
672 ,@(when (c-major-mode-is 'objc-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
673 `(;; Fontify class names in the beginning of message expressions. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
674 ,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
675 "\\[" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
676 '((c-fontify-types-and-refs () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
677 (c-forward-syntactic-ws limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
678 (let ((start (point))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
679 ;; In this case we accept both primitive and known types. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
680 (when (eq (c-forward-type) 'known) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
681 (goto-char start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
682 (let ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
683 (c-forward-type)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
684 (if (> (point) limit) (goto-char limit))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
685 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
686 ;; The @interface/@implementation/@protocol directives. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
687 ,(c-make-font-lock-search-function |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
688 (concat "\\<" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
689 (regexp-opt |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
690 '("@interface" "@implementation" "@protocol") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
691 t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
692 "\\>") |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
693 '((c-fontify-types-and-refs |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
694 (;; The font-lock package in Emacs is known to clobber |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
695 ;; `parse-sexp-lookup-properties' (when it exists). |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
696 (parse-sexp-lookup-properties |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
697 (cc-eval-when-compile |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
698 (boundp 'parse-sexp-lookup-properties)))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
699 (c-forward-objc-directive) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
700 nil) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
701 (goto-char (match-beginning 0)))))) |
62079
bd033c2d7fd4
(c-cpp-matchers): Use font-lock-negation-char-face.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
61394
diff
changeset
|
702 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
703 (eval . (list "\\(!\\)[^=]" 1 c-negation-char-face-name)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
704 )) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
705 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
706 (defun c-font-lock-complex-decl-prepare (limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
707 ;; Called before any of the matchers in `c-complex-decl-matchers'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
708 ;; Nil is always returned. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
709 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
710 ;; This function does hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
711 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
712 ;;(message "c-font-lock-complex-decl-prepare %s %s" (point) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
713 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
714 ;; Clear the list of found types if we start from the start of the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
715 ;; buffer, to make it easier to get rid of misspelled types and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
716 ;; variables that has gotten recognized as types in malformed code. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
717 (when (bobp) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
718 (c-clear-found-types)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
719 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
720 ;; Clear the c-type char properties in the region to recalculate |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
721 ;; them properly. This is necessary e.g. to handle constructs that |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
722 ;; might been required as declarations temporarily during editing. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
723 ;; The interesting properties are anyway those put on the closest |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
724 ;; token before the region. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
725 (c-clear-char-properties (point) limit 'c-type) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
726 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
727 ;; Update `c-state-cache' to the beginning of the region. This will |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
728 ;; make `c-beginning-of-syntax' go faster when it's used later on, |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
729 ;; and it's near the point most of the time. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
730 (c-parse-state) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
731 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
732 ;; Check if the fontified region starts inside a declarator list so |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
733 ;; that `c-font-lock-declarators' should be called at the start. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
734 (let ((prop (save-excursion |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
735 (c-backward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
736 (unless (bobp) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
737 (c-get-char-property (1- (point)) 'c-type))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
738 (when (memq prop '(c-decl-id-start c-decl-type-start)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
739 (c-forward-syntactic-ws limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
740 (c-font-lock-declarators limit t (eq prop 'c-decl-type-start)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
741 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
742 nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
743 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
744 (defun c-font-lock-<>-arglists (limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
745 ;; Fontify types and references in names containing angle bracket |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
746 ;; arglists from the point to LIMIT. Note that |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
747 ;; `c-font-lock-declarations' already has handled many of them. Nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
748 ;; is always returned. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
749 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
750 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
751 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
752 (let (;; The font-lock package in Emacs is known to clobber |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
753 ;; `parse-sexp-lookup-properties' (when it exists). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
754 (parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
755 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
756 (boundp 'parse-sexp-lookup-properties))) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
757 (c-parse-and-markup-<>-arglists t) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
758 c-restricted-<>-arglists |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
759 id-start id-end id-face pos kwd-sym) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
760 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
761 (while (and (< (point) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
762 (re-search-forward c-opt-<>-arglist-start limit t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
763 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
764 (setq id-start (match-beginning 1) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
765 id-end (match-end 1) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
766 pos (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
767 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
768 (goto-char id-start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
769 (unless (c-skip-comments-and-strings limit) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
770 (setq kwd-sym nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
771 c-restricted-<>-arglists nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
772 id-face (get-text-property id-start 'face)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
773 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
774 (if (cond |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
775 ((eq id-face 'font-lock-type-face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
776 ;; The identifier got the type face so it has already been |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
777 ;; handled in `c-font-lock-declarations'. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
778 nil) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
779 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
780 ((eq id-face 'font-lock-keyword-face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
781 (when (looking-at c-opt-<>-sexp-key) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
782 ;; There's a special keyword before the "<" that tells |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
783 ;; that it's an angle bracket arglist. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
784 (setq kwd-sym (c-keyword-sym (match-string 1))))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
785 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
786 (t |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
787 ;; There's a normal identifier before the "<". If we're not in |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
788 ;; a declaration context then we set `c-restricted-<>-arglists' |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
789 ;; to avoid recognizing templates in function calls like "foo (a |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
790 ;; < b, c > d)". |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
791 (c-backward-syntactic-ws) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
792 (when (and (memq (char-before) '(?\( ?,)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
793 (not (eq (get-text-property (1- (point)) 'c-type) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
794 'c-decl-arg-start))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
795 (setq c-restricted-<>-arglists t)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
796 t)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
797 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
798 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
799 (goto-char (1- pos)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
800 ;; Check for comment/string both at the identifier and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
801 ;; at the "<". |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
802 (unless (c-skip-comments-and-strings limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
803 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
804 (c-fontify-types-and-refs () |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
805 (when (c-forward-<>-arglist (c-keyword-member |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
806 kwd-sym 'c-<>-type-kwds)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
807 (when (and c-opt-identifier-concat-key |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
808 (not (get-text-property id-start 'face))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
809 (c-forward-syntactic-ws) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
810 (if (looking-at c-opt-identifier-concat-key) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
811 (c-put-font-lock-face id-start id-end |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
812 c-reference-face-name) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
813 (c-put-font-lock-face id-start id-end |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
814 'font-lock-type-face))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
815 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
816 (goto-char pos))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
817 (goto-char pos))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
818 nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
819 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
820 (defun c-font-lock-declarators (limit list types) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
821 ;; Assuming the point is at the start of a declarator in a |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
822 ;; declaration, fontify it. If LIST is non-nil, fontify also all |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
823 ;; following declarators in a comma separated list (e.g. "foo" and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
824 ;; "bar" in "int foo = 17, bar;"). Stop at LIMIT. If TYPES is |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
825 ;; non-nil, fontify all identifiers as types. Nil is always |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
826 ;; returned. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
827 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
828 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
829 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
830 ;;(message "c-font-lock-declarators from %s to %s" (point) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
831 (c-fontify-types-and-refs |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
832 ((pos (point)) next-pos id-start id-end |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
833 paren-depth |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
834 id-face got-init |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
835 c-last-identifier-range |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
836 (separator-prop (if types 'c-decl-type-start 'c-decl-id-start))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
837 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
838 (while (and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
839 pos |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
840 (< (point) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
841 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
842 (let (got-identifier) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
843 (setq paren-depth 0) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
844 ;; Skip over type decl prefix operators. (Note similar |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
845 ;; code in `c-forward-decl-or-cast-1'.) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
846 (while (and (looking-at c-type-decl-prefix-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
847 (if (and (c-major-mode-is 'c++-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
848 (match-beginning 2)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
849 ;; If the second submatch matches in C++ then |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
850 ;; we're looking at an identifier that's a |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
851 ;; prefix only if it specifies a member pointer. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
852 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
853 (setq id-start (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
854 (c-forward-name) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
855 (if (looking-at "\\(::\\)") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
856 ;; We only check for a trailing "::" and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
857 ;; let the "*" that should follow be |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
858 ;; matched in the next round. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
859 t |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
860 ;; It turned out to be the real identifier, |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
861 ;; so flag that and stop. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
862 (setq got-identifier t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
863 nil)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
864 t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
865 (if (eq (char-after) ?\() |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
866 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
867 (setq paren-depth (1+ paren-depth)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
868 (forward-char)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
869 (goto-char (match-end 1))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
870 (c-forward-syntactic-ws)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
871 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
872 ;; If we didn't pass the identifier above already, do it now. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
873 (unless got-identifier |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
874 (setq id-start (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
875 (c-forward-name)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
876 (setq id-end (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
877 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
878 (/= id-end pos)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
879 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
880 ;; Skip out of the parens surrounding the identifier. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
881 (or (= paren-depth 0) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
882 (c-safe (goto-char (scan-lists (point) 1 paren-depth)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
883 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
884 (<= (point) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
885 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
886 (progn |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
887 (when (looking-at c-decl-hangon-key) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
888 (c-forward-keyword-clause 1)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
889 (<= (point) limit)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
890 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
891 ;; Search syntactically to the end of the declarator (";", |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
892 ;; ",", a closen paren, eob etc) or to the beginning of an |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
893 ;; initializer or function prototype ("=" or "\\s\("). |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
894 ;; Note that the open paren will match array specs in |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
895 ;; square brackets, and we treat them as initializers too. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
896 (c-syntactic-re-search-forward |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
897 "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
898 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
899 (setq next-pos (match-beginning 0) |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
900 id-face (if (eq (char-after next-pos) ?\() |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
901 'font-lock-function-name-face |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
902 'font-lock-variable-name-face) |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
903 got-init (and (match-beginning 1) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
904 (char-after (match-beginning 1)))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
905 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
906 (if types |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
907 ;; Register and fontify the identifer as a type. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
908 (let ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
909 (goto-char id-start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
910 (c-forward-type)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
911 ;; Fontify the last symbol in the identifier if it isn't fontified |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
912 ;; already. The check is necessary only in certain cases where this |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
913 ;; function is used "sloppily", e.g. in `c-simple-decl-matchers'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
914 (when (and c-last-identifier-range |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
915 (not (get-text-property (car c-last-identifier-range) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
916 'face))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
917 (c-put-font-lock-face (car c-last-identifier-range) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
918 (cdr c-last-identifier-range) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
919 id-face))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
920 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
921 (goto-char next-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
922 (setq pos nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
923 (when list |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
924 ;; Jump past any initializer or function prototype to see if |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
925 ;; there's a ',' to continue at. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
926 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
927 (cond ((eq id-face 'font-lock-function-name-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
928 ;; Skip a parenthesized initializer (C++) or a function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
929 ;; prototype. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
930 (if (c-safe (c-forward-sexp 1) t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
931 (c-forward-syntactic-ws limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
932 (goto-char limit))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
933 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
934 (got-init |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
935 ;; Skip an initializer expression. If we're at a '=' |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
936 ;; then accept a brace list directly after it to cope |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
937 ;; with array initializers. Otherwise stop at braces |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
938 ;; to avoid going past full function and class blocks. |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
939 (and (if (and (eq got-init ?=) |
62641
27b53b1903b6
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
62254
diff
changeset
|
940 (= (c-forward-token-2 1 nil limit) 0) |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
941 (looking-at "{")) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
942 (c-safe (c-forward-sexp) t) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
943 t) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
944 ;; FIXME: Should look for c-decl-end markers here; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
945 ;; we might go far into the following declarations |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
946 ;; in e.g. ObjC mode (see e.g. methods-4.m). |
56646
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
947 (c-syntactic-re-search-forward "[;,{]" limit 'move t) |
b7446b6f097d
Updated CC Mode to 5.30.9.
Martin Stjernholm <mast@lysator.liu.se>
parents:
53073
diff
changeset
|
948 (backward-char))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
949 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
950 (t (c-forward-syntactic-ws limit))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
951 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
952 ;; If a ',' is found we set pos to the next declarator and iterate. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
953 (when (and (< (point) limit) (looking-at ",")) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
954 (c-put-char-property (point) 'c-type separator-prop) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
955 (forward-char) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
956 (c-forward-syntactic-ws limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
957 (setq pos (point)))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
958 nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
959 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
960 (defconst c-font-lock-maybe-decl-faces |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
961 ;; List of faces that might be put at the start of a type when |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
962 ;; `c-font-lock-declarations' runs. This needs to be evaluated to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
963 ;; ensure that face name aliases in Emacs are resolved. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
964 (list nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
965 font-lock-type-face |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
966 c-reference-face-name |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
967 font-lock-keyword-face)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
968 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
969 (defun c-font-lock-declarations (limit) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
970 ;; Fontify all the declarations, casts and labels from the point to LIMIT. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
971 ;; Assumes that strings and comments have been fontified already. Nil is |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
972 ;; always returned. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
973 ;; |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
974 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
975 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
976 ;;(message "c-font-lock-declarations search from %s to %s" (point) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
977 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
978 (save-restriction |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
979 (let (;; The position where `c-find-decl-spots' stopped. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
980 start-pos |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
981 ;; 'decl if we're in an arglist containing declarations (but |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
982 ;; if `c-recognize-paren-inits' is set it might also be an |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
983 ;; initializer arglist), '<> if the arglist is of angle |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
984 ;; bracket type, 'arglist if it's some other arglist, or nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
985 ;; if not in an arglist at all. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
986 context |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
987 ;; The position of the next token after the closing paren of |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
988 ;; the last detected cast. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
989 last-cast-end |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
990 ;; The result from `c-forward-decl-or-cast-1'. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
991 decl-or-cast |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
992 ;; The maximum of the end positions of all the checked type |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
993 ;; decl expressions in the successfully identified |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
994 ;; declarations. The position might be either before or |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
995 ;; after the syntactic whitespace following the last token |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
996 ;; in the type decl expression. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
997 (max-type-decl-end 0) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
998 ;; Same as `max-type-decl-*', but used when we're before |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
999 ;; `token-pos'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1000 (max-type-decl-end-before-token 0) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1001 ;; Set according to the context to direct the heuristics for |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1002 ;; recognizing C++ templates. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1003 c-restricted-<>-arglists |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1004 ;; Turn on recording of identifier ranges in |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1005 ;; `c-forward-decl-or-cast-1' and `c-forward-label' for |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1006 ;; later fontification. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1007 (c-record-type-identifiers t) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1008 c-record-ref-identifiers |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1009 ;; Make `c-forward-type' calls mark up template arglists if |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1010 ;; it finds any. That's necessary so that we later will |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1011 ;; stop inside them to fontify types there. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1012 (c-parse-and-markup-<>-arglists t) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1013 ;; The font-lock package in Emacs is known to clobber |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1014 ;; `parse-sexp-lookup-properties' (when it exists). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1015 (parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1016 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1017 (boundp 'parse-sexp-lookup-properties)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1018 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1019 ;; Below we fontify a whole declaration even when it crosses the limit, |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1020 ;; to avoid gaps when lazy-lock fontifies the file a screenful at a |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1021 ;; time. That is however annoying during editing, e.g. the following is |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1022 ;; a common situation while the first line is being written: |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1023 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1024 ;; my_variable |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1025 ;; some_other_variable = 0; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1026 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1027 ;; font-lock will put the limit at the beginning of the second line |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1028 ;; here, and if we go past it we'll fontify "my_variable" as a type and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1029 ;; "some_other_variable" as an identifier, and the latter will not |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1030 ;; correct itself until the second line is changed. To avoid that we |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1031 ;; narrow to the limit if the region to fontify is a single line. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1032 (narrow-to-region |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1033 (point-min) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1034 (if (<= limit (c-point 'bonl)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1035 (save-excursion |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1036 ;; Narrow after any operator chars following the limit though, |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1037 ;; since those characters can be useful in recognizing a |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1038 ;; declaration (in particular the '{' that opens a function body |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1039 ;; after the header). |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1040 (goto-char limit) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1041 (skip-chars-forward c-nonsymbol-chars) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1042 (point)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1043 limit)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1044 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1045 (c-find-decl-spots |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1046 limit |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1047 c-decl-start-re |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1048 c-font-lock-maybe-decl-faces |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1049 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1050 (lambda (match-pos inside-macro) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1051 (setq start-pos (point)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1052 (when |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1053 ;; The result of the form below is true when we don't recognize a |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1054 ;; declaration or cast. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1055 (if (and (eq (get-text-property (point) 'face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1056 'font-lock-keyword-face) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1057 (looking-at c-not-decl-init-keywords)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1058 ;; Don't do anything more if we're looking at a keyword that |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1059 ;; can't start a declaration. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1060 t |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1061 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1062 ;; Set `context'. Look for "<" for the sake of C++-style template |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1063 ;; arglists. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1064 (if (memq (char-before match-pos) '(?\( ?, ?\[ ?<)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1065 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1066 ;; Find out the type of the arglist. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1067 (if (<= match-pos (point-min)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1068 (setq context 'arglist) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1069 (let ((type (c-get-char-property (1- match-pos) 'c-type))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1070 (cond ((eq type 'c-decl-arg-start) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1071 ;; Got a cached hit in a declaration arglist. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1072 (setq context 'decl)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1073 ((or (eq type 'c-<>-arg-sep) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1074 (eq (char-before match-pos) ?<)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1075 ;; Inside an angle bracket arglist. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1076 (setq context '<>)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1077 (type |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1078 ;; Got a cached hit in some other type of arglist. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1079 (setq context 'arglist)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1080 ((if inside-macro |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1081 (< match-pos max-type-decl-end-before-token) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1082 (< match-pos max-type-decl-end)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1083 ;; The point is within the range of a previously |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1084 ;; encountered type decl expression, so the arglist |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1085 ;; is probably one that contains declarations. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1086 ;; However, if `c-recognize-paren-inits' is set it |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1087 ;; might also be an initializer arglist. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1088 (setq context 'decl) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1089 ;; The result of this check is cached with a char |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1090 ;; property on the match token, so that we can look |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1091 ;; it up again when refontifying single lines in a |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1092 ;; multiline declaration. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1093 (c-put-char-property (1- match-pos) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1094 'c-type 'c-decl-arg-start)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1095 (t |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1096 (setq context 'arglist))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1097 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1098 (setq context nil)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1099 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1100 ;; If we're in a normal arglist context we don't want to |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1101 ;; recognize commas in nested angle bracket arglists since |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1102 ;; those commas could be part of our own arglist. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1103 (setq c-restricted-<>-arglists (and c-recognize-<>-arglists |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1104 (eq context 'arglist)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1105 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1106 ;; Now analyze the construct. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1107 decl-or-cast (c-forward-decl-or-cast-1 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1108 match-pos context last-cast-end)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1109 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1110 (if (not decl-or-cast) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1111 ;; False alarm. Return t to go on to the next check. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1112 t |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1113 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1114 (if (eq decl-or-cast 'cast) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1115 ;; Save the position after the previous cast so we can feed |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1116 ;; it to `c-forward-decl-or-cast-1' in the next round. That |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1117 ;; helps it discover cast chains like "(a) (b) c". |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1118 (setq last-cast-end (point)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1119 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1120 ;; Set `max-type-decl-end' or `max-type-decl-end-before-token' |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1121 ;; under the assumption that we're after the first type decl |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1122 ;; expression in the declaration now. That's not really true; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1123 ;; we could also be after a parenthesized initializer |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1124 ;; expression in C++, but this is only used as a last resort |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1125 ;; to slant ambiguous expression/declarations, and overall |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1126 ;; it's worth the risk to occasionally fontify an expression |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1127 ;; as a declaration in an initializer expression compared to |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1128 ;; getting ambiguous things in normal function prototypes |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1129 ;; fontified as expressions. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1130 (if inside-macro |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1131 (when (> (point) max-type-decl-end-before-token) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1132 (setq max-type-decl-end-before-token (point))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1133 (when (> (point) max-type-decl-end) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1134 (setq max-type-decl-end (point)))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1135 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1136 ;; Back up to the type to fontify the declarator(s). |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1137 (goto-char (car decl-or-cast)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1138 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1139 (let ((decl-list |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1140 (if context |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1141 ;; Should normally not fontify a list of |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1142 ;; declarators inside an arglist, but the first |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1143 ;; argument in the ';' separated list of a "for" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1144 ;; statement is an exception. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1145 (when (eq (char-before match-pos) ?\() |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1146 (save-excursion |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1147 (goto-char (1- match-pos)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1148 (c-backward-syntactic-ws) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1149 (and (c-simple-skip-symbol-backward) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1150 (looking-at c-paren-stmt-key)))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1151 t))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1152 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1153 ;; Fix the `c-decl-id-start' or `c-decl-type-start' property |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1154 ;; before the first declarator if it's a list. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1155 ;; `c-font-lock-declarators' handles the rest. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1156 (when decl-list |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1157 (save-excursion |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1158 (c-backward-syntactic-ws) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1159 (unless (bobp) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1160 (c-put-char-property (1- (point)) 'c-type |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1161 (if (cdr decl-or-cast) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1162 'c-decl-type-start |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1163 'c-decl-id-start))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1164 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1165 (c-font-lock-declarators |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1166 (point-max) decl-list (cdr decl-or-cast)))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1167 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1168 ;; A cast or declaration has been successfully identified, so do |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1169 ;; all the fontification of types and refs that's been recorded. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1170 (c-fontify-recorded-types-and-refs) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1171 nil)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1172 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1173 ;; It was a false alarm. Check if we're in a label instead. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1174 (goto-char start-pos) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1175 (when (c-forward-label t match-pos nil) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1176 ;; Can't use `c-fontify-types-and-refs' here since we |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1177 ;; should use the label face. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1178 (let (elem) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1179 (while c-record-ref-identifiers |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1180 (setq elem (car c-record-ref-identifiers) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1181 c-record-ref-identifiers (cdr c-record-ref-identifiers)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1182 (c-put-font-lock-face (car elem) (cdr elem) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1183 c-label-face-name))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1184 ;; `c-forward-label' probably has added a `c-decl-end' |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1185 ;; marker, so return t to `c-find-decl-spots' to signal |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1186 ;; that. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1187 t)))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1188 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1189 nil))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1190 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1191 (c-lang-defconst c-simple-decl-matchers |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1192 "Simple font lock matchers for types and declarations. These are used |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1193 on level 2 only and so aren't combined with `c-complex-decl-matchers'." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1194 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1195 t `(;; Objective-C methods. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1196 ,@(when (c-major-mode-is 'objc-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1197 `((,(c-lang-const c-opt-method-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1198 (,(byte-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1199 (lambda (limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1200 (let (;; The font-lock package in Emacs is known to clobber |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1201 ;; `parse-sexp-lookup-properties' (when it exists). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1202 (parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1203 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1204 (boundp 'parse-sexp-lookup-properties)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1205 (save-restriction |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1206 (narrow-to-region (point-min) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1207 (c-font-lock-objc-method))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1208 nil)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1209 (goto-char (match-end 1)))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1210 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1211 ;; Fontify all type names and the identifiers in the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1212 ;; declarations they might start. Use eval here since |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1213 ;; `c-known-type-key' gets its value from |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1214 ;; `*-font-lock-extra-types' on mode init. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1215 (eval . (list ,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1216 'c-known-type-key |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1217 '(1 'font-lock-type-face t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1218 '((c-font-lock-declarators limit t nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1219 (save-match-data |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1220 (goto-char (match-end 1)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1221 (c-forward-syntactic-ws)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1222 (goto-char (match-end 1)))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1223 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1224 ;; Fontify types preceded by `c-type-prefix-kwds' and the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1225 ;; identifiers in the declarations they might start. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1226 ,@(when (c-lang-const c-type-prefix-kwds) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1227 (let* ((prefix-re (c-make-keywords-re nil |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1228 (c-lang-const c-type-prefix-kwds))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1229 (type-match (+ 2 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1230 (regexp-opt-depth prefix-re) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1231 (c-lang-const c-simple-ws-depth)))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1232 `((,(c-make-font-lock-search-function |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1233 (concat "\\<\\(" prefix-re "\\)" ; 1 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1234 (c-lang-const c-simple-ws) "+" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1235 (concat "\\(" ; 2 + prefix-re + c-simple-ws |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1236 (c-lang-const c-symbol-key) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1237 "\\)")) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1238 `(,type-match |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1239 'font-lock-type-face t) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1240 `((c-font-lock-declarators limit t nil) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1241 (save-match-data |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1242 (goto-char (match-end ,type-match)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1243 (c-forward-syntactic-ws)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1244 (goto-char (match-end ,type-match)))))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1245 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1246 ;; Fontify special declarations that lacks a type. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1247 ,@(when (c-lang-const c-typeless-decl-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1248 `((,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1249 (concat "\\<\\(" |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1250 (regexp-opt (c-lang-const c-typeless-decl-kwds)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1251 "\\)\\>") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1252 '((c-font-lock-declarators limit t nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1253 (save-match-data |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1254 (goto-char (match-end 1)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1255 (c-forward-syntactic-ws)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1256 (goto-char (match-end 1))))))) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1257 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1258 ;; Fontify generic colon labels in languages that support them. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1259 ,@(when (c-lang-const c-recognize-colon-labels) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1260 `(c-font-lock-labels)))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1261 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1262 (c-lang-defconst c-complex-decl-matchers |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1263 "Complex font lock matchers for types and declarations. Used on level |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1264 3 and higher." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1265 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1266 t `(;; Initialize some things before the search functions below. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1267 c-font-lock-complex-decl-prepare |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1268 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1269 ,@(if (c-major-mode-is 'objc-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1270 ;; Fontify method declarations in Objective-C, but first |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1271 ;; we have to put the `c-decl-end' `c-type' property on |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1272 ;; all the @-style directives that haven't been handled in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1273 ;; `c-basic-matchers-before'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1274 `(,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1275 (c-make-keywords-re t |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1276 ;; Exclude "@class" since that directive ends with a |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1277 ;; semicolon anyway. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1278 (delete "@class" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1279 (append (c-lang-const c-protection-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1280 (c-lang-const c-other-decl-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1281 nil))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1282 '((c-put-char-property (1- (match-end 1)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1283 'c-type 'c-decl-end))) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1284 c-font-lock-objc-methods)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1285 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1286 ;; Fontify all declarations, casts and normal labels. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1287 c-font-lock-declarations |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1288 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1289 ;; Fontify angle bracket arglists like templates in C++. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1290 ,@(when (c-lang-const c-recognize-<>-arglists) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1291 `(c-font-lock-<>-arglists)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1292 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1293 ;; The first two rules here mostly find occurences that |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1294 ;; `c-font-lock-declarations' has found already, but not |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1295 ;; declarations containing blocks in the type (see note below). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1296 ;; It's also useful to fontify these everywhere to show e.g. when |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1297 ;; a type keyword is accidentally used as an identifier. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1298 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1299 ;; Fontify basic types. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1300 ,(let ((re (c-make-keywords-re nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1301 (c-lang-const c-primitive-type-kwds)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1302 (if (c-major-mode-is 'pike-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1303 ;; No symbol is a keyword after "->" in Pike. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1304 `(,(concat "\\(\\=.?\\|[^>]\\|[^-]>\\)" |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1305 "\\<\\(" re "\\)\\>") |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1306 2 font-lock-type-face) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1307 `(,(concat "\\<\\(" re "\\)\\>") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1308 1 'font-lock-type-face))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1309 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1310 ;; Fontify types preceded by `c-type-prefix-kwds'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1311 ,@(when (c-lang-const c-type-prefix-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1312 `((,(byte-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1313 `(lambda (limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1314 (c-fontify-types-and-refs |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1315 ((c-promote-possible-types t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1316 ;; The font-lock package in Emacs is known to clobber |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1317 ;; `parse-sexp-lookup-properties' (when it exists). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1318 (parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1319 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1320 (boundp 'parse-sexp-lookup-properties)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1321 (save-restriction |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1322 ;; Narrow to avoid going past the limit in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1323 ;; `c-forward-type'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1324 (narrow-to-region (point) limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1325 (while (re-search-forward |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1326 ,(concat "\\<\\(" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1327 (c-make-keywords-re nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1328 (c-lang-const c-type-prefix-kwds)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1329 "\\)\\>") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1330 limit t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1331 (unless (c-skip-comments-and-strings limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1332 (c-forward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1333 ;; Handle prefix declaration specifiers. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1334 (when (looking-at c-prefix-spec-kwds-re) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1335 (c-forward-keyword-clause 1)) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1336 ,(if (c-major-mode-is 'c++-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1337 `(when (and (c-forward-type) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1338 (eq (char-after) ?=)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1339 ;; In C++ we additionally check for a "class |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1340 ;; X = Y" construct which is used in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1341 ;; templates, to fontify Y as a type. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1342 (forward-char) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1343 (c-forward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1344 (c-forward-type)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1345 `(c-forward-type)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1346 ))))))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1347 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1348 ;; Fontify symbols after closing braces as declaration |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1349 ;; identifiers under the assumption that they are part of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1350 ;; declarations like "class Foo { ... } foo;". It's too |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1351 ;; expensive to check this accurately by skipping past the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1352 ;; brace block, so we use the heuristic that it's such a |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1353 ;; declaration if the first identifier is on the same line as |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1354 ;; the closing brace. `c-font-lock-declarations' will later |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1355 ;; override it if it turns out to be an new declaration, but |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1356 ;; it will be wrong if it's an expression (see the test |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1357 ;; decls-8.cc). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1358 ,@(when (c-lang-const c-opt-block-decls-with-vars-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1359 `((,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1360 (concat "}" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1361 (c-lang-const c-single-line-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1362 "\\(" ; 1 + c-single-line-syntactic-ws-depth |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1363 (c-lang-const c-type-decl-prefix-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1364 "\\|" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1365 (c-lang-const c-symbol-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1366 "\\)") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1367 `((c-font-lock-declarators limit t nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1368 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1369 (c-put-char-property (match-beginning 0) 'c-type |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1370 'c-decl-id-start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1371 (goto-char (match-beginning |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1372 ,(1+ (c-lang-const |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1373 c-single-line-syntactic-ws-depth))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1374 (goto-char (match-end 0))))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1375 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1376 ;; Fontify the type in C++ "new" expressions. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1377 ,@(when (c-major-mode-is 'c++-mode) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1378 `(("\\<new\\>" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1379 (c-font-lock-c++-new)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1380 )) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1381 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1382 (defun c-font-lock-labels (limit) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1383 ;; Fontify all statement labels from the point to LIMIT. Assumes |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1384 ;; that strings and comments have been fontified already. Nil is |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1385 ;; always returned. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1386 ;; |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1387 ;; Note: This function is only used on decoration level 2; this is |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1388 ;; taken care of directly by the gargantuan |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1389 ;; `c-font-lock-declarations' on higher levels. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1390 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1391 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1392 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1393 (let (continue-pos id-start |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1394 ;; The font-lock package in Emacs is known to clobber |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1395 ;; `parse-sexp-lookup-properties' (when it exists). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1396 (parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1397 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1398 (boundp 'parse-sexp-lookup-properties)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1399 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1400 (while (re-search-forward ":[^:]" limit t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1401 (setq continue-pos (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1402 (goto-char (match-beginning 0)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1403 (unless (c-skip-comments-and-strings limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1404 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1405 (c-backward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1406 (and (setq id-start (c-on-identifier)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1407 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1408 (not (get-text-property id-start 'face)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1409 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1410 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1411 (goto-char id-start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1412 (c-backward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1413 (or |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1414 ;; Check for a char that precedes a statement. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1415 (memq (char-before) '(?\} ?\{ ?\;)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1416 ;; Check for a preceding label. We exploit the font |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1417 ;; locking made earlier by this function. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1418 (and (eq (char-before) ?:) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1419 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1420 (backward-char) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1421 (c-backward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1422 (not (bobp))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1423 (eq (get-text-property (1- (point)) 'face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1424 c-label-face-name)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1425 ;; Check for a keyword that precedes a statement. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1426 (c-after-conditional))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1427 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1428 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1429 ;; Got a label. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1430 (goto-char id-start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1431 (looking-at c-symbol-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1432 (c-put-font-lock-face (match-beginning 0) (match-end 0) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1433 c-label-face-name))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1434 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1435 (goto-char continue-pos)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1436 nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1437 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1438 (c-lang-defconst c-basic-matchers-after |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1439 "Font lock matchers for various things that should be fontified after |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1440 generic casts and declarations are fontified. Used on level 2 and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1441 higher." |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1442 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1443 t `(;; Fontify the identifiers inside enum lists. (The enum type |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1444 ;; name is handled by `c-simple-decl-matchers' or |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1445 ;; `c-complex-decl-matchers' below. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1446 ,@(when (c-lang-const c-brace-id-list-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1447 `((,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1448 (concat |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1449 "\\<\\(" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1450 (c-make-keywords-re nil (c-lang-const c-brace-id-list-kwds)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1451 "\\)\\>" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1452 ;; Disallow various common punctuation chars that can't come |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1453 ;; before the '{' of the enum list, to avoid searching too far. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1454 "[^\]\[{}();,/#=]*" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1455 "{") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1456 '((c-font-lock-declarators limit t nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1457 (save-match-data |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1458 (goto-char (match-end 0)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1459 (c-put-char-property (1- (point)) 'c-type |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1460 'c-decl-id-start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1461 (c-forward-syntactic-ws)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1462 (goto-char (match-end 0))))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1463 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1464 ;; Fontify labels after goto etc. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1465 ,@(when (c-lang-const c-before-label-kwds) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1466 `(;; (Got three different interpretation levels here, |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1467 ;; which makes it a bit complicated: 1) The backquote |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1468 ;; stuff is expanded when compiled or loaded, 2) the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1469 ;; eval form is evaluated at font-lock setup (to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1470 ;; substitute c-label-face-name correctly), and 3) the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1471 ;; resulting structure is interpreted during |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1472 ;; fontification.) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1473 (eval |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1474 . ,(let* ((c-before-label-re |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1475 (c-make-keywords-re nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1476 (c-lang-const c-before-label-kwds)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1477 `(list |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1478 ,(concat "\\<\\(" c-before-label-re "\\)\\>" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1479 "\\s *" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1480 "\\(" ; identifier-offset |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1481 (c-lang-const c-symbol-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1482 "\\)") |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1483 (list ,(+ (regexp-opt-depth c-before-label-re) 2) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1484 c-label-face-name nil t)))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1485 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1486 ;; Fontify the clauses after various keywords. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1487 ,@(when (or (c-lang-const c-type-list-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1488 (c-lang-const c-ref-list-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1489 (c-lang-const c-colon-type-list-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1490 (c-lang-const c-paren-type-kwds)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1491 `((,(c-make-font-lock-search-function |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1492 (concat "\\<\\(" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1493 (c-make-keywords-re nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1494 (append (c-lang-const c-type-list-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1495 (c-lang-const c-ref-list-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1496 (c-lang-const c-colon-type-list-kwds) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1497 (c-lang-const c-paren-type-kwds))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1498 "\\)\\>") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1499 '((c-fontify-types-and-refs ((c-promote-possible-types t)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1500 (c-forward-keyword-clause 1) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1501 (if (> (point) limit) (goto-char limit)))))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1502 )) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1503 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1504 (c-lang-defconst c-matchers-1 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1505 t (c-lang-const c-cpp-matchers)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1506 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1507 (c-lang-defconst c-matchers-2 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1508 t (append (c-lang-const c-matchers-1) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1509 (c-lang-const c-basic-matchers-before) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1510 (c-lang-const c-simple-decl-matchers) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1511 (c-lang-const c-basic-matchers-after))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1512 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1513 (c-lang-defconst c-matchers-3 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1514 t (append (c-lang-const c-matchers-1) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1515 (c-lang-const c-basic-matchers-before) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1516 (c-lang-const c-complex-decl-matchers) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1517 (c-lang-const c-basic-matchers-after))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1518 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1519 (defun c-compose-keywords-list (base-list) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1520 ;; Incorporate the font lock keyword lists according to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1521 ;; `c-doc-comment-style' on the given keyword list and return it. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1522 ;; This is used in the function bindings of the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1523 ;; `*-font-lock-keywords-*' symbols since we have to build the list |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1524 ;; when font-lock is initialized. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1525 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1526 (unless (memq c-doc-face-name c-literal-faces) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1527 (setq c-literal-faces (cons c-doc-face-name c-literal-faces))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1528 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1529 (let* ((doc-keywords |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1530 (if (consp (car-safe c-doc-comment-style)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1531 (cdr-safe (or (assq c-buffer-is-cc-mode c-doc-comment-style) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1532 (assq 'other c-doc-comment-style))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1533 c-doc-comment-style)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1534 (list (nconc (apply 'nconc |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1535 (mapcar |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1536 (lambda (doc-style) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1537 (let ((sym (intern |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1538 (concat (symbol-name doc-style) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1539 "-font-lock-keywords")))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1540 (cond ((fboundp sym) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1541 (funcall sym)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1542 ((boundp sym) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1543 (append (eval sym) nil))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1544 (if (listp doc-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1545 doc-keywords |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1546 (list doc-keywords)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1547 base-list))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1548 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1549 ;; Kludge: If `c-font-lock-complex-decl-prepare' is on the list we |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1550 ;; move it first since the doc comment font lockers might add |
51829
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
1551 ;; `c-type' text properties, so they have to be cleared before that. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1552 (when (memq 'c-font-lock-complex-decl-prepare list) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1553 (setq list (cons 'c-font-lock-complex-decl-prepare |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1554 (delq 'c-font-lock-complex-decl-prepare |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1555 (append list nil))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1556 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1557 list)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1558 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1559 (defun c-override-default-keywords (def-var) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1560 ;; This is used to override the value on a `*-font-lock-keywords' |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1561 ;; variable only if it's nil or has the same value as one of the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1562 ;; `*-font-lock-keywords-*' variables. Older font-lock packages |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1563 ;; define a default value for `*-font-lock-keywords' which we want |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1564 ;; to override, but we should otoh avoid clobbering a user setting. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1565 ;; This heuristic for that isn't perfect, but I can't think of any |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1566 ;; better. /mast |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1567 (when (and (boundp def-var) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1568 (memq (symbol-value def-var) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1569 (cons nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1570 (mapcar |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1571 (lambda (suffix) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1572 (let ((sym (intern (concat (symbol-name def-var) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1573 suffix)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1574 (and (boundp sym) (symbol-value sym)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1575 '("-1" "-2" "-3"))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1576 ;; The overriding is done by unbinding the variable so that the normal |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1577 ;; defvar will install its default value later on. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1578 (makunbound def-var))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1579 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1580 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1581 ;;; C. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1582 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1583 (c-override-default-keywords 'c-font-lock-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1584 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1585 (defconst c-font-lock-keywords-1 (c-lang-const c-matchers-1 c) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1586 "Minimal font locking for C mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1587 Fontifies only preprocessor directives (in addition to the syntactic |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1588 fontification of strings and comments).") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1589 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1590 (defconst c-font-lock-keywords-2 (c-lang-const c-matchers-2 c) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1591 "Fast normal font locking for C mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1592 In addition to `c-font-lock-keywords-1', this adds fontification of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1593 keywords, simple types, declarations that are easy to recognize, the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1594 user defined types on `c-font-lock-extra-types', and the doc comment |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1595 styles specified by `c-doc-comment-style'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1596 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1597 (defconst c-font-lock-keywords-3 (c-lang-const c-matchers-3 c) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1598 "Accurate normal font locking for C mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1599 Like `c-font-lock-keywords-2' but detects declarations in a more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1600 accurate way that works in most cases for arbitrary types without the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1601 need for `c-font-lock-extra-types'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1602 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1603 (defvar c-font-lock-keywords c-font-lock-keywords-3 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1604 "Default expressions to highlight in C mode.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1605 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1606 (defun c-font-lock-keywords-2 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1607 (c-compose-keywords-list c-font-lock-keywords-2)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1608 (defun c-font-lock-keywords-3 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1609 (c-compose-keywords-list c-font-lock-keywords-3)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1610 (defun c-font-lock-keywords () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1611 (c-compose-keywords-list c-font-lock-keywords)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1612 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1613 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1614 ;;; C++. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1615 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1616 (defun c-font-lock-c++-new (limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1617 ;; Assuming point is after a "new" word, check that it isn't inside |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1618 ;; a string or comment, and if so try to fontify the type in the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1619 ;; allocation expression. Nil is always returned. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1620 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1621 ;; As usual, C++ takes the prize in coming up with a hard to parse |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1622 ;; syntax. :P |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1623 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1624 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1625 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1626 (unless (c-skip-comments-and-strings limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1627 (save-excursion |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1628 (catch 'false-alarm |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1629 ;; A "new" keyword is followed by one to three expressions, where |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1630 ;; the type is the middle one, and the only required part. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1631 (let (expr1-pos expr2-pos |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1632 ;; Enable recording of identifier ranges in `c-forward-type' |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1633 ;; etc for later fontification. Not using |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1634 ;; `c-fontify-types-and-refs' here since the ranges should |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1635 ;; be fontified selectively only when an allocation |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1636 ;; expression is successfully recognized. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1637 (c-record-type-identifiers t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1638 c-record-ref-identifiers |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1639 ;; The font-lock package in Emacs is known to clobber |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1640 ;; `parse-sexp-lookup-properties' (when it exists). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1641 (parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1642 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1643 (boundp 'parse-sexp-lookup-properties)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1644 (c-forward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1645 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1646 ;; The first placement arglist is always parenthesized, if it |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1647 ;; exists. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1648 (when (eq (char-after) ?\() |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1649 (setq expr1-pos (1+ (point))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1650 (condition-case nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1651 (c-forward-sexp) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1652 (scan-error (throw 'false-alarm t))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1653 (c-forward-syntactic-ws)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1654 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1655 ;; The second expression is either a type followed by some "*" or |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1656 ;; "[...]" or similar, or a parenthesized type followed by a full |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1657 ;; identifierless declarator. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1658 (setq expr2-pos (1+ (point))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1659 (cond ((eq (char-after) ?\()) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1660 ((let ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1661 (c-forward-type))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1662 (t (setq expr2-pos nil))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1663 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1664 (when expr1-pos |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1665 (cond |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1666 ((not expr2-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1667 ;; No second expression, so the first has to be a |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1668 ;; parenthesized type. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1669 (goto-char expr1-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1670 (let ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1671 (c-forward-type))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1672 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1673 ((eq (char-before expr2-pos) ?\() |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1674 ;; Got two parenthesized expressions, so we have to look |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1675 ;; closer at them to decide which is the type. No need to |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1676 ;; handle `c-record-ref-identifiers' since all references |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1677 ;; has already been handled by other fontification rules. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1678 (let (expr1-res expr2-res) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1679 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1680 (goto-char expr1-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1681 (when (setq expr1-res (c-forward-type)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1682 (unless (looking-at |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1683 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1684 (concat (c-lang-const c-symbol-start c++) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1685 "\\|[*:\)\[]"))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1686 ;; There's something after the would-be type that |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1687 ;; can't be there, so this is a placement arglist. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1688 (setq expr1-res nil))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1689 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1690 (goto-char expr2-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1691 (when (setq expr2-res (c-forward-type)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1692 (unless (looking-at |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1693 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1694 (concat (c-lang-const c-symbol-start c++) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1695 "\\|[*:\)\[]"))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1696 ;; There's something after the would-be type that can't |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1697 ;; be there, so this is an initialization expression. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1698 (setq expr2-res nil)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1699 (when (and (c-go-up-list-forward) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1700 (progn (c-forward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1701 (eq (char-after) ?\())) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1702 ;; If there's a third initialization expression |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1703 ;; then the second one is the type, so demote the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1704 ;; first match. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1705 (setq expr1-res nil))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1706 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1707 ;; We fontify the most likely type, with a preference for |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1708 ;; the first argument since a placement arglist is more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1709 ;; unusual than an initializer. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1710 (cond ((memq expr1-res '(t known prefix))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1711 ((memq expr2-res '(t known prefix))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1712 ((eq expr1-res 'found) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1713 (let ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1714 (goto-char expr1-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1715 (c-forward-type))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1716 ((eq expr2-res 'found) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1717 (let ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1718 (goto-char expr2-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1719 (c-forward-type))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1720 ((and (eq expr1-res 'maybe) (not expr2-res)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1721 (let ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1722 (goto-char expr1-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1723 (c-forward-type))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1724 ((and (not expr1-res) (eq expr2-res 'maybe)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1725 (let ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1726 (goto-char expr2-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1727 (c-forward-type))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1728 ;; If both type matches are 'maybe then we're |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1729 ;; too uncertain to promote either of them. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1730 ))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1731 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1732 ;; Fontify the type that now is recorded in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1733 ;; `c-record-type-identifiers', if any. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1734 (c-fontify-recorded-types-and-refs))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1735 nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1736 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1737 (c-override-default-keywords 'c++-font-lock-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1738 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1739 (defconst c++-font-lock-keywords-1 (c-lang-const c-matchers-1 c++) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1740 "Minimal font locking for C++ mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1741 Fontifies only preprocessor directives (in addition to the syntactic |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1742 fontification of strings and comments).") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1743 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1744 (defconst c++-font-lock-keywords-2 (c-lang-const c-matchers-2 c++) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1745 "Fast normal font locking for C++ mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1746 In addition to `c++-font-lock-keywords-1', this adds fontification of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1747 keywords, simple types, declarations that are easy to recognize, the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1748 user defined types on `c++-font-lock-extra-types', and the doc comment |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1749 styles specified by `c-doc-comment-style'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1750 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1751 (defconst c++-font-lock-keywords-3 (c-lang-const c-matchers-3 c++) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1752 "Accurate normal font locking for C++ mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1753 Like `c++-font-lock-keywords-2' but detects declarations in a more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1754 accurate way that works in most cases for arbitrary types without the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1755 need for `c++-font-lock-extra-types'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1756 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1757 (defvar c++-font-lock-keywords c++-font-lock-keywords-3 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1758 "Default expressions to highlight in C++ mode.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1759 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1760 (defun c++-font-lock-keywords-2 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1761 (c-compose-keywords-list c++-font-lock-keywords-2)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1762 (defun c++-font-lock-keywords-3 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1763 (c-compose-keywords-list c++-font-lock-keywords-3)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1764 (defun c++-font-lock-keywords () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1765 (c-compose-keywords-list c++-font-lock-keywords)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1766 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1767 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1768 ;;; Objective-C. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1769 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1770 (defun c-font-lock-objc-method () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1771 ;; Assuming the point is after the + or - that starts an Objective-C |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1772 ;; method declaration, fontify it. This must be done before normal |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1773 ;; casts, declarations and labels are fontified since they will get |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1774 ;; false matches in these things. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1775 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1776 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1777 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1778 (c-fontify-types-and-refs |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1779 ((first t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1780 (c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1781 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1782 (while (and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1783 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1784 (c-forward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1785 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1786 ;; An optional method type. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1787 (if (eq (char-after) ?\() |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1788 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1789 (forward-char) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1790 (c-forward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1791 (c-forward-type) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1792 (prog1 (c-go-up-list-forward) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1793 (c-forward-syntactic-ws))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1794 t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1795 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1796 ;; The name. The first time it's the first part of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1797 ;; the function name, the rest of the time it's an |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1798 ;; argument name. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1799 (looking-at c-symbol-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1800 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1801 (goto-char (match-end 0)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1802 (c-put-font-lock-face (match-beginning 0) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1803 (point) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1804 (if first |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1805 'font-lock-function-name-face |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1806 'font-lock-variable-name-face)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1807 (c-forward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1808 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1809 ;; Another optional part of the function name. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1810 (when (looking-at c-symbol-key) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1811 (goto-char (match-end 0)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1812 (c-put-font-lock-face (match-beginning 0) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1813 (point) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1814 'font-lock-function-name-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1815 (c-forward-syntactic-ws)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1816 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1817 ;; There's another argument if a colon follows. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1818 (eq (char-after) ?:))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1819 (forward-char) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1820 (setq first nil)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1821 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1822 (defun c-font-lock-objc-methods (limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1823 ;; Fontify method declarations in Objective-C. Nil is always |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1824 ;; returned. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1825 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
1826 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1827 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1828 (let (;; The font-lock package in Emacs is known to clobber |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1829 ;; `parse-sexp-lookup-properties' (when it exists). |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1830 (parse-sexp-lookup-properties |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1831 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1832 (boundp 'parse-sexp-lookup-properties)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1833 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1834 (c-find-decl-spots |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1835 limit |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1836 "[-+]" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1837 nil |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1838 (lambda (match-pos inside-macro) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1839 (forward-char) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1840 (c-font-lock-objc-method)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1841 nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1842 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1843 (c-override-default-keywords 'objc-font-lock-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1844 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1845 (defconst objc-font-lock-keywords-1 (c-lang-const c-matchers-1 objc) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1846 "Minimal font locking for Objective-C mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1847 Fontifies only compiler directives (in addition to the syntactic |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1848 fontification of strings and comments).") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1849 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1850 (defconst objc-font-lock-keywords-2 (c-lang-const c-matchers-2 objc) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1851 "Fast normal font locking for Objective-C mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1852 In addition to `objc-font-lock-keywords-1', this adds fontification of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1853 keywords, simple types, declarations that are easy to recognize, the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1854 user defined types on `objc-font-lock-extra-types', and the doc |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1855 comment styles specified by `c-doc-comment-style'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1856 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1857 (defconst objc-font-lock-keywords-3 (c-lang-const c-matchers-3 objc) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1858 "Accurate normal font locking for Objective-C mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1859 Like `objc-font-lock-keywords-2' but detects declarations in a more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1860 accurate way that works in most cases for arbitrary types without the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1861 need for `objc-font-lock-extra-types'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1862 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1863 (defvar objc-font-lock-keywords objc-font-lock-keywords-3 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1864 "Default expressions to highlight in Objective-C mode.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1865 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1866 (defun objc-font-lock-keywords-2 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1867 (c-compose-keywords-list objc-font-lock-keywords-2)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1868 (defun objc-font-lock-keywords-3 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1869 (c-compose-keywords-list objc-font-lock-keywords-3)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1870 (defun objc-font-lock-keywords () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1871 (c-compose-keywords-list objc-font-lock-keywords)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1872 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1873 ;; Kludge to override the default value that |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1874 ;; `objc-font-lock-extra-types' might have gotten from the font-lock |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1875 ;; package. The value replaced here isn't relevant now anyway since |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1876 ;; those types are builtin and therefore listed directly in |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1877 ;; `c-primitive-type-kwds'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1878 (when (equal (sort (append objc-font-lock-extra-types nil) 'string-lessp) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1879 '("BOOL" "Class" "IMP" "SEL")) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1880 (setq objc-font-lock-extra-types |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1881 (cc-eval-when-compile (list (concat "[" c-upper "]\\sw*"))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1882 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1883 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1884 ;;; Java. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1885 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1886 (c-override-default-keywords 'java-font-lock-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1887 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1888 (defconst java-font-lock-keywords-1 (c-lang-const c-matchers-1 java) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1889 "Minimal font locking for Java mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1890 Fontifies nothing except the syntactic fontification of strings and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1891 comments.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1892 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1893 (defconst java-font-lock-keywords-2 (c-lang-const c-matchers-2 java) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1894 "Fast normal font locking for Java mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1895 In addition to `java-font-lock-keywords-1', this adds fontification of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1896 keywords, simple types, declarations that are easy to recognize, the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1897 user defined types on `java-font-lock-extra-types', and the doc |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1898 comment styles specified by `c-doc-comment-style'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1899 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1900 (defconst java-font-lock-keywords-3 (c-lang-const c-matchers-3 java) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1901 "Accurate normal font locking for Java mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1902 Like `java-font-lock-keywords-2' but detects declarations in a more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1903 accurate way that works in most cases for arbitrary types without the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1904 need for `java-font-lock-extra-types'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1905 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1906 (defvar java-font-lock-keywords java-font-lock-keywords-3 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1907 "Default expressions to highlight in Java mode.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1908 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1909 (defun java-font-lock-keywords-2 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1910 (c-compose-keywords-list java-font-lock-keywords-2)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1911 (defun java-font-lock-keywords-3 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1912 (c-compose-keywords-list java-font-lock-keywords-3)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1913 (defun java-font-lock-keywords () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1914 (c-compose-keywords-list java-font-lock-keywords)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1915 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1916 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1917 ;;; CORBA IDL. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1918 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1919 (c-override-default-keywords 'idl-font-lock-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1920 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1921 (defconst idl-font-lock-keywords-1 (c-lang-const c-matchers-1 idl) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1922 "Minimal font locking for CORBA IDL mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1923 Fontifies nothing except the syntactic fontification of strings and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1924 comments.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1925 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1926 (defconst idl-font-lock-keywords-2 (c-lang-const c-matchers-2 idl) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1927 "Fast normal font locking for CORBA IDL mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1928 In addition to `idl-font-lock-keywords-1', this adds fontification of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1929 keywords, simple types, declarations that are easy to recognize, the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1930 user defined types on `idl-font-lock-extra-types', and the doc comment |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1931 styles specified by `c-doc-comment-style'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1932 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1933 (defconst idl-font-lock-keywords-3 (c-lang-const c-matchers-3 idl) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1934 "Accurate normal font locking for CORBA IDL mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1935 Like `idl-font-lock-keywords-2' but detects declarations in a more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1936 accurate way that works in most cases for arbitrary types without the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1937 need for `idl-font-lock-extra-types'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1938 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1939 (defvar idl-font-lock-keywords idl-font-lock-keywords-3 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1940 "Default expressions to highlight in CORBA IDL mode.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1941 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1942 (defun idl-font-lock-keywords-2 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1943 (c-compose-keywords-list idl-font-lock-keywords-2)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1944 (defun idl-font-lock-keywords-3 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1945 (c-compose-keywords-list idl-font-lock-keywords-3)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1946 (defun idl-font-lock-keywords () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1947 (c-compose-keywords-list idl-font-lock-keywords)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1948 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1949 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1950 ;;; Pike. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1951 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1952 (c-override-default-keywords 'pike-font-lock-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1953 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1954 (defconst pike-font-lock-keywords-1 (c-lang-const c-matchers-1 pike) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1955 "Minimal font locking for Pike mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1956 Fontifies only preprocessor directives (in addition to the syntactic |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1957 fontification of strings and comments).") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1958 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1959 (defconst pike-font-lock-keywords-2 (c-lang-const c-matchers-2 pike) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1960 "Fast normal font locking for Pike mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1961 In addition to `pike-font-lock-keywords-1', this adds fontification of |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1962 keywords, simple types, declarations that are easy to recognize, the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1963 user defined types on `pike-font-lock-extra-types', and the doc |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1964 comment styles specified by `c-doc-comment-style'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1965 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1966 (defconst pike-font-lock-keywords-3 (c-lang-const c-matchers-3 pike) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1967 "Accurate normal font locking for Pike mode. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1968 Like `pike-font-lock-keywords-2' but detects declarations in a more |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1969 accurate way that works in most cases for arbitrary types without the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1970 need for `pike-font-lock-extra-types'.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1971 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1972 (defvar pike-font-lock-keywords pike-font-lock-keywords-3 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1973 "Default expressions to highlight in Pike mode.") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1974 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1975 (defun pike-font-lock-keywords-2 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1976 (c-compose-keywords-list pike-font-lock-keywords-2)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1977 (defun pike-font-lock-keywords-3 () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1978 (c-compose-keywords-list pike-font-lock-keywords-3)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1979 (defun pike-font-lock-keywords () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1980 (c-compose-keywords-list pike-font-lock-keywords)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1981 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1982 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1983 ;;; Doc comments. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1984 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1985 (defun c-font-lock-doc-comments (prefix limit keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1986 ;; Fontify the comments between the point and LIMIT whose start |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1987 ;; matches PREFIX with `c-doc-face-name'. Assumes comments have been |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1988 ;; fontified with `font-lock-comment-face' already. nil is always |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1989 ;; returned. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1990 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1991 ;; After the fontification of a matching comment, fontification |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1992 ;; according to KEYWORDS is applied inside it. It's a list like |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1993 ;; `font-lock-keywords' except that anchored matches and eval |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1994 ;; clauses aren't supported and that some abbreviated forms can't be |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1995 ;; used. The buffer is narrowed to the comment while KEYWORDS is |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1996 ;; applied; leading comment starters are included but trailing |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1997 ;; comment enders for block comment are not. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1998 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
1999 ;; Note that faces added through KEYWORDS should never replace the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2000 ;; existing `c-doc-face-name' face since the existence of that face |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2001 ;; is used as a flag in other code to skip comments. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2002 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2003 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2004 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2005 (let (comment-beg region-beg) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2006 (if (eq (get-text-property (point) 'face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2007 'font-lock-comment-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2008 ;; Handle the case when the fontified region starts inside a |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2009 ;; comment. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2010 (let ((range (c-literal-limits))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2011 (setq region-beg (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2012 (when range |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2013 (goto-char (car range))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2014 (when (looking-at prefix) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2015 (setq comment-beg (point))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2016 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2017 (while (or |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2018 comment-beg |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2019 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2020 ;; Search for the prefix until a match is found at the start |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2021 ;; of a comment. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2022 (while (when (re-search-forward prefix limit t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2023 (setq comment-beg (match-beginning 0)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2024 (or (not (c-got-face-at comment-beg |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2025 c-literal-faces)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2026 (and (/= comment-beg (point-min)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2027 (c-got-face-at (1- comment-beg) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2028 c-literal-faces)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2029 (setq comment-beg nil)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2030 (setq region-beg comment-beg)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2031 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2032 (if (eq (elt (parse-partial-sexp comment-beg (+ comment-beg 2)) 7) t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2033 ;; Collect a sequence of doc style line comments. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2034 (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2035 (goto-char comment-beg) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2036 (while (and (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2037 (c-forward-single-comment) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2038 (skip-syntax-forward " ") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2039 (< (point) limit)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2040 (looking-at prefix)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2041 (goto-char comment-beg) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2042 (c-forward-single-comment)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2043 (if (> (point) limit) (goto-char limit)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2044 (setq comment-beg nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2045 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2046 (let ((region-end (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2047 (keylist keywords) keyword matcher highlights) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2048 (c-put-font-lock-face region-beg region-end c-doc-face-name) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2049 (save-restriction |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2050 ;; Narrow to the doc comment. Among other things, this |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2051 ;; helps by making "^" match at the start of the comment. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2052 ;; Do not include a trailing block comment ender, though. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2053 (and (> region-end (1+ region-beg)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2054 (progn (goto-char region-end) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2055 (backward-char 2) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2056 (looking-at "\\*/")) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2057 (setq region-end (point))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2058 (narrow-to-region region-beg region-end) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2059 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2060 (while keylist |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2061 (setq keyword (car keylist) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2062 keylist (cdr keylist) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2063 matcher (car keyword)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2064 (goto-char region-beg) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2065 (while (if (stringp matcher) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2066 (re-search-forward matcher region-end t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2067 (funcall matcher region-end)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2068 (setq highlights (cdr keyword)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2069 (if (consp (car highlights)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2070 (while highlights |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2071 (font-lock-apply-highlight (car highlights)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2072 (setq highlights (cdr highlights))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2073 (font-lock-apply-highlight highlights)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2074 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2075 (goto-char region-end))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2076 nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2077 (put 'c-font-lock-doc-comments 'lisp-indent-function 2) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2078 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2079 (defun c-find-invalid-doc-markup (regexp limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2080 ;; Used to fontify invalid markup in doc comments after the correct |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2081 ;; ones have been fontified: Find the first occurence of REGEXP |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2082 ;; between the point and LIMIT that only is fontified with |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2083 ;; `c-doc-face-name'. If a match is found then submatch 0 surrounds |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2084 ;; the first char and t is returned, otherwise nil is returned. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2085 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2086 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2087 (let (start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2088 (while (if (re-search-forward regexp limit t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2089 (not (eq (get-text-property |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2090 (setq start (match-beginning 0)) 'face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2091 c-doc-face-name)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2092 (setq start nil))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2093 (when start |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2094 (store-match-data (list (copy-marker start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2095 (copy-marker (1+ start)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2096 t))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2097 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2098 ;; GtkDoc patterns contributed by Masatake YAMATO <jet@gyve.org>. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2099 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2100 (defconst gtkdoc-font-lock-doc-comments |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2101 (let ((symbol "[a-zA-Z0-9_]+") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2102 (header "^ \\* ")) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2103 `((,(concat header "\\(" symbol "\\):[ \t]*$") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2104 1 ,c-doc-markup-face-name prepend nil) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2105 (,(concat symbol "()") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2106 0 ,c-doc-markup-face-name prepend nil) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2107 (,(concat header "\\(" "@" symbol "\\):") |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2108 1 ,c-doc-markup-face-name prepend nil) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2109 (,(concat "[#%]" symbol) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2110 0 ,c-doc-markup-face-name prepend nil)) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2111 )) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2112 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2113 (defconst gtkdoc-font-lock-doc-protection |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2114 `(("< \\(public\\|private\\|protected\\) >" |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2115 1 ,c-doc-markup-face-name prepend nil))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2116 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2117 (defconst gtkdoc-font-lock-keywords |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2118 `((,(lambda (limit) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2119 (c-font-lock-doc-comments "/\\*\\*$" limit |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2120 gtkdoc-font-lock-doc-comments) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2121 (c-font-lock-doc-comments "/\\*< " limit |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2122 gtkdoc-font-lock-doc-protection) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2123 )))) |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2124 |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2125 ;; Javadoc. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2126 |
51829
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2127 (defconst javadoc-font-lock-doc-comments |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2128 `(("{@[a-z]+[^}\n\r]*}" ; "{@foo ...}" markup. |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2129 0 ,c-doc-markup-face-name prepend nil) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2130 ("^\\(/\\*\\)?\\(\\s \\|\\*\\)*\\(@[a-z]+\\)" ; "@foo ..." markup. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2131 3 ,c-doc-markup-face-name prepend nil) |
51829
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2132 (,(concat "</?\\sw" ; HTML tags. |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2133 "\\(" |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2134 (concat "\\sw\\|\\s \\|[=\n\r*.:]\\|" |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2135 "\"[^\"]*\"\\|'[^']*'") |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2136 "\\)*>") |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2137 0 ,c-doc-markup-face-name prepend nil) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2138 ("&\\(\\sw\\|[.:]\\)+;" ; HTML entities. |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2139 0 ,c-doc-markup-face-name prepend nil) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2140 ;; Fontify remaining markup characters as invalid. Note |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2141 ;; that the Javadoc spec is hazy about when "@" is |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2142 ;; allowed in non-markup use. |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2143 (,(lambda (limit) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2144 (c-find-invalid-doc-markup "[<>&]\\|{@" limit)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2145 0 'font-lock-warning-face prepend nil))) |
51829
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2146 |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2147 (defconst javadoc-font-lock-keywords |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2148 `((,(lambda (limit) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2149 (c-font-lock-doc-comments "/\\*\\*" limit |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2150 javadoc-font-lock-doc-comments))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2151 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2152 ;; Pike autodoc. |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2153 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2154 (defconst autodoc-decl-keywords |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2155 ;; Adorned regexp matching the keywords that introduce declarations |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2156 ;; in Pike Autodoc. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2157 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2158 (c-make-keywords-re t '("@decl" "@elem" "@index" "@member") 'pike-mode))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2159 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2160 (defconst autodoc-decl-type-keywords |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2161 ;; Adorned regexp matching the keywords that are followed by a type. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2162 (cc-eval-when-compile |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2163 (c-make-keywords-re t '("@elem" "@member") 'pike-mode))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2164 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2165 (defun autodoc-font-lock-line-markup (limit) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2166 ;; Fontify all line oriented keywords between the point and LIMIT. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2167 ;; Nil is always returned. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2168 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2169 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2170 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2171 (let ((line-re (concat "^\\(\\(/\\*!\\|\\s *\\(" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2172 c-current-comment-prefix |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2173 "\\)\\)\\s *\\)@[A-Za-z_-]+\\(\\s \\|$\\)")) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2174 (markup-faces (list c-doc-markup-face-name c-doc-face-name))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2175 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2176 (while (re-search-forward line-re limit t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2177 (goto-char (match-end 1)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2178 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2179 (if (looking-at autodoc-decl-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2180 (let* ((kwd-pos (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2181 (start (match-end 1)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2182 (pos start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2183 end) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2184 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2185 (c-put-font-lock-face (point) pos markup-faces) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2186 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2187 ;; Put a declaration end mark at the markup keyword and |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2188 ;; remove the faces from the rest of the line so that it |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2189 ;; gets refontified as a declaration later on by |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2190 ;; `c-font-lock-declarations'. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2191 (c-put-char-property (1- pos) 'c-type 'c-decl-end) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2192 (goto-char pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2193 (while (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2194 (end-of-line) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2195 (setq end (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2196 (and (eq (char-before) ?@) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2197 (not (eobp)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2198 (progn (forward-char) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2199 (skip-syntax-forward " ") |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2200 (looking-at c-current-comment-prefix)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2201 (goto-char (match-end 0)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2202 (c-remove-font-lock-face pos (1- end)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2203 (c-put-font-lock-face (1- end) end markup-faces) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2204 (setq pos (point))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2205 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2206 ;; Include the final newline in the removed area. This |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2207 ;; has no visual effect but it avoids some tricky special |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2208 ;; cases in the testsuite wrt the differences in string |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2209 ;; fontification in Emacs vs XEmacs. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2210 (c-remove-font-lock-face pos (min (1+ (point)) (point-max))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2211 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2212 ;; Must handle string literals explicitly inside the declaration. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2213 (goto-char start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2214 (while (re-search-forward |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2215 "\"\\([^\\\"]\\|\\\\.\\)*\"\\|'\\([^\\']\\|\\\\.\\)*'" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2216 end 'move) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2217 (c-put-font-lock-string-face (match-beginning 0) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2218 (point))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2219 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2220 ;; Fontify types after keywords that always are followed |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2221 ;; by them. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2222 (goto-char kwd-pos) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2223 (when (looking-at autodoc-decl-type-keywords) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2224 (c-fontify-types-and-refs ((c-promote-possible-types t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2225 (goto-char start) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2226 (c-forward-syntactic-ws) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2227 (c-forward-type)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2228 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2229 ;; Mark each whole line as markup, as long as the logical line |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2230 ;; continues. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2231 (while (progn |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2232 (c-put-font-lock-face (point) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2233 (progn (end-of-line) (point)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2234 markup-faces) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2235 (and (eq (char-before) ?@) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2236 (not (eobp)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2237 (progn (forward-char) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2238 (skip-syntax-forward " ") |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2239 (looking-at c-current-comment-prefix)))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2240 (goto-char (match-end 0)))))) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2241 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2242 nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2243 |
51829
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2244 (defconst autodoc-font-lock-doc-comments |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2245 `(("@\\(\\w+{\\|\\[\\([^\]@\n\r]\\|@@\\)*\\]\\|[@}]\\|$\\)" |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2246 ;; In-text markup. |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2247 0 ,c-doc-markup-face-name prepend nil) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2248 (autodoc-font-lock-line-markup) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2249 ;; Fontify remaining markup characters as invalid. |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2250 (,(lambda (limit) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2251 (c-find-invalid-doc-markup "@" limit)) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2252 0 'font-lock-warning-face prepend nil) |
51829
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2253 )) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2254 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2255 (defun autodoc-font-lock-keywords () |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2256 ;; Note that we depend on that `c-current-comment-prefix' has got |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2257 ;; its proper value here. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2258 ;; |
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2259 ;; This function might do hidden buffer changes. |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2260 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2261 ;; The `c-type' text property with `c-decl-end' is used to mark the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2262 ;; end of the `autodoc-decl-keywords' occurrences to fontify the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2263 ;; following declarations. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2264 (setq c-type-decl-end-used t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2265 |
51829
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2266 `((,(lambda (limit) |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2267 (c-font-lock-doc-comments "/[*/]!" limit |
d508ffa43505
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
Martin Stjernholm <mast@lysator.liu.se>
parents:
51714
diff
changeset
|
2268 autodoc-font-lock-doc-comments))))) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2269 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2270 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2271 ;; AWK. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2272 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2273 ;; Awk regexps written with help from Peter Galbraith |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2274 ;; <galbraith@mixing.qc.dfo.ca>. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2275 ;; Take GNU Emacs's 'words out of the following regexp-opts. They dont work |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2276 ;; in Xemacs 21.4.4. acm 2002/9/19. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2277 (eval-after-load "cc-awk" ; Evaluate while loading cc-fonts |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2278 `(defconst awk-font-lock-keywords ; Evaluate after loading cc-awk |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2279 ',(eval-when-compile ; Evaluate while compiling cc-fonts |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2280 (list |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2281 ;; Function names. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2282 '("^\\s *\\(func\\(tion\\)?\\)\\>\\s *\\(\\sw+\\)?" |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2283 (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2284 ;; |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2285 ;; Variable names. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2286 (cons |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2287 (concat "\\<" |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2288 (regexp-opt |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2289 '("ARGC" "ARGIND" "ARGV" "BINMODE" "CONVFMT" "ENVIRON" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2290 "ERRNO" "FIELDWIDTHS" "FILENAME" "FNR" "FS" "IGNORECASE" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2291 "LINT" "NF" "NR" "OFMT" "OFS" "ORS" "PROCINFO" "RLENGTH" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2292 "RS" "RSTART" "RT" "SUBSEP" "TEXTDOMAIN") t) "\\>") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2293 'font-lock-variable-name-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2294 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2295 ;; Special file names. (acm, 2002/7/22) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2296 ;; The following regexp was created by first evaluating this in GNU Emacs 21.1: |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2297 ;; (regexp-opt '("/dev/stdin" "/dev/stdout" "/dev/stderr" "/dev/fd/n" "/dev/pid" |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2298 ;; "/dev/ppid" "/dev/pgrpid" "/dev/user") 'words) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2299 ;; , removing the "?:" from each "\\(?:" (for backward compatibility with older Emacsen) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2300 ;; , replacing the "n" in "dev/fd/n" with "[0-9]+" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2301 ;; , removing the unwanted \\< at the beginning, and finally filling out the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2302 ;; regexp so that a " must come before, and either a " or heuristic stuff after. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2303 ;; The surrounding quotes are fontified along with the filename, since, semantically, |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2304 ;; they are an indivisible unit. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2305 '("\\(\"/dev/\\(fd/[0-9]+\\|p\\(\\(\\(gr\\)?p\\)?id\\)\\|\ |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2306 std\\(err\\|in\\|out\\)\\|user\\)\\)\\>\ |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2307 \\(\\(\"\\)\\|\\([^\"/\n\r][^\"\n\r]*\\)?$\\)" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2308 (1 font-lock-variable-name-face t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2309 (8 font-lock-variable-name-face t t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2310 ;; Do the same (almost) with |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2311 ;; (regexp-opt '("/inet/tcp/lport/rhost/rport" "/inet/udp/lport/rhost/rport" |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2312 ;; "/inet/raw/lport/rhost/rport") 'words) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2313 ;; This cannot be combined with the above pattern, because the match number |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2314 ;; for the (optional) closing \" would then exceed 9. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2315 '("\\(\"/inet/\\(\\(raw\\|\\(tc\\|ud\\)p\\)/lport/rhost/rport\\)\\)\\>\ |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2316 \\(\\(\"\\)\\|\\([^\"/\n\r][^\"\n\r]*\\)?$\\)" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2317 (1 font-lock-variable-name-face t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2318 (6 font-lock-variable-name-face t t)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2319 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2320 ;; Keywords. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2321 (concat "\\<" |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2322 (regexp-opt |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2323 '("BEGIN" "END" "break" "continue" "delete" "do" "else" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2324 "exit" "for" "getline" "if" "in" "next" "nextfile" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2325 "return" "while") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2326 t) "\\>") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2327 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2328 ;; Builtins. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2329 `(eval . (list |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2330 ,(concat |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2331 "\\<" |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2332 (regexp-opt |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2333 '("adump" "and" "asort" "atan2" "bindtextdomain" "close" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2334 "compl" "cos" "dcgettext" "exp" "extension" "fflush" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2335 "gensub" "gsub" "index" "int" "length" "log" "lshift" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2336 "match" "mktime" "or" "print" "printf" "rand" "rshift" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2337 "sin" "split" "sprintf" "sqrt" "srand" "stopme" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2338 "strftime" "strtonum" "sub" "substr" "system" |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2339 "systime" "tolower" "toupper" "xor") t) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2340 "\\>") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2341 0 c-preprocessor-face-name)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2342 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2343 ;; gawk debugging keywords. (acm, 2002/7/21) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2344 ;; (Removed, 2003/6/6. These functions are now fontified as built-ins) |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2345 ;; (list (concat "\\<" (regexp-opt '("adump" "stopme") t) "\\>") |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2346 ;; 0 'font-lock-warning-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2347 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2348 ;; User defined functions with an apparent spurious space before the |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2349 ;; opening parenthesis. acm, 2002/5/30. |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2350 `(,(concat "\\(\\w\\|_\\)" c-awk-escaped-nls* "\\s " |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2351 c-awk-escaped-nls*-with-space* "(") |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2352 (0 'font-lock-warning-face)) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2353 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2354 ;; Space after \ in what looks like an escaped newline. 2002/5/31 |
67252
04d2abb755d9
Update CC Mode to release 5.31.
Alan Mackenzie <acm@muc.de>
parents:
64699
diff
changeset
|
2355 '("\\\\\\s +$" 0 font-lock-warning-face t) |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2356 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2357 ;; Unbalanced string (") or regexp (/) delimiters. 2002/02/16. |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2358 '("\\s|" 0 font-lock-warning-face t nil) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2359 ;; gawk 3.1 localizable strings ( _"translate me!"). 2002/5/21 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2360 '("\\(_\\)\\s|" 1 font-lock-warning-face) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2361 '("\\(_\\)\\s\"" 1 font-lock-string-face) ; FIXME! not for XEmacs. 2002/10/6 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2362 )) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2363 "Default expressions to highlight in AWK mode.")) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2364 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2365 |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2366 (cc-provide 'cc-fonts) |
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2367 |
52401 | 2368 ;;; arch-tag: 2f65f405-735f-4da5-8d4b-b957844c5203 |
51714
bc91cbf50c24
Updated CC Mode to version 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
diff
changeset
|
2369 ;;; cc-fonts.el ends here |