Mercurial > vim
annotate runtime/syntax/fortran.vim @ 12847:14f287552218 v8.0.1300
patch 8.0.1300: file permissions may end up wrong when writing
commit https://github.com/vim/vim/commit/cd142e3369db8888163a511dbe9907bcd138829c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 16 17:03:45 2017 +0100
patch 8.0.1300: file permissions may end up wrong when writing
Problem: File permissions may end up wrong when writing.
Solution: Use fchmod() instead of chmod() when possible. Don't truncate
until we know we can change the file.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 16 Nov 2017 17:15:06 +0100 |
parents | 368468ef35cf |
children | 99586852c2db |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
7384
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
2 " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) |
10385
368468ef35cf
commit https://github.com/vim/vim/commit/c0514bf4777a1d55f5785b3887c5686fd0bbe870
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
3 " Version: 100 |
368468ef35cf
commit https://github.com/vim/vim/commit/c0514bf4777a1d55f5785b3887c5686fd0bbe870
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
4 " Last Change: 2016 Oct. 29 |
6530 | 5 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
6 " Usage: For instructions, do :help fortran-syntax from Vim |
7 | 7 " Credits: |
10228
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
8 " Version 0.1 (April 2000) for Fortran 95 was based on the Fortran 77 syntax file by |
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
9 " Mario Eusebio and Preben Guldberg. Since then, useful suggestions and contributions |
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
10 " have been made, in chronological order, by: |
8303
88207f4b861a
commit https://github.com/vim/vim/commit/dae8d21dd291df6a6679a00be64e18bca0156576
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
11 " Andrej Panjkov, Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile, |
7 | 12 " Walter Dieudonné, Alexander Wagner, Roman Bertle, Charles Rendleman, |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
13 " Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, Jan Hermann, |
10228
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
14 " Stefano Zaghi, Vishnu V. Krishnan and Judicaël Grasset |
7 | 15 |
3281 | 16 if exists("b:current_syntax") |
7 | 17 finish |
18 endif | |
19 | |
3237 | 20 let s:cpo_save = &cpo |
21 set cpo&vim | |
22 | |
3281 | 23 " Choose fortran_dialect using the priority: |
7384
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
24 " source file directive > buffer-local value > global value > file extension |
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
25 " first try using directive in first three lines of file |
3281 | 26 let b:fortran_retype = getline(1)." ".getline(2)." ".getline(3) |
27 if b:fortran_retype =~? '\<fortran_dialect\s*=\s*F\>' | |
28 let b:fortran_dialect = "F" | |
29 elseif b:fortran_retype =~? '\<fortran_dialect\s*=\s*f08\>' | |
30 let b:fortran_dialect = "f08" | |
31 elseif !exists("b:fortran_dialect") | |
32 if exists("g:fortran_dialect") && g:fortran_dialect =~# '\<F\|f08\>' | |
33 " try global variable | |
34 let b:fortran_dialect = g:fortran_dialect | |
35 else " nothing found, so use default | |
36 let b:fortran_dialect = "f08" | |
7 | 37 endif |
38 endif | |
3281 | 39 unlet! b:fortran_retype |
40 " make sure buffer-local value is not invalid | |
41 if b:fortran_dialect !~# '\<F\|f08\>' | |
42 let b:fortran_dialect = "f08" | |
7 | 43 endif |
44 | |
45 " Choose between fixed and free source form if this hasn't been done yet | |
46 if !exists("b:fortran_fixed_source") | |
3281 | 47 if b:fortran_dialect == "F" |
48 " F requires free source form | |
7 | 49 let b:fortran_fixed_source = 0 |
50 elseif exists("fortran_free_source") | |
3281 | 51 " User guarantees free source form for all fortran files |
7 | 52 let b:fortran_fixed_source = 0 |
53 elseif exists("fortran_fixed_source") | |
3281 | 54 " User guarantees fixed source form for all fortran files |
7 | 55 let b:fortran_fixed_source = 1 |
7384
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
56 elseif expand("%:e") ==? "f\<90\|95\|03\|08\>" |
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
57 " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers |
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
58 let b:fortran_fixed_source = 0 |
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
59 elseif expand("%:e") ==? "f\|f77\|for" |
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
60 " Fixed-form file extension defaults |
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
61 let b:fortran_fixed_source = 1 |
7 | 62 else |
3281 | 63 " Modern fortran still allows both free and fixed source form. |
7 | 64 " Assume fixed source form unless signs of free source form |
2377
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
65 " are detected in the first five columns of the first s:lmax lines. |
7 | 66 " Detection becomes more accurate and time-consuming if more lines |
67 " are checked. Increase the limit below if you keep lots of comments at | |
68 " the very top of each file and you have a fast computer. | |
2377
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
69 let s:lmax = 500 |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
70 if ( s:lmax > line("$") ) |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
71 let s:lmax = line("$") |
7 | 72 endif |
73 let b:fortran_fixed_source = 1 | |
2377
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
74 let s:ln=1 |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
75 while s:ln <= s:lmax |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
76 let s:test = strpart(getline(s:ln),0,5) |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
77 if s:test !~ '^[Cc*]' && s:test !~ '^ *[!#]' && s:test =~ '[^ 0-9\t]' && s:test !~ '^[ 0-9]*\t' |
7384
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
78 let b:fortran_fixed_source = 0 |
aea5ebf352c4
commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents:
6530
diff
changeset
|
79 break |
7 | 80 endif |
2377
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
81 let s:ln = s:ln + 1 |
7 | 82 endwhile |
2377
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
83 unlet! s:lmax s:ln s:test |
7 | 84 endif |
85 endif | |
86 | |
87 syn case ignore | |
88 | |
3281 | 89 if b:fortran_fixed_source == 1 |
90 syn match fortranConstructName "^\s\{6,}\zs\a\w*\ze\s*:" | |
91 else | |
92 syn match fortranConstructName "^\s*\zs\a\w*\ze\s*:" | |
93 endif | |
94 if exists("fortran_more_precise") | |
95 syn match fortranConstructName "\(\<end\s*do\s\+\)\@<=\a\w*" | |
96 syn match fortranConstructName "\(\<end\s*if\s\+\)\@<=\a\w*" | |
97 syn match fortranConstructName "\(\<end\s*select\s\+\)\@<=\a\w*" | |
7 | 98 endif |
99 | |
3281 | 100 syn match fortranUnitHeader "\<end\>" |
819 | 101 syn match fortranType "\<character\>" |
102 syn match fortranType "\<complex\>" | |
103 syn match fortranType "\<integer\>" | |
7 | 104 syn keyword fortranType intrinsic |
105 syn match fortranType "\<implicit\>" | |
106 syn keyword fortranStructure dimension | |
107 syn keyword fortranStorageClass parameter save | |
108 syn match fortranUnitHeader "\<subroutine\>" | |
109 syn keyword fortranCall call | |
110 syn match fortranUnitHeader "\<function\>" | |
111 syn match fortranUnitHeader "\<program\>" | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
112 syn match fortranUnitHeader "\<block\>" |
819 | 113 syn keyword fortranKeyword return stop |
7 | 114 syn keyword fortranConditional else then |
115 syn match fortranConditional "\<if\>" | |
3256 | 116 syn match fortranConditionalOb "\<if\s*(.*)\s*\d\+\s*,\s*\d\+\s*,\s*\d\+\s*$" |
7 | 117 syn match fortranRepeat "\<do\>" |
118 | |
119 syn keyword fortranTodo contained todo fixme | |
120 | |
121 "Catch errors caused by too many right parentheses | |
819 | 122 syn region fortranParen transparent start="(" end=")" contains=ALLBUT,fortranParenError,@fortranCommentGroup,cIncluded,@spell |
7 | 123 syn match fortranParenError ")" |
124 | |
125 syn match fortranOperator "\.\s*n\=eqv\s*\." | |
126 syn match fortranOperator "\.\s*\(and\|or\|not\)\s*\." | |
127 syn match fortranOperator "\(+\|-\|/\|\*\)" | |
3281 | 128 syn match fortranTypeOb "\<character\s*\*" |
7 | 129 |
130 syn match fortranBoolean "\.\s*\(true\|false\)\s*\." | |
131 | |
819 | 132 syn keyword fortranReadWrite backspace close endfile inquire open print read rewind write |
7 | 133 |
134 "If tabs are allowed then the left margin checks do not work | |
135 if exists("fortran_have_tabs") | |
136 syn match fortranTab "\t" transparent | |
137 else | |
138 syn match fortranTab "\t" | |
139 endif | |
140 | |
819 | 141 syn keyword fortranIO access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit |
7 | 142 |
3281 | 143 syn keyword fortranIntrinsicR alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl |
7 | 144 |
145 " Intrinsics provided by some vendors | |
3256 | 146 syn keyword fortranExtraIntrinsic algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh |
7 | 147 |
3281 | 148 syn keyword fortranIntrinsic abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh |
149 syn match fortranIntrinsic "\<len\s*[(,]"me=s+3 | |
150 syn match fortranIntrinsic "\<real\s*("me=s+4 | |
7 | 151 syn match fortranType "\<implicit\s\+real" |
152 syn match fortranType "^\s*real\>" | |
3281 | 153 syn match fortranIntrinsic "\<logical\s*("me=s+7 |
7 | 154 syn match fortranType "\<implicit\s\+logical" |
155 syn match fortranType "^\s*logical\>" | |
156 | |
157 "Numbers of various sorts | |
158 " Integers | |
159 syn match fortranNumber display "\<\d\+\(_\a\w*\)\=\>" | |
160 " floating point number, without a decimal point | |
3281 | 161 syn match fortranFloatIll display "\<\d\+[deq][-+]\=\d\+\(_\a\w*\)\=\>" |
7 | 162 " floating point number, starting with a decimal point |
3281 | 163 syn match fortranFloatIll display "\.\d\+\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" |
7 | 164 " floating point number, no digits after decimal |
3281 | 165 syn match fortranFloatIll display "\<\d\+\.\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" |
7 | 166 " floating point number, D or Q exponents |
3281 | 167 syn match fortranFloatIll display "\<\d\+\.\d\+\([dq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" |
7 | 168 " floating point number |
169 syn match fortranFloat display "\<\d\+\.\d\+\(e[-+]\=\d\+\)\=\(_\a\w*\)\=\>" | |
170 " Numbers in formats | |
171 syn match fortranFormatSpec display "\d*f\d\+\.\d\+" | |
172 syn match fortranFormatSpec display "\d*e[sn]\=\d\+\.\d\+\(e\d+\>\)\=" | |
173 syn match fortranFormatSpec display "\d*\(d\|q\|g\)\d\+\.\d\+\(e\d+\)\=" | |
174 syn match fortranFormatSpec display "\d\+x\>" | |
175 " The next match cannot be used because it would pick up identifiers as well | |
176 " syn match fortranFormatSpec display "\<\(a\|i\)\d\+" | |
177 | |
178 " Numbers as labels | |
179 syn match fortranLabelNumber display "^\d\{1,5}\s"me=e-1 | |
180 syn match fortranLabelNumber display "^ \d\{1,4}\s"ms=s+1,me=e-1 | |
181 syn match fortranLabelNumber display "^ \d\{1,3}\s"ms=s+2,me=e-1 | |
182 syn match fortranLabelNumber display "^ \d\d\=\s"ms=s+3,me=e-1 | |
183 syn match fortranLabelNumber display "^ \d\s"ms=s+4,me=e-1 | |
184 | |
3281 | 185 if exists("fortran_more_precise") |
7 | 186 " Numbers as targets |
187 syn match fortranTarget display "\(\<if\s*(.\+)\s*\)\@<=\(\d\+\s*,\s*\)\{2}\d\+\>" | |
188 syn match fortranTarget display "\(\<do\s\+\)\@<=\d\+\>" | |
189 syn match fortranTarget display "\(\<go\s*to\s*(\=\)\@<=\(\d\+\s*,\s*\)*\d\+\>" | |
190 endif | |
191 | |
3281 | 192 syn keyword fortranTypeR external |
193 syn keyword fortranIOR format | |
194 syn match fortranKeywordR "\<continue\>" | |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
195 syn match fortranKeyword "^\s*\d\+\s\+continue\>" |
3256 | 196 syn match fortranKeyword "\<go\s*to\>" |
197 syn match fortranKeywordDel "\<go\s*to\ze\s\+.*,\s*(.*$" | |
198 syn match fortranKeywordOb "\<go\s*to\ze\s*(\d\+.*$" | |
3281 | 199 syn region fortranStringR start=+'+ end=+'+ contains=fortranContinueMark,fortranLeftMargin,fortranSerialNumber |
200 syn keyword fortranIntrinsicR dim lge lgt lle llt mod | |
3256 | 201 syn keyword fortranKeywordDel assign pause |
7 | 202 |
3281 | 203 syn match fortranType "\<type\>" |
204 syn keyword fortranType none | |
7 | 205 |
3281 | 206 syn keyword fortranStructure private public intent optional |
207 syn keyword fortranStructure pointer target allocatable | |
208 syn keyword fortranStorageClass in out | |
209 syn match fortranStorageClass "\<kind\s*="me=s+4 | |
210 syn match fortranStorageClass "\<len\s*="me=s+3 | |
7 | 211 |
3281 | 212 syn match fortranUnitHeader "\<module\>" |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
213 syn match fortranUnitHeader "\<submodule\>" |
3281 | 214 syn keyword fortranUnitHeader use only contains |
215 syn keyword fortranUnitHeader result operator assignment | |
216 syn match fortranUnitHeader "\<interface\>" | |
217 syn match fortranUnitHeader "\<recursive\>" | |
218 syn keyword fortranKeyword allocate deallocate nullify cycle exit | |
219 syn match fortranConditional "\<select\>" | |
220 syn keyword fortranConditional case default where elsewhere | |
7 | 221 |
3281 | 222 syn match fortranOperator "\(\(>\|<\)=\=\|==\|/=\|=\)" |
223 syn match fortranOperator "=>" | |
224 | |
225 syn region fortranString start=+"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber | |
226 syn keyword fortranIO pad position action delim readwrite | |
227 syn keyword fortranIO eor advance nml | |
7 | 228 |
3281 | 229 syn keyword fortranIntrinsic adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack precision present product radix random_number random_seed range repeat reshape rrspacing |
230 syn keyword fortranIntrinsic scale scan selected_int_kind selected_real_kind set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify | |
231 syn match fortranIntrinsic "\<not\>\(\s*\.\)\@!"me=s+3 | |
232 syn match fortranIntrinsic "\<kind\>\s*[(,]"me=s+4 | |
7 | 233 |
3281 | 234 syn match fortranUnitHeader "\<end\s*function" |
235 syn match fortranUnitHeader "\<end\s*interface" | |
236 syn match fortranUnitHeader "\<end\s*module" | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
237 syn match fortranUnitHeader "\<end\s*submodule" |
3281 | 238 syn match fortranUnitHeader "\<end\s*program" |
239 syn match fortranUnitHeader "\<end\s*subroutine" | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
240 syn match fortranUnitHeader "\<end\s*block" |
3281 | 241 syn match fortranRepeat "\<end\s*do" |
242 syn match fortranConditional "\<end\s*where" | |
243 syn match fortranConditional "\<select\s*case" | |
244 syn match fortranConditional "\<end\s*select" | |
245 syn match fortranType "\<end\s*type" | |
246 syn match fortranType "\<in\s*out" | |
7 | 247 |
3682 | 248 syn keyword fortranType procedure |
249 syn match fortranType "\<module\ze\s\+procedure\>" | |
3281 | 250 syn keyword fortranIOR namelist |
251 syn keyword fortranConditionalR while | |
252 syn keyword fortranIntrinsicR achar iachar transfer | |
7 | 253 |
3281 | 254 syn keyword fortranInclude include |
255 syn keyword fortranStorageClassR sequence | |
7 | 256 |
257 syn match fortranConditional "\<end\s*if" | |
258 syn match fortranIO contains=fortranOperator "\<e\(nd\|rr\)\s*=\s*\d\+" | |
259 syn match fortranConditional "\<else\s*if" | |
260 | |
3256 | 261 syn keyword fortranUnitHeaderOb entry |
7 | 262 syn match fortranTypeR display "double\s\+precision" |
263 syn match fortranTypeR display "double\s\+complex" | |
264 syn match fortranUnitHeaderR display "block\s\+data" | |
265 syn keyword fortranStorageClassR common equivalence data | |
3281 | 266 syn keyword fortranIntrinsicR dble dprod |
267 syn match fortranOperatorR "\.\s*[gl][et]\s*\." | |
268 syn match fortranOperatorR "\.\s*\(eq\|ne\)\s*\." | |
7 | 269 |
3281 | 270 syn keyword fortranRepeat forall |
271 syn match fortranRepeat "\<end\s*forall" | |
272 syn keyword fortranIntrinsic null cpu_time | |
273 syn match fortranType "\<elemental\>" | |
274 syn match fortranType "\<pure\>" | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
275 syn match fortranType "\<impure\>" |
3281 | 276 if exists("fortran_more_precise") |
277 syn match fortranConstructName "\(\<end\s*forall\s\+\)\@<=\a\w*\>" | |
7 | 278 endif |
279 | |
3281 | 280 if b:fortran_dialect == "f08" |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
281 " F2003 |
3281 | 282 syn keyword fortranIntrinsic command_argument_count get_command get_command_argument get_environment_variable is_iostat_end is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
283 " ISO_C_binding |
3281 | 284 syn keyword fortranConstant c_null_char c_alert c_backspace c_form_feed c_new_line c_carriage_return c_horizontal_tab c_vertical_tab |
285 syn keyword fortranConstant c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr | |
286 syn keyword fortranIntrinsic iso_c_binding c_loc c_funloc c_associated c_f_pointer c_f_procpointer | |
287 syn keyword fortranType c_ptr c_funptr | |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
288 " ISO_Fortran_env |
3281 | 289 syn keyword fortranConstant iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
290 " IEEE_arithmetic |
3281 | 291 syn keyword fortranIntrinsic ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
292 |
3281 | 293 syn keyword fortranReadWrite flush wait |
294 syn keyword fortranIO decimal round iomsg | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
295 syn keyword fortranType asynchronous nopass non_overridable pass protected volatile extends import |
3281 | 296 syn keyword fortranType non_intrinsic value bind deferred generic final enumerator |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
297 syn match fortranType "\<abstract\>" |
3281 | 298 syn match fortranType "\<class\>" |
299 syn match fortranType "\<associate\>" | |
300 syn match fortranType "\<end\s*associate" | |
301 syn match fortranType "\<enum\s*,\s*bind\s*(\s*c\s*)" | |
302 syn match fortranType "\<end\s*enum" | |
303 syn match fortranConditional "\<select\s*type" | |
304 syn match fortranConditional "\<type\s*is\>" | |
305 syn match fortranConditional "\<class\s*is\>" | |
306 syn match fortranUnitHeader "\<abstract\s*interface\>" | |
307 syn match fortranOperator "\([\|]\)" | |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
308 |
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
309 " F2008 |
3281 | 310 syn keyword fortranIntrinsic acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 |
311 syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits | |
312 syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image | |
313 syn keyword fortranIO newunit | |
314 syn keyword fortranType contiguous | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
315 syn keyword fortranRepeat concurrent |
6530 | 316 |
317 " CUDA fortran | |
318 syn match fortranTypeCUDA "\<attributes\>" | |
319 syn keyword fortranTypeCUDA host global device value | |
320 syn keyword fortranTypeCUDA shared constant pinned texture | |
321 syn keyword fortranTypeCUDA dim1 dim2 dim3 dim4 | |
322 syn keyword fortranTypeCUDA cudadeviceprop cuda_count_kind cuda_stream_kind | |
323 syn keyword fortranTypeCUDA cudaEvent cudaFuncAttributes cudaArrayPtr | |
324 syn keyword fortranTypeCUDA cudaSymbol cudaChannelFormatDesc cudaPitchedPtr | |
325 syn keyword fortranTypeCUDA cudaExtent cudaMemcpy3DParms | |
326 syn keyword fortranTypeCUDA cudaFuncCachePreferNone cudaFuncCachePreferShared | |
327 syn keyword fortranTypeCUDA cudaFuncCachePreferL1 cudaLimitStackSize | |
328 syn keyword fortranTypeCUDA cudaLimitPrintfSize cudaLimitMallocHeapSize | |
329 syn keyword fortranTypeCUDA cudaSharedMemBankSizeDefault cudaSharedMemBankSizeFourByte cudaSharedMemBankSizeEightByte | |
330 syn keyword fortranTypeCUDA cudaEventDefault cudaEventBlockingSync cudaEventDisableTiming | |
331 syn keyword fortranTypeCUDA cudaMemcpyHostToDevice cudaMemcpyDeviceToHost | |
332 syn keyword fortranTypeCUDA cudaMemcpyDeviceToDevice | |
333 syn keyword fortranTypeCUDA cudaErrorNotReady cudaSuccess cudaErrorInvalidValue | |
334 syn keyword fortranTypeCUDA c_devptr | |
335 | |
336 syn match fortranStringCUDA "blockidx%[xyz]" | |
337 syn match fortranStringCUDA "blockdim%[xyz]" | |
338 syn match fortranStringCUDA "griddim%[xyz]" | |
339 syn match fortranStringCUDA "threadidx%[xyz]" | |
340 | |
341 syn keyword fortranIntrinsicCUDA warpsize syncthreads syncthreads_and syncthreads_count syncthreads_or threadfence threadfence_block threadfence_system gpu_time allthreads anythread ballot | |
342 syn keyword fortranIntrinsicCUDA atomicadd atomicsub atomicmax atomicmin atomicand atomicor atomicxor atomicexch atomicinc atomicdec atomiccas sizeof __shfl __shfl_up __shfl_down __shfl_xor | |
343 syn keyword fortranIntrinsicCUDA cudaChooseDevice cudaDeviceGetCacheConfig cudaDeviceGetLimit cudaDeviceGetSharedMemConfig cudaDeviceReset cudaDeviceSetCacheConfig cudaDeviceSetLimit cudaDeviceSetSharedMemConfig cudaDeviceSynchronize cudaGetDevice cudaGetDeviceCount cudaGetDeviceProperties cudaSetDevice cudaSetDeviceFlags cudaSetValidDevices | |
344 syn keyword fortranIntrinsicCUDA cudaThreadExit cudaThreadSynchronize cudaGetLastError cudaGetErrorString cudaPeekAtLastError cudaStreamCreate cudaStreamDestroy cudaStreamQuery cudaStreamSynchronize cudaStreamWaitEvent cudaEventCreate cudaEventCreateWithFlags cudaEventDestroy cudaEventElapsedTime cudaEventQuery cudaEventRecord cudaEventSynchronize | |
345 syn keyword fortranIntrinsicCUDA cudaFuncGetAttributes cudaFuncSetCacheConfig cudaFuncSetSharedMemConfig cudaSetDoubleForDevice cudaSetDoubleForHost cudaFree cudaFreeArray cudaFreeHost cudaGetSymbolAddress cudaGetSymbolSize | |
346 syn keyword fortranIntrinsicCUDA cudaHostAlloc cudaHostGetDevicePointer cudaHostGetFlags cudaHostRegister cudaHostUnregister cudaMalloc cudaMallocArray cudaMallocHost cudaMallocPitch cudaMalloc3D cudaMalloc3DArray | |
347 syn keyword fortranIntrinsicCUDA cudaMemcpy cudaMemcpyArraytoArray cudaMemcpyAsync cudaMemcpyFromArray cudaMemcpyFromSymbol cudaMemcpyFromSymbolAsync cudaMemcpyPeer cudaMemcpyPeerAsync cudaMemcpyToArray cudaMemcpyToSymbol cudaMemcpyToSymbolAsync cudaMemcpy2D cudaMemcpy2DArrayToArray cudaMemcpy2DAsync cudaMemcpy2DFromArray cudaMemcpy2DToArray cudaMemcpy3D cudaMemcpy3DAsync | |
348 syn keyword fortranIntrinsicCUDA cudaMemGetInfo cudaMemset cudaMemset2D cudaMemset3D cudaDeviceCanAccessPeer cudaDeviceDisablePeerAccess cudaDeviceEnablePeerAccess cudaPointerGetAttributes cudaDriverGetVersion cudaRuntimeGetVersion | |
349 | |
350 syn region none matchgroup=fortranType start="<<<" end=">>>" contains=ALLBUT,none | |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
351 endif |
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
352 |
7 | 353 syn cluster fortranCommentGroup contains=fortranTodo |
354 | |
355 if (b:fortran_fixed_source == 1) | |
356 if !exists("fortran_have_tabs") | |
357 "Flag items beyond column 72 | |
358 syn match fortranSerialNumber excludenl "^.\{73,}$"lc=72 | |
359 "Flag left margin errors | |
360 syn match fortranLabelError "^.\{-,4}[^0-9 ]" contains=fortranTab | |
361 syn match fortranLabelError "^.\{4}\d\S" | |
362 endif | |
2034 | 363 syn match fortranComment excludenl "^[!c*].*$" contains=@fortranCommentGroup,@spell |
7 | 364 syn match fortranLeftMargin transparent "^ \{5}" |
365 syn match fortranContinueMark display "^.\{5}\S"lc=5 | |
366 else | |
367 syn match fortranContinueMark display "&" | |
368 endif | |
369 | |
3281 | 370 syn match fortranComment excludenl "!.*$" contains=@fortranCommentGroup,@spell |
10228
8a1481e59d64
commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
371 syn match fortranOpenMP excludenl "^\s*!\$\(OMP\)\=&\=\s.*$" |
7 | 372 |
373 "cpp is often used with Fortran | |
374 syn match cPreProc "^\s*#\s*\(define\|ifdef\)\>.*" | |
375 syn match cPreProc "^\s*#\s*\(elif\|if\)\>.*" | |
376 syn match cPreProc "^\s*#\s*\(ifndef\|undef\)\>.*" | |
377 syn match cPreCondit "^\s*#\s*\(else\|endif\)\>.*" | |
378 syn region cIncluded contained start=+"[^(]+ skip=+\\\\\|\\"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber | |
379 syn match cIncluded contained "<[^>]*>" | |
380 syn match cInclude "^\s*#\s*include\>\s*["<]" contains=cIncluded | |
381 | |
382 "Synchronising limits assume that comment and continuation lines are not mixed | |
819 | 383 if exists("fortran_fold") || exists("fortran_more_precise") |
384 syn sync fromstart | |
385 elseif (b:fortran_fixed_source == 0) | |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
386 syn sync linecont "&" minlines=30 |
7 | 387 else |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
388 syn sync minlines=30 |
7 | 389 endif |
390 | |
3281 | 391 if exists("fortran_fold") |
7 | 392 |
393 if (b:fortran_fixed_source == 1) | |
394 syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
395 syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(submodule\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule |
7 | 396 syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
397 syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
398 syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
399 syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock |
10385
368468ef35cf
commit https://github.com/vim/vim/commit/c0514bf4777a1d55f5785b3887c5686fd0bbe870
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
400 syn region fortranAssociate transparent fold keepend start="^\s*\<associate\s\+" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*associate" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
401 syn region fortranInterface transparent fold keepend extend start="^\s*\(abstract \)\=\s*interface\>" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
402 syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\|abstract\)\)\=\s*::" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock,fortranInterface |
7 | 403 else |
404 syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
405 syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(submodule\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule |
7 | 406 syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
407 syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
408 syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
409 syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock |
10385
368468ef35cf
commit https://github.com/vim/vim/commit/c0514bf4777a1d55f5785b3887c5686fd0bbe870
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
410 syn region fortranAssociate transparent fold keepend start="^\s*\<associate\s\+" skip="^\s*[!#].*$" excludenl end="\<end\s*associate" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
411 syn region fortranInterface transparent fold keepend extend start="^\s*\(abstract \)\=\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8303
diff
changeset
|
412 syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\|abstract\)\)\=\s*::" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock,fortranInterface |
7 | 413 endif |
414 | |
415 if exists("fortran_fold_conditionals") | |
416 if (b:fortran_fixed_source == 1) | |
417 syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData | |
418 syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData | |
419 syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(.\+)\s*then\>" skip="^\([!c*]\|\s*#\).*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData | |
10385
368468ef35cf
commit https://github.com/vim/vim/commit/c0514bf4777a1d55f5785b3887c5686fd0bbe870
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
420 syn region fortranCase transparent fold keepend extend start="\<select\s*\(case\|type\)\>" skip="^\([!c*]\|\s*#\).*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData |
7 | 421 else |
422 syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData | |
423 syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\s*[!#].*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData | |
8303
88207f4b861a
commit https://github.com/vim/vim/commit/dae8d21dd291df6a6679a00be64e18bca0156576
Christian Brabandt <cb@256bit.org>
parents:
7384
diff
changeset
|
424 syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(\(.\|&\s*\n\)\+)\(\s\|&\s*\n\)*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData |
10385
368468ef35cf
commit https://github.com/vim/vim/commit/c0514bf4777a1d55f5785b3887c5686fd0bbe870
Christian Brabandt <cb@256bit.org>
parents:
10228
diff
changeset
|
425 syn region fortranCase transparent fold keepend extend start="\<select\s*\(case\|type\)\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData |
7 | 426 endif |
427 endif | |
428 | |
429 if exists("fortran_fold_multilinecomments") | |
430 if (b:fortran_fixed_source == 1) | |
431 syn match fortranMultiLineComments transparent fold "\(^[!c*].*\(\n\|\%$\)\)\{4,}" contains=ALLBUT,fortranMultiCommentLines | |
432 else | |
433 syn match fortranMultiLineComments transparent fold "\(^\s*!.*\(\n\|\%$\)\)\{4,}" contains=ALLBUT,fortranMultiCommentLines | |
434 endif | |
435 endif | |
436 endif | |
437 | |
438 " Define the default highlighting. | |
3281 | 439 " The default highlighting differs for each dialect. |
440 " Transparent groups: | |
441 " fortranParen, fortranLeftMargin | |
442 " fortranProgram, fortranModule, fortranSubroutine, fortranFunction, | |
443 " fortranBlockData | |
444 " fortran77Loop, fortran90Loop, fortranIfBlock, fortranCase | |
445 " fortranMultiCommentLines | |
446 hi def link fortranKeyword Keyword | |
447 hi def link fortranConstructName Identifier | |
448 hi def link fortranConditional Conditional | |
449 hi def link fortranRepeat Repeat | |
450 hi def link fortranTodo Todo | |
451 hi def link fortranContinueMark Special | |
452 hi def link fortranString String | |
453 hi def link fortranNumber Number | |
454 hi def link fortranOperator Operator | |
455 hi def link fortranBoolean Boolean | |
456 hi def link fortranLabelError Error | |
457 hi def link fortranObsolete Todo | |
458 hi def link fortranType Type | |
459 hi def link fortranStructure Type | |
460 hi def link fortranStorageClass StorageClass | |
461 hi def link fortranCall Function | |
462 hi def link fortranUnitHeader fortranPreCondit | |
463 hi def link fortranReadWrite Keyword | |
464 hi def link fortranIO Keyword | |
465 hi def link fortranIntrinsic Function | |
466 hi def link fortranConstant Constant | |
7 | 467 |
3281 | 468 " To stop deleted & obsolescent features being highlighted as Todo items, |
469 " comment out the next 5 lines and uncomment the 5 lines after that | |
470 hi def link fortranUnitHeaderOb fortranObsolete | |
471 hi def link fortranKeywordOb fortranObsolete | |
472 hi def link fortranConditionalOb fortranObsolete | |
473 hi def link fortranTypeOb fortranObsolete | |
474 hi def link fortranKeywordDel fortranObsolete | |
475 "hi def link fortranUnitHeaderOb fortranUnitHeader | |
476 "hi def link fortranKeywordOb fortranKeyword | |
477 "hi def link fortranConditionalOb fortranConditional | |
478 "hi def link fortranTypeOb fortranType | |
479 "hi def link fortranKeywordDel fortranKeyword | |
3256 | 480 |
3281 | 481 if b:fortran_dialect == "F" |
482 hi! def link fortranIntrinsicR fortranObsolete | |
483 hi! def link fortranUnitHeaderR fortranObsolete | |
484 hi! def link fortranTypeR fortranObsolete | |
485 hi! def link fortranStorageClassR fortranObsolete | |
486 hi! def link fortranOperatorR fortranObsolete | |
487 hi! def link fortranInclude fortranObsolete | |
488 hi! def link fortranLabelNumber fortranObsolete | |
489 hi! def link fortranTarget fortranObsolete | |
490 hi! def link fortranFloatIll fortranObsolete | |
491 hi! def link fortranIOR fortranObsolete | |
492 hi! def link fortranKeywordR fortranObsolete | |
493 hi! def link fortranStringR fortranObsolete | |
494 hi! def link fortranConditionalR fortranObsolete | |
495 else | |
496 hi! def link fortranIntrinsicR fortranIntrinsic | |
497 hi! def link fortranUnitHeaderR fortranPreCondit | |
498 hi! def link fortranTypeR fortranType | |
499 hi! def link fortranStorageClassR fortranStorageClass | |
500 hi! def link fortranOperatorR fortranOperator | |
501 hi! def link fortranInclude Include | |
502 hi! def link fortranLabelNumber Special | |
503 hi! def link fortranTarget Special | |
504 hi! def link fortranFloatIll fortranFloat | |
505 hi! def link fortranIOR fortranIO | |
506 hi! def link fortranKeywordR fortranKeyword | |
507 hi! def link fortranStringR fortranString | |
508 hi! def link fortranConditionalR fortranConditional | |
509 endif | |
7 | 510 |
6530 | 511 " CUDA |
512 hi def link fortranIntrinsicCUDA fortranIntrinsic | |
513 hi def link fortranTypeCUDA fortranType | |
514 hi def link fortranStringCUDA fortranString | |
515 | |
3281 | 516 hi def link fortranFormatSpec Identifier |
517 hi def link fortranFloat Float | |
518 hi def link fortranPreCondit PreCondit | |
519 hi def link cIncluded fortranString | |
520 hi def link cInclude Include | |
521 hi def link cPreProc PreProc | |
522 hi def link cPreCondit PreCondit | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
9975
diff
changeset
|
523 hi def link fortranOpenMP PreProc |
3281 | 524 hi def link fortranParenError Error |
525 hi def link fortranComment Comment | |
526 hi def link fortranSerialNumber Todo | |
527 hi def link fortranTab Error | |
7 | 528 |
3281 | 529 " Uncomment the next line if you use extra intrinsics provided by vendors |
530 "hi def link fortranExtraIntrinsic Function | |
7 | 531 |
532 let b:current_syntax = "fortran" | |
533 | |
3237 | 534 let &cpo = s:cpo_save |
535 unlet s:cpo_save | |
7 | 536 " vim: ts=8 tw=132 |