blob: a857caed8f7583defe1e2abda0ecbdd2611a80eb [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim Compiler File
2" Compiler: Perl syntax checks (perl -Wc)
Bram Moolenaara3ff49f2010-05-30 22:48:02 +02003" Maintainer: Christian J. Robinson <heptite@gmail.com>
Bram Moolenaar54775062019-07-31 21:07:14 +02004" Last Change: 2019 Jul 22
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
6if exists("current_compiler")
7 finish
8endif
9let current_compiler = "perl"
10
11if exists(":CompilerSet") != 2 " older Vim always used :setlocal
12 command -nargs=* CompilerSet setlocal <args>
13endif
14
15let s:savecpo = &cpo
16set cpo&vim
17
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000018if exists('g:perl_compiler_force_warnings') && g:perl_compiler_force_warnings == 0
19 let s:warnopt = 'w'
Bram Moolenaar071d4272004-06-13 20:20:40 +000020else
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000021 let s:warnopt = 'W'
Bram Moolenaar071d4272004-06-13 20:20:40 +000022endif
23
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000024if getline(1) =~# '-[^ ]*T'
25 let s:taintopt = 'T'
26else
27 let s:taintopt = ''
28endif
29
Bram Moolenaar54775062019-07-31 21:07:14 +020030exe 'CompilerSet makeprg=perl\ -' . s:warnopt . s:taintopt . 'c\ %:S'
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000031
Bram Moolenaar071d4272004-06-13 20:20:40 +000032CompilerSet errorformat=
33 \%-G%.%#had\ compilation\ errors.,
34 \%-G%.%#syntax\ OK,
35 \%m\ at\ %f\ line\ %l.,
36 \%+A%.%#\ at\ %f\ line\ %l\\,%.%#,
37 \%+C%.%#
38
39" Explanation:
40" %-G%.%#had\ compilation\ errors., - Ignore the obvious.
41" %-G%.%#syntax\ OK, - Don't include the 'a-okay' message.
42" %m\ at\ %f\ line\ %l., - Most errors...
43" %+A%.%#\ at\ %f\ line\ %l\\,%.%#, - As above, including ', near ...'
44" %+C%.%# - ... Which can be multi-line.
45
46let &cpo = s:savecpo
47unlet s:savecpo