Checker rapper: cleanup.

This commit is contained in:
LCD 47 2016-05-05 19:42:00 +03:00
parent 952e297457
commit 71208eb69b
5 changed files with 36 additions and 68 deletions

View File

@ -61,11 +61,11 @@ Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP,
LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix,
Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML, Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML,
R, Racket, Relax NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM spec, Ruby,
SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig,
VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, z80, Zope TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML,
page templates, and zsh. See the [wiki][3] for details about the corresponding YANG data models, z80, Zope page templates, and zsh. See the [wiki][3] for
supported checkers. details about the corresponding supported checkers.
A number of third-party Vim plugins also provide checkers for syntastic, A number of third-party Vim plugins also provide checkers for syntastic,
for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12], for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12],

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.7.0-130' let g:_SYNTASTIC_VERSION = '3.7.0-132'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1

View File

@ -90,6 +90,8 @@ let s:_DEFAULT_CHECKERS = {
\ 'tex': ['lacheck', 'chktex'], \ 'tex': ['lacheck', 'chktex'],
\ 'texinfo': ['makeinfo'], \ 'texinfo': ['makeinfo'],
\ 'text': [], \ 'text': [],
\ 'trig': ['rapper'],
\ 'turtle': ['rapper'],
\ 'twig': ['twiglint'], \ 'twig': ['twiglint'],
\ 'typescript': ['tsc'], \ 'typescript': ['tsc'],
\ 'vala': ['valac'], \ 'vala': ['valac'],

View File

@ -1,28 +1,23 @@
"============================================================================ "============================================================================
"File: rapper.vim "File: rapper.vim
"Description: Syntax checking plugin for syntastic.vim "Description: Syntax checking plugin for syntastic
"Maintainer: Sebastian Tramp <mail@sebastian.tramp.name> "Maintainer: Sebastian Tramp <mail@sebastian.tramp.name>
"License: This program is free software. It comes without any warranty, "License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute " 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 " 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. " Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================ "============================================================================
" file is build based on the given guide as well as existing checker plugins if exists('g:loaded_syntastic_trig_rapper_checker')
" https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
if exists('g:loaded_syntastic_trig_rapper_checker') " {{{1
finish finish
else endif
let g:loaded_syntastic_trig_rapper_checker = 1 let g:loaded_syntastic_trig_rapper_checker = 1
endif " }}}1
" redirect trig syntax check to turtle syntax check {{{1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'trig', \ 'filetype': 'trig',
\ 'name': 'rapper', \ 'name': 'rapper',
\ 'redirect': 'turtle/rapper'}) \ 'redirect': 'turtle/rapper'})
" }}}1
" vim: set sw=4 sts=4 et fdm=marker: " vim: set sw=4 sts=4 et fdm=marker:

View File

@ -1,75 +1,46 @@
"============================================================================ "============================================================================
"File: rapper.vim "File: rapper.vim
"Description: Syntax checking plugin for syntastic.vim "Description: Syntax checking plugin for syntastic
"Maintainer: Sebastian Tramp <mail@sebastian.tramp.name> "Maintainer: Sebastian Tramp <mail@sebastian.tramp.name>
"License: This program is free software. It comes without any warranty, "License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute " 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 " 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. " Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
" "
" file is build based on the given guide as well as existing checker plugins "============================================================================
" https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
if exists('g:loaded_syntastic_turtle_rapper_checker') " {{{1 if exists('g:loaded_syntastic_turtle_rapper_checker')
finish finish
else endif
let g:loaded_syntastic_turtle_rapper_checker = 1 let g:loaded_syntastic_turtle_rapper_checker = 1
endif " }}}1"
" reset options to the Vim defaults {{{1
" http://vi.stackexchange.com/questions/2116
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
" }}}1
" verify that the checker is installed and any other environment deps are met function! SyntaxCheckers_turtle_rapper_GetHighlightRegex(item)
function! SyntaxCheckers_turtle_rapper_IsAvailable() dict " {{{1
return executable(self.getExec())
endfunction " }}}1
" perform the syntax check and return the results in the form of a quickfix list
function! SyntaxCheckers_turtle_rapper_GetLocList() dict " {{{1
" Create the program call via makeprg
" example call: rapper -i guess -q --count file.ttl
" this uses "-i guess" in order to allow to redirect other rdf formats
let makeprg = self.makeprgBuild({
\ 'args': '-i guess -q --count ',
\ 'args_after': '' })
" Create error format matching lines
" Example output:
" rapper: Error - URI file:///.../file.ttl:39 - syntax error, unexpected a
let errorformat = 'rapper: Error - URI file://%f:%l - %m'
" sets up the environment according to the options given, runs the checker,
" resets the environment, and returns the location list
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat})
endfunction " }}}1
" return a regular expression pattern matching the current error in order to
" highlight parts of the line
function! SyntaxCheckers_turtle_rapper_GetHighlightRegex(item) " {{{1
let term = matchstr(a:item['text'], '\mFailed to convert qname \zs\S\+\ze to URI') let term = matchstr(a:item['text'], '\mFailed to convert qname \zs\S\+\ze to URI')
if term !=# '' return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
let term = '\V' . escape(term, '\') endfunction
endif
return term function! SyntaxCheckers_turtle_rapper_GetLocList() dict
endfunction " }}}1 let makeprg = self.makeprgBuild({ 'args': '-i guess -q --count' })
let errorformat =
\ 'rapper: %trror - URI file://%f:%l - %m,' .
\ 'rapper: %tarning - URI file://%f:%l - %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 1] })
endfunction
" tell syntastic that this plugin exists {{{1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'turtle', \ 'filetype': 'turtle',
\ 'name': 'rapper', \ 'name': 'rapper'})
\ 'exec': 'rapper' })
" }}}1
" reload saved options {{{1
" http://vi.stackexchange.com/questions/2116
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo
" }}}1
" vim: set sw=4 sts=4 et fdm=marker: " vim: set sw=4 sts=4 et fdm=marker: