PHP: Make parser work with more error messages

This commit is contained in:
Adriaan Zonnenberg
2017-02-18 00:51:33 +01:00
parent a18e172a96
commit cca0222cf1
2 changed files with 22 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ function! ale_linters#php#php#Handle(buffer, lines) abort
" Matches patterns like the following:
"
" PHP Parse error: syntax error, unexpected ';', expecting ']' in - on line 15
let l:pattern = ':\s\+\(.\+unexpected ''\(.\{-}\)''.*\) in - on line \(\d\+\)'
let l:pattern = 'Parse error:\s\+\(.\{-}unexpected ''\(.\{-}\)''.\{-}\|.*\) in - on line \(\d\+\)'
let l:output = []
@@ -21,7 +21,7 @@ function! ale_linters#php#php#Handle(buffer, lines) abort
\ 'bufnr': a:buffer,
\ 'lnum': l:match[3] + 0,
\ 'vcol': 0,
\ 'col': match(getline(l:match[3]), l:match[2]) + 1,
\ 'col': empty(l:match[2]) ? 0 : stridx(getline(l:match[3]), l:match[2]) + 1,
\ 'text': l:match[1],
\ 'type': 'E',
\ 'nr': -1,