update from MirBSD CVS
[alioth/jupp.git] / syntax / fortran.jsf.in
1 # $MirOS: contrib/code/jupp/syntax/fortran.jsf.in,v 1.3 2017/12/02 05:38:05 tg Exp $
2 #-
3 # JOE syntax highlight file for FORTRAN
4 # Heavily improved by: Malte Thoma (thoma@uni-muenster.de)
5
6 # Bugs:
7 #  in:  4.  eq.   -- does not recognize the .eq.
8 #  needs more intrinsics.
9
10 =Idle
11 =Comment        green
12 =Constant       cyan
13 =Type           red
14 =Keyword        bold 
15 =Intrinsic      magenta
16 =Preproc        yellow
17 =Operator       magenta
18 =Bad            bold red
19
20 # First character of line...
21
22 :reset Idle
23         *               idle            noeat
24         "\n"            reset
25         "cC*"           comment         recolor=-1
26         "#"             pre             recolor=-1
27
28 :pre    Preproc                                 
29         *               pre                             
30         "\n"            reset                   
31         
32 :comment Comment
33         *               comment
34         "\n"            reset
35
36 :idle Idle
37         *               idle
38         "!"             comment         recolor=-1
39         "\n"            reset
40         "0-9"           first_number    recolor=-1
41         "."             have_dot
42         "'"             string          recolor=-1
43         "a-zA-Z_"       ident           buffer
44
45 :first_number Constant
46         *               idle    noeat
47         "0-9"           first_number
48         "."             second_start
49         "eEdD"          epart
50
51 :have_dot Constant
52         *               idle    recolor=-2      noeat
53         "0-9"           second_number           recolor=-2
54         " \ta-zA-Z"     operator1       noeat recolor=-2
55
56 # Color the left .
57
58 :operator1 Operator
59         *       operator        buffer noeat
60         " \t"   operator1
61
62 # Default color is Idle for unknown operator
63
64 :operator Idle
65         *               idle    noeat
66         "a-zA-Z"        operator
67         ". \t"          unknown noeat istrings
68         "gt"            op
69         "ge"            op
70         "eq"            op
71         "le"            op
72         "ne"            op
73         "lt"            op
74         "and"           op
75         "or"            op
76         "llt"           op
77         "lle"           op
78         "lgt"           op
79         "lge"           op
80         "not"           op
81         "false"         const
82         "true"          const
83 done
84
85 # Eat the right .
86
87 :unknown Operator
88         *       idle
89         " \t"   unknown
90
91 :op Operator
92         *       idle
93         " \t"   op
94
95 :const Constant
96         *       idle
97         "."     op noeat
98         " \t"   const
99
100 # For distrinuishing between 4.e1 and 4.eq.
101
102 :second_start Constant
103         *       idle    noeat
104         "a-zA-Z"        operator1       noeat recolor=-2
105         "dD"    epart
106         "eE"    epart1
107         "0-9"   second_number
108
109 :epart1 Constant
110         *               idle    noeat
111         "q"             epart2
112         "0-9+\-"        enum
113
114 :epart2 Idle
115         *               idle    noeat
116         ". \t"          op      noeat recolor=-4
117
118 :second_number Constant
119         *               idle    noeat
120         "eEdD"          epart
121         "0-9"           second_number
122
123 :epart Constant
124         *               idle    noeat
125         "0-9+\-"        enum
126
127 :enum Constant
128         *               idle    noeat
129         "0-9"           enum
130
131 :string Constant
132         *               string
133         "\n"            reset
134         "'"             maybe_end_string
135
136 :maybe_end_string Constant
137         *               idle    noeat
138         "'"             string
139
140 :ident Idle
141         *               idle            noeat istrings
142         "allocate"      kw
143         "allocatable"   kw
144         "assign"        kw
145         "assignment"    kw
146         "backspace"     kw
147         "block"         kw
148         "blockdata"     kw
149         "call"          kw
150         "case"          kw
151         "character"     type
152         "close"         kw
153         "common"        kw
154         "complex"       type
155         "contains"      kw
156         "continue"      kw
157         "cycle"         kw
158         "data"          kw
159         "deallocate"    kw
160         "default"       kw
161         "dimension"     type
162         "do"            kw
163         "double"        type
164         "doubleprecision"       type
165         "elemental"     kw
166         "else"          kw
167         "elseif"        kw
168         "elsewhere"     kw
169         "end"           kw
170         "endblock"      kw
171         "endblockdata"  kw
172         "enddo"         kw
173         "endfile"       kw
174         "endforall"     kw
175         "endif"         kw
176         "endinterface"  kw
177         "endmodule"     kw
178         "endselect"     kw
179         "endtype"       kw
180         "endwhere"      kw
181         "entry"         kw
182         "equivalence"   kw
183         "exit"          kw
184         "external"      kw
185         "forall"        kw
186         "format"        kw
187         "function"      kw
188         "go"            kw
189         "goto"          kw
190         "if"            kw
191         "implicit"      kw
192         "implicit"      kw
193         "in"            kw
194         "inout"         kw
195         "inquire"       kw
196         "integer"       type
197         "intent"        kw
198         "interface"     kw
199         "intrinsic"     kw
200         "iolength"      kw
201         "kind"          kw
202         "logical"       type
203         "module"        kw
204         "namelist"      kw
205         "none"          kw
206         "nullify"       kw
207         "only"          kw
208         "open"          kw
209         "optional"      kw
210         "out"           kw
211         "parameter"     kw
212         "pause"         kw
213         "pointer"       kw
214         "precision"     type
215         "print"         kw
216         "private"       kw
217         "procedure"     kw
218         "program"       kw
219         "publc"         kw
220         "public"        kw
221         "pure"          kw
222         "read"          kw
223         "real"          type
224         "recursive"     kw
225         "result"        kw
226         "return"        kw
227         "rewind"        kw
228         "save"          kw
229         "select"        kw
230         "selectcase"    kw
231         "sequence"      kw
232         "stat"          kw
233         "stop"          kw
234         "subroutine"    kw
235         "target"        kw
236         "then"          kw
237         "to"            kw
238         "type"          kw
239         "use"           kw
240         "where"         kw
241         "while"         kw
242         "write"         kw
243 done
244         "("             idle    noeat istrings
245 # Keywords have to be duplicated here...
246         "allocate"      kw
247         "allocatable"   kw
248         "assign"        kw
249         "assignment"    kw
250         "backspace"     kw
251         "block"         kw
252         "blockdata"     kw
253         "call"          kw
254         "case"          kw
255         "character"     kw
256         "close"         kw
257         "common"        kw
258         "complex"       kw
259         "contains"      kw
260         "continue"      kw
261         "cycle"         kw
262         "data"          kw
263         "deallocate"    kw
264         "default"       kw
265         "dimension"     type
266         "do"            kw
267         "double"        type
268         "doubleprecision"       type
269         "elemental"     kw
270         "else"          kw
271         "elseif"        kw
272         "elsewhere"     kw
273         "end"           kw
274         "endblock"      kw
275         "endblockdata"  kw
276         "enddo"         kw
277         "endfile"       kw
278         "endforall"     kw
279         "endif"         kw
280         "endinterface"  kw
281         "endmodule"     kw
282         "endselect"     kw
283         "endtype"       kw
284         "endwhere"      kw
285         "entry"         kw
286         "equivalence"   kw
287         "exit"          kw
288         "external"      kw
289         "forall"        kw
290         "format"        kw
291         "function"      kw
292         "go"            kw
293         "goto"          kw
294         "if"            kw
295         "implicit"      kw
296         "implicit"      kw
297         "in"            kw
298         "inout"         kw
299         "inquire"       kw
300         "integer"       kw
301         "intent"        kw
302         "interface"     kw
303         "intrinsic"     kw
304         "iolength"      kw
305         "kind"          kw
306         "logical"       type
307         "module"        kw
308         "namelist"      kw
309         "none"          kw
310         "nullify"       kw
311         "only"          kw
312         "open"          kw
313         "optional"      kw
314         "out"           kw
315         "parameter"     kw
316         "pause"         kw
317         "pointer"       kw
318         "precision"     type
319         "print"         kw
320         "private"       kw
321         "procedure"     kw
322         "program"       kw
323         "publc"         kw
324         "public"        kw
325         "pure"          kw
326         "read"          kw
327         "real"          kw
328         "recursive"     kw
329         "result"        kw
330         "return"        kw
331         "rewind"        kw
332         "save"          kw
333         "select"        kw
334         "selectcase"    kw
335         "sequence"      kw
336         "stat"          kw
337         "stop"          kw
338         "subroutine"    kw
339         "target"        kw
340         "then"          kw
341         "to"            kw
342         "type"          kw
343         "use"           kw
344         "where"         kw
345         "while"         kw
346         "write"         kw
347 # Here are instrinsics
348         "abs"           intrinsic
349         "achar"         intrinsic
350         "acos"          intrinsic
351         "adjustl"               intrinsic
352         "adjustr"               intrinsic
353         "aimag"         intrinsic
354         "aint"          intrinsic
355         "all"           intrinsic
356         "allocated"             intrinsic
357         "alog"          intrinsic
358         "alog10"        intrinsic
359         "anint"         intrinsic
360         "any"           intrinsic
361         "asin"          intrinsic
362         "associated"            intrinsic
363         "atan"          intrinsic
364         "atan2"         intrinsic
365         "bit_size"              intrinsic
366         "btest"         intrinsic
367         "ceiling"               intrinsic
368         "char"          intrinsic
369         "cmplx"         intrinsic
370         "conjg"         intrinsic
371         "cos"           intrinsic
372         "cosh"          intrinsic
373         "count"         intrinsic
374         "cpu_time"              intrinsic
375         "cshift"                intrinsic
376         "date_and_time"         intrinsic
377         "dble"          intrinsic
378         "digits"                intrinsic
379         "dim"           intrinsic
380         "dot_product"           intrinsic
381         "dprod"         intrinsic
382         "eoshift"               intrinsic
383         "epsilon"               intrinsic
384         "exp"           intrinsic
385         "exponent"              intrinsic
386         "false"         intrinsic
387         "floor"         intrinsic
388         "float"         intrinsic
389         "fraction"              intrinsic
390         "huge"          intrinsic
391         "iachar"                intrinsic
392         "iand"          intrinsic
393         "ibclr"         intrinsic
394         "ibits"         intrinsic
395         "ibset"         intrinsic
396         "ichar"         intrinsic
397         "ieor"          intrinsic
398         "index"         intrinsic
399         "int"           intrinsic
400         "int2"          intrinsic
401         "ior"           intrinsic
402         "ishft"         intrinsic
403         "ishftc"                intrinsic
404         "kind"          intrinsic
405         "lbound"                intrinsic
406         "len"           intrinsic
407         "len_trim"              intrinsic
408         "lge"           intrinsic
409         "lgt"           intrinsic
410         "lle"           intrinsic
411         "llt"           intrinsic
412         "log"           intrinsic
413         "log10"         intrinsic
414         "matmul"                intrinsic
415         "max"           intrinsic
416         "maxexponent"           intrinsic
417         "maxloc"                intrinsic
418         "maxval"                intrinsic
419         "merge"         intrinsic
420         "min"           intrinsic
421         "minexponent"           intrinsic
422         "minloc"                intrinsic
423         "minval"                intrinsic
424         "mod"           intrinsic
425         "modulo"                intrinsic
426         "mvbits"                intrinsic
427         "nearest"               intrinsic
428         "nint"          intrinsic
429         "not"           intrinsic
430         "null"          intrinsic
431         "pack"          intrinsic
432         "present"               intrinsic
433         "product"               intrinsic
434         "radix"         intrinsic
435         "random_number"         intrinsic
436         "random_seed"           intrinsic
437         "range"         intrinsic
438         "real"          intrinsic
439         "repeat"                intrinsic
440         "reshape"               intrinsic
441         "rrspacing"             intrinsic
442         "scale"         intrinsic
443         "scan"          intrinsic
444         "selected_int_kind"             intrinsic
445         "selected_real_kind"            intrinsic
446         "set_exponent"          intrinsic
447         "shape"         intrinsic
448         "sign"          intrinsic
449         "sin"           intrinsic
450         "sinh"          intrinsic
451         "size"          intrinsic
452         "spacing"               intrinsic
453         "spread"                intrinsic
454         "sqrt"          intrinsic
455         "sum"           intrinsic
456         "system_clock"          intrinsic
457         "tan"           intrinsic
458         "tanh"          intrinsic
459         "tiny"          intrinsic
460         "transfer"              intrinsic
461         "transpose"             intrinsic
462         "trim"          intrinsic
463         "true"          intrinsic
464         "ubound"                intrinsic
465         "unpack"                intrinsic
466         "verify"                intrinsic
467 done
468         "a-zA-Z0-9_"    ident
469         " \t"   ws_ident        hold
470
471
472 # Whitespace after an identifier... we wait to see if there is a "("
473 :ws_ident Idle
474         *               idle            noeat istrings
475         "allocate"      kw
476         "allocatable"   kw
477         "assign"        kw
478         "assignment"    kw
479         "backspace"     kw
480         "block"         kw
481         "blockdata"     kw
482         "call"          kw
483         "case"          kw
484         "character"     type
485         "close"         kw
486         "common"        kw
487         "complex"       type
488         "contains"      kw
489         "continue"      kw
490         "cycle"         kw
491         "data"          kw
492         "deallocate"    kw
493         "default"       kw
494         "dimension"     type
495         "do"            kw
496         "double"        type
497         "doubleprecision"       type
498         "elemental"     kw
499         "else"          kw
500         "elseif"        kw
501         "elsewhere"     kw
502         "end"           kw
503         "endblock"      kw
504         "endblockdata"  kw
505         "enddo"         kw
506         "endfile"       kw
507         "endforall"     kw
508         "endif"         kw
509         "endinterface"  kw
510         "endmodule"     kw
511         "endselect"     kw
512         "endtype"       kw
513         "endwhere"      kw
514         "entry"         kw
515         "equivalence"   kw
516         "exit"          kw
517         "external"      kw
518         "forall"        kw
519         "format"        kw
520         "function"      kw
521         "go"            kw
522         "goto"          kw
523         "if"            kw
524         "implicit"      kw
525         "in"            kw
526         "inout"         kw
527         "inquire"       kw
528         "integer"       type
529         "intent"        kw
530         "interface"     kw
531         "intrinsic"     kw
532         "iolength"      kw
533         "kind"          kw
534         "logical"       type
535         "module"        kw
536         "namelist"      kw
537         "none"          kw
538         "nullify"       kw
539         "only"          kw
540         "open"          kw
541         "optional"      kw
542         "out"           kw
543         "parameter"     kw
544         "pause"         kw
545         "pointer"       kw
546         "precision"     type
547         "print"         kw
548         "private"       kw
549         "procedure"     kw
550         "program"       kw
551         "publc"         kw
552         "public"        kw
553         "pure"          kw
554         "read"          kw
555         "real"          type
556         "recursive"     kw
557         "result"        kw
558         "return"        kw
559         "rewind"        kw
560         "save"          kw
561         "select"        kw
562         "selectcase"    kw
563         "sequence"      kw
564         "stat"          kw
565         "stop"          kw
566         "subroutine"    kw
567         "target"        kw
568         "then"          kw
569         "to"            kw
570         "type"          kw
571         "use"           kw
572         "where"         kw
573         "while"         kw
574         "write"         kw
575 done
576         "("             idle    noeat istrings
577 # Keywords have to be duplicated here...
578         "allocate"      kw
579         "allocatable"   kw
580         "assign"        kw
581         "assignment"    kw
582         "backspace"     kw
583         "block"         kw
584         "blockdata"     kw
585         "call"          kw
586         "case"          kw
587         "character"     type
588         "close"         kw
589         "common"        kw
590         "complex"       type
591         "contains"      kw
592         "continue"      kw
593         "cycle"         kw
594         "data"          kw
595         "deallocate"    kw
596         "default"       kw
597         "dimension"     type
598         "do"            kw
599         "double"        type
600         "doubleprecision"       type
601         "elemental"     kw
602         "else"          kw
603         "elseif"        kw
604         "elsewhere"     kw
605         "end"           kw
606         "endblock"      kw
607         "endblockdata"  kw
608         "enddo"         kw
609         "endfile"       kw
610         "endforall"     kw
611         "endif"         kw
612         "endinterface"  kw
613         "endmodule"     kw
614         "endselect"     kw
615         "endtype"       kw
616         "endwhere"      kw
617         "entry"         kw
618         "equivalence"   kw
619         "exit"          kw
620         "external"      kw
621         "forall"        kw
622         "format"        kw
623         "function"      kw
624         "go"            kw
625         "goto"          kw
626         "if"            kw
627         "implicit"      kw
628         "in"            kw
629         "inout"         kw
630         "inquire"       kw
631         "integer"       kw
632         "intent"        kw
633         "interface"     kw
634         "intrinsic"     kw
635         "iolength"      kw
636         "kind"          kw
637         "logical"       type
638         "module"        kw
639         "namelist"      kw
640         "none"          kw
641         "nullify"       kw
642         "only"          kw
643         "open"          kw
644         "optional"      kw
645         "out"           kw
646         "parameter"     kw
647         "pause"         kw
648         "pointer"       kw
649         "precision"     type
650         "print"         kw
651         "private"       kw
652         "procedure"     kw
653         "program"       kw
654         "publc"         kw
655         "public"        kw
656         "pure"          kw
657         "read"          kw
658         "real"          type
659         "recursive"     kw
660         "result"        kw
661         "return"        kw
662         "rewind"        kw
663         "save"          kw
664         "select"        kw
665         "selectcase"    kw
666         "sequence"      kw
667         "stat"          kw
668         "stop"          kw
669         "subroutine"    kw
670         "target"        kw
671         "then"          kw
672         "to"            kw
673         "type"          kw
674         "use"           kw
675         "where"         kw
676         "while"         kw
677         "write"         kw
678 # Here are instrinsics
679         "abs"           intrinsic
680         "achar"         intrinsic
681         "acos"          intrinsic
682         "adjustl"               intrinsic
683         "adjustr"               intrinsic
684         "aimag"         intrinsic
685         "aint"          intrinsic
686         "all"           intrinsic
687         "allocated"             intrinsic
688         "alog"          intrinsic
689         "alog10"        intrinsic
690         "anint"         intrinsic
691         "any"           intrinsic
692         "asin"          intrinsic
693         "associated"            intrinsic
694         "atan"          intrinsic
695         "atan2"         intrinsic
696         "bit_size"              intrinsic
697         "btest"         intrinsic
698         "ceiling"               intrinsic
699         "char"          intrinsic
700         "cmplx"         intrinsic
701         "conjg"         intrinsic
702         "cos"           intrinsic
703         "cosh"          intrinsic
704         "count"         intrinsic
705         "cpu_time"              intrinsic
706         "cshift"                intrinsic
707         "date_and_time"         intrinsic
708         "dble"          intrinsic
709         "digits"                intrinsic
710         "dim"           intrinsic
711         "dot_product"           intrinsic
712         "dprod"         intrinsic
713         "eoshift"               intrinsic
714         "epsilon"               intrinsic
715         "exp"           intrinsic
716         "exponent"              intrinsic
717         "false"         intrinsic
718         "floor"         intrinsic
719         "float"         intrinsic
720         "fraction"              intrinsic
721         "huge"          intrinsic
722         "iachar"                intrinsic
723         "iand"          intrinsic
724         "ibclr"         intrinsic
725         "ibits"         intrinsic
726         "ibset"         intrinsic
727         "ichar"         intrinsic
728         "ieor"          intrinsic
729         "index"         intrinsic
730         "int"           intrinsic
731         "int2"          intrinsic
732         "ior"           intrinsic
733         "ishft"         intrinsic
734         "ishftc"                intrinsic
735         "kind"          intrinsic
736         "lbound"                intrinsic
737         "len"           intrinsic
738         "len_trim"              intrinsic
739         "lge"           intrinsic
740         "lgt"           intrinsic
741         "lle"           intrinsic
742         "llt"           intrinsic
743         "log"           intrinsic
744         "log10"         intrinsic
745         "matmul"                intrinsic
746         "max"           intrinsic
747         "maxexponent"           intrinsic
748         "maxloc"                intrinsic
749         "maxval"                intrinsic
750         "merge"         intrinsic
751         "min"           intrinsic
752         "minexponent"           intrinsic
753         "minloc"                intrinsic
754         "minval"                intrinsic
755         "mod"           intrinsic
756         "modulo"                intrinsic
757         "mvbits"                intrinsic
758         "nearest"               intrinsic
759         "nint"          intrinsic
760         "not"           intrinsic
761         "null"          intrinsic
762         "pack"          intrinsic
763         "present"               intrinsic
764         "product"               intrinsic
765         "radix"         intrinsic
766         "random_number"         intrinsic
767         "random_seed"           intrinsic
768         "range"         intrinsic
769         "real"          intrinsic
770         "repeat"                intrinsic
771         "reshape"               intrinsic
772         "rrspacing"             intrinsic
773         "scale"         intrinsic
774         "scan"          intrinsic
775         "selected_int_kind"             intrinsic
776         "selected_real_kind"            intrinsic
777         "set_exponent"          intrinsic
778         "shape"         intrinsic
779         "sign"          intrinsic
780         "sin"           intrinsic
781         "sinh"          intrinsic
782         "size"          intrinsic
783         "spacing"               intrinsic
784         "spread"                intrinsic
785         "sqrt"          intrinsic
786         "sum"           intrinsic
787         "system_clock"          intrinsic
788         "tan"           intrinsic
789         "tanh"          intrinsic
790         "tiny"          intrinsic
791         "transfer"              intrinsic
792         "transpose"             intrinsic
793         "trim"          intrinsic
794         "true"          intrinsic
795         "ubound"                intrinsic
796         "unpack"                intrinsic
797         "verify"                intrinsic
798 done
799         " \t"   ws_ident
800
801
802 :intrinsic Intrinsic
803         *       idle    noeat
804
805 :kw Keyword
806         *       idle    noeat
807
808 :type Type
809         *       idle    noeat