Handle empty source, with and without comments

Fixes #336.