rust/src/etc/indenter

17 lines
238 B
Plaintext
Raw Normal View History

2012-04-17 08:01:17 -07:00
#!/usr/bin/perl
use strict;
use warnings;
2012-04-05 20:59:07 -07:00
2012-04-17 08:01:17 -07:00
my $indent = 0;
2012-04-05 20:59:07 -07:00
while (<>) {
if (/^rust: ~">>/) {
2012-04-05 20:59:07 -07:00
$indent += 1;
}
2012-04-17 08:01:17 -07:00
printf "%03d %s%s", $indent, (" " x $indent), $_;
2012-04-21 10:04:58 -07:00
if (/^rust: ~"<</) {
2012-04-21 10:04:58 -07:00
$indent -= 1;
}
2012-04-05 20:59:07 -07:00
}