From b905f6d08aebec353a67a7d0866a7e94f8f63032 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 19 Mar 2015 08:33:54 +0200 Subject: [PATCH] Mercury checker: cleanup. --- README.markdown | 6 ++--- plugin/syntastic.vim | 2 +- plugin/syntastic/registry.vim | 1 + syntax_checkers/mercury/mmc.vim | 39 +++++++++++++++++++-------------- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/README.markdown b/README.markdown index 6c6fab4f..72d54e82 100644 --- a/README.markdown +++ b/README.markdown @@ -58,9 +58,9 @@ C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, -NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable -Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax NG, -reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Tcl, TeX, +Mercury, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext +Portable Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax +NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] for details about the corresponding supported checkers. diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index a4e62f0d..e0dbccbd 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.6.0-59' +let g:_SYNTASTIC_VERSION = '3.6.0-62' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 9d008671..ea77fe80 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -53,6 +53,7 @@ let s:_DEFAULT_CHECKERS = { \ 'lua': ['luac'], \ 'markdown': ['mdl'], \ 'matlab': ['mlint'], + \ 'mercury': ['mmc'], \ 'nasm': ['nasm'], \ 'nroff': ['mandoc'], \ 'objc': ['gcc'], diff --git a/syntax_checkers/mercury/mmc.vim b/syntax_checkers/mercury/mmc.vim index 14e95af0..75ee6545 100644 --- a/syntax_checkers/mercury/mmc.vim +++ b/syntax_checkers/mercury/mmc.vim @@ -1,9 +1,13 @@ "============================================================================ "File: mercury.vim "Description: Syntax checking plugin for syntastic.vim -" Based off of the hlint syntax checker. -"Maintainer: Josh Rahm (joshuarahm@gmail.com) -"License: WTF +"Maintainer: Joshua Rahm (joshuarahm@gmail.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:loaded_syntastic_mercury_mmc_checker') @@ -11,27 +15,28 @@ if exists('g:loaded_syntastic_mercury_mmc_checker') endif let g:loaded_syntastic_mercury_mmc_checker = 1 -if !exists('g:syntastic_mercury_compiler_options') - let g:syntastic_mercury_compiler_options='' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_mercury_mmc_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe': self.getExecEscaped() . ' -e ' . g:syntastic_mercury_compiler_options}) + let makeprg = self.makeprgBuild({ 'args_before': '-e' }) let errorformat = - \ '%E%f:%l: error:%m,' . - \ '%E%f:%l: Error:%m,' . - \ '%W%f:%l: warning:%m,' . - \ '%E%f:%l: mode error:%m' + \ '%C%f:%l: %m,' . + \ '%E%f:%l: %m,' . + \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['compressWhitespace'] }) + \ 'errorformat': errorformat }) + + for e in loclist + if stridx(e['text'], ' warning:') >= 0 + let e['type'] = 'W' + endif + endfor + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ @@ -41,4 +46,4 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ let &cpo = s:save_cpo unlet s:save_cpo -" vim: set et sts=4 sw=4: +" vim: set sw=4 sts=4 et fdm=marker: