/[emacs]/emacs/lisp/progmodes/cc-fonts.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/cc-fonts.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4.2.2 by miles, Fri Nov 21 00:35:51 2003 UTC revision 1.4.2.3 by miles, Sat Sep 4 09:22:57 2004 UTC
# Line 574  casts and declarations are fontified.  U Line 574  casts and declarations are fontified.  U
574        ;; Fontify leading identifiers in fully qualified names like        ;; Fontify leading identifiers in fully qualified names like
575        ;; "foo::bar" in languages that supports such things.        ;; "foo::bar" in languages that supports such things.
576        ,@(when (c-lang-const c-opt-identifier-concat-key)        ,@(when (c-lang-const c-opt-identifier-concat-key)
577            `((,(byte-compile            (if (c-major-mode-is 'java-mode)
578                 ;; Must use a function here since we match longer                ;; Java needs special treatment since "." is used both to
579                 ;; than we want to move before doing a new search.                ;; qualify names and in normal indexing.  Here we look for
580                 ;; This is not necessary for XEmacs >= 20 since it                ;; capital characters at the beginning of an identifier to
581                 ;; restarts the search from the end of the first                ;; recognize the class.  "*" is also recognized to cover
582                 ;; highlighted submatch (something that causes                ;; wildcard import declarations.  All preceding dot separated
583                 ;; problems in other places).                ;; identifiers are taken as package names and therefore
584                 `(lambda (limit)                ;; fontified as references.
585                    (while (re-search-forward                `(,(c-make-font-lock-search-function
586                            ,(concat "\\(\\<" ; 1                    ;; Search for class identifiers preceded by ".".  The
587                                     "\\(" (c-lang-const c-symbol-key) "\\)" ; 2                    ;; anchored matcher takes it from there.
588                                     "[ \t\n\r\f\v]*"                    (concat (c-lang-const c-opt-identifier-concat-key)
589                                     (c-lang-const c-opt-identifier-concat-key)                            "[ \t\n\r\f\v]*"
590                                     "[ \t\n\r\f\v]*"                            (concat "\\("
591                                     "\\)"                                    "[" c-upper "][" (c-lang-const c-symbol-chars) "]*"
592                                     "\\("                                    "\\|"
593                                     (c-lang-const c-opt-after-id-concat-key)                                    "\\*"
594                                     "\\)")                                    "\\)"))
595                            limit t)                    `((let (id-end)
596                      (unless (progn                        (goto-char (1+ (match-beginning 0)))
597                                (goto-char (match-beginning 0))                        (while (and (eq (char-before) ?.)
598                                (c-skip-comments-and-strings limit))                                    (progn
599                        (or (get-text-property (match-beginning 2) 'face)                                      (backward-char)
600                            (c-put-font-lock-face (match-beginning 2)                                      (c-backward-syntactic-ws)
601                                                  (match-end 2)                                      (setq id-end (point))
602                                                  c-reference-face-name))                                      (< (skip-chars-backward
603                        (goto-char (match-end 1)))))))))                                          ,(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))))))))))
636    
637        ;; Fontify the special declarations in Objective-C.        ;; Fontify the special declarations in Objective-C.
638        ,@(when (c-major-mode-is 'objc-mode)        ,@(when (c-major-mode-is 'objc-mode)
# Line 787  casts and declarations are fontified.  U Line 819  casts and declarations are fontified.  U
819              (<= (point) limit)              (<= (point) limit)
820    
821              ;; Search syntactically to the end of the declarator (";",              ;; Search syntactically to the end of the declarator (";",
822              ;; ",", ")", ">" (for <> arglists), eob etc) or to the              ;; ",", a closen paren, eob etc) or to the beginning of an
823              ;; beginning of an initializer or function prototype ("="              ;; initializer or function prototype ("=" or "\\s\(").
824              ;; or "\\s\(").              ;; Note that the open paren will match array specs in
825                ;; square brackets, and we treat them as initializers too.
826              (c-syntactic-re-search-forward              (c-syntactic-re-search-forward
827               "[\];,\{\}\[\)>]\\|\\'\\|\\(=\\|\\(\\s\(\\)\\)" limit t t))               "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t))
828    
829        (setq next-pos (match-beginning 0)        (setq next-pos (match-beginning 0)
830              id-face (if (match-beginning 2)              id-face (if (eq (char-after next-pos) ?\()
831                          'font-lock-function-name-face                          'font-lock-function-name-face
832                        'font-lock-variable-name-face)                        'font-lock-variable-name-face)
833              got-init (match-beginning 1))              got-init (and (match-beginning 1)
834                              (char-after (match-beginning 1))))
835    
836        (if types        (if types
837            ;; Register and fontify the identifer as a type.            ;; Register and fontify the identifer as a type.
# Line 828  casts and declarations are fontified.  U Line 862  casts and declarations are fontified.  U
862                   (goto-char limit)))                   (goto-char limit)))
863    
864                (got-init                (got-init
865                 ;; Skip an initializer expression.                 ;; Skip an initializer expression.  If we're at a '='
866                 (if (c-syntactic-re-search-forward "[;,]" limit 'move t)                 ;; then accept a brace list directly after it to cope
867                     (backward-char)))                 ;; 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)))
876    
877                (t (c-forward-syntactic-ws limit)))                (t (c-forward-syntactic-ws limit)))
878    

Legend:
Removed from v.1.4.2.2  
changed lines
  Added in v.1.4.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26