@snoofle said:
20+ years ago, before I encountered my first code beautifier, I used to brute force the 'beautification process' by doing the following:
cat the source file into a stream, splitting it into one word per lineThen I had a simple program that indented 3 spaces for each opened block - just ran the code through it and voila: formatted, [un]capitalized reserved/DB words, etc. It all ran as a single shell script, so it was easy to use. Of course, it was fully documented as it wasn't at all obvious how it did what it did, as it was one long chain of piped commands... Crude by today's standards, but in its day, it beat doing it by hand.
pipe through sed to strip out numbers and assorted punctuation
pipe through uniq
pipe through a canned script to strip out the reserved words of the language
pipe through a canned script to split into 2 files: one with DB reserved words, one without
cat each into a sed script to generate a shell file that runs sed on each word to [un]cap it
then run the whole thing on the source file.
A lazier developer would have invented Perl to solve this problem for them.