/[emacs]/emacs/lisp/progmodes/f90.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/f90.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.78 by rms, Fri Dec 31 14:53:24 2004 UTC revision 1.79 by gm, Tue Mar 29 18:34:22 2005 UTC
# Line 597  characters long.") Line 597  characters long.")
597    
598  ;; Hideshow support.  ;; Hideshow support.
599  (defconst f90-end-block-re  (defconst f90-end-block-re
600    (concat "^[ \t0-9]*\\<end\\>[ \t]*"    (concat "^[ \t0-9]*\\<end[ \t]*"
601            (regexp-opt '("do" "if" "forall" "function" "interface"            (regexp-opt '("do" "if" "forall" "function" "interface"
602                          "module" "program" "select"  "subroutine"                          "module" "program" "select" "subroutine"
603                          "type" "where" ) t)                          "type" "where" ) t)
604            "[ \t]*\\sw*")            "[ \t]*\\sw*")
605    "Regexp matching the end of a \"block\" of F90 code.    "Regexp matching the end of an F90 \"block\", from the line start.
606  Used in the F90 entry in `hs-special-modes-alist'.")  Used in the F90 entry in `hs-special-modes-alist'.")
607    
608  ;; Ignore the fact that FUNCTION, SUBROUTINE, WHERE, FORALL have a  ;; Ignore the fact that FUNCTION, SUBROUTINE, WHERE, FORALL have a
609  ;; following "(".  DO, CASE, IF can have labels; IF must be  ;; following "(".  DO, CASE, IF can have labels.
 ;; accompanied by THEN.  
 ;; A big problem is that many of these statements can be broken over  
 ;; lines, even with embedded comments. We only try to handle this for  
 ;; IF ... THEN statements, assuming and hoping it will be less common  
 ;; for other constructs. We match up to one new-line, provided ")  
 ;; THEN" appears on one line. Matching on just ") THEN" is no good,  
 ;; since that includes ELSE branches.  
 ;; For a fully accurate solution, hideshow would probably have to be  
 ;; modified to allow functions as well as regexps to be used to  
 ;; specify block start and end positions.  
610  (defconst f90-start-block-re  (defconst f90-start-block-re
611    (concat    (concat
612     "^[ \t0-9]*"                         ; statement number     "^[ \t0-9]*"                         ; statement number
613     "\\(\\("     "\\(\\("
614     "\\(\\sw+[ \t]*:[ \t]*\\)?"          ; structure label     "\\(\\sw+[ \t]*:[ \t]*\\)?"          ; structure label
615     "\\(do\\|select[ \t]*case\\|if[ \t]*(.*\n?.*)[ \t]*then\\|"     "\\(do\\|select[ \t]*case\\|"
616       ;; See comments in fortran-start-block-re for the problems of IF.
617       "if[ \t]*(\\(.*\\|"
618       ".*\n\\([^if]*\\([^i].\\|.[^f]\\|.\\>\\)\\)\\)\\<then\\|"
619     ;; Distinguish WHERE block from isolated WHERE.     ;; Distinguish WHERE block from isolated WHERE.
620     "\\(where\\|forall\\)[ \t]*(.*)[ \t]*\\(!\\|$\\)\\)\\)"     "\\(where\\|forall\\)[ \t]*(.*)[ \t]*\\(!\\|$\\)\\)\\)"
621     "\\|"     "\\|"
622     "program\\|interface\\|module\\|type\\|function\\|subroutine"     "program\\|interface\\|module\\|type\\|function\\|subroutine"
    ;; ") THEN" at line end. Problem - also does ELSE.  
 ;;;   "\\|.*)[ \t]*then[ \t]*\\($\\|!\\)"  
623     "\\)"     "\\)"
624     "[ \t]*")     "[ \t]*")
625    "Regexp matching the start of a \"block\" of F90 code.    "Regexp matching the start of an F90 \"block\", from the line start.
626  A simple regexp cannot do this in fully correct fashion, so this  A simple regexp cannot do this in fully correct fashion, so this
627  tries to strike a compromise between complexity and flexibility.  tries to strike a compromise between complexity and flexibility.
628  Used in the F90 entry in `hs-special-modes-alist'.")  Used in the F90 entry in `hs-special-modes-alist'.")
# Line 1305  Checks for consistency of block types an Line 1296  Checks for consistency of block types an
1296  Does not check the outermost block, because it may be incomplete.  Does not check the outermost block, because it may be incomplete.
1297  Interactively, pushes mark before moving point."  Interactively, pushes mark before moving point."
1298    (interactive "p")    (interactive "p")
1299      (if (interactive-p) (push-mark (point) t))
1300    (and num (< num 0) (f90-end-of-block (- num)))    (and num (< num 0) (f90-end-of-block (- num)))
1301    (let ((case-fold-search t)    (let ((case-fold-search t)
1302          (count (or num 1))          (count (or num 1))
1303          end-list end-this end-type end-label          end-list end-this end-type end-label
1304          start-this start-type start-label)          start-this start-type start-label)
     (if (interactive-p) (push-mark (point) t))  
1305      (beginning-of-line)                 ; probably want this      (beginning-of-line)                 ; probably want this
1306      (while (and (> count 0) (re-search-backward f90-blocks-re nil 'move))      (while (and (> count 0) (re-search-backward f90-blocks-re nil 'move))
1307        (beginning-of-line)        (beginning-of-line)

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.79

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26