Mercurial > emacs
comparison lisp/font-lock.el @ 24512:ca92d7df3b48
* font-lock.el (c-font-lock-keywords-2): Only fontify a label if it is
on the line by itself.
(java-font-lock-keywords-2): Likewise. Don't fontify a class name if
it is not in a declarative context.
author | Simon Marshall <simon@gnu.org> |
---|---|
date | Tue, 23 Mar 1999 15:31:44 +0000 |
parents | 5583aa06a287 |
children | fb98da96a257 |
comparison
equal
deleted
inserted
replaced
24511:6dbea1df5686 | 24512:ca92d7df3b48 |
---|---|
2309 '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?" | 2309 '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?" |
2310 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) | 2310 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) |
2311 ;; Anders Lindgren <andersl@andersl.com> points out that it is quicker to | 2311 ;; Anders Lindgren <andersl@andersl.com> points out that it is quicker to |
2312 ;; use MATCH-ANCHORED to effectively anchor the regexp on the left. | 2312 ;; use MATCH-ANCHORED to effectively anchor the regexp on the left. |
2313 ;; This must come after the one for keywords and targets. | 2313 ;; This must come after the one for keywords and targets. |
2314 '(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:" | 2314 '(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:[ \t]*$" |
2315 (beginning-of-line) (end-of-line) | 2315 (beginning-of-line) (end-of-line) |
2316 (1 font-lock-constant-face))) | 2316 (1 font-lock-constant-face))) |
2317 ))) | 2317 ))) |
2318 | 2318 |
2319 (setq c-font-lock-keywords-3 | 2319 (setq c-font-lock-keywords-3 |
2775 | 2775 |
2776 (defconst java-font-lock-keywords-3 nil | 2776 (defconst java-font-lock-keywords-3 nil |
2777 "Gaudy level highlighting for Java mode. | 2777 "Gaudy level highlighting for Java mode. |
2778 See also `java-font-lock-extra-types'.") | 2778 See also `java-font-lock-extra-types'.") |
2779 | 2779 |
2780 ;; Regexps written with help from Fred White <fwhite@bbn.com> and | 2780 ;; Regexps written with help from Fred White <fwhite@bbn.com>, |
2781 ;; Anders Lindgren <andersl@andersl.com>. | 2781 ;; Anders Lindgren <andersl@andersl.com> and Carl Manning <caroma@ai.mit.edu>. |
2782 (let* ((java-keywords | 2782 (let* ((java-keywords |
2783 (eval-when-compile | 2783 (eval-when-compile |
2784 (regexp-opt | 2784 (regexp-opt |
2785 '("catch" "do" "else" "super" "this" "finally" "for" "if" | 2785 '("catch" "do" "else" "super" "this" "finally" "for" "if" |
2786 ;; Anders Lindgren <andersl@andersl.com> says these have gone. | 2786 ;; Anders Lindgren <andersl@andersl.com> says these have gone. |
2814 (setq java-font-lock-keywords-1 | 2814 (setq java-font-lock-keywords-1 |
2815 (list | 2815 (list |
2816 ;; | 2816 ;; |
2817 ;; Fontify class names. | 2817 ;; Fontify class names. |
2818 '("\\<\\(class\\)\\>[ \t]*\\(\\sw+\\)?" | 2818 '("\\<\\(class\\)\\>[ \t]*\\(\\sw+\\)?" |
2819 (1 font-lock-type-face) (2 font-lock-function-name-face nil t)) | 2819 (1 font-lock-keyword-face) (2 font-lock-type-face nil t)) |
2820 ;; | 2820 ;; |
2821 ;; Fontify package names in import directives. | 2821 ;; Fontify package names in import directives. |
2822 '("\\<\\(import\\|package\\)\\>[ \t]*\\(\\sw+\\)?" | 2822 '("\\<\\(import\\|package\\)\\>[ \t]*\\(\\sw+\\)?" |
2823 (1 font-lock-keyword-face) | 2823 (1 font-lock-keyword-face) |
2824 (2 font-lock-constant-face nil t) | 2824 (2 font-lock-constant-face nil t) |
2830 (append java-font-lock-keywords-1 | 2830 (append java-font-lock-keywords-1 |
2831 (list | 2831 (list |
2832 ;; | 2832 ;; |
2833 ;; Fontify class names. | 2833 ;; Fontify class names. |
2834 `(eval . | 2834 `(eval . |
2835 (cons (concat "\\<\\(" (,@ java-type-names) "\\)\\>") | 2835 (cons (concat "\\<\\(" (,@ java-type-names) "\\)\\>[^.]") |
2836 'font-lock-type-face)) | 2836 '(1 font-lock-type-face))) |
2837 ;; | 2837 ;; |
2838 ;; Fontify all builtin keywords (except below). | 2838 ;; Fontify all builtin keywords (except below). |
2839 (concat "\\<\\(" java-keywords "\\|" java-type-specs "\\)\\>") | 2839 (concat "\\<\\(" java-keywords "\\|" java-type-specs "\\)\\>") |
2840 ;; | 2840 ;; |
2841 ;; Fontify keywords and targets, and case default/goto tags. | 2841 ;; Fontify keywords and targets, and case default/goto tags. |
2842 (list "\\<\\(break\\|case\\|continue\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?" | 2842 (list "\\<\\(break\\|case\\|continue\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?" |
2843 '(1 font-lock-keyword-face) '(2 font-lock-constant-face nil t)) | 2843 '(1 font-lock-keyword-face) '(2 font-lock-constant-face nil t)) |
2844 ;; This must come after the one for keywords and targets. | 2844 ;; This must come after the one for keywords and targets. |
2845 '(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:" | 2845 '(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:[ \t]*$" |
2846 (beginning-of-line) (end-of-line) | 2846 (beginning-of-line) (end-of-line) |
2847 (1 font-lock-constant-face))) | 2847 (1 font-lock-constant-face))) |
2848 ;; | 2848 ;; |
2849 ;; Fontify all constants. | 2849 ;; Fontify all constants. |
2850 '("\\<\\(false\\|null\\|true\\)\\>" . font-lock-constant-face) | 2850 '("\\<\\(false\\|null\\|true\\)\\>" . font-lock-constant-face) |