Source

shlomi-fish-homepage / bin / indent-define-tag.pl

Full commit
shl...@cec68495-… 1272241 


Shlomi Fish 44c7eaf 
shl...@cec68495-… 1272241 




Shlomi Fish 44c7eaf 
shl...@cec68495-… 1272241 


Shlomi Fish 44c7eaf 
shl...@cec68495-… 1272241 



Shlomi Fish 44c7eaf 
shl...@cec68495-… 1272241 










use strict;
use warnings;

my $indent=0;
my $line_num = 1;
while(<>)
{
    my $open = m!<define!;
    my $close = m!</define!;
    if($close && (!$open))
    {
        $indent--;
    }

    if ($open || $close)
    {
    print sprintf("%-4s: ", $line_num) . (($indent>=0)?
        "    "x$indent:
        "ERRR"x(-$indent)).$_;
    }

    if ($open && (!$close))
    {
        $indent++;
    }
}
continue
{
    $line_num++;
}