summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/whitespace.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/whitespace.pl b/scripts/whitespace.pl
new file mode 100644
index 000000000..1d6548092
--- /dev/null
+++ b/scripts/whitespace.pl
@@ -0,0 +1,11 @@
+#! /usr/bin/perl
+
+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/(?:\G|^)[ ]{6}/\t/mg;
+open (DIFF, "| diff -u $input -");
+print DIFF $source ;