File: codestandard.pl

package info (click to toggle)
emboss 6.6.0%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 571,544 kB
  • sloc: ansic: 460,579; java: 29,439; perl: 13,573; sh: 12,754; makefile: 3,283; csh: 706; asm: 351; xml: 239; pascal: 237; modula3: 8
file content (25 lines) | stat: -rwxr-xr-x 502 bytes parent folder | download | duplicates (10)
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
#!/usr/bin/perl -w

$cnt = 0;
$mt="\n";
while (<>) {
    $cnt++;
    if (/^\s*$/ && $lastbrack) {
	printf "%5d< %s", $cnt, $_;
    }
    if (/^\s*[\}]$/ && $lastempty) {
	printf "%5d> %s", $cnt-1, $mt;
    }
    if (/^\s*[\{]\s*$/) {$lastbrack=1}
    else {$lastbrack=0}

    if (/^\s*\/\//) {next}
    if (/\S.*[\{]/) {
	if (/\S.*[\{].*[\}]/) {next}
	if (/\".*[\{]/) {next}
	if (/[=]\s*[\{]/) {next}
	printf "%5d: %s", $cnt, $_;
    }
    if (/^\s*$/) {$lastempty=1;$mt=$_;}
    else {$lastempty=0}
}