Improve treatment of Fortran's "class is"
* lisp/progmodes/f90.el (f90-start-block-re, f90-no-block-limit): Handle "class is". (Bug#25039) * test/automated/f90.el (f90-test-bug25039): New test.
This commit is contained in:
parent
3674317311
commit
e46a13446a
2 changed files with 23 additions and 2 deletions
|
@ -895,8 +895,10 @@ Can be overridden by the value of `font-lock-maximum-decoration'.")
|
||||||
|
|
||||||
;; This is for a TYPE block, not a variable of derived TYPE.
|
;; This is for a TYPE block, not a variable of derived TYPE.
|
||||||
;; Hence no need to add CLASS for F2003.
|
;; Hence no need to add CLASS for F2003.
|
||||||
|
;; Note that this also matches "type is", so you might need to use
|
||||||
|
;; f90-typeis-re as well.
|
||||||
(defconst f90-type-def-re
|
(defconst f90-type-def-re
|
||||||
;; type word
|
;; type word (includes "type is")
|
||||||
;; type :: word
|
;; type :: word
|
||||||
;; type, attr-list :: word
|
;; type, attr-list :: word
|
||||||
;; where attr-list = attr [, attr ...]
|
;; where attr-list = attr [, attr ...]
|
||||||
|
@ -953,7 +955,7 @@ Used in the F90 entry in `hs-special-modes-alist'.")
|
||||||
;; Avoid F2003 "type is" in "select type",
|
;; Avoid F2003 "type is" in "select type",
|
||||||
;; and also variables of derived type "type (foo)".
|
;; and also variables of derived type "type (foo)".
|
||||||
;; "type, foo" must be a block (?).
|
;; "type, foo" must be a block (?).
|
||||||
"type[ \t,]\\("
|
"\\(?:type\\|class\\)[ \t,]\\("
|
||||||
"[^i(!\n\"& \t]\\|" ; not-i(
|
"[^i(!\n\"& \t]\\|" ; not-i(
|
||||||
"i[^s!\n\"& \t]\\|" ; i not-s
|
"i[^s!\n\"& \t]\\|" ; i not-s
|
||||||
"is\\(?:\\sw\\|\\s_\\)\\)\\|"
|
"is\\(?:\\sw\\|\\s_\\)\\)\\|"
|
||||||
|
@ -1452,6 +1454,7 @@ if all else fails."
|
||||||
(not (or (looking-at "end")
|
(not (or (looking-at "end")
|
||||||
(looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\
|
(looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\
|
||||||
\\|select[ \t]*\\(case\\|type\\)\\|case\\|where\\|forall\\|\
|
\\|select[ \t]*\\(case\\|type\\)\\|case\\|where\\|forall\\|\
|
||||||
|
\\(?:class\\|type\\)[ \t]*is\\|\
|
||||||
block\\|critical\\|enum\\|associate\\)\\_>")
|
block\\|critical\\|enum\\|associate\\)\\_>")
|
||||||
(looking-at "\\(program\\|\\(?:sub\\)?module\\|\
|
(looking-at "\\(program\\|\\(?:sub\\)?module\\|\
|
||||||
\\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\_>")
|
\\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\_>")
|
||||||
|
|
|
@ -255,4 +255,22 @@ end program prog")
|
||||||
(forward-line -2)
|
(forward-line -2)
|
||||||
(should (= 5 (current-indentation)))))
|
(should (= 5 (current-indentation)))))
|
||||||
|
|
||||||
|
(ert-deftest f90-test-bug25039 ()
|
||||||
|
"Test for http://debbugs.gnu.org/25039 ."
|
||||||
|
(with-temp-buffer
|
||||||
|
(f90-mode)
|
||||||
|
(insert "program prog
|
||||||
|
select type (a)
|
||||||
|
class is (c1)
|
||||||
|
x = 1
|
||||||
|
type is (t1)
|
||||||
|
x = 2
|
||||||
|
end select
|
||||||
|
end program prog")
|
||||||
|
(f90-indent-subprogram)
|
||||||
|
(forward-line -3)
|
||||||
|
(should (= 2 (current-indentation))) ; type is
|
||||||
|
(forward-line -2)
|
||||||
|
(should (= 2 (current-indentation))))) ; class is
|
||||||
|
|
||||||
;;; f90.el ends here
|
;;; f90.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue