comparison runtime/doc/syntax.txt @ 3281:af1e8a1714c2

Update runtime files.
author Bram Moolenaar <bram@vim.org>
date Fri, 20 Jan 2012 21:08:56 +0100
parents ba708ee8d69d
children b37888de599c
comparison
equal deleted inserted replaced
3280:aa265b7165cc 3281:af1e8a1714c2
1 *syntax.txt* For Vim version 7.3. Last change: 2012 Jan 04 1 *syntax.txt* For Vim version 7.3. Last change: 2012 Jan 20
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1159 Highlighting appropriate for Fortran 2008 is used by default. This choice 1159 Highlighting appropriate for Fortran 2008 is used by default. This choice
1160 should be appropriate for most users most of the time because Fortran 2008 is 1160 should be appropriate for most users most of the time because Fortran 2008 is
1161 almost a superset of previous versions (Fortran 2003, 95, 90, and 77). 1161 almost a superset of previous versions (Fortran 2003, 95, 90, and 77).
1162 1162
1163 Fortran source code form ~ 1163 Fortran source code form ~
1164 Fortran 9x code can be in either fixed or free source form. Note that the 1164 Fortran code can be in either fixed or free source form. Note that the
1165 syntax highlighting will not be correct if the form is incorrectly set. 1165 syntax highlighting will not be correct if the form is incorrectly set.
1166 1166
1167 When you create a new fortran file, the syntax script assumes fixed source 1167 When you create a new fortran file, the syntax script assumes fixed source
1168 form. If you always use free source form, then > 1168 form. If you always use free source form, then >
1169 :let fortran_free_source=1 1169 :let fortran_free_source=1
1240 statement labels used in do, goto and arithmetic if statements will be 1240 statement labels used in do, goto and arithmetic if statements will be
1241 recognized, as will construct names at the end of a do, if, select or forall 1241 recognized, as will construct names at the end of a do, if, select or forall
1242 construct. 1242 construct.
1243 1243
1244 Non-default fortran dialects ~ 1244 Non-default fortran dialects ~
1245 The syntax script supports five Fortran dialects: f95, f90, f77, the Lahey 1245 The syntax script supports two Fortran dialects: f08 and F. You will probably
1246 subset elf90, and the Imagine1 subset F. However, these dialects are outdated; 1246 find the default highlighting (f08) satisfactory. A few legacy constructs
1247 the next version of the syntax script will support only two variants: modern 1247 deleted or declared obsolescent in the 2008 standard are highlighted as todo
1248 Fortran and legacy Fortran. 1248 items.
1249 1249
1250 If you use f77 with extensions, even common ones like do/enddo loops, do/while 1250 If you use F, the advantage of setting the dialect appropriately is that
1251 loops and free source form that are supported by most f77 compilers including 1251 other legacy features excluded from F will be highlighted as todo items and
1252 g77 (GNU Fortran), then you will probably find the default highlighting 1252 that free source form will be assumed.
1253 satisfactory. However, if you use strict f77 with no extensions, not even free 1253
1254 source form or the MIL STD 1753 extensions, then the advantages of setting the 1254 The dialect can be selected in various ways. If all your fortran files use
1255 dialect to f77 are that names such as SUM are recognized as user variable 1255 the same dialect, set the global variable fortran_dialect in your .vimrc prior
1256 names and not highlighted as f9x intrinsic functions, that obsolete constructs 1256 to your syntax on statement. The case-sensitive, permissible values of
1257 such as ASSIGN statements are not highlighted as todo items, and that fixed 1257 fortran_dialect are "f08" or "F". Invalid values of fortran_dialect are
1258 source form will be assumed. 1258 ignored.
1259 1259
1260 If you use elf90 or F, the advantage of setting the dialect appropriately is 1260 If the dialect depends upon the file extension, then it is most convenient to
1261 that f90 features excluded from these dialects will be highlighted as todo 1261 set a buffer-local variable in a ftplugin file. For more information on
1262 items and that free source form will be assumed as required for these 1262 ftplugin files, see |ftplugin|. For example, if all your fortran files with
1263 dialects. 1263 an .f90 extension are written in the F subset, your ftplugin file should
1264 1264 contain the code >
1265 The dialect can be selected by setting the variable fortran_dialect. The
1266 permissible values of fortran_dialect are case-sensitive and must be "f95",
1267 "f90", "f77", "elf" or "F". Invalid values of fortran_dialect are ignored.
1268
1269 If all your fortran files use the same dialect, set fortran_dialect in your
1270 .vimrc prior to your syntax on statement. If the dialect depends upon the file
1271 extension, then it is most convenient to set it in a ftplugin file. For more
1272 information on ftplugin files, see |ftplugin|. For example, if all your
1273 fortran files with an .f90 extension are written in the elf subset, your
1274 ftplugin file should contain the code >
1275 let s:extfname = expand("%:e") 1265 let s:extfname = expand("%:e")
1276 if s:extfname ==? "f90" 1266 if s:extfname ==? "f90"
1277 let fortran_dialect="elf" 1267 let b:fortran_dialect="F"
1278 else 1268 else
1279 unlet! fortran_dialect 1269 unlet! b:fortran_dialect
1280 endif 1270 endif
1281 Note that this will work only if the "filetype plugin indent on" command 1271 Note that this will work only if the "filetype plugin indent on" command
1282 precedes the "syntax on" command in your .vimrc file. 1272 precedes the "syntax on" command in your .vimrc file.
1283 1273
1284 Finer control is necessary if the file extension does not uniquely identify 1274 Finer control is necessary if the file extension does not uniquely identify
1285 the dialect. You can override the default dialect, on a file-by-file basis, by 1275 the dialect. You can override the default dialect, on a file-by-file basis,
1286 including a comment with the directive "fortran_dialect=xx" (where xx=f77 or 1276 by including a comment with the directive "fortran_dialect=xx" (where xx=F or
1287 elf or F or f90 or f95) in one of the first three lines in your file. For 1277 f08) in one of the first three lines in your file. For example, your older .f
1288 example, your older .f files may be written in extended f77 but your newer 1278 files may be legacy code but your newer ones may be F codes, and you would
1289 ones may be F codes, and you would identify the latter by including in the 1279 identify the latter by including in the first three lines of those files a
1290 first three lines of those files a Fortran comment of the form > 1280 Fortran comment of the form >
1291 ! fortran_dialect=F 1281 ! fortran_dialect=F
1292 F overrides elf if both directives are present. 1282
1283 For previous versions of the syntax, you may have set fortran_dialect to the
1284 now-obsolete values "f77", "f90", "f95", or "elf". Such settings will be
1285 silently handled as "f08". Users of "elf" may wish to experiment with "F"
1286 instead.
1287
1288 The syntax/fortran.vim script contains embedded comments that tell you how to
1289 comment and/or uncomment some lines to (a) activate recognition of some
1290 non-standard, vendor-supplied intrinsics and (b) to prevent features deleted
1291 or declared obsolescent in the 2008 standard from being highlighted as todo
1292 items.
1293 1293
1294 Limitations ~ 1294 Limitations ~
1295 Parenthesis checking does not catch too few closing parentheses. Hollerith 1295 Parenthesis checking does not catch too few closing parentheses. Hollerith
1296 strings are not recognized. Some keywords may be highlighted incorrectly 1296 strings are not recognized. Some keywords may be highlighted incorrectly
1297 because Fortran90 has no reserved words. 1297 because Fortran90 has no reserved words.