summaryrefslogtreecommitdiff
path: root/tools/indenter-cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-12-23 19:40:38 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-12-24 00:36:04 -0800
commitf71413176f32ef642824456544ecbda5933a0944 (patch)
tree84cad0936a4fc3b274dcdb9a7239da202f9407cc /tools/indenter-cpp
parente342dbed1e87916aef984ca5d25f5ab93af46ebc (diff)
downloadtmwa-f71413176f32ef642824456544ecbda5933a0944.tar.gz
tmwa-f71413176f32ef642824456544ecbda5933a0944.tar.bz2
tmwa-f71413176f32ef642824456544ecbda5933a0944.tar.xz
tmwa-f71413176f32ef642824456544ecbda5933a0944.zip
Add non-indenting indenter for C++
Fix a bunch of bugs that none of me noticed before.
Diffstat (limited to 'tools/indenter-cpp')
-rwxr-xr-xtools/indenter-cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/indenter-cpp b/tools/indenter-cpp
new file mode 100755
index 0000000..bcdf2e0
--- /dev/null
+++ b/tools/indenter-cpp
@@ -0,0 +1,9 @@
+#!/bin/bash -e
+# this is the implementation of indenter -cpp
+set -o pipefail
+expand |
+sed -e 's:^ *//:&&:' -e 's:^ *#://#:' |
+indenter -ipp |
+sed -e 's:^ *// *#:#:' -e 's:^\( *//\) *//:\1:' |
+pp-indent |
+bs-align