summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/unbrace
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-02-17 13:37:52 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-02-17 13:37:52 +0100
commitd718302dd85eadbd72657d44b44d728a9e4c25a9 (patch)
tree791a4d6e9f4479d090c43065402f32b4a0f0f41c /crawl-ref/source/util/unbrace
parentf09a4b33f069bd5ed7a9c1bc0f7eec77a6c83100 (diff)
downloadcrawl-ref-d718302dd85eadbd72657d44b44d728a9e4c25a9.tar.gz
crawl-ref-d718302dd85eadbd72657d44b44d728a9e4c25a9.zip
The bracecider script.
Diffstat (limited to 'crawl-ref/source/util/unbrace')
-rwxr-xr-xcrawl-ref/source/util/unbrace19
1 files changed, 19 insertions, 0 deletions
diff --git a/crawl-ref/source/util/unbrace b/crawl-ref/source/util/unbrace
new file mode 100755
index 0000000000..13866cb919
--- /dev/null
+++ b/crawl-ref/source/util/unbrace
@@ -0,0 +1,19 @@
+#!/usr/bin/perl -w
+
+undef $/;
+for $f (grep /\.(cc|h)$/, split /\n/, `git ls-files`)
+{
+ open F, "<", $f or die "Can't read $f\n";
+ $_ = <F>;
+ close F;
+
+ # Aaaw, due to the support code, this beautiful one-liner is one no longer :(
+ # Should have told you to:
+ # for x in *.cc *.h;do unbrace <"$x" >aa && mv aa "$x";done
+ # like I always did before...
+ s&^( +(?:if|while|for|do|else)\b[^\n]*)\n +{\n( *[^/ }][^\n]*)\n +}$&$1\n$2&msg;
+
+ open F, ">", $f or die "Can't write $f\n";
+ print F;
+ close F;
+}