From da6520c69f6556113d791056b7f7956ed39e9019 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 9 Mar 2014 22:21:29 +0200 Subject: [PATCH] \V regexps can spell trouble if contains backslashes. --- plugin/syntastic.vim | 2 +- syntax_checkers/actionscript/mxmlc.vim | 2 +- syntax_checkers/css/prettycss.vim | 2 +- syntax_checkers/javascript/jslint.vim | 2 +- syntax_checkers/lex/flex.vim | 2 +- syntax_checkers/lua/luac.vim | 4 ++-- syntax_checkers/php/php.vim | 2 +- syntax_checkers/po/msgfmt.vim | 2 +- syntax_checkers/python/frosted.vim | 2 +- syntax_checkers/ruby/mri.vim | 2 +- syntax_checkers/texinfo/makeinfo.vim | 2 +- syntax_checkers/text/atdtool.vim | 2 +- syntax_checkers/vim/vimlint.vim | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 1e9203a2..7abb5b00 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.3.0-120' +let g:syntastic_version = '3.3.0-121' " Sanity checks {{{1 diff --git a/syntax_checkers/actionscript/mxmlc.vim b/syntax_checkers/actionscript/mxmlc.vim index 8cfdc347..e423aa0d 100644 --- a/syntax_checkers/actionscript/mxmlc.vim +++ b/syntax_checkers/actionscript/mxmlc.vim @@ -41,7 +41,7 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item) endif - return term != '' ? '\V\<' . term . '\>' : '' + return term != '' ? '\V\<' . escape(term, '\') . '\>' : '' endfunction function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index 536568fa..10d6af3d 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -26,7 +26,7 @@ set cpo&vim function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$') if term != '' - let term = '\V' . term + let term = '\V' . escape(term, '\') endif return term endfunction diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index c233cf34..89d3a802 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -22,7 +22,7 @@ set cpo&vim function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''') if term != '' - let term = '\V' . term + let term = '\V' . escape(term, '\') endif return term endfunction diff --git a/syntax_checkers/lex/flex.vim b/syntax_checkers/lex/flex.vim index c6e48340..b8bc6483 100644 --- a/syntax_checkers/lex/flex.vim +++ b/syntax_checkers/lex/flex.vim @@ -26,7 +26,7 @@ function! SyntaxCheckers_lex_flex_GetHighlightRegex(item) \ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze') endif - return term != '' ? '\V' . term : '' + return term != '' ? '\V' . escape(term, '\') : '' endfunction function! SyntaxCheckers_lex_flex_GetLocList() dict diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index b34778de..012f1490 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -28,7 +28,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) let a:pos['col'] = p[2] let result = '\%' . p[2] . 'c' else - let result = '\V' . near + let result = '\V' . escape(near, '\') endif " XXX the following piece of code is evil, and is likely to break @@ -38,7 +38,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) "if open != '' " let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)')) " let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning' - " call matchadd(group, '\%' . line . 'l\V' . open) + " call matchadd(group, '\%' . line . 'l\V' . escape(open, '\')) "endif endif return result diff --git a/syntax_checkers/php/php.vim b/syntax_checkers/php/php.vim index 3192d7dd..23c1db9e 100644 --- a/syntax_checkers/php/php.vim +++ b/syntax_checkers/php/php.vim @@ -20,7 +20,7 @@ set cpo&vim function! SyntaxCheckers_php_php_GetHighlightRegex(item) let term = matchstr(a:item['text'], "\\munexpected '\\zs[^']\\+\\ze'") - return term != '' ? '\V' . term : '' + return term != '' ? '\V' . escape(term, '\') : '' endfunction function! SyntaxCheckers_php_php_GetLocList() dict diff --git a/syntax_checkers/po/msgfmt.vim b/syntax_checkers/po/msgfmt.vim index 5b714de9..254aa91a 100644 --- a/syntax_checkers/po/msgfmt.vim +++ b/syntax_checkers/po/msgfmt.vim @@ -20,7 +20,7 @@ set cpo&vim function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown') - return term != '' ? '\V' . term : '' + return term != '' ? '\V' . escape(term, '\') : '' endfunction function! SyntaxCheckers_po_msgfmt_GetLocList() dict diff --git a/syntax_checkers/python/frosted.vim b/syntax_checkers/python/frosted.vim index 2b6119ce..5c47de5c 100644 --- a/syntax_checkers/python/frosted.vim +++ b/syntax_checkers/python/frosted.vim @@ -39,7 +39,7 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict if len(parts) >= 4 let e["type"] = parts[1][0] let e["text"] = parts[3] . ' [' . parts[1] . ']' - let e["hl"] = '\V' . parts[2] + let e["hl"] = '\V' . escape(parts[2], '\') elseif e["text"] =~? '\v^I\d+:' let e["valid"] = 0 else diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index c0b0166d..aa7de267 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -21,7 +21,7 @@ set cpo&vim function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) if stridx(a:i['text'], 'assigned but unused variable') >= 0 let term = split(a:i['text'], ' - ')[1] - return '\V\<'.term.'\>' + return '\V\<' . escape(term, '\') . '\>' endif return '' diff --git a/syntax_checkers/texinfo/makeinfo.vim b/syntax_checkers/texinfo/makeinfo.vim index ccd3b2f2..63cae936 100644 --- a/syntax_checkers/texinfo/makeinfo.vim +++ b/syntax_checkers/texinfo/makeinfo.vim @@ -20,7 +20,7 @@ set cpo&vim function! SyntaxCheckers_texinfo_makeinfo_GetHighlightRegex(item) let term = matchstr(a:item['text'], "\\m`\\zs[^']\\+\\ze'") - return term != '' ? '\V' . term : '' + return term != '' ? '\V' . escape(term, '\') : '' endfunction function! SyntaxCheckers_texinfo_makeinfo_GetLocList() dict diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 5a8ea0c7..b0f32c11 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -22,7 +22,7 @@ function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') if term != '' let col = get(a:item, 'col', 0) - let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . term + let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . escape(term, '\') endif return term endfunction diff --git a/syntax_checkers/vim/vimlint.vim b/syntax_checkers/vim/vimlint.vim index 7f380d7b..d0916dce 100644 --- a/syntax_checkers/vim/vimlint.vim +++ b/syntax_checkers/vim/vimlint.vim @@ -29,7 +29,7 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item) endif endif - return '\V' . (col ? '\%' . col . 'c' : '') . term + return '\V' . (col ? '\%' . col . 'c' : '') . escape(term, '\') endif return ''