Bram Moolenaar | 8c1b8cb | 2022-06-14 17:41:28 +0100 | [diff] [blame] | 1 | " 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 Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 9 | |
| 10 | if exists("current_compiler") |
| 11 | finish |
| 12 | endif |
| 13 | let current_compiler = "perl" |
| 14 | |
| 15 | if exists(":CompilerSet") != 2 " older Vim always used :setlocal |
| 16 | command -nargs=* CompilerSet setlocal <args> |
| 17 | endif |
| 18 | |
| 19 | let s:savecpo = &cpo |
| 20 | set cpo&vim |
| 21 | |
Bram Moolenaar | 8c1b8cb | 2022-06-14 17:41:28 +0100 | [diff] [blame] | 22 | if get(g:, 'perl_compiler_force_warnings', 1) |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 23 | let s:warnopt = 'W' |
Bram Moolenaar | 8c1b8cb | 2022-06-14 17:41:28 +0100 | [diff] [blame] | 24 | else |
| 25 | let s:warnopt = 'w' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | endif |
| 27 | |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 28 | if getline(1) =~# '-[^ ]*T' |
| 29 | let s:taintopt = 'T' |
| 30 | else |
| 31 | let s:taintopt = '' |
| 32 | endif |
| 33 | |
Bram Moolenaar | 5477506 | 2019-07-31 21:07:14 +0200 | [diff] [blame] | 34 | exe 'CompilerSet makeprg=perl\ -' . s:warnopt . s:taintopt . 'c\ %:S' |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 35 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 36 | CompilerSet 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 | |
| 50 | let &cpo = s:savecpo |
| 51 | unlet s:savecpo |