All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: w0rp <devw0rp@gmail.com>
2 " Description: gcc for Fortran files
4 " This option can be set to 0 to use -ffixed-form
5 call ale#Set('fortran_gcc_use_free_form', 1)
6 call ale#Set('fortran_gcc_executable', 'gcc')
7 " Set this option to change the GCC options for warnings for Fortran.
8 call ale#Set('fortran_gcc_options', '-Wall')
10 function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
11 " We have to match a starting line and a later ending line together,
15 " Error: Expected comma in I/O list at (1)
16 let l:line_marker_pattern = ':\(\d\+\)[.:]\=\(\d\+\)\=:\=$'
17 let l:message_pattern = '^\(Error\|Warning\): \(.\+\)$'
18 let l:looking_for_message = 0
19 let l:last_loclist_obj = {}
24 if l:looking_for_message
25 let l:match = matchlist(l:line, l:message_pattern)
27 let l:match = matchlist(l:line, l:line_marker_pattern)
34 if l:looking_for_message
35 let l:looking_for_message = 0
37 " Now we have the text, we can set it and add the error.
38 let l:last_loclist_obj.text = l:match[2]
39 let l:last_loclist_obj.type = l:match[1] is# 'Warning' ? 'W' : 'E'
40 call add(l:output, l:last_loclist_obj)
42 let l:last_loclist_obj = {
44 \ 'lnum': l:match[1] + 0,
45 \ 'col': l:match[2] + 0,
48 " Start looking for the message and error type.
49 let l:looking_for_message = 1
56 function! ale_linters#fortran#gcc#GetCommand(buffer) abort
57 let l:layout_option = ale#Var(a:buffer, 'fortran_gcc_use_free_form')
61 return '%e -S -x f95 -fsyntax-only ' . l:layout_option
62 \ . ale#Pad(ale#Var(a:buffer, 'fortran_gcc_options'))
66 call ale#linter#Define('fortran', {
68 \ 'output_stream': 'stderr',
69 \ 'executable': {b -> ale#Var(b, 'fortran_gcc_executable')},
70 \ 'command': function('ale_linters#fortran#gcc#GetCommand'),
71 \ 'callback': 'ale_linters#fortran#gcc#Handle',