3 * Description: Fortran77 programming language with cpp-statements
4 * Author: Keith Refson <Keith.Refson@earth.ox.ac.uk>
5 * Markku Rossi <mtr@iki.fi>
6 * Tobias Buchal <buch@ifh.bau-verm.uni-karlsruhe.de>
9 state fortran_string extends Highlight
17 state fortran_io extends Highlight
26 /* IO Keywords. (build-re '(FMT UNIT REC END ERR FILE STATUS
27 ACCESS FORM RECL BLANK IOSTAT EXIST OPENED NUMBER NAME
28 SEQUENTIAL DIRECT FORMATTED UNFORMATTED NEXTREC)) */
29 /\BbACCESS|BLANK|DIRECT|E(ND|RR|XIST)|F(ILE|MT|ORM(|ATTED))|IOSTAT\
30 |N(AME|EXTREC|UMBER)|OPENED|REC(|L)|S(EQUENTIAL|TATUS)\
31 |UN(FORMATTED|IT))\b/ {
37 /* IO Keywords. (build-re '(fmt unit rec end err file status
38 access form recl blank iostat exist opened number name
39 sequential direct formatted unformatted nextrec)) */
40 /\b(access|blank|direct|e(nd|rr|xist)|f(ile|mt|orm(|atted))|iostat\
41 |n(ame|extrec|umber)|opened|rec(|l)|s(equential|tatus)\
42 |un(formatted|it))\b/ {
48 /* Strings in the io statement */
52 call (fortran_string);
57 state fortran_pp extends HighlightEntry
67 /* String constants. */
71 call (fortran_string);
75 /* Pre-processor lines. */
77 reference_face (true);
80 reference_face (false);
83 /* Comparators. We have to roll by hand because of the
84 dots - "\b" doesn't delimit here. */
85 /\.(and|eqv?|g(e|t)|l(e|t)|ne(qv)?|not|or)\./ {
91 /* Comparators. We have to roll by hand because of the
92 dots - "\b" doesn't delimit here. */
93 /\.(AND|EQV?|G(E|T)|L(E|T)|NE(QV)?|NOT|OR)\./ {
99 /* IO Statement (build-re '(open close read
100 write inquire backspace endfile rewind )) */
101 /\b(backspace|close|endfile|inquire|open|re(ad|wind)|write)\b/ {
105 keyword_face (false);
109 /* IO Statement (build-re '(OPEN CLOSE READ
110 WRITE INQUIRE BACKSPACE ENDFILE REWIND )) */
111 /\b(BACKSPACE|CLOSE|ENDFILE|INQUIRE|OPEN|RE(AD|WIND)|WRITE)\b/ {
115 keyword_face (false);
119 /* Keywords. (build-re '( block\ *data call
120 character\\*\[0-9\]+ common complex\\*\[0-9\]+ continue
121 data dimension do double\ *precision else elseif end enddo
122 endfile endif entry equivalence external format function
123 go\ *to if implicit include integer\\*\[0-9\]+ intrinsic
124 logical\\*\[0-9\]+ parameter pause print program
125 real\\*\[0-9\]+ return save stop subroutine then while )) */
126 /\b(block *data|c(all|haracter(\*[0-9]+)?|o(m(mon|plex(\*[0-9]+)?)|ntinue))\
127 |d(ata|imension|o(|uble *precision))\
128 |e(lse(|if)|n(d(|do|file|if)|try)|quivalence|xternal)|f(ormat|unction)\
129 |go *to|i(f|mplicit|n(clude|t(eger(\*[0-9]+)?|rinsic)))|logical(\*[0-9]+)?\
130 |p(a(rameter|use)|r(int|ogram))|re(al(\*[0-9]+)?|turn)\
131 |s(ave|top|ubroutine)|then|while)\b/ {
135 keyword_face (false);
137 /* Keywords. (build-re '( block\ *data call
138 character\\*\[0-9\]+ COMMON COMPLEX\\*\[0-9\]+ CONTINUE
139 DATA DIMENSION DO DOUBLE\ *PRECISION ELSE ELSEIF END ENDDO
140 ENDFILE ENDIF ENTRY EQUIVALENCE EXTERNAL FORMAT FUNCTION
141 GO\ *TO IF IMPLICIT INCLUDE INTEGER\\*\[0-9\]+ INTRINSIC
142 LOGICAL\\*\[0-9\]+ PARAMETER PAUSE PRINT PROGRAM
143 REAL\\*\[0-9\]+ RETURN SAVE STOP SUBROUTINE THEN WHILE )) */
144 /\b(BLOCK *DATA|C(ALL|HARACTER(\*[0-9]+)?|O(M(MON|PLEX(\*[0-9]+)?)|NTINUE))\
145 |D(ATA|IMENSION|O(|UBLE *PRECISION))\
146 |E(LSE(|IF)|N(D(|DO|FILE|IF)|TRY)|QUIVALENCE|XTERNAL)|F(ORMAT|UNCTION)\
147 |GO *TO|I(F|MPLICIT|N(CLUDE|T(EGER(\*[0-9]+)?|RINSIC)))|LOGICAL(\*[0-9]+)?\
148 |P(A(RAMETER|USE)|R(INT|OGRAM))|RE(AL(\*[0-9]+)?|TURN)\
149 |S(AVE|TOP|UBROUTINE)|THEN|WHILE)\b/ {
153 keyword_face (false);