aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Marshall1994-10-12 08:24:50 +0000
committerSimon Marshall1994-10-12 08:24:50 +0000
commit563f09b5419c6b68ecdfca396ee0a85b781cd725 (patch)
tree8e1c3544f2d53fb3f8c1fefd2e4a31d85bd2cd27
parent5a28e48c70926c89c29ca76a1f2df733096f1cb5 (diff)
downloademacs-563f09b5419c6b68ecdfca396ee0a85b781cd725.tar.gz
emacs-563f09b5419c6b68ecdfca396ee0a85b781cd725.zip
* fortran.el: (fortran-mode-syntax-table): Made `!' be a comment.
(fortran-font-lock-keywords-1, fortran-font-lock-keywords-2, fortran-font-lock-keywords): New variables. (fortran-mode): Set font-lock-defaults.
-rw-r--r--lisp/progmodes/fortran.el67
1 files changed, 67 insertions, 0 deletions
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index 1ea86503aae..f177afee57a 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -177,8 +177,73 @@ This variable used in TAB format mode.")
177 (modify-syntax-entry ?\\ "/" fortran-mode-syntax-table) 177 (modify-syntax-entry ?\\ "/" fortran-mode-syntax-table)
178 (modify-syntax-entry ?. "w" fortran-mode-syntax-table) 178 (modify-syntax-entry ?. "w" fortran-mode-syntax-table)
179 (modify-syntax-entry ?_ "w" fortran-mode-syntax-table) 179 (modify-syntax-entry ?_ "w" fortran-mode-syntax-table)
180 (modify-syntax-entry ?\! "<" fortran-mode-syntax-table)
180 (modify-syntax-entry ?\n ">" fortran-mode-syntax-table)) 181 (modify-syntax-entry ?\n ">" fortran-mode-syntax-table))
181 182
183;; Comments are real pain in Fortran because there is no way to represent the
184;; standard comment syntax in an Emacs syntax table (we can for VAX-style).
185;; Therefore an unmatched quote in a standard comment will throw fontification
186;; off on the wrong track. But to make it clear(er) to the programmer what is
187;; happening, we don't override string fontification when fontifying, by the
188;; keyword regexp, a standard comment.
189
190(defconst fortran-font-lock-keywords-1
191 '(;; Fontify comments.
192; ("^[Cc*].*$" 0 font-lock-comment-face t)
193 ("^[Cc*].*$" . font-lock-comment-face)
194 ;; Program, subroutine and function declarations, plus calls.
195 ("\\<\\(call\\|function\\|program\\|subroutine\\)\\>[ \t]*\\(\\sw+\\)?"
196 (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)))
197 "For consideration as a value of `fortran-font-lock-keywords'.
198This does fairly subdued highlighting.")
199
200(defconst fortran-font-lock-keywords-2
201 (append fortran-font-lock-keywords-1
202 (let ((type-types
203; ("integer" "logical" "real" "complex" "dimension" "double" "map"
204; "precision" "character" "parameter" "common" "save" "external"
205; "implicit" "intrinsic" "data" "equivalence" "structure" "union")
206 (concat "c\\(haracter\\|om\\(mon\\|plex\\)\\)\\|"
207 "d\\(ata\\|imension\\|ouble\\)\\|"
208 "e\\(quivalence\\|xternal\\)\\|"
209 "i\\(mplicit\\|nt\\(eger\\|rinsic\\)\\)\\|logical\\|map\\|"
210 "p\\(arameter\\|recision\\)\\|re\\(al\\|cord\\)\\|"
211 "s\\(ave\\|tructure\\)\\|union"))
212 (fkeywords
213; ("continue" "format" "end" "enddo" "if" "then" "else" "endif"
214; "elseif" "while" "inquire" "stop" "return" "include" "open"
215; "close" "read" "write" "format" "print")
216 (concat "c\\(lose\\|ontinue\\)\\|"
217 "e\\(lse\\(\\|if\\)\\|nd\\(\\|do\\|if\\)\\)\\|format\\|"
218 "i\\(f\\|n\\(clude\\|quire\\)\\)\\|open\\|print\\|"
219 "re\\(ad\\|turn\\)\\|stop\\|then\\|w\\(hile\\|rite\\)"))
220 (flogicals
221; ("and" "or" "not" "lt" "le" "eq" "ge" "gt" "ne" "true" "false")
222 "and\\|eq\\|false\\|g[et]\\|l[et]\\|n\\(e\\|ot\\)\\|or\\|true"))
223 (list
224 ;;
225 ;; Fontify types and variable names (but not length specs or `/'s).
226 (list (concat "\\<\\(" type-types "\\)\\>[0-9 \t/*]*\\(\\sw+\\)?")
227 '(1 font-lock-type-face)
228 '(11 font-lock-variable-name-face nil t))
229 ;;
230 ;; Fontify all builtin keywords (except logical, do and goto; see below).
231 (concat "\\<\\(" fkeywords "\\)\\>")
232 ;;
233 ;; Fontify all builtin operators.
234 (concat "\\.\\(" flogicals "\\)\\.")
235 ;;
236 ;; Fontify do/goto keywords and targets, and goto tags.
237 (list "\\<\\(do\\|go[ \t]*to\\)\\>[ \t]*\\([0-9]+\\)?"
238 '(1 font-lock-keyword-face)
239 '(2 font-lock-reference-face nil t))
240 (cons "^[ \t]*\\([0-9]+\\)" 'font-lock-reference-face))))
241 "For consideration as a value of `fortran-font-lock-keywords'.
242This does a lot more highlighting.")
243
244(defconst fortran-font-lock-keywords fortran-font-lock-keywords-1
245 "Additional expressions to highlight in Fortran mode.")
246
182(defvar fortran-mode-map () 247(defvar fortran-mode-map ()
183 "Keymap used in Fortran mode.") 248 "Keymap used in Fortran mode.")
184(if fortran-mode-map 249(if fortran-mode-map
@@ -354,6 +419,8 @@ with no args, if that value is non-nil."
354 (setq fortran-startup-message nil) 419 (setq fortran-startup-message nil)
355 (setq local-abbrev-table fortran-mode-abbrev-table) 420 (setq local-abbrev-table fortran-mode-abbrev-table)
356 (set-syntax-table fortran-mode-syntax-table) 421 (set-syntax-table fortran-mode-syntax-table)
422 (make-local-variable 'font-lock-defaults)
423 (setq font-lock-defaults '(fortran-font-lock-keywords nil t))
357 (make-local-variable 'fortran-break-before-delimiters) 424 (make-local-variable 'fortran-break-before-delimiters)
358 (setq fortran-break-before-delimiters t) 425 (setq fortran-break-before-delimiters t)
359 (make-local-variable 'indent-line-function) 426 (make-local-variable 'indent-line-function)