blob: ad2016905ffc156ad849bf7f01a4282ec386c263 (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
while( $#ARGV > -1 ) {
print "$ARGV[0]\n";
$source = "$ARGV[0]";
if( $source =~ /~$/ ) {
$dest = "$`";
} else {
rename("$source","$source"."~") || die "Cannot rename ($source)";
$dest = "$source";
$source .= "~";
}
open(INPUT,"<$source") || die "Cannot open ($source)";
open(OUTPUT,">$dest") || die "Cannot open ($dest)";
$n = 1;
$prestrip = 0;
while( <INPUT> ) {
chomp;
if( ! $prestrip && /^[0-9]+\.\t/ ) {
$prestrip = 1;
$_ = $';
} elsif( $prestrip ) {
if( /^[0-9]+\.\t/ ) {
$_ = $';
} else {
s/^\t//;
}
}
if( /^\s*$/ || /^\s*({|})\s*;?\s*$/ || /^\s*\/\//
|| /^\s*private\s*:/ || /^\s*protected\s*:/ || /^\s*public\s*:/
|| /^\s*}?\s*else\s*{?\s*:/
) {
print OUTPUT "\t$_\n";
} else {
print OUTPUT "$n.\t$_\n";
++$n;
}
}
close(INPUT);
close(OUTPUT);
shift(@ARGV);
}
|