]> git.eshelyaron.com Git - emacs.git/commitdiff
f90.el: add some support for continued strings without leading '&'
authorGlenn Morris <rgm@gnu.org>
Tue, 24 Feb 2015 07:13:49 +0000 (23:13 -0800)
committerGlenn Morris <rgm@gnu.org>
Tue, 24 Feb 2015 07:13:49 +0000 (23:13 -0800)
* lisp/progmodes/f90.el (f90-beginning-of-subprogram)
(f90-end-of-subprogram, f90-match-end):
Handle continued strings where the continuation does not start
with "&" and happens to match our regexp.

* test/automated/f90.el (f90-test-bug-19809): New test.

Fixes: debbugs:19809
lisp/ChangeLog
lisp/progmodes/f90.el
test/ChangeLog
test/automated/f90.el

index 7e7bbb7486a7fc80afeb25190933b429f407c6ab..165c1ce96de522053783377e1241be15f88e22d3 100644 (file)
@@ -1,3 +1,10 @@
+2015-02-24  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/f90.el (f90-beginning-of-subprogram)
+       (f90-end-of-subprogram, f90-match-end):
+       Handle continued strings where the continuation does not start
+       with "&" and happens to match our regexp.  (Bug#19809)
+
 2015-02-24  Bozhidar Batsov  <bozhidar@batsov.com>
 
        * comint.el (comint-clear-buffer): New command.
index b923819ebb3814a85dc7e1fb4a512f2c84e796c7..6264d3b7b828605a477a9964bf18622d578e1574 100644 (file)
@@ -1634,7 +1634,10 @@ Return (TYPE NAME), or nil if not found."
                 (re-search-backward f90-program-block-re nil 'move))
       (beginning-of-line)
       (skip-chars-forward " \t0-9")
-      (cond ((setq matching-beg (f90-looking-at-program-block-start))
+      ;; Check if in string in case using non-standard feature where
+      ;; continued strings do not need "&" at start of continuations.
+      (cond ((f90-in-string))
+            ((setq matching-beg (f90-looking-at-program-block-start))
              (setq count (1- count)))
             ((f90-looking-at-program-block-end)
              (setq count (1+ count)))))
@@ -1659,7 +1662,8 @@ Return (TYPE NAME), or nil if not found."
                 (re-search-forward f90-program-block-re nil 'move))
       (beginning-of-line)
       (skip-chars-forward " \t0-9")
-      (cond ((f90-looking-at-program-block-start)
+      (cond ((f90-in-string))
+            ((f90-looking-at-program-block-start)
              (setq count (1+ count)))
             ((setq matching-end (f90-looking-at-program-block-end))
              (setq count (1- count))))
@@ -2199,8 +2203,12 @@ Leave point at the end of line."
         (end-point (point))
         (case-fold-search t)
         matching-beg beg-name end-name beg-block end-block end-struct)
+    ;; Check if in string in case using non-standard feature where
+    ;; continued strings do not need "&" at start of continuations.
     (when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9")
-                          (setq end-struct (f90-looking-at-program-block-end)))
+                          (unless (f90-in-string)
+                            (setq end-struct
+                                  (f90-looking-at-program-block-end))))
       (setq end-block (car end-struct)
             end-name  (cadr end-struct))
       (save-excursion
index abc582c20fa99e0fe887634a3d87a3aac440c02f..7ba14964c0a9accc8a581bbf9fa69a8ea1d3d07b 100644 (file)
@@ -1,3 +1,7 @@
+2015-02-24  Glenn Morris  <rgm@gnu.org>
+
+       * automated/f90.el (f90-test-bug-19809): New test.
+
 2015-02-22  Michael Albinus  <michael.albinus@gmx.de>
 
        * automated/tramp-tests.el (tramp-test17-insert-directory):
index c6bc41f799afa46cda9a793508a1c67a019e63af..1cb2f035a6b51c695568c2d71fbf6a1a1abc0422 100644 (file)
@@ -173,4 +173,20 @@ end program prog")
     (f90-indent-subprogram)
     (should (= 0 (current-indentation)))))
 
+(ert-deftest f90-test-bug-19809 ()
+  "Test for http://debbugs.gnu.org/19809 ."
+  (with-temp-buffer
+    (f90-mode)
+    ;; The Fortran standard says that continued strings should have
+    ;; '&' at the start of continuation lines, but it seems gfortran
+    ;; allows them to be absent (albeit with a warning).
+    (insert "program prog
+  write (*,*), '&
+end program prog'
+end program prog")
+    (goto-char (point-min))
+    (f90-end-of-subprogram)
+    (should (= (point) (point-max)))))
+
+
 ;;; f90.el ends here