+2002-10-06 Glenn Morris <gmorris@ast.cam.ac.uk>
+
+ * progmodes/fortran.el (fortran-beginning-do): Ignore labelled DO
+ loops.
+
2002-10-04 Markus Rost <rost@math.ohio-state.edu>
* vc.el (vc-default-show-log-entry): Fix typo.
(defun fortran-beginning-do ()
"Search backwards for first unmatched DO [WHILE].
-Return point or nil."
- (let ((case-fold-search t))
+Return point or nil. Ignores labelled DO loops (ie DO 10 ... 10 CONTINUE)."
+ (let ((case-fold-search t)
+ (dostart-re "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+[^0-9]"))
(if (save-excursion
(beginning-of-line)
(skip-chars-forward " \t0-9")
- (looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+"))
+ (looking-at dostart-re))
;; Sitting on one.
(match-beginning 0)
;; Search for one.
(not (and (looking-at fortran-end-prog-re)
(fortran-check-end-prog-re))))
(skip-chars-forward " \t0-9")
- (cond ((looking-at
- "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+")
+ (cond ((looking-at dostart-re)
(setq count (1- count)))
+ ;; Note labelled loop ends not considered.
((looking-at "end[ \t]*do\\b")
(setq count (1+ count)))))
(and (= count 0)