Skip to content

Commit

Permalink
Update syntastic
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoorhis committed Jan 14, 2013
1 parent 5325439 commit 4156591
Show file tree
Hide file tree
Showing 16 changed files with 255 additions and 20 deletions.
7 changes: 6 additions & 1 deletion .vim/bundle/syntastic/autoload/syntastic/c.vim
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ endfunction
" get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! syntastic#c#GetIncludeDirs(filetype)
let include_dirs = copy(s:default_includes)
let include_dirs = []

if !exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') ||
\ !g:syntastic_{a:filetype}_no_default_include_dirs
let include_dirs = copy(s:default_includes)
endif

if exists('g:syntastic_'.a:filetype.'_include_dirs')
call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs)
Expand Down
65 changes: 65 additions & 0 deletions .vim/bundle/syntastic/autoload/syntastic/makeprg.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
if exists("g:loaded_syntastic_makeprg_autoload")
finish
endif
let g:loaded_syntastic_makeprg_autoload = 1

function! syntastic#makeprg#build(opts)
let opts = copy(a:opts)

if !has_key(opts, 'args')
let opts['args'] = ''
endif

if !has_key(opts, 'subchecker')
let opts['subchecker'] = ''
endif

let builder = s:MakeprgBuilder.New(opts['exe'], opts['args'], opts['subchecker'])
return builder.makeprg()
endfunction

let s:MakeprgBuilder = {}

function! s:MakeprgBuilder.New(exe, args, subchecker)
let newObj = copy(self)
let newObj._exe = a:exe
let newObj._args = a:args
let newObj._subchecker = a:subchecker
return newObj
endfunction

function! s:MakeprgBuilder.makeprg()
return join([self.exe(), self.args(), self.fname()])
endfunction

function! s:MakeprgBuilder.exe()
if self.optExists('exe')
return {self.optName('exe')}
endif

return self._exe
endfunction

function! s:MakeprgBuilder.args()
if exists('g:syntastic_' . &ft . '_args')
return g:syntastic_{&ft}_args
endif

return self._args
endfunction

function! s:MakeprgBuilder.fname()
return shellescape(expand("%"))
endfunction

function! s:MakeprgBuilder.optExists(name)
return exists(self.optName(a:name))
endfunction

function! s:MakeprgBuilder.optName(name)
let setting = "g:syntastic_" . &ft
if !empty(self._subchecker)
let setting .= '_' . self._subchecker
endif
return setting . '_' . a:name
endfunction
24 changes: 24 additions & 0 deletions .vim/bundle/syntastic/autoload/syntastic/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@ function! syntastic#util#DevNull()
return '/dev/null'
endfunction

"search the first 5 lines of the file for a magic number and return a map
"containing the args and the executable
"
"e.g.
"
"#!/usr/bin/perl -f -bar
"
"returns
"
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
function! syntastic#util#ParseShebang()
for lnum in range(1,5)
let line = getline(lnum)

if line =~ '^#!'
let exe = matchstr(line, '^#!\s*\zs[^ \t]*')
let args = split(matchstr(line, '^#!\s*[^ \t]*\zs.*'))
return {'exe': exe, 'args': args}
endif
endfor

return {'exe': '', 'args': []}
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:
4 changes: 2 additions & 2 deletions .vim/bundle/syntastic/syntax_checkers/c.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ if !exists('g:syntastic_c_checker')
let g:syntastic_c_checker = "gcc"
endif

if g:syntastic_c_checker == "gcc"
if executable("gcc")
if g:syntastic_c_checker == "gcc" || g:syntastic_c_checker == "clang"
if executable(g:syntastic_c_checker)
runtime! syntax_checkers/c/gcc.vim
endif
elseif g:syntastic_c_checker == "checkpatch"
Expand Down
12 changes: 9 additions & 3 deletions .vim/bundle/syntastic/syntax_checkers/c/gcc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
"
" let g:syntastic_c_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_c_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
Expand Down Expand Up @@ -68,7 +73,7 @@ if exists('loaded_gcc_syntax_checker')
endif
let loaded_gcc_syntax_checker = 1

if !executable('gcc')
if !executable(g:syntastic_c_checker)
finish
endif

Expand All @@ -84,7 +89,7 @@ if !exists('g:syntastic_c_config_file')
endif

