|
| 1 | +"============================================================================ |
| 2 | +"File: mxmlc.vim |
| 3 | +"Description: ActionScript syntax checker - using mxmlc |
| 4 | +"Maintainer: Andy Earnshaw <[email protected]> |
| 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 | +"============================================================================ |
| 11 | + |
| 12 | +if exists('g:loaded_syntastic_actionscript_mxmlc_checker') |
| 13 | + finish |
| 14 | +endif |
| 15 | +let g:loaded_syntastic_actionscript_mxmlc_checker = 1 |
| 16 | + |
| 17 | +let s:save_cpo = &cpo |
| 18 | +set cpo&vim |
| 19 | + |
| 20 | +if !exists('g:syntastic_actionscript_mxmlc_conf') |
| 21 | + let g:syntastic_actionscript_mxmlc_conf = '' |
| 22 | +endif |
| 23 | + |
| 24 | +function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item) |
| 25 | + let term = '' |
| 26 | + |
| 27 | + if match(a:item['text'], "variable '") > -1 |
| 28 | + let term = split(a:item['text'], "'")[1] |
| 29 | + |
| 30 | + elseif match(a:item['text'], 'expected a definition keyword') > -1 |
| 31 | + let term = matchlist(a:item['text'], 'not \([^\.]\+\)\.')[1] |
| 32 | + |
| 33 | + elseif match(a:item['text'], 'undefined \%(property\|method\)') > -1 |
| 34 | + let term = matchlist(a:item['text'], 'undefined \%(property\|method\) \([^\. ]\+\)')[1] |
| 35 | + |
| 36 | + elseif match(a:item['text'], 'could not be found') > -1 |
| 37 | + let term = matchlist(a:item['text'], ' \([^ ]\+\) could not be found')[1] |
| 38 | + |
| 39 | + elseif match(a:item['text'], 'Type was not found') > -1 |
| 40 | + let term = matchlist(a:item['text'], ': \([^\.]\+\)\.')[1] |
| 41 | + |
| 42 | + endif |
| 43 | + |
| 44 | + return strlen(term) ? '\V\<'.term.'\>' : '' |
| 45 | +endfunction |
| 46 | + |
| 47 | +function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict |
| 48 | + let output = has("win32") ? 'NUL' : '/dev/null' |
| 49 | + let makeprg = self.makeprgBuild({ 'args': '-output=' . output . s:Args() }) |
| 50 | + |
| 51 | + let errorformat = |
| 52 | + \ '%f(%l): col: %c %trror: %m,' . |
| 53 | + \ '%f(%l): col: %c %tarning: %m,' |
| 54 | + |
| 55 | + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) |
| 56 | +endfunction |
| 57 | + |
| 58 | +function s:Args() |
| 59 | + return !empty(g:syntastic_actionscript_mxmlc_conf) ? ' -load-config+=' . g:syntastic_actionscript_mxmlc_conf : '' |
| 60 | +endfunction |
| 61 | + |
| 62 | +call g:SyntasticRegistry.CreateAndRegisterChecker({ |
| 63 | + \ 'filetype': 'actionscript', |
| 64 | + \ 'name': 'mxmlc'}) |
| 65 | + |
| 66 | +let &cpo = s:save_cpo |
| 67 | +unlet s:save_cpo |
0 commit comments