]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/syntax_checkers/fortran.vim
ee176f26b4e9ccdaccb57d2fdde30c7fb0b2f594
[rbdr/dotfiles] / vim / syntax_checkers / fortran.vim
1 "============================================================================
2 "File: fortran.vim
3 "Description: Syntax checking plugin for syntastic.vim
4 "Maintainer: Karl Yngve LervÄg <karl.yngve@lervag.net>
5 "License: This program is free software. It comes without any warranty,
6 " to the extent permitted by applicable law. You can redistribute
7 " it and/or modify it under the terms of the Do What The Fuck You
8 " Want To Public License, Version 2, as published by Sam Hocevar.
9 " See http://sam.zoy.org/wtfpl/COPYING for more details.
10 "Note: This syntax checker uses gfortran with the option -fsyntax-only
11 " to check for errors and warnings. Additional flags may be
12 " supplied through both local and global variables,
13 " b:syntastic_fortran_flags,
14 " g:syntastic_fortran_flags.
15 " This is particularly useful when the source requires module files
16 " in order to compile (that is when it needs modules defined in
17 " separate files).
18 "
19 "============================================================================
20
21 if exists("loaded_fortran_syntax_checker")
22 finish
23 endif
24 let loaded_fortran_syntax_checker = 1
25
26 "bail if the user doesnt have fortran installed
27 if !executable("gfortran")
28 finish
29 endif
30
31 if !exists('g:syntastic_fortran_flags')
32 let g:syntastic_fortran_flags = ''
33 endif
34
35 function! SyntaxCheckers_fortran_GetLocList()
36 let makeprg = 'gfortran -fsyntax-only'
37 let makeprg .= g:syntastic_fortran_flags
38 if exists('b:syntastic_fortran_flags')
39 let makeprg .= b:syntastic_fortran_flags
40 endif
41 let makeprg .= ' ' . shellescape(expand('%'))
42 let errorformat = '%-C %#,%-C %#%.%#,%A%f:%l.%c:,%Z%m,%G%.%#'
43 return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
44 endfunction