\V<pattern> regexps can spell trouble if <pattern> contains backslashes.
This commit is contained in:
parent
223d00a0f0
commit
da6520c69f
@ -18,7 +18,7 @@ if has('reltime')
|
|||||||
let g:syntastic_start = reltime()
|
let g:syntastic_start = reltime()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:syntastic_version = '3.3.0-120'
|
let g:syntastic_version = '3.3.0-121'
|
||||||
|
|
||||||
" Sanity checks {{{1
|
" Sanity checks {{{1
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return term != '' ? '\V\<' . term . '\>' : ''
|
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
|
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
|
||||||
|
@ -26,7 +26,7 @@ set cpo&vim
|
|||||||
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
|
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$')
|
let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$')
|
||||||
if term != ''
|
if term != ''
|
||||||
let term = '\V' . term
|
let term = '\V' . escape(term, '\')
|
||||||
endif
|
endif
|
||||||
return term
|
return term
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -22,7 +22,7 @@ set cpo&vim
|
|||||||
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
|
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
|
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
|
||||||
if term != ''
|
if term != ''
|
||||||
let term = '\V' . term
|
let term = '\V' . escape(term, '\')
|
||||||
endif
|
endif
|
||||||
return term
|
return term
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -26,7 +26,7 @@ function! SyntaxCheckers_lex_flex_GetHighlightRegex(item)
|
|||||||
\ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze')
|
\ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return term != '' ? '\V' . term : ''
|
return term != '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_lex_flex_GetLocList() dict
|
function! SyntaxCheckers_lex_flex_GetLocList() dict
|
||||||
|
@ -28,7 +28,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
|
|||||||
let a:pos['col'] = p[2]
|
let a:pos['col'] = p[2]
|
||||||
let result = '\%' . p[2] . 'c'
|
let result = '\%' . p[2] . 'c'
|
||||||
else
|
else
|
||||||
let result = '\V' . near
|
let result = '\V' . escape(near, '\')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" XXX the following piece of code is evil, and is likely to break
|
" 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 != ''
|
"if open != ''
|
||||||
" let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)'))
|
" let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)'))
|
||||||
" let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
" 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
|
||||||
endif
|
endif
|
||||||
return result
|
return result
|
||||||
|
@ -20,7 +20,7 @@ set cpo&vim
|
|||||||
|
|
||||||
function! SyntaxCheckers_php_php_GetHighlightRegex(item)
|
function! SyntaxCheckers_php_php_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], "\\munexpected '\\zs[^']\\+\\ze'")
|
let term = matchstr(a:item['text'], "\\munexpected '\\zs[^']\\+\\ze'")
|
||||||
return term != '' ? '\V' . term : ''
|
return term != '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_php_php_GetLocList() dict
|
function! SyntaxCheckers_php_php_GetLocList() dict
|
||||||
|
@ -20,7 +20,7 @@ set cpo&vim
|
|||||||
|
|
||||||
function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item)
|
function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown')
|
let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown')
|
||||||
return term != '' ? '\V' . term : ''
|
return term != '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_po_msgfmt_GetLocList() dict
|
function! SyntaxCheckers_po_msgfmt_GetLocList() dict
|
||||||
|
@ -39,7 +39,7 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict
|
|||||||
if len(parts) >= 4
|
if len(parts) >= 4
|
||||||
let e["type"] = parts[1][0]
|
let e["type"] = parts[1][0]
|
||||||
let e["text"] = parts[3] . ' [' . parts[1] . ']'
|
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+:'
|
elseif e["text"] =~? '\v^I\d+:'
|
||||||
let e["valid"] = 0
|
let e["valid"] = 0
|
||||||
else
|
else
|
||||||
|
@ -21,7 +21,7 @@ set cpo&vim
|
|||||||
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
||||||
if stridx(a:i['text'], 'assigned but unused variable') >= 0
|
if stridx(a:i['text'], 'assigned but unused variable') >= 0
|
||||||
let term = split(a:i['text'], ' - ')[1]
|
let term = split(a:i['text'], ' - ')[1]
|
||||||
return '\V\<'.term.'\>'
|
return '\V\<' . escape(term, '\') . '\>'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
@ -20,7 +20,7 @@ set cpo&vim
|
|||||||
|
|
||||||
function! SyntaxCheckers_texinfo_makeinfo_GetHighlightRegex(item)
|
function! SyntaxCheckers_texinfo_makeinfo_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], "\\m`\\zs[^']\\+\\ze'")
|
let term = matchstr(a:item['text'], "\\m`\\zs[^']\\+\\ze'")
|
||||||
return term != '' ? '\V' . term : ''
|
return term != '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_texinfo_makeinfo_GetLocList() dict
|
function! SyntaxCheckers_texinfo_makeinfo_GetLocList() dict
|
||||||
|
@ -22,7 +22,7 @@ function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item)
|
|||||||
let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)')
|
let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)')
|
||||||
if term != ''
|
if term != ''
|
||||||
let col = get(a:item, 'col', 0)
|
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
|
endif
|
||||||
return term
|
return term
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -29,7 +29,7 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return '\V' . (col ? '\%' . col . 'c' : '') . term
|
return '\V' . (col ? '\%' . col . 'c' : '') . escape(term, '\')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user