aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1996-04-19 20:07:47 +0000
committerKarl Heuer1996-04-19 20:07:47 +0000
commitc80718ccb9e66011245253acb3c7df2c6199bfec (patch)
tree5b48912f505479e6315110e4436dd3a987c39639
parent55be13141341ecca134894b0e390de966e108580 (diff)
downloademacs-c80718ccb9e66011245253acb3c7df2c6199bfec.tar.gz
emacs-c80718ccb9e66011245253acb3c7df2c6199bfec.zip
(f90-keywords-re): Added operator and result.
(f90-keywords-level-3-re): Added operator and result. (f90-match-end, f90-looking-at-program-block-start): Fixed bug with false matching in comments/strings. (f90-looking-at-program-block-start, f90-imenu-generic-expression): Added knowledge of pure and extrinsic subroutines. (f90-abbrev-start): Fixed bug using next-command-event. (f90-keywords-level-3-re): Added keyword "nullify". (f90-else-like-re): Fixed indentation of case() statements. (f90-font-lock-keywords-2): Changed highlighting of case() statements.
-rw-r--r--lisp/progmodes/f90.el70
1 files changed, 44 insertions, 26 deletions
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index aa6de50b3aa..349dafb95eb 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -3,7 +3,7 @@
3;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
4 4
5;; Author: Torbj\"orn Einarsson <T.Einarsson@clab.ericsson.se> 5;; Author: Torbj\"orn Einarsson <T.Einarsson@clab.ericsson.se>
6;; Created: Sep. 21, 1995 6;; Created: Apr. 18, 1996
7;; Keywords: fortran, f90, languages 7;; Keywords: fortran, f90, languages
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
@@ -117,6 +117,7 @@
117;; mechanism for treating multi-line directives (continued by \ ). 117;; mechanism for treating multi-line directives (continued by \ ).
118;; 7) f77 do-loops do 10 i=.. ; ; 10 continue are not correctly indented. 118;; 7) f77 do-loops do 10 i=.. ; ; 10 continue are not correctly indented.
119;; You are urged to use f90-do loops (with labels if you wish). 119;; You are urged to use f90-do loops (with labels if you wish).
120;; 8) The highlighting mode under XEmacs is not as complete as under Emacs.
120 121
121;; List of user commands 122;; List of user commands
122;; f90-previous-statement f90-next-statement 123;; f90-previous-statement f90-next-statement
@@ -204,9 +205,9 @@ whether to blink the matching beginning.")
204 ;;"elseif" "elsewhere" "end" "enddo" "endfile" "endif" "entry" "equivalence" 205 ;;"elseif" "elsewhere" "end" "enddo" "endfile" "endif" "entry" "equivalence"
205 ;;"exit" "external" "forall" "format" "function" "goto" "if" "implicit" 206 ;;"exit" "external" "forall" "format" "function" "goto" "if" "implicit"
206 ;;"include" "inquire" "integer" "intent" "interface" "intrinsic" "logical" 207 ;;"include" "inquire" "integer" "intent" "interface" "intrinsic" "logical"
207 ;;"module" "namelist" "none" "nullify" "only" "open" "optional" "parameter" 208 ;;"module" "namelist" "none" "nullify" "only" "open" "operator" "optional" "parameter"
208 ;;"pause" "pointer" "precision" "print" "private" "procedure" "program" 209 ;;"pause" "pointer" "precision" "print" "private" "procedure" "program"
209 ;;"public" "read" "real" "recursive" "return" "rewind" "save" "select" 210 ;;"public" "read" "real" "recursive" "result" "return" "rewind" "save" "select"
210 ;;"sequence" "stop" "subroutine" "target" "then" "type" "use" "where" 211 ;;"sequence" "stop" "subroutine" "target" "then" "type" "use" "where"
211 ;;"while" "write") 212 ;;"while" "write")
212 (concat 213 (concat
@@ -217,25 +218,28 @@ whether to blink the matching beginning.")
217 "if\\)\\|try\\)\\|quivalence\\|x\\(it\\|ternal\\)\\)\\|f\\(or\\(all\\|" 218 "if\\)\\|try\\)\\|quivalence\\|x\\(it\\|ternal\\)\\)\\|f\\(or\\(all\\|"
218 "mat\\)\\|unction\\)\\|goto\\|i\\(f\\|mplicit\\|n\\(clude\\|quire\\|t\\(" 219 "mat\\)\\|unction\\)\\|goto\\|i\\(f\\|mplicit\\|n\\(clude\\|quire\\|t\\("
219 "e\\(ger\\|nt\\|rface\\)\\|rinsic\\)\\)\\)\\|logical\\|module\\|n\\(" 220 "e\\(ger\\|nt\\|rface\\)\\|rinsic\\)\\)\\)\\|logical\\|module\\|n\\("
220 "amelist\\|one\\|ullify\\)\\|o\\(nly\\|p\\(en\\|tional\\)\\)\\|p\\(a\\(" 221 "amelist\\|one\\|ullify\\)\\|o\\(nly\\|p\\(en\\|erator\\|tional\\)\\)\\|p\\(a\\("
221 "rameter\\|use\\)\\|ointer\\|r\\(ecision\\|i\\(nt\\|vate\\)\\|o\\(" 222 "rameter\\|use\\)\\|ointer\\|r\\(ecision\\|i\\(nt\\|vate\\)\\|o\\("
222 "cedure\\|gram\\)\\)\\|ublic\\)\\|re\\(a[dl]\\|cursive\\|turn\\|wind\\)\\|" 223 "cedure\\|gram\\)\\)\\|ublic\\)\\|re\\(a[dl]\\|cursive\\|sult\\|turn\\|wind\\)\\|"
223 "s\\(ave\\|e\\(lect\\|quence\\)\\|top\\|ubroutine\\)\\|t\\(arget\\|hen\\|" 224 "s\\(ave\\|e\\(lect\\|quence\\)\\|top\\|ubroutine\\)\\|t\\(arget\\|hen\\|"
224 "ype\\)\\|use\\|w\\(h\\(ere\\|ile\\)\\|rite\\)\\)\\>") 225 "ype\\)\\|use\\|w\\(h\\(ere\\|ile\\)\\|rite\\)\\)\\>")
225 "Regexp for F90 keywords.") 226 "Regexp for F90 keywords.")
226 227
227(defconst f90-keywords-level-3-re 228(defconst f90-keywords-level-3-re
228 ;; ("allocate" "allocatable" "assign" "assignment" "backspace" "close" 229 ;; ("allocate" "allocatable" "assign" "assignment" "backspace" "close"
229 ;; "deallocate" "endfile" "entry" "equivalence" "external" "inquire" "intent" 230 ;; "deallocate" "dimension" "endfile" "entry" "equivalence" "external"
230 ;; "intrinsic" "only" "open" "optional" "parameter" "pause" "pointer" "print" 231 ;; "inquire" "intent" "intrinsic" "nullify" "only" "open" "operator"
231 ;; "private" "public" "read" "recursive" "rewind" "save" "select" "sequence" 232 ;; "optional" "parameter" "pause" "pointer" "print" "private" "public"
232 ;; "target" "write") 233 ;; "read" "recursive" "result" "rewind" "save" "select" "sequence"
234 ;; "target" "write")
233 (concat 235 (concat
234 "\\<\\(a\\(llocat\\(able\\|e\\)\\|ssign\\(\\|ment\\)\\)\\|backspace\\|" 236 "\\<\\(a\\(llocat\\(able\\|e\\)\\|ssign\\(\\|ment\\)\\)\\|backspace\\|"
235 "close\\|deallocate\\|e\\(n\\(dfile\\|try\\)\\|quivalence\\|xternal\\)\\|" 237 "close\\|d\\(eallocate\\|imension\\)\\|e\\(n\\(dfile\\|try\\)\\|"
236 "in\\(quire\\|t\\(ent\\|rinsic\\)\\)\\|o\\(nly\\|p\\(en\\|tional\\)\\)\\|" 238 "quivalence\\|xternal\\)\\|"
239 "in\\(quire\\|t\\(ent\\|rinsic\\)\\)\\|nullify\\|"
240 "o\\(nly\\|p\\(en\\|erator\\|tional\\)\\)\\|"
237 "p\\(a\\(rameter\\|use\\)\\|ointer\\|ri\\(nt\\|vate\\)\\|ublic\\)\\|re\\(" 241 "p\\(a\\(rameter\\|use\\)\\|ointer\\|ri\\(nt\\|vate\\)\\|ublic\\)\\|re\\("
238 "ad\\|cursive\\|wind\\)\\|s\\(ave\\|e\\(lect\\|quence\\)\\)\\|target\\|" 242 "ad\\|cursive\\|sult\\|wind\\)\\|s\\(ave\\|e\\(lect\\|quence\\)\\)\\|target\\|"
239 "write\\)\\>") 243 "write\\)\\>")
240"Keyword-regexp for font-lock level >= 3.") 244"Keyword-regexp for font-lock level >= 3.")
241 245
@@ -387,7 +391,7 @@ whether to blink the matching beginning.")
387 1 font-lock-keyword-face) 391 1 font-lock-keyword-face)
388 '("\\<\\(exit\\|cycle\\)[ \t]*\\(\\sw+\\)2\\>" 392 '("\\<\\(exit\\|cycle\\)[ \t]*\\(\\sw+\\)2\\>"
389 2 font-lock-doc-string-face) 393 2 font-lock-doc-string-face)
390 '("\\<\\(case\\)[ \t]+\\(default\\|(\\)" . 1) 394 '("\\<\\(case\\)[ \t]*\\(default\\|(\\)" . 1)
391 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)" 395 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)"
392 1 font-lock-keyword-face) 396 1 font-lock-keyword-face)
393 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)" 397 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)"
@@ -410,7 +414,7 @@ whether to blink the matching beginning.")
410 "\\<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\>" 414 "\\<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\>"
411 '("\\<\\(exit\\|cycle\\)[ \t]*\\(\\sw+\\)?\\>" 415 '("\\<\\(exit\\|cycle\\)[ \t]*\\(\\sw+\\)?\\>"
412 (1 font-lock-keyword-face) (2 font-lock-reference-face nil t)) 416 (1 font-lock-keyword-face) (2 font-lock-reference-face nil t))
413 '("\\<\\(case\\)[ \t]+\\(default\\|(\\)" . 1) 417 '("\\<\\(case\\)[ \t]*\\(default\\|(\\)" . 1)
414 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)" 418 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)"
415 (1 font-lock-keyword-face) (2 font-lock-reference-face)) 419 (1 font-lock-keyword-face) (2 font-lock-reference-face))
416 '("^[ \t]*\\([0-9]+\\)" (1 font-lock-reference-face t))))) 420 '("^[ \t]*\\([0-9]+\\)" (1 font-lock-reference-face t)))))
@@ -645,7 +649,7 @@ program\\|select\\|subroutine\\|type\\|where\\|forall\\)\\>")
645(defconst f90-program-block-re 649(defconst f90-program-block-re
646 "\\(program\\|module\\|subroutine\\|function\\)") 650 "\\(program\\|module\\|subroutine\\|function\\)")
647(defconst f90-else-like-re 651(defconst f90-else-like-re
648 "\\(else\\([ \t]*if\\|where\\)?\\|case[ \t]*\\(default\\|(\\)\\)\\>") 652 "\\(else\\([ \t]*if\\|where\\)?\\|case[ \t]*\\(default\\|(\\)\\)")
649(defconst f90-end-if-re 653(defconst f90-end-if-re
650 "end[ \t]*\\(if\\|select\\|where\\|forall\\)\\>") 654 "end[ \t]*\\(if\\|select\\|where\\|forall\\)\\>")
651(defconst f90-end-type-re 655(defconst f90-end-type-re
@@ -664,7 +668,8 @@ program\\|select\\|subroutine\\|type\\|where\\|forall\\)\\>")
664 "^[ \t0-9]*\\(" 668 "^[ \t0-9]*\\("
665 "program[ \t]+\\(\\sw+\\)\\|" 669 "program[ \t]+\\(\\sw+\\)\\|"
666 "module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)\\|" 670 "module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)\\|"
667 "\\(recursive[ \t]*\\)?subroutine[ \t]+\\(\\sw+\\)\\|" 671 "\\(pure\\|recursive\\|extrinsic([^)]+)\\)?[ \t]*"
672 "subroutine[ \t]+\\(\\sw+\\)\\|"
668 ; avoid end function, but allow for most other things 673 ; avoid end function, but allow for most other things
669 "\\([^!]*\\([^e!].[^ \t!]\\|.[^n!][^ \t!]\\|..[^d \t!]\\)" 674 "\\([^!]*\\([^e!].[^ \t!]\\|.[^n!][^ \t!]\\|..[^d \t!]\\)"
670 "\\|[^!]?[^!]?\\)[ \t]*function[ \t]+\\(\\sw+\\)" 675 "\\|[^!]?[^!]?\\)[ \t]*function[ \t]+\\(\\sw+\\)"
@@ -1000,10 +1005,12 @@ Name is non-nil only for type."
1000 ((and (not (looking-at "module[ \t]*procedure\\>")) 1005 ((and (not (looking-at "module[ \t]*procedure\\>"))
1001 (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>")) 1006 (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>"))
1002 (list (f90-match-piece 1) (f90-match-piece 2))) 1007 (list (f90-match-piece 1) (f90-match-piece 2)))
1003 ((looking-at "\\(recursive[ \t]*\\)?\\(subroutine\\)[ \t]+\\(\\sw+\\)") 1008 ((looking-at (concat
1009 "\\(pure\\|recursive\\|extrinsic([^)]+)\\)?[ \t]*"
1010 "\\(subroutine\\)[ \t]+\\(\\sw+\\)"))
1004 (list (f90-match-piece 2) (f90-match-piece 3))) 1011 (list (f90-match-piece 2) (f90-match-piece 3)))
1005 ((and (not (looking-at "end[ \t]*function")) 1012 ((and (not (looking-at "end[ \t]*function"))
1006 (looking-at ".*\\(function\\)[ \t]+\\(\\sw+\\)")) 1013 (looking-at "[^!\"\&\\n]*\\(function\\)[ \t]+\\(\\sw+\\)"))
1007 (list (f90-match-piece 1) (f90-match-piece 2))))) 1014 (list (f90-match-piece 1) (f90-match-piece 2)))))
1008 1015
1009(defsubst f90-looking-at-program-block-end () 1016(defsubst f90-looking-at-program-block-end ()
@@ -1580,9 +1587,19 @@ Leave point at the end of line."
1580 (setq end-name (car (cdr end-struct))) 1587 (setq end-name (car (cdr end-struct)))
1581 (save-excursion 1588 (save-excursion
1582 (beginning-of-line) 1589 (beginning-of-line)
1583 (while (and (not (zerop count)) 1590 (while
1584 (re-search-backward 1591 (and (not (zerop count))
1585 (concat "\\(" f90-blocks-re "\\)") nil t)) 1592 (let ((stop nil) notexist)
1593 (while (not stop)
1594 (setq notexist
1595 (not (re-search-backward
1596 (concat "\\(" f90-blocks-re "\\)") nil t)))
1597 (if notexist
1598 (setq stop t)
1599 (setq stop
1600 (not (or (f90-in-string)
1601 (f90-in-comment))))))
1602 (not notexist)))
1586 (beginning-of-line) (skip-chars-forward " \t0-9") 1603 (beginning-of-line) (skip-chars-forward " \t0-9")
1587 (cond ((setq matching-beg 1604 (cond ((setq matching-beg
1588 (cond 1605 (cond
@@ -1627,10 +1644,11 @@ Any other key combination is executed normally."
1627 (interactive) 1644 (interactive)
1628 (let (e c) 1645 (let (e c)
1629 (insert last-command-char) 1646 (insert last-command-char)
1630 (setq e (next-command-event) 1647 (if (string-match "XEmacs" emacs-version)
1631 c (if (string-match "XEmacs" emacs-version) 1648 (progn
1632 (event-to-character e) 1649 (setq e (next-command-event))
1633 (read-event))) 1650 (setq c (event-to-character e)))
1651 (setq c (read-event)))
1634 ;; insert char if not equal to `?' 1652 ;; insert char if not equal to `?'
1635 (if (or (= c ??) (eq c help-char)) 1653 (if (or (= c ??) (eq c help-char))
1636 (f90-abbrev-help) 1654 (f90-abbrev-help)