diff options
| author | Richard M. Stallman | 1994-03-05 23:32:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-05 23:32:27 +0000 |
| commit | 1bd508405637ad40ccabdce824c6d2991ecb6387 (patch) | |
| tree | 0d7feed0b23645f26982abea3bcf57dc9339de8d | |
| parent | 54b2aa5c65269cf635f755a11a1d01c03f7772d8 (diff) | |
| download | emacs-1bd508405637ad40ccabdce824c6d2991ecb6387.tar.gz emacs-1bd508405637ad40ccabdce824c6d2991ecb6387.zip | |
(c++-font-lock-keywords-1, c++-font-lock-keywords-2): New variables.
(c++-font-lock-keywords): Use c++-font-lock-keywords-1.
| -rw-r--r-- | lisp/font-lock.el | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 4dee589a7c4..eedb805c9bb 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -496,11 +496,22 @@ This does fairly subdued highlighting.") | |||
| 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. |
| @@ -559,6 +570,7 @@ This does a lot more highlighting.") | |||
| 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) |
| @@ -586,15 +598,22 @@ This does a lot more highlighting.") | |||
| 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 | ||