]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/nasm/nasm.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / ale_linters / nasm / nasm.vim
1 " Author: Oyvind Ingvaldsen <oyvind.ingvaldsen@gmail.com>
2 " Description: NASM linter for asmsyntax nasm.
3
4 call ale#Set('nasm_nasm_executable', 'nasm')
5 call ale#Set('nasm_nasm_options', '')
6
7 function! ale_linters#nasm#nasm#GetCommand(buffer) abort
8     " Note that NASM requires a trailing slash for the -I option.
9     let l:separator = has('win32') ? '\' : '/'
10     let l:output_null = has('win32') ? 'NUL' : '/dev/null'
11
12     return '%e -X gnu -I %s:h' . l:separator
13     \   . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
14     \   . ' %s'
15     \   . ' -o ' . l:output_null
16 endfunction
17
18 function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
19     " Note that we treat 'fatal' as errors.
20     let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
21     let l:output = []
22
23     for l:match in ale#util#GetMatches(a:lines, l:pattern)
24         call add(l:output, {
25         \ 'lnum': l:match[1] + 0,
26         \ 'type': l:match[2] =~? 'error\|fatal' ? 'E' : 'W',
27         \ 'text': l:match[3],
28         \})
29     endfor
30
31     return l:output
32 endfunction
33
34 call ale#linter#Define('nasm', {
35 \   'name': 'nasm',
36 \   'output_stream': 'stderr',
37 \   'lint_file': 1,
38 \   'executable': {b -> ale#Var(b, 'nasm_nasm_executable')},
39 \   'command': function('ale_linters#nasm#nasm#GetCommand'),
40 \   'callback': 'ale_linters#nasm#nasm#Handle',
41 \})