mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
42f32671a8
The more I try the cleanup helper, the more corner cases I find... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
15 lines
588 B
Perl
15 lines
588 B
Perl
#! /usr/bin/perl
|
|
|
|
my $input = $ARGV[0];
|
|
my $source = `clang-format $input`;
|
|
$source =~ s/^(.*each.*\(.*\).*)\n\s*{\s*$/$1 {/img;
|
|
$source =~ s/^(\s*struct[^()\n]*)\n\s*{\s*$/$1 {/img;
|
|
$source =~ s/^(\s*static\s+struct[^()\n]*)\n\s*{\s*$/$1 {/img;
|
|
$source =~ s/^(\s*union[^()\n]*)\n\s*{\s*$/$1 {/img;
|
|
$source =~ s/^(\s*static\s+union[^()\n]*)\n\s*{\s*$/$1 {/img;
|
|
$source =~ s/^(\s*class.*)\n\s*{\s*$/$1 {/img;
|
|
$source =~ s/^(\S*::\S*.*)\n\s*: /$1 : /img;
|
|
$source =~ s/(?:\G|^)[ ]{6}/\t/mg;
|
|
$source =~ s/(?:\G|^)(\t*)[ ]{4}"/$1\t"/mg;
|
|
open (DIFF, "| diff -u $input -");
|
|
print DIFF $source ;
|