1 "============================================================================
3 "Description: Syntax checking plugin for syntastic.vim
4 "Maintainer: Alexis Laferrière <alexis.laf@xymus.net>
5 "License: This program is free software. It comes without any warranty,
6 " to the extent permitted by applicable law. You can redistribute
7 " it and/or modify it under the terms of the Do What The Fuck You
8 " Want To Public License, Version 2, as published by Sam Hocevar.
9 " See http://sam.zoy.org/wtfpl/COPYING for more details.
11 " g:syntastic_nitg specifies custom path to compiler
12 " g:syntastic_nit_dir specifies the NIT_DIR env variable
13 " g:syntastic_nit_args specifies extra arguments to call nitg
14 " g:syntastic_nit_include_dirs lists directories to include, must be a list
15 " g:nit_main sets the main module to compile instead of the opened file
16 "============================================================================
17 if exists("loaded_syntastic_nit_nitg_checker")
20 let loaded_syntastic_nit_nitg_checker = 1
22 " check if nitg is accessible
23 if exists('g:syntastic_nitg')
24 let s:nitg = g:syntastic_nitg
29 if !executable(s:nitg)
30 if exists('g:syntastic_nitg')
31 echo "Syntastic for Nit error: Custom nitg cannot be found at: " . g:syntastic_nitg
36 function! SyntaxCheckers_nit_nitg_IsAvailable()
37 return executable(expand(s:nitg))
40 function! SyntaxCheckers_nit_nitg_GetLocList()
41 let makeprg = s:nitg . " --no-color --only-metamodel "
44 if exists('g:syntastic_nit_dir')
45 let makeprg = "NIT_DIR=" . g:syntastic_nit_dir . " " . makeprg
48 " custom options for nit compiler
49 if exists('g:syntastic_nit_options')
50 let makeprg .= " " . g:syntastic_nit_options
53 " custom dirs to include for compiler
54 if exists('g:syntastic_nit_include_dirs')
55 for d in g:syntastic_nit_include_dirs
56 let makeprg .= " -I " . d
60 " alternative main module
61 if exists('g:nit_main')
62 let makeprg .= " " . g:nit_main
64 let makeprg .= " " . shellescape(expand("%"))
68 let makeprg .= " 2>&1 "
70 " possible combinations of error messages
71 let ef_start = [ '%f:%l\,%c--%*[0-9]:',
72 \ '%f:%l\,%c--%*[0-9]\,%*[0-9]:',
74 let ef_type = [ ' %tarning: ',
77 " generate errorformat from combinations
81 let errorformat .= s . t . '%m,'
85 return SyntasticMake({ 'makeprg': makeprg, 'errorformat':errorformat })
88 call g:SyntasticRegistry.CreateAndRegisterChecker({