File: efm_filter.pl

package info (click to toggle)
vim 2%3A7.4.488-7%2Bdeb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 49,660 kB
  • ctags: 31,441
  • sloc: ansic: 309,686; cpp: 4,068; makefile: 3,283; perl: 1,175; awk: 715; sh: 695; xml: 508; lisp: 501; cs: 458; asm: 114; python: 39; csh: 6
file content (39 lines) | stat: -rwxr-xr-x 978 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env perl
#
# This program works as a filter that reads from stdin, copies to
# stdout *and* creates an error file that can be read by vim.
#
# This program has only been tested on SGI, Irix5.3.
#
# Written by Ives Aerts in 1996. This little program is not guaranteed
# to do (or not do) anything at all and can be freely used for
# whatever purpose you can think of.

$args = @ARGV;

unless ($args == 1) {
  die("Usage: vimccparse <output filename>\n");
}

$filename = @ARGV[0];
open (OUT, ">$filename") || die ("Can't open file: \"$filename\"");

while (<STDIN>) {
  print;
  if (   (/"(.*)", line (\d+): (e)rror\((\d+)\):/)
      || (/"(.*)", line (\d+): (w)arning\((\d+)\):/) ) {
    $file=$1;
    $line=$2;
    $errortype="\u$3";
    $errornr=$4;
    chop($errormsg=<STDIN>);
    $errormsg =~ s/^\s*//;
    $sourceline=<STDIN>;
    $column=index(<STDIN>, "^") - 1;

    print OUT "$file>$line:$column:$errortype:$errornr:$errormsg\n";
  }
}

close(OUT);
exit(0);