Ahh, this is better.

This version now works surprisingly well.
It can handle continuation lines, and it can handle input piped from a file.
Of course it still needs work, but this is a nice checkpoint to work from.