From 5214f00a17a389ee2c285610f5b367341a77ce21 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 24 Feb 2015 15:42:01 +0200 Subject: [PATCH] New checker for API Blueprint: snowcrash. --- README.markdown | 22 +-- plugin/syntastic.vim | 2 +- plugin/syntastic/registry.vim | 175 +++++++++++---------- syntax_checkers/apiblueprint/snowcrash.vim | 66 ++++++++ 4 files changed, 166 insertions(+), 99 deletions(-) create mode 100644 syntax_checkers/apiblueprint/snowcrash.vim diff --git a/README.markdown b/README.markdown index 73c09c66..de6c7fd7 100644 --- a/README.markdown +++ b/README.markdown @@ -53,17 +53,17 @@ are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntastic has checking plugins for ActionScript, -Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, 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, 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. +Ada, API Blueprint, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, +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, +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. A number of third-party Vim plugins also provide checkers for syntastic, for example: [omnisharp-vim][25], [rust.vim][12], [syntastic-extras][26], diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 0a2593d0..c164d841 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-44' +let g:_SYNTASTIC_VERSION = '3.6.0-45' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index a9ae21e0..9d008671 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -6,93 +6,94 @@ let g:loaded_syntastic_registry = 1 " Initialisation {{{1 let s:_DEFAULT_CHECKERS = { - \ 'actionscript':['mxmlc'], - \ 'ada': ['gcc'], - \ 'applescript': ['osacompile'], - \ 'asciidoc': ['asciidoc'], - \ 'asm': ['gcc'], - \ 'bro': ['bro'], - \ 'bemhtml': ['bemhtmllint'], - \ 'c': ['gcc'], - \ 'cabal': ['cabal'], - \ 'chef': ['foodcritic'], - \ 'co': ['coco'], - \ 'cobol': ['cobc'], - \ 'coffee': ['coffee', 'coffeelint'], - \ 'coq': ['coqtop'], - \ 'cpp': ['gcc'], - \ 'cs': ['mcs'], - \ 'css': ['csslint'], - \ 'cucumber': ['cucumber'], - \ 'cuda': ['nvcc'], - \ 'd': ['dmd'], - \ 'dart': ['dartanalyzer'], - \ 'docbk': ['xmllint'], - \ 'dustjs': ['swiffer'], - \ 'elixir': [], - \ 'erlang': ['escript'], - \ 'eruby': ['ruby'], - \ 'fortran': ['gfortran'], - \ 'glsl': ['cgc'], - \ 'go': ['go'], - \ 'haml': ['haml'], - \ 'handlebars': ['handlebars'], - \ 'haskell': ['ghc_mod', 'hdevtools', 'hlint'], - \ 'haxe': ['haxe'], - \ 'hss': ['hss'], - \ 'html': ['tidy'], - \ 'java': ['javac'], - \ 'javascript': ['jshint', 'jslint'], - \ 'json': ['jsonlint', 'jsonval'], - \ 'less': ['lessc'], - \ 'lex': ['flex'], - \ 'limbo': ['limbo'], - \ 'lisp': ['clisp'], - \ 'llvm': ['llvm'], - \ 'lua': ['luac'], - \ 'markdown': ['mdl'], - \ 'matlab': ['mlint'], - \ 'nasm': ['nasm'], - \ 'nroff': ['mandoc'], - \ 'objc': ['gcc'], - \ 'objcpp': ['gcc'], - \ 'ocaml': ['camlp4o'], - \ 'perl': ['perlcritic'], - \ 'php': ['php', 'phpcs', 'phpmd'], - \ 'po': ['msgfmt'], - \ 'pod': ['podchecker'], - \ 'puppet': ['puppet', 'puppetlint'], - \ 'python': ['python', 'flake8', 'pylint'], - \ 'r': [], - \ 'racket': ['racket'], - \ 'rnc': ['rnv'], - \ 'rst': ['rst2pseudoxml'], - \ 'ruby': ['mri'], - \ 'sass': ['sass'], - \ 'scala': ['fsc', 'scalac'], - \ 'scss': ['sass', 'scss_lint'], - \ 'sh': ['sh', 'shellcheck'], - \ 'slim': ['slimrb'], - \ 'sml': ['smlnj'], - \ 'spec': ['rpmlint'], - \ 'tcl': ['nagelfar'], - \ 'tex': ['lacheck', 'chktex'], - \ 'texinfo': ['makeinfo'], - \ 'text': [], - \ 'twig': ['twiglint'], - \ 'typescript': ['tsc'], - \ 'vala': ['valac'], - \ 'verilog': ['verilator'], - \ 'vhdl': ['ghdl'], - \ 'vim': ['vimlint'], - \ 'xhtml': ['tidy'], - \ 'xml': ['xmllint'], - \ 'xslt': ['xmllint'], - \ 'yacc': ['bison'], - \ 'yaml': ['jsyaml'], - \ 'z80': ['z80syntaxchecker'], - \ 'zpt': ['zptlint'], - \ 'zsh': ['zsh', 'shellcheck'], + \ 'actionscript': ['mxmlc'], + \ 'ada': ['gcc'], + \ 'apiblueprint': ['snowcrash'], + \ 'applescript': ['osacompile'], + \ 'asciidoc': ['asciidoc'], + \ 'asm': ['gcc'], + \ 'bro': ['bro'], + \ 'bemhtml': ['bemhtmllint'], + \ 'c': ['gcc'], + \ 'cabal': ['cabal'], + \ 'chef': ['foodcritic'], + \ 'co': ['coco'], + \ 'cobol': ['cobc'], + \ 'coffee': ['coffee', 'coffeelint'], + \ 'coq': ['coqtop'], + \ 'cpp': ['gcc'], + \ 'cs': ['mcs'], + \ 'css': ['csslint'], + \ 'cucumber': ['cucumber'], + \ 'cuda': ['nvcc'], + \ 'd': ['dmd'], + \ 'dart': ['dartanalyzer'], + \ 'docbk': ['xmllint'], + \ 'dustjs': ['swiffer'], + \ 'elixir': [], + \ 'erlang': ['escript'], + \ 'eruby': ['ruby'], + \ 'fortran': ['gfortran'], + \ 'glsl': ['cgc'], + \ 'go': ['go'], + \ 'haml': ['haml'], + \ 'handlebars': ['handlebars'], + \ 'haskell': ['ghc_mod', 'hdevtools', 'hlint'], + \ 'haxe': ['haxe'], + \ 'hss': ['hss'], + \ 'html': ['tidy'], + \ 'java': ['javac'], + \ 'javascript': ['jshint', 'jslint'], + \ 'json': ['jsonlint', 'jsonval'], + \ 'less': ['lessc'], + \ 'lex': ['flex'], + \ 'limbo': ['limbo'], + \ 'lisp': ['clisp'], + \ 'llvm': ['llvm'], + \ 'lua': ['luac'], + \ 'markdown': ['mdl'], + \ 'matlab': ['mlint'], + \ 'nasm': ['nasm'], + \ 'nroff': ['mandoc'], + \ 'objc': ['gcc'], + \ 'objcpp': ['gcc'], + \ 'ocaml': ['camlp4o'], + \ 'perl': ['perlcritic'], + \ 'php': ['php', 'phpcs', 'phpmd'], + \ 'po': ['msgfmt'], + \ 'pod': ['podchecker'], + \ 'puppet': ['puppet', 'puppetlint'], + \ 'python': ['python', 'flake8', 'pylint'], + \ 'r': [], + \ 'racket': ['racket'], + \ 'rnc': ['rnv'], + \ 'rst': ['rst2pseudoxml'], + \ 'ruby': ['mri'], + \ 'sass': ['sass'], + \ 'scala': ['fsc', 'scalac'], + \ 'scss': ['sass', 'scss_lint'], + \ 'sh': ['sh', 'shellcheck'], + \ 'slim': ['slimrb'], + \ 'sml': ['smlnj'], + \ 'spec': ['rpmlint'], + \ 'tcl': ['nagelfar'], + \ 'tex': ['lacheck', 'chktex'], + \ 'texinfo': ['makeinfo'], + \ 'text': [], + \ 'twig': ['twiglint'], + \ 'typescript': ['tsc'], + \ 'vala': ['valac'], + \ 'verilog': ['verilator'], + \ 'vhdl': ['ghdl'], + \ 'vim': ['vimlint'], + \ 'xhtml': ['tidy'], + \ 'xml': ['xmllint'], + \ 'xslt': ['xmllint'], + \ 'yacc': ['bison'], + \ 'yaml': ['jsyaml'], + \ 'z80': ['z80syntaxchecker'], + \ 'zpt': ['zptlint'], + \ 'zsh': ['zsh', 'shellcheck'], \ } lockvar! s:_DEFAULT_CHECKERS diff --git a/syntax_checkers/apiblueprint/snowcrash.vim b/syntax_checkers/apiblueprint/snowcrash.vim new file mode 100644 index 00000000..638e3528 --- /dev/null +++ b/syntax_checkers/apiblueprint/snowcrash.vim @@ -0,0 +1,66 @@ +"============================================================================ +"File: snowcrash.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"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_apiblueprint_snowcrash_checker") + finish +endif +let g:loaded_syntastic_apiblueprint_snowcrash_checker = 1 + +if !exists('g:syntastic_apiblueprint_snowcrash_sort') + let g:syntastic_apiblueprint_snowcrash_sort = 1 +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_apiblueprint_snowcrash_GetLocList() dict + let makeprg = self.makeprgBuild({ 'post_args': '-u -l' }) + + let errorformat = + \ '%trror: (%n) %m,' . + \ '%tarning: (%n) %m,' . + \ '%-G%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')}, + \ 'returns': [0, 2] }) + + for e in loclist + let matches = matchlist(e['text'], '\v^(.+); line (\d+), column (\d+) - line (\d+), column (\d+)$') + if len(matches) > 5 + let e['lnum'] = str2nr(matches[2]) + let e['col'] = str2nr(matches[3]) + let e['vcol'] = 0 + + if matches[2] == matches[4] + let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . matches[5] . 'c' + endif + + let e['text'] = matches[1] + else + let e['valid'] = 0 + endif + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'apiblueprint', + \ 'name': 'snowcrash'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: