diff options
| author | Glenn Morris <rgm@gnu.org> | 2020-01-15 18:47:51 -0800 |
|---|---|---|
| committer | Glenn Morris <rgm@gnu.org> | 2020-01-15 18:47:51 -0800 |
| commit | 3b0d1a50aa7e7555d46c6a6b54840c9fb46a6810 (patch) | |
| tree | 0725354aa64e2c52abb8839a8d6a6f32914e34bd /lisp/progmodes/f90.el | |
| parent | 55803cc189a89031bbf2b37e5ac00a04ef1ad8aa (diff) | |
| download | emacs-3b0d1a50aa7e7555d46c6a6b54840c9fb46a6810.tar.gz | |
f90: handle F2008 module function
* lisp/progmodes/f90.el (f90-font-lock-keywords-1)
(f90-looking-at-program-block-start):
Handle F2008 "module function" and subroutine. (Bug#38415)
* test/lisp/progmodes/f90-tests.el (f90-test-bug38415): New test.
Diffstat (limited to 'lisp/progmodes/f90.el')
| -rw-r--r-- | lisp/progmodes/f90.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 92fba1c53bb..9f61b8a6fca 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -539,8 +539,10 @@ type-name parts, respectively." read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t)) ;; Other functions and declarations. Named interfaces = F2003. ;; F2008: end submodule submodule_name. - '("\\_<\\(\\(?:end[ \t]*\\)?\\(program\\|\\(?:sub\\)?module\\|\ -function\\|associate\\|subroutine\\|interface\\)\\|use\\|call\\)\ + ;; F2008: module function|subroutine NAME. + '("\\_<\\(\\(?:end[ \t]*\\)?\\(program\\|\ +\\(?:module[ \t]*\\)?\\(?:function\\|subroutine\\)\\|\ +\\(?:sub\\)?module\\|associate\\|interface\\)\\|use\\|call\\)\ \\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?" (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) ;; F2008: submodule (parent_name) submodule_name. @@ -1381,14 +1383,19 @@ write\\)[ \t]*([^)\n]*)") (cond ((looking-at "\\(program\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>") (list (match-string 1) (match-string 2))) - ((and (not (looking-at "module[ \t]*procedure\\_>")) + ((and (not (looking-at "module[ \t]*\\(procedure\\|function\\|subroutine\\)\\_>")) (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")) (list (match-string 1) (match-string 2))) ((looking-at "\\(submodule\\)[ \t]*([^)\n]+)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>") (list (match-string 1) (match-string 2))) - ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)")) - (looking-at "[^!'\"&\n]*\\(function\\|subroutine\\)[ \t]+\ + ((and (not (looking-at "end[ \t]*\\(function\\|procedure\\|subroutine\\)")) + (looking-at "[^!'\"&\n]*\\(?:module[ \t]*\\)?\ +\\(function\\|subroutine\\)[ \t]+\ \\(\\(?:\\sw\\|\\s_\\)+\\)")) + ;; TODO: In F2008 "module procedure foo" may or may not start a block, + ;; It is impossible to tell the difference without parsing state. +;;; (looking-at "[^!'\"&\n]*module[ \t]*\\(procedure\\)[ \t]+\ +;;;\\(\\(?:\\sw\\|\\s_\\)+\\)"))) (list (match-string 1) (match-string 2))))) ;; Following will match an un-named main program block; however ;; one needs to check if there is an actual PROGRAM statement after |
