Mercurial > emacs
comparison lisp/font-lock.el @ 6219:d960f0463014
(c++-font-lock-keywords-1, c++-font-lock-keywords-2): New variables.
(c++-font-lock-keywords): Use c++-font-lock-keywords-1.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 05 Mar 1994 23:32:27 +0000 |
parents | 00cee8387866 |
children | de72ddd5a3c0 |
comparison
equal
deleted
inserted
replaced
6218:f4d5338c2142 | 6219:d960f0463014 |
---|---|
494 | 494 |
495 (defconst c-font-lock-keywords-2 nil | 495 (defconst c-font-lock-keywords-2 nil |
496 "For consideration as a value of `c-font-lock-keywords'. | 496 "For consideration as a value of `c-font-lock-keywords'. |
497 This does a lot more highlighting.") | 497 This does a lot more highlighting.") |
498 | 498 |
499 (defconst c++-font-lock-keywords-1 nil | |
500 "For consideration as a value of `c++-font-lock-keywords'. | |
501 This does fairly subdued highlighting.") | |
502 | |
503 (defconst c++-font-lock-keywords-2 nil | |
504 "For consideration as a value of `c++-font-lock-keywords'. | |
505 This does a lot more highlighting.") | |
506 | |
499 (let* ((storage "auto\\|extern\\|register\\|static\\|typedef") | 507 (let* ((storage "auto\\|extern\\|register\\|static\\|typedef") |
500 (struct "struct\\|union\\|enum") | 508 (struct "struct\\|union\\|enum") |
501 (prefixes "signed\\|unsigned\\|short\\|long") | 509 (prefixes "signed\\|unsigned\\|short\\|long") |
502 (types (concat prefixes "\\|int\\|char\\|float\\|double\\|void")) | 510 (types (concat prefixes "\\|int\\|char\\|float\\|double\\|void")) |
503 (ctoken "[a-zA-Z0-9_:~*]+")) | 511 (ctoken "[a-zA-Z0-9_:~*]+") |
512 (c++-things (concat | |
513 "const\\|class\\|protected:\\|private:\\|public:\\|inline\\|" | |
514 "new\\|delete"))) | |
504 (setq c-font-lock-keywords-1 | 515 (setq c-font-lock-keywords-1 |
505 (list | 516 (list |
506 ;; fontify preprocessor directives as comments. | 517 ;; fontify preprocessor directives as comments. |
507 '("^#[ \t]*[a-z]+" . font-lock-comment-face) | 518 '("^#[ \t]*[a-z]+" . font-lock-comment-face) |
508 ;; | 519 ;; |
557 (append c-font-lock-keywords-1 | 568 (append c-font-lock-keywords-1 |
558 (list | 569 (list |
559 ;; | 570 ;; |
560 ;; fontify all storage classes and type specifiers | 571 ;; fontify all storage classes and type specifiers |
561 (cons (concat "\\<\\(" storage "\\)\\>") 'font-lock-type-face) | 572 (cons (concat "\\<\\(" storage "\\)\\>") 'font-lock-type-face) |
573 (cons (concat "\\<\\(" types "\\)\\>") 'font-lock-type-face) | |
562 (cons (concat "\\<\\(\\(\\(" prefixes "\\)\\>[ \t]*\\)*\\(" types | 574 (cons (concat "\\<\\(\\(\\(" prefixes "\\)\\>[ \t]*\\)*\\(" types |
563 "\\)\\)\\>") | 575 "\\)\\)\\>") |
564 'font-lock-type-face) | 576 'font-lock-type-face) |
565 (list (concat "\\<\\(" struct "\\)[ \t]+" ctoken) | 577 (list (concat "\\<\\(" struct "\\)[ \t]+" ctoken) |
566 0 'font-lock-type-face 'keep) | 578 0 'font-lock-type-face 'keep) |
584 1 font-lock-function-name-face) | 596 1 font-lock-function-name-face) |
585 ;; | 597 ;; |
586 ;; Fontify global variables without a type. | 598 ;; Fontify global variables without a type. |
587 ; '("^\\([_a-zA-Z0-9:~*]+\\)[ \t]*[[;={]" 1 font-lock-function-name-face) | 599 ; '("^\\([_a-zA-Z0-9:~*]+\\)[ \t]*[[;={]" 1 font-lock-function-name-face) |
588 ))) | 600 ))) |
601 | |
602 (setq c++-font-lock-keywords-1 | |
603 (cons | |
604 (concat "\\(" c++-things "\\)[ \t\n]") | |
605 c-font-lock-keywords-1)) | |
606 (setq c++-font-lock-keywords-2 | |
607 (cons | |
608 (cons (concat "\\<\\(" c++-things "\\)\\>") 'font-lock-type-face) | |
609 c-font-lock-keywords-2)) | |
589 ) | 610 ) |
590 | 611 |
591 ; default to the gaudier variety? | 612 ; default to the gaudier variety? |
592 ;(defvar c-font-lock-keywords c-font-lock-keywords-2 | |
593 ; "Additional expressions to highlight in C mode.") | |
594 (defvar c-font-lock-keywords c-font-lock-keywords-1 | 613 (defvar c-font-lock-keywords c-font-lock-keywords-1 |
595 "Additional expressions to highlight in C mode.") | 614 "Additional expressions to highlight in C mode.") |
596 | 615 |
597 (defvar c++-font-lock-keywords c-font-lock-keywords | 616 (defvar c++-font-lock-keywords c++-font-lock-keywords-1 |
598 "Additional expressions to highlight in C++ mode.") | 617 "Additional expressions to highlight in C++ mode.") |
599 | 618 |
600 | 619 |
601 (defvar perl-font-lock-keywords | 620 (defvar perl-font-lock-keywords |
602 (list | 621 (list |