Mercurial > emacs
comparison lisp/progmodes/cc-fonts.el @ 83194:b15f799f66b5
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-489
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-490
Update from CVS: man/fixit.texi (Spelling): Fix typo.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-491
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-492
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-493
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-494
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-495
Update from CVS: Add missing lisp/mh-e files
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-496
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-497
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-498
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-499
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-500
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-234
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Thu, 19 Aug 2004 15:05:01 +0000 |
parents | b7446b6f097d |
children | 31aa9a390538 d8411455de48 |
comparison
equal
deleted
inserted
replaced
83193:e6f198d9e7d3 | 83194:b15f799f66b5 |
---|---|
572 1 font-lock-keyword-face)) | 572 1 font-lock-keyword-face)) |
573 | 573 |
574 ;; Fontify leading identifiers in fully qualified names like | 574 ;; Fontify leading identifiers in fully qualified names like |
575 ;; "foo::bar" in languages that supports such things. | 575 ;; "foo::bar" in languages that supports such things. |
576 ,@(when (c-lang-const c-opt-identifier-concat-key) | 576 ,@(when (c-lang-const c-opt-identifier-concat-key) |
577 `((,(byte-compile | 577 (if (c-major-mode-is 'java-mode) |
578 ;; Must use a function here since we match longer | 578 ;; Java needs special treatment since "." is used both to |
579 ;; than we want to move before doing a new search. | 579 ;; qualify names and in normal indexing. Here we look for |
580 ;; This is not necessary for XEmacs >= 20 since it | 580 ;; capital characters at the beginning of an identifier to |
581 ;; restarts the search from the end of the first | 581 ;; recognize the class. "*" is also recognized to cover |
582 ;; highlighted submatch (something that causes | 582 ;; wildcard import declarations. All preceding dot separated |
583 ;; problems in other places). | 583 ;; identifiers are taken as package names and therefore |
584 `(lambda (limit) | 584 ;; fontified as references. |
585 (while (re-search-forward | 585 `(,(c-make-font-lock-search-function |
586 ,(concat "\\(\\<" ; 1 | 586 ;; Search for class identifiers preceded by ".". The |
587 "\\(" (c-lang-const c-symbol-key) "\\)" ; 2 | 587 ;; anchored matcher takes it from there. |
588 "[ \t\n\r\f\v]*" | 588 (concat (c-lang-const c-opt-identifier-concat-key) |
589 (c-lang-const c-opt-identifier-concat-key) | 589 "[ \t\n\r\f\v]*" |
590 "[ \t\n\r\f\v]*" | 590 (concat "\\(" |
591 "\\)" | 591 "[" c-upper "][" (c-lang-const c-symbol-chars) "]*" |
592 "\\(" | 592 "\\|" |
593 (c-lang-const c-opt-after-id-concat-key) | 593 "\\*" |
594 "\\)") | 594 "\\)")) |
595 limit t) | 595 `((let (id-end) |
596 (unless (progn | 596 (goto-char (1+ (match-beginning 0))) |
597 (goto-char (match-beginning 0)) | 597 (while (and (eq (char-before) ?.) |
598 (c-skip-comments-and-strings limit)) | 598 (progn |
599 (or (get-text-property (match-beginning 2) 'face) | 599 (backward-char) |
600 (c-put-font-lock-face (match-beginning 2) | 600 (c-backward-syntactic-ws) |
601 (match-end 2) | 601 (setq id-end (point)) |
602 c-reference-face-name)) | 602 (< (skip-chars-backward |
603 (goto-char (match-end 1))))))))) | 603 ,(c-lang-const c-symbol-chars)) 0)) |
604 (not (get-text-property (point) 'face))) | |
605 (c-put-font-lock-face (point) id-end c-reference-face-name) | |
606 (c-backward-syntactic-ws))) | |
607 nil | |
608 (goto-char (match-end 0))))) | |
609 | |
610 `((,(byte-compile | |
611 ;; Must use a function here since we match longer than we | |
612 ;; want to move before doing a new search. This is not | |
613 ;; necessary for XEmacs >= 20 since it restarts the search | |
614 ;; from the end of the first highlighted submatch (something | |
615 ;; that causes problems in other places). | |
616 `(lambda (limit) | |
617 (while (re-search-forward | |
618 ,(concat "\\(\\<" ; 1 | |
619 "\\(" (c-lang-const c-symbol-key) "\\)" ; 2 | |
620 "[ \t\n\r\f\v]*" | |
621 (c-lang-const c-opt-identifier-concat-key) | |
622 "[ \t\n\r\f\v]*" | |
623 "\\)" | |
624 "\\(" | |
625 (c-lang-const c-opt-after-id-concat-key) | |
626 "\\)") | |
627 limit t) | |
628 (unless (progn | |
629 (goto-char (match-beginning 0)) | |
630 (c-skip-comments-and-strings limit)) | |
631 (or (get-text-property (match-beginning 2) 'face) | |
632 (c-put-font-lock-face (match-beginning 2) | |
633 (match-end 2) | |
634 c-reference-face-name)) | |
635 (goto-char (match-end 1)))))))))) | |
604 | 636 |
605 ;; Fontify the special declarations in Objective-C. | 637 ;; Fontify the special declarations in Objective-C. |
606 ,@(when (c-major-mode-is 'objc-mode) | 638 ,@(when (c-major-mode-is 'objc-mode) |
607 `(;; Fontify class names in the beginning of message expressions. | 639 `(;; Fontify class names in the beginning of message expressions. |
608 ,(c-make-font-lock-search-function | 640 ,(c-make-font-lock-search-function |
785 (c-safe (goto-char (scan-lists (point) 1 paren-depth)))) | 817 (c-safe (goto-char (scan-lists (point) 1 paren-depth)))) |
786 | 818 |
787 (<= (point) limit) | 819 (<= (point) limit) |
788 | 820 |
789 ;; Search syntactically to the end of the declarator (";", | 821 ;; Search syntactically to the end of the declarator (";", |
790 ;; ",", ")", ">" (for <> arglists), eob etc) or to the | 822 ;; ",", a closen paren, eob etc) or to the beginning of an |
791 ;; beginning of an initializer or function prototype ("=" | 823 ;; initializer or function prototype ("=" or "\\s\("). |
792 ;; or "\\s\("). | 824 ;; Note that the open paren will match array specs in |
825 ;; square brackets, and we treat them as initializers too. | |
793 (c-syntactic-re-search-forward | 826 (c-syntactic-re-search-forward |
794 "[\];,\{\}\[\)>]\\|\\'\\|\\(=\\|\\(\\s\(\\)\\)" limit t t)) | 827 "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t)) |
795 | 828 |
796 (setq next-pos (match-beginning 0) | 829 (setq next-pos (match-beginning 0) |
797 id-face (if (match-beginning 2) | 830 id-face (if (eq (char-after next-pos) ?\() |
798 'font-lock-function-name-face | 831 'font-lock-function-name-face |
799 'font-lock-variable-name-face) | 832 'font-lock-variable-name-face) |
800 got-init (match-beginning 1)) | 833 got-init (and (match-beginning 1) |
834 (char-after (match-beginning 1)))) | |
801 | 835 |
802 (if types | 836 (if types |
803 ;; Register and fontify the identifer as a type. | 837 ;; Register and fontify the identifer as a type. |
804 (let ((c-promote-possible-types t)) | 838 (let ((c-promote-possible-types t)) |
805 (goto-char id-start) | 839 (goto-char id-start) |
826 (if (c-safe (c-forward-sexp 1) t) | 860 (if (c-safe (c-forward-sexp 1) t) |
827 (c-forward-syntactic-ws limit) | 861 (c-forward-syntactic-ws limit) |
828 (goto-char limit))) | 862 (goto-char limit))) |
829 | 863 |
830 (got-init | 864 (got-init |
831 ;; Skip an initializer expression. | 865 ;; Skip an initializer expression. If we're at a '=' |
832 (if (c-syntactic-re-search-forward "[;,]" limit 'move t) | 866 ;; then accept a brace list directly after it to cope |
833 (backward-char))) | 867 ;; with array initializers. Otherwise stop at braces |
868 ;; to avoid going past full function and class blocks. | |
869 (and (if (and (eq got-init ?=) | |
870 (= (c-forward-token-2) 0) | |
871 (looking-at "{")) | |
872 (c-safe (c-forward-sexp) t) | |
873 t) | |
874 (c-syntactic-re-search-forward "[;,{]" limit 'move t) | |
875 (backward-char))) | |
834 | 876 |
835 (t (c-forward-syntactic-ws limit))) | 877 (t (c-forward-syntactic-ws limit))) |
836 | 878 |
837 ;; If a ',' is found we set pos to the next declarator and iterate. | 879 ;; If a ',' is found we set pos to the next declarator and iterate. |
838 (when (and (< (point) limit) (looking-at ",")) | 880 (when (and (< (point) limit) (looking-at ",")) |