Put the actual parsing logic at the top of createSourceFile instead of the bottom.

This makes it vastly simpler to fix up that logic since you no longer have to go find
the end of the function first.