From 4ceba225c81f337caf42a82d00a4cc9456521748 Mon Sep 17 00:00:00 2001 From: Joshua Downer Date: Mon, 11 Apr 2016 20:27:34 -0400 Subject: [PATCH 1/4] added pyang.vim to syntax checkers --- plugin/syntastic/registry.vim | 1 + syntax_checkers/yang/pyang.vim | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 syntax_checkers/yang/pyang.vim diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index f97f7a2d..74fade22 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -102,6 +102,7 @@ let s:_DEFAULT_CHECKERS = { \ 'xquery': ['basex'], \ 'yacc': ['bison'], \ 'yaml': ['jsyaml'], + \ 'yang': ['pyang'], \ 'z80': ['z80syntaxchecker'], \ 'zpt': ['zptlint'], \ 'zsh': ['zsh'], diff --git a/syntax_checkers/yang/pyang.vim b/syntax_checkers/yang/pyang.vim new file mode 100644 index 00000000..42514dcf --- /dev/null +++ b/syntax_checkers/yang/pyang.vim @@ -0,0 +1,36 @@ +"============================================================================ +"File: pyang.vim +"Description: Syntax checking plugin for syntastic.vim +"Authors: joshua.downer@gmail.com +" +"============================================================================ + +if exists('g:loaded_syntastic_yang_pyang_checker') + finish +endif +let g:loaded_syntastic_yang_pyang_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_yang_pyang_GetLocList() dict + let makeprg = self.makeprgBuild({}) + + let errorformat = '%f:%l:%m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'postprocess': ['filterForeignErrors'] }) +endfunction + +runtime! syntax_checkers/yang/pyang.vim + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'yang', + \ 'name': 'pyang'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: From 035b1551188ba29327e26d3389692fc3743f7787 Mon Sep 17 00:00:00 2001 From: Joshua Downer Date: Tue, 12 Apr 2016 05:21:56 -0400 Subject: [PATCH 2/4] added license to pyang.vim --- syntax_checkers/yang/pyang.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/syntax_checkers/yang/pyang.vim b/syntax_checkers/yang/pyang.vim index 42514dcf..3b23c899 100644 --- a/syntax_checkers/yang/pyang.vim +++ b/syntax_checkers/yang/pyang.vim @@ -2,6 +2,11 @@ "File: pyang.vim "Description: Syntax checking plugin for syntastic.vim "Authors: joshua.downer@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. " "============================================================================ From daffe39dcfd70513e7ccf0e5e765fb492c0e374f Mon Sep 17 00:00:00 2001 From: Joshua Downer Date: Tue, 12 Apr 2016 07:02:19 -0400 Subject: [PATCH 3/4] identify errors and warnings --- syntax_checkers/yang/pyang.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/yang/pyang.vim b/syntax_checkers/yang/pyang.vim index 3b23c899..68e5d85f 100644 --- a/syntax_checkers/yang/pyang.vim +++ b/syntax_checkers/yang/pyang.vim @@ -21,7 +21,9 @@ set cpo&vim function! SyntaxCheckers_yang_pyang_GetLocList() dict let makeprg = self.makeprgBuild({}) - let errorformat = '%f:%l:%m' + let errorformat = + \ '%W%f:%l: warning: %m,' . + \ '%E%f:%l: error: %m' return SyntasticMake({ \ 'makeprg': makeprg, From 36f84ef79d8442b49e811f6a95a4a8c2e78df269 Mon Sep 17 00:00:00 2001 From: Joshua Downer Date: Tue, 12 Apr 2016 07:02:58 -0400 Subject: [PATCH 4/4] remove unnecessary call to runtime! --- syntax_checkers/yang/pyang.vim | 2 -- 1 file changed, 2 deletions(-) diff --git a/syntax_checkers/yang/pyang.vim b/syntax_checkers/yang/pyang.vim index 68e5d85f..5f247eb2 100644 --- a/syntax_checkers/yang/pyang.vim +++ b/syntax_checkers/yang/pyang.vim @@ -31,8 +31,6 @@ function! SyntaxCheckers_yang_pyang_GetLocList() dict \ 'postprocess': ['filterForeignErrors'] }) endfunction -runtime! syntax_checkers/yang/pyang.vim - call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'yang', \ 'name': 'pyang'})