• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/progmodes/

Lines Matching defs:font

1 ;;; cc-fonts.el --- font lock support for CC Mode
33 ;; o `c-label-face-name' is either `font-lock-constant-face' (in
34 ;; Emacs), or `font-lock-reference-face'.
40 ;; o `c-preprocessor-face-name' is `font-lock-preprocessor-face' in
42 ;; `font-lock-builtin-face' or `font-lock-reference-face' in Emacs.
44 ;; o `c-doc-face-name' is `font-lock-doc-string-face' in XEmacs,
45 ;; `font-lock-doc-face' in Emacs 21 and later, or
46 ;; `font-lock-comment-face' in older Emacs (that since source
58 ;; the dependencies on the font locking order):
60 ;; o `font-lock-comment-face' and the face in `c-doc-face-name' is
64 ;; o `font-lock-string-face' is not used in anything but string
66 ;; o `font-lock-keyword-face' and the face in `c-label-face-name' are
89 (cc-external-require 'font-lock)
101 (cc-bytecomp-defun c-font-lock-declarators)
102 (cc-bytecomp-defun c-font-lock-objc-method)
103 (cc-bytecomp-defun c-font-lock-invalid-string)
107 ;; Note that font-lock in XEmacs doesn't expand face names as
108 ;; variables, so we have to use the (eval . FORM) in the font lock
112 (cond ((c-face-name-p 'font-lock-preprocessor-face)
113 ;; XEmacs has a font-lock-preprocessor-face.
114 'font-lock-preprocessor-face)
115 ((c-face-name-p 'font-lock-builtin-face)
116 ;; In Emacs font-lock-builtin-face has traditionally been
118 'font-lock-builtin-face)
120 'font-lock-reference-face)))
122 (cc-bytecomp-defvar font-lock-constant-face)
125 (cond ((c-face-name-p 'font-lock-label-face)
129 'font-lock-label-face)
130 ((and (c-face-name-p 'font-lock-constant-face)
131 (eq font-lock-constant-face 'font-lock-constant-face))
132 ;; Test both if font-lock-constant-face exists and that it's
135 'font-lock-constant-face)
137 'font-lock-reference-face)))
140 (if (and (c-face-name-p 'font-lock-constant-face)
141 (eq font-lock-constant-face 'font-lock-constant-face))
143 'font-lock-constant-face
148 (if (and (c-face-name-p 'font-lock-reference-face)
149 (eq font-lock-reference-face 'font-lock-reference-face))
153 'font-lock-reference-face
159 (cond ((c-face-name-p 'font-lock-doc-string-face)
161 'font-lock-doc-string-face)
162 ((c-face-name-p 'font-lock-doc-face)
164 'font-lock-doc-face)
166 'font-lock-comment-face)))
169 (if (c-face-name-p 'font-lock-doc-markup-face)
173 'font-lock-doc-markup-face
177 (if (c-face-name-p 'font-lock-negation-char-face)
179 'font-lock-negation-char-face))
205 (defmacro c-put-font-lock-face (from to face)
207 ;; font-lock would do it. In XEmacs that means putting an
208 ;; additional font-lock property, or else the font-lock package
213 (if (fboundp 'font-lock-set-face)
216 `(font-lock-set-face ,from ,to ,face)
219 (defmacro c-remove-font-lock-face (from to)
220 ;; This is the inverse of `c-put-font-lock-face'.
223 (if (fboundp 'font-lock-remove-face)
224 `(font-lock-remove-face ,from ,to)
227 (defmacro c-put-font-lock-string-face (from to)
228 ;; Put `font-lock-string-face' on a string. The surrounding
234 `(c-put-font-lock-face (1+ ,from) (1- ,to) 'font-lock-string-face)
235 `(c-put-font-lock-face ,from ,to 'font-lock-string-face)))
267 ;; regexp string in a `font-lock-keywords' matcher, except that
272 ;; covered by the font-lock context.)
285 (defun c-make-font-lock-search-function (regexp &rest highlights)
287 ;; a matcher element in `font-lock-keywords'. It cuts out a little
290 ;; matcher(s), since most (if not all) font-lock implementations
293 ;; the different (X)Emacs font-lock packages.
300 ;; `font-lock-keywords', with these limitations: The face is always
309 ;; covered by the font-lock context.)
315 (let (;; The font-lock package in Emacs is known to clobber
338 (c-put-font-lock-face
357 ;; the call to `c-make-font-lock-search-function' then let's
359 (def-edebug-spec c-make-font-lock-search-function
371 (c-put-font-lock-face (car elem) (cdr elem)
372 'font-lock-type-face))
378 (c-put-font-lock-face (car elem) (cdr elem)
385 ;; Note: `c-font-lock-declarations' assumes that no matcher here
386 ;; sets `font-lock-type-face' in languages where
405 ,(+ ncle-depth re-depth 1) font-lock-string-face))))
418 font-lock-string-face)
437 `((,(c-make-font-lock-search-function
458 (c-put-font-lock-face
461 'font-lock-function-name-face)
473 (c-put-font-lock-face
475 'font-lock-variable-name-face)
482 (c-put-font-lock-face
485 'font-lock-variable-name-face)))))))
495 `((,(c-make-font-lock-search-function
504 (c-put-font-lock-face (match-beginning 1)
510 (,(c-make-font-lock-search-function
532 ;; Make hard spaces visible through an inverted `font-lock-warning-face'.
537 (c-make-inverse-face 'font-lock-warning-face
542 (defun c-font-lock-invalid-string ()
544 ;; fontify that char with `font-lock-warning-face' if the string
563 (c-put-font-lock-face start (1+ start) 'font-lock-warning-face)))))
570 ;; Note: `c-font-lock-declarations' assumes that no matcher here
571 ;; sets `font-lock-type-face' in languages where
575 ;; can't span lines. Later font
576 ;; lock packages have a `font-lock-syntactic-face-function' for
580 ,(c-make-font-lock-search-function
584 '((c-font-lock-invalid-string)))
602 2 font-lock-keyword-face)
604 1 font-lock-keyword-face))
617 `(,(c-make-font-lock-search-function
638 (c-put-font-lock-face (point) id-end
667 (c-put-font-lock-face (match-beginning 2)
675 ,(c-make-font-lock-search-function
688 ,(c-make-font-lock-search-function
695 (;; The font-lock package in Emacs is known to clobber
707 (defun c-font-lock-complex-decl-prepare (limit)
708 ;; This function will be called from font-lock for a region bounded by POINT
710 ;; font-lock-keyword-face. It always returns NIL to inhibit this and
718 ;;(message "c-font-lock-complex-decl-prepare %s %s" (point) limit)
739 ;; that `c-font-lock-declarators' should be called at the start.
746 (c-font-lock-declarators limit t (eq prop 'c-decl-type-start))))
750 (defun c-font-lock-<>-arglists (limit)
751 ;; This function will be called from font-lock for a region bounded by POINT
753 ;; font-lock-keyword-face. It always returns NIL to inhibit this and
759 ;; `c-font-lock-declarations' already has handled many of them.
763 (let (;; The font-lock package in Emacs is known to clobber
786 ((eq id-face 'font-lock-type-face)
788 ;; handled in `c-font-lock-declarations'.
791 ((eq id-face 'font-lock-keyword-face)
822 (c-put-font-lock-face id-start id-end
824 (c-put-font-lock-face id-start id-end
825 'font-lock-type-face)))))
831 (defun c-font-lock-declarators (limit list types)
841 ;;(message "c-font-lock-declarators from %s to %s" (point) limit)
916 'font-lock-function-name-face
917 'font-lock-variable-name-face)
932 (c-put-font-lock-face (car c-last-identifier-range)
942 (cond ((eq id-face 'font-lock-function-name-face)
975 (defconst c-font-lock-maybe-decl-faces
977 ;; `c-font-lock-declarations' runs. This needs to be evaluated to
980 font-lock-type-face
982 font-lock-keyword-face))
984 (defun c-font-lock-declarations (limit)
985 ;; This function will be called from font-lock for a region bounded by POINT
987 ;; font-lock-keyword-face. It always returns NIL to inhibit this and
996 ;;(message "c-font-lock-declarations search from %s to %s" (point) limit)
1034 ;; The font-lock package in Emacs is known to clobber
1048 ;; font-lock will put the limit at the beginning of the second line
1069 c-font-lock-maybe-decl-faces
1077 'font-lock-keyword-face)
1176 ;; `c-font-lock-declarators' handles the rest.
1186 (c-font-lock-declarators
1201 (c-put-font-lock-face (caar c-record-ref-identifiers)
1205 (c-put-font-lock-face (caar c-record-ref-identifiers)
1207 'font-lock-keyword-face))
1211 (c-put-font-lock-face (car kwd) (cdr kwd)
1212 'font-lock-keyword-face))
1223 "Simple font lock matchers for types and declarations. These are used
1231 (let (;; The font-lock package in Emacs is known to clobber
1238 (c-font-lock-objc-method)))
1245 ;; `*-font-lock-extra-types' on mode init.
1246 (eval . (list ,(c-make-font-lock-search-function
1248 '(1 'font-lock-type-face t)
1249 '((c-font-lock-declarators limit t nil)
1263 `((,(c-make-font-lock-search-function
1270 'font-lock-type-face t)
1271 `((c-font-lock-declarators limit t nil)
1279 `((,(c-make-font-lock-search-function
1283 '((c-font-lock-declarators limit t nil)
1291 `(c-font-lock-labels))))
1294 "Complex font lock matchers for types and declarations. Used on level
1298 ;; resulting constant, `c-matchers-3'. At run time, font lock will call
1300 ;; Fontification"). The font lock region is delimited by POINT and the
1302 ;; inhibiting spurious font-lock-keyword-face highlighting and another
1306 c-font-lock-complex-decl-prepare
1313 `(,(c-make-font-lock-search-function
1323 c-font-lock-objc-methods))
1326 c-font-lock-declarations
1330 `(c-font-lock-<>-arglists))
1333 ;; `c-font-lock-declarations' has found already, but not
1345 2 font-lock-type-face)
1347 1 'font-lock-type-face)))
1355 ;; The font-lock package in Emacs is known to clobber
1393 ;; the closing brace. `c-font-lock-declarations' will later
1398 `((,(c-make-font-lock-search-function
1406 `((c-font-lock-declarators limit t nil)
1420 (c-font-lock-c++-new))))
1423 (defun c-font-lock-labels (limit)
1430 ;; `c-font-lock-declarations' on higher levels.
1435 ;; The font-lock package in Emacs is known to clobber
1457 ;; Check for a preceding label. We exploit the font
1473 (c-put-font-lock-face (match-beginning 0) (match-end 0)
1488 `((,(c-make-font-lock-search-function
1497 '((c-font-lock-declarators limit t nil)
1510 ;; eval form is evaluated at font-lock setup (to
1532 `((,(c-make-font-lock-search-function
1561 ;; Incorporate the font lock keyword lists according to
1564 ;; `*-font-lock-keywords-*' symbols since we have to build the list
1565 ;; when font-lock is initialized.
1580 "-font-lock-keywords"))))
1590 ;; Kludge: If `c-font-lock-complex-decl-prepare' is on the list we
1591 ;; move it first since the doc comment font lockers might add
1593 (when (memq 'c-font-lock-complex-decl-prepare list)
1594 (setq list (cons 'c-font-lock-complex-decl-prepare
1595 (delq 'c-font-lock-complex-decl-prepare
1601 ;; This is used to override the value on a `*-font-lock-keywords'
1603 ;; `*-font-lock-keywords-*' variables. Older font-lock packages
1604 ;; define a default value for `*-font-lock-keywords' which we want
1625 (c-override-default-keywords 'c-font-lock-keywords)
1627 (defconst c-font-lock-keywords-1 (c-lang-const c-matchers-1 c)
1628 "Minimal font locking for C mode.
1632 (defconst c-font-lock-keywords-2 (c-lang-const c-matchers-2 c)
1633 "Fast normal font locking for C mode.
1634 In addition to `c-font-lock-keywords-1', this adds fontification of
1636 user defined types on `c-font-lock-extra-types', and the doc comment
1639 (defconst c-font-lock-keywords-3 (c-lang-const c-matchers-3 c)
1640 "Accurate normal font locking for C mode.
1641 Like `c-font-lock-keywords-2' but detects declarations in a more
1643 need for `c-font-lock-extra-types'.")
1645 (defvar c-font-lock-keywords c-font-lock-keywords-3
1648 (defun c-font-lock-keywords-2 ()
1649 (c-compose-keywords-list c-font-lock-keywords-2))
1650 (defun c-font-lock-keywords-3 ()
1651 (c-compose-keywords-list c-font-lock-keywords-3))
1652 (defun c-font-lock-keywords ()
1653 (c-compose-keywords-list c-font-lock-keywords))
1659 (defun c-font-lock-c++-new (limit)
1682 ;; The font-lock package in Emacs is known to clobber
1780 (c-override-default-keywords 'c++-font-lock-keywords)
1782 (defconst c++-font-lock-keywords-1 (c-lang-const c-matchers-1 c++)
1783 "Minimal font locking for C++ mode.
1787 (defconst c++-font-lock-keywords-2 (c-lang-const c-matchers-2 c++)
1788 "Fast normal font locking for C++ mode.
1789 In addition to `c++-font-lock-keywords-1', this adds fontification of
1791 user defined types on `c++-font-lock-extra-types', and the doc comment
1794 (defconst c++-font-lock-keywords-3 (c-lang-const c-matchers-3 c++)
1795 "Accurate normal font locking for C++ mode.
1796 Like `c++-font-lock-keywords-2' but detects declarations in a more
1798 need for `c++-font-lock-extra-types'.")
1800 (defvar c++-font-lock-keywords c++-font-lock-keywords-3
1803 (defun c++-font-lock-keywords-2 ()
1804 (c-compose-keywords-list c++-font-lock-keywords-2))
1805 (defun c++-font-lock-keywords-3 ()
1806 (c-compose-keywords-list c++-font-lock-keywords-3))
1807 (defun c++-font-lock-keywords ()
1808 (c-compose-keywords-list c++-font-lock-keywords))
1814 (defun c-font-lock-objc-method ()
1846 (c-put-font-lock-face (match-beginning 0)
1849 'font-lock-function-name-face
1850 'font-lock-variable-name-face))
1856 (c-put-font-lock-face (match-beginning 0)
1858 'font-lock-function-name-face)
1866 (defun c-font-lock-objc-methods (limit)
1872 (let (;; The font-lock package in Emacs is known to clobber
1884 (c-font-lock-objc-method))))
1887 (c-override-default-keywords 'objc-font-lock-keywords)
1889 (defconst objc-font-lock-keywords-1 (c-lang-const c-matchers-1 objc)
1890 "Minimal font locking for Objective-C mode.
1894 (defconst objc-font-lock-keywords-2 (c-lang-const c-matchers-2 objc)
1895 "Fast normal font locking for Objective-C mode.
1896 In addition to `objc-font-lock-keywords-1', this adds fontification of
1898 user defined types on `objc-font-lock-extra-types', and the doc
1901 (defconst objc-font-lock-keywords-3 (c-lang-const c-matchers-3 objc)
1902 "Accurate normal font locking for Objective-C mode.
1903 Like `objc-font-lock-keywords-2' but detects declarations in a more
1905 need for `objc-font-lock-extra-types'.")
1907 (defvar objc-font-lock-keywords objc-font-lock-keywords-3
1910 (defun objc-font-lock-keywords-2 ()
1911 (c-compose-keywords-list objc-font-lock-keywords-2))
1912 (defun objc-font-lock-keywords-3 ()
1913 (c-compose-keywords-list objc-font-lock-keywords-3))
1914 (defun objc-font-lock-keywords ()
1915 (c-compose-keywords-list objc-font-lock-keywords))
1918 ;; `objc-font-lock-extra-types' might have gotten from the font-lock
1922 (when (equal (sort (append objc-font-lock-extra-types nil) 'string-lessp)
1924 (setq objc-font-lock-extra-types
1931 (c-override-default-keywords 'java-font-lock-keywords)
1933 (defconst java-font-lock-keywords-1 (c-lang-const c-matchers-1 java)
1934 "Minimal font locking for Java mode.
1938 (defconst java-font-lock-keywords-2 (c-lang-const c-matchers-2 java)
1939 "Fast normal font locking for Java mode.
1940 In addition to `java-font-lock-keywords-1', this adds fontification of
1942 user defined types on `java-font-lock-extra-types', and the doc
1945 (defconst java-font-lock-keywords-3 (c-lang-const c-matchers-3 java)
1946 "Accurate normal font locking for Java mode.
1947 Like `java-font-lock-keywords-2' but detects declarations in a more
1949 need for `java-font-lock-extra-types'.")
1951 (defvar java-font-lock-keywords java-font-lock-keywords-3
1954 (defun java-font-lock-keywords-2 ()
1955 (c-compose-keywords-list java-font-lock-keywords-2))
1956 (defun java-font-lock-keywords-3 ()
1957 (c-compose-keywords-list java-font-lock-keywords-3))
1958 (defun java-font-lock-keywords ()
1959 (c-compose-keywords-list java-font-lock-keywords))
1965 (c-override-default-keywords 'idl-font-lock-keywords)
1967 (defconst idl-font-lock-keywords-1 (c-lang-const c-matchers-1 idl)
1968 "Minimal font locking for CORBA IDL mode.
1972 (defconst idl-font-lock-keywords-2 (c-lang-const c-matchers-2 idl)
1973 "Fast normal font locking for CORBA IDL mode.
1974 In addition to `idl-font-lock-keywords-1', this adds fontification of
1976 user defined types on `idl-font-lock-extra-types', and the doc comment
1979 (defconst idl-font-lock-keywords-3 (c-lang-const c-matchers-3 idl)
1980 "Accurate normal font locking for CORBA IDL mode.
1981 Like `idl-font-lock-keywords-2' but detects declarations in a more
1983 need for `idl-font-lock-extra-types'.")
1985 (defvar idl-font-lock-keywords idl-font-lock-keywords-3
1988 (defun idl-font-lock-keywords-2 ()
1989 (c-compose-keywords-list idl-font-lock-keywords-2))
1990 (defun idl-font-lock-keywords-3 ()
1991 (c-compose-keywords-list idl-font-lock-keywords-3))
1992 (defun idl-font-lock-keywords ()
1993 (c-compose-keywords-list idl-font-lock-keywords))
1999 (c-override-default-keywords 'pike-font-lock-keywords)
2001 (defconst pike-font-lock-keywords-1 (c-lang-const c-matchers-1 pike)
2002 "Minimal font locking for Pike mode.
2006 (defconst pike-font-lock-keywords-2 (c-lang-const c-matchers-2 pike)
2007 "Fast normal font locking for Pike mode.
2008 In addition to `pike-font-lock-keywords-1', this adds fontification of
2010 user defined types on `pike-font-lock-extra-types', and the doc
2013 (defconst pike-font-lock-keywords-3 (c-lang-const c-matchers-3 pike)
2014 "Accurate normal font locking for Pike mode.
2015 Like `pike-font-lock-keywords-2' but detects declarations in a more
2017 need for `pike-font-lock-extra-types'.")
2019 (defvar pike-font-lock-keywords pike-font-lock-keywords-3
2022 (defun pike-font-lock-keywords-2 ()
2023 (c-compose-keywords-list pike-font-lock-keywords-2))
2024 (defun pike-font-lock-keywords-3 ()
2025 (c-compose-keywords-list pike-font-lock-keywords-3))
2026 (defun pike-font-lock-keywords ()
2027 (c-compose-keywords-list pike-font-lock-keywords))
2033 (defun c-font-lock-doc-comments (prefix limit keywords)
2036 ;; fontified with `font-lock-comment-face' already. nil is always
2041 ;; `font-lock-keywords' except that anchored matches and eval
2055 'font-lock-comment-face)
2096 (c-put-font-lock-face region-beg region-end c-doc-face-name)
2119 (font-lock-apply-highlight (car highlights))
2121 (font-lock-apply-highlight highlights))))
2125 (put 'c-font-lock-doc-comments 'lisp-indent-function 2)
2148 (defconst gtkdoc-font-lock-doc-comments
2161 (defconst gtkdoc-font-lock-doc-protection
2165 (defconst gtkdoc-font-lock-keywords
2167 (c-font-lock-doc-comments "/\\*\\*$" limit
2168 gtkdoc-font-lock-doc-comments)
2169 (c-font-lock-doc-comments "/\\*< " limit
2170 gtkdoc-font-lock-doc-protection)
2175 (defconst javadoc-font-lock-doc-comments
2193 0 'font-lock-warning-face prepend nil)))
2195 (defconst javadoc-font-lock-keywords
2197 (c-font-lock-doc-comments "/\\*\\*" limit
2198 javadoc-font-lock-doc-comments)))))
2213 (defun autodoc-font-lock-line-markup (limit)
2233 (c-put-font-lock-face (point) pos markup-faces)
2238 ;; `c-font-lock-declarations'.
2250 (c-remove-font-lock-face pos (1- end))
2251 (c-put-font-lock-face (1- end) end markup-faces)
2258 (c-remove-font-lock-face pos (min (1+ (point)) (point-max)))
2265 (c-put-font-lock-string-face (match-beginning 0)
2280 (c-put-font-lock-face (point)
2292 (defconst autodoc-font-lock-doc-comments
2296 (autodoc-font-lock-line-markup)
2300 0 'font-lock-warning-face prepend nil)
2303 (defun autodoc-font-lock-keywords ()
2315 (c-font-lock-doc-comments "/[*/]!" limit
2316 autodoc-font-lock-doc-comments)))))
2320 ;; 2006-07-10: awk-font-lock-keywords has been moved back to cc-awk.el.