diff options
| author | Karl Heuer | 1995-04-20 17:23:29 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-04-20 17:23:29 +0000 |
| commit | 72e80cad6fd9891fdcd178ed52310d4769af70fc (patch) | |
| tree | 8077bcb5b38529b4c6631a05d08122028b224a5c | |
| parent | e2439696ea341c3b7cf0337ae7190e817cf3451f (diff) | |
| download | emacs-72e80cad6fd9891fdcd178ed52310d4769af70fc.tar.gz emacs-72e80cad6fd9891fdcd178ed52310d4769af70fc.zip | |
(f90-keywords): "only" added to keyword list.
(f90-font-lock-keywords-1): Type may now have attributes private
and public.
(f90-font-lock-keywords-2): Fixed difference between type and type().
(hilit-set-mode-patterns): Type may now have attributes private.
and public, fixed difference between type and type().
(f90-p-type-re): New regular-expression constant for type commands.
(f90-mode): indent-tabs-mode put to nil by default.
(f90-looking-at-type-like): Now uses f90-p-type-re.
(f90-no-block-limit): Now uses f90-p-type-re.
(f90-change-keywords): Don't change preprocessor lines.
| -rw-r--r-- | lisp/progmodes/f90.el | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 001571ff641..bfb544e3c89 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;; f90.el --- Fortran-90 mode (free format) for GNU Emacs. | 1 | ;; f90.el --- Fortran-90 mode (free format) for GNU Emacs and GNU XEmacs. |
| 2 | ;; Copyright (C) 1995 Free Software Foundation, Inc. | 2 | ;; Copyright (C) 1995 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | ;; Author: Torbj\"orn Einarsson <tfkte@fy.chalmers.se> | 4 | ;; Author: Torbj\"orn Einarsson <tfkte@fy.chalmers.se> |
| 5 | ;; Created: Jan 21, 1995 | 5 | ;; Created: Apr. 13, 1995 |
| 6 | ;; Keywords: fortran, f90, languages | 6 | ;; Keywords: fortran, f90, languages |
| 7 | 7 | ||
| 8 | ;; This program is free software; you can redistribute it and/or modify | 8 | ;; This program is free software; you can redistribute it and/or modify |
| @@ -86,7 +86,9 @@ | |||
| 86 | ;; f90-auto-keyword-case nil | 86 | ;; f90-auto-keyword-case nil |
| 87 | ;; f90-auto-hilit19 t | 87 | ;; f90-auto-hilit19 t |
| 88 | ;; f90-leave-line-no nil | 88 | ;; f90-leave-line-no nil |
| 89 | ;; f90-startup-message t) | 89 | ;; f90-startup-message t |
| 90 | ;; indent-tabs-mode nil | ||
| 91 | ;; ) | ||
| 90 | ;; ;;The rest is not default. | 92 | ;; ;;The rest is not default. |
| 91 | ;; (abbrev-mode 1) ; turn on abbreviation mode | 93 | ;; (abbrev-mode 1) ; turn on abbreviation mode |
| 92 | ;; (f90-auto-fill-mode 1) ; turn on auto-filling | 94 | ;; (f90-auto-fill-mode 1) ; turn on auto-filling |
| @@ -108,6 +110,9 @@ | |||
| 108 | ;; b) To use font-lock-mode, nothing special is needed. | 110 | ;; b) To use font-lock-mode, nothing special is needed. |
| 109 | ;; 4) For FIXED FORMAT code, use the ordinary fortran mode. | 111 | ;; 4) For FIXED FORMAT code, use the ordinary fortran mode. |
| 110 | ;; 5) This mode does not work under emacs-18.x. | 112 | ;; 5) This mode does not work under emacs-18.x. |
| 113 | ;; 6) Preprocessor directives, i.e., lines starting with # are left-justified | ||
| 114 | ;; and are untouched by all case-changing commands. There is, at present, no | ||
| 115 | ;; mechanism for treating multi-line directives (continued by \ ). | ||
| 111 | 116 | ||
| 112 | ;; List of user commands | 117 | ;; List of user commands |
| 113 | ;; f90-previous-statement f90-next-statement | 118 | ;; f90-previous-statement f90-next-statement |
| @@ -194,7 +199,7 @@ whether to blink the matching beginning.") | |||
| 194 | "elseif" "elsewhere" "end" "enddo" "endfile" "endif" "entry" "equivalence" | 199 | "elseif" "elsewhere" "end" "enddo" "endfile" "endif" "entry" "equivalence" |
| 195 | "exit" "external" "forall" "format" "function" "goto" "if" "implicit" | 200 | "exit" "external" "forall" "format" "function" "goto" "if" "implicit" |
| 196 | "include" "inquire" "integer" "intent" "interface" "intrinsic" "logical" | 201 | "include" "inquire" "integer" "intent" "interface" "intrinsic" "logical" |
| 197 | "module" "namelist" "none" "nullify" "open" "optional" "parameter" | 202 | "module" "namelist" "none" "nullify" "only" "open" "optional" "parameter" |
| 198 | "pause" "pointer" "precision" "print" "private" "procedure" "program" | 203 | "pause" "pointer" "precision" "print" "private" "procedure" "program" |
| 199 | "public" "read" "real" "recursive" "return" "rewind" "save" "select" | 204 | "public" "read" "real" "recursive" "return" "rewind" "save" "select" |
| 200 | "sequence" "stop" "subroutine" "target" "then" "type" "use" "where" | 205 | "sequence" "stop" "subroutine" "target" "then" "type" "use" "where" |
| @@ -262,6 +267,10 @@ whether to blink the matching beginning.") | |||
| 262 | 'font-lock-function-name-face) | 267 | 'font-lock-function-name-face) |
| 263 | '("^[ \t]*\\(type\\)[ \t]+\\sw+" 1 font-lock-keyword-face) | 268 | '("^[ \t]*\\(type\\)[ \t]+\\sw+" 1 font-lock-keyword-face) |
| 264 | '("^[ \t]*type[ \t]+\\(\\sw+\\)" 1 font-lock-function-name-face) | 269 | '("^[ \t]*type[ \t]+\\(\\sw+\\)" 1 font-lock-function-name-face) |
| 270 | '("^[ \t]*\\(type[ \t]*,[ \t]*\\(private\\|public\\)\\)[ \t]*::\ | ||
| 271 | [ \t]*\\(\\sw+\\)" 1 font-lock-keyword-face) | ||
| 272 | '("^[ \t]*\\(type[ \t]*,[ \t]*\\(private\\|public\\)\\)[ \t]*::\ | ||
| 273 | [ \t]*\\(\\sw+\\)" 3 font-lock-function-name-face) | ||
| 265 | '("^[ \t]*\\(end[ \t]*\\)?interface\\>" . font-lock-keyword-face) | 274 | '("^[ \t]*\\(end[ \t]*\\)?interface\\>" . font-lock-keyword-face) |
| 266 | '("^[ \t]*contains\\>" . font-lock-keyword-face))) | 275 | '("^[ \t]*contains\\>" . font-lock-keyword-face))) |
| 267 | "For consideration as a value of `f90-font-lock-keywords-1'. | 276 | "For consideration as a value of `f90-font-lock-keywords-1'. |
| @@ -272,8 +281,8 @@ This does fairly subdued highlighting of comments and function names.") | |||
| 272 | (append f90-font-lock-keywords-1 | 281 | (append f90-font-lock-keywords-1 |
| 273 | (list | 282 | (list |
| 274 | ;; Variable declarations | 283 | ;; Variable declarations |
| 275 | '("\\(\\(real\\|integer\\|character\\|complex\\|logical\\|type\\).*\\)::" | 284 | '("\\(\\(real\\|integer\\|character\\|complex\\|logical\\|\ |
| 276 | 1 font-lock-type-face) | 285 | type[ \t]*(\\sw+)\\).*\\)::" 1 font-lock-type-face) |
| 277 | '("implicit[ \t]*none" . font-lock-keyword-face) | 286 | '("implicit[ \t]*none" . font-lock-keyword-face) |
| 278 | '("^[ \t]*\\(\\sw+[ \t]*:[ \t]*\\)?\\(do\\([ \t]*while\\)?\\)\\>" | 287 | '("^[ \t]*\\(\\sw+[ \t]*:[ \t]*\\)?\\(do\\([ \t]*while\\)?\\)\\>" |
| 279 | 2 font-lock-keyword-face) | 288 | 2 font-lock-keyword-face) |
| @@ -352,7 +361,7 @@ This highlights variable types, \"keywords,\" etc.") | |||
| 352 | nil f90-face-string) | 361 | nil f90-face-string) |
| 353 | (list "!" "$" f90-face-comment) | 362 | (list "!" "$" f90-face-comment) |
| 354 | (list "\\(\\(real\\|integer\\|character\\|complex\\|logical\ | 363 | (list "\\(\\(real\\|integer\\|character\\|complex\\|logical\ |
| 355 | \\|type\\).*\\)::" 1 f90-face-decl) | 364 | \\|type[ \t]*(\\sw+)\\).*\\)::" 1 f90-face-decl) |
| 356 | (list "implicit[ \t]*none" nil f90-face-decl) | 365 | (list "implicit[ \t]*none" nil f90-face-decl) |
| 357 | (list "^[ \t]*\\(program\\|module\\)[ \t]+\\sw+" 1 f90-face-prog) | 366 | (list "^[ \t]*\\(program\\|module\\)[ \t]+\\sw+" 1 f90-face-prog) |
| 358 | (list "^[ \t]*\\(program\\|module\\)[ \t]+\\(\\sw+\\)" 2 f90-face-label) | 367 | (list "^[ \t]*\\(program\\|module\\)[ \t]+\\(\\sw+\\)" 2 f90-face-label) |
| @@ -366,6 +375,8 @@ This highlights variable types, \"keywords,\" etc.") | |||
| 366 | "subroutine\\|type\\)[ \t]+\\(\\sw+\\)") 2 f90-face-label) | 375 | "subroutine\\|type\\)[ \t]+\\(\\sw+\\)") 2 f90-face-label) |
| 367 | (list "^[ \t]*\\(type\\)[ \t]+\\sw+" 1 f90-face-type) | 376 | (list "^[ \t]*\\(type\\)[ \t]+\\sw+" 1 f90-face-type) |
| 368 | (list "^[ \t]*type[ \t]+\\(\\sw+\\)" 1 f90-face-label) | 377 | (list "^[ \t]*type[ \t]+\\(\\sw+\\)" 1 f90-face-label) |
| 378 | (list "^[ \t]*\\(type[ \t]*,[ \t]*\\(private\\|public\\)\\)[ \t]*::[ \t]*\\(\\sw+\\)" 1 f90-face-type) | ||
| 379 | (list "^[ \t]*\\(type[ \t]*,[ \t]*\\(private\\|public\\)\\)[ \t]*::[ \t]*\\(\\sw+\\)" 3 f90-face-label) | ||
| 369 | (list "^[ \t]*\\(end[ \t]*\\)?interface\\>" nil f90-face-interface) | 380 | (list "^[ \t]*\\(end[ \t]*\\)?interface\\>" nil f90-face-interface) |
| 370 | (list "^[ \t]*contains\\>" nil f90-face-contains) | 381 | (list "^[ \t]*contains\\>" nil f90-face-contains) |
| 371 | (list "^[ \t]*\\(\\sw+[ \t]*:[ \t]*\\)?\\(do\\([ \t]*while\\)?\\)\\>" | 382 | (list "^[ \t]*\\(\\sw+[ \t]*:[ \t]*\\)?\\(do\\([ \t]*while\\)?\\)\\>" |
| @@ -533,6 +544,9 @@ program\\|select\\|subroutine\\|type\\|where\\|forall\\)\\>") | |||
| 533 | (defconst f90-end-type-re | 544 | (defconst f90-end-type-re |
| 534 | "end[ \t]*\\(type\\|interface\\|block[ \t]*data\\)\\>") | 545 | "end[ \t]*\\(type\\|interface\\|block[ \t]*data\\)\\>") |
| 535 | (defconst f90-no-break-re "\\(\\*\\*\\|//\\|=>\\)") | 546 | (defconst f90-no-break-re "\\(\\*\\*\\|//\\|=>\\)") |
| 547 | (defconst f90-p-type-re | ||
| 548 | (concat "\\(type\\)[ \t]*,[ \t]*\\(public\\|private\\)" | ||
| 549 | "[ \t]*::[ \t]*\\(" f90-symbol-re "\\)\\>")) | ||
| 536 | ;; A temporary position to make region operators faster | 550 | ;; A temporary position to make region operators faster |
| 537 | (defvar f90-cache-position nil) | 551 | (defvar f90-cache-position nil) |
| 538 | (make-variable-buffer-local 'f90-cache-position) | 552 | (make-variable-buffer-local 'f90-cache-position) |
| @@ -682,12 +696,13 @@ with no args, if that value is non-nil." | |||
| 682 | (setq comment-indent-function 'f90-comment-indent) | 696 | (setq comment-indent-function 'f90-comment-indent) |
| 683 | (make-local-variable 'abbrev-all-caps) | 697 | (make-local-variable 'abbrev-all-caps) |
| 684 | (setq abbrev-all-caps t) | 698 | (setq abbrev-all-caps t) |
| 699 | (setq indent-tabs-mode nil) | ||
| 685 | ;; Setting up things for font-lock | 700 | ;; Setting up things for font-lock |
| 686 | (if (string-match "Lucid" emacs-version) | 701 | (if (string-match "Lucid" emacs-version) |
| 687 | (put 'f90-mode 'font-lock-keywords-case-fold-search t) | 702 | (put 'f90-mode 'font-lock-keywords-case-fold-search t) |
| 688 | ;; (make-local-variable 'font-lock-keywords) ; for version <= 19.28 | 703 | ;; (make-local-variable 'font-lock-keywords) ; for Emacs version <= 19.28 |
| 689 | ;; (setq font-lock-keywords f90-font-lock-keywords) | 704 | ;; (setq font-lock-keywords f90-font-lock-keywords) |
| 690 | (make-local-variable 'font-lock-defaults) ; for version > 19.28 | 705 | (make-local-variable 'font-lock-defaults) ; for Emacs version > 19.28 |
| 691 | (setq font-lock-defaults '(f90-font-lock-keywords t)) | 706 | (setq font-lock-defaults '(f90-font-lock-keywords t)) |
| 692 | ) | 707 | ) |
| 693 | (make-local-variable 'font-lock-keywords-case-fold-search) | 708 | (make-local-variable 'font-lock-keywords-case-fold-search) |
| @@ -835,6 +850,8 @@ Name is non-nil only for type." | |||
| 835 | (cond | 850 | (cond |
| 836 | ((looking-at (concat "\\(type\\)[ \t]+\\(" f90-symbol-re "\\)\\>")) | 851 | ((looking-at (concat "\\(type\\)[ \t]+\\(" f90-symbol-re "\\)\\>")) |
| 837 | (list (f90-match-piece 1) (f90-match-piece 2))) | 852 | (list (f90-match-piece 1) (f90-match-piece 2))) |
| 853 | ((looking-at f90-p-type-re) | ||
| 854 | (list (f90-match-piece 1) (f90-match-piece 3))) | ||
| 838 | ((looking-at "\\(interface\\)\\>") | 855 | ((looking-at "\\(interface\\)\\>") |
| 839 | (list (f90-match-piece 1) nil)) | 856 | (list (f90-match-piece 1) nil)) |
| 840 | ((looking-at "\\(block[ \t]*data\\)\\>") | 857 | ((looking-at "\\(block[ \t]*data\\)\\>") |
| @@ -902,6 +919,7 @@ case\\|where\\|forall\\)\\>") | |||
| 902 | block[ \t]*data\\)\\>") | 919 | block[ \t]*data\\)\\>") |
| 903 | (looking-at "\\(contains\\|continue\\|\\sw+[ \t]*:\\)") | 920 | (looking-at "\\(contains\\|continue\\|\\sw+[ \t]*:\\)") |
| 904 | (looking-at "type[ \t]+\\sw+") | 921 | (looking-at "type[ \t]+\\sw+") |
| 922 | (looking-at f90-p-type-re) | ||
| 905 | (re-search-forward "\\(function\\|subroutine\\)" eol t)))))) | 923 | (re-search-forward "\\(function\\|subroutine\\)" eol t)))))) |
| 906 | 924 | ||
| 907 | (defsubst f90-update-line () | 925 | (defsubst f90-update-line () |
| @@ -1553,10 +1571,14 @@ Any other key combination is executed normally." | |||
| 1553 | (while (re-search-forward keyword-re end t) | 1571 | (while (re-search-forward keyword-re end t) |
| 1554 | (if (progn | 1572 | (if (progn |
| 1555 | (setq state (parse-partial-sexp ref-point (point))) | 1573 | (setq state (parse-partial-sexp ref-point (point))) |
| 1556 | (and (not (nth 3 state)) (not (nth 4 state)))) | 1574 | (or (nth 3 state) (nth 4 state) |
| 1557 | (progn | 1575 | (save-excursion ; Check for cpp directive. |
| 1558 | (setq ref-point (point)) | 1576 | (beginning-of-line) |
| 1559 | (funcall change-word -1))))))) | 1577 | (skip-chars-forward " \t0-9") |
| 1578 | (looking-at "#")))) | ||
| 1579 | () | ||
| 1580 | (setq ref-point (point)) | ||
| 1581 | (funcall change-word -1)))))) | ||
| 1560 | 1582 | ||
| 1561 | (provide 'f90) | 1583 | (provide 'f90) |
| 1562 | 1584 | ||