(file) Return to fortran_pp.st CVS log (file) (dir) Up to [RizwankCVS] / testProject / share / enscript / hl

  1 rizwank 1.1 /**
  2              * Name: fortran_pp
  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>
  7              */
  8             
  9             state fortran_string extends Highlight
 10             {
 11               /[\']/ {
 12                 language_print ($0);
 13                 return;
 14               }
 15             }
 16             
 17             state fortran_io extends Highlight
 18             {
 19               /\)/ {
 20                 language_print ($0);
 21                 return;
 22 rizwank 1.1   }
 23             
 24             
 25             
 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/ {
 32                 keyword_face (true);
 33                 language_print ($0);
 34                 keyword_face (false);
 35               }
 36             
 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/ {
 43 rizwank 1.1     keyword_face (true);
 44                 language_print ($0);
 45                 keyword_face (false);
 46               }
 47             
 48               /* Strings in the io statement */
 49               /[\']/ {
 50                 string_face (true);
 51                 language_print ($0);
 52                 call (fortran_string);
 53                 string_face (false);
 54               }
 55             }
 56             
 57             state fortran_pp extends HighlightEntry
 58             {
 59               /* Comments. */
 60               /(^[cC!\*]|!)/ {
 61                 comment_face (true);
 62                 language_print ($0);
 63                 call (eat_one_line);
 64 rizwank 1.1     comment_face (false);
 65               }
 66             
 67               /* String constants. */
 68               /[\']/ {
 69                 string_face (true);
 70                 language_print ($0);
 71                 call (fortran_string);
 72                 string_face (false);
 73               }
 74             
 75               /* Pre-processor lines. */
 76               /^#/ {
 77                 reference_face (true);
 78                 language_print ($0);
 79                 call (eat_one_line);
 80                 reference_face (false);
 81               }
 82             
 83               /* Comparators.  We have to roll by hand because of the
 84                  dots - "\b" doesn't delimit here. */
 85 rizwank 1.1   /\.(and|eqv?|g(e|t)|l(e|t)|ne(qv)?|not|or)\./ {
 86                 keyword_face (true);
 87                 language_print ($0);
 88                 keyword_face (false);
 89               }
 90             
 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)\./ {
 94                 keyword_face (true);
 95                 language_print ($0);
 96                 keyword_face (false);
 97               }
 98             
 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/ {
102             
103                 keyword_face (true);
104                 language_print ($0);
105                 keyword_face (false);
106 rizwank 1.1     call (fortran_io);
107               }
108             
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/ {
112             
113                 keyword_face (true);
114                 language_print ($0);
115                 keyword_face (false);
116                 call (fortran_io);
117               }
118             
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 rizwank 1.1 |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/ {
132             
133                 keyword_face (true);
134                 language_print ($0);
135                 keyword_face (false);
136               }
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 rizwank 1.1 |P(A(RAMETER|USE)|R(INT|OGRAM))|RE(AL(\*[0-9]+)?|TURN)\
149             |S(AVE|TOP|UBROUTINE)|THEN|WHILE)\b/ {
150             
151                 keyword_face (true);
152                 language_print ($0);
153                 keyword_face (false);
154               }
155             }
156             
157             
158             /*
159             Local variables:
160             mode: c
161             End:
162             */

Rizwan Kassim
Powered by
ViewCVS 0.9.2