FWIW, a similar tool exists that works with most C-style languages, `uncrustify`. Might be worth looking into as well?
http://uncrustify.sourceforge.net