Mercurial > emacs
comparison lisp/progmodes/fortran.el @ 9476:59901c9aa208
* 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.
author | Simon Marshall <simon@gnu.org> |
---|---|
date | Wed, 12 Oct 1994 08:24:50 +0000 |
parents | b26a8476561d |
children | b2d6d69b7707 |
comparison
equal
deleted
inserted
replaced
9475:c15caadae3c4 | 9476:59901c9aa208 |
---|---|
175 (modify-syntax-entry ?\' "\"" fortran-mode-syntax-table) | 175 (modify-syntax-entry ?\' "\"" fortran-mode-syntax-table) |
176 (modify-syntax-entry ?\" "\"" fortran-mode-syntax-table) | 176 (modify-syntax-entry ?\" "\"" fortran-mode-syntax-table) |
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)) |
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'. | |
198 This 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'. | |
242 This 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.") | |
181 | 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 |
185 () | 250 () |
352 (message "Emacs Fortran mode %s. Bugs to %s" | 417 (message "Emacs Fortran mode %s. Bugs to %s" |
353 fortran-mode-version bug-fortran-mode)) | 418 fortran-mode-version bug-fortran-mode)) |
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) |
360 (setq indent-line-function 'fortran-indent-line) | 427 (setq indent-line-function 'fortran-indent-line) |
361 (make-local-variable 'comment-indent-function) | 428 (make-local-variable 'comment-indent-function) |