Mercurial > vim
annotate runtime/syntax/fortran.vim @ 7147:c590de398af9
commit https://github.com/vim/vim/commit/ca63501fbcd1cf9c8aa9ff12c093c95b62a89ed7
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 25 20:34:21 2015 +0200
Update various runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 25 Sep 2015 20:45:09 +0200 |
parents | 435956324539 |
children | aea5ebf352c4 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
3281 | 2 " Language: Fortran 2008 (and earlier versions: 2003, 95, 90, and 77) |
6530 | 3 " Version: 0.95 |
4 " Last Change: 2015 Jan. 15 | |
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: |
8 " Version 0.1 was based on the fortran 77 syntax file by Mario Eusebio and | |
9 " Preben Guldberg. Useful suggestions were made by: Andrej Panjkov, | |
10 " Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile, | |
11 " Walter Dieudonné, Alexander Wagner, Roman Bertle, Charles Rendleman, | |
6530 | 12 " Andrew Griffiths, Joe Krahn, Hendrik Merx, and Matt Thompson. |
7 | 13 |
3281 | 14 if exists("b:current_syntax") |
7 | 15 finish |
16 endif | |
17 | |
3237 | 18 let s:cpo_save = &cpo |
19 set cpo&vim | |
20 | |
3281 | 21 " Choose fortran_dialect using the priority: |
22 " source file directive > buffer-local value > global value > default | |
23 " try using directive in first three lines of file | |
24 let b:fortran_retype = getline(1)." ".getline(2)." ".getline(3) | |
25 if b:fortran_retype =~? '\<fortran_dialect\s*=\s*F\>' | |
26 let b:fortran_dialect = "F" | |
27 elseif b:fortran_retype =~? '\<fortran_dialect\s*=\s*f08\>' | |
28 let b:fortran_dialect = "f08" | |
29 elseif !exists("b:fortran_dialect") | |
30 if exists("g:fortran_dialect") && g:fortran_dialect =~# '\<F\|f08\>' | |
31 " try global variable | |
32 let b:fortran_dialect = g:fortran_dialect | |
33 else " nothing found, so use default | |
34 let b:fortran_dialect = "f08" | |
7 | 35 endif |
36 endif | |
3281 | 37 unlet! b:fortran_retype |
38 " make sure buffer-local value is not invalid | |
39 if b:fortran_dialect !~# '\<F\|f08\>' | |
40 let b:fortran_dialect = "f08" | |
7 | 41 endif |
42 | |
43 " Choose between fixed and free source form if this hasn't been done yet | |
44 if !exists("b:fortran_fixed_source") | |
3281 | 45 if b:fortran_dialect == "F" |
46 " F requires free source form | |
7 | 47 let b:fortran_fixed_source = 0 |
48 elseif exists("fortran_free_source") | |
3281 | 49 " User guarantees free source form for all fortran files |
7 | 50 let b:fortran_fixed_source = 0 |
51 elseif exists("fortran_fixed_source") | |
3281 | 52 " User guarantees fixed source form for all fortran files |
7 | 53 let b:fortran_fixed_source = 1 |
54 else | |
3281 | 55 " Modern fortran still allows both free and fixed source form. |
7 | 56 " 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
|
57 " are detected in the first five columns of the first s:lmax lines. |
7 | 58 " Detection becomes more accurate and time-consuming if more lines |
59 " are checked. Increase the limit below if you keep lots of comments at | |
60 " 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
|
61 let s:lmax = 500 |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
62 if ( s:lmax > line("$") ) |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
63 let s:lmax = line("$") |
7 | 64 endif |
65 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
|
66 let s:ln=1 |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
67 while s:ln <= s:lmax |
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
68 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
|
69 if s:test !~ '^[Cc*]' && s:test !~ '^ *[!#]' && s:test =~ '[^ 0-9\t]' && s:test !~ '^[ 0-9]*\t' |
7 | 70 let b:fortran_fixed_source = 0 |
71 break | |
72 endif | |
2377
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
73 let s:ln = s:ln + 1 |
7 | 74 endwhile |
2377
878562053ba3
Update Fortran indent and syntax file. (Ajit Thakkar)
Bram Moolenaar <bram@vim.org>
parents:
2370
diff
changeset
|
75 unlet! s:lmax s:ln s:test |
7 | 76 endif |
77 endif | |
78 | |
79 syn case ignore | |
80 | |
3281 | 81 if b:fortran_fixed_source == 1 |
82 syn match fortranConstructName "^\s\{6,}\zs\a\w*\ze\s*:" | |
83 else | |
84 syn match fortranConstructName "^\s*\zs\a\w*\ze\s*:" | |
85 endif | |
86 if exists("fortran_more_precise") | |
87 syn match fortranConstructName "\(\<end\s*do\s\+\)\@<=\a\w*" | |
88 syn match fortranConstructName "\(\<end\s*if\s\+\)\@<=\a\w*" | |
89 syn match fortranConstructName "\(\<end\s*select\s\+\)\@<=\a\w*" | |
7 | 90 endif |
91 | |
3281 | 92 syn match fortranUnitHeader "\<end\>" |
819 | 93 syn match fortranType "\<character\>" |
94 syn match fortranType "\<complex\>" | |
95 syn match fortranType "\<integer\>" | |
7 | 96 syn keyword fortranType intrinsic |
97 syn match fortranType "\<implicit\>" | |
98 syn keyword fortranStructure dimension | |
99 syn keyword fortranStorageClass parameter save | |
100 syn match fortranUnitHeader "\<subroutine\>" | |
101 syn keyword fortranCall call | |
102 syn match fortranUnitHeader "\<function\>" | |
103 syn match fortranUnitHeader "\<program\>" | |
819 | 104 syn keyword fortranKeyword return stop |
7 | 105 syn keyword fortranConditional else then |
106 syn match fortranConditional "\<if\>" | |
3256 | 107 syn match fortranConditionalOb "\<if\s*(.*)\s*\d\+\s*,\s*\d\+\s*,\s*\d\+\s*$" |
7 | 108 syn match fortranRepeat "\<do\>" |
109 | |
110 syn keyword fortranTodo contained todo fixme | |
111 | |
112 "Catch errors caused by too many right parentheses | |
819 | 113 syn region fortranParen transparent start="(" end=")" contains=ALLBUT,fortranParenError,@fortranCommentGroup,cIncluded,@spell |
7 | 114 syn match fortranParenError ")" |
115 | |
116 syn match fortranOperator "\.\s*n\=eqv\s*\." | |
117 syn match fortranOperator "\.\s*\(and\|or\|not\)\s*\." | |
118 syn match fortranOperator "\(+\|-\|/\|\*\)" | |
3281 | 119 syn match fortranTypeOb "\<character\s*\*" |
7 | 120 |
121 syn match fortranBoolean "\.\s*\(true\|false\)\s*\." | |
122 | |
819 | 123 syn keyword fortranReadWrite backspace close endfile inquire open print read rewind write |
7 | 124 |
125 "If tabs are allowed then the left margin checks do not work | |
126 if exists("fortran_have_tabs") | |
127 syn match fortranTab "\t" transparent | |
128 else | |
129 syn match fortranTab "\t" | |
130 endif | |
131 | |
819 | 132 syn keyword fortranIO access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit |
7 | 133 |
3281 | 134 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 | 135 |
136 " Intrinsics provided by some vendors | |
3256 | 137 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 | 138 |
3281 | 139 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 |
140 syn match fortranIntrinsic "\<len\s*[(,]"me=s+3 | |
141 syn match fortranIntrinsic "\<real\s*("me=s+4 | |
7 | 142 syn match fortranType "\<implicit\s\+real" |
143 syn match fortranType "^\s*real\>" | |
3281 | 144 syn match fortranIntrinsic "\<logical\s*("me=s+7 |
7 | 145 syn match fortranType "\<implicit\s\+logical" |
146 syn match fortranType "^\s*logical\>" | |
147 | |
148 "Numbers of various sorts | |
149 " Integers | |
150 syn match fortranNumber display "\<\d\+\(_\a\w*\)\=\>" | |
151 " floating point number, without a decimal point | |
3281 | 152 syn match fortranFloatIll display "\<\d\+[deq][-+]\=\d\+\(_\a\w*\)\=\>" |
7 | 153 " floating point number, starting with a decimal point |
3281 | 154 syn match fortranFloatIll display "\.\d\+\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" |
7 | 155 " floating point number, no digits after decimal |
3281 | 156 syn match fortranFloatIll display "\<\d\+\.\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" |
7 | 157 " floating point number, D or Q exponents |
3281 | 158 syn match fortranFloatIll display "\<\d\+\.\d\+\([dq][-+]\=\d\+\)\=\(_\a\w*\)\=\>" |
7 | 159 " floating point number |
160 syn match fortranFloat display "\<\d\+\.\d\+\(e[-+]\=\d\+\)\=\(_\a\w*\)\=\>" | |
161 " Numbers in formats | |
162 syn match fortranFormatSpec display "\d*f\d\+\.\d\+" | |
163 syn match fortranFormatSpec display "\d*e[sn]\=\d\+\.\d\+\(e\d+\>\)\=" | |
164 syn match fortranFormatSpec display "\d*\(d\|q\|g\)\d\+\.\d\+\(e\d+\)\=" | |
165 syn match fortranFormatSpec display "\d\+x\>" | |
166 " The next match cannot be used because it would pick up identifiers as well | |
167 " syn match fortranFormatSpec display "\<\(a\|i\)\d\+" | |
168 | |
169 " Numbers as labels | |
170 syn match fortranLabelNumber display "^\d\{1,5}\s"me=e-1 | |
171 syn match fortranLabelNumber display "^ \d\{1,4}\s"ms=s+1,me=e-1 | |
172 syn match fortranLabelNumber display "^ \d\{1,3}\s"ms=s+2,me=e-1 | |
173 syn match fortranLabelNumber display "^ \d\d\=\s"ms=s+3,me=e-1 | |
174 syn match fortranLabelNumber display "^ \d\s"ms=s+4,me=e-1 | |
175 | |
3281 | 176 if exists("fortran_more_precise") |
7 | 177 " Numbers as targets |
178 syn match fortranTarget display "\(\<if\s*(.\+)\s*\)\@<=\(\d\+\s*,\s*\)\{2}\d\+\>" | |
179 syn match fortranTarget display "\(\<do\s\+\)\@<=\d\+\>" | |
180 syn match fortranTarget display "\(\<go\s*to\s*(\=\)\@<=\(\d\+\s*,\s*\)*\d\+\>" | |
181 endif | |
182 | |
3281 | 183 syn keyword fortranTypeR external |
184 syn keyword fortranIOR format | |
185 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
|
186 syn match fortranKeyword "^\s*\d\+\s\+continue\>" |
3256 | 187 syn match fortranKeyword "\<go\s*to\>" |
188 syn match fortranKeywordDel "\<go\s*to\ze\s\+.*,\s*(.*$" | |
189 syn match fortranKeywordOb "\<go\s*to\ze\s*(\d\+.*$" | |
3281 | 190 syn region fortranStringR start=+'+ end=+'+ contains=fortranContinueMark,fortranLeftMargin,fortranSerialNumber |
191 syn keyword fortranIntrinsicR dim lge lgt lle llt mod | |
3256 | 192 syn keyword fortranKeywordDel assign pause |
7 | 193 |
3281 | 194 syn match fortranType "\<type\>" |
195 syn keyword fortranType none | |
7 | 196 |
3281 | 197 syn keyword fortranStructure private public intent optional |
198 syn keyword fortranStructure pointer target allocatable | |
199 syn keyword fortranStorageClass in out | |
200 syn match fortranStorageClass "\<kind\s*="me=s+4 | |
201 syn match fortranStorageClass "\<len\s*="me=s+3 | |
7 | 202 |
3281 | 203 syn match fortranUnitHeader "\<module\>" |
204 syn keyword fortranUnitHeader use only contains | |
205 syn keyword fortranUnitHeader result operator assignment | |
206 syn match fortranUnitHeader "\<interface\>" | |
207 syn match fortranUnitHeader "\<recursive\>" | |
208 syn keyword fortranKeyword allocate deallocate nullify cycle exit | |
209 syn match fortranConditional "\<select\>" | |
210 syn keyword fortranConditional case default where elsewhere | |
7 | 211 |
3281 | 212 syn match fortranOperator "\(\(>\|<\)=\=\|==\|/=\|=\)" |
213 syn match fortranOperator "=>" | |
214 | |
215 syn region fortranString start=+"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber | |
216 syn keyword fortranIO pad position action delim readwrite | |
217 syn keyword fortranIO eor advance nml | |
7 | 218 |
3281 | 219 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 |
220 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 | |
221 syn match fortranIntrinsic "\<not\>\(\s*\.\)\@!"me=s+3 | |
222 syn match fortranIntrinsic "\<kind\>\s*[(,]"me=s+4 | |
7 | 223 |
3281 | 224 syn match fortranUnitHeader "\<end\s*function" |
225 syn match fortranUnitHeader "\<end\s*interface" | |
226 syn match fortranUnitHeader "\<end\s*module" | |
227 syn match fortranUnitHeader "\<end\s*program" | |
228 syn match fortranUnitHeader "\<end\s*subroutine" | |
229 syn match fortranRepeat "\<end\s*do" | |
230 syn match fortranConditional "\<end\s*where" | |
231 syn match fortranConditional "\<select\s*case" | |
232 syn match fortranConditional "\<end\s*select" | |
233 syn match fortranType "\<end\s*type" | |
234 syn match fortranType "\<in\s*out" | |
7 | 235 |
3682 | 236 syn keyword fortranType procedure |
237 syn match fortranType "\<module\ze\s\+procedure\>" | |
3281 | 238 syn keyword fortranIOR namelist |
239 syn keyword fortranConditionalR while | |
240 syn keyword fortranIntrinsicR achar iachar transfer | |
7 | 241 |
3281 | 242 syn keyword fortranInclude include |
243 syn keyword fortranStorageClassR sequence | |
7 | 244 |
245 syn match fortranConditional "\<end\s*if" | |
246 syn match fortranIO contains=fortranOperator "\<e\(nd\|rr\)\s*=\s*\d\+" | |
247 syn match fortranConditional "\<else\s*if" | |
248 | |
3256 | 249 syn keyword fortranUnitHeaderOb entry |
7 | 250 syn match fortranTypeR display "double\s\+precision" |
251 syn match fortranTypeR display "double\s\+complex" | |
252 syn match fortranUnitHeaderR display "block\s\+data" | |
253 syn keyword fortranStorageClassR common equivalence data | |
3281 | 254 syn keyword fortranIntrinsicR dble dprod |
255 syn match fortranOperatorR "\.\s*[gl][et]\s*\." | |
256 syn match fortranOperatorR "\.\s*\(eq\|ne\)\s*\." | |
7 | 257 |
3281 | 258 syn keyword fortranRepeat forall |
259 syn match fortranRepeat "\<end\s*forall" | |
260 syn keyword fortranIntrinsic null cpu_time | |
261 syn match fortranType "\<elemental\>" | |
262 syn match fortranType "\<pure\>" | |
263 if exists("fortran_more_precise") | |
264 syn match fortranConstructName "\(\<end\s*forall\s\+\)\@<=\a\w*\>" | |
7 | 265 endif |
266 | |
3281 | 267 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
|
268 " F2003 |
3281 | 269 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
|
270 " ISO_C_binding |
3281 | 271 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 |
272 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 | |
273 syn keyword fortranIntrinsic iso_c_binding c_loc c_funloc c_associated c_f_pointer c_f_procpointer | |
274 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
|
275 " ISO_Fortran_env |
3281 | 276 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
|
277 " IEEE_arithmetic |
3281 | 278 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
|
279 |
3281 | 280 syn keyword fortranReadWrite flush wait |
281 syn keyword fortranIO decimal round iomsg | |
282 syn keyword fortranType asynchronous nopass non_overridable pass protected volatile abstract extends import | |
283 syn keyword fortranType non_intrinsic value bind deferred generic final enumerator | |
284 syn match fortranType "\<class\>" | |
285 syn match fortranType "\<associate\>" | |
286 syn match fortranType "\<end\s*associate" | |
287 syn match fortranType "\<enum\s*,\s*bind\s*(\s*c\s*)" | |
288 syn match fortranType "\<end\s*enum" | |
289 syn match fortranConditional "\<select\s*type" | |
290 syn match fortranConditional "\<type\s*is\>" | |
291 syn match fortranConditional "\<class\s*is\>" | |
292 syn match fortranUnitHeader "\<abstract\s*interface\>" | |
293 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
|
294 |
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
295 " F2008 |
3281 | 296 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 |
297 syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits | |
298 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 | |
299 syn keyword fortranIO newunit | |
300 syn keyword fortranType contiguous | |
6530 | 301 |
302 " CUDA fortran | |
303 syn match fortranTypeCUDA "\<attributes\>" | |
304 syn keyword fortranTypeCUDA host global device value | |
305 syn keyword fortranTypeCUDA shared constant pinned texture | |
306 syn keyword fortranTypeCUDA dim1 dim2 dim3 dim4 | |
307 syn keyword fortranTypeCUDA cudadeviceprop cuda_count_kind cuda_stream_kind | |
308 syn keyword fortranTypeCUDA cudaEvent cudaFuncAttributes cudaArrayPtr | |
309 syn keyword fortranTypeCUDA cudaSymbol cudaChannelFormatDesc cudaPitchedPtr | |
310 syn keyword fortranTypeCUDA cudaExtent cudaMemcpy3DParms | |
311 syn keyword fortranTypeCUDA cudaFuncCachePreferNone cudaFuncCachePreferShared | |
312 syn keyword fortranTypeCUDA cudaFuncCachePreferL1 cudaLimitStackSize | |
313 syn keyword fortranTypeCUDA cudaLimitPrintfSize cudaLimitMallocHeapSize | |
314 syn keyword fortranTypeCUDA cudaSharedMemBankSizeDefault cudaSharedMemBankSizeFourByte cudaSharedMemBankSizeEightByte | |
315 syn keyword fortranTypeCUDA cudaEventDefault cudaEventBlockingSync cudaEventDisableTiming | |
316 syn keyword fortranTypeCUDA cudaMemcpyHostToDevice cudaMemcpyDeviceToHost | |
317 syn keyword fortranTypeCUDA cudaMemcpyDeviceToDevice | |
318 syn keyword fortranTypeCUDA cudaErrorNotReady cudaSuccess cudaErrorInvalidValue | |
319 syn keyword fortranTypeCUDA c_devptr | |
320 | |
321 syn match fortranStringCUDA "blockidx%[xyz]" | |
322 syn match fortranStringCUDA "blockdim%[xyz]" | |
323 syn match fortranStringCUDA "griddim%[xyz]" | |
324 syn match fortranStringCUDA "threadidx%[xyz]" | |
325 | |
326 syn keyword fortranIntrinsicCUDA warpsize syncthreads syncthreads_and syncthreads_count syncthreads_or threadfence threadfence_block threadfence_system gpu_time allthreads anythread ballot | |
327 syn keyword fortranIntrinsicCUDA atomicadd atomicsub atomicmax atomicmin atomicand atomicor atomicxor atomicexch atomicinc atomicdec atomiccas sizeof __shfl __shfl_up __shfl_down __shfl_xor | |
328 syn keyword fortranIntrinsicCUDA cudaChooseDevice cudaDeviceGetCacheConfig cudaDeviceGetLimit cudaDeviceGetSharedMemConfig cudaDeviceReset cudaDeviceSetCacheConfig cudaDeviceSetLimit cudaDeviceSetSharedMemConfig cudaDeviceSynchronize cudaGetDevice cudaGetDeviceCount cudaGetDeviceProperties cudaSetDevice cudaSetDeviceFlags cudaSetValidDevices | |
329 syn keyword fortranIntrinsicCUDA cudaThreadExit cudaThreadSynchronize cudaGetLastError cudaGetErrorString cudaPeekAtLastError cudaStreamCreate cudaStreamDestroy cudaStreamQuery cudaStreamSynchronize cudaStreamWaitEvent cudaEventCreate cudaEventCreateWithFlags cudaEventDestroy cudaEventElapsedTime cudaEventQuery cudaEventRecord cudaEventSynchronize | |
330 syn keyword fortranIntrinsicCUDA cudaFuncGetAttributes cudaFuncSetCacheConfig cudaFuncSetSharedMemConfig cudaSetDoubleForDevice cudaSetDoubleForHost cudaFree cudaFreeArray cudaFreeHost cudaGetSymbolAddress cudaGetSymbolSize | |
331 syn keyword fortranIntrinsicCUDA cudaHostAlloc cudaHostGetDevicePointer cudaHostGetFlags cudaHostRegister cudaHostUnregister cudaMalloc cudaMallocArray cudaMallocHost cudaMallocPitch cudaMalloc3D cudaMalloc3DArray | |
332 syn keyword fortranIntrinsicCUDA cudaMemcpy cudaMemcpyArraytoArray cudaMemcpyAsync cudaMemcpyFromArray cudaMemcpyFromSymbol cudaMemcpyFromSymbolAsync cudaMemcpyPeer cudaMemcpyPeerAsync cudaMemcpyToArray cudaMemcpyToSymbol cudaMemcpyToSymbolAsync cudaMemcpy2D cudaMemcpy2DArrayToArray cudaMemcpy2DAsync cudaMemcpy2DFromArray cudaMemcpy2DToArray cudaMemcpy3D cudaMemcpy3DAsync | |
333 syn keyword fortranIntrinsicCUDA cudaMemGetInfo cudaMemset cudaMemset2D cudaMemset3D cudaDeviceCanAccessPeer cudaDeviceDisablePeerAccess cudaDeviceEnablePeerAccess cudaPointerGetAttributes cudaDriverGetVersion cudaRuntimeGetVersion | |
334 | |
335 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
|
336 endif |
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
337 |
7 | 338 syn cluster fortranCommentGroup contains=fortranTodo |
339 | |
340 if (b:fortran_fixed_source == 1) | |
341 if !exists("fortran_have_tabs") | |
342 "Flag items beyond column 72 | |
343 syn match fortranSerialNumber excludenl "^.\{73,}$"lc=72 | |
344 "Flag left margin errors | |
345 syn match fortranLabelError "^.\{-,4}[^0-9 ]" contains=fortranTab | |
346 syn match fortranLabelError "^.\{4}\d\S" | |
347 endif | |
2034 | 348 syn match fortranComment excludenl "^[!c*].*$" contains=@fortranCommentGroup,@spell |
7 | 349 syn match fortranLeftMargin transparent "^ \{5}" |
350 syn match fortranContinueMark display "^.\{5}\S"lc=5 | |
351 else | |
352 syn match fortranContinueMark display "&" | |
353 endif | |
354 | |
3281 | 355 syn match fortranComment excludenl "!.*$" contains=@fortranCommentGroup,@spell |
7 | 356 |
357 "cpp is often used with Fortran | |
358 syn match cPreProc "^\s*#\s*\(define\|ifdef\)\>.*" | |
359 syn match cPreProc "^\s*#\s*\(elif\|if\)\>.*" | |
360 syn match cPreProc "^\s*#\s*\(ifndef\|undef\)\>.*" | |
361 syn match cPreCondit "^\s*#\s*\(else\|endif\)\>.*" | |
362 syn region cIncluded contained start=+"[^(]+ skip=+\\\\\|\\"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber | |
363 syn match cIncluded contained "<[^>]*>" | |
364 syn match cInclude "^\s*#\s*include\>\s*["<]" contains=cIncluded | |
365 | |
366 "Synchronising limits assume that comment and continuation lines are not mixed | |
819 | 367 if exists("fortran_fold") || exists("fortran_more_precise") |
368 syn sync fromstart | |
369 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
|
370 syn sync linecont "&" minlines=30 |
7 | 371 else |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
372 syn sync minlines=30 |
7 | 373 endif |
374 | |
3281 | 375 if exists("fortran_fold") |
7 | 376 |
377 if (b:fortran_fixed_source == 1) | |
378 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 | |
379 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 | |
819 | 380 syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|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 |
7 | 381 syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|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
|
382 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 |
7 | 383 syn region fortranInterface transparent fold keepend extend start="^\s*interface\>" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
384 syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\)\)\=\s*::" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock |
7 | 385 else |
386 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 | |
387 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 | |
819 | 388 syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|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 |
7 | 389 syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|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
|
390 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 |
7 | 391 syn region fortranInterface transparent fold keepend extend start="^\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock |
2370
454f314d0e61
Make it possible to load Perl dynamically on Unix. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
392 syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\)\)\=\s*::" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock |
7 | 393 endif |
394 | |
395 if exists("fortran_fold_conditionals") | |
396 if (b:fortran_fixed_source == 1) | |
397 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 | |
398 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 | |
399 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 | |
400 syn region fortranCase transparent fold keepend extend start="\<select\s*case\>" skip="^\([!c*]\|\s*#\).*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData | |
401 else | |
402 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 | |
403 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 | |
404 syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(.\+)\s*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData | |
405 syn region fortranCase transparent fold keepend extend start="\<select\s*case\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData | |
406 endif | |
407 endif | |
408 | |
409 if exists("fortran_fold_multilinecomments") | |
410 if (b:fortran_fixed_source == 1) | |
411 syn match fortranMultiLineComments transparent fold "\(^[!c*].*\(\n\|\%$\)\)\{4,}" contains=ALLBUT,fortranMultiCommentLines | |
412 else | |
413 syn match fortranMultiLineComments transparent fold "\(^\s*!.*\(\n\|\%$\)\)\{4,}" contains=ALLBUT,fortranMultiCommentLines | |
414 endif | |
415 endif | |
416 endif | |
417 | |
418 " Define the default highlighting. | |
3281 | 419 " The default highlighting differs for each dialect. |
420 " Transparent groups: | |
421 " fortranParen, fortranLeftMargin | |
422 " fortranProgram, fortranModule, fortranSubroutine, fortranFunction, | |
423 " fortranBlockData | |
424 " fortran77Loop, fortran90Loop, fortranIfBlock, fortranCase | |
425 " fortranMultiCommentLines | |
426 hi def link fortranKeyword Keyword | |
427 hi def link fortranConstructName Identifier | |
428 hi def link fortranConditional Conditional | |
429 hi def link fortranRepeat Repeat | |
430 hi def link fortranTodo Todo | |
431 hi def link fortranContinueMark Special | |
432 hi def link fortranString String | |
433 hi def link fortranNumber Number | |
434 hi def link fortranOperator Operator | |
435 hi def link fortranBoolean Boolean | |
436 hi def link fortranLabelError Error | |
437 hi def link fortranObsolete Todo | |
438 hi def link fortranType Type | |
439 hi def link fortranStructure Type | |
440 hi def link fortranStorageClass StorageClass | |
441 hi def link fortranCall Function | |
442 hi def link fortranUnitHeader fortranPreCondit | |
443 hi def link fortranReadWrite Keyword | |
444 hi def link fortranIO Keyword | |
445 hi def link fortranIntrinsic Function | |
446 hi def link fortranConstant Constant | |
7 | 447 |
3281 | 448 " To stop deleted & obsolescent features being highlighted as Todo items, |
449 " comment out the next 5 lines and uncomment the 5 lines after that | |
450 hi def link fortranUnitHeaderOb fortranObsolete | |
451 hi def link fortranKeywordOb fortranObsolete | |
452 hi def link fortranConditionalOb fortranObsolete | |
453 hi def link fortranTypeOb fortranObsolete | |
454 hi def link fortranKeywordDel fortranObsolete | |
455 "hi def link fortranUnitHeaderOb fortranUnitHeader | |
456 "hi def link fortranKeywordOb fortranKeyword | |
457 "hi def link fortranConditionalOb fortranConditional | |
458 "hi def link fortranTypeOb fortranType | |
459 "hi def link fortranKeywordDel fortranKeyword | |
3256 | 460 |
3281 | 461 if b:fortran_dialect == "F" |
462 hi! def link fortranIntrinsicR fortranObsolete | |
463 hi! def link fortranUnitHeaderR fortranObsolete | |
464 hi! def link fortranTypeR fortranObsolete | |
465 hi! def link fortranStorageClassR fortranObsolete | |
466 hi! def link fortranOperatorR fortranObsolete | |
467 hi! def link fortranInclude fortranObsolete | |
468 hi! def link fortranLabelNumber fortranObsolete | |
469 hi! def link fortranTarget fortranObsolete | |
470 hi! def link fortranFloatIll fortranObsolete | |
471 hi! def link fortranIOR fortranObsolete | |
472 hi! def link fortranKeywordR fortranObsolete | |
473 hi! def link fortranStringR fortranObsolete | |
474 hi! def link fortranConditionalR fortranObsolete | |
475 else | |
476 hi! def link fortranIntrinsicR fortranIntrinsic | |
477 hi! def link fortranUnitHeaderR fortranPreCondit | |
478 hi! def link fortranTypeR fortranType | |
479 hi! def link fortranStorageClassR fortranStorageClass | |
480 hi! def link fortranOperatorR fortranOperator | |
481 hi! def link fortranInclude Include | |
482 hi! def link fortranLabelNumber Special | |
483 hi! def link fortranTarget Special | |
484 hi! def link fortranFloatIll fortranFloat | |
485 hi! def link fortranIOR fortranIO | |
486 hi! def link fortranKeywordR fortranKeyword | |
487 hi! def link fortranStringR fortranString | |
488 hi! def link fortranConditionalR fortranConditional | |
489 endif | |
7 | 490 |
6530 | 491 " CUDA |
492 hi def link fortranIntrinsicCUDA fortranIntrinsic | |
493 hi def link fortranTypeCUDA fortranType | |
494 hi def link fortranStringCUDA fortranString | |
495 | |
3281 | 496 hi def link fortranFormatSpec Identifier |
497 hi def link fortranFloat Float | |
498 hi def link fortranPreCondit PreCondit | |
499 hi def link cIncluded fortranString | |
500 hi def link cInclude Include | |
501 hi def link cPreProc PreProc | |
502 hi def link cPreCondit PreCondit | |
503 hi def link fortranParenError Error | |
504 hi def link fortranComment Comment | |
505 hi def link fortranSerialNumber Todo | |
506 hi def link fortranTab Error | |
7 | 507 |
3281 | 508 " Uncomment the next line if you use extra intrinsics provided by vendors |
509 "hi def link fortranExtraIntrinsic Function | |
7 | 510 |
511 let b:current_syntax = "fortran" | |
512 | |
3237 | 513 let &cpo = s:cpo_save |
514 unlet s:cpo_save | |
7 | 515 " vim: ts=8 tw=132 |