rebase on 2015
[Vimrc.git] / bundle / syntastic-3.4.0 / syntax_checkers / actionscript / mxmlc.vim
blobe423aa0d77bd9dc5fb02f058d501752c54f2beab
1 "============================================================================
2 "File:        mxmlc.vim
3 "Description: ActionScript syntax checker - using mxmlc
4 "Maintainer:  Andy Earnshaw <andyearnshaw@gmail.com>
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.
10 "============================================================================
12 if exists('g:loaded_syntastic_actionscript_mxmlc_checker')
13     finish
14 endif
15 let g:loaded_syntastic_actionscript_mxmlc_checker = 1
17 if !exists('g:syntastic_actionscript_mxmlc_conf')
18     let g:syntastic_actionscript_mxmlc_conf = ''
19 endif
21 let s:save_cpo = &cpo
22 set cpo&vim
24 function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
25     let term = ''
27     if match(a:item['text'], '\mvariable ''') > -1
28         let term = matchstr(a:item['text'], '\m''\zs[^'']\+\ze''')
30     elseif match(a:item['text'], 'expected a definition keyword') > -1
31         let term = matchstr(a:item['text'], '\mnot \zs[^.]\+\ze\.')
33     elseif match(a:item['text'], '\mundefined \%(property\|method\)') > -1
34         let term = matchstr(a:item['text'], '\mundefined \%(property\|method\) \zs[^. ]\+\ze')
36     elseif match(a:item['text'], 'could not be found') > -1
37         let term = matchstr(a:item['text'], '\m \zs\S\+\ze could not be found')
39     elseif match(a:item['text'], 'Type was not found') > -1
40         let term = matchstr(a:item['text'], '\m: \zs[^.]\+\zs\.')
42     endif
44     return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
45 endfunction
47 function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
48     let makeprg = self.makeprgBuild({
49         \ 'args_before': (g:syntastic_actionscript_mxmlc_conf != '' ?
50         \   ' -load-config+=' . g:syntastic_actionscript_mxmlc_conf : ''),
51         \ 'args_after': '-output=' . syntastic#util#DevNull() })
53     let errorformat =
54         \ '%f(%l): col: %c %trror: %m,' .
55         \ '%f(%l): col: %c %tarning: %m,' .
56         \ '%f: %trror: %m,' .
57         \ '%-G%.%#'
59     return SyntasticMake({
60         \ 'makeprg': makeprg,
61         \ 'errorformat': errorformat })
62 endfunction
64 call g:SyntasticRegistry.CreateAndRegisterChecker({
65     \ 'filetype': 'actionscript',
66     \ 'name': 'mxmlc'})
68 let &cpo = s:save_cpo
69 unlet s:save_cpo
71 " vim: set et sts=4 sw=4: