emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 ddd547f: Improve treatment of Fortran's "class de


From: Glenn Morris
Subject: [Emacs-diffs] emacs-26 ddd547f: Improve treatment of Fortran's "class default"
Date: Thu, 19 Oct 2017 20:05:56 -0400 (EDT)

branch: emacs-26
commit ddd547fada112c603dae7a204fa0b141429f1927
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Improve treatment of Fortran's "class default"
    
    * lisp/progmodes/f90.el (f90-start-block-re, f90-no-block-limit):
    Handle "class default".  (Bug#28786)
    * test/automated/f90.el (f90-test-bug25039): Add "class default".
---
 lisp/progmodes/f90.el            | 12 +++++++++---
 test/lisp/progmodes/f90-tests.el | 14 +++++++++-----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index 6421ba6..7215628 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -909,6 +909,8 @@ Can be overridden by the value of 
`font-lock-maximum-decoration'.")
 [ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
   "Regexp matching the definition of a derived type.")
 
+;; Maybe this should include "class default", but the constant is no
+;; longer used.
 (defconst f90-typeis-re
   "\\_<\\(class\\|type\\)[ \t]*is[ \t]*("
   "Regexp matching a CLASS/TYPE IS statement.")
@@ -955,10 +957,14 @@ Used in the F90 entry in `hs-special-modes-alist'.")
    ;; Avoid F2003 "type is" in "select type",
    ;; and also variables of derived type "type (foo)".
    ;; "type, foo" must be a block (?).
+   ;; And a partial effort to avoid "class default".
    "\\(?:type\\|class\\)[ \t,]\\("
-   "[^i(!\n\"& \t]\\|"                 ; not-i(
+   "[^id(!\n\"& \t]\\|"                ; not-id(
    "i[^s!\n\"& \t]\\|"                 ; i not-s
-   "is\\(?:\\sw\\|\\s_\\)\\)\\|"
+   "d[^e!\n\"& \t]\\|"                 ; d not-e
+   "de[^f!\n\"& \t]\\|"                ; de not-f
+   "def[^a!\n\"& \t]\\|"               ; def not-a
+   "\\(?:is\\|default\\)\\(?:\\sw\\|\\s_\\)\\)\\|"
    ;; "abstract interface" is F2003; "submodule" is F2008.
    "program\\|\\(?:abstract[ \t]*\\)?interface\\|\\(?:sub\\)?module\\|"
    ;; "enum", but not "enumerator".
@@ -1454,7 +1460,7 @@ if all else fails."
     (not (or (looking-at "end")
              (looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\
 \\|select[ \t]*\\(case\\|type\\)\\|case\\|where\\|forall\\|\
-\\(?:class\\|type\\)[ \t]*is\\|\
+\\(?:class\\|type\\)[ \t]*is\\|class[ \t]*default\\|\
 block\\|critical\\|enum\\|associate\\)\\_>")
              (looking-at "\\(program\\|\\(?:sub\\)?module\\|\
 \\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\_>")
diff --git a/test/lisp/progmodes/f90-tests.el b/test/lisp/progmodes/f90-tests.el
index 0c03a19..2a9100a 100644
--- a/test/lisp/progmodes/f90-tests.el
+++ b/test/lisp/progmodes/f90-tests.el
@@ -256,21 +256,25 @@ end program prog")
     (should (= 5 (current-indentation)))))
 
 (ert-deftest f90-test-bug25039 ()
-  "Test for https://debbugs.gnu.org/25039 ."
+  "Test for https://debbugs.gnu.org/25039 and 28786."
   (with-temp-buffer
     (f90-mode)
     (insert "program prog
 select type (a)
-class is (c1)
-x = 1
 type is (t1)
 x = 2
+class is (c1)
+x = 1
+class default
+x=3
 end select
 end program prog")
     (f90-indent-subprogram)
     (forward-line -3)
-    (should (= 2 (current-indentation))) ; type is
+    (should (= 2 (current-indentation))) ; class default
+    (forward-line -2)
+    (should (= 2 (current-indentation))) ; class is
     (forward-line -2)
-    (should (= 2 (current-indentation))))) ; class is
+    (should (= 2 (current-indentation))))) ; type is
 
 ;;; f90-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]