summaryrefslogtreecommitdiff
path: root/ale_linters/nasm/nasm.vim
diff options
context:
space:
mode:
authorBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
committerBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
commitd2b0ae8108b2ee395d4eb43c49d68b322a023a30 (patch)
treebb8145e69bf1bcb8968b29cb1a68c47ceb83674d /ale_linters/nasm/nasm.vim
parentef641dda80f45cb979bc93c2513c6e10cbd8e42a (diff)
parent0a384a49d371838903d8401c5358ec60f3f4266d (diff)
downloadale-d2b0ae8108b2ee395d4eb43c49d68b322a023a30.zip
Merge branch 'master' into sridhars
Diffstat (limited to 'ale_linters/nasm/nasm.vim')
-rw-r--r--ale_linters/nasm/nasm.vim26
1 files changed, 9 insertions, 17 deletions
diff --git a/ale_linters/nasm/nasm.vim b/ale_linters/nasm/nasm.vim
index 77d57e18..cb2119a6 100644
--- a/ale_linters/nasm/nasm.vim
+++ b/ale_linters/nasm/nasm.vim
@@ -4,32 +4,23 @@
call ale#Set('nasm_nasm_executable', 'nasm')
call ale#Set('nasm_nasm_options', '')
-function! ale_linters#nasm#nasm#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'nasm_nasm_executable')
-endfunction
-
-function! ale_linters#nasm#nasm#GetOptions(buffer) abort
- return ale#Var(a:buffer, 'nasm_nasm_options')
-endfunction
-
function! ale_linters#nasm#nasm#GetCommand(buffer) abort
- " Note that NASM require a trailing slash to the -I option.
- let l:executable = ale#Escape(ale_linters#nasm#nasm#GetExecutable(a:buffer))
+ " Note that NASM requires a trailing slash for the -I option.
let l:separator = has('win32') ? '\' : '/'
- let l:path = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h') . l:separator)
- let l:options = ale_linters#nasm#nasm#GetOptions(a:buffer)
+ let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator
+ let l:output_null = has('win32') ? 'NUL' : '/dev/null'
- return l:executable
- \ . ' -X gnu'
- \ . ' -I ' . l:path
- \ . ' ' . l:options
+ return '%e -X gnu -I ' . ale#Escape(l:path)
+ \ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
\ . ' %s'
+ \ . ' -o ' . l:output_null
endfunction
function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
" Note that we treat 'fatal' as errors.
let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
let l:output = []
+
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': l:match[1] + 0,
@@ -37,6 +28,7 @@ function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
\ 'text': l:match[3],
\})
endfor
+
return l:output
endfunction
@@ -44,7 +36,7 @@ call ale#linter#Define('nasm', {
\ 'name': 'nasm',
\ 'output_stream': 'stderr',
\ 'lint_file': 1,
-\ 'executable_callback': 'ale_linters#nasm#nasm#GetExecutable',
+\ 'executable_callback': ale#VarFunc('nasm_nasm_executable'),
\ 'command_callback': 'ale_linters#nasm#nasm#GetCommand',
\ 'callback': 'ale_linters#nasm#nasm#Handle',
\})