Cleanup: asm/gcc checker.

This commit is contained in:
LCD 47 2014-02-08 09:32:44 +02:00
parent 0eed307fdb
commit 4def389ae4
2 changed files with 13 additions and 28 deletions

View File

@ -35,10 +35,10 @@ the user is notified and is happy because they didn't have to compile their
code or execute their script to find them. code or execute their script to find them.
At the time of this writing, syntax checking plugins exist for ActionScript, At the time of this writing, syntax checking plugins exist for ActionScript,
Ada, AppleScript, AsciiDoc, BEMHTML, Bourne shell, C, C++, C#, Chef, Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bourne shell, C, C++, C#, Chef,
CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir,
Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe,
Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, Lex, Limbo, LISP, Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, Lex, Limbo, LISP,
LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++,
OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket,
reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig,

View File

@ -15,53 +15,38 @@ if exists('g:loaded_syntastic_asm_gcc_checker')
endif endif
let g:loaded_syntastic_asm_gcc_checker = 1 let g:loaded_syntastic_asm_gcc_checker = 1
let s:asm_extensions = { if !exists('g:syntastic_asm_compiler_options')
\ 's': 'att', let g:syntastic_asm_compiler_options = ''
\ 'asm': 'intel'
\ }
if !exists('g:syntastic_asm_compiler')
let g:syntastic_asm_compiler = 'gcc'
endif endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_asm_gcc_IsAvailable() dict function! SyntaxCheckers_asm_gcc_IsAvailable() dict
if !exists('g:syntastic_asm_compiler')
let g:syntastic_asm_compiler = self.getExec()
endif
return executable(expand(g:syntastic_asm_compiler)) return executable(expand(g:syntastic_asm_compiler))
endfunction endfunction
if !exists('g:syntastic_asm_options')
let g:syntastic_asm_options = ''
endif
function! SyntaxCheckers_asm_gcc_GetLocList() dict function! SyntaxCheckers_asm_gcc_GetLocList() dict
let compiler_options = s:GetDialect() . ' ' . g:syntastic_asm_options
return syntastic#c#GetLocList('asm', 'gcc', { return syntastic#c#GetLocList('asm', 'gcc', {
\ 'errorformat': \ 'errorformat':
\ '%-G%f:%s:,' . \ '%-G%f:%s:,' .
\ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' . \ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l: %m', \ '%f:%l: %m',
\ 'main_flags': '-x assembler -fsyntax-only -masm=' . compiler_options , }) \ 'main_flags': '-x assembler -fsyntax-only -masm=' . s:GetDialect() })
endfunction endfunction
function! s:GetDialect() function! s:GetDialect()
if exists('g:syntastic_asm_dialect') return exists('g:syntastic_asm_dialect') ? g:syntastic_asm_dialect :
return g:syntastic_asm_dialect \ expand('%:e') ==? 'asm' ? 'intel' : 'att'
endif
let extensions = exists('g:syntastic_asm_extensions')
\ ? g:syntastic_asm_extensions : s:asm_extensions
let dialect = get( extensions, tolower(expand('%:e')), 'att' )
return dialect
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'asm', \ 'filetype': 'asm',
\ 'name': 'gcc'}) \ 'name': 'gcc' })
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo