summaryrefslogtreecommitdiff
path: root/support/tex-it/chkscr.pl
blob: b37c52f72a77eb204736dd1a5e58278b6ea44e59 (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
#!/usr/local/bin/perl

$prevline = "";
@badlines = ();
$prevbad = 0;
while (<>) {
    chop;

    push (@badlines, $_) if $prevbad;
    $prevbad = 0;
    next if /\s*#/;
    next if /.*\}\s*$/;
    next if /.*\{\s*$/;
    next if /.*,\s*$/;
    next if /^\s*$/;

    if (!/.*;\s*$/) {
	push (@badlines, $_);
	$prevbad = 1;
    }
}

$even = 0;
foreach $line (@badlines) {
    if ($even) {
	$ok = 0;
	if ($line =~ /.*;\s*$/ && $line =~ /^\s*if/) {
	    $ok = 1;
	}
	if (! $ok) {
	    print "---\n";
	    print $prevline, "\n";
	    print $line, "\n";
	}

	$even = 0;
    } else {
	$even = 1;
	$prevline = $line;
    }
}