comparison lisp/progmodes/f90.el @ 107105:906017fe8f4b

Fix previous change for F2003 interfaces. * progmodes/f90.el (f90-font-lock-keywords-1, f90-font-lock-keywords-2): Move F2003 named interfaces from keywords-2 to keywords-1, and use function-name-face rather than constant-face. Simplify "abstract interface" regexp.
author Glenn Morris <rgm@gnu.org>
date Sun, 07 Feb 2010 12:23:20 -0800
parents 3b143add1364
children 3c104aea26eb
comparison
equal deleted inserted replaced
107104:c984638f1446 107105:906017fe8f4b
156 ;; 2. Have "f90-mode" just recognize F90 syntax, then derived modes 156 ;; 2. Have "f90-mode" just recognize F90 syntax, then derived modes
157 ;; "f95-mode", "f2003-mode" for the language revisions. 157 ;; "f95-mode", "f2003-mode" for the language revisions.
158 ;; 3. Support for align. 158 ;; 3. Support for align.
159 ;; Font-locking: 159 ;; Font-locking:
160 ;; 1. OpenMP, OpenMPI?, preprocessor highlighting. 160 ;; 1. OpenMP, OpenMPI?, preprocessor highlighting.
161 ;; 2. interface blah - Highlight "blah" in function-name face? 161 ;; 2. integer_name = 1
162 ;; Need to avoid "interface operator (+)" etc. 162 ;; 3. Labels for "else" statements (F2003)?
163 ;; 3. integer_name = 1
164 ;; 4. Labels for "else" statements (F2003)?
165 163
166 (defvar comment-auto-fill-only-comments) 164 (defvar comment-auto-fill-only-comments)
167 (defvar font-lock-keywords) 165 (defvar font-lock-keywords)
168 166
169 ;; User options 167 ;; User options
465 ;; Highlight definition of derived type. 463 ;; Highlight definition of derived type.
466 ;;; '("\\<\\(\\(?:end[ \t]*\\)?type\\)\\>\\([^()\n]*::\\)?[ \t]*\\(\\sw+\\)" 464 ;;; '("\\<\\(\\(?:end[ \t]*\\)?type\\)\\>\\([^()\n]*::\\)?[ \t]*\\(\\sw+\\)"
467 ;;; (1 font-lock-keyword-face) (3 font-lock-function-name-face)) 465 ;;; (1 font-lock-keyword-face) (3 font-lock-function-name-face))
468 '(f90-typedef-matcher 466 '(f90-typedef-matcher
469 (1 font-lock-keyword-face) (2 font-lock-function-name-face)) 467 (1 font-lock-keyword-face) (2 font-lock-function-name-face))
470 ;; Other functions and declarations. 468 ;; F2003. Prevent operators being highlighted as functions.
469 '("\\<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\
470 read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t))
471 ;; Other functions and declarations. Named interfaces = F2003.
471 '("\\<\\(\\(?:end[ \t]*\\)?\\(program\\|module\\|function\\|associate\\|\ 472 '("\\<\\(\\(?:end[ \t]*\\)?\\(program\\|module\\|function\\|associate\\|\
472 subroutine\\)\\|use\\|call\\)\\>[ \t]*\\(\\sw+\\)?" 473 subroutine\\|interface\\)\\|use\\|call\\)\\>[ \t]*\\(\\sw+\\)?"
473 (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) 474 (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
474 ;; F2003. 475 ;; F2003.
475 '("\\<\\(use\\)[ \t]*,[ \t]*\\(\\(?:non_\\)?intrinsic\\)[ \t]*::[ \t]*\ 476 '("\\<\\(use\\)[ \t]*,[ \t]*\\(\\(?:non_\\)?intrinsic\\)[ \t]*::[ \t]*\
476 \\(\\sw+\\)" 477 \\(\\sw+\\)"
477 (1 font-lock-keyword-face) (2 font-lock-keyword-face) 478 (1 font-lock-keyword-face) (2 font-lock-keyword-face)
478 (3 font-lock-function-name-face)) 479 (3 font-lock-function-name-face))
479 "\\<\\(\\(end[ \t]*\\)?block[ \t]*data\\|contains\\|\ 480 "\\<\\(\\(end[ \t]*\\)?block[ \t]*data\\|contains\\)\\>"
480 end[ \t]*interface\\)\\>" 481 ;; "abstract interface" is F2003.
481 ;; "abstract interface" is F2003. Must come after previous entry. 482 '("\\<abstract[ \t]*interface\\>" (0 font-lock-keyword-face t)))
482 '("\\<\\(\\(?:abstract[ \t]*\\)?interface\\)\\>"
483 ;; [ \t]*\\(\\(\\sw+\\)[ \t]*[^(]\\)?"
484 ;; (2) messes up "interface operator ()", etc.
485 (1 font-lock-keyword-face))) ;(2 font-lock-function-name-face nil t)))
486 "This does fairly subdued highlighting of comments and function calls.") 483 "This does fairly subdued highlighting of comments and function calls.")
487 484
488 ;; NB not explicitly handling this, yet it seems to work. 485 ;; NB not explicitly handling this, yet it seems to work.
489 ;; type(...) function foo() 486 ;; type(...) function foo()
490 (defun f90-typedec-matcher (limit) 487 (defun f90-typedec-matcher (limit)
558 \\(function\\)\\>[ \t]*\\(\\sw+\\)[ \t]*\\(([^&!\n]*)\\)" 555 \\(function\\)\\>[ \t]*\\(\\sw+\\)[ \t]*\\(([^&!\n]*)\\)"
559 (1 font-lock-type-face t) (4 font-lock-keyword-face t) 556 (1 font-lock-type-face t) (4 font-lock-keyword-face t)
560 (5 font-lock-function-name-face t) (6 'default t)) 557 (5 font-lock-function-name-face t) (6 'default t))
561 ;; enum (F2003; must be followed by ", bind(C)"). 558 ;; enum (F2003; must be followed by ", bind(C)").
562 '("\\<\\(enum\\)[ \t]*," (1 font-lock-keyword-face)) 559 '("\\<\\(enum\\)[ \t]*," (1 font-lock-keyword-face))
563 ;; F2003. Prevent operators being highlighted as constants.
564 '("\\<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\
565 read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t))
566 ;; Interface blocks can be named in F2003.
567 '("\\<\\(\\(?:end[ \t]*\\)?interface\\)[ \t]*\\(\\sw+\\)?\\>"
568 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
569 ;; end do, enum (F2003), if, select, where, and forall constructs. 560 ;; end do, enum (F2003), if, select, where, and forall constructs.
570 '("\\<\\(end[ \t]*\\(do\\|if\\|enum\\|select\\|forall\\|where\\)\\)\\>\ 561 '("\\<\\(end[ \t]*\\(do\\|if\\|enum\\|select\\|forall\\|where\\)\\)\\>\
571 \\([ \t]+\\(\\sw+\\)\\)?" 562 \\([ \t]+\\(\\sw+\\)\\)?"
572 (1 font-lock-keyword-face) (3 font-lock-constant-face nil t)) 563 (1 font-lock-keyword-face) (3 font-lock-constant-face nil t))
573 '("^[ \t0-9]*\\(\\(\\sw+\\)[ \t]*:[ \t]*\\)?\\(\\(if\\|\ 564 '("^[ \t0-9]*\\(\\(\\sw+\\)[ \t]*:[ \t]*\\)?\\(\\(if\\|\