Merge branch 'vim' into feat/float-point-ext
[vim_extended.git] / runtime / tools / efm_filter.pl
blob1d1a4f303bc0373de751c875e06e6e46eb4f25a0
1 #!/usr/bin/env perl
3 # This program works as a filter that reads from stdin, copies to
4 # stdout *and* creates an error file that can be read by vim.
6 # This program has only been tested on SGI, Irix5.3.
8 # Written by Ives Aerts in 1996. This little program is not guaranteed
9 # to do (or not do) anything at all and can be freely used for
10 # whatever purpose you can think of.
12 $args = @ARGV;
14 unless ($args == 1) {
15 die("Usage: vimccparse <output filename>\n");
18 $filename = @ARGV[0];
19 open (OUT, ">$filename") || die ("Can't open file: \"$filename\"");
21 while (<STDIN>) {
22 print;
23 if ( (/"(.*)", line (\d+): (e)rror\((\d+)\):/)
24 || (/"(.*)", line (\d+): (w)arning\((\d+)\):/) ) {
25 $file=$1;
26 $line=$2;
27 $errortype="\u$3";
28 $errornr=$4;
29 chop($errormsg=<STDIN>);
30 $errormsg =~ s/^\s*//;
31 $sourceline=<STDIN>;
32 $column=index(<STDIN>, "^") - 1;
34 print OUT "$file>$line:$column:$errortype:$errornr:$errormsg\n";
38 close(OUT);
39 exit(0);