summaryrefslogtreecommitdiffstats
path: root/scripts/whitespace.pl
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-13 22:08:09 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-13 22:10:21 -0800
commitebac81b784056cd288a5b69f7c341fecdc89d5e5 (patch)
treef76b79a6a040e772babc52ce4c7086fc4038cffd /scripts/whitespace.pl
parent51220f26ef712c31a9a7213807787829d4bb4818 (diff)
downloadsubsurface-ebac81b784056cd288a5b69f7c341fecdc89d5e5.tar.gz
Fine tuning of the whitespace / coding style post processing
The struct / class regex was way too relaxed. Having the parent class on the same line usually looks better. clang-format appears to do something odd with continuation strings - even with UseTab: Always it indents those with four spaces. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'scripts/whitespace.pl')
-rw-r--r--scripts/whitespace.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/whitespace.pl b/scripts/whitespace.pl
index 1d6548092..ad5380442 100644
--- a/scripts/whitespace.pl
+++ b/scripts/whitespace.pl
@@ -3,9 +3,10 @@
my $input = $ARGV[0];
my $source = `clang-format $input`;
$source =~ s/^(.*each.*\(.*\).*)\n\s*{\s*$/$1 {/img;
-$source =~ s/^(.*struct.*)\n\s*{\s*$/$1 {/img;
-$source =~ s/^(.*class.*)\n\s*{\s*$/$1 {/img;
-$source =~ s/^(\S*::\S*.*)\n\s*: /$1 :\n\t/img;
+$source =~ s/^(\s*struct.*)\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 ;