haml: small regex tune

This commit is contained in:
kongo2002 2010-12-26 10:33:49 +08:00 committed by Chris Hoffman
parent 4de05651aa
commit f8cb300890

View File

@ -23,8 +23,8 @@ function! SyntaxCheckers_haml_GetLocList()
let output = system("haml -c " . shellescape(expand("%"))) let output = system("haml -c " . shellescape(expand("%")))
if v:shell_error != 0 if v:shell_error != 0
"haml only outputs the first error, so parse it ourselves "haml only outputs the first error, so parse it ourselves
let line = substitute(output, '^\(Syntax\|Haml\) error on line \(\d*\):.*', '\2', '') let line = substitute(output, '^\%(Syntax\|Haml\) error on line \(\d*\):.*', '\1', '')
let msg = substitute(output, '^\(Syntax\|Haml\) error on line \d*:\(.*\)', '\2', '') let msg = substitute(output, '^\%(Syntax\|Haml\) error on line \d*:\(.*\)', '\1', '')
return [{'lnum' : line, 'text' : msg, 'bufnr': bufnr(""), 'type': 'E' }] return [{'lnum' : line, 'text' : msg, 'bufnr': bufnr(""), 'type': 'E' }]
endif endif
return [] return []