]> code.delx.au - gnu-emacs/commitdiff
* lisp/progmodes/f90.el (f90-type-def-re): Handle attribute lists
authorGlenn Morris <rgm@gnu.org>
Mon, 6 Jul 2015 02:25:04 +0000 (19:25 -0700)
committerGlenn Morris <rgm@gnu.org>
Mon, 6 Jul 2015 02:25:04 +0000 (19:25 -0700)
such as "extends(parent), private".  (Bug#20969)

* test/automated/f90.el (f90-test-bug20969, f90-test-bug20969b):
New tests.

lisp/progmodes/f90.el
test/automated/f90.el

index 2bd7e7cc884c73b672cc4f9faf197647a8ae37e6..43b057ba88240029b15592d2d23ef2dd6ce6297c 100644 (file)
@@ -898,12 +898,12 @@ Can be overridden by the value of `font-lock-maximum-decoration'.")
 (defconst f90-type-def-re
   ;; type word
   ;; type :: word
-  ;; type, stuff :: word
-  ;; type, bind(c) :: word
-  ;; type, extends(stuff) :: word
+  ;; type, attr-list :: word
+  ;;   where attr-list = attr [, attr ...]
+  ;;   and attr may include bind(c) or extends(thing)
   ;; NOT "type ("
   "\\_<\\(type\\)\\_>\\(?:\\(?:[^()\n]*\\|\
-.*,[ \t]*\\(?:bind\\|extends\\)[ \t]*(.*)[ \t]*\\)::\\)?\
+.*,[ \t]*\\(?:bind\\|extends\\)[ \t]*(.*).*\\)::\\)?\
 [ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)"
   "Regexp matching the definition of a derived type.")
 
index 4c1abc34c4738bde67b7c2a513c3c8d0cf94c6a7..c521d289a5dbf95d4dde2e0d85c0398c15ff5f75 100644 (file)
@@ -214,4 +214,30 @@ end module modname")
     (forward-line -1)
     (should (= 2 (current-indentation)))))
 
+(ert-deftest f90-test-bug20969 ()
+  "Test for http://debbugs.gnu.org/20969 ."
+  (with-temp-buffer
+    (f90-mode)
+    (insert "module modname
+type, extends ( sometype ), private :: type1
+integer :: part1
+end type type1
+end module modname")
+    (f90-indent-subprogram)
+    (forward-line -1)
+    (should (= 2 (current-indentation)))))
+
+(ert-deftest f90-test-bug20969b ()
+  "Test for http://debbugs.gnu.org/20969 ."
+  (with-temp-buffer
+    (f90-mode)
+    (insert "module modname
+type, private, extends ( sometype ) :: type1
+integer :: part1
+end type type1
+end module modname")
+    (f90-indent-subprogram)
+    (forward-line -1)
+    (should (= 2 (current-indentation)))))
+
 ;;; f90.el ends here