function! SyntaxCheckers_c_GetLocList()
let makeprg = 'gcc -fsyntax-only '
let makeprg = g:syntastic_c_checker . ' -x c -fsyntax-only '
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
\ 'each function it appears%.%#,%-GIn file included%.%#,'.
Expand All @@ -105,7 +110,8 @@ function! SyntaxCheckers_c_GetLocList()
" determine whether to parse header files as well
if expand('%') =~? '.h$'
if exists('g:syntastic_c_check_header')
let makeprg = 'gcc -c '.shellescape(expand('%')) .
let makeprg = g:syntastic_c_checker
\ ' -c ' . shellescape(expand('%')) .
\ ' ' . g:syntastic_c_compiler_options .
\ ' ' . syntastic#c#GetNullDevice() .
\ ' ' . syntastic#c#GetIncludeDirs('c')
Expand Down
4 changes: 3 additions & 1 deletion .vim/bundle/syntastic/syntax_checkers/coffee.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ endif


function! SyntaxCheckers_coffee_GetLocList()
let makeprg = 'coffee -c -l -o /tmp '.shellescape(expand('%'))
let makeprg = syntastic#makeprg#build({
\ 'exe': 'coffee',
\ 'args': '-c -l -o /tmp' })
let errorformat = 'Syntax%trror: In %f\, %m on line %l,%EError: In %f\, Parse error on line %l: %m,%EError: In %f\, %m on line %l,%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G%.%#'

let coffee_results = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
Expand Down
7 changes: 6 additions & 1 deletion .vim/bundle/syntastic/syntax_checkers/cpp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
"
" let g:syntastic_cpp_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_cpp_no_default_include_dirs = 1
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_cpp_include_dirs. This list can be used like this:
Expand Down Expand Up @@ -87,7 +92,7 @@ if !exists('g:syntastic_cpp_config_file')
endif

function! SyntaxCheckers_cpp_GetLocList()
let makeprg = g:syntastic_cpp_compiler . ' -fsyntax-only ' .
let makeprg = g:syntastic_cpp_compiler . ' -x c++ -fsyntax-only ' .
\ g:syntastic_cpp_compiler_options
let errorformat = '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: '.
\ '%m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,'.
Expand Down
14 changes: 14 additions & 0 deletions .vim/bundle/syntastic/syntax_checkers/dart.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"============================================================================
"File: dart.vim
"Description: Figures out which dart syntax checker (if any) to load
" from the dart directory.
"Maintainer: Maksim Ryzhikov <rv.maksim at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================

call SyntasticLoadChecker('dart')
21 changes: 21 additions & 0 deletions .vim/bundle/syntastic/syntax_checkers/dart/dart_analyzer.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"============================================================================
"File: dart_analyzer.vim
"Description: Dart syntax checker - using dart_analyzer
"Maintainer: Maksim Ryzhikov <rv.maksim at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if !exists("g:syntastic_dart_analyzer_conf")
let g:syntastic_dart_analyzer_conf = ''
endif

function! SyntaxCheckers_dart_GetLocList()
let args = !empty(g:syntastic_dart_analyzer_conf) ? ' ' . g:syntastic_dart_analyzer_conf : ''
let makeprg = 'dart_analyzer ' . shellescape(expand("%")) . args

let errorformat = '%Efile:%f:%l:%c: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
13 changes: 12 additions & 1 deletion .vim/bundle/syntastic/syntax_checkers/efm_perl.pl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
use warnings;
use strict;
use Getopt::Std;
use File::Temp qw( tempfile );

use vars qw/$opt_I $opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'

Expand All @@ -91,13 +92,23 @@
(my $file = shift) or &usage; # display usage if no filename is supplied
my $args = (@ARGV ? ' ' . join ' ', @ARGV : '');

my $libs = join ' ', map {"-I$_"} split ',', $opt_I;
if ($file eq '-') { # make STDIN seek-able, so it can be read twice
my $fh = tempfile();
print {$fh} <STDIN>;
open \*STDIN, '<&', $fh or die "open: $!";
seek \*STDIN, 0, 0 or die "seek: $!";
}

my $libs = join ' ', map {"-I$_"} split ',', $opt_I || '';
my @error_lines = `perl $libs @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-Mwarnings ']} "$file$args" 2>&1`;

my @lines = map { "E:$_" } @error_lines;

my @warn_lines;
if(defined($opt_w)) {
if ($file eq '-') {
seek \*STDIN, 0, 0 or die "seek: $!";
}
@warn_lines = `perl $libs @{[defined $opt_c ? '-c ' : '' ]} -Mwarnings "$file$args" 2>&1`;
}

Expand Down
3 changes: 2 additions & 1 deletion .vim/bundle/syntastic/syntax_checkers/html/tidy.vim
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ let s:ignore_html_errors = [
\ "<meta> proprietary attribute \"charset\"",
\ "<meta> lacks \"content\" attribute",
\ "inserting \"type\" attribute",
\ "proprietary attribute \"data-"
\ "proprietary attribute \"data-",
\ "<input> attribute \"type\" has invalid value \"search\""
\]

function! s:ValidateError(text)
Expand Down
Loading

0 comments on commit 4156591

Please sign in to comment.