mxmlc.vim 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. "============================================================================
  11. if exists('g:loaded_syntastic_actionscript_mxmlc_checker')
  12. finish
  13. endif
  14. let g:loaded_syntastic_actionscript_mxmlc_checker = 1
  15. let s:save_cpo = &cpo
  16. set cpo&vim
  17. function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
  18. let term = ''
  19. if match(a:item['text'], '\mvariable ''') > -1
  20. let term = matchstr(a:item['text'], '\m''\zs[^'']\+\ze''')
  21. elseif match(a:item['text'], 'expected a definition keyword') > -1
  22. let term = matchstr(a:item['text'], '\mnot \zs[^.]\+\ze\.')
  23. elseif match(a:item['text'], '\mundefined \%(property\|method\)') > -1
  24. let term = matchstr(a:item['text'], '\mundefined \%(property\|method\) \zs[^. ]\+\ze')
  25. elseif match(a:item['text'], 'could not be found') > -1
  26. let term = matchstr(a:item['text'], '\m \zs\S\+\ze could not be found')
  27. elseif match(a:item['text'], 'Type was not found') > -1
  28. let term = matchstr(a:item['text'], '\m: \zs[^.]\+\zs\.')
  29. endif
  30. return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
  31. endfunction
  32. function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
  33. call syntastic#log#deprecationWarn('actionscript_mxmlc_conf', 'actionscript_mxmlc_args',
  34. \ "'-load-config+=' . syntastic#util#shexpand(OLD_VAR)")
  35. let makeprg = self.makeprgBuild({ 'args_after': '-output=' . syntastic#util#DevNull() })
  36. let errorformat =
  37. \ '%f(%l): col: %c %trror: %m,' .
  38. \ '%f(%l): col: %c %tarning: %m,' .
  39. \ '%f: %trror: %m,' .
  40. \ '%-G%.%#'
  41. return SyntasticMake({
  42. \ 'makeprg': makeprg,
  43. \ 'errorformat': errorformat })
  44. endfunction
  45. call g:SyntasticRegistry.CreateAndRegisterChecker({
  46. \ 'filetype': 'actionscript',
  47. \ 'name': 'mxmlc'})
  48. let &cpo = s:save_cpo
  49. unlet s:save_cpo
  50. " vim: set sw=4 sts=4 et fdm=marker: