Emit comments before nodes (and ends)

Instead of using the source string to figure out which comments are
contiguous.