blob: 21e384fb8522a5e38a3441644e5e42e0cb4f1634 [file] [log] [blame]
Bram Moolenaar8c1b8cb2022-06-14 17:41:28 +01001" Vim compiler file
2" Compiler: Perl syntax checks (perl -Wc)
3" Maintainer: vim-perl <vim-perl@googlegroups.com>
4" Author: Christian J. Robinson <heptite@gmail.com>
5" Homepage: https://github.com/vim-perl/vim-perl
6" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
7" License: Vim License (see :help license)
8" Last Change: 2021 Nov 2
Bram Moolenaar071d4272004-06-13 20:20:40 +00009
10if exists("current_compiler")
11 finish
12endif
13let current_compiler = "perl"
14
15if exists(":CompilerSet") != 2 " older Vim always used :setlocal
16 command -nargs=* CompilerSet setlocal <args>
17endif
18
19let s:savecpo = &cpo
20set cpo&vim
21
Bram Moolenaar8c1b8cb2022-06-14 17:41:28 +010022if get(g:, 'perl_compiler_force_warnings', 1)
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000023 let s:warnopt = 'W'
Bram Moolenaar8c1b8cb2022-06-14 17:41:28 +010024else
25 let s:warnopt = 'w'
Bram Moolenaar071d4272004-06-13 20:20:40 +000026endif
27
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000028if getline(1) =~# '-[^ ]*T'
29 let s:taintopt = 'T'
30else
31 let s:taintopt = ''
32endif
33
Bram Moolenaar54775062019-07-31 21:07:14 +020034exe 'CompilerSet makeprg=perl\ -' . s:warnopt . s:taintopt . 'c\ %:S'
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000035
Bram Moolenaar071d4272004-06-13 20:20:40 +000036CompilerSet errorformat=
37 \%-G%.%#had\ compilation\ errors.,
38 \%-G%.%#syntax\ OK,
39 \%m\ at\ %f\ line\ %l.,
40 \%+A%.%#\ at\ %f\ line\ %l\\,%.%#,
41 \%+C%.%#
42
43" Explanation:
44" %-G%.%#had\ compilation\ errors., - Ignore the obvious.
45" %-G%.%#syntax\ OK, - Don't include the 'a-okay' message.
46" %m\ at\ %f\ line\ %l., - Most errors...
47" %+A%.%#\ at\ %f\ line\ %l\\,%.%#, - As above, including ', near ...'
48" %+C%.%# - ... Which can be multi-line.
49
50let &cpo = s:savecpo
51unlet s:savecpo